help 433 and lcd

315MHz and 433MHz wireless connections are very commonly used by consumer electronics including weather stations, home automation remote controls, power consumption meters, car alarms, and also many DIY projects.
Post Reply
fats699
Posts: 4
Joined: Fri Nov 04, 2011 4:18 am

help 433 and lcd

Post by fats699 » Fri Nov 04, 2011 4:25 am

hi i am new to this so sorry if this sounds like a stupid question
i have got the eleven and i got a lcd shield and the 433 rx shield
i am trying to decode the signels from a arlec home automation remote
i can not seem to be able to get the raw data i have had some sucsess
but it was a test sketch for a weather station
what i would like to do is desplay the serial data on my lcd
any help would be great

Regards
Martin Fraser

User avatar
jonoxer
Freetronics Staff
Freetronics Staff
Posts: 298
Joined: Sat Oct 15, 2011 11:31 am
Location: Melbourne, Australia
Contact:

Re: help 433 and lcd

Post by jonoxer » Fri Nov 04, 2011 5:51 am

Sounds like a project many people would be interested in!

Could you please post a reference the exact Arlec device model that you're using, and outline what you've tried so far? Examples of any data you've been able to extract so far (if any) would be very helpful.
--
Jon

fats699
Posts: 4
Joined: Fri Nov 04, 2011 4:18 am

Re: help 433 and lcd

Post by fats699 » Fri Nov 04, 2011 6:21 am

hi the model is a arlc rc1 it is for power plugs and has 3 on/off buttons on the remote
the sketch i have is this and i added in the lcd parts lol its not neat but i am learning as i go

Code: Select all

/******* Sketch to test Input Capture interrupt handling *********************************
 functionality: measure length of pulses on the ICP pin with precision of 0.5 microseconds
 Show the min and max pulse widths in microseconds on the serial port

**************************************************************************************************************/
#include <stdio.h>      // for verbose debugging using sprintf
#include <LiquidCrystal.h>

#define icpPin 8        // ICP input pin on arduino
#define outPin 2        // output pin that will shadow the input, can be monitored with a scope

                        // some variables to help see that something is happening in the interrupt handlers
volatile unsigned int Value;     // this stores the current ICR1 value
volatile unsigned int MinValue;    
volatile unsigned int MaxValue;
volatile unsigned int Overflows;
volatile unsigned int PulseCount;


/* Overflow interrupt vector */
ISR(TIMER1_OVF_vect){                 // here if no input pulse detected
   Overflows++;                       // incriment overflow count  
}

/* ICR interrupt vector */
ISR(TIMER1_CAPT_vect){
   TCNT1 = 0;                            // reset the counter  
   if( bit_is_set(TCCR1B ,ICES1)){       // was rising edge detected ?  
        digitalWrite(outPin,HIGH );      // yes, set our output pin high to mirror the input
   }
   else {                                // falling edge was detected
        Value = ICR1;                    // save the input capture value
        digitalWrite(outPin,LOW );       // set our output pin low to mirror the input  
        PulseCount++;
        if(Value < MinValue)             // update min or max values as appropriate  
            MinValue = Value;
        if (Value > MaxValue)
            MaxValue = Value;    
   }    
   TCCR1B ^= _BV(ICES1);                 // toggle bit value to trigger on the other edge    
}
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);

void setup() {
  Serial.begin (19200);
  pinMode(outPin, OUTPUT);               // declare the ledPin as an OUTPUT
  pinMode(icpPin, INPUT);                // ICP pin (digital pin 8 on arduino) as input
  MinValue =    30000;                   // Initialise with extreme values
  MaxValue =    0;
 lcd.begin(16, 2);

  TCCR1A = 0 ;                    // this register set to 0!
  TCCR1B =_BV(CS11);              // NORMAL MODE!!, prescaller 8, rising edge ICP1 - this works
  TCCR1B |= _BV(ICES1);           // enable input capture    

  TIMSK1 =  _BV(ICIE1);                         // enable input capture interrupt for timer 1
  TIMSK1 |= _BV(TOIE1);                         // enable overflow interrupt to detect missing input pulses
  Serial.print("Finished setup\r\n");
}

