3
\$\begingroup\$

I have a microcontroller-based project (using an Atmega328) that needs to detect the presence of a solid object placed on the project box. What would be the best way to achieve this? I've thought about using a photosensitive resistor in a voltage divider configuration, but the issue I have with this is that if the project box is in a dark room it may not detect any light when the object is removed.

Any and all input on this would be appreciated as I'm not sure how reliable my voltage divider solution is. The objects placed on the project box will be solid and made of glass or plastic. And the only output needed from whatever sensor I use is a logical zero or one to signify if an object is there or not there. Note the objects may have concave bottoms, so the sensor would need to be able to identify it even if it's up to 1-2 cm away from the sensor.

\$\endgroup\$
  • 1
    \$\begingroup\$ Strain gauge/load cell? \$\endgroup\$ – Ignacio Vazquez-Abrams Oct 2 '13 at 13:31
  • \$\begingroup\$ I don't think that would work as the object may have a concave bottom, and so physical contact with the sensor is not guaranteed. \$\endgroup\$ – David Högberg Oct 2 '13 at 13:41
  • \$\begingroup\$ LED+photocell, just like in an optical mouse? \$\endgroup\$ – user36129 Oct 2 '13 at 13:55
  • \$\begingroup\$ Weigh the whole project box (whatever that is) \$\endgroup\$ – Andy aka Oct 2 '13 at 14:08
  • \$\begingroup\$ What object(s)? How heavy / what range of weights? Will it always be on top? In the same place? Same colour? Moving? A hinged lid with a microswitch, or opto-sensor, is the simplest solution. \$\endgroup\$ – John U Oct 2 '13 at 16:29
2
\$\begingroup\$

A couple options come to mind.

Range finder

Use an ultrasonic range finder or, if you think the object would be opaque enough, an infrared proximity sensor. Put the sensor in the top of the box, pointing up and out of a hole you've cut there and poll it occasionally. When the measured distance decreases rapidly, and as a method of noise filtering stays low for a set number of samples, you've got an object in the way.

Properly placed load sensor

Another way is to put the load sensors on the bottom of the box. Assuming the object is actually placed on the box, the detected load will increase and can signify the presence of an object.

Strain gauge

Make the top of the box springy, that is, it's lifted slightly from a solid resting point. Now place a strain gauge in the gap. When an object is placed on the top it is depressed and bends the strain gauge. This signifies the presence of an object.

The above options don't necessarily give you a logical one/zero for presence, but neither would a optical sensor.

Momentary push buttons

If you're mechanically savvy, you could even use one or more push button switches. For instance, on the lid of your project box place three/four push button switches and attach (glue) a platform for the object on top of them. This method might not be terribly reliable though. I'd try to avoid too many moving parts.

Personally, I'd go with the optical range/proximity sensor.

|improve this answer|||||
\$\endgroup\$
  • \$\begingroup\$ Sorry to downvote, but a few reasons: Range sensing is not a great solution when distances are very short, and "in contact with" is a short distance. Load sensor is a relatively expensive solution compared to a simple switch. Both of these give analogue readings requiring further processing / calibration rather than on/off. And an optical sensor, of the beam-break or reflective proximity type, would give you a logical one/zero output. \$\endgroup\$ – John U Oct 3 '13 at 9:52
  • \$\begingroup\$ I think the infrared proximity sensor is the way to go. Now I only have to find out if it is available as a single IC circuit that I can buy. \$\endgroup\$ – David Högberg Oct 3 '13 at 11:09
  • \$\begingroup\$ Are there any inexpensive load sensors? Anything that costs just a couple of bucks and can detect small loads? \$\endgroup\$ – David Högberg Oct 3 '13 at 11:29
  • \$\begingroup\$ @JohnU Yes, "in contact with" is very close, this is desired. The OP is not trying to measure range, only detect an object, perhaps calling it a proximity sensor would satisfy you. The purpose is the same when a threshold range is set, at which point any analog output (or digital value) could be interpreted as a logical one/zero, just as you suggest would be done with a different type of optical sensor. It's as simple as a "if greater than or equal to" statement. \$\endgroup\$ – Samuel Oct 3 '13 at 16:26
  • \$\begingroup\$ @user29920 Proper load sensors are not that cheap. But you could make due with a strain gauge and a properly constructed enclosure/triggering mechanism. Additionally, I've added another option in that vein. \$\endgroup\$ – Samuel Oct 3 '13 at 16:32
