Need help/consultation with sleeping ATMEGA16U2

I need to save energy :slight_smile: and so I plan (on MEGA 2560) to connect USBVCC pin to PB6 pin of ATMEGA16U2:

  • when USB is connected the PB6 is "1", when disconnected USB the PB6 is "0" (some pull-down will be needed).
  • in ATMEGA16U2 firmware I need add some code for external interrupt on PB6:
    on falling edge: deep sleep :sleeping:
    on rising edge: wake up

When USB cable is connected the ATMEGA16U2 is in normal mode,
when USB cable is not connected the ATMEGA16U2 is in sleep mode.

I think it saves about 14 mA!

Is it a good idea? :wink:

Normally, when I think about saving energy, the context is in the "Pro Mini" or bare-328P designs. Saving 14mA on a Mega2560 is just something that seems "wrong" to me.

Is a Mega2560 needed? What is the total power consumption required from the batteries?

Assuming you cannot use a Mini, have you thought about an Atmega1284? A lots of work has been done on this forum to create a stable core file for the 1284... you should investigate.

Ray

I save about 45 mA on main procesor! Glutton is the second procesor (16U2).
Yes, mega2560 is necessary, I have a lot of peripheral - sensors and a stepper motors. But this peripherals works only for a little time the board is sleeping and waiting for user requirements.

entony:
I need to save energy

Suggestion: Use your Mega2560 as a development board to refine your software, then when you are ready to finalize your project (and save energy), move it over to a board that does not have the USB-to-serial and other power-hungry crud built in, such as: Cross Roads Electronics