Amplifying output of IR sensor

Thread Starter

sminded

Joined Nov 22, 2015
22
Im working on a 5V board which have 16 touch sensors in form of paired IR leds and phototransistors. They are hooked up to two shift registers (74hc165) which have a high input level of 2V. The idle V is about 0.5 (when not touching). To sense a touch with a finger it needs to be about 3cm from the sensor which is too close. So my idea is to use four LM324 quad opamps to increase the sensitivity of the touch sensors. Im thinking I will first use a suitable resistor to mute the idle voltage to 0V and from there connect to the non inverting input of the op amp.

Does this seem to be the correct solution or is there some simpler solution I can use? Is the LM324 the correct type of op amp or is there a better suited one?

The project is a modular board for an interactive led coffee table which can play different games like the classic low pixel games and chess. The first proto will be 16 boards and 256 pixels controlled by Teensy 3.1.
Im currently fine tuning the first proto board and this is one thing I need to improve (touch sensor sensitivity).
 

Sensacell

Joined Jun 19, 2012
3,432
Can you post a schematic? Using un-modulated IR will never yield much in the way of range or stability, your sensors will be totally overwhelmed by any incandescent lighting in the vicinity.

Using modulated IR can work well, at the expense of significantly increased circuit complexity.

Capacitive sensors are a better idea for this kind of thing.
 

Thread Starter

sminded

Joined Nov 22, 2015
22
Can you post a schematic? Using un-modulated IR will never yield much in the way of range or stability, your sensors will be totally overwhelmed by any incandescent lighting in the vicinity.

Using modulated IR can work well, at the expense of significantly increased circuit complexity.

Capacitive sensors are a better idea for this kind of thing.
I will post a schematic later tomorrow, right now im only using a mobile. However it is only as you might expect with a 75 ohm (5V, 60mA) current limiting resistor for the ir led and one 10 ohm for the reverse biased photodiode, then a 5k pulldown resistor on the anode side of the diode. The output is taken from the anode to the shift register.

Capacitive sensors is ruled out as I need to sense ordinary chess pieces, also i believe they will be more difficult to integrate on the table as well.

With the prototype I have now I currently do not have any problem with noise or natural light etc, but I have problem with reflection of the glass surface which also needs to be considered.

The problem with modulated is that I would need complete sensors or else I have to decode 256 inputs in the controller. The complete sensors I have seen will be too expensive for this project.
 

Sensacell

Joined Jun 19, 2012
3,432
Ok chess pieces.

You are expecting a clean digital output directly into a shift register? This means that ALL your sensors need to perform EXACTLY the same so that the switching threshold can be set by choosing a resistor, etc. This will be a nightmare as you will find that normal component variation and mounting differences cause the threshold to vary all over the place, you will be tweaking them individually with 256 potentiometers, hating life.

I offer the following thoughts:

1) Choose a more robust sensing technology that guarantees a clean digital output without the variation (magnets and hall sensors for example)
2) If you have to use an optical system, design it so you can measure the light level and calibrate it in software.
One idea is to make each sensor an oscillator, use a digital MUX to select an individual sensor, then measure the light level by measuring the frequency of each sensor using the MCU's internal timer, scan the board to make it work in real-time. This avoids the nightmare of analog MUXing and keeps the sensors really simple.

I would think along the lines of an 8 X 8 matrix to minimize the wiring and complexity, think of a way to activate one sensor at a time, with a row-column enable, then you can control the whole thing with 2 X 8 bit shift registers, then you could wired OR all the sensors to one input.
 

Thread Starter

sminded

Joined Nov 22, 2015
22
Ok chess pieces.

You are expecting a clean digital output directly into a shift register? This means that ALL your sensors need to perform EXACTLY the same so that the switching threshold can be set by choosing a resistor, etc. This will be a nightmare as you will find that normal component variation and mounting differences cause the threshold to vary all over the place, you will be tweaking them individually with 256 potentiometers, hating life.

I offer the following thoughts:

1) Choose a more robust sensing technology that guarantees a clean digital output without the variation (magnets and hall sensors for example)
2) If you have to use an optical system, design it so you can measure the light level and calibrate it in software.
One idea is to make each sensor an oscillator, use a digital MUX to select an individual sensor, then measure the light level by measuring the frequency of each sensor using the MCU's internal timer, scan the board to make it work in real-time. This avoids the nightmare of analog MUXing and keeps the sensors really simple.

