background preloader

How to Run an Arduino for Years on a Battery

How to Run an Arduino for Years on a Battery
If you found this article after doing a search on Google, welcome! On this website you will find plenty of content around DIY home automation using open-source hardware. Enjoy the article! For most of the Arduino tutorials you will find on this website, power is usually not an issue as the Arduino is powered by the USB cable coming from the computer. For example, you want to power the wireless motion detector just by using a set of batteries. The first thing we need is to build our own Arduino system with just the minimal set of components. Hardware & Software Requirements You need several components to build you own Arduino system. In a previous project I used a FTDI breakout board to program the Arduino chip directly on the breadboard. To power the Arduino, you will need a battery. You will also need several components around the chip. Finally, you will need a breadboard and some jumper wires. This is the list of the components that were used in this article: Hardware Configuration

<avr/power.h>: Power Reduction Management Arduino to Arduino Serial Communication | Robotic Controls Introduction It is possible to chain Arduinos together in such a way as to get communication between the two. Having Arduino-Arduino communication can be useful for many projects, such as having one Arduino to run motors and having another sense the surroundings and then relay commands to the other Arduino. This can be done in several methods, using I2C and Serial, to list a few. This tutorial will focus on Arduino-Arduino communication through the serial ports (RX and TX). Schematic The schematic below shows how to connect the two Arduinos together. There has to be a common ground between the two or else it will not function properly. Coding When sending things through serial, everything is sent in bytes. Simple Code The easiest way to get around this is to try to avoid using characters and numbers at the same time. Upload the Physical Pixel code, which can be found in the Arduino IDE under: File >> Examples >> Communication, onto one Arduino. On the other Arduino, upload: Complex Code

Best ways to power a Arduino according to your need | Homautomation In this post I will describe what is the best way to power a Arduino according to your needs. Of course according to your needs, the way you power your Arduino system, is very important. If you want to make a system connected to a wall plug it is much easier than running an autonomous system on batteries for a while. Regulate power without power contraint Power adapter for Arduino board If you want to run your system over an Arduino board (typically Arduino Uno), It’s really simple. 5V regulator for standalone Atmega If you want to run Atmega in a standalone mode (as I described in a previous post), You’ll need to regulate power in order to provide 5v to the Atmega. It is easy to use in order to regulate any input voltage to 5V output voltage. Here is the schema for create this kind of regulation Making an autonomous system is more tricky. Why using a classic Arduino board is not a good idea? Arduino (Arduino Uno) board are not designed to be used in a such mode because: Optimizing code Sleepy

LowPower - QED From QED < CEE474(Link to this page as CEE474/LowPower) Low Power Cookbook get the sketch for this here: This page is all about reducing power consuption of the AVR microcontrollers. Atmel resources, such as datasheets and application notes and picoPower videos The AVR libc library reference, specifically on avr/power.h, avr/sleep.h and avr/interrupt.h Dean Camera's great guides to Timers and Interrupts. No one of these is my favorite, they all give some great details. Turning off parts of the chip you're not using Theory The datasheet offers the following Power Reduction Register: from avr/power.h, a variety of functions you can use if you #include avr/power.h to manipulate the bits in PRR: Note that because the timers may be used in defining interrupts (see below), only turn off the timers that won't be used! In addition, there remain some other ADC functions you can turn off that are not accessed in power.h. Setting pins

Sending float variables over Serial without loss of precision with Arduino and Processing or Python Last updated on Tue, 2010-11-30 16:58. Originally submitted by fabio on 2010-11-19 15:42. For a project I'm working on, I had the need to send some float variables computed on the Arduino board to a Processing program running on a computer over a Serial communication Link. Arduino doesn't have any "out of the box" way to send float variables over the Serial interface but one could simply send approximations: send the float as an integer and truncate the decimals or send it only with two digit for the decimals. Unfortunately, I needed the best precision for my project so the above solutions weren't actually useful. So, I came out with the following way: given that on both the Arduino and Processing have 32 bit floats and that both the ATMEL 328 (the microcontroller used by Arduino) and my i386 compatible PC are both big endian processors, I can split the float on Arduino into an array of 4 bytes. Then, I found 2 possibilities: using Serial.write() I can send them raw to the Arduino. Raw bytes

How to run an Arduino (clone) on (AA) batteries for over a year – Part 2 | Hardware Startup A short while ago, I wrote a blog post about running an Arduino on batteries. That post was well received and got many upvotes, likes, tweets and comments (Thanks everyone!). That post discussed among other things getting rid of energy suckers, low-quiescent current regulators and the use of sleep-mode. This post will discuss how to connect your Arduino (clone) to simple AA/AAA or coin cell batteries, how to use interrupts to wake Arduino from sleep mode and how to make sure that other components like sensors are not eating all the energy from your battery. As some of you commented, apart from running an Arduino of a 9V battery, one can easily run an Arduino of 3V or 4.5V with AA/AAA or coin cell batteries (given that you sensors or other electronics don’t need a higher voltage). A last thing that one has to keep in mind is the selection and usage of the other components in the design. Let’s take for instance the motion detector that I was talking about. Like this: Like Loading...

