Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

SMS/TxT controlled mains power sockets


  • Please log in to reply
1 reply to this topic

#1 wendo

wendo

    Advanced Member

  • Members
  • PipPipPip
  • 85 posts

Posted 31 December 2013 - 12:17 AM

Hi All

 

My first real project after having my Netduino for 2 weeks is pretty much complete, at least based on the original specs I had in mind. It's an SMS controlled mains power switch, switching up to 4 sockets independently.

 

You can send it SMS commands to turn on, turn off, or return the current state of each of the relays/sockets.

 

It consists of

I hope to eventually fit this all into a 4 socket power board, although I'm not sure at the moment exactly how I'm going to do that.

 

The GPRS shield is on COM1 and the LCD on COM2 with the relays connected from D4 - D7.

 

The code is heavily based on Jair's code here but translated to English (thanks Google!) and some bugs caught. The biggest being I had to add a delay to the eventhandler for incoming messages or I wouldn't always get actual message text, only the header. I'm not sure if this is expected of the event handler (to fire before the buffer has finished writing) but once I caught that everything else was pretty straight forward. I did add some code to pull the date/time from the cell network.

 

The LCD code is basically a direct port of the Seeedstudio Arduino driver and would obviously need to be replaced anyway since the LCD is now discontinued.

 

One thing I'd still like to add is a timer or event to automatically turn the back-light of the LCD off after 5 seconds of inactivity to save power, however the initial attempt didn't go great so that's still on the to-do list. Since I'm brand new to C# it'll probably take some time.

 

If you're looking for a driver for a SIM900 based shield, the version I've used it probably the best one available at the moment. All the previous ones I looked at either didn't do SMS at all, or only did sending. Jair's driver was a godsend in that regard.

 

Full code is here

 

Questions and comments welcome. This was my first experience with .NETMF, C# and Netduino so it's likley I've done a lot of things wrong, but it works :)

 

Edited: Changed Repo and made code modular so LCD code can be disabled



#2 wendo

wendo

    Advanced Member

  • Members
  • PipPipPip
  • 85 posts

Posted 07 January 2014 - 06:28 AM

An update to this. It now includes a web server as an option when compiling, and connecting a push button to D8 will allow you to display the current IP address on the LCD.

 

The web server has been setup to respond to queries on the /switches URL, but will also serve up files from the SD card if they are there

 

Core code has been tidied up a lot, threaded, and a timer is used for LCD backlight control now.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.