0
\$\begingroup\$

I have set up serial communication between my Arduino and a sensor stamp.

The sensor stamp in question is Atlas Scientific EC stamp. The communication uses RT232 RS232 serial protocol.

The replies I get are often garbled, and after some transmissions the Arduino then falls out of sync, while the sensor board continues transmitting data.

Some people have recommended installing a bypass capacitor.

What is the right position and size for a bypass capacitor in my setup?

The board and Arduino have common 5V and GND, while TX and RX pins are crossed.

\$\endgroup\$
6
  • 2
    \$\begingroup\$ Please be more specific. Datasheet for your Arduino? Datasheet for the sensor? Source code? Circuit diagram? Picture of your setup? Where would such a bypass capacitor be placed in your opinion? \$\endgroup\$ – jippie May 19 '13 at 8:29
  • 1
    \$\begingroup\$ Did you mean RS232, or the dual-channel RT232 2-wire transmitter? This is the kind of situation where a datasheet really clarifies things. \$\endgroup\$ – Anindo Ghosh May 19 '13 at 9:13
  • \$\begingroup\$ Here's the datasheet: atlas-scientific.com/_files/legacy/ec/EC_Circuit_2.0.pdf \$\endgroup\$ – vrode May 19 '13 at 9:33
  • 1
    \$\begingroup\$ Minor Gripe - What's the deal with calling stuff a "stamp"? It's a PCB module, which you treat as a component. Call it a module - it's more informative. \$\endgroup\$ – Connor Wolf May 19 '13 at 11:02
  • \$\begingroup\$ What baud rate, and what sort of wiring (how long etc) is it? \$\endgroup\$ – pjc50 May 19 '13 at 13:23
2
\$\begingroup\$

For garbled data I think the problem might be with the way you are receiving the data in the Arduino. I had a similar question with Arduino/Android usb communication that can be found here.

You need to push serial data onto some sort of buffer before you can display or use the data. Since the rx/tx can be in somewhat random chunks and you cannot be certain in what size chunks the data will appear you need to be certain of the total data size before it is sent or have some indicator of a start and end transmission so you can set up a buffer to hold the data.

\$\endgroup\$
0
\$\begingroup\$

Serial port speed needs to be within a certain tolerance. Often on micro controllers the baud rate is divided from the clock, check that the result is within 3.5% of the desired rate. On a TI 320F28335 DSP, here is a 57600 baud approximation: divider = 0x51=81; LSPCLK 37425000 / (81*8) = 57754 baud (+154 baud or +0.2%)

The speed difference between transmitter and receiver must be within about 3.5% so sampling is correct throughout a full frame (start bit, data bits, optional parity and stop bit). The actual bit rate needs to be between 55732 and 59775 baud or transmission will be erratic.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.