Early PCs and other computers had serial ports, sometimes as their main interfaces for peripherals. Serial ports still survive, but these days they are more likely to have a USB connection into the main computer. However, when you are working with a microcontroller, you probably don’t want a proper RS232 port with its plus and minus 12 volt signals.
You can get converters that specifically output logic-level signals but you probably can’t pick one up at the local office supply store. They might, though, have a normal USB to serial cable. [Aaron] had the same problem so he hacked into a cable to pull out the logic level signals.
On the one hand, hacks like this are a good inspiration for when you have a similar problem. On the other hand, you probably won’t wind up with the same cable as [Aaron]. He got lucky since the board inside his cable was clearly marked. Just to be sure, he shorted the transmit and receive lines to see that he did get an echo back from a terminal program.
Unsurprisingly, you can also repurpose an ESP8266 to perform this same task. Or, you can use a cable as an I/O device.
Hmmmm…
I don’t want to be “that guy”, and I totally understand Aaron’s hacker ethos, I have done things exactly like this myself, pretty much just because I could.
But… that being said, the engineer in me would be remiss if I didn’t point out that FTDI already makes a cable that does this, p/n TTL-232R-5V-WE, for 5 V logic, adn TTL-232R-3.3V-WE for 3v logic, available for $20 from the usual suspects, like Digikey and Mouser
or like $3 off ebay
Or a USB-Serial TTL breakout board on Ebay for $1.50.
But that said, when you have time constraints a hacked $10 cable can still beat 3 weeks postage from china.
$2-5 clones with a jumper to select the levels, too, from the usual source
Yep. I bought a pack of 10 of them so I can have one almost everywhere. It’s a required tool for any hacker
Or you could get an FTDI breakout from adafruit.
The documentation and libraries make it worth the extra money.
+1! (also not an Adafruit shill)
Why I buy FTDI and clone based boards by the (almost) bucket load. Get them cheap enough to build it directly in.
Have a couple of NAS boxes with DE9 “proper” RS232. On one I took apart and soldered wires to the logic level side to hook to the adapter. Now both options are available. Not that id ever use the D9
Buy ’em and build ’em in! That’s not a hack!
Seriously, though, it’s a great solution. Gives you a USB port for power as well, if you choose to go that route. And if you’ve got a serial bootloader installed, it’s a programming port. All for a few bucks. We live in good times.
Man I wasn’t looking forward to the comments :) I do mention in the article that boards are available cheaply, but then you have to wait for postage and I was impatient. I’ll keep a stock of them in for the future though!
I was going to go one step further, and criticize you for wanting to program a micro-controller.
Most anything you could want to use one for has already been done, so you could just buy the final thing you want off e-bay for 75 cents and save yourself all the trouble of making it yourself.
I sell a TTL level USB-to-serial I call “FTDI-be-gone,” because it’s based on the Cypress Semi CY7C65213, so it uses class-level drivers rather than proprietary ones.
I also put a MOSFET in to switch the target power off prior to enumeration and during USB suspend, which makes it more compliant with the USB spec. There’s also a jumper to choose between 3.3v and 5v logic and output power. Lastly, there’s a current limiting switch to protect the host from inrush.
https://hackaday.io/project/9659-ftdi-be-gone
Oh, there’s also an RS-232 variant if you prefer.
Project idea:
USB Serial cable with slot that can be broken with moderate force to remove the RS-232 part, but which leaves both resulting parts operational?
I just avoid anything with “FTDI” with it. Been doing since last year’s debacle. Why would I want to support a company that bricks other people’s hardware? If they did not want their drivers to support clones, fine… they could disable support in the drivers. But hell, they went and zero’d the device IDs making them unusable. F**K them.
HaD staff knows, they also indicated a ‘fuck them’ attitude on previous occasions..
At the risk of shit posting, why didn’t they jumper across the level converter chip so you get TTL out put on the DB9 connector?
If you leave the level converter in place it will still be driving the tx and rx lines with opposite levels (-10 to -12V for a TTL high and +10 to +12V for a TTL low) since RS232 drivers are inverters.
If you cut VCC to the converter this would work.
Last time I got a TTL level RS232-to-USB converter I did indeed not buy it at an office supply shop but at a phone accessories shop instead.
FYI: they don’t sell them at the bakery either, and most butcher shops also show low availability.
I recently did exactly that. Needed a USB->3.3v serial converter. Didn’t have a dedicated one on hand. Dug around in the ‘USB cables’ box, pulled out an old phone interface cable, hacked off the connector, opened the shell, traced a few pins, and ‘poof’ a 3.3v serial adapter.
http://www.correctivephrenology.com/blog/
BTDT.
https://hackaday.io/project/8808-hacking-an-rs232-adapter
https://hackaday.io/project/10737-add-dtr-to-cheap-pl2303
I used a cheapy on a project – it bit me. I was seeing a 100v swing on the TX line that would (mostly) settle down with a load on it. POS.
I have a couple from http://www.accesio.com/ – they are solid. No, I am only a customer. Their stuff is solid. The cheapy ones can easily start dropping bits even at 9600. I have used mine to 19.2 with zero problems.
There are times to go cheap. There are times to get pro tools..
Nice hack, BTW. I will use it in an emergency.
I avoid using Prolific chips, they show problems working with the serial bootloaders of my favourite ARM Cortex controllers. I guess there are some timing issues either with the chip itself or the drivers for Prolific converters, but i’ve had to test about 20 different adapters for our company a few years ago, and every single adapter with Prolific inside showed problems when trying to download firmware from the PC into the controller. All FTDI based adapters just worked. Unfortunately i did not get the time to do a deeper analysis on why the Prolific chips fail at that task.