D21G features

RTC, EEPROM, WDT

Tom

Real Time Clock - RTC

Industruinos with the D21G topboard have a built-in RTC (MCP79402 with I2C 0x57 and 0x6F) that can be used with this library

A simple example that displays the date and time on the LCD can be found here.

EEPROM

The D21G does not have any built-in EEPROM as the usual Arduino chips have, but the board includes external EEPROM over I2C. Addresses are 0x50, 0x51, 0x52, 0x53.

Each of the 4 I2C addresses have 255 bytes available; in total 1kByte.

This EEPROM can be used with this library, or you can also use the Wire library directly to read/write bytes.

Check out this example sketch that uses the above library to write/read byte, long, and float types (including the conversions), output on the left.

WDT - Watchdog Timer

The Adafruit SleepyDog library works on the D21G as in this example.

It requires the installation of the ASF core library too.

The above example activates a watchdog timer of 4 seconds, and goes through 10 loops that include a watchdog.reset() which tells the WDT that all is fine. Then it starts a delay() that is longer than the WDT period, so after 4 seconds the unit resets and starts the sketch again. 

SLEEP

This library also has a sleep function to reduce power consumption. Have a look at the library example 'sleep.ino' and use the function (for 5 seconds sleep)

  int sleepMS = Watchdog.sleep(5000);

My test on a PROTO D21G show (12V on Vin):

  • awake, full backlight: 8mA (may be higher on more recent batches)
  • awake, no backlight: 5-7mA
  • sleeping, no backlight: 2mA
When the PROTO is powered by 5V (on 5V terminal), the results are:
  • awake, full backlight: 17mA (may be higher on more recent batches)
  • awake, no backlight: 13mA
  • sleeping, no backlight: 4mA

For an IND.I/O D21G the results are (12V, I/O channels not connected to anything):

  • awake, full backlight: 180mA
  • sleeping, no backlight: 175mA
So not much power is saved with the sleep mode, as the IND.I/O baseboard already draws 49mA in idle state, without the MCU/topboard connected.
==================================================================
Please note that upload seems to be disabled in sleep mode, so to activate the D21G's bootloader, it may be necessary to press the Reset button on the topboard twice.
==================================================================