Continue to Site

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.

  • 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:
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.

https://www.windmill.co.uk/wiring.html
 
Last edited:
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???
 
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:
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
 
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.?
 
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...
 
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

  • esp04 May. 09.gif
    esp04 May. 09.gif
    2.4 KB · Views: 219
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??
 
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.
 
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???
 
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

  • esp05 May. 09.gif
    esp05 May. 09.gif
    3.9 KB · Views: 209
Last edited:
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???
 
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:
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

  • ZD0280%20-%20OSW46L5111P.pdf
    267 KB · Views: 142
Look at my EDIT.:)

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
 

Attachments

  • ZD0280%20-%20OSW46L5111P.pdf
    267 KB · Views: 119
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

  • esp05 May. 09.gif
    esp05 May. 09.gif
    4.9 KB · Views: 195
Last edited:
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

New Articles From Microcontroller Tips

Back
Top