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.
hi,
I thought you were driving the LED via the PC's serial DTR port.??

Are you asking for the PC led drive program.?

Hi there....

i dnt think i have confused you this time....

whenever, my LDR gives the output, it will be changing according to the brightness....accordingly, the comparison output will change..right??? this changing voltage should be sent to LED everytime using serial port. So for sending this changing voltage i need to write a code...so thats what i am saying...hope u r getting me???

Payal
 
Hi there....

i dnt think i have confused you this time....

whenever, my LDR gives the output, it will be changing according to the brightness....accordingly, the comparison output will change..right??? this changing voltage should be sent to LED everytime using serial port. So for sending this changing voltage i need to write a code...so thats what i am saying...hope u r getting me???

Payal

Also, for doing this operation you gave me that circuit....right?
 
hi there,
sorry but m using C in linux with gcc complier....n now its end of my project so cnt switch to smethng new again....

hi,
I did a simple VB5 program yesterday that drives the DTR line, its very basic but it would have given you a starting point.:)

Let me know how your project goes.
 
hi,
I did a simple VB5 program yesterday that drives the DTR line, its very basic but it would have given you a starting point.:)

Let me know how your project goes.

if you dnt mind can i have a look at it???
also i got this code from the web which can help me somethng do you wanna see if its the write thing...in this i will be connecting TxD to my LED circuit..and controlling RTS....

pbenito - Re: Serial programming - Writing bytes in a blocking mode - Problem wit
 
if you dnt mind can i have a look at it???
also i got this code from the web which can help me somethng do you wanna see if its the write thing...in this i will be connecting TxD to my LED circuit..and controlling RTS....

pbenito - Re: Serial programming - Writing bytes in a blocking mode - Problem wit

hi,
Ive extracted the subs and posted as a text file.

The program opens the Comms port [ you choose which port number]
The DTR line is set high/low using MSCOMM1.DTRE = true or false

The Timer.Intervals are loaded with a value proportional to the mark/space ratio of the 'PWM' drive to the DTR line.

You can still use the MSCOMM1 TXD/RXD as normal for serial data I/O.

OK.?:)
 

Attachments

  • DTR1.txt
    948 bytes · Views: 113
hi,
Ive extracted the subs and posted as a text file.

The program opens the Comms port [ you choose which port number]
The DTR line is set high/low using MSCOMM1.DTRE = true or false

The Timer.Intervals are loaded with a value proportional to the mark/space ratio of the 'PWM' drive to the DTR line.

You can still use the MSCOMM1 TXD/RXD as normal for serial data I/O.

OK.?:)



OK i will refer your code and try to get soem help from it...Also, did u have a look at the link?? haahaa just curious to know

but thankyou for helping me so much....Mr. Virtual Computer!!!! :p
 
OK i will refer your code and try to get soem help from it...Also, did u have a look at the link?? haahaa just curious to know

but thankyou for helping me so much....Mr. Virtual Computer!!!! :p

hi,
Read your link, it deals with DTR and RTS for remote UART sensing.

Whats the format of the serial data that you are sending to the remote PC.?

Note: if the remote PC's program expects the DTR and other control signals for its serial port, its possible to link pins on the DB9 which will supply the the required signals.

This maybe required as you are using the control signals for LED's.
 
hi,
Read your link, it deals with DTR and RTS for remote UART sensing.

Whats the format of the serial data that you are sending to the remote PC.?

Note: if the remote PC's program expects the DTR and other control signals for its serial port, its possible to link pins on the DB9 which will supply the the required signals.

This maybe required as you are using the control signals for LED's.

************************************
i am not sure if i am answering the right thing to you....

MY PC is sending the voltage to the LEDs using Serial port so it will be in digital format....i.e. integer right?? and i thnk this code only uses RTS pin....

What if in place of char Hello world i just send the voltage value to the port...u think it will work??? and then i can put it into a loop to keep doing it...???
 
************************************
i am not sure if i am answering the right thing to you....

MY PC is sending the voltage to the LEDs using Serial port so it will be in digital format....i.e. integer right?? and i thnk this code only uses RTS pin....

What if in place of char Hello world i just send the voltage value to the port...u think it will work??? and then i can put it into a loop to keep doing it...???

Not really.!
You are sending pulses to the DTR line which drives the LED drive transistor.
Not data.
The pulses are in a PWM format, pulse width modulation.
example: set DTR high, led is lit, set DTR low, led is off.

If you send an On and Off pulse at a fast rate and the On and Off periods are of the same duration, the led will appear at roughly half brightness.

If you make the On period say 75% and the Off period 25% then the led will appear at roughly 75% brightness.

As you know the required brightness of the LED after calculating from the LDR input from the PC paraport, you can pulse the DTR at the required mark/space ratio.
 
Not really.!
You are sending pulses to the DTR line which drives the LED drive transistor.
Not data.
The pulses are in a PWM format, pulse width modulation.
example: set DTR high, led is lit, set DTR low, led is off.

