How to Make a BeagleBone-Based Appliance Notification Texter

Contributed By Digi-Key's North American Editors

Once a washer or dryer cycle has started, users have to wait up to an hour for them to finish their cycles. Too often, they forget to check in on the appliances so wet clothes sit clumped for hours, while dry clothes sit to wrinkle, leading to user frustration. While this project will show you how to set up the BeagleBone Green or BeagleBone Black to send an alert text to any cellphone when the wash or dry cycles are completed to eliminate this frustration, what you learn can be applied to any motion-sensing project.

This is a real-world problem/solution scenario that is solved using the Internet of Things (IoT), an accelerometer, the BeagleBone, some extraneous hardware and some light programming. By following along with the process, you will get familiar with the workings of the BeagleBone (Green or Black) and in doing so it may fire your imagination for other applications. In the meantime, you might want to make this for yourself, your significant other, or a friend.

Let your appliance do the texting

Given how much time is spent on cellphones, what better way to solve the problem of distraction than to have the washer and dryer send a text when the laundry is done? Without tampering with the machine or the AC power lines, this project shows how to use an accelerometer to detect machine operation. The concept is that the machine vibrates when in operation and the accelerometer is used to detect the presence and absence of that vibration to indicate cycle status.

For this project, we used both the new Wi-Fi-enabled BeagleBone Green as well as the BeagleBone Black. BeagleBone is a great, stable platform for IoT-targeted applications, with more than enough general-purpose I/O to connect to sensors and expansion boards. Except for the BeagleBone Green’s built-in wireless capability, the setup is identical so they can be used interchangeably.

Most people don’t realize that you can send a text (SMS) via email. So, by hooking up the BeagleBone via Wi-Fi and using an email server, we can send a text via email. The carriers for cellphone service have provided an easy way to do this. It is the same way you address an email: provided in the list below:1

  1. AT&T:
  2. T-Mobile:
  3. Verizon:
  4. Sprint: or
  5. Virgin Mobile:
  6. Tracfone:
  7. Metro PCS:
  8. Boost Mobile:
  9. Cricket:
  10. Nextel:
  11. Alltel:
  12. Ptel:
  13. Suncom:
  14. Qwest:
  15. U.S. Cellular:

Parts and basic design

A basic parts list is given at the end of this article, but it primarily comprises a BeagleBone Black or Green, an accelerometer, an LED, a power on/off switch, and some cabling, as well as a USB battery pack and two industrial magnets.

Diagram of base circuit design for the texter system using a BeagleBone Green (click for full-size)

Figure 1: Base circuit design for the texter system using a BeagleBone Green, an accelerometer, a USB power pack, and Python code. (Diagram drawn using Digi-Key Scheme-it)

We created a Wi-Fi-enabled box that attaches to a washer or dryer via magnets and as mentioned it works by detecting if the washer/dryer is on or off by reading its vibration. There is a CW Industries switch and a Lumex Opto/Components LED on the top of the Bud Industries box that let you turn on and off the device and provide an indication as to its on/off status. When the user is using their washer or dryer, they simply turn on the device before they start the washer or dryer and turn it off when they retrieve their clothes after the washer or dryer is finished with the load.

As the device uses vibration, the design needed to factor in that there are cycle changes in a washer and dryer that could fool the device into thinking that it is off when the motor stops. This stop period is usually up to 30 seconds.

Image of power switch and indicator

Figure 2 (top)

Image of 'black box” that rests atop the appliance

Figure 2 (bottom)

Figure 2: Except for the power switch and indicator LED (top), the system really is a “black box” that rests atop the appliance (bottom.) (Image source: Digi-Key Electronics)

Image of accelerometer and BeagleBone Green

Figure 3a: Inside the project box, the accelerometer (red pc board on left) and BeagleBone Green (center, green pc board) are attached to the lid with stand offs. The main difference between the Black and Green variants of the BeagleBone is that Green has built-in wireless communication capabilities. (Image source: Digi-Key Electronics)

Image of board with BeagleBone Black

Figure 3b: Another view of the board, this time with the BeagleBone Black, showing white Wi-Fi adapter on right. (Image source: Digi-Key Electronics)

Image of BeagleBone Black and support electronics

Figure 4: Another angle of the BeagleBone Black and support electronics. The bottom shows the two industrial magnets and the external battery pack attached using hot-glue. (Image source: Digi-Key Electronics)

To measure whether the washer/dryer is on or off, the accelerometer measures the X axis of the three axes provided. This is because it is the X axis (horizontal plane) of the surface of the appliance that moves the most: side to side, versus up and down. A timer is implemented into the code to determine if the washer/dryer has stopped for 1 minute. Since a cycle change takes less than 1 minute, it only sends a text after 1 minute of no activity. This ensures that the washer/dryer has completed its cycle before sending the text.

There is a subroutine that measures out 50 readings in 10 seconds, corresponding to a reading every 200 ms. After 10 seconds of readings, the subroutine returns the current state of the device. It returns whether or not the accelerometer X-axis numbers are in range of the baseline, which is taken when the device is first turned on and the washer/dryer is off. The 50 readings are compared, then calculated, and it is determined whether the values of the X-axis are in-range or out-of-range. The in-range values indicate that the device does not detect vibration; therefore system is in standby mode and waiting for the appliance to start.

