![]() |
| |||||||
| Electronics It covers a wide range of stuff , so grab your soldering iron and come on in. |
![]() |
| | LinkBack (1) | Thread Tools | Search this Thread | Display Modes |
| |
#1 (permalink)
|
| Junior Member | I have a small device that controls a relay which is normally open. Using the serial port on my computer I would like to be able to detect when the relay closes. I thought the easiest way would be to connect the Tx wire of the serial port to the relay and then via the relay back to the Rx wire. The idea was to keep writing to the port and immediately trying to read back from it. Until the relay closes the program would not be able to read what it sends thus realising the relay is still open. This kind of works but is not very efficient due to the constant looping and opening/closing of the port. Furthermore it is not possible to monitor 2 relays this way. I did check out some of the Velleman kits but they mostly operate using the parallel port which I would like to avoid if at all possible. Is there some better simple way? Perhaps even utilising the USB port? |
| | |
| | #2 (permalink) |
| Premium Member iTrader: (0) Join Date: Jan 2008 Location: Adelaide
Posts: 79
Spent time on board: 2 Days and 19:17:06
![]() | Hi doktor. Rather than use the TX/RX pins of the serial port, try using the DSR and CTS lines of the serial port on pins 6 and 8 respectively (6 and 5 on a D25 connector). These two lines are input pins on the serial port. If you've done any windows programming, it would be very easy to write a bit of code to monitor these two pins. |
| | |
| | #3 (permalink) |
| Senior Member | Couple of choices available to you depending on how much function you want to have. If you're just looking for something to be momentarly on, then pumping the serial line and having an RS232 carrier detect on the line is very simple. All you're looking for is a 6 to 24Vpp AC signal. A bypass capacitor, diode detector and low pass filter (4 components will do the job). Gav has the right idea though, there is no need to send data, just use the control lines. CTS RTS and DSR DTR. That's enough for two relays with tellbacks. If however you actually want to do it with RS232 serial then it can be done with .... (everybody knew I was going to say this) a PIC chip !! In fact the pic chip is so good at doing this job that you can have multiple devices running off the pic chip and you can even have multiple pic chips all running on RS232 like a bus. (RS232 isn't designed for bus type comms RS485 is better for that, but we can make our own rules in this case) Keep an eye on the PIC thread ... serial comms is about 2 or 3 tutorials away. |
| | |
| Sponsored Links | |
| | #4 (permalink) | ||
| Premium Member iTrader: (0) Join Date: Jan 2008 Location: Adelaide
Posts: 79
Spent time on board: 2 Days and 19:17:06
![]() | Quote:
Quote:
I have used USBmicro adaptors on a number of projects and they seem to work quite well. Have a look at Dontronics USBmicro's U421 USB Interface - Dontronics | ||
| | |
| | #6 (permalink) |
| Junior Member | Thank you everyone! Yes, the CTS/RTS and DSR/DTR lines seem like a much better option. That way the program could just wait until they are activated without the need to loop forever. I was actually thinking of perhaps using a PIC but that seemed much more involved and I just wanted something quick and simple. Basically a simple piece of hardware that I could program to send me an email when the relay momentarily closes. Just a quick question though. I think I should have mentioned that the relay is driven by a different piece of hardware and does not require power. That being the case would it be enough to simply loop the CTS/RTS wires through the relay switch? Thanks again, doktor |
| | |
| Sponsored Links | |
| | |
| | #7 (permalink) | |
| Premium Member | Quote:
If you want to do it professionally and have $85 in your wallet, want to have it foolproof and accessible from anywhere in the world...get a BF450. It has an rs232 to TCP/IP converter and four software controlled relays. You can monitor the inputs and the outputs. I have a custom application that a talented man wrote to control it that is absolutely sensational. It also has inputs. you can even get it to send you an email if one of the relays has been triggered.
__________________ On vacation.... | |
| | |
![]() |
LinkBacks (?)
LinkBack to this Thread: http://www.austech.info/electronics/12808-rs232-acting-switch-sensor.html | ||||
| Posted By | For | Type | Date | |
| Austech - Powered by vBulletin | This thread | Refback | 31-10-08 06:51 AM | |
| Thread Tools | Search this Thread |
| Display Modes | |
| |