Maker Pro
Maker Pro

Cheapest way to get data from multiple(100s) of sensors?

dorke

Jun 20, 2015
2,342
Joined
Jun 20, 2015
Messages
2,342
Bob,
That would be 20 outputs.
(Tristate capable or with an extra external NPN transistor).

Steve,
The purpose of the ULN is to be able to drive a single row of LEDs at the same time with the required current -about 200mA ,all sensors of that row require about 20mA max.
Take care not to drive more than a single row at a time -power wise the ULN isn't capable of driving all 8 rows at a time .That may damage the IC.

Depending on the uC you would use, a pull down resistor (4.7K or so) on the ULN inputs is advised.
So that at star-up the inputs would be "0"=output off.
Use a 9pin SIP resistor network with a common pin per a ULN IC ,instead of single resistors.
 

Steve Peart

Sep 16, 2015
53
Joined
Sep 16, 2015
Messages
53
Would a 3.3k resistor work or is the full 4.7k needed? Why use the resistor network instead of single resistors?
 

Steve Peart

Sep 16, 2015
53
Joined
Sep 16, 2015
Messages
53
@dorke, @BobK, sorry, didn't ping you directly above. I am wondering what resistance values could potentially be alternatives since i don't have these particular (4.7k) ones on hand.

What is the benefit to using the resistor network in lieu of the individual resistors?

Thanks!
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
A 3.3K or a 10K would work fine. If you want to do much in electronics, buy a resistor kit on Ebay which will contain hundreds of resistors for a few bucks.

Bob
 

Steve Peart

Sep 16, 2015
53
Joined
Sep 16, 2015
Messages
53
@BobK, I have been slowly accumulating resistors as I go. If I buy them from jameco (which used to be only a couple miles from my house), I would always get ~100 of them since they are so cheap. I may buy the 4.7k ones for this project, I just want to be able to at least test on the breadboard without buying much.

Do you know why @dorke would suggest the 9pin resistor network though? I am wondering the benefit of this.

Thanks!
 

dorke

Jun 20, 2015
2,342
Joined
Jun 20, 2015
Messages
2,342
As bob said and,
I would add the layout is the simplest possible.
 

Sunnysky

Jul 15, 2016
541
Joined
Jul 15, 2016
Messages
541
recall original question?

"I plan to have 100s of Reflective IR Sensors and want to be able to read from all"

I wonder how much thought has gone into what objects needed to be detected and ignored. what is the medium? and what objects? and what optical SNR is needed vs range?
apertures on a table top?
glass table? transmission loss x2
glass reflections? daylight accumulation x #/row or column
max gap to object?
min object reflectance ratio?

keep in mind this sensor peaks at 2mm and flattens out at 20% at 15mm

then a black chess piece might only reflect 10% even at 2mm then only 3% at 10mm
 

Steve Peart

Sep 16, 2015
53
Joined
Sep 16, 2015
Messages
53
@Sunnysky, The point of the IR Sensors in the table is mostly to determine if an object is touching the table at that point. That information about the grid of sensors should be read as quickly as possible and then decisions can be made based on the grid values. I was still hoping for analog granularity on the sensors in order to potentially have the table react a bit based on range as an object gets closer to touching the table. I plan to have RGB LEDs on each sensor in the grid. Touching a sensor won't always necessarily light up the LED on that same point, allowing for games and other interactions with the table based on touch/proximity, etc. What things might I consider on this idea based on the things you mentioned?
 

Steve Peart

Sep 16, 2015
53
Joined
Sep 16, 2015
Messages
53
@dorke , @BobK :

Does this look right to you guys in terms of how i've wired this up? I am currently having an issue where it appears as though no matter how many sensors I have hooked up in a row, they all read the same value, but I am not sure if it's a software problem or a wiring problem. This setup shows just one sensor, but you could see how multiple could be added to the row. I read the analog sensor values from the A0 pin on my arduino.

LED Pixel Sensor_bb.png
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
I've been away from this thread. I was envisaging a linear array, but that was wrong...

I wonder if you e thought of using the IR LEDs as the sensor as well as the source of light?

I've seen this done with visible LEDs but I cant see why it can't be done with IR LEDs.

