Wake-on-Shake Hookup Guide

Pages
Contributors: Toni_K, SFUptownMaker
Favorited Favorite 7

Command Set

If you would like to simply test out the Wake-on-Shake over a serial connection before permanently embedding it in your project, take a look at the following command settings. These will also allow you to customize your hardware settings depending on your particular project applications. If you need a little refresher on how to connect the Wake-on-Shake with a serial terminal, check out our tutorial on Serial Terminal Basics!

Make sure you've connected an external power supply to the JST connector or the 0.1" headers next to it!

Communication Settings

Using the serial header interface, the user can communicate with the Wake-on-Shake over a basic terminal connection. You can test out the following commands this way, to determine what is the best functionality of the Wake-on-Shake for your particular application.

For interfacing with the Wake-on-Shake, you will need to use the following serial terminal settings:

  • Baud Rate: 9600 bps
  • Data Size: 8 bits
  • Parity: none
  • Stop Bits: 1
  • Voltage Level: 3.3V

Standard Commands

Remember: 'lf' is line feed (10 or 0x0A) and 'cr' is carriage return (13 or 0x0D).
  • Threshold Level t<0-248><cr>|<lf>: This command will set the threshold level at which the device will wake from sleep. Default value from the factory is 150mG. This setting will accept any value between 0 and 2,048.

  • Delay d<2000-65535><cr>|<lf>: This command sets the delay between the device waking up and returning to sleep. The default value is 5s. The input number is in milliseconds, and can range from 2,000 to 65,535.

  • Sleep z: This command will set the device to sleep. Functionally, this "shortcuts" the delay command, moving the sleep timer closer to zero. This allows the Wake-on-Shake to finish any general bookkeeping commands before powering down. After receiving this command, sleep mode will occur within 35ms.

Advanced User Commands

  • Pin State p<0-3|6>: Print the current state of the defined pin on the 0.1" header on the board. Number input by user defines pin (i.e., p0 prints PB0 pin state). Pin state can either be '0' or '1'.

  • Drive Pin Low L<0-3|6>: Drive user-defined pin low.

  • Drive Pin High H<0-3|6>: Drive user-defined pin high.

  • Buffer Write b<0-255><cr>|<lf>: Place an 8-bit value into the device's write buffer. This value can been written to either an arbitrary EEPROM address -or- to an arbitrary register in the ADXL362, depending on the next command.

  • Write Buffer to ADXL362 w<0-64><cr>|<lf>: Write the 'Buffer Write' value into the register of the ADXL362 specified in this command. Please refer to the ADXL362 datasheet for information about the registers.

  • Write Buffer to EEPROM e<0-127><cr>|<lf>: Write the 'Buffer Write' value nto the ATTiny2313A EEPROM memory at the address specified in this command. This can be used to store data in non-volatile memory by the user's application, or to alter operation settings not normally exposed to the user.

  • Print ADXL362 Register r<0-64><cr>|<lf>: Print the contents of the sepcified ADXL362 register to the serial port.

  • Print ATTiny2313A EEPROM address E<0-127><cr>|<lf>: Print the contents of the specified ATTIny2313A EEPROM address to the serial port.

EEPROM Memory Space Reference

Thanks to the on-board EEPROM memory storage, configuration paramters are saved even if power is removed from the Wake-on-Shake. These values can be changed via the serial interface. There are five settings stored in the EEPROM of which the user should be aware.

EEPROM User Configurable Settings
AddrNameDefaultDescription
0-1ATHRESH150Activity threshold setting (0-2048)
2-3WAKE_OFF S5000Time after wake-up before returning to sleep mode(0-655535)
4-5ITHRESH50Inactivity threshold setting (0-2048)
6-7ITIME15# samples (12.5Hz) below ITHRESH before wake interrupt enabled
127KEY_ADDR123If !=123, restore EEPROM locations to default

  • Key Address is used to record whether EEPROM values have been configured or not. On the first power up, the firmware will check to see if that location is set to a specific value (123). If not, it will initialize the other memory locations, along with the key address itself.
Note: A reset to factory settings can be forced by writing this location to any value other than 123 and power cycling the board.
  • Inactivity Threshold is the level below which the ADXL362 must sense movement before it resets and begins waiting for motion again. By default, this is 50mg.

  • Inactivity Time Delay is the amount of time the motion threshold should be below the inactivity threshold before the reset to the motion trigger occurs. Be default, this value is 15. This translates to about 2.5 seconds.