Go Down

Topic: Toy audio reconstruction (Read 471 times) previous topic - next topic

Dash4g

Jan 03, 2019, 10:35 pm Last Edit: Jan 03, 2019, 10:40 pm by Dash4g
In a nutshell, I am trying to change the voice of toys to a different language.



There are many toys I am hoping to change, but I am looking to re-purpose the:
  • Battery pack (often 3x AA batteries)
  • Built-in speaker
  • Inputs (buttons, switches)

I have been able to use a few different modules from sparkfun and aliexpress, which essentially do the same thing:


For other toys which have more conditional inputs (like this seat or this book) I was hoping to use a DFPlayer, arduino and communicate over serial with the digital pins to allow for the conditional statements.

*If (page 1 open) && (button 2) then play AudioFile1.wav

A few challenges with this project are:
  • Battery life of a dfplayer  (3xAA batteries wont last hours, let alone weeks or months of shelf life)
  • Max size of a inputs (by my count, i'd have 36 button pushes for that book and over 110 audio files)

Before I go too far, I thought I would throw it out there to see if anyone had any ideas to limit the power consumption of this setup and utilize a better method of inputs.

PaulRB

#1
Jan 03, 2019, 10:48 pm Last Edit: Jan 03, 2019, 11:03 pm by PaulRB
I don't know about the SparkFun module, but the DFPlayer module is not very efficient for use in battery powered circuits. Even when not playing, it consumes a lot of current, as you point out.

Here's the start of an idea. Many of the more "modern" Arduino boards, based on samd21 or esp32 chips, have a DAC output. Some have built in sd card readers. Add a small amplifier. You may have to record the audio files in WAV format instead of MP3, but high capacity SD cards are cheap these days. Research the board first to make sure it has a low current usage when in some kind of sleep mode. Many are not great at this, not because of the chip, but because of the other components in the boards, such as power regulators, power LEDs etc. You need to get the sleep current down to less than 1mA, but the lower the better. So careful research needed. Also check that the SD card reader and amplifier modules have a pin which shuts them down into a very low power mode, so the Arduino can shut them down when not needed.

vinceherman

How fast does it initialize?
I have seen threads here that have a circuit that wakes up when a button is pushed, runs to completion and then powers down.

PaulRB

#3
Jan 03, 2019, 11:25 pm Last Edit: Jan 04, 2019, 12:23 am by PaulRB
Low Power Labs Motino M0 is an example of a samd21 based Arduino compatible board with very low power sleep modes. It can wake from sleep on an external interrupt which could be caused by a button press. They also sell a low power SD card module.

Here is a high efficiency amplifier board with a pin which can be used to shut it down into a low power sleep (I think - the SW pin).

Here is a tutorial on playing WAV files with Arduino Zero.

For 36 buttons, you could organise them into a 6 x 6 matrix. 12 digital pins would be needed to read them. The 6 row pins would be set to INPUT_PULLUP and the 6 column pins to OUTPUT & LOW. If any button is pressed, one of the input pins would be pulled low. These pins could be set to interrupt & wake the chip from low power sleep, I think. The chip would then check which pin had been pulled low. This would indicate the row of the pressed switch in the matrix. The chip would then set the column pins to INPUT_PULLUP and the row pins to OUTPUT & LOW. The column pins could then be read to determine the column of the pressed switch in the matrix.

Dash4g

How fast does it initialize?
I have seen threads here that have a circuit that wakes up when a button is pushed, runs to completion and then powers down.

Not very fast. at least 0.5s to call the file; not ideal for initialization on power up, but I might try this as I search for alternative methods. Thanks!

Low Power Labs Motino M0 is an example of a samd21 based Arduino compatible board with very low power sleep modes. It can wake from sleep on an external interrupt which could be caused by a button press. They also sell a low power SD card module.

Here is a high efficiency amplifier board with a pin which can be used to shut it down into a low power sleep (I think - the SW pin).

Here is a tutorial on playing WAV files with Arduino Zero.

For 36 buttons, you could organise them into a 6 x 6 matrix. 12 digital pins would be needed to read them. The 6 row pins would be set to INPUT_PULLUP and the 6 column pins to OUTPUT & LOW. If any button is pressed, one of the input pins would be pulled low. These pins could be set to interrupt & wake the chip from low power sleep, I think. The chip would then check which pin had been pulled low. This would indicate the row of the pressed switch in the matrix. The chip would then set the column pins to INPUT_PULLUP and the row pins to OUTPUT & LOW. The column pins could then be read to determine the column of the pressed switch in the matrix.
Wow, thanks Paul.

I will do some research around this board and specifically that chip. I am sure I could get a little shield which would house the amplifier and some diodes for the matrix for easy soldering. I will update this thread as I find out more.

Thanks again to both of you!

MorganS

A Teensy with a Prop Shield will do everything you want.
"The problem is in the code you didn't post."

gbafamily

If the sounds are short and few, the sounds may fit in program memory/Flash. The SAMD21 has 256K of Flash for code and const data. Adafruit has a sound function like this for the samd21 DAC output.

Code: [Select]
// 8 bit samples, 8000 samples/sec, mono, 8000 bytes per second of audio.
const uint8_t SOUND1[] = {0xAA, 0xBB, ...}
playSound(SOUND1, sizeof(SOUND1), 8000);


If more storage is required, various Adafruit M0/M4 (samd21/samd51) also have 2 MB of SPI Flash. For example, this board https://www.adafruit.com/product/3727 has a SAMD21 with 2MBytes SPI Flash. This could eliminate the need for the SD slot and SD card.

PaulRB

#7
Jan 04, 2019, 10:22 am Last Edit: Jan 04, 2019, 10:29 am by PaulRB
...This could eliminate the need for the SD slot and SD card.
On the other hand, using a sd card could allow for easy language configuration. The sketch on the Arduino board would not have to change, just insert an SD card with the words spoken in Spanish, Vietnamese, Swahili... In fact, any customer of the toy with a reasonable level of PC skills could customize the language or voice of the toy by populating the sd card with files (with the required filenames).

Dash4g

#8
Jan 04, 2019, 07:21 pm Last Edit: Jan 04, 2019, 07:26 pm by Dash4g
A Teensy with a Prop Shield will do everything you want.
Very interesting... however, If i read the pinout correctly, would I be able to use 22 pins for a button matrix (6x6 or maybe even 8x8)?

Also, I wonder about the the power consumption of the Teensy in sleep with the shield. I think I can pick one of these up this afternoon and try it out this weekend.

On the other hand, using a sd card could allow for easy language configuration. The sketch on the Arduino board would not have to change, just insert an SD card with the words spoken in Spanish, Vietnamese, Swahili... In fact, any customer of the toy with a reasonable level of PC skills could customize the language or voice of the toy by populating the sd card with files (with the required filenames).
Bingo, Bango! The end goal is definitely to be able to adapt this project to other languages. I was able to get some older 32Megabyte SD cards from Aliexpress a few months ago for literal pennies.

But... playing with the file sizes and sample rates, I might be able to squeeze ~3 minutes of 16-bit mono WAV files.

Another idea: Can I just get a Moteino M0 with a 4Mbit Flash chip, de-solder it and add a new 32Mbit flash chip, such as:



I will put an order in for a few Monteino M0's just because they seem very cool to play around with anyways...

PaulRB

#9
Jan 04, 2019, 08:11 pm Last Edit: Jan 04, 2019, 08:41 pm by PaulRB
You can order the Motino M0s without the flash chip, and add your own, I suppose. But ask the seller first in case the chip you plan to add is incompatible. Soldering something on is always much easier than unsoldering, in my experience. Removing components always risks damaging the board by lifting/tearing PCB tracks. But even so you will need good eyesight, steady hands, a good quality temp controlled soldering iron, and the skills to use it. Would stick with the SD cards myself.

Another low power board to consider would this RocketScream.

But I have to say that both the RocketScream and the Low Power Labs boards are not the cheapest around. They are specialist boards designed to be sensor nodes that run for months to years on small batteries. This maybe overkill for toys. The Teensy lc board maybe just as suitable and cheaper, but check the standby/sleep consumption before you buy.

xl97

A Teensy with a Prop Shield will do everything you want.
^ This!
Pretty impressive combo there...
And some pretty amazing projects use it!    Including power consumption stuff..   (check out the Open Source LightSaber project that uses this)
I have used the DFPlayer for many projects, and if using a legit board.. works great.   (Although power consumption was never a concern of mine)

hammy

Have you looked at the recordable modules you can buy off eBay for very little money , $2 or so each , complete with speaker etc .

PaulRB

Have you looked at the recordable modules you can buy off eBay for very little money , $2 or so each , complete with speaker etc .
Care to post a link, Hammy?

hammy

Search for " greeting card recordable voice" on google or eBay

Go Up