3
\$\begingroup\$

You could implement a capacitive sensor on the top of the box. Plastic has a relative permittivity which is about 2.0 or greater and glass is greater than 4.0. So both should be easily distinguishable from air which is essentially 1.0.

The Arduino CapSense library uses a very simple GPIO pin based method for measuring capacitance. You could easily do this on your project. The most interesting part would be designing the sensor layout to maximize the reliability of detecting the object of interest without false readings e.g. when someone's hand is near the surface.

The sensor would work by the glass or plastic object causing the fringing field capacitance between the two sensor electrodes to increase when the object is present, compared to the capacitance when only air is present above the sensor surface. One electrode would be connected to ground and the other electrode to the MCU "receive pin" as in the following diagram:

CapSense library circuit example

Now I expect you'd want to use two electrodes and use the fringing field capacitance to do the sensing, rather than the "one-electrode" model used in the above figure, since the plastic or glass object won't be well coupled to ground.

You could use a spot sensor, like a circular sensor and a surrounding ground plane, or you could implement a wider-area sensor using interdigitated coplanar electrodes.

|improve this answer|||||
\$\endgroup\$
  • 1
    \$\begingroup\$ I love you! ♥☺☼☻ \$\endgroup\$ – David Högberg Oct 3 '13 at 20:36
2
\$\begingroup\$

You could try a variation on a 'magic-eye' detector (beam interrupt).

enter image description here

With no object to block the beam the output from the phototransistor would be LOW. With an object in the way the output would go HIGH.

|improve this answer|||||
\$\endgroup\$
  • \$\begingroup\$ Neat; what did you use to draw that? \$\endgroup\$ – boardbite Oct 2 '13 at 18:57
  • \$\begingroup\$ @boardbite just a simple paint program - kolourpaint \$\endgroup\$ – JIm Dearden Oct 2 '13 at 19:00
  • \$\begingroup\$ You seem to have a good sense of geometry/symmetry then; looks fairly textbook-like! \$\endgroup\$ – boardbite Oct 2 '13 at 19:05
  • \$\begingroup\$ @boardbite From years of scribbling circuits and designs on the back of brown envelopes before PCs were even invented. \$\endgroup\$ – JIm Dearden Oct 2 '13 at 19:25
2
\$\begingroup\$

If the object contains any material metallic a very simple (and cheap) option is to use inductive sensing. You can make a coil of wire with a few loops and use this as an inductor in a LC oscillator. It's pretty straight forward to use an arduino (or any other controller de jour) to stimulate and measure the resonance frequency of the oscillator. When an object (in particular a metallic object) comes near or in the loop the inductance of the loop changes as does the oscillation frequency. Thus you can detect the presence of the object by observing oscillation frequency. This technique works well depending on your material. Theoretically almost any core material will change the inductors value, but the SNR might be questionable. I hacked up a sensor similar to this in about 30 mins a few months back in order to try to detect non-metallic materials. Though the frequency changes the SNR is low so you might need more complicated signal processing to differentiate the object. At that point you'd probably want to consider other sensors (ultrasonic, IR, load cell, etc) since the nice thing about this option is the simplicity/cost.

Incidentally this is the way that stop lights detect the presence of cars. If you've ever seen a loop cut into the pavement at a light this is actually where they embed coils of wire to make the L in the LC oscillator.

|improve this answer|||||
\$\endgroup\$
  • \$\begingroup\$ It clearly states in the question that the object is made from glass or plastic. Maybe you need to amend your answer. \$\endgroup\$ – Andy aka Oct 2 '13 at 19:09
  • \$\begingroup\$ I meant the answer to be food for thought. If he/she can add a piece of foil/metal (or if the glass/plastic object contains any amount of foil/metal) the proposed solution could work. Alternatively if he/she wants to get into some signal processing or is super cost constrained signal processing might solve it with just plastic/glass. That stated I modified the answer to reflect the spirit with which it was intended. \$\endgroup\$ – Doov Oct 2 '13 at 20:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.