Coder Social home page Coder Social logo

rcswitch-pi's Introduction

NOTE

This repository is currently unmaintained. I recommend you to use or switch to a maintained library instead.

About

rcswitch-pi is for controlling rc remote controlled power sockets with the raspberry pi. Kudos to the projects rc-switch and wiringpi. I just adapted the rc-switch code to use the wiringpi library instead of the library provided by the arduino.

Usage

First you have to install the wiringpi library. After that you can compile the example program send by executing make. You may want to changet the used GPIO pin before compilation in the send.cpp source file.

rcswitch-pi's People

Contributors

r10r avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rcswitch-pi's Issues

String constructor

Hello. Thanks for awsome lib!
i have a problem right now. i using message=String("data")+String(123321), and
.send(message);
code:
for(int i=0;i<4;i++){
message = String("BB_")+String(i)+String("_")+String(Sensor[i]);

mySwitch.sendTriState(message);

}

get this error:
no mathching function for call to 'RCSwitch::sendTriSate(String&)'

MORE:
Arduino: 1.5.6-r2 (Windows 8), Board: "Arduino Pro or Pro Mini, ATmega328 (5V, 16 MHz)"

Send_RClib_4_sensors.ino: In function 'void loop()':
Send_RClib_4_sensors:83: error: no matching function for call to 'RCSwitch::sendTriState(String&)'
C:\Program Files (x86)\Arduino\libraries\RCSwitch/RCSwitch.h:72: note: candidates are: void RCSwitch::sendTriState(char*)

Please some advice or solution on this.
Thanks

Send raw DATA (eg Pt2272 or equal chips)

Hi, it would be nice if you could add into the switch case
" case 2:
mySwitch.sendTriState(systemCode);
break;
"
and so you can just send a stream like FFFF01FF1111 (8 codes (0,1,F) and eg M4 type 4 pins to switch)
usage is:
"send FFFF01FF1111 0 2"
the 0 is just for the empty unitcode or could be used as the field of the 1-6 pins to swicht as you like to add...

best regards Bernhard

Sleep and Transceiver

I am trying to make deep sleep with arduino, when receiver gets a signal arduino will wake up.
Is it possible? If yes device will be battery powered.
I think receiver will eat all power even arduino sleeps?

Do you have any alternative device or lib suggestion?

There are a lot of tutorials with a transmitter and a receiver - ugly green boards.
Did anyone try Transceiver? Or any alternative with good ranges +100meters ?

http://seeedstudio.com/depot/433Mhz-Wireless-Serial-Transceiver-Module-1-Kilometer-p-1733.html?user_country=

libwiringPi.so: undefined reference to `pthread_join'

First, I installed Raspbian Ubuntu Xenial for Orange Pi Zero.

root@orangepizero:~/WiringOP/rcswitch-pi# cat /etc/armbian-image-release
# PLEASE DO NOT EDIT THIS FILE
BOARD=orangepizero
BOARD_NAME="Orange Pi Zero"
VERSION=5.33.170922
LINUXFAMILY=sun8i
BRANCH=dev
ARCH=arm
IMAGE_TYPE=nightly
BOARD_TYPE=conf
INITRD_ARCH=arm
KERNEL_IMAGE_TYPE=zImage

Next, I installed WiringOP:

git clone https://github.com/zhaolei/WiringOP.git -b h3
cd WiringOP/
sudo bash build

gpio readall
 +-----+-----+----------+------+---+-Orange Pi+---+---+------+---------+-----+--+
 | BCM | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | BCM |
 +-----+-----+----------+------+---+----++----+---+------+----------+-----+-----+
 |     |     |     3.3v |      |   |  1 || 2  |   |      | 5v       |     |     |
 |  12 |   8 |    SDA.0 | ALT3 | 0 |  3 || 4  |   |      | 5V       |     |     |
 |  11 |   9 |    SCL.0 | ALT3 | 0 |  5 || 6  |   |      | 0v       |     |     |
 |   6 |   7 |   GPIO.7 | ALT3 | 0 |  7 || 8  | 0 | ALT3 | TxD3     | 15  | 13  |
 |     |     |       0v |      |   |  9 || 10 | 0 | ALT3 | RxD3     | 16  | 14  |
 |   1 |   0 |     RxD2 | ALT3 | 0 | 11 || 12 | 0 | ALT3 | GPIO.1   | 1   | 110 |
 |   0 |   2 |     TxD2 | ALT3 | 0 | 13 || 14 |   |      | 0v       |     |     |
 |   3 |   3 |     CTS2 | ALT3 | 0 | 15 || 16 | 0 | ALT3 | GPIO.4   | 4   | 68  |
 |     |     |     3.3v |      |   | 17 || 18 | 0 | ALT3 | GPIO.5   | 5   | 71  |
 |  64 |  12 |     MOSI | ALT4 | 0 | 19 || 20 |   |      | 0v       |     |     |
 |  65 |  13 |     MISO | ALT4 | 0 | 21 || 22 | 0 | ALT3 | RTS2     | 6   | 2   |
 |  66 |  14 |     SCLK | ALT4 | 0 | 23 || 24 | 0 | ALT4 | CE0      | 10  | 67  |
 |     |     |       0v |      |   | 25 || 26 | 0 | ALT3 | GPIO.11  | 11  | 21  |
 |  19 |  30 |    SDA.1 | ALT3 | 0 | 27 || 28 | 0 | ALT3 | SCL.1    | 31  | 18  |
 |   7 |  21 |  GPIO.21 | ALT3 | 0 | 29 || 30 |   |      | 0v       |     |     |
 |   8 |  22 |  GPIO.22 | ALT3 | 0 | 31 || 32 | 0 | ALT3 | RTS1     | 26  | 200 |
 |   9 |  23 |  GPIO.23 | ALT3 | 0 | 33 || 34 |   |      | 0v       |     |     |
 |  10 |  24 |  GPIO.24 | ALT3 | 0 | 35 || 36 | 0 | ALT3 | CTS1     | 27  | 201 |
 |  20 |  25 |  GPIO.25 |  OUT | 1 | 37 || 38 | 0 | ALT3 | TxD1     | 28  | 198 |
 |     |     |       0v |      |   | 39 || 40 | 0 | ALT3 | RxD1     | 29  | 199 |
 +-----+-----+----------+------+---+----++----+---+------+----------+-----+-----+
 | BCM | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | BCM |
 +-----+-----+----------+------+---+-Orange Pi+---+------+----------+-----+-----+

Then, I tried to install RCSwitch but I am getting:

RCSwitch.cpp:229:74: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
g++    -c -o send.o send.cpp
g++   RCSwitch.o send.o -o send -lwiringPi
//usr/local/lib/libwiringPi.so: undefined reference to `pthread_join'
//usr/local/lib/libwiringPi.so: undefined reference to `pthread_create'
//usr/local/lib/libwiringPi.so: undefined reference to `pthread_cancel'
collect2: error: ld returned 1 exit status
Makefile:4: recipe for target 'send' failed
make: *** [send] Error 1

