Reading 128 light sensors with at least 30Hz - Page 1
Forum section: electronics / projects

author: PeterFW
author_rank: Frequent Contributor
timestamp: April 30, 2021, 05:03:35 pm
content: Hello everybody, this is not me asking:"I have no clue, please help!"This is me asking:"I can do this perfectly fine on by own, but i would like some feedback before starting to work on the PCB."I want to build a 128 pixel wide linear array of light sensors, after a bit of search i settled on the ALS-PT19-315C from everlight.https://everlighteurope.com/ambient-light-sensors/7/ALSPT19315CL177TR8.htmlMy first idea was to just use a few analog 8:1 analog mux IC, separate the whole string into 8 sections of 8 pixel each and feed that into 8 separate ADC on a SPI bus.I am pretty much just building a low resolution flat bed scanner, but in a polar coordinate design.

author: Benta
author_rank: Super Contributor
timestamp: April 30, 2021, 06:22:25 pm
content: Your plan is sensible, you might also consider 16:1 analog MUXes.What interests me more is: how do you plan to either match the sensors or calibrate them individually? Their current spread is enormous. A trimpot on each emitter would result in inequal impedances, causing additional issues.Or you could buy +10k pieces and bin them individually.A challenge.

author: ogden
author_rank: Super Contributor
timestamp: April 30, 2021, 06:36:40 pm
content: One can get CIS scanner head for < 15$. Why reinvent the wheel building such? Just buy sensor to have more time for primary task of your project.

author: Kleinstein
author_rank: Super Contributor
timestamp: April 30, 2021, 06:44:41 pm
content: Multiplexing is possible, also for more than 8 channels to 1 ADC.The sensor seams to be a phototranstor with optical filter for the visible range and thus gives out a small current. When using the sensor at low intensity one could consider using them with a capacitor (for each channel separate) instead of a load resistor. This way the signal of all channels could be integrated in parallel.With artificial light it may help to average over 20 ms to suppress 50 Hz and 100 Hz contributions.

author: james_s
author_rank: Super Contributor
timestamp: April 30, 2021, 09:04:43 pm
content: You can get ADCs with 16 inputs for a few dollars each, 8 of those will get you enough channels, I haven't looked at the other specs but it's something worth checking. Might be simpler than tacking analog mux stages onto a ADC.

author: Siwastaja
author_rank: Super Contributor
timestamp: May 01, 2021, 09:54:01 am
content: Your mux plan is just fine, many other acceptable solutions as well.I would be concerned about the accuracy of phototransistors, unit-to-unit variation is huge as is temperature variation. Photodiodes would do better but require external amplification. (Phototransistor is internally something you can approximate as a photodiode + simple transistor amplifier with no feedback or reference, hence inaccurate.)Software calibration is of course doable assuming no further drift after assembly. I'd still consider adding temperature compensation if you need any accuracy. If you can assume the whole string is at the same temperature, a single sensor, maybe integrated in the MCU, would do.What's your expected accuracy? Say you have a 100 lux light source, is it OK if some show 50, some others 200 lux?

author: PeterFW
author_rank: Frequent Contributor
timestamp: May 01, 2021, 12:32:39 pm
content: Thank you all for the great replies, much appreciated!Quote from: Benta on April 30, 2021, 06:22:25 pmQuote from: Siwastaja on May 01, 2021, 09:54:01 amI do not need high resolution, i am aiming for 8 bits for a start, though i have not really settled on a ADC and just am kinda thinking of using a bunch of ATmega328p instead.Each sensor is paired with a LED so in a test/setup jig i can just run it through a calibration loop by ramping the LED up/down and just write a calibration file.At least that was my rough game-planQuote from: ogden on April 30, 2021, 06:36:40 pmThat was actually my first idea, but this is more an art project.Each sensor is coupled with an LED and mounted behind a glow in the dark coated acrylic sheet that rotates. I intentionally want moderately "big pixels" that can be interacted with and be optically/mechanically isolated from each other.It just fits my idea better to do this with photo transistors.Quote from: Kleinstein on April 30, 2021, 06:44:41 pmLuckily i do not need to worry about that, my light source is flicker free and solid state.My intention is to "read" the surface of a glow in the dark screen from behind, this is a kinda whacky art/music project.

author: Siwastaja
author_rank: Super Contributor
timestamp: May 01, 2021, 01:01:54 pm
content: Quote from: PeterFW on May 01, 2021, 12:32:39 pmResolution is one thing, accuracy another. You need to understand that put in bits, the accuracy of these sensors uncalibrated is approx. 1 bit, i.e., you can expect -50% +100% variance around the average. If you want to use this sensor type for anything more demanding than detecting existence of black vs. white indicator (even then you'd like to use high-contrast materials), definitely plan ahead how you calibrate them, i.e., how do you design the dummy object that delivers equal amount of light to all of the pixels.I'm sure AtMega328P's 10-bit ADC run in 8-bit mode is more than suitable compared to the accuracy of the phototransistors, you'll never be able to get even near to 0.5% accuracy.

author: PeterFW
author_rank: Frequent Contributor
timestamp: May 01, 2021, 02:37:57 pm
content: Quote from: Siwastaja link=topic=277226.msg3560976#msg3560976Every sensor has a LED right beside it and a Phosphorescent material above. Each LED/Sensor pair "optically isolated" from the neighbors by a grid structure.So my idea was to slowly cycle ramp the LED up and measure at each brightness step once the direct reflected light and once the luminecent light.That gives me a calibration curve for each sensor i can use as a reference/lookup table or am i missing something?I am more then happy with 5% or sensor to sensor accuracy.This guy here build a 1k image sensor from these and the results look pretty much as good as i want it to work.https://hackaday.com/2019/12/30/image-sensor-from-discrete-parts-delivers-glorious-1-kilopixel-images/#more-392159

author: Kleinstein
author_rank: Super Contributor
timestamp: May 01, 2021, 03:21:33 pm
content: It would be a good idea to first build a minimal setup with just 1 or 2 pixels to get an idea about the approximate intensity. There quite some dynamic range for the light. It many need a different circuit depending on the intensity range.Using LED + phosphorescent material sounds like pretty low intensity. The way with phototransitor and resistor only reads the pixels 1 at a time and this only short read out. This give low sensitivity.With a capacitor one can get longer exposure time looking at many pixels at the same time, with only one extra cap per channel. It is mainly a thing for low intensity though.

author: Siwastaja
author_rank: Super Contributor
timestamp: May 01, 2021, 04:19:13 pm
content: Quote from: PeterFW on May 01, 2021, 02:37:57 pmSounds good and simple; assuming you PWM the LEDs at significantly higher frequency than the cutoff of the RC filter you are going to add after the phototransistor, then the duty cycle works out as a linear multiplier for light output. A lookup table will be both easiest and best solution if you have enough non-volatile memory to store all steps for all sensor elements.Calibrating the thing at a few different temperatures and calculating temperature coeff for each pixel would be the next step and likely required for the 5% accuracy aim, unless you can decide to regulate the temperature, for example by only operating at air-conditioned lab.