November 30, 2013
about a year ago
Having spent a lot of time with this WTV020SD device based board and “the-rebel-agent” control library, I suspect some might appreciate my sharing a little of my experience…
What appeared to make my sound card ‘work’ well via serial I/0 and the “the-rebel-agent” library, included:
5v > 3.3v signal conditioning (voltage dividers) between Arduino outputs and sound card inputs
increasing post reset delay (by waiting for busy assertion + deassertion + 13ms)
increasing post audio play delay (by waiting for busy assertion)
I conditioned the DCLK, DIN and RESET signals with voltage dividers. Each Arduino pin drives its corresponding sound card pin via a 56 ohm resistor. Each sound card pin has a 100 ohm resistor to ground. This reduces the maximum sound card input voltage to about 2.5v. Before I did this the sound card would not work and its supply voltage was jumping up close to 4 volts (due to input diode conduction and high Arduino output pin voltage). I should admit that I have not retried the sound card without these level shifters, so can’t be sure if I made other changes to my configuration that actually ‘fixed’ my operational problem.
For what its worth my configuration/connectivity:
OSSEP Arduino Uno with 5v supply
sound card/device: WTV020SD-20SS NO.17 1208 RSH6530G_3H
microSD card: Strontium SD class4 2GB FAT formatted.
serial I/O Control utilized (‘MP3’ mode was not tested)
microSD Audio Module powered with 3.3V from Arduino UNO
How might “the-rebel-agent” library be improved - for everyone?
increase post reset and post play delays (my custom library waits for busy events)
error checking and reporting logic i.e. busy asserted/or not when expected (trivial to help users debug!)
volume control and other features (e.g. loop play single/all files)
DIN low when commands not sent (to save power IF voltage dividers used)
Where is the library not like the spec and perhaps less efficient?
clock period is currently set to be >10 times longer then spec indicates
data setup/hold to rising edge of clock is not balanced as per spec diagram
clock state during reset set low, though spec shows/suggests otherwise
What else have I learned/found/done?
A WTV020SD Chinese data sheet - mostly but not completely identical to the English one circulating.
commands 0xFFFB, 0xFFFC and 0xFFFD loop a single audio file, all the files or stop looping. I have not been able to make the loop commands work reliably with AD4 files. File size may be important. This may explain why they were not translated into the english document.
observed that minimum clock period required is actually less then 10% of specified (for my device)
busy asserted during ‘paused’ playback
busy asserts (for a while) after reset command
I rebuilt/‘fixed’ the library, added delays, play retry post reset, made it data sheet consistent, identified set volume etc commands
the sound card has a 5v to 3.3v supply regulator, and if used, might reduce noise on audio output
Simplify my reset connection by using a diode during pull down and relying on the board pull-up circuit? This has yet to be tried and would have the added benefit of reducing power slightly.
Play after reset fails when audio module powered up after being unpowered for a while… (presumably allowing supply capacitors, to completely discharge). I modified my library to retry the first play command after reset, if the first attempt fails.
Play after stop fails under certain conditions and can be ‘fixed’ (on my card,) by adding a 1ms delay between the two commands. I added a 10ms delay following each command (yes I know I could have targeted only the stop commands).
Chinese Data sheet: (Google translate does work for this but … ever hear of GIGO? )
What would have saved many users a lot of time:
A complete data sheet in English with clarifications of device variants, correct timing diagrams and device min/typ/max specifications and characteristics.
What I would appreciate:
Jeff Niergarth -electrical engineer with extensive hardware/software development experience…
The Wtv020sd device on the sound card should work with ‘3.3v’ supply voltages between DC2.5～3.6V as per the chinese data sheet.
The problem with batteries is that their voltage can vary considerably over their life… and under load, particularly if weak or of low capacity.
The sound card may draw considerable current when playing audio:
Any batteries or on-board supply that can maintain their voltage as above with a 100ma load may be acceptable to it.
On the microSD Audio Module there is an on-board regulator that accepts a higher supply voltage via the VCC hole/signal and drops it down to ‘well regulated’ 3.3v…
This regulator will accept up to 12v via VCC. I would expect this would work fine from 3.8V to 5V. At higher voltages the regulator device might start to over-heat… and possibly even burn out - while playing certain audio files.
You will have more leeway with sagging battery voltage if you use the VCC connection to provide power - at the expense of additional power/energy lost through the on-board voltage regulator.
Busy is set while audio is playing… The library playVoice function utilizes this characteristic.
This guy measured power consumption during playback. If you know your battery capacity, given the current drain, you should be able to predict longevity:
END OF MESSAGE
There is a backdoor in the asnycPlayVoice command that gives the user access to all device commands:
wtv020sd16p.asyncPlayVoice(0xFFF0); // Sets voice to minimum (off)
wtv020sd16p.asyncPlayVoice(0xFFFx); // Sets voice to level where x ranges from 0 (no-sound) to 7(max)
wtv020sd16p.asyncPlayVoice(0xFFF7); // Sets voice to maximum
You can also initiate single/all voice file loopback (and stop) via these commands:
wtv020sd16p.asyncPlayVoice(0xFFFB); // loops back current audio file being played, indefinitely
wtv020sd16p.asyncPlayVoice(0xFFFC); // loops back “all” audio files from the one being played..
wtv020sd16p.asyncPlayVoice(0xFFFD); // stops any loop back.
Note these last three commands appear to be buggy… File size/type may be important…
It is trivial to add a volume setting command to the-rebel-agent library, for control of the card via an arduino.
Some anecdotal information here on power consumption:
As many have reported success with FAT formated 2G micro-sd cards, you are certainly OK to try them. That having been said, I don’t know of anyone who has tried filling their 2G micro-sd cards past the 1G point to check IF the sound card can address more then 1GB of memory. Given how files tend to get fragmented over a storage medium’s space (as they are created and ‘deleted’,) I suspect someone has already inadvertently tested this on a heavily used 2G sd card…
The microSD audio module’s Wtv020sd chip uses PWM to produce sound. It does not require Arduino driven PWM signals to control it via Data/Clock/Reset signals… although… a very clever programmer with much time to waste might be able to do this!.(I doubt anyone has taken on this -dubious- challenge.) Of more interest is the observation that this technique (i.e. ‘needlessly’ using Arduino PWM controlled pins to drive DCLK and DIN signals,) might not significantly increase device commands, given ‘the_rebel_agent’s current/original? library takes 10 times longer to shift in device commands then the datasheet suggests is necessary… (i.e. about 30mS longer).
No public wish lists :(
Forgot your password?
No account? Register one!