Several Serial Devices

Hi,

I have an Arduino Duemilanove in my project and I need to comunicate serial with 3 devices:
-LCD 16x2
-Xbee
-Barcode scanner

The barcode scanner is the only not working
It has a serial cable and a RS232 interface built in, is not a handheld, its kinda OEM.

I could read it sometimes but no more.
Now it looks like a power supply issue.
I was able to feed it with another power supply so it can scan normaly.
But now when I try to read from it using software serial arduino just freezes.
I am using pin 9 and 13 for the scanner.

Try reading some more from that scanner you will smoke your arduino. RS232 runs on +- 12V and Arduino serial runs on 0 +5V so you should have something in between to shift the voltage levels.

You should use an RS232/TTL adapter like this
http://www.nkcelectronics.com/rs232-to-ttl-converter-board-33v232335.html
or
http://www.nkcelectronics.com/RS232-to-TTL-converter-board-DTE-with-Male-DB9-33V-to-5V_p_369.html

Thank you all for quick replying!

I think will not smoke the Arduino because the specification of the scanner states the power is 5v.

I had better success reading using RX and TX pins and using the real Serial.

Will I still need the converter?

But I get weird data!
I dont know the relation to the printed barcode it reads, any clue?
Is it because I dont have that converter?

Measure the Rx & Tx lines out of the scanner when it is not sending - are they resting something besides 0 or 5V? Like + 10, +12V, maybe -10 or -12?
Then they are using RS232 levels and you will need the adapter, or make one up.

Ok, Im gonna do this. Thanks!

And how about the strange chars I got, is it related to voltage too?
Or I may need to do some kind of conversion in the software?

Either voltage related (so 0's are seen as 1's and 1's as 0's),
or datarate speed mismatch.

CrossRoads:
Either voltage related (so 0's are seen as 1's and 1's as 0's),
or datarate speed mismatch.

Could also be inverted polarity besides all those.

After several test and trials and some discussion with the hardware supplier I could not make it work yet.

In the last email from the supplier he asked me the following:
Please let me know if your Arduino accepts only RS232 TTL level data or not?
If that's the case, then we have to provide you the pinout/p assignment of the CD-620-R to you because our CD-620-R provides signal data as RS232 level, that may cause misread of code.

I am insecure to answer this.
Anyone knows this, please?

yamandu:
After several test and trials and some discussion with the hardware supplier I could not make it work yet.

In the last email from the supplier he asked me the following:
Please let me know if your Arduino accepts only RS232 TTL level data or not?
If that's the case, then we have to provide you the pinout/p assignment of the CD-620-R to you because our CD-620-R provides signal data as RS232 level, that may cause misread of code.

I am insecure to answer this.
Anyone knows this, please?

You may reply arduino accepts TTL UART signals, 5V and 0V. It doesn't accept RS232 +-12V. You probably damaged either the scanner or arduino when you try to connect 0-5V arduino with +-12V scanner.

do you have a link to the datasheet of the barcode reader?

Hi,

the specs for the scanner are here

I have replied the manufacturer and will wait...

Interestingly I am reading a EAN13 barcode with this number 7896672201424
but in arduino I read this values: 100,76,204,102,38,102,102,230,166,230,102,230,166,0

Looks like nothing was damaged. But is kind of a decoding problem.

The number of digits seems correct (assuming the 0 is an indicator for END OF CODE)
but the numbers do not make sense at all (at least for me), looking at them binary does not help either.

Can you post the barcode itself - image or description -
sw = small white
ww = wide white
sb = small black
wb = wide black

maybe the bitstream encodes the raw barcode before ascii conversion... (datasheet gives no clue)

robtillaart, I am thinking the same way, but have no results on decrypting this thing yet.

The barcode scanned is attached here.

I have read about the EAN 13 encoding but hadnt helped.

This thing is such a puzzle.

have you read wikipedia - http://en.wikipedia.org/wiki/European_Article_Number - might help to decode it

if this is teh code there might be 3 different codes used simultaneously !

I need to comunicate serial with 3 devices:

Assuming those devices talk back to the mcu (they are write-only devices), the trick is to use a resistor + mcu pin to isolate them from the bus: from the serial bus, run a resistor (1k) to the device. On the device's serial pin, connect a small resistor (110ohm or less) to a mcu pin (UART_ENx pin). Default the UART_ENx pin to set / output.

When you want to talk to this device, tri-state its UART_ENx pin; at the end of the transmission, turn it as output.

This approach allows you to connect as many write-only uart devices to one hardware uart.

The manufacturer replied that I will need to communicate without using the RS232 cable provided.
He gave the pin assignment that I had attached here.

My doubt now is if I can only use RX and TX pins do read the serial data.
I will keep searching and trying.

decoder interface pinout.jpg

Finally solved the problem using a RS232 to TTL converter board and a null modem.

Null modem was need just because both connectors are female, scanner and converter.

Thank you all.

yamandu:
Finally solved the problem using a RS232 to TTL converter board and a null modem.

Null modem was need just because both connectors are female, scanner and converter.

Thank you all.

Well a male to male null modem connector does more then just allow two female connectors to be attached to each other, as a null modem also crosses the send and receive signals and cross connects a few of the RS-232 control signals between the two connectors. There are straight-through gender changers that can connect two female connectors without changing any of the wiring paths and are simple called gender changers. a null model connector performs wiring modification and are avalible in male to male, female to female, or male to female configurations.

So if your set up works using the null model connector you selected then it was not just because you had two female connectors needing attachment to each other but rather also a change from DTE to DCE identity for one end of the two connections. A DTE serial device cannot direct wire to another DTE device as neither can a DCE wire directly to another DCE device, they must be of opposite identities.

Lefty

You are so correct retrolefty,

in fact I have not yet a null modem.
I have bought a gender changer thinking it would solve my problem, but not.
So I removed it, and used simple wires crossing tx and rx like a null modem between the RS232 to TTl converter and the serial cable from the barcode scanner.
It worked perfectly wired this way, so I expect it to work with the null modem (that I will buy soon).

Thanks for your comment.