2
\$\begingroup\$

I'd like to develop an Arduino board with the ATmega32U4 MCU but in a low power mode. I've been searching and I know I have to change the fuses to prevent the brown-out-reset (BOR) when the battery is lower than a certain voltage. I'd also have to change the CLK bits to divide the 16MHz crystal into a lower frequency mode to consume less energy.

I found this webpage to change the fuses.

I just don't know how to do this (which program to use - FLIP?? and how to proceed) and if by doing this bootloader change the board would still be recognized in the Arduino 1.0 program (boards sections - like a Leonardo variant 8MHz for example). I have the 6x2 ISP pins accessible.

By the way, I have a board with the ATmega32U4 and it's 0.1uF capacitors and a 16MHz crystal (+ 2x 22pF caps). I also have the ATMEL mkII programmer with the ISP 3x2 MISO/MOSI/CLK/RESET/VCC/GND connector.

Would somebody know how to help me?

\$\endgroup\$
  • \$\begingroup\$ You'd be best off asking on the Arduino forums TBH \$\endgroup\$ – Majenko Jun 13 '14 at 11:45
1
\$\begingroup\$

The program to use would be avrdude.

What you need to change is not so much the bootloader (although if you want to build an Arduino compatible board, you'll need to upload an Arduino compatible bootloader) as the fuse bits.

The details of those (e.g. clock rate, brown out settings) are generally not relevant for Arduino compatibility, but the cleanest approach is to make a custom entry in boards.txt for your board, cloning e.g. a Leonardo entry but tweaking the fuse bits to your preferences. That allows you to set those fuse bits through the "Burn Bootloader" command in Arduino.

\$\endgroup\$
1
\$\begingroup\$

Easiest would be to use the ATMEL mkII and avrdude. The webpage already contains the avrdude arguments. avrdude can be found the the arduino application folder (under mac /Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin).

You'd run something like

avrdude -v -patmega32u4 -cavrispmkII -B10 -Pusb -U lfuse:w:0x5e:m -U hfuse:w:0x99:m -U efuse:w:0xf3:m 

However the following things will change when you set the Divide clock by 8 internally (CKDIV8).

First the arduino bootloader will probably no longer work. Instead you can program the board using the Atmel mkII instead of the board's USB.

Secondly, thinks like delay() will take 8 times as long. So delay(1000) will not take 1 second, but 8 seconds.

To fix this, you need to create a new board. Just go to you arduino home folder ~/arduino or my documents\arduino. Create a folder named hardware, if it doesn't yet exist. Inside this folder create a folder named e.g. atmega32u4. In this folder create a text file called boards.txt, with the following contents

atmega32u4.name=ATMega32u4  2Mhz
atmega32u4.upload.protocol=avrispmkII
atmega32u4.upload.maximum_size=28672
atmega32u4.build.mcu=atmega32u4
atmega32u4.build.f_cpu=2000000L
atmega32u4.build.core=arduino
atmega32u4.build.variant=leonardo

Next create a folder names variants. Copy the leonardo here, which can be found in the arduino application folder /Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/variants/leonardo.

In the Arduino IDE, you should now be able to select Tools -> Boards -> ATMega32u4 2Mhz.

\$\endgroup\$
  • \$\begingroup\$ Hello Gerben. Thank you so much for the detailed Mac guide. I'd only ask you if it is possible to do this in Windows? \$\endgroup\$ – Electronics_Guy Jun 15 '14 at 21:40
  • \$\begingroup\$ Should be pretty much the same, except slightly different paths. Just change /Applications/Arduino.app/Contents/Resources/Java/... to <<arduino-folder>>\java\... (probably c:\Program Files (x86)\arduino\java\...) \$\endgroup\$ – Gerben Jun 16 '14 at 18:37
  • \$\begingroup\$ @Gerben: Do you know any solution for this? \$\endgroup\$ – user46983 Jul 8 '14 at 10:02
  • \$\begingroup\$ What is "this"? \$\endgroup\$ – Gerben Jul 8 '14 at 13:26
0
\$\begingroup\$

I've already tested your solution. I've started by programming a normal Leonardo bootloader in ArduinoV1 program. I've also tested a Blink to make sure it was working. The current consumption of the board @3.3V Vcc is 16mA (without USB connected) and 19mA with USB connected. I wanted to reduce the power by reducing the frequency and minimum voltage limited by BOR. Then i used the AVRDUDE run through the the comand line, and connecting my ATmega32u4 board with the Atmel Mkii 3x2 pins. The PC asked me for "Would you like this fuse to be changed back?" I answered No and the status was ok but the consumption was like before. Then i tried to answer Yes but i waited more than one minute of programming and nothing happened. Please look at my log file: https://dl.dropboxusercontent.com/u/3172596/avrdude%20log.png

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.