Question about power consumption (driving DC motors), and now audio amplifying also

28 Jan 2010 . Edited: 04 Feb 2010

As you probably already have noticed, I'm working on my Billy Bass hack (see notebook).

Now I got around to connect the L293D motor driver to the mbed and give it a try on Billy. So I wired it up on my breadboard and gave it a try. I use the digital outs to command the L293D, and the whole breadboard (mbed, L293D and SD card) is powered using a "wall wart" style 6 volts 500 mA power source.

As I ran my test program which moves Billys tail, body and mouth, I found out that I'm running out of power. When Billys both motors are in action the mbed resets as a cause of lack of power.

I put my "electrician skills" to work and added some capacitors found in my spare parts box to fix the power loss during heavy load. After adding enough capacitors (electrolyte) the mbed stayed on for the whole program, so I guess I'm on the right way at least? I noticed it took at least 3000uF of capacitors (10 volts) to keep the system running. The mbeds leds were still showing some fading during stress, so I added some more. Now I have 3 x 3000uF which seems to do the trick.

As a test I also took out my heavy artillery (one 10000uF and one 6800uF), and with them added the mbed stays on without power for about a second when idle :)

My question is: is this what I have done a good or bad idea, and what would you suggest to handle the power supply during stress? (different capacitors, different power source?)

I have no idea about how to calculate correct amount of capacitors...

28 Jan 2010

I think you are supposed to use another power supply and have the micro drive relays or transisters to do any heavy work.

28 Jan 2010

The motor driver should have a pin for external power supply. The mbed power and the power for the motors should be different that way the mbed will never power off. Also the motors would need way more current then for the mbed.

28 Jan 2010

I noticed the VS pin for external power on the L293D ic. But looking at Billys original "brain" which is a very small circuit board (about the same size as the mbed) I just wonder how they made it work using only 4 x 1.5 volts AA batteries? I suppose the original cpu (which is much smaller than the mbed's) draws much less current.

I believe the position where Billy's body is bent outwards from the plaque draws quite some current when the motor pushes against the movement limiter (or something) and the mouth moves at the same time.

Maybe the best approach would be using a more powerful power source and regulate a smaller voltage from it for the mbed. Using two different power sources would make it too much of a hassle in my opinion. I just hope I won't fry the mbed :)

Thanks for your advice anyway.

28 Jan 2010

You could always just find an old AC adaptor then you can just plug your project in, then you shouldn't have to worry about power draining. Then you could just use a transistor to regulate power for the mbed.

29 Jan 2010

Its quite a while since I saw a Billy working in his original mode, but, as I remember it, it wasn't the smoothest thing ever...

Did they by any chance run it off 6v by never doing more than 1 thing at once ?

i.e. drive either motor and the mouth. ? never everything at once ?

just a thought...

its just you say that mbed resets when you have both motors and the mouth working. I wonder if that never actually originally happened.

30 Jan 2010 . Edited: 30 Jan 2010
Tommi Laurila wrote:

As you probably already have noticed, I'm working on my Billy Bass hack (see notebook).

Now I got around to connect the L293D motor driver to the mbed and give it a try on Billy. So I wired it up on my breadboard and gave it a try. I use the digital outs to command the L293D, and the whole breadboard (mbed, L293D and SD card) is powered using a "wall wart" style 6 volts 500 mA power source.

As I ran my test program which moves Billys tail, body and mouth, I found out that I'm running out of power. When Billys both motors are in action the mbed resets as a cause of lack of power.

I put my "electrician skills" to work and added some capacitors found in my spare parts box to fix the power loss during heavy load. After adding enough capacitors (electrolyte) the mbed stayed on for the whole program, so I guess I'm on the right way at least? I noticed it took at least 3000uF of capacitors (10 volts) to keep the system running. The mbeds leds were still showing some fading during stress, so I added some more. Now I have 3 x 3000uF which seems to do the trick.

As a test I also took out my heavy artillery (one 10000uF and one 6800uF), and with them added the mbed stays on without power for about a second when idle :)

My question is: is this what I have done a good or bad idea, and what would you suggest to handle the power supply during stress? (different capacitors, different power source?)

I have no idea about how to calculate correct amount of capacitors...

my guess is you aren't using the 'seperate input-logic' supply feature of the L293... motors are an inductive load, i.e. they generate blowback voltage that the MCU doesn't really like.

