TimerOneThree library for ATmega1284P

atmega1284pThe arduino TimerOne library described at http://playground.arduino.cc/Code/Timer1 is the starting point for this lib. In the original library that can be found at http://code.google.com/p/arduino-timerone/downloads/list the pwm pins are (sort of) hard-coded to fit to the ATmega168P / 328P (the chip of the Uno R3 board). I simply changed them to the pin settings of the ATmega1284P using maniacbug’s pinout. Then I doubled the code and adapted it to timer3 of the ATmega1284P and it’s pins. Continue reading

Arduino powered by a capacitor – EEPROM in page mode

atmega_capacitors_pv_7This is the next step forward In my “minimalistic standalone ATmega328 powered by a capacitor”. In this project I was walking from the start through first tests, reducing consumption, optimized tests and adding a RTC including the problems of waking up from sleep via interrupt. Then I added a 24AA256 EEPROM as external memory. EEPROMs are good for data storage as they keep data even when supply voltage has gone down. But they are slow, especially in write mode. This means that a lot of time is spent by simply writing two bytes of data into this memory and thus, energy is consumed during this time. Now with the 24AA256 it is possible to write up to 64 bytes at once. This is called “block mode”. Let’s look if we can reduce energy consumption furthermore by using this feature. Continue reading

Arduino powered by a capacitor – extending memory

atmega_capacitors_pv_6In my “minimalistic standalone ATmega328 powered by a capacitor” project I was walking from the start through first tests, reducing consumption, optimized tests and adding a RTC. The RTC has let me learn a lot about waking up from sleep via interrupt.

Now one more component is due to come: external EEPROM to extend data memory. As I’m hoping to extend total uptime more I probably will run out of EEPROM memory when keeping the basic example (reading one ADC channel once a second and writing data to EEPROM). Furthermore, when it comes to practical use of the system, internal EEPROM is too small also.

Continue reading

Arduino powered by a capacitor – timing with RTC

atmega_capacitors_pv_5There are already some posts about my testsystem, Arduino powered by a capacitor: The start, first tests, reducing consumption and optimized tests. With different power saving techniques power consumption could be reduced by a factor of around 300. Now let’s look how we can go further and come step by step to a system that can be used in real life.

The basic idea is a microcontroller system e. g. for datalogging of slowly changing signals like room temperature or solar irradiation. In these applications the controller is up for a very short time and then sleeps until the next event. In the basic tests with a standalone ATmega328P timing between two logging events was done by the internal watchdog timer. Now let’s try to improve this…

Continue reading

ATmega328P wakeup from sleep via interrupt

atmega_capacitors_pv_4In my project “Arduino powered by a capacitor” (start, first tests, reducing consumption, optimized tests) I want to use an extermal timer like the DS1337 to generate periodic interrupts for my ATmega328P that will wake it up from sleep to do datalogging or whatever is the desire.

Using a real time clock (RTC) has the advantage of higher timing accuracy but also brings in a new problem that is described and solved in this post. Continue reading

Instructions from the AVR power library for ATmega328P

The library <avr/power.h> makes it easy to shut down all unneeded hardware of an ATmega controller.

The documentation of this library shows all available instructions and also on which controllers they are working. As I didn’t find this very readable I copied the table and deleted everything that doesn’t apply to the ATmega328P. Continue reading

Arduino powered by a capacitor – reducing consumption

atmega_capacitors_pv_2The first test showed that there is a lot of power reduction potential in having the controller sleep when it doesn’t have to do something. Now it’s time to look in detail to the possibilities of saving power both while the controller is running and during sleep. With simple test sketches measurements are done with different configurations to see the effects and to find out how low power consumption can be. Continue reading

ArduinoISP: reading and writing fuses on ATmega328P

An arduino board like the Uno can be a programmer for a standalone ATmega chip. For the ATmega328P that is used in the Uno there is a tutorial on the arduino homepage. This lets you burn the bootloader into the chip without the need for other hardware. This post shows how to use the same configuration for reading and writing the fuses on the chip. Continue reading

Arduino powered by a capacitor – first tests

atmega_capacitors_pv_1This is the second post about powering an arduino from a capacitor. The basic setup is described in the introduction. It’s an ATmega328P in a standalone setup with use of the internal clock source. The power comes from the two capacitors on the picture. The microcontroller measures it’s own supply voltage repeatedly in intervals and writes data to the onboard EEPROM. After starting the measurement the power supply is plugged out and the ATmega runs off of the capacitors until the voltage is too low.

In this post I will describe how long the setup can run with different power-reducing techniques. Continue reading