no worries Udo. i havent written any code myself, just working with several examples i have found. i guess i am stuck at the point where I am unsure exactly how to read this bitstream and decode it. here are some of the things i have tried:
I started with some code for a la crosse weather station (GitHub - practicalarduino/WeatherStationReceiver: Use an Arduino and a 433MHz receiver module to intercept and process weather data from a La Crosse home weather station). the main part of the input capture looks like:
#define INPUT_CAPTURE_IS_RISING_EDGE() ((TCCR1B & _BV(ICES1)) != 0)
#define INPUT_CAPTURE_IS_FALLING_EDGE() ((TCCR1B & _BV(ICES1)) == 0)
#define SET_INPUT_CAPTURE_RISING_EDGE() (TCCR1B |= _BV(ICES1))
#define SET_INPUT_CAPTURE_FALLING_EDGE() (TCCR1B &= ~_BV(ICES1))
ISR( TIMER1_CAPT_vect )
{
// Immediately grab the current capture time
uiICP_CapturedTime = ICR1;
//----------------------------------------------------------------------------
//immediately grab the current capture polarity and reverse it to catch all the subsequent high and low periods coming in
//If the initial period filter passes below, this will be inspected to become bICP_EventPolarity
if( INPUT_CAPTURE_IS_RISING_EDGE() )
{
SET_INPUT_CAPTURE_FALLING_EDGE(); //previous period was low and just transitioned high
bICP_CapturedPeriodWasHigh = false; //uiICP_CapturedPeriod about to be stored will be a low period
} else {
SET_INPUT_CAPTURE_RISING_EDGE(); //previous period was high and transitioned low
bICP_CapturedPeriodWasHigh = true; //uiICP_CapturedPeriod about to be stored will be a high period
}
//----------------------------------------------------------------------------
//calculate the current period just measured, to accompany the polarity now stored
uiICP_CapturedPeriod = (uiICP_CapturedTime - uiICP_PreviousCapturedTime);
//----------------------------------------------------------------------------
// RF Pulse filtering, width test and polarity are analysed now, call the
// interpreter(s) to analyse them
RF_Interpreter_WS2355();
//----------------------------------------------------------------------------
//save the current capture data as previous so it can be used for period calculation again next time around
uiICP_PreviousCapturedTime = uiICP_CapturedTime;
uiICP_PreviousCapturedPeriod = uiICP_CapturedPeriod;
bICP_PreviousCapturedPeriodWasHigh = bICP_CapturedPeriodWasHigh;
}
void RF_Interpreter_WS2355()
{
//Check if this is a valid zero(long high) or one(short high) bit, or low period in between
if( bICP_CapturedPeriodWasHigh )
{
//got a high period, could be a valid bit
if( (uiICP_CapturedPeriod >= WSR_SHORT_PERIOD_MIN) && (uiICP_CapturedPeriod <= WSR_SHORT_PERIOD_MAX) )
{
//short high, valid one bit
bValidBit = WSR_BIT_ONE;
} else if( (uiICP_CapturedPeriod >= WSR_LONG_PERIOD_MIN) && (uiICP_CapturedPeriod <= WSR_LONG_PERIOD_MAX) ) {
//long high, valid zero bit
bValidBit = WSR_BIT_ZERO;
} else {
//invalid high period, in the dead zone between short and long bit period lengths
WSR_RESET();
}
}
}
but i think this particular weather station is not using manchester encoding, unless I do not correctly understand the terms "long high" and "short high"
I have also used the code in http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1195830186/0#0, which tells me:
Got 1090 pulses: min=493, max=1006 (0 timer overflows)
so re: timing - i think the short width pulse is ~500us, and the long width pulse is ~1000us. i dont think this translates directly to 1s and 0s, as they depend on where the high is within each 1000us. to better describe this:
http://alyer.frihost.net/thn128decoding.htm
(note this is not the same time of weather station as i have either, but represents manchester encoding)
essentially what i think i need to do is sync up with the incoming stream which starts with a long series of short width pulses, and then, keeping in mind where the clock is at, see where the pulse starts - if its at the beginning of the start of the clock period, or mid way through the clock period.
i hope this makes sense - im a little lost!