0
\$\begingroup\$

I am a bit new to electronics, but I am a programmer. The thing is that I want to control one or two lights using my code on my computer

Arduino and similar devices are not an option in the meanwhile. I don't either have an RS232 port.

Note that I can extract IC and stuff from things like JoySticks or whatever if needed.

Some things I know/learned:

  • Turning on/off a light is basically [not] passing positive voltage to the LED, where the LED is always connected to an appropriate ground
  • Turning on/off a light is a logical operation, so if we are using an analog jack (or whatever), we need to convert it to a logical output, since we need the light either on or off, not something in between
  • Using ports like USB requires a microcontroller chip

Note that I don't mind doing hacky stuff, I'm doing that being a hobbyist, not for production

\$\endgroup\$
  • \$\begingroup\$ Please define 'light' a bit more. Just an LED as an indicator or something else? How many? \$\endgroup\$ – KarlKarlsom Jul 2 '16 at 2:50
  • \$\begingroup\$ What connectors you have on your PC available? \$\endgroup\$ – KarlKarlsom Jul 2 '16 at 2:52
  • \$\begingroup\$ @KarlKarlsom It's an ordinary LED lamp \$\endgroup\$ – OverCoder Jul 2 '16 at 2:55
  • \$\begingroup\$ @KarlKarlsom I have RJ-11, RJ-45, USB, Line in, out, and mic audio jacks. It's a laptop \$\endgroup\$ – OverCoder Jul 2 '16 at 2:56
  • \$\begingroup\$ Why are microcontrollers not an option? \$\endgroup\$ – Tom Carpenter Jul 2 '16 at 3:06
1
\$\begingroup\$

In general, you can do it, but you will always require some extra hardware. I'm going to assume that when you talk about lighting "an LED" you do not mean a mains-operated LED lightbulb, but rather a small LED which you can buy separately.

In this case, what you should do is go on eBay and search for "USB relay". Get the cheapest you can find and you will be able to drive it from your PC's USB port. You'll need to connect the relay contacts to the LED, a current-limiting resistor, and some sort of voltage source (which can be a 9 volt battery if you don't mind the limited battery life).

If you are trying to light an LED lightbulb, you'll need to do two things. Second, you'll need a relay board which is rated for 120 or 220 volts, depending on where you live. First, though, you need to STOP WHAT YOU ARE DOING AND FIND SOMEBODY WHO IS AN ELECTRICIAN SO YOU DON'T KILL YOURSELF. And I mean that sincerely.

\$\endgroup\$
  • \$\begingroup\$ It's just an ordinary single LED lamp, not a 220v bulb. And hmmm, if that's the only option then I'd have to buy that device, though I'll see if one can have hardware-free solutions before accepting this answer \$\endgroup\$ – OverCoder Jul 2 '16 at 3:03
  • \$\begingroup\$ @OverCoder - Well, if you've got a really old PC with a parallel port (which I doubt, since you don't have a serial port) you can directly drive an LED/current resistor via one of the data lines. Probably not a help to you, though. \$\endgroup\$ – WhatRoughBeast Jul 2 '16 at 3:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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