{ Lekker Logic }

Technology Solutions

Raspberry Pi Send Text Message SMS Python Script

I picked up a couple Raspberry Pi units recently to mess around with and start working on some automation projects as well as learn more Python programming.  These things are awesome!  One setup I wanted to incorporate was connecting a PIR motion sensor into the Rpi and use it to trigger a text/SMS message to my phone.

I am not going to get into the hardware portion of this (although I can if anyone wants it) but rather just show the Python script to make this work.  Assuming you have the Rpi setup properly the below will sense motion on the PIR sensor from GPIO 18, then send a text/SMS to the designated phone number.  This is done by sending an email out to the proper carriers gateway using SMTPLIB from Python.

 

Lekker Logic
Tags: Automation, GPIO, PIR, Python, Raspberry Pi, SMTP