My suggestion is you get a seperate power supply to plug into Vcc2 (Vs), and plug +5V from the mbed into Vcc1. Putting the mcu on the same side as an inductive load will stress it...

If you're powering from a seperate power supply, connect the power supply into Vin and Vcc2(Vs), and connect all logic through Vout.. (you might need a +5V Vreg if you're using 5V logic). That way the regulator built into the mbed protects it from any transient spikes (and i imagine that's how billy was run off 4 batteries).

That's a ridiculous amount of capacitors you're adding to keep the mbed on.. those capacitors are basically absorbing the spikes the motor is causing...  Also, 500mA might be too little, look for something like 1-2A @ 5V, ... you can use anything between 4.5V - 9.0V for Vin on the mbed.

30 Jan 2010 . Edited: 30 Jan 2010

 

David Styles wrote:

Its quite a while since I saw a Billy working in his original mode, but, as I remember it, it wasn't the smoothest thing ever...

Did they by any chance run it off 6v by never doing more than 1 thing at once ?

i.e. drive either motor and the mouth. ? never everything at once ?

just a thought...

its just you say that mbed resets when you have both motors and the mouth working. I wonder if that never actually originally happened.

The original Billy actually did (at least this one I have at home) move out his body and talk at the same time, and that's why I got so surprised about the power lack. In my implementation of test moves Billy keeps his body out for a little longer time (maybe one second) than the original while talking. Maybe the original was timed so that the power was just enough to keep him running. You are correct in that Billy is not one of the smoothest movers around..

 

My four year old daughter really gave the original a "few" test rounds :) and I never recall that it would reset prematurely due to lack of power.

Here is a picture of the original Billy brain (next to a matchstick for size reference) Those orange/brown wires were going to one of the motors (the other pair is on the other side):

Original Billy Bass brain

30 Jan 2010

Michael Wei wrote:
Tommi Laurila wrote:

As you probably already have noticed, I'm working on my Billy Bass hack (see notebook).

Now I got around to connect the L293D motor driver to the mbed and give it a try on Billy. So I wired it up on my breadboard and gave it a try. I use the digital outs to command the L293D, and the whole breadboard (mbed, L293D and SD card) is powered using a "wall wart" style 6 volts 500 mA power source.

As I ran my test program which moves Billys tail, body and mouth, I found out that I'm running out of power. When Billys both motors are in action the mbed resets as a cause of lack of power.

I put my "electrician skills" to work and added some capacitors found in my spare parts box to fix the power loss during heavy load. After adding enough capacitors (electrolyte) the mbed stayed on for the whole program, so I guess I'm on the right way at least? I noticed it took at least 3000uF of capacitors (10 volts) to keep the system running. The mbeds leds were still showing some fading during stress, so I added some more. Now I have 3 x 3000uF which seems to do the trick.

As a test I also took out my heavy artillery (one 10000uF and one 6800uF), and with them added the mbed stays on without power for about a second when idle :)

My question is: is this what I have done a good or bad idea, and what would you suggest to handle the power supply during stress? (different capacitors, different power source?)

I have no idea about how to calculate correct amount of capacitors...

my guess is you aren't using the 'seperate input-logic' supply feature of the L293... motors are an inductive load, i.e. they generate blowback voltage that the MCU doesn't really like.

My suggestion is you get a seperate power supply to plug into Vcc2 (Vs), and plug +5V from the mbed into Vcc1. Putting the mcu on the same side as an inductive load will stress it...

