Connecting to a sensor via serial

Anyone know if i can make a serial conneciton to an ocean server sensor using NewSoftSerial ? and if not how can i connect?

I have an arduino duemilonave(328) and i would like to talk to an OSServer 5500 sensor.

here are the links to the sensor:
http://www.robotshop.us/content/PDF/OS5000_Compass_Manual.pdf
http://www.robotshop.us/content/PDF/Compass_OS5000_Family.pdf

I have tested it and it seems to work via a sample exec that connects via usb and outputs tilt values. So i think the sensor is working correctly

When i set up the circuit to talk to the sensor via serial- i do get continous readings back from the sensor but they are all garbled and do not represent readable strings like:^*&^@&^WEUYI....

I am using NewSoftSerial library and i was wondering if i can actually use this lib connect to this type of sensor. The factory default baud is 19200, 8, 1, N according to the specs. Any help or tips would be much appreciated :slight_smile:

here is the simple code i wrote:

#include <NewSoftSerial.h>


NewSoftSerial mySerial(3, 4);

int baudRate=19200;

void setup()
{
  Serial.begin(9600);
 
  mySerial.begin(baudRate);
 Serial.println("setup");
}

void loop() {
  int incoming = 0;
  if (Serial.available()) {
    
        incoming = Serial.read();
  }
  if(mySerial.available())
  {
    Serial.print(mySerial.read(),BYTE);
  }
 
}

but they are all garbled and do not represent readable strings like:^*&^@&^WEUYI.

That sounds like either incorrect baud rate or an upside down signal. Is the output of your sensor RS232? If it is you will need an RS232 to TTL voltage converter between your sensor and the Arduino.

Hi,

first i would check the proper operation of the sensor with hyperterminal on a PC. If this works (baudrate correct), then i would set the baudrate of Serial to the same baudrate or higher as mySerial, may be the 64 Char buffer overruns, if the sensor transmits without any delay.

Good luck
Mike

yes i have been checking the baud rate but i believe that it is correct.
and yes the connection is rs232, but i do not have a converter. I just have taken the lines directly from the serial port and connected to the arduino. Perhaps this does not work. Yes your right i should be trying to connect to a pc's hyperterminal first and validate all bauds. Not sure what you mean by 64 char buffer overruns but will look into that too.
not sure what upside down signal is but ill look into that too
Thanks for the advise

To read RS232 signals, you need an interface like a MAX232 chip. This converts the RS232 voltage levels to TTL levels the Arduino expects on its serial pins.

RS232 uses negative voltage to indicate a "1", whereas TTL signaling uses a positive voltage to indicate a "1". The MAX232 chip performs this inverting for you.

So you have put a negative voltage into your Arduino. Logic says this has blown it up, however if you are lucky you may have got away with it.

Not sure what you mean by 64 char buffer overruns but will look into that too.

Don't bother with that we have found your problem, it's not using a voltage converter / inverter.

ok thanks , i see the tutorial on max 232 and if its like the other ones looks simple enough.

luckily nothing has blown up chip still is working on usb :wink:

Really appreciate the help guys