Low power ATmega/tiny with watchdog timer At work recently, the pranks have been escalating. I’ve decided that for my next salvo, I’m going to build the most annoying beeping device I can. I’m using an ATtiny45/85 chip, programmed using the Arduino development environment. The clone army grows The device is intended to be planted somewhere near the target’s desk, and will just beep (or make some other annoying sound), every 5-8 minutes. Three primary factors influenced the design of this, in this order: Low power consumptionInexpensiveSmall size It’s likely to take the subject days, if not weeks, to find it at that rate, so the battery needs to last for at least a few weeks. As I intend to make around 10 of these devices, keeping the cost down was important. Making this as small as possible was quite a challenge, but in the end, the largest parts were the battery and battery holder. Putting the chip to sleep when it’s idle. 1. Putting the chip to sleep is pretty easy: But then you need some way to wake it up. 2. 3. 4.

Converting HEX as a String to actual HEX values | The Skyway Last night I spent quite a bit of time figuring out how to go from a string containing “7E00101700000000000000000013380244320520″ which is an XBee API packet to actually writing those hex values to the XBee. The packet has been assembled with PHP and a database backing it. That data was echo’ed onto an HTML page which an Arduino (with an Ethernet connection) parsed. Basically what I did was reading the string one character at a time, here are bits of the code: As you can see I stored the data in a byte array. This is needed to properly convert the ASCII value to the hex value of each character. And there you have it, a string containing hex values as ascii is properly converted into actual HEX. Related

Running Atmega328 in a standalone mode without Arduino Shield | Homautomation In this post I will describe how to use a Atmega328P chip without Arduino board. This kind of electronic circuit is much cheaper than an Arduino board and can be used with the same programming environnement and the same code to do exactly the same stuffs. Price : less than $10.00 Needed Hardware Arduino Uno The Arduino Uno will be used only as a programmer for the following circuit. A Atmega328P Price: $5.95 at Adafruit A 10kOhm Resistor Price: $0.10 at Digikey A 16Mhz resonator Price: $0.70 at Digikey That’s all Atmega 328P First of all you have to be familiar with Atmega328P (be careful it is better to use a Atmega328P instead of a Atmega328). Here is the Atmega328P datasheet. Ok, ok, there is a lot of text to read. Right now, you have to know that Atmega on an Arduino board is already loaded with the Arduino Bootloader. Load the Arduino Bootloader into the atmega328P To do so, we need to use an Arduino Board. Load Arduino ISP The project is now open, load it into the Arduino Uno Board. Done. Done!

Sleeping Arduino - Part 5 Wake Up Via The Watchdog Timer OverviewWelcome to the fifth and final part of the "Sleeping Arduino" series, where we will cover how to wake the Arduino from sleep mode using the Watchdog Timer (WDT). When waking your Arduino from sleep, you could use one of the standard internal timers of an Arduino as I have detailed in Part 4, but if you are looking for the maximum sleep time and/or minimum sleep power consumption, you have the use the WDT;As I have mentioned in this table, the WDT can give us a sleep time of 8 seconds, whereas the 'longest' 8/18bit timer will only give us a sleep time of ~4 seconds.Watchdog Timer (WDT)The Watchdog Timer on the Arduino's microprocessor only has one source to drive it: it's own separate internal 128kHz oscillator (as opposed to the 8/16bit internal timers, which can use either the 16Mhz system clock or an external clock). The WDT also has a prescaler, which is used to configure the timeout period. It supports timeout periods from 16ms to 8 seconds: All parts of this series:

A Swarm of Xbees! Arduino Xbee Wireless & More In the past we have covered a few things that interact through serial, from RFID readers to controlling an Arduino’s pins using the serial terminal. Serial as we have talked about it is actually know as UART, and operates over 2 pins RX and TX (receive and transmit). These connections have previously been limited by their required wires. So… what if you could drop the wire connection between the arduino and the RFID reader, or your computer and the arduino without adding much complexity? Well that is what Gerardo proposed with this article he wrote for bildr. Everyone hates long wires running from one end of the room to the other, and let’s face it, it’s aesthetically unpleasant. Series 1 vs Series 2/.25 A quick note here: This article does not cover the series 2 or series 2.5 XBee modules, and the series 1 and 2/2.5 are not compatible with each other. Choosing the right one for you getting started Hooking one up The supply voltage for the XBees is 3.3 volts, and it is a strict 3.3v. Code

arduino - How can a let my atmega328 run for a year on batteries?