Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Getting started with RS232


  • Please log in to reply
3 replies to this topic

#1 Aaron Douglas

Aaron Douglas

    New Member

  • Members
  • Pip
  • 2 posts

Posted 04 March 2012 - 04:01 PM

Hey all,

I just recently purchased the Netduino Plus. While I'm not new to C# or programming in general, working with electronics is a completely new frontier for me, and I'll be honest, I don't know anything about them.

Now, in my day to day work life, I do a lot of work with GPS's (particularly Garmin OEM GPS's, so I figured this might be a good place to start. Right now I'm trying to interface an old Garmin eTrex Legend [www.garmin.com] (RS232 connection info on page 58) that I happened to have lying around so that I can read the NMEA output through the RS232 connection. Now, from what I've read so far, being RS232, it's probably running at +/- 12v, which I would obviously not want to plug into the netduino.

As much as I've gathered so far, I have to run this through something such as the Max232 [www.sparkfun.com] to convert it to TTL. Is this about right? From what I've seen, there are prebuilt converters you can buy, but I'd rather put it together myself so that I can get a better idea of what's going on. Does this sound about right?

On that line, if anyone can point me to any links about how to wire something like this up, I'd greatly appeciate it.

Thanks for any help.

Aaron

#2 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 724 posts
  • LocationBerkshire, UK

Posted 04 March 2012 - 06:16 PM

Hi Aaron,

You are correct, the RS232 levels are typically +/-5V to +/-12V depending on how the device has been constructed.

There are two reasons not to plug these voltages directly into the Netduino (plus):
  • first, the obvious one, is that the the positive voltage is too high, and also the Netduino does not like negative voltages.
  • second, but less obvious, is that the RS232 signals are inverted when they are converted from TTL to RS232. So the Netduino will not understand the pattern of the serial signal coming in.
The MAX3232 is ideal for converting to and from RS232. The first "3" indicates this is the version that runs happily on a 3V supply.

Assuming you buy a dual in-line package (not surface mount), wiring it up is very simple and could be done on a bread board first. You need the chip itself and five 0.1uF or 100nF capacitors. (0.1 micro Farad = 100 nano Farad). Apart from some wire, that's it.

The MAX3232 does two jobs:
  • take the 3V supply voltage and boost it to RS232 voltage levels (using four of the capacitors to store it),
  • convert TTL to RS232 and RS232 to TTL.
If you follow the link on the sparkfun site to the datasheet, turn to the bottom of page 7 to see a schematic of the device with its capacitors.

There is a diagram at the bottom of page 6 that shows the pinout of the device. Note the notch at the top of the package, that shows you where pin 1 is. (Sometimes there is a small round spot next to pin 1 instead of a notch.)

Be careful as the data sheet describes two devices, the MAX3232 and the MAX3222. The latter, the wrong one, is an 18 pin device, it is similar but also has a shutdown and an enable input.

When you come to lay it out on bread board (or your own PCB), keep the wires short and place the capacitors as near to the chip as you can. Be careful to get all the capacitors round the correct way. The design uses polarised capacitors which won't work as well the wrong way round, and could even be dangerous if they decide to pop. Try and buy radial capacitors - these have both leads on the same end of the capacitor, this makes them a bit easier to plug into a bread board. You would probably have to do a lot more leg bending for axial capacitors.

The converter will provide you with two TLL to RS232 convert pairs, so you could have two RS232 ports with TX and RX, or you could have a single port with TX, RX, CTS and RTS.
If you only need a single pair of signals (TX & RX), you should tie the unused TTL input to Gnd or Vcc.

Paul

#3 Aaron Douglas

Aaron Douglas

    New Member

  • Members
  • Pip
  • 2 posts

Posted 04 March 2012 - 06:27 PM

Paul, Thanks for the detailed response. I think I have enough to at least get started now. Incidentally, can anyone recommend a place to buy the MAX3232? It's out of stock on sparkfun, and if you read the comments, it seems what they're selling isn't actually the MAX3232. Aaron

#4 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 724 posts
  • LocationBerkshire, UK

Posted 04 March 2012 - 09:59 PM

Yes I didn't pickup on that. The comments and data sheet say its another manufacturer. If you can get it, I think it will be OK. Not sure where you are, I am in the UK and quick search turned up people selling individual max3232 devices on ebay. I also spotted a ready made breakout board "Mini MAX3232 RS232 Shield" that looked OK. (Though you said earlier you did not want a ready made kit.) I don't use ebay that often for components, I prefer to buy from a shop - less risk of counterfeits or internally damaged goods Paul




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.