• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Light Sensor Project

Status
Not open for further replies.

loveek9

New Member
Hi

I am building a light sensor project which i have designed. I am measuring ambient light using LDR and passing it to my computer using Parallel port. then i am defining some preset voltages in the CPU, which i will compare with the LDR output. The difference of this is what i want to give to the LED Lamp through serial port. But i am not getting the right way to do it.

Can anyone give me the idea to of how to connect the serial port to the LED lamp???

I am doing C programming in linux for this project.

Help as soon as possible will be appreciated!!!

Thanks,
Loveek9
 
Last edited by a moderator:

ericgibbs

Well-Known Member
Most Helpful Member
Hi

I am building a light sensor project which i have designed. I am measuring ambient light using LDR and passing it to my computer using Parallel port. then i am defining some preset voltages in the CPU, which i will compare with the LDR output. The difference of this is what i want to give to the LED Lamp through serial port. But i am not getting the right way to do it.

Can anyone give me the idea to of how to connect the serial port to the LED lamp???

I am doing C programming in linux for this project.

Help as soon as possible will be appreciated!!!

Thanks,
Loveek9
hi,:)

You can read/write to the 4 RS232 control pins on the serial port.

This means a MAX232 [ or equiv] for level shifting.

http://www.windmill.co.uk/wiring.html
 
Last edited:

loveek9

New Member
Thanks for your rsuch a quick response.

But do you mean using the TxD,RxD,RTS and RTR pins??

And then how do i connect this to the LED Lamp???
 

ericgibbs

Well-Known Member
Most Helpful Member
Thanks for your rsuch a quick response.

But do you mean using the TxD,RxD,RTS and RTR pins??

And then how do i connect this to the LED Lamp???
hi,
Not the TXD and RXD pins, you cannot set them high/low.

But the two outputs DTR/RTS you can set/high low with your program.

The output from the PC is +/-12Vish, so you could use a transistor to step down to 0 and +5V.

Is this what you mean.?
 
Last edited:

loveek9

New Member
hi,
Not the TXD and RXD pins, you cannot set them high/low.

But the two outputs DTR/RTS you can set/high low with your program.

The output from the PC is +/-12Vish, so you could use a transistor to step down to 0 and +5V.

Is this what you mean.?
HI again,

What you are saying is absolutely correct, but when i am pre-defining some voltages in my code, it will keep comparing it with the LDR everytime. So don't you think that step it down everytime will be difficult. It should automatically lit the LED lamp with the difference voltage.

I hope you are ableto understand what i mean???

thanks
 

ericgibbs

Well-Known Member
Most Helpful Member
HI again,

What you are saying is absolutely correct, but when i am pre-defining some voltages in my code, it will keep comparing it with the LDR everytime. So don't you think that step it down everytime will be difficult. It should automatically lit the LED lamp with the difference voltage.

I hope you are ableto understand what i mean???

thanks
Are you saying you want an analogue signal via the serial port.?
 

loveek9

New Member
Are you saying you want an analogue signal via the serial port.?
Hmmm...

i know serial port won't give a analog signal output. It just that i am confused if your method will set the lamp at the desired voltage. ??

Sorry for confusing you even...
 

ericgibbs

Well-Known Member
Most Helpful Member
Hmmm...

i know serial port won't give a analog signal output. It just that i am confused if your method will set the lamp at the desired voltage. ??

Sorry for confusing you even...
hi,
No problem.

Look at this image:
 

Attachments

loveek9

New Member
hi,
No problem.

Look at this image:
This circuit looks quite simple to implement and a bit hard to believe that it is that easy to generate output of my circuit! I will try to implment this thing and get back to you of the outcome.

Also, the value of the resistor. should i choose a small value for it??
 

ericgibbs

Well-Known Member
Most Helpful Member
This circuit looks quite simple to implement and a bit hard to believe that it is that easy to generate output of my circuit! I will try to implment this thing and get back to you of the outcome.

Also, the value of the resistor. should i choose a small value for it??
To calculate the resistor I would need to know the LED voltage and current rating, also the actual voltage levels on YOUR RS232, they do vary.
 

loveek9

New Member
To calculate the resistor I would need to know the LED voltage and current rating, also the actual voltage levels on YOUR RS232, they do vary.
I can give you these values only on monday, that is because my project supervisor has ordered the RS 232 and LED thing yesterday and which will be in by monday.

So can i get back to you then???
 

ericgibbs

Well-Known Member
Most Helpful Member
I can give you these values only on monday, that is because my project supervisor has ordered the RS 232 and LED thing yesterday and which will be in by monday.

So can i get back to you then???
OK,
The current drawn from the RS232 pins should not be greater than 12mA.

If you require a brighter LED, we will have to add a transistor and 3 resistors.

EDIT: something like this.
 

Attachments

Last edited:

loveek9

New Member
OK,
The current drawn from the RS232 pins should not be greater than 12mA.

If you require a brighter LED, we will have to add a transistor and 3 resistors.
I think he has ordered a white LED for the testing purpose so i think we will need a transisitor and resistors

what do you recon???
 

ericgibbs

Well-Known Member
Most Helpful Member
Hahaa...that was quick!!!:)

You are a real Engineer!!!! I will try this out and tell you the outcome :)
How can you be sure of that, you maybe interacting with a 'virtual engineering' program.:p

I might be just a few lines of code.!
 
Last edited:

loveek9

New Member
Hahaa...that was quick!!!:)

You are a real Engineer!!!! I will try this out and tell you the outcome :)

Hi Again,

I checked with my supervisor, and the serial port that i am using is D9 connector and the white LED i am using is attached here.

So what values will you suggest for the coponents in the circuit you gave me???

thanks
 

Attachments

ericgibbs

Well-Known Member
Most Helpful Member
Hi there!!!

I have confirmed the details of the port and LED. The port that i ma using is normal D9 serial port and the details of LED are attached below.

Can you please help me design the circuit ????

My proff suggests to use large values of resistors for this ciruit, what do you say?

thanks
hi,
Look at this circuit.
NOTE: the 39R is based on a +5Vs supply to the LED via the resistor.

For any higher value of Vs, then R= [Vs-3.3]/0.04
 

Attachments

Last edited:

loveek9

New Member
hi,
Look at this circuit.
NOTE: the 39R is based on a +5Vs supply to the LED via the resistor.

For any higher value of Vs, then R= [Vs-3.3]/0.04

Hi virtual engineering program!!

i am confused with the other serial port connections of D9 ....how do i connect them.....???

please help me.....
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top