Maker Pro
Maker Pro

Double functionality on Micro

Hi all,
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.
 

Harald Kapp

Moderator
Moderator
This will not work.
The 33 kΩ resistor will reduce the current through the LED to a mre 100 µA (assuming a 3.3 V output pin.

There are better options to increase the numbe rof available I/O lines. E.g. use a shift register to serially output a number of bits using only 2 wires (data and clock). Or use an I/O-expander, e.g. one of those offered here.
I recommend that you do not mix analog functionality and digital functionality as this may have consequences with regard to signal integrity that are hard to fix.
 
The 33K was used to stop the LED working when measuring current..
When it is a output it lights very briefly to flash every 1 minute.
Would putting a diode in place of the 220R help? Or a zener diode?
The only other thing i was thinking was to use a i/o expander as you mentioned. However i really am restricted by PCB space.
Any other suggestiins?
 
I have 2 buttons, the leds are already multiplexed.
I think it may come down to using a shift register, this would mean trying to free up 3 i/o lines, clk, data and latch.
Which i cant afford to do.
 
I have 2 backlights for a lcd and 1 extra led. Trying to connect from 2 i/o lines. Lcd have common anodes
They all have to work independently.
 
Top