For an interactive installation I need to detect objects passing through a hole (around 20cm diameter). If an object passes an output is generated. All this should be battery powered.
I have already read into the low power features of Arduino and I'm planning on using the sleep mode in combination with interrupts to wake it when an object passes through a hole. For this to happen the output of the sensor should be digital, generating either a high or low signal.
Does anyone have good ideas how to set up a sensor that is very low power and does this accurately? The detection speed should be around 20ms at most.
I was thinking about an IR sensor, but these might use a lot of current. Any help appreciated!
I'm not sure what you mean by a detection speed of 20 milliseconds?
I get the impression you are thinking of a detector that is "alive" all the time and which will wake up the Arduino if it sees something - and maybe that's necessary.
However another way to think about it is that everything is asleep most of the time but wakes up for a very brief period at regular intervals to see if there is an object present. This will work if it is logical to say "if I check every X millisecs I can be sure of never missing anything".
For how long does the project need to operate from the battery? Is there an opportunity to use a significantly larger battery?
Yes ok, I was thinking more of something that is ‘alive’ while the Arduino is sleeping. The other approach of waking up the Arduino every 20ms and checking the value seems inefficient for power.
Duration it should work… well I guess as long as possible. Right now I’m working with a battery of 6600mAh, but if it can work on 2 or 3 AA batteries for about 1-2 months that would be great.
A lot depends on the power required by the sensor. What are the objects and how do you plan to detect them?
I suspect the sensor may use more power than the Atmega 328. In which case there would be a significant saving by switching the sensor off. If the system wakes up for 200usecs every 20msecs that’s just a 1% duty cycle.
I’m not sure how much of an Arduno Uno goes to sleep when you put the 328 chip to sleep. It may be worth building a breadboard Arduino that runs at a lower clock speed to save power. See http://arduino.cc/en/Tutorial/ArduinoToBreadboard. And study the power consumption figures in the Atmega 328 datasheet.
Thof, could the sensor be passive, relying on ambient light, for example. A simple LDR could detect passing shadows of objects moving past the hole.
Robin2 is absolutely correct, don’t use an ordinary Arduino, its power led and USB-Serial chip will waste battery juice. Certainly don’t power an Arduino through its barrel socket or Vin (regulator) input.
I would use an ATtiny85 running at 1MHz, powered by 3 x AA alkaline or 3 or 4 x AA long-life (low self discharge) NiMh rechargeables (the type that say “ready to use” on the packet), and use your Arduino to program it using the ArduinoISP sketch. But get as much as possible of the sketch and circuit working first on the Arduino, before moving to the ATtiny.
I'm definitely using a bare arduino chip, I now have a arduino mini, but I can also go for a completely naked version.
LDR, I have been thinking about it, but I guess this will be influenced too much by environmental light like shadows etc. (The installation is outdoor) LDR is also an analog value, so the arduino should be checking it continuously (or every 20ms).
For power usage, it shouldn't be a problem if the sensor uses more power then the arduino as long as it lasts long.
Right now my best guess is using an IR LED with 555 timer and a receiver, checking at 30khz (or something in line of this).
What size are the objects? If they are spheres half the diameter of the hole (ie 100mm diam) they would have to travel at 100*1000/30 = 3,333 mm/sec to pass their own diameter in 30 msecs. Are they travelling that fast? Or are they very much smaller? (Hope my maths is correct).
You've not yet said what they are. Are they metal? Wood? Plastic? Flesh? Is this to detect an animal sticking its head into a feeder?
Yes it's a game, there are several holes and people can try to throw a ball through, but of course sticking a hand should also work.
So magnetic or capacitive is out. Seems like optical will work. Have an LED and receiver across each opening.
If you use a low power IR LED, drive it with 38kHz and use an IR remote control receiver as the pickup. Should then be very resistant to interference from ambient lighting.
If the object is a ball or a hand it would hardly be necessary to check as often as every 30msecs.
Could the hole be made into a tunnel so that the ball or hand would cause the light level to fall which could be detected by an LDR (though I'm not sure how fast they react) or photodiode. In my mind the point of the tunnel is to increase the length of time for detection.
The ball must hit something.. Then a microswitch may be a solution - with NO POWER use at all while inactive
The OP only indicated that the hand or object passes through the hole.