Teensy3 and RCSwitch Library for 433mhz home automation and alarm devices

Status
Not open for further replies.

GremlinWrangler

Well-known member
For anybody trying to interface the cheaper 433mhz power switches/alarm sensors the RCSwitch Library and examples almost work out of the box, only addition being adding pinMode(0, INPUT); to setup the RX pin as Teensy3.x doesn't default the pins as input like an Uno/Atmega328.

Source:
https://code.google.com/p/rc-switch/

Notes:
RCSwitch is designed to support a range of insecure 433 mhz specifications, what it won't do is allow you to interface to anything with a sane rolling code system so manage your expectations accordingly. See also expected 433mhz performance range described at https://www.pjrc.com/teensy/td_libs_VirtualWire.html

Library usage is to specify the interrupt you want to attach the RX pin to, not the pin itself and the numbers differ on Arduino. Teensy 3 allows interrupts on all pins, so you can just insert whichever digital input pin works for your design and let the compiler and Paul's magic sort it out.

Most of the RF modules operate on 5V or higher, level shift accordingly to the Teensy, especially if you are using a teensy3.0 with it's 3.3v inputs.

Library produces the TX waveform via delay loops, so is blocking. RX loop is interrupt driven so will happily run in the background unless you start trying to push high data rates through it and in any case none of this has any error correction so code accordingly.

If you are comparing to VirtualWire for use in a new project:
VirtualWire adds a CRC, comes with two way communications examples and seems to have a more robust de-coding scheme that uses running averages.
RCSwitch has a Raspberry Pi implementation if that's what you are looking for.

Any device that you are talking to like this is inherently insecure, this may or may not matter to you. In my implementation I'm using motion sensors to feed lighting control in home automation so worst case of spoofing is lights get turned on, and can accept that at $10 a sensor.

Have Fun
 
Status
Not open for further replies.
Back
Top