timing could be more accurate

Evaluating the send command I found that actual pulse times are quite consistently about 80 microseconds too long.

The timing can be much improved by a call to piHiPri() which is a function in WiringPi. It raises the scheduling priority of the process resulting in more accurate timing. See the WiringPi example code DelayTest.c

Segmentation fault

When i try to run you're send command, i get a segmentation fault, and nothing has been sent.

Also porting the receiver?

I was wondering if you're planning to port the receiver as well. I build a sender on my own, but haven't got the receiver to work on longer distances. I want to make sure it's not just my code that's causing these problems. I heard that the receiver from the RCswitch library did work with the same device connected to an arduino instead of a Rasberry Pi.

Translation of RCSwitch from Arduino to RPi

Hi,

I am using an Arduino to control my lights at home using RCSwitch. I would like know use a Raspberry Pi and I fand this library. I try several times but I didn't find an issue...
For Arduino I use:

Serial.println("Turn ON RCSwitch");
mySwitch.send(1394005,24);
Serial.println("Turn OFF RCSwitch");
mySwitch.send(1394004,24);

I tried:

sudo ./send 1394005 24 1
sudo ./send 1394004 24 0

It doesn't work... Do you have any idea?
Thanks
P0uet

Anyone developing this ?

I am running Ubuntu 16.04 and get a compile error.

make all
g++ -DRPI -c -o ../rc-switch/RCSwitch.o ../rc-switch/RCSwitch.cpp
g++ -DRPI -c -o send.o send.cpp
g++ -DRPI ../rc-switch/RCSwitch.o send.o -o send -lwiringPi
/usr/lib/gcc/arm-linux-gnueabihf/5/../../../../lib/libwiringPi.so: undefined reference to pthread_join' /usr/lib/gcc/arm-linux-gnueabihf/5/../../../../lib/libwiringPi.so: undefined reference topthread_create'
/usr/lib/gcc/arm-linux-gnueabihf/5/../../../../lib/libwiringPi.so: undefined reference to `pthread_cancel'
collect2: error: ld returned 1 exit status
Makefile:8: recipe for target 'send' failed
make: *** [send] Error 1

Anyone have a solution?
Regards,

WARNING : Deprecated conversion from string constant to char*

When you tried to compile the rcswitch library, it will throw warning message.

This is how to fix it:

https://github.com/r10r/rcswitch-pi/blob/master/RCSwitch.cpp#L194
const char* code[5] = { "FFFF", "0FFF", "F0FF", "FF0F", "FFF0" };

https://github.com/r10r/rcswitch-pi/blob/master/RCSwitch.cpp#L229
const char* code[6] = { "FFFFF", "0FFFF", "F0FFF", "FF0FF", "FFF0F", "FFFF0" };

Source:http://stackoverflow.com/questions/59670/how-to-get-rid-of-deprecated-conversion-from-string-constant-to-char-warnin

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.