Creative Commons images are CC BY-NC-SA 3.0

24.95

added to your
shopping cart

quantity
In stock 48 in stock
24.95 1+ units
22.46 10+ units
19.96 100+ units

Description: Have you ever wanted your project to just "hibernate" until someone picks it up or moves it? It's a great strategy for dramatically extending the battery life of a widget that doesn't need to be active all the time. The Wake-on-Shake board is designed to make it really simple to do just that!

The Wake-on-Shake, based on a concept by Nitzan Gadish of Analog Devices, combines the ATTiny2313A with the ADXL362 low-power MEMS accelerometer to cut power to your project for long periods of time, all the while waiting for a shake or a bump and sipping <2uA at 3.7V! With power consumption that low, the limiting factor for lifespan in most devices will be aging-related self-discharge of the batteries.

The board is easy to use, you basically connect it as a power switch between your device and a power source (2.0-5.5V). By default, the board will activate the load when it experiences a mild bump or tilt; the load will be powered for 5 seconds after that. Using a serial data connection, the sensitivity can be increased or decreased, as can the delay time. Additionally, the “WAKE” pin allows the load to control when it goes back to sleep. By pulling the wake signal high (to at least 2.7V), the load will remain energized until it releases the pin.

Note: While it is possible to connect the load to the on-board serial port, allowing the load to access the ADXL362 and EEPROM storage of the ATTiny2313A, caution must be exercised when doing this to avoid sourcing current to the load through the serial port data lines on the ATTiny2313A, which could damage the ATTiny2313A as well as causing excessive off-state power dissipation.

Features:

  • Supply Voltage: 2.0 - 5.5VDC
  • Power Consumption in Hibernation: <2uA @ 3.7V
  • Wake Signal: 2.7 - 15V
  • Serial Header for Configuration is FTDI Basic Breakout Compatible
  • ISP Header for ATTiny2313A is Broken Out, No Bootloader is Available
  • 2mm JST Connector for LiPo Battery Input

Documents:

