Low Power Arduino Pro Mini running at 1Mhz

Contents

After playing with the MySensors1 framework and possible sensor types, I build a prototype of a Temperature Sensor which is battery powered. The MySensors website contains a great guide on battery powered nodes2 but I wanted to go one step further and reduce the clock of the used Arduino Pro Mini from 8Mhz to 1Mhz.

Jean-Matthieu DECHRISTÉ wrote an extensive article on this topic3, so this post only includes the basics.

Requirements

While you can use a simple USB-Serial adapter to program an Arduino, you’ll need an ISP to set the fused which are relevant for the clock. If you have a spare Arduino, you can simply use the Arduino ISP sketch and use it as programmer4.

Furthermore you need to calculate the fuses for the desired settings (e.g. using Fuse Calculator5).

If you want to keep the basic settings of the Arduino to default and only set the clock to 1Mhz and disable the brownout detection, you can use the following values:

FuseValue
Low0x62
High0xDA
Extended0xFF

Write Fuses with AVRDUDE

Depending on the used path and COM port, you might need to modify this command which writes the three fuses to the Arduino:

avrdude -Cavrdude.conf -v -patmega328p -cstk500v1 -PCOM7 -b19200 -U lfuse:w:0x62:m -U hfuse:w:0xda:m -U efuse:w:0xff:m

Program Board in Arduino IDE

After setting the fuses, you will no longer be able to use the default boards provided by the Arduino IDE to program your Arduino. I did not find a reliable way to program a 1Mhz Arduino using the USB-Serial Adapter, therefor it’s required to add a new Board Configuration to the IDE and use the ISP for further programming.

First find the boards.txt of your Arduino IDE installation. On windows it is placed in C:\Program Files (x86)\Arduino\hardware\arduino\avr. Now append the following configuration and save the file:

#############################################
########### Arduino Pro Mini 1Mhz ###########
#############################################

promini1MhzInt.name=Arduino Pro Mini (1MHz internal, 1.8V)
promini1MhzInt.upload.tool=avrdude
promini1MhzInt.build.board=AVR_PRO
promini1MhzInt.build.mcu=atmega328p
promini1MhzInt.build.f_cpu=1000000L
promini1MhzInt.build.core=arduino
promini1MhzInt.build.variant=eightanaloginputs

promini1MhzInt.menu.cpu.8MHzatmega328=ATmega328 (1.8V, 1Mhz)
promini1MhzInt.menu.cpu.8MHzatmega328.bootloader.low_fuses=0x62
promini1MhzInt.menu.cpu.8MHzatmega328.bootloader.high_fuses=0xDA
promini1MhzInt.menu.cpu.8MHzatmega328.bootloader.extended_fuses=0xFF

You should now see a new entry Arduino Pro Mini (1MHz internal, 1.8V) in your IDE.

Footnotes

Gallery

Tags

Comments

Related

MySensors BBQ Thermometer

Thinking about additional uses of the rather easy MySensors Framework I came across a less common but really tasty purpose: why not build a BBQ thermometer which sends it’s data to the MySensors Gateway which is then visualized in Grafana. Thermistors The sensors of BBQ thermometers are usually NTC thermistors which means, that you can measure a resistant which decreases as the temperature rises. E.g. you might measure 100kΩ at 25°C and 6kΩ at 100°C.

Battery-powered Arduino

Running an Arduino on battery power is only useful, if you know, when to change the battery. Here it is handy, to measure the current battery level and get notifications, if it drops below a certain threshold. Thankfully you can use the analog Pins to measure a voltage. If you attach a voltage to e.g. A0, your Arduino will compare the input voltage with a reference voltage (by default VCC) and return a value between 0-1023 where 1023 means, that the input voltage is equal or higher than VCC.

Automatische Balkonbewässerung - Tankinhalt berechnen

Nachdem der Füllstandsensor nun zuverlässig Distanzen an FHEM sendet, kann daraus der Tankinhalt berechnet werden. Mathematik eines Eimers Die dafür nötigen Formel unterscheiden sich je nachdem, welche Form der Tank hat, als ersten Protoypen habe ich einen Putzeimer genutzt. Über dem Eimer habe ich den Ultraschallsensor angebracht und die Entfernung der Unterkante bis zum Boden mit 24cm gemessen. Der Radius in dieser Höhe beträgt 14cm, am Boden sind es 12cm.

Automatische Balkonbewässerung - Finaler Aufbau

Da nun sowohl die Software als auch Hardware einige problemlos lief, habe ich als finalen Schritt noch einen besseren Wasserbehälter als den 12 Liter Eimer gesucht. Fündig geworden bin ich bei der Firma Goebel, welche Wassertanks für den Campingbedarf anbietet. Hinter unserem Sofa sind knapp 30cm Platz zur Wand, daher passt hier der 76 Liter Tank (100cm x 40cm x 20cm) ideal. Die Einfüll und Reinigungsöffnung des Tanks ist auf der Seite, daher musste ich oben einen neuen Stutzen anbringen.

PCB Boards for MySensors Nodes

When I last worked with Atmel Microcontrollers in the early 2000s, it was simply unpayable to produce small batches of custom PCBs. Nowadays it’s hard to get an overview of all the companies that offer either prototype boards or small batches. Furthermore is the software by this time very advanced and the myriads of online tutorials make it easy to design simple and more complex circuits. In this post I’d like to show some of the PCBs I created and ordered and of the process to this.

FHEM - MySensors Ethernet Gateway

Damit nicht nur ein einzelnes Gerät Zugriff auf die Daten einer MySensors Node hat, wird ein Gateway benötigt. Dieses empfängt über 2.4Ghz die Daten und bietet diese über diverse Schnittstellen zur Weiterverarbeitung an. MySensors bietet mehrere Möglichkeiten ein Gateway für die Sensoren zur Verfügung zu stellen. Das Ganze reicht von einem Seriellen Gateway1 über den direkten Anschluss an einen Raspberry2 oder auch ein WLAN Gateway3. Um etwas flexibler zu bleiben habe ich mich für ein Ethernet Gateway4 entschieden.