Troubleshooting: Arduino Communication with PreSens Oxy10 Transmitter




This page contains the troubleshooting efforts to communicate with the PreSens Oxy10 Transmitter.
The components of the system needed to be checked individually to see if they function.




The PreSens Arduino Transmitter System



Arduino Mega


Can the Mega function correctly?


We sent information from an Arduino Uno to a Mega to determine if the Mega received data. We determined that the Mega was functioning properly.
  1. To determine whether the Mega can communicate correctly, we used an Arduino Uno and programmed it to print 5's.
  2. We then connected this programmed Uno to the mega, expecting the mega to print 5's. In this way we would determine if the Mega can receive data.
  3. The mega did not print 5's. Instead it printed 50 13 10. We programmed the UNO to print the text works and when we connected this to the Mega, the Mega printed numbers again.
  4. We successfully communicated between the Mega and the Uno using new codes receiver and sender.
    1. The Uno was programmed with the sender code which prints the information “This is a test.” to the Uno’s serial port.
    2. The Mega was programmed with the receiver Code which reads the Serial port of the Mega continuously for information.
    3. The Uno was programmed first, disconnected from the PC and wired to the Mega. The mega was connected to the PC and its output was monitored using the Arduino Serial port.


Arduino codes used:
receiver.rtf
sender.rtf

This image depicts the output of the Arduino terminal upon successful communication between the Uno and Mega.




RS232 Shield

Can the RS232 shield receive data?


We determined that the RS232 can receive data and here are the troubleshooting steps taken:


  1. The RS232 shield, unlike the Arduino, does not have a light indicating power is being received. We confirmed the RS232 can turn on when connected to the RX and TX transmitter pins of the Mega to those on the RS232 and lights illuminated on the RS232 shield.
  2. Initially we tried the Loopback test to determine whether the shield could both receive and transmit data.
    1. The Loopback test (http://www.usconverters.com/downloads/usb-serial-rs232-loop-back-test.pdf ) is commonly used to determine whether USB to RS232 serial cables are functioning.
    2. The USB to serial RS232 adapter was connected to the RS232 shield and the rx and tx pins on the shield were shorted theoretically allowing information to be transmitted and received by the same computer.
    3. The test was repeated at two baud rates 9600 (recommended by the test protocol) and 38400 (recommended by the designers of the RS232 shield).
    4. The test was did not demonstrate communication with either baud rates and it remained inconclusive whether the RS232 shield was capable of receiving and transmitting data.
  3. After much iteration of code and trials, we were able to send information through the RS232 shield from one computer read that information from the Mega with another computer.
    1. Connected the Shield to a Linux computer via USB serial to RS232 cable cable. Connected the RS232 end to the RS232 shield wired to the Mega as per assembly video. Connected the Mega to another computer via USB.
    2. On the linux computer, we used the Python code (below) to send a message through the COM port (USB interface) connected to the RS232 shield.
    3. Code check_outputformat3.ino was loaded in the Mega to allow it to read the information from the shield.
    4. Initially, the RX light of the shield blinked indicating information was sent. A series of y’s printed from the Mega in the Arduino terminal. This meant that information was not being decoded correctly and there were baud rate errors. We determined that baud rate 38400 worked.
    5. By receving this hello message we were able to read out from the RS232 'hello' demonstrating that it can receive data. close()


The Mega and Shield wiring diagram:


Arduino Codes Used:
check_output_format3.rtf

Python code used to transmit messages to the RS232 shield.

   import serial
   ser = serial.Serial('/dev/ttyUSB0', 38400, timeout=1)
   ser.write("hello")
   ser.


This image is of the Arduino terminal printing “hello” and indicating that the shield can receive data.



Can the RS232 shield transmit data?


We determined that the RS232 can transmit data and here are the troubleshooting steps taken:


  1. To test to see if the RS232 shield could transmit data, the Mega and RS232 were assembled as depicted above 'The Mega and Shield Wiring Diagram'. The shield was connected via Serial to USB to a comport on a second computer.
  2. Code Rs232_shieldtest.ino was loaded to the Mega to transmit the message “This is working!” to serial3 on the Mega.
  3. Using the program Putty on the second computer, we were able to read the message being transmitted to the RS232 shield. This message was the original message we loaded into the mega. Receiving this message confirmed the ability of the RS232 to recieve data.


Arduino Codes Used:
rs232_shieldtest.rtf

This image depicts the successful transmitting with the RS232 shield. In the image, the Putty software is depicted reading “This is working!”



Recording of RS232 Transmitting http://www.youtube.com/watch?v=_IplvFEuTHY&feature=youtu.be



Initializing the Transmitter


We have yet been able to initialize the transmitter as it would normally function with its original software. Here are the troubleshooting steps taken:


Knowing that the Mega and RS232 shield work to receive and transmit data. The next component to consider was the transmitter itself. The transmitter works to receive and transmit data with the PreSens software. This was proven through actual experimentation with the device. In order to initialize the transmitter with an arduino, we need to replicate the proper initialization procedure that the PreSens software is responsible for.

The codes used to communicate directly with the transmitter were designed based on the information programming and protocol guides provided by our PreSens supplier.
programming_guide.pdf
serial_communication_interface.pdf

  1. With the communication system assembled (image), we tried to send out commands to initialize the transmitter using the following code (post code). The RS232 shield lit indicating that commands were transmitted to the PreSens transmitter but no information was received in return.
  2. To reverse engineering the initialization protocol, we tried to interrupt the protocol sent out by the PreSens software. The software communicated via USB so we connected the Mega and loaded a simple code that read continuously from the Mega. When we ran the software, we read nothing from the Mega. This meant that the software did not use any serial commands to check if the transmitter was there. Because the software did not detect any device, it did not send any commands to the arduino.
  3. We went back to the programming guide and tried all of the initialization commands listed. The RS232 blinked indicating that the commands were being sent to the transmitter but no communication was received in return.
  4. We know that we are sending commands but it seems that they are not the ones the device expects. At this point, we are proceeding with testing more commands from the programming guide provided by PreSens.


Sample of initialization testing code used:


The following sample of code contains a sample of commands described by he PreSens programming guide. All of the commands are found in the programming guide posted above.
initializationtesting.rtf

 
start/classes/seniorproject/rs232/troubleshooting/start.txt · Last modified: 2013/05/15 18:44 by aceved
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki