Hi there,
I am absolute newbie in Arduino and electronics; I have checked a lot of entries in the forum and tried many things, but I still have no solution to my simple problem.
I have an Arduino UNO rev 3. I want to use Arduino to read the weight form a scale, and some other parameters from sensors, to perform operations and get some results.
When pressing a button in the scale, let's call it "send" button, the scale sends the weight as rs232 (9600/8/N/1) using 14 Bytes. I have bought a sparkfun shield for adapting the rs232 voltage levels to TTL (SparkFun RS232 Shifter - SMD - PRT-00449 - SparkFun Electronics).
I have also taken pieces of code for reading the scale, adding a delay of 100 ms for checking purposes.
#include <SoftwareSerial.h>
#define rxPin 2
#define txPin 3
SoftwareSerial balanza = SoftwareSerial(rxPin, txPin); // RX, TX
char x;
void setup()
{
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
Serial.begin(19200);
Serial.println("Goodnight moon!");
balanza.begin(9600);
}
void loop() // run over and over
{
if (balanza.available()) {
int test = balanza.available();
Serial.print(test);
x = balanza.read();
Serial.print(x); //this produces a series of countdown numbers and readings, only for checking purposes
}
delay(100);
}
GND connected to GND. Rx pin (pin 2) connected to Tx of the shield. Tx pin (pin 3) connected to Rx of the shield. VCC is not connected following the scale's manual. However, I have also tried connecting 5V and 3.3V to VCC, with little differences.
Having everything in place, when pressing the "send" button of the scale, what I obtain is the following:
[MODIFIED: removed "Goodnight moon!" becase I don't get it when I press "send"; I get "Goodnight moon!"when I open the Serial Monitor, which is OK]
"14ÿ13ÿ12ÿ11ÿ10ÿ9ÿ8ÿ7ÿ6ÿ5ÿ4ÿ3ÿ2ÿ1ÿ"
14 and the countdown numbers are OK since it tells the number of Bytes of the message (balanza.available()).
However, instead of obtaining something like "W=+ 1.05kg" I only get fourteen "ÿ", which is 255 (11111111).
I have tested connecting the scale to a PC, COM port, and I get normal responses, like "W=+ 1.05kg".
So, I know that the scale sends the correct information, but I can only get "ÿÿÿÿÿÿÿÿÿÿÿÿÿÿ" (character).
I have also used another rs232/ttl adaptor (http://www.ebay.com/itm/MAX3232-RS232-Serial-Port-To-TTL-Converter-Module-5V-COM-DB9-Connector-W-Cable-/131297394854), but the result has been even worse: I didn't receive anything when pressing the "send" button of the scale; I only got data when switching the scale off: about 64 Bytes of weird characters.
I have swapped many times Rx and Tx just to check if I was wrong. I have set the Serial baud rate coming to my PC to 19200 to avoid echo with the baud rate of the scale.
What can be wrong? Are both shields damaged? Any ideas or similar problems? Should this be completely solved by using another arduino module with 2 or more hardware serials?
THANK YOU!