Random Nerd Tutorials

Programming the BeagleBone Black with Python

This entry is part 4 of 4 in the series Getting Started with BeagleBone Black. 

This post was written by Rui Santos and Luís Perestrelo authors of BeagleBone For Dummies.

Building a surveillance system with a PIR sensor, the BeagleBone Black and Python.

The BeagleBone Black is an outstanding tool for projects that involve the Internet. Access is easy (simply connect it to the router through an Ethernet cable ), and both Python and JavaScript feature libraries that greatly simplifies matters.

PIR sensors are quite neat devices that are able to detect motion. Their output pin, which will be connected to the BeagleBone Black sends a digital signal HIGH whenever somebody passes by, and is LOW whenever else. Automatic lights in public places are built on this concept.

The project sends you an email whenever motion is detected.

beaglebone black pir motion sensor

Parts Required

Here’s a list with everything you need:


NOTE: You can read my tutorial on how to modify a cheap PIR motion sensor to operate at 3.3V.


Python Code

You can click here to download this Python script.

NOTE: You can only use this example with Gmail. And don’t forget to replace the example below with your own credentials…


Now you’ve built your own surveillance system that sends you an email when the PIR sensor detects movement!



If you have any questions post them in the comments below. Special thanks to Luís Perestrelo for helping Rui Santos putting this series together!

Want to learn more about the BeagleBone Black?

You can buy our book BeagleBone For Dummies on Amazon!

Learn ESP32 with Arduino IDE

This our complete guide to program the ESP32 with Arduino IDE, including projects, tips, and tricks! The registrations are open, so SIGN UP NOW »

Recommended Resources

Home Automation using ESP8266 »
Build IoT projects and home automation gadgets with the ESP8266 Wi-Fi module.

Build a Home Automation System »
Learn how to build a automation system using open-source hardware and software from scratch.

Arduino Step-by-Step Projects »
Build 25 cool Arduino projects with our course even with no prior experience!

Leave a Comment:

Add Your Reply

Grab our Electronics and Programming Courses