I'm trying to read values from my Kern scale with RS232 with my Arduino Mega, i ve tried the codes online but none worked, therefore Im asking for help.
The scale uses an RS232 interface, so I bought an MAX3232 converter, I have checked the wiring, the RX on pin 3, TX on pin 2 and GND on pin 5. On the TTL side, I connect the VCC and GND to arduino, reads about 4V, and RX to RX1 on pin 19, and TX on TX1 on pin 18.
I have tried the code available online, but it doesnt give me any readings in the serial monitor.
The settings on my kern scale are:
7 digit data output
Continious data output
9600 bps
no parity bit
Yes i agree the wiring is a bit cursed
Thanks so much in advance, I ve been trying for at least a week now.
Hi, yes the short cable with red wires is just a gender changer, and the RS232, the top 5 pins from left to right is pins 1-5, rx on pin 3,tx-2, gnd-5, the others are not connected.
Can you expand on this? Pin 4 on a standard 9-pin D-connector is - I think - DTR, which is one of the hardware handshake lines. The serial adapter module you have does not support handshaking, so you need to make sure that the scale is not expecting any hardware handshaking, otherwise it will not communicate.
EDIT: Having just skimmed the manual, the scale does not appear to use any form of hardware handshaking. I guess you have it setup for continuous serial output?
If you change your Arduino code to use Serial1 instead of SoftwareSerial, then you can set the type of parity you need to match the scale setting.
If you set your scale to continuous output, then the only 2 signals you need from the connector are GND and TXD.
Have you tried using a serial terminal program on your PC to receive the serial output just to check that data is being sent?
thanks so much, i rejigged the pin 2 and 3 on the rs232 and switched from an arduino mega to uno and used a code i got from another post which you also contributed to this post, and it just worked. here is my results.
But i still wonder why does my mega dont work? i have checked with an serial moniter on my pc and its getting no results at all.
void setup()
{
Serial.begin(9600); // USB Serial monitor
Serial1.begin(9600); // Serial1: TX1/RX1 (pins depend on your board)
}
void setup()
{
Serial.begin(9600); // USB Serial Monitor
Serial1.begin(9600, SERIAL_8N2); // Serial1 with 8N2
}
void loop()
{
if (Serial1.available())
{
char x = Serial1.read();
Serial.print(x); // Echo to Serial Monitor
}
}
ok this is completely solved. just this code, and it now works perfectly. Thank you 2 so much! this has been bothering me for a month now.
void setup() {
Serial.begin(9600); // USB serial for monitoring
Serial1.begin(9600); // Serial1 for the RS232 scale
}
void loop() {
if (Serial1.available()) {
Serial.write(Serial1.read());
}
}