Strange Data From Serial

I posted yesterday, but realized I did not include enough information for it to be clear.

I am trying to read serial data in though an UNO from a battery controller. The controller only transmits (only using pin 1 and ground). The battery controller uses 9600 baud, 8 data bits, 1 stop bit, no parity. When I monitor the controller through putty on windows the serial output looks like this:

$OPOW,1,0,0.0,0.0,4.1,59.6,86.0,D%6D $OPOW,1,0,0.0,0.0,4.1,59.6,86.0,D%6D ...

When I monitor through serial monitor on the arduino it looks like this:

[125 …E��§Ÿ§¥Ÿ£Ÿ§Ÿ£Ÿ§—£�§•�£“§�“£Ÿ§wµ—Ÿåë91 }…E��§Ÿ§¥Ÿ£Ÿ§Ÿ£Ÿ§—£�§•�£“§�“£Ÿ§wµ—Ÿåë91 }…E��§Ÿ§¥Ÿ£Ÿ§Ÿ£Ÿ§—£�§•�£“§�“£Ÿ§wµ—Ÿåë[125 …E��§Ÿ§¥Ÿ£Ÿ§Ÿ£Ÿ§—£�§•�£“§�“£Ÿ§wµ—Ÿåë210

My code looks like this:

char data;

void setup() { Serial.begin(9600);

}

void loop() {

while (Serial.available() > 0) {

data = byte(Serial.read());

if (data ){ Serial.print(data); } } }

I have no clue why the data is so different. Any help would be amazing!!

Do you have the battery controller and serial monitor connected to the same serial port (hardware serial)? You might need to set up a software serial port to receive the data from the battery controller and use the hardware serial (pins 0 and 1) to send to the serial monitor.

Try data = Serial.read();

Is the IDE serial monitor also set to 9600? (look in the bottom right hand corner) You have grounds connected?

Grounds are connected, IDE is set to 9600 baud. Changed to data=Serial.read(), still strange symbols.

With the controller going through software serial, the output is slightly different but just as strange: [êvvííÚÚÚÙZY´²²´ÛV[êvvíííÚÚÙZY´²²´ÛV ...

Post your new code, please. In code tags like below. Select and copy your code in the IDE, click the </> icon on left above smileys, paste code between the tags.

.

char data;
void setup()
 {
  Serial.begin(9600);
}

void loop() 
{
  while (Serial.available() > 0) 
    {             
          data = byte(Serial.read());             
          if (data)
                {
                     Serial.print(data);
                }     
      }
}

Is the output from the battery controller TTL or RS232?

Controller is RS-232.

#include "SoftwareSerial.h"

char data; 
SoftwareSerial battery = SoftwareSerial(9,255);

void setup() {
  Serial.begin(9600);
  battery.begin(9600);

}

void loop() {

  while (battery.available() > 0) {
                data = battery.read();
               if (data ){
                  Serial.print(data);
               }     
    }
}

If it is RS232 then you will need to convert to TTL when you connect it to the Arduino.

Try using one of the examples in serial input basics. Serial data arrives at an Arduino very slowly compared to how fast the Arduino works.

…R