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.
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!
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)
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.
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?
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?
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.