My toys arrived this afternoon - a MAX232N serial level-converter and an LV-EZ4 Ultrasound ranging device.
I hooked up the MAX232N chip in a breadboard. Since the Ultrasound device has no use for an incoming serial signal, I plan to use one incoming level-conversion channel for the DTR pin, and the other for the RTS pin. I am planning to use these TTL outputs which originated at my server's RS232 port to do the following:
- control a transistor which can switch on the Ultrasound device and switch it off again
- command the Ultrasound device to take a reading as needed.
Breadboarding up the MAX232N, I was able to control an LED via a transistor using +- 9 volts input. I used a Darlington which had been slated for use in an old Stepper motor project, because I didn't have any other NPN transistors.( the Breadboard setupCollapse )
The Ultrasound device speaks serial at 0-5 volts, so I'll be using the MAX232 to convert its signal to proper serial levels for transmission back to my linux box.
I looked up the DB9 serial pinouts, connected a Cisco console cable to an RJ45 breakout box, and figured out which pegs corresponded to which RS232 pin using a multimeter to check resistance.( the breakout boxCollapse )
To establish I had figured out how to use the Device::SerialPort module, I had already written a simple serial console program. This worked well enough that I could send commands to my Cisco router and view the results. I stripped down this program to simply toggle the DTR pin every 3 seconds:( strobe.plCollapse )
Using the breakout box and a voltmeter, I saw the expected +- 12 volts alternating on the DTR pin every four seconds. Yay!
This project will go on hold for several days because a short trip to South Australia is fast approaching. Hopefully I'll be able to continue late next week.