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. 


Link to other posts
Forget Me Not : eLDERmon Intro
Forget Me Not :  eLDERmon  Electrical
Forget Me Not :  eLDERmon  Outlets
Forget Me Not : eLDERmon Planning
Forget Me Not : eLDERmon Parts 1
Forget Me Not :  eLDERmon  Sponsor Parts
Forget Me Not : eLDERmon Hardware Hacking
Forget Me Not : eLDERmon GNUplot
Forget Me Not: eLDERmon Protocol
Forget Me Not : eLDERmon Hardware Hacking #2
Forget Me Not : eLDERmon Hardware Hacking #3
Forget Me Not : eLDERmon OpenHAB


Hardware

One of the parts of my Challenge was measuring the Outdoor Temperature and Humidity.
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

Obviously the first place to look is the internet to see if someone else has played with one of these devices.
Sadly after a few good leads, the answer was No.

I did find some links for where to buy (same place I got it originally), but it looks like they are end of line.

 

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

I recall that this was in the bargain bin, but there were no markings or note saying why (or I'd lost it years ago).

When I opened it up, I was pleasantly surprised how much effort had been made to prevent moisture ingress, and that it included a Humidity sensor.

DSC_4649 (med).JPG


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.

DSC_4656 (med).JPG

          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.

Data1.jpg
The above picture shows there is data going out to the transmitter.

It will require some working out the protocol, but in the meantime it needs to be sent out so it can be used.

DSC_4651 (med).JPG

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.

DSC_4657 (med).JPG

These Tx units don't have a aerial, and the required length is 170mm for a 1/4 wave whip.

A length of wire was added but it needed to be carefully placed around the inside, to ensure the seal was not comprimised.

DSC_4659 (med).JPG

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

I connected the receiver up, connected the logic analyser to the receiver output and was surprised that it was capturing rubbish.

It was so bad and random I didn't bother capturing it.

It seems that something was either sending 433MHz data or some other frequency was being picked up.

Shorting out the antenna made no difference, and since there is no other pins to trigger the analyser off, it was end game until I got home.

Receiver.jpg  Receiver 2.jpg

     images from Nexus 7  ... despite the 5MP you can't control the ISO so the images get grainy ...

 

When the scope was added, it became clearer what was causing the trigger seen on the logic analyser.

50Hz.JPG

A regular pattern showed.

The cursor is looking at 10 cycles (the second cursor seems to have become a dotted line) and there is 200mS between Cursor 1 and Cursor 2 as indicated by the Δ200ms and the Δ5Hz.

200mS/10 = 20mS

Freq (Hz) = 1/ time  therefore  freq = 1/20mS or 1/ 0.020  = 50Hz which is our mains frequency.

Despite isolating the computer by running the receiver on battery, and adding a capacitor in the scope earth, it still remained.

 

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.

Data.png

So for now this is how it will be, and I'll use the raw data sent out to the transmitter to do the decoding.

 

 

Mark