So I have an environmental sensor that spits out data over an rs232 serial port. I wrote a program in processing that reads this data and creates an xml from it. When I open the port with processing at 9600, I receive a string that looks something like "A02, T65, P282, H200".
Now I want to connect the sensor to an Arduino and have it read the data. I'm not really sure how I would go about this, but I tried connecting the ground, and the TX and RX ports from the rs232 to the Arduino. I then opened the port at 9600, and began reading bytes as integers. I got a string of indecipherable integers in the serial monitors. Something like:
0
0
0
0
0
0
0
255
49
0
0
0
0
-1
-1
19
49
Then I tried reading it as characters, and I received a string of garage. I thought the numbers might represent Ascii characters, but they don't seem to correspond with anything decipherable.
Any ideas? Thanks.. still learning the basic, and I really appreciate all the help so far.
What kind of Arduino are you using? Exactly how are you connecting the sensor output to the Arduino (what Arduino pins, what external components, if any)?
Your problem is that an RS-232 link cannot be directly wired to an Arduino serial link pins (voltage levels are not compatable). You need a voltage/logic inversion convertor such as a MAX232 chip.
Hmm. Its an rs232 port definitely. Is there an easy way to see if it is TTL or not? The technical side of the sensor is unfortunately pretty undocumented, but it uses FTDI drivers to communicate with my PC.
Measure the voltage on the TxD line from the device with reference to the ground pin on the same connector. Make sure the device isn't tranmitting anything.
The idle state will be negative if it's RS232.
I could hack it if necessary. Actually, some of the individual sensors are detachable. The air quality sensor just has a positive and negative connection. I'm looking into how to make this work on its own with the Arduino right now. Maybe this is the route I want to go.