If you're powering from a seperate power supply, connect the power supply into Vin and Vcc2(Vs), and connect all logic through Vout.. (you might need a +5V Vreg if you're using 5V logic). That way the regulator built into the mbed protects it from any transient spikes (and i imagine that's how billy was run off 4 batteries).

That's a ridiculous amount of capacitors you're adding to keep the mbed on.. those capacitors are basically absorbing the spikes the motor is causing...  Also, 500mA might be too little, look for something like 1-2A @ 5V, ... you can use anything between 4.5V - 9.0V for Vin on the mbed.

I tried to draw the circuit I am using in the picture below.

Pins 1, 16 and 9 go to a digital out on the mbed (enabling the L293D motor controls and supplying logic power), as do the pins 2, 7, 10 and 15, which are used to control the motors. Pin 8 is the direct power supply pin for the L293D and it comes straight from the 6 volts 500mA ac adapter I am using. The mbed gets its power from the same wire. Both ICs share the same ground.

L293D circuit

And as you say, I am most concerned about not to blow up my mbed because of wrong wiring. I'm aware that I put in way too big capacitors, but with about 4000uF the mbed stays on. Without the caps the mbed resets when both motors run. Would it be any good to use some kind of diodes to protect the mbed from the blowback voltage?

Maybe the best thing really would be to get a more powerful ac adapter. I don't know what voltage the motors are (I suppose they are 6 volts), so would it hurt them much if I used a 9 volt ac adapter without regulation for the motors? Someone told me the motors would just go faster..

31 Jan 2010


You want to utilize the on board mbed voltage regulators ... above is l293E, but same idea.. keep mbed outputs to logic only...

01 Feb 2010

I think you need to use a higher rated power supply. 500 mA is not much (3W).

Sorry if I’m about to state the obvious, but the reason the circuit stays on with a high capacitance is because the capacitors are storing energy (E = 1/2 CV² if I remember correctly). 4 x AA batteries can pump out more than 500mA for a short period, maybe you could try running the system from batteries as an experiment?

 

01 Feb 2010

Michael, thanks for the clarifying picture. I see I need to change the L293D logic power supply (pin 16) to come from the mbed's Vout instead of a digital out. Otherwise my wiring should be about the same as the one in your picture (apart from the motor wiring, but I guess that's due to the differences in the IC's).

Martin, as you guessed my "brilliant plan" with the big capacitors was to store enough reserve power to keep the mbed running during high current consumption by the motors :). Thanks for the tip on using batteries, I'll try that too. The idea of using an ac adapter was just avoiding running out of batteries every now and then.

04 Feb 2010

Okay, one thing you can do to improve things further is to power both the motors and the mbed off one supply,  as above, but feed the mbed via a schottky diode of suitable rating (say 1amp, 20 v - plenty of those around), and put some of your extra capacitance on the mbed side of the diode. When the initial surge current of your motors kicks in as they try to overcome friction, inertia etc in dear old Billy, the power supply is probably being pulled way down for a short period as the current limit of the supply kicks in (once the motors get going they will take much less current, in general). When this dip happens, the diode is back biased and the only current flowing out the capacitor is the one powering the mbed, so the voltage to the mbed should hold up much longer.

The reason batteries (good ones, fully charged, anyway) can be better is that they are only limited in how much current they can supply by their internal resistance and low internal resistance battery technologies such as LiOn, NiMH or alkaline can put out a LOT of current (enough to cause serious damage if you are foolish enough to carry them arounfd in a pocket with keys, jewelry or coins that can short them out) but power supplies always current limit at a point before meltdown, at least if they are UL listed.

 

Dave

04 Feb 2010 . Edited: 04 Feb 2010

Project update:

Billy has been to the gym, and is now running with more power! As suggested here, I changed the AC adapter to a more powerful one. I now use an old laptop adapter capable of putting out 19 volts and 3 amperes. To get the voltage down I use a 7809 regulator (9 volts, 1 ampere), and now the mbed has no problem staying on during Billys "moves". The regualtor is running very hot after only a short moment (a minute or so) even when the motors are not connected or in use. I put a heat sink on it which also gets very hot. Is this normal? I'm afraid it will melt if it's on for a longer time (and it's supposed to be always on).

To lower the voltage a bit more for Billys motors, I placed a diode in front of the power line going to the L293D. Multimeter measurements show a voltage of about 8 volts. With this setup Billy really got a new life. He is no more a lazy fish wagging his tail and body in a tired way. Now his moves are quicker and more responsive. :) I also tried to put a second diode in series to drop the voltage to about 7 volts, but then Billy got a bit slow again, so I only use one diode.

Thanks to everyone for your input and advice!

 

However, my problems are not gone yet. :( I'm not sure if it would be better to start a new thread about this, but I'll put it here for now.

My next trouble regards the sound quality of the waveplayer. I bought a cheap low power audio amp from ebay (NJM386D kit) to amplify the sound signal coming from the mbed's analog out pin. When running the (updated) Waveplayer the mbed plays the sound nicely, but there's a very annoying buzz sounding a soon as I connect power to the mbed. The buzz is higher in frequency than 50 or 60 Hz, and I have no idea of how to get rid of it.

The output volume coming from the mbed seems to be very quiet, and I have to use the maximum gain (200) in the amp to get the volume to a suitable level. This is probably why the buzz noise also gets amplified so much? Analog electronics is a really difficult thing... :)

