I tried a lot of code I found on the internet, but nothing worked.
#include <SoftwareSerial.h>
SoftwareSerial myScale(0, 1); // RX, TX
void setup() {
// Open serial communications and wait for the port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for the serial port to connect. Needed for native USB port only
}
// set the data rate for the SoftwareSerial port
myScale.begin(9600);
}
void loop() { // run over and over
if (myScale.available()) {
Serial.write(myScale.read());
}
}
By the way, I have RS232 to USB convertor which I have plugged into the PC, and I have connected to the device COM using putty and I can see the data clearly.
Your UNO is a 5V board, so power your RS232-TTL converter from the UNO 5V. You don't need to wire up the SoftwareSerial Tx pin as you are not sending any data to the scales. But, maybe you should be ...
There was a recent discussion regarding scales and RS232. Those particular scales needed a serial command in order to take a measurement and send it over the serial link. Check your documentation.
Thanks for your help, It's seem to be working now and there is a progress,
I am able to receive data from the scale but not the data I have expecting for:
Do you have any idea how can I parse it to ASCII?
void loop() { // run over and over
if (myScale.available()) {
Serial.println(myScale.read() & 0x7F);
delay(50);
}
}
Does your user manual give indication of the format of the serial data? Is it plain ASCII?
If it was ASCII, then i'd expect to see numbers like 48 (=0) through to 57 (=9) plus 46 (=decimal point) and probably a 10 and 13 at the end of each reading.
That's nice. We could be about 12000 percent more helpful if you supplied make and model of this device, and links to ant documentation that exists for it.
You could probably do a good amount of research using a terminal program like putty or coolterm, no program, no Arduino.
@markd833, @alto777
Like i mentioned above, I have used putty.
i used baud rate 9600 which is the same in my code
#include <SoftwareSerial.h>
SoftwareSerial myScale(2, 3); // RX, TX
String inData;
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial.println("Starting");
// set the data rate for the SoftwareSerial port
myScale.begin(9600);
}
void loop() { // run over and over
if(myScale.available()){
Serial.println(myScale.read());
}
}
Draw schematics or share what you have already drawn showing one: exactly how you have successfully received using putty, and two: exactly how you've hooked it up with the Arduino and are failing.
While connecting the RS232 via USB converter I have check the COM is device manager and simply logged into using putty like that:
and this is the results:
the scale is power using 220v,
arduino is powered through the USB cable from PC
max3232 is connected like the schema above.
No. I mean srsly, real schematic diagrams: we are at the point where "this is connected to that like this and that is connected the same way" just won't do.
Draw schematics. Take a picture or two maybe.
I am curious why and where 3.3 volts ever enters into it this.
When you say MAX3232, are you talking about the chip or some module you got somewhere?
How is the chip wired, or what module are you using and how is it connected? Schematics would show that level of detail.
There is nothing obvsly wrong with what you are trying.
What means this?
While connecting the RS232 via USB converter
What converter? How is it wired? How is it powered?
Please confirm or correct the output you get from your program. The nonsense output.