Link to home
Start Free TrialLog in
Avatar of wcoka
wcoka

asked on

How to turn on/off a light bulb from my PC using VB

What do I need and how can I turn on/off a light bulb from my PC using VB programming?
Avatar of andreba
andreba

- A microcontroller with a program to execute your required action
- A connection to your machine (usually through COM port)
- A VB application that sends the message to be interpreted by your microcontroller, which consequently will switch on your light..

:-)
Avatar of wcoka

ASKER

Where can I find this microcontroller and how should I do the connection to my machine? Also where can I find an example the message that my application should send to the microcontroller?
Sorry, we can't do homework here..
Do a bit more research on your subject..

:-)
wcoka: For interfacing a PC with external electrical device, you need to have idea about interfacing methods and electrical device. So you need to learn many things before attempting the project.
The general idea of interfacing is activating a relay which in turn activates any electrical device.
To control the relay you need some interfacing circuit attached to your computer port. The easiest way is using your LPT port, link I posted previously. You can also use Communication port. http://www.rentron.com/PC-Remote1.htm Now,  you need to control the interfacing circuit using the port with your program.

You can ask any doubt in the process of doing the project, but dont keep any thread for multiple questions, Higher points will increase the response.
You dont really need a microcontroller - You can do this from the parallel port - provided you connect a large enough triac (to dim) and relay to controll the bulb.

I just answered a question here: https://www.experts-exchange.com/questions/21366989/Visual-Basic-MSCOMM-CONTROL-Turn-on-a-light-LED.html on controlling a LED with the parallel port.

Perhaps that can help you.
I think the easiest way would be to get The Clapper® and attach your light bulb to it.  Then, record a WAV file of yourself clapping twice.  To activate the light, play the sound through your VB code, adjusting the volume of speakers as needed.

See:
How To Play a Waveform (.WAV) Sound File in Visual Basic
http://support.microsoft.com/kb/q86281/

On a more serious note - you could use the X10 (home automation) modules to control just about anything from your computer.

See:
Two-Way X-10 Power Line Interface
http://www.radioshack.com/product.asp?catalog%5Fname=CTLG&category%5Fname=CTLG%5F002%5F001%5F001%5F000&product%5Fid=980%2D0197
Avatar of wcoka

ASKER

I'm reading this tutorial http://www.aaroncake.net/electronics/vblpt.htm but when I try to run any of the examples from here I get a VB error and I closes... do you think that it cold be because I´m runnig winXp and that dll(WIN95IO.DLL)?
Avatar of wcoka

ASKER

I download a Port Parallel Monitor at http://www.geekhideout.com/parmon.shtml and in one of my machines that has XP it works fine but at another I get an error message of "Privileged Instruction" any ideas why?
Avatar of wcoka

ASKER

Any help?
ASKER CERTIFIED SOLUTION
Avatar of modulo
modulo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial