Introduction: Power Your Arduino/AVR With a Hand-Cranked Battery
If you've ever wanted to power your Arduino or AVR from a battery for development testing (batteries have different power delivery qualities than, say, transformed AC or even a regulated wall wart in DC) testing but were tired of going through batteries (Hey, I admit I've sucked batteries dry in hours because of a slipped-up design before I caught it).
Maybe you want to take your design and project mobile, for instance, up in the mountains away from your vehicle and any plug in outlets. It might be useful to have a battery powered device whose batteries you never change, but just crank up once a week. Or better yet, maybe you want to take your Arduino to the coffee shop and not have to look for an outlet or USB connection. Well, here's a quick little way to power your development board from a battery that never (well, you know) runs out.
I've taken a hand-crank-powered flashlight and hax0red it to power my AVR and Arduino development boards. The battery lasts for a good long time and if you crank it a few times before you use it you'll find you'll get a solid 3.5V out of it (depending on your battery). Plenty enough to power an AVR ATtiny, ATmega, and ATxmega, as well as other 3.3V devices like the STM32F ARM MCU indefinitely!
Step 1: Necessary Items
To make this work, you'll need either:
- DC motor (I've tried about 3 or 4 different kinds of DC motors for this and I got them all out of old CD/DVD players so you don't have to pay for one if you cannibalize).
- small 3.3 or whatever capacity battery (I've used several small lithiums for my testing)
- diode (a small 1N4148 will do)
- something to make a crank with (rod & hot glue, rubber band, etc)
or you can buy a hand-cranked flashlight from ebay for a buck and change. This method is prefereable for a couple of reasons. First, the cranking mechanism is far superior to probably anything you're going to make and will really torque up when you crank it, delivering energy to the battery and straight on through to the powered device. Second, you'll have a tiny motor and small battery already included for probably what you'd end up paying for the battery alone, so splurge and buy one or two (I bought two) hand-cranked flashlights. You'll be glad you did.
For both versions you'll need the standard tools: wire, wire snips, soldering iron, etc.
Step 2: Get Out the Good Bits
If you are building from scratch, skip this step.
Unscrew the handcranked torch case screws. Pull out the chrome plastic reflector and two low-voltage white LED's. They will be soldered in parallel and to the battery. Unsolder or otherwise heat up the solder joints and gently pull the LED structure away from the case components.
Now you have a case with a hand crank, a motor and a battery connected via a diode. Check out the schematic on the next page for how it all fits together.
Step 3: Solder Connections
(-) Motor (+) ---> Diode ---> (+) Battery ---> Leads | |---> (-) Battery ---> Switch ---------------> LeadsThe motor is connected to the positive terminal of the battery via a diode that manages back EMF when the motor is suddenly stopped (ie you stop cranking). A small switching diode like the 1N4148 works well for this tiny amount of voltage and current we'll be seeing. Attach a long wire/lead from the positive terminal of the battery.
The negative terminal of the motor is attached to the negative terminal of the battery and next a slide switch is soldered on to conserve energy/power when the battery is not in use. Sure, we can wind it up and recharge a bazillion times, but why when we don't have to? Attach a long wire or lead from the "on" end of the slide switch.
The schematics show a test setup with a motor and all requirements built in. You can build this on a bread board for your tests or you can power some other board that you may already have, as I did with my ATtiny Stick Development Board that I built myself. I also use a 3.3V zener as a voltage regulator "just in case," to protect the AVR. As always, bypass caps from Vcc to GND on all AVRs.
Attachments
Step 4: How It Works
What is a motor, anyway? It's the same as a generator, but in opposite; it's able to convert one form of energy into another. That is, a motor converts electrical energy from a battery or power source into rotational energy of motion/mechanical energy. A generator is the opposite: it takes it's mechanical energy (such as a shaft being turned by falling water or steam) and converts it into electrical energy and heat.
Inside our brushed DC motor are various components known as the stator, rotor, commutator, armature, and a field magnet (it can be an electromagnet but they are rarely so in cheaper DC motors). See the image below. Just as when you played with magnets before, you've noticed that the same poles push away from each other and opposite poles attract each other. This is going on inside the DC motor.
The electrical energy created from an induced current that moves to oppose the magnetic flux is part of the energy we get out of the motor. There is typically a low to medium efficiency and much energy can be lost as heat due to friction. This is a HIGHLY simplified version of a DC motor but suits our purposes here. For a more thorough dealing check out AN905: DC Brushless Fundamentals by Microchip.
For now, know that a motor and a generator are the same fundamental thing and that we are going to use our DC motors as mini-generators.
Step 5: Powering Your Boards
Once you have made your connections, crank up the motor for a few seconds (I usually crank it seriously for about 10 sec) and take a measurement from the leads. Your battery should be charged up enough to power a board. If not, keep'a'crankin'.
Once you've reached your target voltage attack the (+) end of the crank leads to Vin of the Arduino or Vcc of your AVR. Attach the (-) to the GND connections of your development board. You should see your power lights come on indicating that you have just powered your board. It will source enough for your AVR, LED, and even an AVR ISP mk II (since it draws it's power from the board) without a problem.
You are now ready to fully detach your devices from it's power-requirement tether. You could put crank-powered devices out in the field and only stop by every so often to crank it back up. It has the potential to last for a very long time...much longer than battery alone and without the hassle of finding some power outlet.
I hope you enjoyed this little instructable and it gives you some new ideas for your next project. As always, I welcome your comments and suggestions on this and any of my instructables. If you liked it or any of my 'ibles, be sure to vote 5 stars! You can also catch me on freenode.net on various tech channels as nick nevdull. Say hi!
Cheers!
-Gian
19 Comments
Question 9 months ago on Introduction
Thanx for this! Would it more difficult to generate 5V instead, which, I think, would be enough to charge an iPhone?
7 years ago
Would this work ok with a 9v battery?
9 years ago on Introduction
Nice, just picked up a few of these keychains from DX with this exact goal, powering an arduino! :D Thanks for the tut, will definitely come in handy
Reply 9 years ago on Introduction
Hey, thanks for the comment. Good luck with your project!
10 years ago on Introduction
Great project! Actually all your instructables are impressive brainchilds, good explained and with many different branches investigations, I like them!
Reply 10 years ago on Introduction
Heyas,
Thank you so much for the kind words! It's great to know someone is enjoying them.
Cheers!
Gian
11 years ago on Step 5
how many volts does the generator give? btw its nice
Reply 11 years ago on Step 5
hi bapos,
Thanks! I got almost 4 volts consistently.
/nev/dull
12 years ago on Introduction
Arduino is here:
http://www.arduino.cc/en/Main/Boards
http://www.freeduino.org/index.html
https://www.instructables.com/id/RGB-LED-Tutorial-using-an-Arduino-RGBL/
My Arduino:
http://micbric.free.fr/arduino.html
Enjoy
12 years ago on Introduction
waht is a Arduino or avr?
Reply 12 years ago on Introduction
They're both popular microcontrollers used in DIY projects. AVR is the product line from Atmel while the Arduino is a readily accessible hardware and software programming/development board for an AVR.
12 years ago on Introduction
great.... but here's an idea. Why not connect another DC motor to one of the digital out pins, and use that to drive the crank? That way it can run for ever!
Reply 12 years ago on Introduction
Sorry, but that does not work. This is a common beginner mistake... The law of conservation of energy says that you cannot get more energy (electricity) out of a machine that the amount of energy you put in. The generator will have to create enough energy to charge the battery and have enough leftover to run a motor to power the entire circuit, which is impossible.
In fact, the motor will not even be able to turn the generator because the load on it will resist movement of the shaft, and this will cause the motor to attempt to draw more power out of the battery and generator, creating a runaway loop.
If you try this, the battery will drain faster than without a motor. Make sure you don't attach a motor directly to a digital pin, always use a transistor.
Reply 12 years ago on Introduction
Yeah... I was kidding...
12 years ago on Introduction
Neat, but it would be well worthwhile adding a couple of capacitors (100uF and 0.1uF) across the battery. These won't affect the charging, but the output from the generator circuit is going to be incredibly spiky, and the capacitors will go some way to suppressing this. For a bit more protection, a 4.7V zener diode wouldn't go amiss there too.
Reply 12 years ago on Introduction
put in a small, cheap, ceramic capacitor in parallel too, and it will take care oft the sharper spikes :)
Reply 12 years ago on Introduction
Heya AndyGadget,
Thanks a lot for the comments. I think you're right about the capacitors and will work them into the next design. I added a 3.3V zener in the schematic but it never translated into the case version. Maybe 4.7V is better for overvolt protection?
Thanks again for the improvements.
Cheers!
-gian
/nev/dull
12 years ago on Introduction
I've often wondered if the handcrank genny, supercap and switching reg would be better for this kind of duty.
Steve
12 years ago on Introduction
Nice article