Hi, thanks for all the suggestions.
I used a soundcard to analyze the original protocoll, fortunately there was a data pin on the remote controll ic, which i could access directly.
Using the VDI / INT pin i was able to capture some results with my soundcard, but the results seemed to be very noisy and not accurate enough to compare to my desired data.
Monitoring the power worked with a multimeter, but i'm having difficulties getting the shunt and voltage divider right, my soundcard seems to just pull everything to 1.2V regardless of on or off status.
I have now resorted to just brute forcing through all offset values from -300µs to + 300µs and i will see wether my fan suddenly turns on sometime this afternoon.
I already got the outlets to work with your library, i suspect my SPI and Interrupt code screws up the timings. (I want to use my own library, because i plan to use a couple of Attiny 45 as remote sensors without the arduino bootloader)
As a short demonstration, this code should turn on and off the outlet D with all address switches set to high (adapted from your kaku example):
// This example sends commands to the Elro switchable outlets units via OOK at 433 Mhz.
// 2010-07-08 http://opensource.org/licenses/mit-license.php
// Only slightly adapted from the kakudemo example by Jean-Claude Wippler http://www.jeelabs.org
#include
#include
#include
#include
// Turn transmitter on or off, but also apply asymmetric correction and account
// for 25 us SPI overhead to end up with the proper on-the-air pulse widths.
// With thanks to JGJ Veken for his help in getting these values right.
static void ookPulse(int on, int off) {
rf12onOff(1);
delayMicroseconds(on + 150);
rf12onOff(0);
delayMicroseconds(off - 200);
}
#define ELROSHORT (370)
#define ELROLONG (3ELROSHORT)
void elroSend(uint16t address){
signed short i,j;
//sent pulse 4 times to make sure
for(j = 0; j < 4; j++) {
for(i = 11; i >= 0; i--){
if((address >> i) & 0x01) {
//Bit set, send code for low
ookPulse(ELROSHORT, ELROLONG);
ookPulse(ELROSHORT, ELROLONG);
} else {
//Bit not set, send code for float
ookPulse(ELROSHORT, ELROLONG);
ookPulse(ELROLONG, ELROSHORT);
}
}
ookPulse(ELROSHORT, (31 ELROSHORT));
}
}
// This is just a helper function to transform the remote controll keys to addresses
// adddressCode is the 5 bit code set via the dip switches inside the remote, the upper
// position is a 1, lower is 0;
// deviceNumber is 1 for button A, 2 for B, etc
void elroSwitch(uint8t addressCode, uint8t deviceNumber, boolean on) {
uint16t cmd = 0;
cmd |= ((addressCode & 0x1F) << 7);
cmd |= (1 << (7-deviceNumber));
cmd |= on ? 2 : 1;
elroSend(cmd);
}
void setup() {
Serial.begin(57600);
Serial.println("\nelrodemo;
rf12initialize(0, RF12433MHZ);
}
void loop() {
Serial.println("on");
elroSwitch(0x1F, 4, true);
// elroSend(0x0F8A );
delay(2000);
Serial.println("off");
elroSwitch(0x1F, 4, false);
// elroSend(0x0F89 );
delay(5000);
}
I will report back if i find out more.