MAX3232 Dual UART To RS232 Interface
Table of Contents
I use RS-232 extensively for communications between my microcontroller project and Raspberry Pi-type machines and have had success in the past using these little MAX3232 modules that are available cheaply on Ebay.
By attaching 90 pin headers and making Kicad footprints, I was able easily use them on my homemade PCBs,
such as this 3-port board that I used on RPi-type computers.
I have standardised on the use of 3.5mm stereo plugs and sockets for connecting RS232. Cheap and easy stereo audio carry the TX, RX and GND lines.
Over a period of months, I start to find that some of the modules were starting to fail, exhibiting flakey operation: working on TX only or just outright not working.
"Oh, well," I said, "I had better replace the faulty ones" and so ordered an Ebay batch of 10, waited 6 to 10 weeks for delivery and then only to find that not even one of them worked. A few of them worked for a little while but ran almost too hot to touch and then became flakey and then just went ahead and failed. Reject rubbish obviously. "Hmm, no more Ebay junk for me", I mused. It's a pity because for quite a few years there I used to have good success using the various cheap Ebay electronics modules.
Anyway, I went ahead and ordered a batch of MAX3232 chips from a reputable supplier and resigned myself to having to make my own boards, which probably isn't a bad thing really.
Above shows how I used to mount the modules, on this board I managed to hot-air desolder and resolder a good chip.
I was always getting confused with which end was TX and which was RX and cross-over cables and could never get it right without much effort. The problem has been overcome with the use of 3-pin jumper header which allow TX and RX to be variously connected to either the tip or the ring of the 3.5mm stereo plug.
Circuit
The MAX3232 chip contains two RS232 transceivers and the modules only use one of these, leaving the other unused. I decided that I could make do with only two RS232 ports on the new board instead of the three on the old one and hence was able to use only one chip.
- A 3.3V regulator is included as the board will be mostly used when a 5V supply is available but with 3.3V logic. To use with 5V logic, the regulator could be bypassed by shorting pins 2 and 3. I probably should have included a jumper to make doing that easier.
PCB
After two failed attempts at making a homemade prototype PCB, I figured that I'd just order 10 from jlcpcb.com, which I should probably have just done in the first place. If I do another batch then I'll move the semiconductors to the front side and make the capacitors surface mount too.
Drilling Template
Here's the front panel of a Banana Pi machine that's currently being built.
To get the holes in the front panel to line up with the jacks on the PCB, I made a drilling template:
then printed it out and used that to drill a small piece of PCB material,
PCB Artwork
Should anyone wish to make their own boards then here is the artwork in SVG format.
Conclusion
Here's a board being used in my RPi to MCU development setup, here being used for software development on a ATMEGA module.
All in all, a worthwhile little project that will serve me well. With the amount of junk that seems to be peddled on Ebay these days, the old adage: "if you want it done properly then do it yourself" is becoming truer that ever, and there's the added advantage of being able to make things work exactly as you want them to.