It might take a little research, but I saw it done using something like an 8x8 array of red LEDs. I'll see if I can find it again...
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
This page http://www.thebox.myzen.co.uk/Workshop/LED_Sensing.html describes how a led on its own can act as a light and a light sensor (although not at the same time).

If you turn on the LEDs around one that is a sensor, you should be able to determine if there is something in front of that LED. The beauty of this is that the output is analog but you can read it digitally.

One approach to this is to have a series of 595's used to turn LEDs on (via a diode) and a series of (tho input equivalent) to read the voltage across each LED.

You turn all the LEDs on, then turn off the ones you want to be read from. Then you read the LEDs repeatedly. The time it takes for the input to become a low logic level is determined by how much light it receives (the more light the faster the voltage decays).

Whilst this requires one chip per 4 LEDs, it also requires zero sensors.

Practically speaking, you may not want (or be able) to turn on all the LEDs at once, but this just means you scan fewer LEDs at once.
 

dorke

Jun 20, 2015
2,342
Joined
Jun 20, 2015
Messages
2,342
Yes, there is a major problem.
Assuming the sensor notation is "D" for diode and "T" for transistor.
You need to connect a wire from the junction of T+ and the 3.3K resistor to pin 13 of the CD4051 instead of the blue wire now connected.

A DVM should be used to de-bug this circuit,do you have one?.


Noname.jpg
 

Steve Peart

Sep 16, 2015
53
Joined
Sep 16, 2015
Messages
53
@(*steve*) : I feel like I am too far into this design for that idea at this point. I have purchased all of my RGB LEDs and at least a handful of the sensors. Wouldn't what you're suggesting make the process run a bit slower since i'd have to double-duty the LEDs as sensors and IR Lights?

@dorke : Had to look up DVM, so i guess i don't have that? Does Fritzing do this? If not, can you recommend one, possibly free?

Did the rest of this look good, or was the issue you found just where you stopped?

Thanks guys!
 

dorke

Jun 20, 2015
2,342
Joined
Jun 20, 2015
Messages
2,342
A DVM is a Digital Volt Meter, the basic essential measurement tool,nothing can be debugged without it.
You can get a basic, poor quality, entry level one for about 3$.
Like the DT830,it should be fine for you.
Don't know or use "Fritzing".

I didn't check the 74HC595 connections.

You have to correct the fault at #73 for the circuit to work.
After you do ,"force" pin 1 of the ULN2803 to "1" (connect to 5v)
and measure the voltage on pin 18 of the ULN2803 with a DVM or with A1.
Then,measure the voltage you get with A0.
 
Last edited:

Sunnysky

Jul 15, 2016
541
Joined
Jul 15, 2016
Messages
541
@Sunnysky, The point of the IR Sensors in the table is mostly to determine if an object is touching the table at that point. That information about the grid of sensors should be read as quickly as possible and then decisions can be made based on the grid values. I was still hoping for analog granularity on the sensors in order to potentially have the table react a bit based on range as an object gets closer to touching the table. I plan to have RGB LEDs on each sensor in the grid. Touching a sensor won't always necessarily light up the LED on that same point, allowing for games and other interactions with the table based on touch/proximity, etc. What things might I consider on this idea based on the things you mentioned?
  1. You will be much more explicit on behavior for "analog granularity"
  2. Glass will reflect more than the a black chess piece, unless it has a glossy surface.
  3. Just to detect an object digitally must account for variations in LED efficacy, aging and analog results of each sensor may vary 30% (est.) unless bias R current is matched to yield the same output voltage
  4. Your reflected signal to stray optical noise is very low even with mirror foil and no glass in this datasheet, so you have slim margins for a comparator. I expect the curve below to be compressed to 1/10 ) 10% reflectance and stray from glass may be 5% leaving a peak SNR of only 2:1
  5. The comparator can be globally set to affect all comparators to achieve say 1/3 of max reflectance of peak
  6. This may detect at a certain distance a few mm above the glass and sensor for a given set of chess pieces but another set of checkers might be 50% worse and need to re-calibrated with potentiometer outside.
upload_2016-9-22_15-40-40.png
You may have to attach adhesive foil on the bottom of each piece and but the sensor against the glass to extend "d" range. using thin glass.

