LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 05-25-2006, 03:20 PM   #1
ElectroLinux
Member
 
Registered: Feb 2004
Posts: 74

Rep: Reputation: 15
Control Light Bulb using serial cable


My main question is how to connect two light bulbs (one green and one red) to a linux pc through serial or usb and to be able to control it using perl?
 
Old 05-25-2006, 03:49 PM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 11,853

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
What exactly are you trying to do?

What type of bulbs are we talking about? AC incandescent, DC or LED?

You should not connect any light bulbs directly to any port. You might damage the I/O device. You can connect LEDs but must use a limiting resistor.

Actually, using the parallel port would probably be the easiest solution and the simplest program. The USB is strictly a data bus and would require additional hardware. Controling specific RS-232 data lines is harder then with a parallel port.

Is this a school project?

Have you done any googling yet?

Last edited by michaelk; 05-25-2006 at 04:06 PM.
 
Old 05-25-2006, 03:53 PM   #3
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,395
Blog Entries: 2

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
Unless the light bulb is very tiny, neither the serial port or USB interface is likely to be able to source enough current to illuminate it. You may be able to accomplish that with LEDs.

I would look into the perl module Sys::PortIO, which allows you write & read arbitrary IO addresses. You could use it control the Modem Control Register of a PC UART (and thus the related serial port control signals). You will need to dig into the documentation for 8250-style UARTs to decide which lines are appropriate for your purpose. There is a fairly small and standard list of IO addresses used by serial ports on PC compatibles.

--- rod.
 
Old 05-25-2006, 04:55 PM   #4
ElectroLinux
Member
 
Registered: Feb 2004
Posts: 74

Original Poster
Rep: Reputation: 15
i've done some googling, but not much luck. I'd like to use a real regular light bulb. The bulb doesn't have to get its power from the pc, just controlled.
 
Old 05-25-2006, 05:48 PM   #5
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,395
Blog Entries: 2

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
Quote:
Originally Posted by ElectroLinux
i've done some googling, but not much luck. I'd like to use a real regular light bulb. The bulb doesn't have to get its power from the pc, just controlled.
How much hardware are you prepared to build or buy? There are a few ready-made systems that you can buy that connect to various PC ports. My preference would be a solid-state relay with zero-crossing detection that has TTL level inputs and 120VAC contacts. These could easily be controlled from a parallel port using Sys::PortIO. If you are planning to build your own, the software side will be a small part of the overall project.

--- rod.
 
Old 05-25-2006, 06:12 PM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 11,853

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Indeed purchasing a Solid State Relay would be the easiest way to go and are not expensive.
 
Old 05-25-2006, 07:50 PM   #7
ElectroLinux
Member
 
Registered: Feb 2004
Posts: 74

Original Poster
Rep: Reputation: 15
Where can I buy a "solid-state relay with zero-crossing detection that has TTL level inputs and 120VAC contact"?
 
Old 05-25-2006, 07:57 PM   #8
michaelk
Moderator
 
Registered: Aug 2002
Posts: 11,853

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Google?
http://www.sordselectric.com/Merchan...ory_Code=SSRHP
 
Old 05-25-2006, 08:21 PM   #9
ElectroLinux
Member
 
Registered: Feb 2004
Posts: 74

Original Poster
Rep: Reputation: 15
Actually, i guess i can use two leds. But how do I connect the two leds so I can control them separately using the perl module?
 
Old 05-25-2006, 08:26 PM   #10
michaelk
Moderator
 
Registered: Aug 2002
Posts: 11,853

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
A quick google:
http://www.epanorama.net/circuits/pa...owsprogramming
 
Old 05-26-2006, 09:18 AM   #11
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,395
Blog Entries: 2

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
Quote:
Originally Posted by ElectroLinux
Where can I buy a "solid-state relay with zero-crossing detection that has TTL level inputs and 120VAC contact"?
Manufacturers include Crydom, Potter & Brumfield, Opto22, Omron, Clare, International Rectifier.

Vendors include Omega, Digikey, Newark.

Make Google your friend.


I personally like the I/O-Module style packaging made popular by Opto22. Nice, easy to use, sanitary mounting systems avaliable for them, too.

--- rod.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How many forum members does it take to change a light bulb? Tinkster General 363 08-09-2014 07:27 AM
Exploding light bulb! markhod General 21 02-24-2007 07:04 AM
Serial/Console Cable nistelrooy Linux - Newbie 4 07-29-2005 12:21 AM
Serial flow control in 2.6.8 kidzmom3 Linux - General 1 12-08-2004 08:47 AM
No PC light on USB Cable Modem perrymans Linux - Hardware 2 04-16-2002 04:51 AM


All times are GMT -5. The time now is 05:12 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration