Hey Guys -
I am about to install a new ceiling fan including a remote I got as well for it and although have experience with Raspberry Pis, wanted to give an old Arduino Uno a shot at controlling it. Having never used the Uno before, I installed the software, got a WINGONEER 433Mhz RF Wireless Transmitter Module and Receiver Kit, a breadboard, some wires, and used this guide which uses rc-switch library to capture and send the signals. I successfully captured the signals for my buttons, but unfortunately cannot test sending them yet as I haven't finished the fan install yet.
Anyways - my goal is to be able to control the fan/light somewhat easily using something like SmartThings, IFTTT, a batch file, etc. Obviously if I can get one working, then I can interface them together. The problem is that - assuming that I interpreted the steps correctly and sending them works correctly - each time I want to emulate a button press, I must upload a different script to the Arduino. There must be a better way to do this!
My Question
So, how can I achieve my goal? Is it possible to compile the scripts into individual EXEs (one per button / command) so that executing each emulates pressing the button?
Below is an example of what I captured from one of the buttons as well as the script which should send the command. Any ideas would be appreciated - Thanks!
Raw Capture from "Light On/Off" Button
- Decimal: 2067781 (24Bit) Binary: 000111111000110101000101 Tri-State: not applicable PulseLength: 358 microseconds Protocol: 1
- Raw data: 11124,352,1088,348,1080,356,1080,1068,372,1068,368,1064,372,1068,368,1068,368,1068,368,348,1088,348,1088,344,1088,1068,368,652,364,352,1084,16,36,100,368,408,28,32,432,104,24,16,52,492,300,20,24,96,48,
Binary Value per Button
- 000111111000110101000101 - Light On/Off
- 000111111000110101001100 - Stop
- 000111111000110101001000 - Low
- 000111111000110101000010 - Medium
- 000111111000110101000110 - High
- 000111111000110101000100 - 1 Hour
- 000111111000110101000001 - 2 Hour
- 000111111000110101000011 - 4 Hour
- 000111111000110101001010 - 8 Hour
Untested Script Which Should Emulate Light On/Off Button Press
#include <RCSwitch.h>
RCSwitch mySwitch = RCSwitch();
void setup() {
Serial.begin(9600);
// Transmitter is connected to Arduino Pin #10
mySwitch.enableTransmit(10);
// Optional set pulse length.
mySwitch.setPulseLength(358);
// set protocol (default is 1, will work for most outlets)
// mySwitch.setProtocol(1);
// Optional set number of transmission repetitions.
// mySwitch.setRepeatTransmit(15);
pinMode(13,OUTPUT);
}
void loop() {
mySwitch.send("000111111000110101000101");
digitalWrite(13,HIGH);
delay(500);
digitalWrite(13,LOW);
delay(10000);
}
Thanks again!