Here is a picture of my breadboard (click on it for a bigger version). The regulator with heat sink is in the upper left corner. The audio amp is next to it, and the mbed is in the upper right corner. Below the mbed is the L293D and you can see the wires going to Billys motors at the bottom. The speaker is Billys original 8 ohm 0.5 watt model. The small black component below the mbed is the diode that lowers the voltage for the L293D input.

The AC adapter connectors are in "idle" state, I move the black (ground) connector to the black terminal when powering on the whole system.

Breadboard

05 Feb 2010

The reason that the regulator is getting hot is that the supply that you are using has too high an output voltage. Consider that the input is 19V at 1A -19W and that the output is 9V at 1A - 9W. This means that the regulator is is dropping 10V and dissipating 10W which is a huge amout in micro electronic terms. You would be best to find a 12V 1A supply for a 9V regulator and then the heat generated is a great deal less and more managable.

Pip

05 Feb 2010

Even better to use 9V regulated power supply. I picked one nice little switching mode universal power supply at local Fry's for under (dontremember) $40. It has a bunch of little plugins for different voltages, and gives 3A at 9V. And it is quite compact.

Here are few links (google PSSMV7U):

http://www.vellemanusa.com/us/enu/product/view/?id=351445
http://www.jameco.com/webapp/wcs/stores/servlet/ProductDisplay?langId=-1&storeId=10001&catalogId=10001&pa=1537521&productId=1537521&cid=PDF
http://www.frys.com/product/3714786?site=sr:SEARCH:MAIN_RSLT_PG

07 Feb 2010

Changing the AC adapter one more time, this time to a 12 volts 1 amp adapter solved the power problems. Now the mbed stays on without overheating the regulator.

However, now I'm stuck with the audio. I simply can't get a clean audio signal, but get a lot of noise and buzz making the sound barely hearable. I feel I've tried everything, but obviously this still needs lots more of investigating.

07 Feb 2010

I actually used a series of transistors to interface with the mbed so as not to overload it. its a real simple schematic, took me a while to figure it out, and in fact i had to go to a previous project i had done which interfaced a lpt1 port with a radio controller for a car with a ip camera on it. i have a schematic and a board layout, if anyone is interested. you really only need 3 transistors 3 resistors 3 diodes, i added some blue led's to the mix, for absolutley no reason what so ever save for i like blue flashing lights, it kind of serves as diagnostic if you have to have a reason. at any rate that addition will cost you 3 led's and 3 more resistors. it uses a 9v battery for the power supply. like i said anyone interested send me an email and ill send pics layout and schematics. incidentally anyone making their own boards and has'nt tried the laser printer method, look it up it saves time money and works really really well.

24 Nov 2013

Sorry to dredge up this old thread, but it is exactly what I am after. I guess I am quite late to the BMBB party.

I wired everything up using Steve Ravet's BMBB project instructions. I am using a 6V DC 2.1 Amp wall wart. Should be plenty of juice out of that thing. I am using the original BMBB circuit to operate the motors. The audio comes off of pin 18 and feeds into a SparkFun TPA2005D1 mono amp. I think I blew up my amp because I used it directly with the DC supply power. When I had it on my breadboard I used a 5v/3.3v DC regulator (SparkFun PRT-10804) that took power from the 6V wall wart. I just soldered everything to a PCB tonight and I decided to just go direct with the power. What's 1V going to hurt I said… It got very hot and no longer works… A new amp is on order. I can plug the speaker directly in between pin 18 and ground and I hear it weakly playing the sound, so that's fine.

The other problem is the motors. The mouth is not so bad, but if I try to flip out the body, the mbed resets. When this lived on the breadboard I tried to feed the BMBB board with the 6V from the wall wart by hooking it up in parallel with the regulator. The regulator fed the mbed and the amp. That seemed to make the motors happy and the mbed did not reset, but the audio was hosed. Some times it would play the first couple of seconds of audio, other times just clicks. Sometimes it would just lock up with a loud squeal.

On the PCB I have replaced the old regulator with a new 5V regulator (SparkFun PRT-00114) that will again power the mbed and the amp. I am not sure how I need to power the motors and isolate them from the mbed/amp. Are transistors my answer?

Import programbilly

The Big Mouth Billy Bass program

Please log in to post a reply.