// this loop prints the number of pulses in the last second, showing min and max pulse widths
void loop() {
  char buffer[80];
  // show the captured data, divide pulse widths by 2 to display time in microseconds
  sprintf(buffer,"Got %d pulses: min=%d, max=%d (%d timer overflows)\r\n", PulseCount, MinValue / 2, MaxValue / 2, Overflows);        
  Serial.print(buffer);    // send the info to the serial port
  /* reset variables ready for the next reading */  
  PulseCount = Overflows = 0; // reset counts
  MinValue =    30000;        // set values to extremes
  MaxValue =    0;      
 // when characters arrive over the serial port...
  if (Serial.available())
    // wait a bit for the entire message to arrive
    delay(100);
    // clear the screen
    lcd.clear();
    // read all the available characters
    while (Serial.available() > 0);
      // display each character to the LCD
      lcd.write(Serial.read());  
  delay(1000);             // wait 1 second for next update  [/font]            
}



and this the output i get the 530-540 pulses are when i am pressing the button on the remote

Code: Select all

Finished setup
Got 22 pulses: min=7, max=660 (1 timer overflows)
Got 2275 pulses: min=5, max=1118 (0 timer overflows)
Got 2483 pulses: min=6, max=1144 (0 timer overflows)
Got 2697 pulses: min=6, max=923 (0 timer overflows)
Got 2567 pulses: min=7, max=992 (0 timer overflows)
Got 2196 pulses: min=7, max=1963 (0 timer overflows)
Got 1370 pulses: min=7, max=3888 (0 timer overflows)
Got 536 pulses: min=338, max=1090 (0 timer overflows)
Got 536 pulses: min=338, max=1090 (0 timer overflows)
Got 538 pulses: min=337, max=1090 (0 timer overflows)
Got 542 pulses: min=337, max=1091 (0 timer overflows)
Got 542 pulses: min=334, max=1091 (0 timer overflows)
Got 539 pulses: min=337, max=1090 (0 timer overflows)
Got 535 pulses: min=333, max=1090 (0 timer overflows)
Got 536 pulses: min=335, max=1090 (0 timer overflows)
Got 1068 pulses: min=5, max=15960 (4 timer overflows)
Got 2726 pulses: min=6, max=1394 (0 timer overflows)
Got 1694 pulses: min=5, max=1199 (0 timer overflows)
Got 541 pulses: min=338, max=1097 (0 timer overflows)
Got 538 pulses: min=338, max=1097 (0 timer overflows)
Got 534 pulses: min=335, max=1097 (0 timer overflows)
Got 534 pulses: min=339, max=1097 (0 timer overflows)
Got 1398 pulses: min=5, max=23878 (4 timer overflows)
Got 538 pulses: min=335, max=1097 (0 timer overflows)
Got 540 pulses: min=337, max=1097 (0 timer overflows)
Got 540 pulses: min=337, max=1097 (0 timer overflows)
Got 774 pulses: min=7, max=20447 (4 timer overflows)
Got 2647 pulses: min=5, max=935 (0 timer overflows)
Got 2342 pulses: min=5, max=1466 (0 timer overflows)
Got 2227 pulses: min=6, max=1335 (0 timer overflows)
and all i get on the lcd is garbage

fats699
Posts: 4
Joined: Fri Nov 04, 2011 4:18 am

Re: help 433 and lcd

Post by fats699 » Sat Nov 05, 2011 9:07 am

yeahar i got it going it will display the becimal value of the remote and will tell you if it is a invalid code
i fould a libary with a example but had to rewire the reciver board to use pin 2 not pin 8 as the lcd was also useing pin 8

User avatar
jonoxer
Freetronics Staff
Freetronics Staff
Posts: 298
Joined: Sat Oct 15, 2011 11:31 am
Location: Melbourne, Australia
Contact:

Re: help 433 and lcd

Post by jonoxer » Fri Nov 11, 2011 4:58 am

That's great news! I'm sure other people would be interested in trying the same thing, so could you please post a link to the library you used and any other info that may be helpful to someone else wanting to do it?

If you document your project somewhere (even just in this thread) I'd love to link to it from the Receiver Shield page.
--
Jon

fats699
Posts: 4
Joined: Fri Nov 04, 2011 4:18 am

Re: help 433 and lcd

Post by fats699 » Sat Nov 12, 2011 10:31 am

i can do that just give me a couple of days and i will put it all togerther so it looks better

Post Reply