Once the device detects vibration, the mode is then set to ON and the cycle and timing detection starts. When a cycle ends, the device vibration readings will go “in-range” and the cycle-check mode starts along with the 1-minute timer. If no activity, the device will go into Finish mode and send a text. It will then go back to standby to wait for another start.

The texting part works by sending an email via the BeagleBone. Since we are using email, we need an email handling service like Gmail to send the email, which gets translated into a text by the carrier. To set this up you need an email to login to, for example, in Python:

#Assign sender and receiver, X represents the digits of the phone number

sender = ''

receiver = ''

#Next we create the message:

header = 'To: ' + receiver + '\n' + 'From: ' + sender

body = 'Laundry is DONE!'

signature = '- Sent From BBB'

#Load the gmail server and port into the class “mail”

mail = smtplib.SMTP('',587)

#run a subroutine with your email login and password for your gmail.

def sendText():




mail.login('', 'password’')

mail.sendmail(sender, receiver, '\n\n' + body + '\n\n' + signature)


Running the sendText() function will send your text with the initialized variables loaded into it.

Wi-Fi connection

The Python code for this project was written in the Cloud9 IDE provided inside the BeagleBone using the USB connection in an Internet browser. The default address is Once the box is connected to Wi-Fi using the BeagleBone’s Wi-Fi IP address, you can SSH into it using a terminal program like PuTTY and run the Python script made in Cloud9. Typing in “ifconfig” into the terminal gives you the IP address of the BeagleBone connected via Wi-Fi.

Screenshot of the Cloud9 IDE showing Python code and terminal

Figure 5: Screenshot of the Cloud9 IDE showing Python code and terminal. (Image Source: Digi-Key Electronics)

Accelerometer connection:

The Sparkfun MMA8452Q accelerometer is powered with 3.3 V from the BeagleBone and communicates via I2C. The Python program writes to the configuration registers setting up how the data should display and configuring the mode you want to use. For this project we used the XYZ mode where the device is polled from the I2C where the X-axis values are translated into g’s (acceleration). The Python program reads the values from a register on the accelerometer and all mathematical translation from the polled values to the units it uses to determine its state is done by the Python program.

Image of Sparkfun’s MMA8452Q accelerometer module

Figure 6: Sparkfun’s MMA8452Q accelerometer module is used in the XYZ mode and X-axis values are translated into g’s to detect vibration. (Image source: Sparkfun)

Text Received:

Screenshot of received text on phone

Figure 7: Screenshot of received text on phone. (Image source: Digi-Key Electronics)

The program is run via SSH and executed using “Python”

What follows below are terminal screenshots of the Python program running (Source: Digi-Key Electronics):

Image of running the Python script from the terminal

Figure 8: Running the Python script from the terminal displays the hardware and variables being initiated.

Showing the readings, current state, and mode

Figure 9: Showing the readings, current state, and mode.

Showing the device reading the appliance vibration

Figure 10: Showing the device reading the appliance vibration meaning it’s ON.

Image of starting the 1-minute timer when the values are back in range

Figure 11: Starting the 1-minute timer when the values are back in range.

Checking if the stop of vibration was a cycle change or finished

Figure 12: Checking if the stop of vibration was a cycle change or finished.

Checking timer to see if 1 minute has passed

Figure 13: Checking timer to see if 1 minute has passed without activity.

Image of one minute has passed, sending text

Figure 14: One minute has passed without activity meaning the laundry load is finished, sending text.

Other applications of texting project

This concept could be applied to almost anything that has a moving part. Some examples include CNC machines, manufacturing devices, garage doors, doors and windows, vehicles, microwaves with rotary trays, or even toasters. The list could go on. Hopefully, this tutorial will give a starting point for your next motion-sensing project.


There are many useful applications of the IoT and with technologies such as the BeagleBone Black (or BeagleBone Green, with built-in Wi-Fi) it is now easier than ever to get a project off the ground. In this instance, we have shown how to design a system that delivers a text alert when a washer or dryer has completed its cycle using the BeagleBone, an accelerometer, some basic hardware, and some targeted Python code. From this, many other useful projects can be developed.

Parts list for this project include:

  1. BeagleBone Green Wireless
  2. BeagleBone Black
  3. Sparkfun MMA8452Q 3-Axis Accelerometer
  4. 1 CW Industries Switch
  5. 1 Lumex Opto/Components LED
  6. Bud Industries Project Box
  7. Project wires
    1. From Bud Industries
    2. From MikroElektronika
  8. USB Battery Pack (Any with a 5 V source USB out is fine. Preferably with high current output.)
  9. Two industrial magnets (A good source for some, inside old mechanical hard drives) or four of these magnets from Radial Magnet Inc


  1. Popular Mechanics

Disclaimer: The opinions, beliefs, and viewpoints expressed by the various authors and/or forum participants on this website do not necessarily reflect the opinions, beliefs, and viewpoints of Digi-Key Electronics or official policies of Digi-Key Electronics.

About this publisher

Digi-Key's North American Editors