If you send an On and Off pulse at a fast rate and the On and Off periods are of the same duration, the led will appear at roughly half brightness.

If you make the On period say 75% and the Off period 25% then the led will appear at roughly 75% brightness.

As you know the required brightness of the LED after calculating from the LDR input from the PC paraport, you can pulse the DTR at the required mark/space ratio.


you know what...this logic i am trying to explain my supervisor since morning...but he is not understanding...he says send dat...but how can i send data with using DAC or something.....He wants PWM controlled circuit with data...:( ,....
but yes what you are saying is write...the ratio i can decide by my output...the problem is m trying all this but not getting through :confused:

but yes have to do it so will keep trying for another week....as it is due next week.
 
you know what...this logic i am trying to explain my supervisor since morning...but he is not understanding...he says send dat...but how can i send data with using DAC or something.....He wants PWM controlled circuit with data...:( ,....
but yes what you are saying is write...the ratio i can decide by my output...the problem is m trying all this but not getting through :confused:

but yes have to do it so will keep trying for another week....as it is due next week.

hi,
Dont panic.
What help do you want from me.

Do you have a full drawing showing the components.?
 
hi,
Dont panic.
What help do you want from me.

Do you have a full drawing showing the components.?


ldr1 is my input circuit and the other circuit is the one you have given me...he says, replace the DTR pin with Txd and set the RTS pin low or high and make it working...

my input is ready, getting all the voltages properly and storing them in a variable. now point is the output...

he expects to set the RTS pin high and low using the code and while doing this write the data on serial port.....but whats the use of writing like should i write the voltage value on the TxD line will will be given to the driver circuit??? but i dnt thnk this works...

what are ur views on this???
 

Attachments

  • ldr1.jpg
    ldr1.jpg
    33.2 KB · Views: 124
  • esp05 May. 09(2).gif
    esp05 May. 09(2).gif
    4.9 KB · Views: 116
ldr1 is my input circuit and the other circuit is the one you have given me...he says, replace the DTR pin with Txd and set the RTS pin low or high and make it working...

my input is ready, getting all the voltages properly and storing them in a variable. now point is the output...

he expects to set the RTS pin high and low using the code and while doing this write the data on serial port.....but whats the use of writing like should i write the voltage value on the TxD line will will be given to the driver circuit??? but i dnt thnk this works...

what are ur views on this???

hi,
Has the teacher seen the LED drive circuit.?

You can use either the DTR or RTS signal to drive the transistor.

If you send a 'voltage' value on the TXD line it will be in RS232 format and will not be suitable for controlling the brightness of the LED.
It will only be useful if you have a remote PC or UART that can receive the RS232 data.

I think there is a misunderstanding between you and the teacher of what is required.

Ask him why does he want you to switch the RTS line and whats the purpose of putting the LDR voltage on the TXD line.???
 
Last edited:
hi,
Has the teacher seen the LED drive circuit.?

You can use either the DTR or RTS signal to drive the transistor.

If you send a 'voltage' value on the TXD line it will be in RS232 format and will not be suitable for controlling the brightness of the LED.
It will only be useful if you have a remote PC or UART that can receive the RS232 data.

I think there is a misunderstanding between you and the teacher of what is required.

Ask him why does he want you to switch the RTS line and whats the purpose of putting the LDR voltage on the TXD line.???


Hi there,

i tried to toggle the DTR line finaaly using a code....but if i connect just a LED and resisitor it is working but it is not able to drive the circuit that you suggested me
 
Hi there,

i tried to toggle the DTR line finaaly using a code....but if i connect just a LED and resisitor it is working but it is not able to drive the circuit that you suggested me

hey one more question..

does DTR go to level high automaticaaly???

like when i set the DTR pin i get voltage -11V and when i clear it i get +10.6V. And once, the code stops, the output at DTR is again -11V. So is everything going ok according to your kowledge?

Cheers
:)
 
hey one more question..

does DTR go to level high automaticaaly???

like when i set the DTR pin i get voltage -11V and when i clear it i get +10.6V. And once, the code stops, the output at DTR is again -11V. So is everything going ok according to your kowledge?

Cheers
:)

hi,
The voltage levels look OK.


I will make up that transistor/led circuit and prove for you that it works.
Will post result within 24 hr. OK

EDIT:
Tried the circuit, works OK, also it has been used often in the past.
You must be doing something wrong at your end.

Post a circuit showing how its connected to the serial output and the +5V..
 
Last edited:
hi,
The voltage levels look OK.


I will make up that transistor/led circuit and prove for you that it works.
Will post result within 24 hr. OK

EDIT:
Tried the circuit, works OK, also it has been used often in the past.
You must be doing something wrong at your end.

Post a circuit showing how its connected to the serial output and the +5V..

Hi,

well, i did test the circuit the way you posted to me...but if u are still saying then i will check it again and get back to you later.

is that ok?
 
Hi,

well, i did test the circuit the way you posted to me...but if u are still saying then i will check it again and get back to you later.

is that ok?

Thats OK, but a simple sketch would also be helpful.:)
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top