Instructables

IR Reflective Sensors for Arduino??

I just ordered a bunch of reflective sensors... Similar to the sparkfun one (I've not decided digital or analog yet)...I'd like to connect them all up similar to the Pololu Arrays... 

I want to hook up like ~30 and read them individually... How do you differentiate so many inputs into the Arduino? Is there some similiar code to work from? cheers!

frollard2 years ago
You have a few options; you either:

-get the digital version and hook one to each input pin
-use the analog version and make a demultiplexer to 'select' one/multiple sensors by outputting a pulse of power to each, reading that sensor, then moving on to the next one. All the outputs are connected to the same analog input. You quickly switch between the sensors and check each multiple times per second with a loop.
-use a port expander; it has its own ports and talks the values back to the main unit over i2c or 2wire, as data instead of just arbitrary signals.
hydronics (author)  frollard2 years ago
hey! I like the i2C chips because they seem flexible... digital or analog.. and fully supported in the Arduino library, also cheap, and simple (I seem to be ever a beginner programmer)... Before I jump into this though... would it be even easier to use the PS2 Keyboard hack?

http://www.instructables.com/id/Extra-inputs-for-Arduino-with-a-keyboard/

The keyboard would limit the inputs to digital, correct? I'm guessing I might need 30 total IR inputs.. Any other downside on how the information is provided...

My goal is to process the inputs minimally (possibly an if/then statement) and then store the inputs (possibly time stamped or simple counter).. Thanks!

It can be done, just be ready that you might not be able to sense multiple concurrent hits with the keyboard hack, since many ps2 keyboards can handle only 1-3 keys at once, so you may miss a 4th event...may or may not be important to your desired effect.
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!