{"id":383,"date":"2012-10-02T21:02:25","date_gmt":"2012-10-02T21:02:25","guid":{"rendered":"http:\/\/ava.upuaut.net\/?p=383"},"modified":"2012-10-25T20:01:13","modified_gmt":"2012-10-25T20:01:13","slug":"low-powered-tracker-1-8v-4mhz-arduino","status":"publish","type":"post","link":"https:\/\/ava.upuaut.net\/?p=383","title":{"rendered":"Low powered tracker 1.8V 4Mhz &#8220;Arduino&#8221;"},"content":{"rendered":"<p><strong>Update : The run time for the 1.8V 4Mhz board was 27.5 hours vs 13 hours for the 3.3V 8Mhz version. This is a huge difference and we haven&#8217;t even started on power saving modes in software yet.\u00a0<\/strong><\/p>\n<p>The new <a href=\"http:\/\/ava.upuaut.net\/?p=353\">pAVA R6 board<\/a> was designed with the ability to be able to run the logic at 1.8V if fitted with the correct regulator. Hopefully this will save even more power, as I write this the board is current on test with the same code that powered the 3.3V version for 13 hours from a single AA.<\/p>\n<p>In order to drop the voltage to 1.8V for the board a few small changes had to be made, primarily the ATMega328P has to run at 4Mhz as opposed to 8Mhz to stay in spec. Secondly the uBLOX MAX6Q module has to be switched out for the 1.8V rated <a href=\"http:\/\/ava.upuaut.net\/store\/index.php?route=product\/product&amp;path=59_64&amp;product_id=71\" target=\"_blank\">MAX6G<\/a> module. The RFM22B is fine down to 1.8V.<\/p>\n<p>So fitted with a 4Mhz crystal and a\u00a0TPS61200DRC regulator the board has been tested step by step this week to ensure the AVR works, then the radio and finally the GPS. Although I utilise the Arduino enviroment for programming I use an ICSP Programmer so don&#8217;t use the Arduino boot loader.<\/p>\n<p>However to facilitate the new board I did have to make a custom entry in boards. Firstly I had to program the fuses in Atmel Studio 6. I turned the brown out protection off, set the fuse to utilise an external crystal 3-8Mhz. Secondly I added the following to boards.txt in Arduino :<br \/>\n<pre class=\"preserve-code-formatting\">##############################################################\npAvaR6LP.name=pAVA R6 Low Power (1.8V, 4 MHz) w\/ ATmega328\npAvaR6LP.upload.protocol=arduino\npAvaR6LP.upload.maximum_size=30720\npAvaR6LP.upload.speed=57600\npAvaR6LP.bootloader.low_fuses=0xFD\npAvaR6LP.bootloader.high_fuses=0xDA\npAvaR6LP.bootloader.extended_fuses=0xFF\npAvaR6LP.bootloader.path=atmega\npAvaR6LP.bootloader.file=ATmegaBOOT_168_atmega328_pava_4MHz.hex\npAvaR6LP.bootloader.unlock_bits=0x3F\npAvaR6LP.bootloader.lock_bits=0x0F\npAvaR6LP.build.mcu=atmega328p\npAvaR6LP.build.f_cpu=4000000L\npAvaR6LP.build.core=arduino\npAvaR6LP.build.variant=standard<\/pre><br \/>\nI don&#8217;t actually think you need to change the boot loader however for completeness I did recompile the boot loader as follows :<\/p>\n<p><span style=\"line-height: 22px;\">1. Add the following to your PATH\u00a0environmental\u00a0variable :<\/span><br style=\"line-height: 22px;\" \/><span style=\"line-height: 22px;\">\u00a0C:\\arduino-1.0.1\\hardware\\tools\\avr\\utils\\bin;C:\\apps\\arduino-1.0.1\\hardware\\tools\\avr\\bin;<\/span><br style=\"line-height: 22px;\" \/><span style=\"line-height: 22px;\">Obviously substituting your paths as needed.<\/span><br \/>\n<span style=\"line-height: 22px;\"><span>\u00a02. Edit\u00a0\u00a0C:\\arduino-1.0.1\\hardware\\arduino\\bootloaders\\atmega\\Makefile adding :<br \/>\n<\/span><\/span><br \/>\n<pre class=\"preserve-code-formatting\">atmega328_pava: TARGET = atmega328_pava_4MHz\natmega328_pava: MCU_TARGET = atmega328p\natmega328_pava: CFLAGS += &#039;-DMAX_TIME_COUNT=F_CPU&amp;gt;&amp;gt;4&#039; &#039;-DNUM_LED_FLASHES=1&#039; -DBAUD_RATE=57600 -DDOUBLE_SPEED\natmega328_pava: AVR_FREQ = 4000000L\u00a0\natmega328_pava: LDSECTION = --section-start=.text=0x7800\natmega328_pava: $(PROGRAM)_atmega328_pava_4MHz.hex<\/pre><br \/>\n3. From\u00a0C:\\arduino-1.0.1\\hardware\\arduino\\bootloaders\\atmega<br \/>\nType : make atmega328_pava<\/p>\n<p>Once done you can program the chip up via the ICSP as normal, I was unable to get the boot loader to work but as I don&#8217;t use it anyway I didn&#8217;t spend much time on this.<\/p>\n<p>One caveat is the procedure &#8216;delayMicroseconds&#8217; in Arduino will now miscalculate times. If you review wiring.c in the Arduino code it is unaware of sub 8Mhz microcontrollers. This is not a bug, there is no standard Arduino that runs at 4Mhz. To get your timing correct just half the time you would normal use. For 50 baud RTTY the delayMicroseconds is normally about 20000\u00b5S but on this board to compensate I use 10000\u00b5S. Alternative feel free to hack up wiring.c to make it aware of 4Mhz clock speed.<\/p>\n<p>Anyway proof as they say is in the pudding so I will report back in hopefully more than 13 hours to advise on the run time of this board.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Update : The run time for the 1.8V 4Mhz board was 27.5 hours vs 13 hours for the 3.3V 8Mhz version. This is a huge difference and we haven&#8217;t even started on power saving modes in software yet.\u00a0 The new &hellip;<\/p>\n<p class=\"read-more\"><a href=\"https:\/\/ava.upuaut.net\/?p=383\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-383","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/ava.upuaut.net\/index.php?rest_route=\/wp\/v2\/posts\/383","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ava.upuaut.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ava.upuaut.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ava.upuaut.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ava.upuaut.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=383"}],"version-history":[{"count":11,"href":"https:\/\/ava.upuaut.net\/index.php?rest_route=\/wp\/v2\/posts\/383\/revisions"}],"predecessor-version":[{"id":398,"href":"https:\/\/ava.upuaut.net\/index.php?rest_route=\/wp\/v2\/posts\/383\/revisions\/398"}],"wp:attachment":[{"href":"https:\/\/ava.upuaut.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=383"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ava.upuaut.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=383"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ava.upuaut.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=383"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}