I would think along the lines of an 8 X 8 matrix to minimize the wiring and complexity, think of a way to activate one sensor at a time, with a row-column enable, then you can control the whole thing with 2 X 8 bit shift registers, then you could wired OR all the sensors to one input.
Hall effect sensor can be ruled out also due to cost and complexity.. remember I need at least 256, but it could be 512, so even 1 usd is way too much, besides i think hall effect sensors might have other problems such as drifting.

For the IR sensor the component variation does not seem to be a big problem as per my testing, but mounting sure is having a big impact. I might get those paired led/diode wrapped in a plastic housing.

The calibration idea is very good, I have been thinking about that, but again then i need to read all the analog values? Or how do you mean to convert it to a pwm signal? Using ADC:s? In that case I can read them using SPI?
The shift register is great as it triggers only at 2V, and supports SPI, so Im using a 3 wire setup that can scan all the sensors.
However 1V would have been better for my purpose thats why I think I need to amplify.
Im also planning to add some robustness in the SW such as having the controller write out the first byte on the SPI bus and later verify it, and scanning multiple times with same results to avoid short burst noise.
 

Thread Starter

sminded

Joined Nov 22, 2015
22
Hmmm... I think I could replace the shift registers with SPI enabled ADC:s, ex MCP3008, it has 8 channels. This would allow me to calibrate each sensor individually and read out the voltage level from the sensor. I could even have a touch calibration that requires the user to press all cells one by one and store that in the teensy eeprom, that would allow me to avoid false touches or near touches.
But at startup I will only run the automatic calibration which will resd in the backround light for eac sensor once while the led is off and once while its on. For the touch calibration I can have a button that needs to be pressed.
 

AnalogKid

Joined Aug 1, 2013
10,987
Why 256? Where are the sensors. Where are the chess pieces. Where are the sensors in relation to the chess pieces. Why is the minimum sensing distance over 1 inch away. What is the max sensing distance. Does the sensing distance vary. For any reason. Ever. What is it you are trying to do. What is the function of the overall system. What is the intent of "sensing" a piece. Why infrared. How big are the pieces. Can something be mounted on them to make "sensing" easier/more reliable. How far apart are the sensors. What is the physical arrangement (straight line, 2x8, 4x4, etc.). Hall sensor chips are small, cheap, and completely self-contained.

ak
 

Sensacell

Joined Jun 19, 2012
3,432
SPI ADC's would be a brute force solution, that's still 32 ADC chips!

Making the output of each sensor a frequency eliminates much analog nastiness, the timing of the MCU is determined by a precision crystal oscillator, you can measure the frequency to many bits of precision with this almost-all-digital technique.

The multiplexing can all be done in the digital domain- no analog noise is introduced this way and the circuitry is simpler.
If you make the oscillators run fast enough, you can get readings quickly.
 

Thread Starter

sminded

Joined Nov 22, 2015
22
Why 256? Where are the sensors. Where are the chess pieces. Where are the sensors in relation to the chess pieces. Why is the minimum sensing distance over 1 inch away. What is the max sensing distance. Does the sensing distance vary. For any reason. Ever. What is it you are trying to do. What is the function of the overall system. What is the intent of "sensing" a piece. Why infrared. How big are the pieces. Can something be mounted on them to make "sensing" easier/more reliable. How far apart are the sensors. What is the physical arrangement (straight line, 2x8, 4x4, etc.). Hall sensor chips are small, cheap, and completely self-contained.

ak
Ok first of all the main interaction with the table is finger touch, doesnt hall sensors require magnets?

It is a 16x16 cell table with glass on top. Each cell is having a touch sensor and an RGB led (APA102C). The cells are located under the glass and separated with a wooden mesh/grid.

The optimal solution would be if the touch sensor would only sense when an object is touching the glass in the corresponding cell.
I want to be able to use chess pieces so I can have a chess game running.
Other than that nothing is decided yet but Im hoping I dont have to redesign too much.
 

Thread Starter

sminded

Joined Nov 22, 2015
22
SPI ADC's would be a brute force solution, that's still 32 ADC chips!

Making the output of each sensor a frequency eliminates much analog nastiness, the timing of the MCU is determined by a precision crystal oscillator, you can measure the frequency to many bits of precision with this almost-all-digital technique.

The multiplexing can all be done in the digital domain- no analog noise is introduced this way and the circuitry is simpler.
If you make the oscillators run fast enough, you can get readings quickly.
Ok, but what IC:s does your solution require?
 

Sensacell

Joined Jun 19, 2012
3,432
You could cook up a light-controlled oscillator using a wide variety of parts! opamps, timers, transistors...
I would go with a rail-to-rail high performance bad ass opamp like the MCP6024 for example... 4 oscillators from one chip.

