tdirodis:
Thanks for the additional ideas. What do you guys think of maybe utilzing this type sensor: https://solarbotics.com/product/40253/ in this application?
I don't think you will get range from those sensors good to know 1 book from 2 or 3. Also detection range is short,
a 3-direction object sensor, with a 4~6" (10.16-15.24cm) range.
I've got to admit that this is much more overwhelming than I had orignally thought. I'm far from an electronics whiz. I like the idea that astrofrostbyte recommended but even after reading up PhotoDiode/Transistor, analog multiplexers, etc. I don't even know where to begin in terms of purchasing the items for this project. It be nice if I could keep the cost to less than $100. I did look at the Farnell website but I'm not sure what would work with an Arduino board or even how I'd begin to hook it all up. Any advice would really be appreciated.
You can set up a photo-diode to work with a digital pin so you don't have to worry about an analog mux at all. But, maybe kill two birds with one stone and just get these: https://www.sparkfun.com/products/9454
These are IR reflectance sensors. You would install them just on one side and they will reflect off a close object and you can detect the book. These will need to be fairly close though and you would get better results if you were able to put white (tape) on the spines of the book. But at $3 a pop, they are worth investigating. They are just plug and play. I forget how many books you said were total. 16 books would be $48 in sensors, but you don't need the mux.
tdirodis:
I've got to admit that this is much more overwhelming than I had orignally thought. I'm far from an electronics whiz. I like the idea that astrofrostbyte recommended but even after reading up PhotoDiode/Transistor, analog multiplexers, etc. I don't even know where to begin in terms of purchasing the items for this project. It be nice if I could keep the cost to less than $100. I did look at the Farnell website but I'm not sure what would work with an Arduino board or even how I'd begin to hook it all up. Any advice would really be appreciated.
What sources do you have? Can you buy from eBay? Phototransistors there, I find as low as 5 to 10 cents US when buying as few as 20.
Get visible light detectors and room light in the box can trigger those not blocked by books as long as that part is not in shadow. To wire it up you can multiplex pins as rows and columns where row pins would be INPUT HIGH pullups and column pins would be one at a time switched to OUTPUT LOW to see which inputs get pulled down through detectors that "see light". The rest of the time the column pins would be INPUT LOW and draw such tiny current as to make no effect.
Worst case, you may need to mount a light on the back of the box. It maybe depends on how you point the detectors, something to experiment with before deciding physical arrangements.
The detectors will be in essence buttons and be debounced in software (give the same reading a number of times in a row, takes a few milliseconds unless very noisy).
US$100? I think less than US$5 to 10 is possible if you use a stand-alone 328P and no custom board. But that doesn't count your work and purchase any custom mountings. If you are willing to use sawdust and white glue you can make those.
A few important things have changed specifically with the box and the book since my origianl post. While the books still have to be taken from the top of the stack, the box itself has open sides, although it will still be easy to mount whatever sensor in 2" space on either side of the book. Now my concern is that there might be too much light to use IR? Also the books are black and I wouldn't not be able to put white tape on the spine of the book as was suggested earlier. I still cannot use a pressure sensor and since the box is moved around the room I don't think an ultra-sound sensor would work either. Will an IR solution still work this new information?
If you drill through the wood spacer(s) that the book spines will be set against and put the detectors in there then extra light from the sides will not be a problem but a help. Ask if the box can be tilted so the spines must always sit against the spacer(s).
Why spacer with an s? If holes will be too close in one spacer then stagger the holes across two so each has every other hole, farther apart than all in the same spacer.
tdirodis:
Now my concern is that there might be too much light to use IR?
That's the main reason for using IR. Visible room light has a fairly low IR content, so an IR LED appears very bright. Otherwise, your TV remote wouldn't work. So IR is still ok
But why need to supply an IR source when you have free room light? Can room light penetrate a book? If a little might get around somehow, put a resistor on the detector input so it does not let the pullup go LOW.
A photodetector needs a certain amount of light to switch full on, the books should block that if the detectors are positioned right. It is already stated that the book spines will be set right against the spacers so where do you put the detectors?