you should also MUX the LED and sensor output together so only one row is on at a time using a matrix scanner of rows and columns. This also means using much higher Peak currents determined by number of rows, n. (where Iavg=Ipk /n ) Since Ipk max is 60mA, I would drive all LEDs in series at 50mA with a suitable driver at a higher voltage. to minimum peak current demands.
 
Last edited:

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
An additional bit of weirdness with internal reflections from a glass surface means that in some cases you might sense LESS reflected light when something is placed on top of the glass sheet.

And on the question about speed. Given I suggested you could easily read the array 500 times per second, even if you had to read it 10 times, that would still leave you able to get 50 samples (from the whole table, not just one position) per second.
 

Steve Peart

Sep 16, 2015
53
Joined
Sep 16, 2015
Messages
53
For additional clarity, what I am trying to do would look a lot like this:
http://www.instructables.com/id/RGB-LED-Pixel-Touch-Reactive-Gaming-Table/?ALLSTEPS

In the build that guy used, he went with micro-controllers for each node, but my intention was to use the MUX tree designed heavily above with loads of help from @dorke and @BobK . I am hoping with that method, to make the overall build much cheaper, and cheaper to expand on down the road.

@(*steve*) : What you're saying sounds like great news, as the more times i can take samples from the whole table the more responsive the whole thing will be.

@Sunnysky : You're hitting me with tons of stuff I wasn't even thinking of, is the short story from what you're saying is that I need to be incredibly small with the distance between sensors and the table top to prevent erroneous detections? And also that the "analog granularity" wouldn't end up being much range?
 

Sunnysky

Jul 15, 2016
541
Joined
Jul 15, 2016
Messages
541
For additional clarity, what I am trying to do would look a lot like this:
http://www.instructables.com/id/RGB-LED-Pixel-Touch-Reactive-Gaming-Table/?ALLSTEPS

In the build that guy used, he went with micro-controllers for each node, but my intention was to use the MUX tree designed heavily above with loads of help from @dorke and @BobK . I am hoping with that method, to make the overall build much cheaper, and cheaper to expand on down the road.

@(*steve*) : What you're saying sounds like great news, as the more times i can take samples from the whole table the more responsive the whole thing will be.

@Sunnysky : You're hitting me with tons of stuff I wasn't even thinking of, is the short story from what you're saying is that I need to be incredibly small with the distance between sensors and the table top to prevent erroneous detections? And also that the "analog granularity" wouldn't end up being much range?
correct.. it would take special optics and different transceivers to improve on this like Irda 2 parts from Sharp/Vishay with 5mm deep tunnel apertures to table. Series driving a row of 10 IR LED x1.2V would need at least 12V-13V @50mA which is far more efficient than MUXing each one.

you start by testing a pair of devices and determine range sensitive and optimal aperture size, pulse width and thus rate of muxing rows. sensitivity vs distance , reflectance ratio and pulse width are all tradeoffs
 
Last edited:

Steve Peart

Sep 16, 2015
53
Joined
Sep 16, 2015
Messages
53
@dorke, @BobK:
So I finally debugged my circuit down to a problem with a couple of the IR Sensors I had been testing with. They got fried somewhere along the line, seemingly pretty sensitive to excessive input. :) I have everything appearing to work as far as getting the Shift register to run along rows, enabling them.

The problem i have now, is that the ULN2803 channels that I am running these rows through to power the row of IR sensors, seems to up the Amperage but lower the voltage, making it not enough voltage to power the IR Sensors at all.

I used my Multi-Meter to test the values when the rows are on or off, and wanted to share them with you to see if you could tell me if things are right or not.

Voltage from the arduino 5v pin to the power line on the Shift Register = ~4.9V/300mA (i think)
Voltage from enabled Shift Register output pin = ~4.5V/50mA (Completely 0V when disabled)
-- Shift Register Output Pin connects to the an input on the ULN2803 --
Output of ULN2803 output pin when Shift Register output pin enabled = ~0.63V/1.08A (~0.05V when disabled)

0.63V Won't power a row of IR LEDs even with the higher Amperage, what am I doing wrong here?

(P.s. I have never really measured Amps before with a multimeter, some of those values may be off if i've done that wrong)

Thanks a ton,
Steve
 
Last edited:
Top