Using my PC to Light up a light bulb.

P

Thread Starter

Paul

Gidday,

I had an Idea the other day. I want to use the serial port (COM1) on my computer to control the electricity going into a light bulb. I bought a 12v bulb (I read thats about what a serial port produces) and want to connect it to pins 3 (send) and 2 (recieve) on COM1. I wrote a program in Borlands C++Builder to send a character through the port, but I'm not sure if this will work.

Does the higher the character (eg: Z) mean more electricity going through (Because there's more positive bits) or will there always be the same elevtricity running through just because the port is opened?

Any input would be most appreciated.
 
I doubt that a serial port with output enough
power (I x E) to operate a light bulb. Try an LED in series with a 500-ohm resistor, that'll work.
Remember, that LED's are polarity sensitive -
they'll light one way, but not the reverse.

Re: Horowitz anf Hill's THE ART OF ELECTRONICS.
 
First of all I wouldn't recommend plugging anything directly into the serial port other than a serial device! You may well damage the PC.

My advice to you would be to buy a budget I/O card, something like this for example:

http://www.superlogics.com/specpage.asp?Items=5342

Most cards come with drivers and sample code (VB and C usually). You can then pull the sample code apart and / or modify it to your specification. This will give you a greater understanding.

To drive your light bulb you will need a small amount of electronics in addition to the I/O card. I'd suggest using eight digital output lines to drive a "resistor ladder" giving you 256 voltage levels.

Have a search around the net - you will no doubt find similar circuits.

Good Luck
 
L

Lewis Bodden

I laughed so hard I fell on the floor. I know that I should be more considerate, but having work with serial communications for so many years and to hear a request like this. If this is not a joke then, my apology. I don't wish to discourage you. When you learn more, you will see the humor.

The serial port usually conforms to the RS-232 Standard. The voltage levels are Plus and Minus 5 to 12 Volts and the power levels are very low. At best they will light an LED. The level does not vary. It is on and off, like Morris Code.

Pin 2 is for receive data and would not work as a reference for a signal. Pin 2 would be connected to the other devices transmit data. You would need to use pin 7 on a DB-25 or Pin 5 on a DB-9 connector (Signal Ground).

Pin 3 is for transmitting data. The signal is normally at minus 12 Volt so the light would be on. When a character is transmitted, the signal switches to plus 12 Volts and back to send the bits in a serial stream. It then returns to minus 12 Volts. If you used a diode to block one side, it would not work like you asked. Even at the lowest Baud Rate, the character code would flash on and off so fast that it would look like a blink.

You could use Pin 4 the Request To Send signal (or may be the DTR). Your program would have to control this signal. You would also need a diode and a low power relay to isolate your light circuit.


Also See the Post http://www.control.com/1026147308/index_html

You might want to check the X10 devices also.
 
Solder an LED in series with a 1 k-ohm resistor
and test between the two terminals you THINK would
be on. (The LED is polarized. If you placed it the
"wrong way" between the two terminals, it won't light, either.)
The serial port can't output enough current to
light any ordinary light bulb. You'd have to do that though a relay or opto-isolator.
 
T

Timo Tuokkola

Since the data from a PC serial port is transmitted using the RS232 hardware protocol, this means that '1's are sent as (approximately) -12 Volts and '0's are sent as (approximately) +12 Volts. Since a light bulb does not usually care what the polarity of the voltage is, it shouldn't matter what character is sent, the lightbulb should be lit for any bit that is sent. (Note: I don't remember the idle state of the RS232 transmit line. It is entirely possible that the bulb will be lit at all times, although this depends on your circuitry.)
 
M

Matt Warshawsky

I'm afraid your on the wrong track. First, the serial port does not have enough current to drive even an LED. Second, and more importantly, the serial port is digital, not analog as you described. This means it outputs 1's and 0's and toggles between them very quickly (as determined by the baud rate). So, if you output a Z, you'll end up with about the line at 5V for half the time, and 0V for the other half of the time (approximately). You can't get the thing to be a constant 5V because of the start and stop bits, but you can get it close by outputing 255 continously.

Anyhow you may want to look at the LabJack (http://www.labjack.com). Its a $99 USB based data acquisition device. It has 20 digital outputs (and 8 A to D, 2 D to A and a counter) and has been designed as such to protect against shorts and the like (as opposed to the serial port which was NOT designed for what you are trying to do). You'll still need to use a relay (which they sell as well) to provide enough current (and the 12V) though to drive a lamp.

The unit is actually very useful as a low cost alarming device. You can use wire it (with a relay again) to a horn or light to indicate different states of your system, and the cost is significantly less than a PLC. It also provides an inexpensive way to take readings from your devices on top of a PLC. Even if your PLC has a communications protocal (as most do) you typically have to spend $500 or more for a driver for it.

Best of luck and feel free to email me if you have further questions about how to wire up your application.

Matt Warshawsky
AzeoTech, Inc.
[email protected]
www.azeotech.com
 
A

Andrew Rokicki

Make sure your light bulb is at least 100W to allow for maximum allowable smoke to come out of your serial port or any other PC components. How about using some Chinese characters for max current ;)

OK seriously. Using serial port is not a good idea. Parallel port with opto isolation is a better choice.

It is a good practice to isolate your control components from PC.
 
Paul,

regarding the serial port:

use LED’s - not light bulbs

the transmit pin will only cause the LED to flicker when you send characters

but you can turn the DTR pin and the RTS pin on or off independently

if you’re willing to leave either the DTR or the RTS pin on constantly, then you can use it as a voltage source - to drive two independent input signals - one on the CTS pin - the other on the DSR pin

regarding the parallel port:

again, use LED’s - not light bulbs

you can have eight independent output pins

you can also have four independent input pins - and you won’t have to dedicate an output pin for a voltage source - just switch the input to the ground pin for a “logic low” on signal

I have two little QBASIC programs which will drive these ports for you - you can email me at [email protected] if you want them - I wrote them about five years ago just for fun - if you email me, be SURE to use a meaningful subject line - I usually just delete anything that I’m not expecting -

finally, I suppose that you could use these ideas to drive the inputs of some optical isolators instead of LED’s and thereby control just about anything you wanted to -

sorry if this text gets “freaky” - I don’t often post on this forum -

best regards, Ron
 
C
I doubt that you will achieve happiness in this fashion and would suggest an LED with several kohms of series resistance to perform experiments of this nature and still have a serial port.

Regards

cww
 
J

Jeremy Pollard

<clip>
>The serial port usually conforms to the RS-232 Standard. The voltage levels are Plus and Minus 5 to 12 Volts and the power levels are very low. At best they will light an LED. The level does not vary. It is on and off, like Morris Code.<
<clip>

Not to detract but its Morse code:)

Cheers from: Jeremy Pollard, CET The Crazy Canuckian!
Integration and Automation Training, Consulting, and Software

Control Design Column
http://www.linkpath.com/index2gisufrm.php3?tempCode=CON&onlineIssue=true&mem
_sess=d8734688500ceb501ce5610f4a530004&speed=high

On The Web - http://www.tsuonline.com

PLCopen North America - [email protected]
http://www.PLCopen.org
 
Top