Giter Club home page Giter Club logo

rcwire's Introduction

RCWire

This library enables you to use cheap 315/433MHz AM transmitter for a textual communication between Arduino and RaspberryPi.
You can also use it for two Arduinos or two RaspberryPis. (For the RaspberryPi version look at the Known Issues section.)

The plan is to create a network of Arduinos in my home, which are controlling several devices.
The RaspberryPi should be the "Control Center" which sends the messages.

I think this is the cheapest solution for creating a wireless network of ICs.

How to use?

The ArduinoExample.cpp showcases an garage door opener with only one command and the RaspberryExample.cpp is the sender which, in my case, is called with a shell script. (e.g. ./send open the door)

//create an object
RCWire wire = RCWire(0, 12); 

//plug in the wire
wire.plugIn(0, handleMessage); //The port has to be the same for sender and receiver

//send a message
wire.sendMessage("this is a really long message i think");

//do something in your callback function
void handleMessage(const char *message) {
    RCWire::println(message); //useful method for cross - platform printing
}

Note for Arduino: the receiver pin is not the pin on the board, it's the interrupt number.
Note for RaspberryPi: take a look at the WiringPi pin mappings. https://projects.drogon.net/raspberry-pi/wiringpi/pins/

Installation-Hardware

There are many tutorials out there for wiring up the boards.
The rxPin 0 in the ArduinoExample.cpp conforms to the pin 2 and the txPin 12 conforms to pin 12 on the Arduino board.
For the Raspberry the pin mappings are equal to the WiringPi mappings.

Update: I testet it with 173mm antennas and it worked very well for distances < 50m indoor.

Installation-Arduino

Just copy the files RCWire,RCSwitch,Header into the appropriate library folder.
For the Arduino IDE check this link: https://www.arduino.cc/en/Guide/Libraries#toc5
For PlatformIO just copy the files into the lib folder.
Take a look at the ArduinoExample.cpp.

Installation-RaspberryPi

First you have to install the well known library WiringPI http://wiringpi.com/download-and-install/
Then just clone the git repo and run the make command.
Now you should have a send application which takes the text to be sent as parameter.
(This application will only work with the ArduinoExample.cpp counterpart. Note that you have to change the message after it was sent once if your sender doesn't run in an infinite loop, or just use the reset function on the receiver after executing the desired command.)

Features

  • You can send text with a maximum length of 59 characters in the default setup.
    (The text is split into four 128 bit frames with a 8 bit header. For longer messages the header has to be bigger. And I think you won't be able to send more without crc-checks.)

  • You can change the transmission-protocol (thanks to RCSwitch).

  • Specify a "port", so that it's possible to have multiple RCWires in one area without disturbing each other.

  • Coming maybe: A signal repeater function. (Use an Arduino to overcome greater distances)

Known Issues

On the RaspberryPi you are currently not able to receive and send in the same application.

rcwire's People

Contributors

appyx avatar tomasroj avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

gixn

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.