Hi,
I'm having the same/similar type of issues that @jockwr was having back in 2017. I didn't find the resolution in the now closed thread so I'm reposting the topic with my conditions as well as the link to the jockwr's post. Also I’m using a similar format because I thought they framed the problem quite well. I've tried everything jockwr stated they did and everything suggested to them in the thread. (I do not have the same thermal condition that jockwr experienced with their transceiver)
It seems like I'm missing some small detail here or some bit of knowledge.
(This is my first Arduino project in more than 10 years so im a bit rusty too)
I've included my sketch at the end.
Sending ASCII strings to RS232 device - Using Arduino / Programming Questions - Arduino Forum
I have a Syringe Pump, it responds to text/string commands.
The device can communicate using it's RS232 DB9 cable
baud: 9600
Bits: 8
Parity: None
Stop bits: 1
Flow Control: None
I'm using the following hardware:
An Uno with a TinySine RS232/RS485 Shield (SP3232E chip from Max Linear)
Prior to trying to use the Arduino to communicate with the Pump I did a check with HyperTerminal in two ways. (Using the RS232 com port native to the laptop and with a USB to RS232 serial converter.)
I've configured HyperTerminal to the following Parameters and ASCII settings enabled:
Baud: 9600
DataBits: 8
Pairity: None
StopBits: 1
FlowControl: None
✓ Send line ends with line feeds.
✓ Echo typed characters locally.
✓ Append line feeds to incoming line ends.
✓ Wrap lines that exceed terminal width.
When I use HyperTerminal to send the command "/1" (to make a communications check for example). The pump does respond with "/0' " (Which is the desired response)
Furthermore, any properly formatted command that I issue via HyperTerminal works and can control the pump. (With the native com port or the USB to serial converter)
Before I try and send any commands from the Arduino to the pump, I wanted to make sure I have Arduino doing this correctly by sending commands from Arduino to HyperTerminal. For this I just used the DB9 cable from the native com port to the TinySine shield and am sending ASCII stings through the serial monitor and the HyperTerminal communication window. It was a success! We can send strings back and forth all day long now.
The next phase was to have Arduino send a command to the pump and get a response on the serial monitor window. (This didn’t work ..just silence)
Next I tried sending a command in which a response on the serial monitor didn’t matter because we would see a physical reaction of the pump. I used “/1W4R” (which is the initialization command when you replace the syringe). This also did nothing.
Additionally, I visually monitored the TX and RX LEDs on the Arduino board. I can see that the commands are transmitting but nothing on the receiving end.
The Conections are as follows:
- PC com6 USB port to USB port on arduino (via USB cable)
- Arduino SoftwareSerial to RS232 shield (Pins 2 & 3)
- RS232 shield to Pump RS232 com port (via DB9 cable)
Note: This is the same setup used for communicating from Arduino to HyperTerminal with the exception of condition 3 (the other end of the DB9 cable is plugged into the native 232 com port on the laptop instead of on the Pump)
Any help will be greatly appreciated.
And here is the sketch I was using for both communication with HyperTerminal and with the Pump:
// ---------------------------------------------------------------------------------------------------------------
// Interfacing Arduino(TinySine RS232/RS485 Shield) and Kloehn Syringe Pump.
// ---------------------------------------------------------------------------------------------------------------
#include <SoftwareSerial.h>
SoftwareSerial Pump(2, 3); // RX, TX
// SETUP------------------------------------------------------------------------------------------------------
void setup() // Runs once.
{
Serial.begin(9600); // Open serial communications with IDE Serial Monitor at 9000 baud (Through pin0 and pin1 or UBS port)
Pump.begin(9600); // Opens comm port through pins 2 & 3 (RS232 Shield) 9600 baud
while (!Serial) {} // Wait for serial port to connect (Needed for native USB port only)
delay(50);
Serial.println("Arduino is online!"); // Test: (Text displayed in Serial Monitor)
delay(1000);
Serial.println("Checking pump status...");
Pump.println("/1"); // Test: Is Pump communicating with the Arduino? ( /0' )
while (Pump.available()){
Serial.println(Pump.readString());
}
}
//END SETUP-----------------------------------------------------------------------
// LOOP-------------------------------------------------------------------------------
void loop() // run over and over
{
while (Pump.available()){
Serial.println(Pump.readString()); // Read message from Pump and print line to IDE Serial Monitor.
}
while (Serial.available()){
Pump.println(Serial.readString()); // Read message from IDE Serial Monitor and print line to Pump.
}
}
// END OF LOOP---------------------------------------------------------------------

