Detecting an LED

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
FuzzyPanda
 
Posts: 4
Joined: Sun Oct 26, 2014 7:26 pm

Detecting an LED

Post by FuzzyPanda »

Helllo all,

I have started a project for my dads company where they have asked me to create a programming/testing system for one of there products.

The system involves using relays to short contacts, then detect a flashing LED output and well as a PWM speaker. The chip on the board us a PIC micro and I have decided to use a Raspberry PI for the project as it can program the pic using a pickit2 (have tested and works). The speaker will be read using a current sensor as I just need to see if its on or off.

My issue is reading the LED and detecting if it on or off. I am currently using the INA219 breakout for the current sensing, an MCP23017 with a Darlington Pair 8 channel to control the relays as there are a number of them.

I was wondering if the MCP23017 is able to sense the LED's being on or off, my tests so far have shown fluctuations with the input on the mcp showing high or low randomly. There are only 3 LED's to sense.

Any suggestions?

User avatar
zener
 
Posts: 4567
Joined: Sat Feb 21, 2009 2:38 am

Re: Detecting an LED

Post by zener »

You can sense them with a photo transistor, photo diode or photo cell (resistor). The inputs might fluctuate if they are floating (nothing connected, no pullup or pulldown).

User avatar
FuzzyPanda
 
Posts: 4
Joined: Sun Oct 26, 2014 7:26 pm

Re: Detecting an LED

Post by FuzzyPanda »

Sorry, should be more specific,

I am testing the pin the the LED will be connected to. The LED is on a keypad so there wont be an LED. So I am trying to detect a voltage output, or even a current output if I have to though it is a small current.

User avatar
zener
 
Posts: 4567
Joined: Sat Feb 21, 2009 2:38 am

Re: Detecting an LED

Post by zener »

The IO expander has digital inputs that sense voltage high or low. So you should be able to detect a voltage that goes high or low. Exactly how you do that can vary depending on what all you need to test and other specifics. You can post your schematic and get general feedback on it.

User avatar
FuzzyPanda
 
Posts: 4
Joined: Sun Oct 26, 2014 7:26 pm

Re: Detecting an LED

Post by FuzzyPanda »

The issue that I'm having is that I can't get the chip to recognise a voltage high. It fluctuates. What voltage should be fed into it. Is there any reason that it would appear to be receiving a false reading voltage?

User avatar
zener
 
Posts: 4567
Joined: Sat Feb 21, 2009 2:38 am

Re: Detecting an LED

Post by zener »

The definitions of what is considered a high voltage in and a low voltage in are shown in the middle of page 28 of the data sheet:

http://ww1.microchip.com/downloads/en/D ... 21952b.pdf

It looks like there is a wide range that it will consider a high level. For testing I would just tie the input to Vcc. If that is the case it should read that input as a high all the time. If it doesn't then there is some other issue.

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: Detecting an LED

Post by adafruit_support_mike »

If the device under test doesn't have an LED, build one into your testing jig.

If possible, use the same kind of LED and wiring that will be in the final assembly. Put a photosensor next to the LED and, if possible, use exactly the same kind of connection between the DUT and the LED as will exist in the final assembly.

In general, it's best to test the parameter you really care about as directly as possible (light output versus current) in conditions as close to the expected operating environment as possible.

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”