# Help using a logic analyzer to measure bitrate

Hello! I was hoping someone could help me with capturing some data using my arduino and open logic sniffer. I've got a set of woods wireless RF outlets (search amazon for woods 13569 for a pic) and i'm trying to figure out how to control them with my arduino. I have a 315 MHz transmitter/receiver that has the same frequency as the switches (or at least the switches and the receiver/transmitter i have both have a little silver round thing that have R315A printed on them).

So far I've been able to use OLS and the arduino to capture what happens on the transmit pin of the remote's IC when a button is pressed, but at this point i'm stumped. I've never used a logic sniffer before, and I don't know how to determine the baud/bit rate the remote is transmitting at. I tried the UART analyzer that's built in to OLS- told it that the Rx was channel 0 and it determined that the baud rate is 1666, but when i plugged that in to the virualwire receive sketch and hit a button the the remote it doesn't detect anything.

Can anyone explain this to me or point me to an appropriate tutorial?

Thanks

Here's a link to what i captured:
https://dl.dropbox.com/u/7650017/OLS.png

I don't have any personal knowledge of the switches. Also, you didn't mention which
315 Mhz device you have, so it's impossible to know what protocol it uses.

However, looking at your OLS picture, the bitrate there is 10 pulses in approx 23 msec,
about 440 bps. However, this is clearly NOT an RS232 protocol. Someone else should know
better, but it looks like an RZ [return-to-zero] protocol, where the shorts pulses [about
0.5 msec] represent either a logic 1 or 0, and the long pulses [about 1.5 msec] represent
the other logic level. So it looks like the 2nd msg = 0110 1000 1000 0000, or else
1001 0111 0111 1111, ie 16 bits per msg. The 1st msg was probably truncated on
triggering.

You can't run this signal into a standard RS232 UART, you will have to use an on-off
keying protocol to your 315 Mhz transmitter.

Here is a picture of what i'm working with:
https://dl.dropbox.com/u/7650017/pic.jpg

The remote has TR-011S printed on the top of it. I couldn't find any information about it by searching for that code or any of the others printed on the remote. The RF transmitter/receiver are a generic pair i ordered off of ebay.

Can you expand on what you mean by an on-off keying protocol? Would that be something similar to how you code IR commands for the arduino? If that was the case i wouldn't need the virtualwire library at all, right? Just key in the pulses to pull a pin high and the delays in between?

What math did you use to determine 440 bps?

Sorry for all the questions, just trying to figure this all out

Can you determine what pin of the IC on the transmitter board the data to the 315 Mhz transmitter is coming from.
If you are lucky, the IC might be a rebadged SC2262, in which case the data will be coming from pin 17.
SC2262/SC2272 remote control encoders are commonly used in these types of switches , and if thats the case, all you need is the SC2262 datasheet, and you will have to trace the circuit to see which buttons go to which input pins.

Mauried, i think you are probably correct that it is an sc2262. After you suggested that I found another post that does exactly what i'm trying to do, but I can't figure out how the sketch in that post works. He doesn't have a sketch for receiving remote codes, so would you have to use a scope/logic sniffer for each remote code? Where in the code do you tell it what to transmit?

If you read the spec sheet for the SC2262 , it explains how the data is sent.
The only things you need to figure out , are where the push buttons on the remote connected to on the encoder chip
and what the internal clock rate of the Sc2262 is ,
This is set by a resistor connected between pins 15 and 16.
You will also need to determine the address code , which is set by whats connected to pins 1 to 8.

Ok, i'm starting to grasp how this works. I'm sorry i didn't post a link to the other project i spoke of, it can be found here: Arduino Forum

My new question:
The datasheet gives some examples of appropriate resistor values for pairing the clock rates between the two chips, but it doesn't say anything about the rate at which each resistor would make the chip run. In the other post he says that a 3.3MOhm resistor sets the clock at 10KHz. Any idea how he calculated that?

Also, I'd still appreciate if someone could tell me how 10 pulses in 23mseconds translates to 440 bps

ok, first, why do we need the clock rate, bps, etc?? Are you writing a library from scratch or planning to use an existing library? If you are using an existing, you donâ€™t really need to know that.

Use the RC-Switch library or RemoteSwitch library. Both of these have receive code included and are compatible with the SC2262

http://arduino.cc/forum/index.php/topic,38075.0.html

Thank you! I had note come across those projects in my searches, they both appear to do exactly what i'm trying to do.

I would still like to know how oric_dan calculated the bps of what the logic sniffer captured, i can't find any examples for how to calculate such a thing. There are plenty of people who seem to know how to do it but nobody has explained it!

Pretty sure he just looked at the number of bits within a certain time....

As he noted, there were 10 pulses in 23ms. So, 1sec/23ms = 43.4 x 10 pulses = 434 pulses/sec. Just a conversion from the sample he took in milliseconds to seconds.

Thanks, that wasn't obvious to me.

The bps really shouldn't matter anyway. The signal is not constant. These are bi-phase or pulse position encoded. If you look at your capture, you have two types of bits (a zero or a one). One is encoded by 1ms high, 2ms low. The other is encoded by 2ms high and 1ms low. The way these are normally decoded is to start a timer on the rising edge of the pulse and then take a sample 1ms in. Notice that one will be low at 1ms and the other will still be high at 1ms.

This one doesn't look like it does it, but many of these protocols have a leader to them that is sent out for a specified amount of time. The time it actually takes to complete that leader pulse is used to calibrate where to take your sample (in case it were to vary.) 1t is the smallest pulse you see. So we are talking in terms of 1t high and 2t low, or 2t high and 1t low. It is self-clocking this way.

Retroplayer, thank you for the explanation! It really helped me figure all of this out.

As it turns out, i don't think the chip in my remote is related to the SC2262 chips. I ended up doing what oric_dan said and switching the transmit pin on and off to emulate the signal coming from the remote. The Logicsniffer program tells you the exact length in milliseconds of each high and low signal that it captures.

Thanks for all the input!