Arduino 433mhz RF Network Controller

From SifWiki
Jump to: navigation, search

Contents

Overview

As per the work on this page and the overview here, I have created a generic Arduino sketch which allows control of various 433mhz devices from a network connected Arduino.

The sketch can be checked out of GitHub by clicking this link: https://github.com/Siftah/Wiki/.

Arduino Setup

In order to use the sketch, you will need to have an Arduino with a 433mhz sender connected to pin 10 (by default, but configurable in the sketch).

The sketch also makes use of an "Arduino Ethernet Shield v1.1" using the ENC28J60 chipset. These are about the cheapest way of connecting an Arduino to ethernet and you can pick up the shield for less than $10 (€8) delivered from Deal Extreme.

I'm using the Jee Labs library, available here; https://github.com/jcw/ethercard

The script also makes use of the RCSwitch library, available here; https://code.google.com/p/rc-switch/

Configure for your devices

You will need to duplicate the following portion of code to create new entries for each of your devices;

/////// DUPLICATE FROM HERE //////////////////////////////
  if (strcmp(command,"d")==0){ // change 'd' to the variable of your choice.
    if (strcmp(value,"0")==0){ // if the values 0, turn off.
        mySwitch.switchOff("11111","00010"); // amend to suit.
    } else {
        mySwitch.switchOn("11111","00010"); // turn switch on by default
    }
  }
/////// TO HERE //////////////////////////////////////////

The above example works with Elro AB440 outlets, more examples available at https://code.google.com/p/rc-switch/wiki/HowTo_Send.

To Use

In order to call the Arduino and ask it to change the status of a connected device, you simply need to send a UDP packet to the Arduino with the command embedded. A simple way to do this from a Linux command line is using ncat, which you'll likely already have installed.

Example to turn my heating off;

echo heat:0:|ncat -u 192.168.1.99 1337 --send-only

"--send-only" is needed so the command exits back to the command line. You'll also notice I added an additional ":" at the end of the command to ensure the Arduino doesn't parse the string as having a linebreak at the end.

Personal tools
Namespaces

Variants
Actions
Navigation
Tools
Google AdSense