Arduino Leonardo Serial Input

Got a hardware problem? ask for help

Arduino Leonardo Serial Input

Postby DFTBA4ever » January 6th, 2013, 7:14 pm

I recently picked up a GPS module from the local thrift shop for $3. The thing is a simple receiver, meant to hook to a computer running proprietary software. The device has a DE-9 serial output, or a PS/2 Mini-Din connector. I want to use this in my own projects. Can this plug into pins on an Arduino for input?
DFTBA4ever
 
Posts: 73
Joined: August 20th, 2011, 1:44 pm

Re: Arduino Leonardo Serial Input

Postby semicolo » January 7th, 2013, 9:39 am

Not directly, you need to convert the rs232 signals (on the gps side) to 5V or 3.3V (on the arduino side).

Search the internet about max232 circuits, you can also find some circuits made with transistors and passive components (like on the original serial arduino). If you don't mind opening the gps module, you may also be able to identify a chip that converts the serial data to rs232 and connect before it.
User avatar
semicolo
 
Posts: 269
Joined: December 13th, 2011, 3:32 pm

Re: Arduino Leonardo Serial Input

Postby DFTBA4ever » January 7th, 2013, 5:22 pm

I see. Also, I wasn't clear on the connector. From the module, there is a wire leading to an RS 232 connector. From that comes a PS/2 connector, implying a choice on which to use. But you think I should crack the thing open?
DFTBA4ever
 
Posts: 73
Joined: August 20th, 2011, 1:44 pm

Re: Arduino Leonardo Serial Input

Postby k-ww » January 7th, 2013, 7:37 pm

You did not mention how the GPS gets it's power -
it may just be using the PS/2 connector for the +5V,
and the I/O is on the RS232 - I have a module that works
in just that fashion, so that you could power it from
a laptop computer.
User avatar
k-ww
 
Posts: 1155
Joined: February 17th, 2011, 10:47 am

Re: Arduino Leonardo Serial Input

Postby DFTBA4ever » January 7th, 2013, 9:13 pm

I found a link to the board's pictures along with a description. Can you tell me more about what I need to do?

http://www.gpsnuts.com/mygps/gps/hardwa ... ly_gps.htm
DFTBA4ever
 
Posts: 73
Joined: August 20th, 2011, 1:44 pm

Re: Arduino Leonardo Serial Input

Postby semicolo » January 8th, 2013, 9:50 am

The guy says in his article the rs232 transceiver is all discrete, so you'd be better with an rs232/ttl converter unless you manage to find the serial line before said transceiver.
seems like the ps2 port provides power, so you need to connect the leonardo's +5/gnd to the ps2 and the db9 to an rs232 level converter connected to the leonardo's serial input
User avatar
semicolo
 
Posts: 269
Joined: December 13th, 2011, 3:32 pm

Re: Arduino Leonardo Serial Input

Postby DFTBA4ever » January 8th, 2013, 4:12 pm

I noticed the board had 4 wires coming from it. I know two are power, but are the other two clock and data, or are they rx and tx?
DFTBA4ever
 
Posts: 73
Joined: August 20th, 2011, 1:44 pm

Re: Arduino Leonardo Serial Input

Postby semicolo » January 9th, 2013, 1:23 pm

Hard to tell just from the picture (looks like there are 4 wires on top and one at the bottom).
But yes there should be +5V/Gnd/rx/tx, just search for the connectors pinout to determine the purpose of the wires.
User avatar
semicolo
 
Posts: 269
Joined: December 13th, 2011, 3:32 pm

Re: Arduino Leonardo Serial Input

Postby UAirLtd » January 9th, 2013, 5:52 pm

You probably got everything you need, but here's some background for you and people from teh future arriving here by search.

Check the voltage on the TX/RX lines, true RS232, such as the like that runs over DB-9 connectors on old-stylie computers use up to +15V for space (logic low) and down to -15V for mark (logic high), which is the opposite of what you'd expect. In fact the voltages are all silly, it's +3 to +15V for space, and -3 to -15V for mark, which is very likely to cause problems if you connect that to something that expects 5V TTL input (could also cause damage).

And that's the purpose of a a max232 circuit, as semicolo suggests. The MAX232 is a chip that converts this odd RS232 voltage levels down to 5V TTL (maybe even 3.3V, can't remember). You can also use discrete transistors and passives to do the same.

However, these days a lot of devices that have serial ports use RS232 but at lower voltages, specifically, they use +5V for space (which falls in the +3 to +15V range and is therefore a valid signal), and 0V for mark (which doesn't fall in the -3 to -15V, but is assumed that the computer is ok with this). This lets the device use 5V while TRANSMITTING to a computer, it does need a bit of protection from the <0V and >5V it would be RECEIVING from the computer, that could be as simple as resistors and clamp diodes.

+5V for space and 0V for mark is the wrong way round for proper TTL serial that a microcontroller usually deals with, but that can be easily inverted using a logic gate chip, or simple inverter circuit made of discrete and passives.

Therefore check the voltage on the TX pin of the GPS unit, if it's idle at <-3V, then you're dealing with a "true RS232" device, and you're going to need a rs232 transceiver like the MAX232 chip. If instead the TX line is idle at 0V, then you may be dealing with a "5V-level RS232" device, and you'll just need a simple inverter circuit to get it talking with an Arduino.

Just for comparison: TTL serial has the TX pin usually idling at +5V (or +3.3V if that's your logic high level). EXCEPT when the device is using hardware flow control and is sending a BREAK signal.
User avatar
UAirLtd
 
Posts: 629
Joined: July 19th, 2011, 10:32 pm

Re: Arduino Leonardo Serial Input

Postby DFTBA4ever » January 9th, 2013, 8:00 pm

Huh. Sure makes me wish I had a computer old enough to have a serial port. I do assume I need to check voltage while it's running?
DFTBA4ever
 
Posts: 73
Joined: August 20th, 2011, 1:44 pm

Next

Return to Help me! Hardware

Who is online

Users browsing this forum: No registered users and 3 guests