Check thqt Serial coms are working

Hi All,

I'm writing a program that sends serial commands from an Arduino Nano to a peltier control board. reading the datasheet for serial coms on the peltier control board it states that serial commands must be sent in the following format:

RS232 serial interface, 115200 baud, 1 start, 8 bit, 1 stop bit, no parity, no handshake (no flow control).

I've set the Arduino up like so:

Serial.begin(115200);

Physically I've got the 0 and 1 pins (Rx and Tx) connected to the Tx and Rx pins of my Max232 chip.

and a DB9 connector from the Max232 Chip to the peltier control board.

I don't know that I'm not sending my commands in the correct format or if the serail commands just aren't getting there.

So what I'm asking really is how do I check?

Cheers

Steve

So what I'm asking really is how do I check?

With an oscilloscope.

It is more likely that your commands are getting there, but that they are not in the form that the device expects/understands, so they are ignored.

Your unposted code may be the culprit.

A link to the device you are talking to is in order, too.

Ah guessed as much :frowning:

yeah the manual I’m following for the peltier controller is :

http://docs-europe.electrocomponents.com/webdocs/0551/0900766b805515a0.pdf

and in terms of code I’m right at the start of working with the kit so I’m just trying to read the temperature, which based on that manual I’ve understood to mean I need to send “$R105?” followed by a carriage return.

#include <Wire.h>  // Comes with Arduino IDE
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);  // Set the LCD I2C address

int dave;

void setup() {
  // put your setup code here, to run once:

  Serial.begin(115200);

  lcd.begin(16,2);   // initialize the lcd for 16 chars 2 lines, turn on backlight
}

void loop() {
  // put your main code here, to run repeatedly:
 delay(4000);
 Serial.write ("$R105?");
 Serial.write ('r');
 dave = Serial.read();
 lcd.clear();
 lcd.print(dave);
}

If this is meant to be a carriage return character

 Serial.write ('r');

it should be

 Serial.write ('\r');

...R

 dave = Serial.read();
 lcd.clear();
 lcd.print(dave);

This won’t work, as it reads and prints a single character.

It appears that you have two options for data return, ASCII floating point and binary mode. In binary mode, the device sends back 4 bytes that make up a (binary form) floating point number.
From the data sheet:

$Rxx? Read data (float or int) from register xx ex. +2.000e+01

$RNxx? Read float data in IEEE754 type from register xx ex. A1A8FCBA

In either case, you need to read several bytes and combine them to form the result.

You may find some useful stuff in Serial Input Basics

...R