-1
\$\begingroup\$

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!

\$\endgroup\$
  • 5
    \$\begingroup\$ 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... \$\endgroup\$ – Chris Stratton Mar 22 '13 at 16:50
  • \$\begingroup\$ Thanks for that Chris, I never thought about an off the shelf solution - Could you suggest a site, or link I can buy from? \$\endgroup\$ – Andrew Mar 22 '13 at 16:55
  • \$\begingroup\$ That would make this a shopping / buying recommendation, which is off topic per the faq. \$\endgroup\$ – user17592 Mar 22 '13 at 18:16
  • \$\begingroup\$ have done a DIY tutorial on what you asking. See Here: sites.google.com/site/sandundhammika/usbserialport \$\endgroup\$ – Standard Sandun Mar 23 '13 at 20:09
  • 1
    \$\begingroup\$ Smart bulbs can be controlled from the Internet, so if your computer can access the Internet, that's a possibility... \$\endgroup\$ – Dampmaskin Aug 19 '19 at 12:43
1
\$\begingroup\$

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.
\$\endgroup\$
0
\$\begingroup\$

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

\$\endgroup\$

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