Arduino 5v mini with 3v coin cells, motor problem?

Hello! Another question for you experts...

I'm running a 5v arduino pro mini from two 3v coin cells (CR1220). The power light comes on fine, and it seems to be ok.

My problem is that it's connected to a tiny vibration motor which i'm sending a command like this to (essentially the led dimmer example code) :

 // fade in from min to max in increments of 2 points:
                for(int fadeValue = 0 ; fadeValue <= 120; fadeValue +=2) { 
                // sets the value
                analogWrite(ledPin, fadeValue);         
                // wait for 30 milliseconds to see the dimming effect    
                delay(30);                            
                 } 

                // fade out from max to min in increments of 2 points:
                for(int fadeValue = 120 ; fadeValue >= 0; fadeValue -=2) { 
                // sets the value
                analogWrite(ledPin, fadeValue);         
  
                    
                delay(30);
              }

For the first couple of cycles it seems to work ok, giving a nice soft "purring" output, but then it stops vibrating at all and just makes a whining noise when it should be vibrating.

Do i need more power? why should it work at first and then stop? I've connected the motor to the ground and pin 9.

Any help much appreciated!

Do i need more power?

Yes

why should it work at first and then stop?

If you take too much out of a battery tiny bubbles form round the electrodes reducing the surface contact area and thus reducing the voltage / current output.

I've connected the motor to the ground and pin 9.

Best to also add a diode form pin 9 (anode) to +5V (cathode) to protect from back EMF from the inductive load. I am assuming that your vibrator takes less than 30mA otherwise you are overloading the arduino pin and you would need to drive it through a transistor.

Thanks for the reply! That's really useful. I'll put another coin battery on and make it 9V, and put a diode in there. According to the website (http://www.coolcomponents.co.uk/catalog/product_info.php?products_id=177) The motor takes 90mA, so i probably need to sort out a transistor... it also says its works from 2v to 3.6V, but the arduino gives 5V? It seems to work when attached via serial so I thought it would be ok. Do i need to somehow supply less voltage?

Sorry for the ignorant questions, Your help is really really useful!

If you need to drive it with a transistor look here to do it:-
http://www.thebox.myzen.co.uk/Workshop/Motors_1.html

I assume the 9V is going through the voltage regulator, that is you are connecting it to Vin.

If the motor takes 90mA at 2V then putting a 144R resistor in series will limit the current to 30mA when you are driving it with 5V. If this is enough to drive it hard enough then that's all you need to do. However, if it won't work like this then you need to use a transistor like in the above link. Then you need to put a 33R resistor in line with it to effectively limit the current to 90mA despite the higher voltage (5V not 2V)

Ok,

I've put 147 ohms worth of resistor in line with the motor, which results in an even more pathetic whine and no vibration. I think I'm going to have to use a transistor.

I'm going to get this diode: http://www.maplin.co.uk/module.aspx?moduleno=19079 the 1N4004S and this transistor:
http://www.maplin.co.uk/Module.aspx?ModuleNo=19061
(BC548B)

and have another go tomorrow.

When I connect it up, so i need to provide a second power supply? Can i use the VCC pin and ground?

Can i use the VCC pin and ground?

Yes.
As you will now be using 9V you need the 33R resistor.

That diode and transistor look OK.
best of luck

Can i use the VCC pin and ground?

The VCC pin on a mini pro is bypassing the regulator and you should NOT connect any power supply above 5V to this pin.

Use the pin labeled RAW for power supply (e.g. 9V) in need of regulation.

Quite right Ben, missed the bit at the beginning that said what she was using.

Power

The board can be powered through USB via the six-pin programming header, or from a regulated 5V or 3.3V (depending on the model) supply applied to the VCC pin or an unregulated supply on the RAW pin.

Thanks for the clarification! I read some horror stories about frying the arduino by using the vcc not the raw pin, so i've been careful not to apply anything to the vcc pin!

I'm working on the impression that the vcc pin has a 5v output if a 9v is put into the raw, is that correct?

Yes that's right.

I constructed the transistor part as advised and it works like a dream! First time too :smiley:

Well done. :slight_smile:

Are you hooked yet?

Actually, yes. I'm going to make so much stuff :smiley:

Great, there aren't enough females in electronics.

There is one of the few only one desk away from me now, she specialises in FPGA design.

Well, i have an engineering degree behind me, but i've learnt more in the last 3 months about electronics by messing around with arduino than i did in 3 years of mechatronics. I'm really enjoying my industrial design masters! what's FPGA design?

what's FPGA design

It's like hardware without the soldering (which I think is the fun bit)

but i've learnt more in the last 3 months

Yes I used to be a lecturer at a University (Physics Man Met) and you can do remarkably little with undergraduates. :wink:

I think as an undergrad at Imperial it was a bit information overload.

I like soldering too, even if i am a bit careless! (interesting paint/solder burn effect on my fingers atm)

I seem to have run into a bit of a brick wall again with my project, last hurdle i think, any ideas?

I've built my final prototype and it works beautifully in a tiny space when connected to a standard 9v battery. When I run it from three 3V coin cells stacked up though it works for only the first cycle, then the motor just makes that whining noise again, indicating the whole thing is underpowered. Am I missing something? I really need a tiny tiny battery for this project or I may as well just shown it on a prototype board >_<

The problem is probably that coin cells do not have a very high current capacity. Can you monitor the voltage from them while the thing is running? That will tell you if they are sagging. Power density in batteries is a big problem especially if you want them small.

You might like to try something like a mobile phone battery.

The voltage drops to about 4 or 5V across the battery when the motor is trying to run. I think I'm a bit screwed, because i don't think a 9V 10mm by 10mm by 7mm commercial battery exists. Maybe if i find some higher capacity coin cells... the ones i'm using are 38mAh.

Ok, i'm going to buy some with a 60mAh capacity and try those. Fingers crossed!