You’ve completed all your testing and your Arduino code is working perfectly. It’s now time to add your circuit to your cache container. Without the Arduino plugged into your computer, how are you going to power it?
Most Arduino boards work with 5V of electricity. You can get special low-power boards that run on 3.3V, but if you did, you’d know it. So, the trick is to supply 5V to your circuit. A 9V battery by itself is too much. Rechargable AA batteries deliver 1.2V, while non-rechargable AAs deliver 1.5V. Either way, there is no easy way to use multiple batteries to sum up to 5V, nor is there any way to make sure a geocacher is using rechargable vs. non-rechargable batteries.
What to do? There are a few solutions. I’ll go over what I’ve figured out and recommend where each may be useful.
Plug It Into The Wall
If you’re lucky enough to be putting your cache near an electrical outlet, you may decide to just plug it into the wall. You will need a USB cable and a USB power adapter. You can use any USB power adapter – I test with one I got with my Amazon Kindle. The adapter is turning 110V AC into 5V DC. I’m sure European adapters exist which perform a similar function. Just plug them together and you’re good to go.
- Geocachers don’t have to bring anything special with them
- You can likely draw as many amps as you need without worry
- There aren’t outlets in the woods
- A geocacher may be able to unplug the USB cable and plug it into their laptop, reprogramming your Arduino and ruining your cache
Use a 7-12V DC Power Supply (like a 9V battery)
Most Arduino boards have a Vin (voltage in) pin which supports the direct connection of a battery, like a 9V in the photo below:
This is a simple and straight-forward way to power your board. Just use the Vin and Ground pin, and you’re ready to go. A regulator exists on the Arduino board to reduce the 9V supply to a steady 5V. Even though most boards are rated for 7-12V, I would not recommend going over 9V, as it can overheat the board.
- Quick and easy set-up
- Inexpensive—no extra components are necessary to handle your power source
- Good for lightweight sensors and components
- A brand-new 9V battery cannot supply over 300mA, and a semi-discharged one could provide less than 50mA (http://data.energizer.com/PDFs/522.pdf)
- Power supplied to other components must come from the Arduino (via the 5V pin), heating and stressing the board
Instead of using the voltage regulator on the Arduino board, an external voltage regulator can be used when you have a DC power supply of more than 7V. Check the datasheet for minimum Vin (voltage in) of your regulator. A regulator that outputs 5V will have “7805” stamped somewhere on it. The excess voltage is “burned off” as heat, so don’t go too far over 7V, or something will start to melt. The benefit is that extra current for external components won’t need to go through and stress your Arduino.
The Arduino Nano (and some other boards) allow you to power the board directly by connecting a regulated 5V power source directly to the 5V pin. Be careful when doing this, because anything over 6V may destroy your board.
Sparkfun sells a 5V regulator for under a dollar. It can handle 1.5A and has some protections built in to keep your circuit safe. You can find them even cheaper on eBay. You will need to use capacitors (100µF In, 10µF Out) with a regulator to keep the voltage steady, as in the diagram below:
Despite the photo, try to avoid using a 9V battery. 9V batteries have horrible power density compared to AA batteries. When I was building my first Arduino Gadget Cache, this was the first power supply I tried. My whole program kept resetting anytime I had to move a servo, because it tried to draw too much current and browned-out the circuit. It took me several days to figure this out. A regulator might be a good idea if your cache somehow involves using a car battery, which is about 12V. At this point, you should consider attaching a thermal heat sink to prevent overheating. Personally, I’m afraid to mess with a car battery, because of the amps it can deliver.
- Allows you to handle power sources over 7V DC
- Can handle up to 1.5A, plenty for LEDs and a servo
- Keeps the Arduino board running cool
- They can overheat with prolonged use of a high voltage source
- Geocachers have to bring an uncommon power source with them
- The most common 7V+ source, a 9V battery, shouldn’t be used for current requirements greater than 50mA
DC/DC Boost Converter
Boost Converters—also called step-up converters—take a lower voltage level and bring it to a higher level. In this case, we want boost converters which bring up the voltage to 5V. To do this, the converter exchanges current (I) for voltage (V) while conserving total power (P), using this equation:
P = V × I , or
Watts = Volts × Amps
So, for example, let’s say you are using an standard Energizer alkaline battery. It can provide 1.5V and 300mA for a reasonable period of time (and a bit more amperage for short periods). Power (Watts) must be conserved, so:
Vbattery × Ibattery = Vboosted × Iboosted
1.5V × 300mA = 5V × Iboosted
Iboosted = 90mA
Note that 90mA in this example is a maximum under ideal conditions. The geocacher’s batteries could be drained a bit, they could be using rechargeable batteries (which run at 1.2V, but have higher amperage discharge capabilities), it could be cold out… any number of things. Plus, boost converters do not operate at 100% efficiency. I like to make sure my ideal Iboosted is at least 30% more than required. This is a good solution if you want to use AA batteries and require less than 1000mA of current.
Lower Amperage Boost Converter (up to 400mA)
If you only need to power LEDs or other low-amperage components, this is a cheap solution. They make few different formats, but I prefer the ones which have pins which fit into a breadboard (as pictured). You can find them on eBay for under $3. The ones I purchased also provided a chart to determine how many amps I could get based on supplied voltage.
|Supplied Voltage||Output Current @ 5V|
Two AA rechargeable batteries should be able to provide 200mA at 5V using this boost converter. That should be enough to power many items. Here is an example of a single AA battery powering an Arduino Nano and one LED on digital pin #3 using a boost converter:
It should be noted that the voltage in and out pins are reversed on this boost converter when comparing it to the voltage regulator.
- Allows use of the very common AA battery
- Cannot power a servo motor
- I can only find them in China, which means they take 3 weeks to arrive
Higher Amperage Boost Converter (1000+ mA)
So, you want to power a higher current device like a servo motor, or maybe you need to light up dozens of LEDs. There is one more solution I’ve found which can give you more amps using AA batteries. Adafruit makes a 5V/1000mA boost converter. Currently at $15, it’s not ultra-expensive, but it costs many more times the other items on this list. This is what I have powering the servo, 4 ultra-bright LEDs, and buzzer in my Simon Says gadget cache. As far as I can tell, it’s magic.
It comes in pieces, and you will need to solder on the adapters you want. In the end, I left off all the USB stuff, and just soldered in the 6 pins so I could mount it in a breadboard. I only use 3 of them: voltage in, voltage out, and ground (the same as the three pins on the lower amp boost converter). I only bought one, and it’s out in my cache, but here’s a Fritzing diagram of how to connect it to a breadboard and control an LED on pin D13:
- Can provide one full amp (or more for short periods)
- Allows use of the very common AA battery
Let me start by saying I have no experience with relays. This was something I investigated before I discovered the PowerBoost 1000, and it may come in handy some day. I’d also like to mention that messing with household or stronger electricity is a good way to electrocute yourself, so make sure you know what you’re doing. Just like it says in this site’s footer, this information is likely wrong. : )
So… you need more than an amp of power, or you need to deal with alternating current (AC). There is a solution, and it can be controlled with your Arduino. It’s called a relay switch. They can generally be found under $10, but you’ll need to pick the version which can handle your volt/amp situation.
There are basically two separate circuits inside a relay switch. The one which is used by your Arduino is a simple 5V magnetic switch. You pass power through the relay to turn the switch on or off. The other circuit in the relay is the heavy duty one, which actually uses the switched circuit. You connect your high amp or AC volt device to its own power source, and then connect the hot wire to the terminals on the relay which work as a switch to turn it off/on. In this way, you can use your low-power 5V Arduino to control just about any kind of electrical power source.
Every option has its place, but I think I’m going to follow this pattern:
- For low current items like LEDs (20mA), 16×2 character LCD screens (160mA), or piezo buzzers (40mA), I’ll stick with the less expensive low-amperage boost converters
- When I need to use a servo (600mA), I’ll get Adafruit’s PowerBoost 1000
- If I need to use an item that plugs into the wall, I’ll figure out how relay switches work
Good luck with your project!