Go Down

Topic: Led sensor (Read 367 times) previous topic - next topic

eaj

I have an application that I want to read an IR sensor connected to A0. I would also like to power an IR LED from PIN 13. The problems are:
For the PIN 13 I don't want the full 5v output. Is there a way with programming to give a 2.2v level?
For A0 I want to be able to adjust the threshold to control PIN 3 to go high when the threshold is met.

Any examples of code that may help?

Thanks!

AWOL

Quote
For the PIN 13 I don't want the full 5v output. Is there a way with programming to give a 2.2v level?

No, but you could use a simple voltage divider, but it sounds more like you just need a simple current-limiter. Can you explain why you think you need a 2.2V level?

Quote
For A0 I want to be able to adjust the threshold to control PIN 3 to go high when the threshold is met.

Code: [Select]
digitalWrite (3, analogRead(A0) >= myThreshold);
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

eaj

For the PIN 13 I don't want the full 5v output. Is there a way with programming to give a 2.2v level?
No, but you could use a simple voltage divider, but it sounds more like you just need a simple current-limiter. Can you explain why you think you need a 2.2V level?

The IR LED is 2.2V. But you suggest I do this in hardware?

digitalWrite (3, analogRead(A0) >= myThreshold);

Thanks! I'll try this!! :)

AWOL

Quote
The IR LED is 2.2V. But you suggest I do this in hardware?

The usual way, with a current-limiting resistor.
Assume 20mA, so
5 - 2.2 / 0.02 = 140 ohm
Go for a 150 ohm, or to be really safe, a 220ohm.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy