Go Down

Topic: Need help managing a large amount of photoresistors (Read 389 times) previous topic - next topic

Jasonchildress

I'm going to build my son a wooden race track for his toy car obsession and I'd like to add some extra pizazz just for the heck of it and to have a fun project to work on.

My idea is to embed a strip of neopixels in the middle of the track along with an array of sensors (I'm going to start with photoresistors)  that will detect where along the track the car is. With that data I can light up the neopixels behind the car (where it's been) to create a sort of Tron effect on the track.

I know I could connect 12, 24, 36 or any # of photoresistors to an Arduino Mega or similar, but that seems like a waste to manage that many individual sensors essentially using up all of my IO pins. Not to mention the wire management nightmare that would come with that.

In my short investigation so far, I'm looking at using an MCU with a ton of pins, an I2C I/O expander (this might help with wire management), multiplexing the photoresistors (still very fuzzy on this concept) or finding some kind of single wire photoresistor array device.

What I'd love to find is something like a NeoPixel strip but instead of an array of LED outputs it would be an array of photoresistor inputs. Does anybody know if a device like this exists? Ultimately, having an array of n# of sensors all connected through one wire.

If not, can anybody point me to multiplexing tutorials or offer a little bit more info on the idea?

My initial, high-level implementation thought on this project is the car will start at the top of the track, as it travels down the track, it will pass over a photoresistor reducing/increasing its resistance. I can measure this resistance difference to know what sensor the car is currently over. Knowing the car will always travel in a linear direction, I can light up all lights starting from the currently covered sensor to the start of the track. Eventually the car will pass over the last sensor and all lights on the NeoPixel strip will be lit up.

Accuracy doesn't have to be amazing, just good enough to create the fun effect I'm going for.

Any advice would be very much appreciated.

Grumpy_Mike

#1
Jul 09, 2019, 08:47 pm Last Edit: Jul 09, 2019, 09:24 pm by Grumpy_Mike
Quote
What I'd love to find is something like a NeoPixel strip but instead of an array of LED outputs it would be an array of photoresistor inputs. Does anybody know if a device like this exists
Sorry it doesn't exist.

I have just finished making the led part of this project and it took 45 minuets to put the LEDs on a single 8 LED curve of track. It is a big project. It has 186 LEDs.

How many sensors do you want? I suspect that is going to be very difficult. Not only do you have the problem of reading that many sensors, you also need to differentiate between the light being reflected down from the racing car above it but you have to somehow ignore any ambient light the track gets. Or conversely allow the ambient light to come through and see what the car covers up.

Quote
finding some kind of single wire photoresistor array device.
Again that is not going to happen, you need a common ground to all photo resistors. By the way the three wire devices are not photo resistors but photo transistors. Photo transistors are a lot faster to respond than photo resistors.

As to multiplexing analogue signals, start reading here:- https://hackaday.com/2018/06/09/arduino-analog-i-o-multiplexer/

PaulRB

An alternative to optical detection of the car would be magnetic. Attach a small magnet to the bottom of the car and embed a number of reed switches in the track. Reed switches can easilly be multiplexed. You could have perhaps 16 or 32 embedded at regular distances around the track. Time between detection at two adjacent points could be used to estimate the car's speed and animate the LEDs in the following section.

Paul__B

LDRs can of course, be multiplexed just the same as any other input device such as switches.

You wire them in a matrix.  A PCF8575 port expander with sixteen lines can control an 8 by 8 matrix for 64 devices.

The trick is - you need a diode in series with every LDR in the matrix.  And a matrix keeps the wiring simple and neat - no more than 16 wires are needed to connect to the whole matrix, or 9 wires to any group of 8 devices, 10 wires to 16 etc.  Ribbon cable.

Jasonchildress

Thanks everybody for the responses/ideas.

@Grumpy_Mike, the link you sent me was perfect. The project outlined in the video is almost exactly what I'm trying to do with the photoresistors and he shared his test code which will be a good starting point for me.

@PaulRB, agree with the idea on estimating the car's speed. I was thinking the same thing. If I really wanted to the take the project up a notch, I would use an LCD to display the fastest speeds. It would be a neat little challenge to try to beat the record.

My next step is to try to recreate the test project in the video, learn from that and see if it's a viable option.

Thanks everybody.

Go Up