Friday, November 17, 2006

Controlling LED with Parallel Port!!

Hi everyone! Yesterday, I connected an LED (Light Emitting Diode) to the parallel port of my computer. Then, I wrote a program to access the parallel port and control the LED. Why did I do this? Well, I just wanted to do something real and physical with my computer. It was really fun!

In my application, I used the data ports on the parallel port for controlling the LEDs. There are eight data ports. So, when I don't send any signal do the data port, its closed ("00000000") and the eight pins have no voltage on it. But, when I send decimal "255" (binary "11111111"), all the pins have a +3.3 V (I was expecting to get +5 V, but for some reason I was getting only 3.3 V). The Windows scientific Calculator came in handy for doing the binary to decimal conversions. I sent values like, decimal "231" (binary "11100111") -- Here, all the pins except the two in the middle were OFF.

Here are two articles which helped me:
Well, this is just the beginning. Now, I'm planning to connect relays to my parallel port. This way, I'd be able to control electrical devices inside my house by using my computer!

Well, I really enjoyed making this and I'd love to hear your comments. :)

41 comments:

karthik said...

Great! I have been trying to do something like this for my project..

Hope I can take some ideas from your blog..Continue your good work..

Karthik

Ashish Derhgawen said...

Thanks Kartik,

Glad to know you found my ideas useful for your project..

Keep visiting,
Ashish :D

Anonymous said...

Interesting.

Paul said...

Wow... Thats all I can say. For years I have wanted to do something like this but I have never had the patience to do the research, this has just really inspired me to look some more into this.

G said...

Hi Ashish,

Excellent work here. I'll be coming back here for sure.

I've been looking for a program which will pulse LED's via the parallel port, but with a variable speed adjustment from the program.

I have no programming skills, so, do you have any ideas??

Go well

Ashish Derhgawen said...

You'll find an LED controlling software in my next post: http://ashishrd.blogspot.com/2006/11/morse-code-converter.html

This program makes the LED flash morse code. :)

G said...

Aha,

Cool stuff. Would it be easy for me to convert that type of program into a stroboscopic one?

G

Ashish Derhgawen said...

Yes, you could do that. You could also connect upto eight LEDs to your parallel port and make them flash in different patterns. Check out: http://www.codeproject.com/csharp/csppleds.asp

Ashish :)

Anonymous said...

