SMS Microcontroller Switch




Introduction: SMS Microcontroller Switch

Ever wish you could control your projects with a simple text?

The Tessel microcontroller has a GPRS module that let's you send text messages and phone calls to and from your microcontroller. Tessel supports hardware modules with other functions, like the relay module shown here, or any sort of sensor you want to modify to work with Tessel. With a little bit of Javascript, you can use your cell phone as a remote switch to control your Tessel with text messages.

The code is relatively simple, copy and paste the script below and then customize to your heart's content.

var tessel = require('tessel');
var gprslib = require('gprs-sim900'); var relaylib = require('relay-mono'); var gprs = gprslib.use(tessel.port['A']); var relay = relaylib.use(tessel.port['C']);

var triggerFunction = require('gprs-trigger'); var triggerFunc = new triggerFunction;

var trigger = 'boop';

// The cool thing you want your triggered module to do. In this case, turn something on or off with the relay module. function coolAction () { relay.toggle(1, function (err) { if (err) return console.err() if (LOGS) console.log('toggled'); }); };

// Initialize GPRS module gprs.on('ready', function() { // Wait around 30 seconds for the GPRS module to connect before sending Tessel a text. console.log("GPRS is on and waiting for you to text a trigger for your module"); triggerFunc.triggerFunc(gprs, trigger, coolAction); });



    • Science of Cooking

      Science of Cooking
    • Pocket-Sized Contest

      Pocket-Sized Contest
    • Trash to Treasure

      Trash to Treasure

    We have a be nice policy.
    Please be positive and constructive.