Author Topic: Double functionality on Micro  (Read 1598 times)

0 Members and 1 Guest are viewing this topic.

Offline SkylimitTopic starter

  • Newbie
  • !
  • Posts: 9
  • Country: au
Double functionality on Micro
« on: January 06, 2020, 07:11:29 am »
I have a issue where due to lack of i/o lines i need to double up on one i/o line. As an A/D to read light sensor and output to drive the LED.
The light sensor output should go from 0 to 2.7V. However, it is being clamped to around 2V (forward volt drop of LED) i think it may be due to the 220R and leakage current of the LED.

My possible solution was to use an Zener instead of the 220R or a diode instead of the 220R. I have no other i/o lines available.

Any help would be appreciated.
Thanks in advance.
 

Offline Berni

  • Super Contributor
  • ***
  • Posts: 5419
  • Country: si
Re: Double functionality on Micro
« Reply #1 on: January 06, 2020, 07:47:18 am »
Well many ways to skin a cat. Often its a better idea to dual purpose digital pins rather than analog

But you can do things like change resistor values around your light sensor to make it produce a smaller voltage. Or you can even use LEDs as light sensors. They work like solar cells and produce a small voltage when light shines in them so you might be able to use the ADC to read the voltage the LED is producing.
 
The following users thanked this post: Skylimit

Offline woofy

  • Frequent Contributor
  • **
  • Posts: 511
  • Country: gb
    • Woofys Place
Re: Double functionality on Micro
« Reply #2 on: January 06, 2020, 09:39:45 am »
Drive the LED via a MOSFET.
Then high gate impedance should not affect the A/D.
 
The following users thanked this post: EEEnthusiast, Skylimit

Online Kleinstein

  • Super Contributor
  • ***
  • Posts: 17286
  • Country: de
Re: Double functionality on Micro
« Reply #3 on: January 06, 2020, 10:03:24 am »
One could get a little more voltage with a diode in series to the LED. Still the LED will be some loading to the analog signal, so it is a compromise on accuracy.
 
The following users thanked this post: Skylimit

Offline Whales

  • Super Contributor
  • ***
  • Posts: 2705
  • Country: au
    • Halestrom
Re: Double functionality on Micro
« Reply #4 on: January 06, 2020, 10:13:19 am »
N.B. if your other pins are driving lots of LEDs: https://en.wikipedia.org/wiki/Charlieplexing
 
The following users thanked this post: Skylimit


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

- - -
-->