serial hexadecimal data

Hi,

I'm struggling trying to decode hex data on my Arduino, I've got a data logger that looks like it uses an Atmel chip at it's heart and communicates with a display using 4 wires. Two are power (+5v and GND) the other two are TX and RX, so I've got a serial-ttl usb adapter so I can view/read the data inline. Looks like it's 9600-8-n-1 so have set the port to those params and sure enough I am now getting a stream of data before I start to feed this into my Arduino and try to interpret it I'm trying to work out the sequence, but can't quite work my way round it.

I'm using od -x < /dev/ttyUSB1 to read the data, and here is the stream:

0002000 0019 1d01 bcfd 1903 0100 fd1d 03bc 0019
0002020 fd01 0003 bc1d 1903 0100 fd1d 19bc 0100
0002040 fd1d 03bc 0019 1d01 bcfd 1903 0100 fd1d
0002060 19bc fd01 0003 bc1d 1903 0100 fd1d 03bc
0002100 0019 1d01 bcfd 1903 0100 fd1d 03bc 0019
0002120 1d01 bcfd 1903 0100 fd1d 03bc 0019 1d01
0002140 bcfd 1903 0100 fd1d 03bc 0019 1d01 bcfd
0002160 1903 0100 fd1d 03bc 0019 1d01 bcfd 1903
0002200 0100 fd1d 03bc 0019 1d01 bcfd 1903 0100
0002220 fd1d 0003 1d01 bcfd 1903 0100 fd1d 03bc
0002240 0019 1d01 bcfd 1903 0100 fd1d 03bc 0119
0002260 bcfd 0019 1d01 bcfd 1903 0100 bc1d 0003
0002300 1d01 bcfd 1903 0100 fd1d 03bc 0019 1d01
0002320 bcfd 1903 0100 fd1d 03bc 0019 1d01 bcfd
0002340 1903 0100 fd1d 03bc 0019 1d01 bcfd 1903
0002360 0100 fd1d 03bc 0019 1d01 bcfd 1903 0100
0002400 fd1d 03bc 0019 1d01 bcfd 0019 fd01 0003
0002420 fd1d 03bc 0019 1d01 bcfd 1903 0100 fd1d
0002440 0003 bc1d 0119 03fd 1d00 19bc 1d01 bcfd
0002460 1903 0100 fd1d 03bc 0019 1d01 bcfd 1903
0002500 0100 fd1d 03bc 0019 1d01 bcfd 1903 0100
0002520 fd1d 19bc 0100 fd1d 03bc 0019 1d01 bcfd
0002540 1903 0100 fd1d 03bc 0019 1d01 bcfd 1903
0002560 0100 bcfd 1903 0100 fd1d 03bc 0019 1d01
0002600 bcfd 1903 0100 fd1d 03bc 0019 1d01 bcfd

So first thing, somewhere in there is the temperature value of 25, which I cannot figure out where!

Then secondly would I be able to use arduino code like this to read from the serial stream:

while(!mySerial.available());
    int incomingByte = mySerial.read();
    Serial.println(incomingByte,HEX);

If I can then figure out the repetition of data?

Thanks in advance and hope I made sense!

Looks like binary (not ASCII) encoding. Consider providing some useful information, like what data are sent to the display, what range of values, etc.

You might find this blog helpful: Reverse Engineer Wireless Temperature / Humidity / Rain Sensors — Part 1 « RAYSHOBBY.NET

First of all is important to understand if the comunication is, and how it is, regolared (like if it has got a begin or and specific byte, or a CRC, or a number separation).
Second important part is to ubderstand how the numvers are transmitted. They may be transmitted like number (in one o more bytes, like using .write()) or like his unit rapresentation. For example the number ten can be raoresented by a bite like 00001010, that is the binary rapesentation of ten, or like '1','0','1','0', that is ten rapresented in binary, or '1','0', ten in ten base, or in a lot of kther ways. Whitch is our? And witch digits? (Specially if the base is >10)
For knkwing all this informations is better the Serial.print() of the myserial.read(), and not its hex rapresebtation.

Sorry for my bad English

Thank you both, yes sorry for the lack of information, I was quickly writing this, but you've made me look at the right part, the DATA first before trying to get my arduino reading it, and you were right, it's BINARY data:

cat /dev/ttyUSB1 | xxd -b -c 7
00000000: 10111100 00000011 00010011 00000000 00000001 00010111 11111101  .......
00000007: 10111100 00000011 00010011 00000000 00000001 00010111 11111101  .......
0000000e: 10111100 00000011 00010011 00000000 00000001 00010111 11111101  .......
00000015: 10111100 00000011 00010011 00000000 00000001 00010111 11111101  .......
0000001c: 10111100 00000011 00010011 00000000 00000001 00010111 11111101  .......
00000023: 10111100 00000011 00010011 00000000 00000001 00010111 11111101  .......

So looking at this, the fourth column is what I want as that holds the temperature, which you can see is reading at 19 (oC) which is great. I now need to work out how to interpret that on my Arduino, so can I just read the data in and use a binary comparison, I'm a little unsure how to tell the Arduino that it's binary not HEX/ASCII data thoug, any tips?

Thanks!

So Arduino recive only the binary codification of the numbers, whitchout any begin/end/control/separation character?
If so you can just read the Serial and use its value like the value of the temperature, directly.

temperature=Serial.read();

The "fourth column" appears to be all zeros to me.

19 in decimal is 10011 in binary. Please study the link in reply #1.

jremington:
The "fourth column" appears to be all zeros to me.

19 in decimal is 10011 in binary. Please study the link in reply #1.

Apologies, I replied too quickly, you are correct, when posting I'd counted the columns, forgetting to disregard the row counter in the first column (xxd adding that).
So the 3rd column is the one with the values I want "00010011"

Thanks Silente, I'm going to try just reading the data in and parsing it as think that will achieve what I want.