Go Down

Topic: Record Changes in Height of Book Stack - Best Sensor? (Read 2634 times) previous topic - next topic

GoForSmoke

If the inside of the box is well illuminated then you only need detectors that the book spines would block or not. Maybe drill holes through the vertical slats and put the detectors in, but if the books are thin that would be a LOT of detectors needing to be wired. Good news is a bag of detectors might run 5 cents each.

I was looking at fiber optic cable, to feed the light from many to 1 phototransistor but wow, the cable I see costs more than detectors and wire!

You could try ultrasonic sensing from above the box. Check them on eBay, they're cheap.
http://www.ebay.com/itm/HC-SR04-Ultrasound-Wave-Detector-Range-Ultrasonic-Sensor-Distance-Module-/200896270284?pt=LH_DefaultDomain_0&hash=item2ec659cfcc
This looks the same as the ones I got from LC Tech. It's supposed to be good to 2mm but I didn't get that in quick testing. Getting it right should be a little problematic.

Quote
There is a 2" slit in front of the box which allows you to see the spine of the book.  In other words you can see that there are still books in the box without looking into it from the top.


That presents single detector possibilities but they would have to be positioned in front of the box.





Nick Gammon on multitasking Arduinos:
1) http://gammon.com.au/blink
2) http://gammon.com.au/serial
3) http://gammon.com.au/interrupts

astrofrostbyte

#16
Mar 08, 2013, 09:57 pm Last Edit: Mar 08, 2013, 10:57 pm by astrofrostbyte Reason: 1
Quote
Astrofrostbye, would you mind providing a recommended parts list?

Well since it's a school project this is probably a good moment to learn about the few components you're going to need.  Just take a day to read up on PhotoDiode/Transistor,  analog multiplexers, etc.

I would recommend Farnell for a bit of components selection, for example if you go to optoelectric section you can select IR emitters,  and select the key specs your looking for like 'emision angle','case' and 'sort on price'  you'll get a good selection.
Then buy a few components and start testing and prove to yourself that this is a good design approach.

maybe....
Since your bookthickness is defined, and relatively large, maybe it could be as simple as using a bunch of lever-switches ?

For robustness just mount them behind a steel strip with holes in where the little wheel sticks out.
Gear: Arduino- Uno,Due,Ethernet,  OLS, Buspirate, J-Link, TDS1002, Rigol DG1022

GoForSmoke


Since your bookthickness is defined, and relatively large, maybe it could be as simple as using a bunch of lever-switches ?

For robustness just mount them behind a steel strip with holes in where the little wheel sticks out.


Do micro-switches cost less than phototransistors? Ceiling lights or a led in the box is enough illumination for those if not covered by a book.

But there is another way not prohibited, you may like.
Quote
The only stipulation is that I cannot use any sort of scale or pressure system to determine the change. 


If all the books have a strip of aluminum foil taped over the spine, they would have capacitance with other strips of foil close in the box. To check you quick charge a foil strip in the box through a resistor  for a millisec or 5 and then count microseconds (small resistor) until the charge bleeds to digital LOW.
You can multiplex pins. One goes HIGH, one goes LOW, the intersection has current flow. There, it rhymes even. You save on resistors multiplexing, they only need to be on the pins for rows or columns. Multiplex also works for phototransistors.

Nick Gammon on multitasking Arduinos:
1) http://gammon.com.au/blink
2) http://gammon.com.au/serial
3) http://gammon.com.au/interrupts

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?

astrofrostbyte

Looks cool, but my eye caught the Price $30,- ,  for that money you can buy 16x (IRled's+photodiode) and 2x Ana.multiplexers.
Remember that with the arduino you can do a bit of modulation also.
Code: [Select]
pseudocode:
for ( i = 0 to 200 )
{ Switch IR led ON
  delayus(  )
  varON += Read AnalogIn from PhotoDiode
  Switch IR Led OFF
  delayus(  )
  VarOFF += Read AnalogIn from PhotoDiode
}
val = (ValOn-ValOFF)

You need to test this because its hard to predict how strong your photodiode signal will be, and influence of Day/artifi. light.
Gear: Arduino- Uno,Due,Ethernet,  OLS, Buspirate, J-Link, TDS1002, Rigol DG1022

GoForSmoke


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,
Quote
a 3-direction object sensor, with a 4~6" (10.16-15.24cm) range.


Nick Gammon on multitasking Arduinos:
1) http://gammon.com.au/blink
2) http://gammon.com.au/serial
3) http://gammon.com.au/interrupts

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. 

Retroplayer

For a mux, this is cheapest: https://www.sparkfun.com/products/9056 at $5, but this is probably easiest (well not really, it's really the same basic thing but with 3 of them): https://www.sparkfun.com/products/9832
That one for $5 will give you 16 inputs, should be enough, right?

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.

Did you need a display for the count?


GoForSmoke


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.

Nick Gammon on multitasking Arduinos:
1) http://gammon.com.au/blink
2) http://gammon.com.au/serial
3) http://gammon.com.au/interrupts

tdirodis

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?

GoForSmoke

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.

Nick Gammon on multitasking Arduinos:
1) http://gammon.com.au/blink
2) http://gammon.com.au/serial
3) http://gammon.com.au/interrupts

Retroplayer


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

GoForSmoke

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?



Nick Gammon on multitasking Arduinos:
1) http://gammon.com.au/blink
2) http://gammon.com.au/serial
3) http://gammon.com.au/interrupts

Go Up