Comments 39 comments

  • AWESOME!!! We can now make all of our elecronics behave like older TV sets! Just bang the top of the device and it starts working! :)

  • I am sure nobody in this group would have a problem figuring it out, but the manual says it communicates at 2400 bps. In reality it seems to be 9600 bps.

    It is working great and I am looking forward to using it. Thanks, Mike, for saving me a lot of programming that I was planning to do.

  • I like the black JST, do you have a part# for that?

  • Can someone explain how to change the parameters of the wake-on-shake, as to change the time before resuming sleep, etc.? I’m trying to reverse engineer the code in the Github Repo but so far have had no luck compiling in the Arduino IDE. I’m not sure how to setup the IDE for programming the wake on shake board, i.e. what board do I choose, etc?

    I see this is partially explained below. But an example Arduino sketch would be great.

    Thanks!

  • Is there a way to tap into the accelerometer outputs (the ADXL362 looks like a 3-axis sensor) once the Arduino is awake? I’m building a battery-powered device that also has an accelerometer to detect orientation that could benefit from having a Wake and Shake for power management, and it’d be sweet if I could do away with the other sensor.

    Or - is it possible to program the WaS so that it only wakes the unit up when a certain orientation is detected? That might also work in my project.

    • The entire contents of the ADXL362 register space is available to the user for both read and write. To read a register from the ADXL 362, issue an ASCII ‘r’ over the serial interface, then the register’s address, then a carriage return or line feed. The 8-bit contents of that register will come back across the the serial line. X, Y, and Z data are in registers 0x08, 0x09, and 0x0A, respectively.

      To change the wake-up parameters is somewhat harder; I’m not going to try and explain it here. You’ll have to dig into the datasheet to figure out what register settings are required. To change a register, first write the new value over the serial port by sending ASCII ‘b’, the new value, and CR or LF. Then, issue ASCII ‘w’, the register address, and CR or LF. Using that method, you can set the wake-up parameters to arbitrary new values. The new settings will not persist through a power cycle, of course.

      • Please see my question above. Can you provide a small example sketch? Thanks!

        • The code for the Wake-on-Shake wasn’t developed in Arduino, and can’t be compiled with the Arduino IDE.

          It was developed with WinAVR, as a standard C project. There were two reasons for that: first, integrating the chip into Arduino proved more of a hassle than I wanted, and second, the Arduino IDE includes a lot of “cruft” which is unnecessary to functionality but would’ve bloated the executable size beyond what can be fit into the limited memory of the device on the board. As it is, the memory is 100% full.

          The user’s guide (link above) explains how to connect to the board via serial connection (using, say, an FTDI Basic) and change the thresholds and timeouts. If you want to work on the firmware for the board itself, that’s a more involved process. You should be able to do it from within AVRStudio.

          • Thanks for the response! (Edit)

            I don’t want to do anything fancy. I just want to adjust the “Time after wake-up before returning to sleep mode” parameter.

            From the user guide:

            “EEPROM Memory Space Reference The Wake-on-Shake uses on-board EEPROM memory to store configuration parameters even if power is removed. The EEPROM is exposed through the serial interface; users can alter these values as they see fit.”

            And apparently the address for this param on the EEPROM is 2-3. I should be able to set this address to a number between 0 - 65535.

            But exactly how? What software and hardware do I need? What are the exact serial commands to do this?

            Thanks.

            • Still looking for help with this. I’d think there should be a way of changing the thing’s basic parameters. In fact is says you can in the user guide but doesn’t explain “how”.

              I’d think one could program an arduino to issue the appropriate serial commands to set the wake on shake’s eeprom with the desired parameters.

              Can someone provide a sample sketch?

              Thanks.

              • Check the User Manual again, page 3 is a list of commands to change the basic parameters.

                • OK. I had to read it a few times. I think I see where the info is. Thanks for your reply!

                  • A want to be able to reliably read before attempting to write. I have the wake on shake’s serial connection connected to Serial 1 on an Arduino Mega 2560. I’m writing a read command ‘E’, for reading the EEPROM, on Serial 1 and printing the reply to the serial monitor (serial 0). Here’s the code:

                    (edit) The following works to some degree but not completely. You really have to dig into the source code to figure out how to read parameters from the wake on shake.

                    It turns out writing (to change) a parameter is much easier. See my reply to this post.)

                         #define DELAY_FACTOR 10
                    
                        void setup() {
                          // initialize both serial ports:
                          Serial.begin(9600);
                          Serial1.begin(9600);
                    
                          // Establish contact (this seems to help..why?)
                          while (Serial1.available() <= 0) {
                            Serial.print('A');   // send a capital A
                            delay(300);
                          }
                        }
                    
                        void loop() {
                    
                          Serial.println("--------Start:--------");
                          readAddress(0);
                          readAddress(1);
                          readAddress(2);
                          readAddress(3);
                          readAddress(4);
                          readAddress(5);
                          readAddress(127);
                          Serial.println("--------End-----------");
                    
                          while(1);  // do the above only once
                        }
                    
                        void readAddress(byte addr) {
                            char buf[16];
                    
                            Serial1.write('E');
                             Serial1.write(addr);        
                             Serial1.write('\r');
                    
                             delay(DELAY_FACTOR);
                             if(Serial1.available() > 0)
                             {
                                   // Read up till the newline which signals the end of the data stream
                                   //
                                 int n = Serial1.readBytesUntil('\n', buf, 16);
                    
                                 for(int j=0; j<n; j++)         
                                       Serial.print(buf[j]);                        
                             }
                             else
                                 Serial.print("empty");
                    
                             Serial.println("");
                             delay(DELAY_FACTOR);
                    
                        }
                    

                    Here is what is printed to the serial monitor:

                     A--------Start:--------
                    ���� 00150
                     05000
                     :-)
                     00173
                     :-)
                     :-(
                     :-(
                     --------End-----------
                    

                    I’m getting closer. I’m seeing the default values for the 1st 2 parameters. But why am I not seeing the others?

                    Any help with what I’m missing is appreciated. Thanks!

                    • OK. HERE IS THE ANSWER I WAS LOOKING FOR!!

                           /********************************************** 
                            This is code for an Arduino to change the
                            "delay between wake up and return to sleep"
                            parameter on the Wake-On-Shake (WoS).                       
                      
                            See the user guide for the syntax to change other parameters.
                      
                            It is assumed that the serial port on the WoS
                            is connected to Serial1 on, say an Arduino Mega.
                      
                            (Connect RX to TX, TX to RX, Vcc to 3.3V and GND to GND.) 
                      
                            PLEASE NOTE: I'm no expert. This code worked for me. 
                            But I can't guarantee it's accuracy.      
                          **********************************************/
                      
                         void setup() {
                            // Initialize the serial port that's connected to the Wake-on-shake. 
                           //  (Note: I've used Serial1 which is the 2nd serial port on the Arduino Mega 2560
                           //   because Serial (the first port) is used to program the Arduino.)
                           //     
                            Serial1.begin(9600);
                      
                            // Establish contact (this seems to help..not sure why?)
                            while (Serial1.available() <= 0) {            
                              delay(300);
                            }
                      
                            // This is command string.
                            // 'd' is the specific command to change the
                            // "delay between wake up and return to sleep" parameter.
                            // "50000" is the delay time in milliseconds.
                            // The command string must end in either '\r' and/or '\n'.
                            //
                            Serial1.write("d50000\r");
                          }
                      
                          void loop() {
                      
                            // nothing to do here
                          }
                      
      • Can I read raw analog outputs from it as with plain accelerometer breakouts or do I need to talk to it over serial? I’m aiming to keep the cost down on a portable device and would rather avoid having to include a serial board of some kind.

        • No, the analog outputs are not available. The ADXL362 is an SPI-only device; the analog outputs of the various axes are not available on the pins under any circumstances.

      • That’s excellent - since I can read from the accelerometer, this will do everything I need.

  • I can’t get the Wake-On-Shake to wake up on its own. 3.7v is going in, but there is nothing coming out of VOUT unless the Wake pin is jumped.

    • Contact tech support and they’ll help you figure out whether you got a bad board. Shouldn’t happen but it IS possible.

  • Could this work in an “Oh Fudge” to replace the arduino and accelerometer?

    • in theory yes, but I think this would actually be too sensitive for an “Oh Fudge” application. You’d be setting off the alarm every time the box got moved.

  • Will it activate if i move the board along the x axis only. I want to put it in a shopping trolley, when the trolley moves, i want it to activate

  • On the next version, perhaps you could breakout the Vreg En line to allow for more seamless energy harvester hackery.

    • I’m curious about this idea- what is the advantage of pulling out the enable pin? Why disable the circuitry when it draws less than a microamp?

      I’m totally willing to consider this, but I don’t fully understand the point. Any circuitry that would enable the wake on shake is liable to draw much more power than the wake on shake does.

  • Wow! Best commented code I’ve seen SparkFun produce.

  • I’m really confused here, can this module supply 5V system that requires about 200mA to operate?. I reviewed the schematic to double check and it seems to me it provides only 3.3V. Am I correct?

    • It should do that just fine. The VOUT pin is connected to VIN through a PMOSFET, so you’ll see a small voltage drop across that FET. The biggest limitation is that the nanopower regulator can only handle a 5.5V input voltage, so you need to be careful about that.

  • Just how sensitive is this? Could it possibly be used in place of the Arduino and accelerometer in the Oh Fudge? Just put it in the box along with the beefcake and horns and maybe a small 555 arming circuit?

    • Oh yes, easily. There’s a painting on the wall outside my office that turns on when you thump the wall. The sensitivity is variable, but picking it up will almost certainly trigger it.

  • Will the unit remain on constantly when under motion? for example would it remain on while driving a car and turn off when the car is stopped?

    • No. It will turn off after the designated time, and then reset once the module has remained still for approximately 2.5 seconds.

      The code is all available on GitHub (https://github.com/sparkfun/Wake_on_shake) and if you have Arduino installed, you have the tools you need to change and build a new executable.

      Since the load has control over the power, as well, you could use the serial port to query the accelerometer and then release when acceleration stops. That’s probably easier, since it doesn’t require any programming; the flash on the uC on this baby is full.

      • I reviewed the code, but couldn’t understand how to make it wake while the circuit is moving,i.e walking and sleeps when it the circuit stops moving. Any guidelines you may suggest?

        • The ADXL362 datasheet is a better place to look for help with that than the code is. Truthfully, I haven’t had the time to fully explore the capabilities of the ADXL362’s motion detection abilities; once I figured out how to do what I wanted here, I had to move on to other projects.

  • Thats funny it doesn’t look like a battery.

    It might be in the wrong category.

  • Anyone else have those tin cans as a kid that when picked up and turned over would “mooo”? Flashbacks.


Related Products