Serial Communication Issues with external power supply

Hi,

I’m attempting to read serial from a bar code reader using an UNO R3. My code works perfectly when the barcode reader is powered by an external 12V supply but the board is powered through USB. The code also works perfectly when I use two different external power supplies (one powering the board and one powering the bar code reader). I need to get the board to read in serial all while connected to the same power supply as the barcode reader. There seems to be some sort of grounding issue? I’ve attached my code.

Things I’ve Tried:

Using diodes on the supply and ground lines to avoid back voltage

Putting some resistors in series with the communication lines RX and TX

Connecting Earth ground to common on the power supply

Changing the pins the serial is read through (software serial)

It appears that serial will work when the power supplies for the barcode reader and the board are isolated. Any suggestions? Thanks in advanced.

finished.ino (4.54 KB)

Draw a diagram of how you have wired it up please.

What sort of trouble please be more specific.

You should be able to do this without any of those things you tried which are all very wrong by the way.

|500x278

Here is a crude sketch of the way I have the circuit wired up

Link here too http://tinypic.com/r/n5ssh/8

I can't get any serial communication when the circuit is wired up with only one power supply. I wrote some code to detect if there is garbage serial coming in (garbage serial is something that is not a read barcode or a "NO READ" signal from the scanner) and it will indicate serial is coming across. In the serial monitor I tried printing out the garbage serial and it appears to have no length and no characters.

If I power it with two separate power supplies it will communicate properly and detect the serial signals of the barcode or "NO READ" output from the barcode scanner. If i connect the grounds of both the power supplies my communication will fail again and I won't see any serial being sent or received.

Thanks for the diagram. There looks to be nothing obviously wrong with that way of wiring it up so it might be down to the power supply itself. There are two things that could be wrong:-

1) The power supply could be incapable of supplying the current needed for both devices.

2) The bar code reader could be generating interference that disrupts the operation of the Arduino. In which case you will need a bit of supply decoupling between the two devices. Normally a 100uF and a 0.1uF ceramic capacitor in parallel across the supply of the bar code reader might work. Otherwise you might need a pi filter circuit, like the last one in this link:- http://www.thebox.myzen.co.uk/Tutorial/De-coupling.html

Thanks for the suggestions.

I changed the power supply from 1A to 2A but it doesn't look like it changed anything.

I'm currently working on the De-coupling circuit, I didn't have success with the 100u(ish) and .1u(ish) capacitors in parallel with the barcode reader.

Can you post a link to the bar code reader, does it have a TTL output or an RS232 one?

I wrote some code to detect if there is garbage serial coming in (garbage serial is something that is not a read barcode or a "NO READ" signal from the scanner) and it will indicate serial is coming across. In the serial monitor I tried printing out the garbage serial and it appears to have no length and no characters.

Can you post this test code as well.

I Attached some references for the bar code reader. The Barcode reader has RS-232 capabilities and I need it to be using RS-232. The code is the same as i originally attached (I attached it here too). If you look down into the main loop I have a few If statements comparing the read in string. The last If statement has an else that flashes a light if garbage (string that’s not equal to “NO READ” or another constant string) is read in.

Copy of DataMan 50L 60L Datasheet (PART-SPEC - 1046132 - 1 - -) - 1.pdf (998 KB)

finished.ino (4.54 KB)

Here's a link to the second reference it was too large to attach. http://www.vsk.com.tw/download/DATAMAN5060/VSK-DM50_Quick_Reference.pdf

The Barcode reader has RS-232 capabilities and I need it to be using RS-232.

But that diagram you drew says you are not using RS232.
With RS232 you get a -12V for a mark and a +12V for a space. The Arduino needs +5V for a mark and 0V for a space. So not only are the voltages wrong they are logically inverted. This accounts for your problem I think. It also explains why you are getting garbage.

Between the barcode reader and the arduino you need an RS232 to TTL converter. A MAX232 chip or one of the many other similar things.

Make sense, sorry for the confusion. The only thing is I really Don't understand why the circuit works properly when I'm using isolated power supplies. I'll look into and hopefully order a converter today, thanks for the information.

Did you have a common ground? If you did not there could be floating that fluked a connection.

Yes that could be it. When I used two power supplies I attempted both ways. When I have a common ground the serial communication fails, when the grounds are not connected the code runs great and it apperas to be communicating properly.