Hi,
Got LED working through LPT port OK, and was going to use it to opto-isolate a relay circuit using a simple LDR circuit (Light dependent resistor) BUT I realised the LED is drawing at least 15 mA. And the LPT port supply should not exceed 2.5mA or thereabouts or you can cook the motherboard LPT chip (so I've read).
So is it safe to run LED's direct from the LPT port? I'm not an expert, I may be missing something.
Please reply to genmail1@gmx.net if you can.

Lloyd

mekanixz said...

hey there,you've done nice work!
i have a problem with the app that controls the leds.i get this message: "unhandled exception has occured...blah blah....C:\C#\LED\off.gif"
and nothing works.this happens even if the parallel isn't connected!(i don't have any programming language installed at this time and i've put the inpout.dll in the system32 folder,OS is windows XP).so..any ideas?

Ashish Derhgawen said...

Which app are you talking about? The one by Levent Saltuklaroglu?

You also try using mine: http://ashishrd.blogspot.com/2006/11/morse-code-converter.html

mekanixz said...

well the first post is about Levent's app..i just tried yours morse conv. and i get the sound output but (still) no led output..

Ashish Derhgawen said...

Its difficult to communicate by writing comments. Send me an e-mail by clicking on the "Email" link under the "Contact me" section.

Anonymous said...

hai,i'm a new boy in C#,i dont know what to do after download a program from Levent Saltuklaroglu.

i try to copy source code n paste in new project n save code as form1.cs and PortInterop.cs same as mention,but..this eror occur when try to debug..

my prjct name is test,the error is..
"visual studio can't start debug,..\test.exe is missing"

how can i solve it..may u give me step by step flow to copy n run this source code successfully..thanks u so much in advance..plz anybody..help me:D

Mr.Pro said...

oooooh great it's my ideal from about 2 weeks

OK .. IHAVE AVERY BIG PROJECT FOR THIS IDEA YOU CAN SHARE MY THIS IDEA

FOR MORE CONTACT
MR_PRO_2020@YAHOO.COM

Anonymous said...

hei...the parallel port only hav 8 pin outputs....how to makeit 15 outputs to control 15 LEDs....

Joe said...

Me and a friend made this too. You can find pictures here: http://profile.imageshack.us/user/joecatshoe/images
your blog really helped, I couldn't find any good articles about it! I wrote an app in c++ to manually control the LEDs and also let them burn randomly! It was really fun to make and to see the leds going on and off automaticaly.

regards
Joe

achref said...

please can you give me the program with visual basic to cmmand a bistepper motor(half step and full step) on my mail uf you want i am pressed by the time : abbassi-fst@hotmail.fr

Anonymous said...

Hi i am Shibly . I want to develop an application which will show numbers thats made by led like on airport or queue system. can any body have any idea.
My email is: shibly27@gmail.com
Thanks in advance.

Anonymous said...

hi sir, i have just seen your project controlling a led from a parallel port, can i ask a help on how to display binary number reprented by leds controlled from a parallel port using c++. i am janette rendaje, a a first year bachelor of science in information technology student, i am using the email cfcstian@yahoo.com, please sir your my only chance to pass in my subject.

abhijit said...

hey i m abhijit,hv u matlab code for that led o/p through parallel port.please send me that matlab code....
my id is
abhi_intel23@yahoo.co.in

Anonymous said...

hello, am is it safe without using a resistor? hehehe im a newbie in this kind of stuffs...advices would help for beginners like me...thanks!

Ashish Derhgawen said...

I've connected LEDs without resitance a few times (look at the pic!) But I would recommend using resistance.

izahw said...

hi man i need u help in such aproject in contoling leds with exe application

xtratorrent said...

hi man, great job.. really creative.. i am trying for the same thing.. but having problem with the coding in TC++, can u please help meh...
Please mail me at
krishnaneupanes@hotmail.com
with best regards:
Krishna Neupane

L. Tibor said...

Hy! I'm from Hungary! I'd like to control 8 leds with lpt port in C# 2008 express under WinXp sp3. I tried inpout32.dll and io.dll and many sample programs but they didn't worked. But i dont know where is a problem.If you know plz help me: my mail adress is tiborjan@gmail.com

Leicester said...

hey there... nice idea... but i've got an RS232 to usb cable... my professor wants me to use this instead of a typical RS232 cable(with both ends having 9-pins).. i will use one end (USB) connectd to my computer then my LEDs are connected into the other end (RS232 -9pins)... my problem is i dont know what controller address to use for USB port.. in an ordinary RS232, the controller address is set to 378 right?? can you help me with my problem??? Thanks a lot... BTW my name is Leicester from the Philippines...More powers!!!

Anonymous said...

How about using the parallel port on a printserver plugged into your LAN.

A printserver and optoisolator + relay(s)/Triac(s) could be placed anywhere in the house and simply plugged into your home ethernet network.

Anonymous said...

I see my ethernet printserver idea has already been done.

http://www.doktor-andy.de/joomla/index.php?option=com_content&task=view&id=40&Itemid=52

http://blog.rhysgoodwin.com/hardware/print-server-power-control-hack/

mavjuz said...

WndLpt free software allows automatic managing up to 12 LEDs that are directly connected to the LPT-port in strict accordance with the script commands. For example:
cycle:
100000000001
010000000010
001000000100
000100001000
goto cycle:
Also Sound Visualization mode is available.
WndLpt Homepage: http://wndlpt.sourceforge.net/

SAIRAGHAVA said...

Hi Ashish....I am unable to understand the software part of glowing an LED through parallel port..can u just explain what are the steps(software part) need to follow to glow an LED. I m waiting for your reply .....

SAIRAGHAVA said...

please ashish......

ronyyy said...

hi..i am rony...can we control LED by sending sms through parallel port..if it is possible then how..??pls anyone can help me..

somu said...

Great yaar , i am new in this line so u please give me a detail how i can start this type of working with my computer ,,can i control house lighting with my parallel port ;

thanks
somu

Rudradutt Joshi said...

hey dude
looks cool,
I am trying to lit an 8x8 board of LEDs.
Can u show me a way?

Anonymous said...

Great job man....

Saad Nayyer said...

Good Article
You can Maintain your voltage through using different ICs.

led par 38 said...

Good job !!! what a brighter brain you have I can't wait for your another great idea . Thanks for sharing this blog.

Sara said...

This is just brilliant write up!Thank you so much for the wealth of the resource! You can Download drivers for HP LaserJet p1102 here!

Anonymous said...

hey guys, help me.
i have a project in the program class , I only know bolrland c, and asked me to program a device to move (in short) when I press any button on my computer (all with language c). I have thought about a arduino but it seems very complex.
help me.

----- ------- greetings from peru

shishant dixit said...

Hello Sir,

I have some problem with parallel port and i have some question regarding this.\

So how can i contact you, can you give me your contact no. or any mail id