Forget Me Not : eLDERmon Hardware Hacking
Since my last post, element14 and EnOcean have pulled out all the stops to ensure the parts for this challenge are available.
So Markus, Christian and Samantha ... thanks for your efforts.
I recalled having a commercial unit that I picked up many years ago in the bargain bin.
Time to dig it out, see if it will do what I want, or if I can re-purpose the case.
Regardless of the final use, it will be an extra sensor at home.
Research
Sadly after a few good leads, the answer was No.
The box and paperwork indicated it was 433Mhz, so adding a receiver to an Arduino I was surprised when I got no data.
About this stage you wish you had something that could measure the radiated RF and determine the frequency.
The Tektronix scope wasn't going to stretch to 433 Mhz, so I found a sketch that flashed the onboard led if any data appeared.
Still nothing ... and a check using a Tx sending data proved the receiver was working.
Broken
As the picture shows the RF unit was a separate device, and features a pcb aerial and some matching to ensure the reduced length is correctly tuned.
That looked promising, so time to see if there was data.
Always nice to see the manufacturer label the connections.
Since I had a few spare minutes at work I captured it with the logic analyser.
The above picture shows there is data going out to the transmitter.
The picture shows one of the loading coils damaged and various soldering on other parts.
Luckily my order of 10 x RFM85 transmitters arrived this morning from Anarduino
A quick replacement and tidy of the wires had the transmitter replaced.
The last one was held on with some double sided tape and foam, so that would do for now.
These Tx units don't have a aerial, and the required length is 170mm for a 1/4 wave whip.
Ideally this should be a straight wire, since the RF standing wave generated along the antenna interacts with the magnetic field .. but that's another subject and another blog.
Capture
Data
To confirm everything worked correctly, I fired up the test unit that sends out a RF control signal. (I bypassed the button checking)
/* Simple Button for Digispark to drive an Watts Clever Outlet Sends the ON code then xx secs later sends the OFF code Pin connections Digi tiny85 P0 (5)= P1 (6)= On board LED (Rev A) P2 (7)= P3 (2)= 433 MHz transmitter Data pin P4 (3)= pushbutton (P4 to ground) P5 (1)= http://code.google.com/p/rc-switch/ */ //RCSwitch code heavily modified to remove extra code not required #include <Digi_RCSwitch.h> RCSwitch mySwitch = RCSwitch(); const int buttonPin = 4; // the number of the pushbutton pin const int ledPin = 1; // the number of the LED pin ver A //const int ledPin = 0; // the number of the LED pin ver B int buttonState = 0; // variable for reading the pushbutton status void setup() { //Serial.begin(9600); pinMode(ledPin, OUTPUT); pinMode(buttonPin, INPUT); digitalWrite(buttonPin, HIGH); // Transmitter is connected to Digispark Pin P3 mySwitch.enableTransmit(3); // Optional set pulse length. // mySwitch.setPulseLength(320); // Optional set protocol (default is 1, will work for most outlets) mySwitch.setProtocol(1); // Optional set number of transmission repetitions. // mySwitch.setRepeatTransmit(15); } void loop() { buttonState = digitalRead(buttonPin); // delete below for the button to work correctly buttonState = LOW; if (buttonState == LOW) { // turn LED on: digitalWrite(ledPin, HIGH); mySwitch.send(13998174, 24); // Send 1 ON Code //mySwitch.send(13998172, 24); // Send 2 ON Code //mySwitch.send(13998170, 24); // Send 3 ON Code delay(5000); digitalWrite(ledPin, LOW); mySwitch.send(13998166, 24); // Send 1 OFF Code //mySwitch.send(13998164, 24); // Send 2 OFF Code //mySwitch.send(13998162, 24); // Send 3 OFF Code } }
/* Simple example for receiving http://code.google.com/p/rc-switch/ */ #include <RCSwitch.h> RCSwitch mySwitch = RCSwitch(); void setup() { Serial.begin(9600); mySwitch.enableReceive(0); // Receiver on inerrupt 0 => that is pin #2 } void loop() { if (mySwitch.available()) { int value = mySwitch.getReceivedValue(); if (value == 0) { Serial.print("Unknown encoding"); } else { Serial.print("Received "); Serial.print( mySwitch.getReceivedValue() ); Serial.print(" / "); Serial.print( mySwitch.getReceivedBitlength() ); Serial.print("bit "); Serial.print("Protocol: "); Serial.println( mySwitch.getReceivedProtocol() ); } mySwitch.resetAvailable(); } }
The data pulses showed up as I expected, and the Arduino quite happily decoded it.