Take the 2-minute tour ×
Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It's 100% free, no registration required.

I build my own pcs, like coding (a little bit) and into engineering.

What I want to do is basically take my computer, hook it up to a circuit with a light bulb and then run a program that will switch the light bulb on and off repeatedly at a set interval e.g. 5 seconds or 1 second.

Please any answers, outline - software required, code, equipments needed and any other details. - I dont mind parts of answers - it all helps!

share|improve this question
5  
If you have an operational goal, there are USB controlled power switches available off the shelf. Otherwise you have the dual challenge of getting an output signal (from a modern legacy-free PC?), and of safely controlling mains power. Search terms: Parallel Port, USB Digital I/O, Solid State Relay... –  Chris Stratton Mar 22 '13 at 16:50
    
Thanks for that Chris, I never thought about an off the shelf solution - Could you suggest a site, or link I can buy from? –  Andrew Mar 22 '13 at 16:55
    
That would make this a shopping / buying recommendation, which is off topic per the faq. –  Camil Staps Mar 22 '13 at 18:16
    
have done a DIY tutorial on what you asking. See Here: sites.google.com/site/sandundhammika/usbserialport –  Standard Sandun Mar 23 '13 at 20:09
add comment

2 Answers

PCs are not built for such simple applications. PCs are made to communicate large amount of data.

I would suggest using a microcontroller for the low level functionality such as switching on and off the LED. And to communicate with this using RS-232, if you have an old computer, or buy a USB-to-I2C/RS-232. This is best for older MCU.

There are newer MCUs (these are from ATMEL) which use USB protocol.

SETUP:

  1. The PC will send the message to the MCU.
  2. The MCU will respond accordingly.
share|improve this answer
add comment

If your PC has a sound card you could output an audio signal that can be used to trigger a relay. You'll need a simple external circuit to detect audio (say 1kHz) and there may be enough power in the audio to even drive a relay. This could switch a bigger load such as a lamp. The audio signal could easily be designed to produce an envelope of sound that corresponds to what you want i.e. 5 seconds of 1kHz followed by 5 seconds of silence etc..

You just need to figure out how to tell your PC to dump some audio to the soundcard. Then you need a simple little audio detection circuit and a relay. You might need a power supply but i suspect there might be enough power from the sound card to do the job.

If it's a low voltage lamp then substitute FET for relay. There are plenty of trivial circuits that can detect an audio type signal and produce a volt or two of DC to drive a FET

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.