Choose your operating frequency so you can scan the whole board fast enough- how fast must it respond?
I would design each sensor unit to require 2 enable signals to be valid (Row /Column) before it outputs a signal.
Make the signal output an open collector - then you can tie them all together into one node that reads the pulses.
(beware of the leakage current of all 256 transistors)

You may need to block it into smaller zones to get the response faster- use more than one counter-timer in the CPU to speed up the scanning.

This project is all about reducing the amount of hardware you need to throw at it, clever multiplexing is the key.
 
Last edited:

Thread Starter

sminded

Joined Nov 22, 2015
22
I cant see your whole solution in front of me, will it be able to judge the distance in discreet steps, ex 0-1023 corresponds to 0-VCC (5.3V)? So I can calibrate.
If it is using op amps, 256 transistors and a lot of glue parts then I feel it will be more simple and cost effective to use the ADC:s. Its really important that I get a modular solution. Meaning I want to make a PCB with 4x4 cells which can be daisy chained. This will allow me to have different table sizes.
 

Thread Starter

sminded

Joined Nov 22, 2015
22

Here is a clip of the perfboard proto with 4x4 cells/pixels. Right now the Teensy is running a simple program that scans the board and lights leds which have been touched. For the output it is using 2 wires for the leds; data and clock, and two wires for the touch sensors; parallell load and clock, and for the inputs its using one wire for the touch sensors; data. In the future I might use two more outputs for the touch sensors; enable IR and data. Enable IR would be used to turn on the IR leds on the board using a transistor and data would be used to feed a checksum byte to the first shift register which then be read as the last byte from the data input.

On the board, the top most IC to the left is the 74HCT245 used as a buffer and level converter from teensy 3.3 to 5V. The next two IC:s are the shift registers 74HC165 which have 8 touch sensors connected each on the parallell in inputs. They are daisy chained and the bottom one is connected to the output jumper which will be connected to another board or back to the controller if it is the last board in series.

On the breadboard I have the Teensy on the top and a logic analyser on the bottom for debugging purposes. On the PCB, only the flat cables are used to run the board, the other wires are connected to the logic analyser.
 
Last edited:

Thread Starter

sminded

Joined Nov 22, 2015
22
Here is a schematic of the touch sensor as it is done now on the prototype.
As discussed I most likely need to be able to turn the IR leds off to save power, I will only ON them while actually sampling/scanning the board. So I need one or more transistor depending on how many is needed for the 1-2 amps the 16 IR leds will draw and I need another output from the controller (enable IR led).

 

Sensacell

Joined Jun 19, 2012
3,432
Wow- the video is impressive- congratulations on a neat idea.

Looking at your circuit, I will say one incandescent lamp shining on it and it will be 100% non-functional.
Have you tested this?

Incandescent lamps emit massive IR around the same wavelength as the LED, no way to compete with them unless you use a modulated concept that shifts the signal up from DC.

BTW- the 10 ohm resistor serves no function? why is is there?
 

Thread Starter

sminded

Joined Nov 22, 2015
22
So now this thing isn't a switch? It's a distance measurement device? Any particular reason why that wasn't revealed 12 posts ago?

ak
its now a laser beam and your attitude sucks

If you follow the thread instead of being grumpy you will see that we discussed distance to be able to calibrate.. a switch is just on and off for the controller so there is no way to adapt the sensitivity in software.
 

Thread Starter

sminded

Joined Nov 22, 2015
22
Wow- the video is impressive- congratulations on a neat idea.

Looking at your circuit, I will say one incandescent lamp shining on it and it will be 100% non-functional.
Have you tested this?

Incandescent lamps emit massive IR around the same wavelength as the LED, no way to compete with them unless you use a modulated concept that shifts the signal up from DC.

BTW- the 10 ohm resistor serves no function? why is is there?
Thanks, and thanks for the inputs.. I havent discussed the project with anyone who really knows electronics yet.. so its great to get some feedback.
With incandescent do you mean any ambient light source or some special type? I have a super bright led lamp on it now without any problem and im also not getting any problem with the rgb leds on the board... but im definately looking at modulation in any case..
 

Sensacell

Joined Jun 19, 2012
3,432
Sun light or light from any filament type lamp is rich in IR.

Many modern light sources (LED, CFL etc.) are weak IR emitters, so it's easy to be deceived into thinking "ambient light" is not a problem, until you turn on an incandescent fixture...
 
Top