Detecting an egg in a nest

Heres an interesting one!

What reliable methods can you think of to detect and egg (or two) in a straw chickens nest?
I thought about a weight/pressure sensor but with the birds moving about plus the small weight of the eggs a high resolution sensory and some calulations would be required. The nest would also have to be raised so that all contact is via the sensor.

What about a sensor to detect the reflectivity of something? The egg is hard and smooth so it should reflect a fair amount of light/radio waves back towards a sensor?

I tried some image recognition over a web cam but oval shapes mixed with straw are a nightmare!

Any other suggestions guys?

Brightness level easy to discriminate by comparator, especially for white eggs. If your chickens prefer to breed other colors, you can change illumination light color up to IR, to get better contrast.

Do you mean using an LDR or such to measure brightness? The coop would need a constant light source for this to work as the ambient light would not be predictable.

What about an IR sensor\emitter combo directly over the nesting area? Would the value be measurable for a 10cm egg from 60cm distance?

CMOS camera. To economical efficiency, one camera for many nests.
Check on a link: http://fftarduino.blogspot.com/2011/12/arduino-laser-3d-tracking-range-finder.html

That looks amazing but very complex.

Do you think an IR reflectance sensor would be able to pick up the reflective surface of the egg?
The birds leave the nest at sunrise so checking can be done using an LDR to determine light outside. (The bird in the nest may give false readings)

They are quite cheap:
http://www.ebay.co.uk/itm/IR-Infrared-Reflectance-Sensor-Sensor-Shield-DC-5V-Arduino-/180761170472?pt=UK_AudioElectronicsVideo_Video_TelevisionSetTopBoxes&hash=item2a16349228

Magician does have a point about using a CMOS camera; in his system, he is using the camera, plus various outputs on an LM1881 to detect sync signals, in order to use that timing info to detect high/low pixel thresholds in the output of a CMOS camera. In his case, he is using this to detect a laser dot, and controlling servos. In your case, you could use this to detect "blobs" of "white" (the eggs) from everything else, provided you can use lighting, filters or other means to subtract out the non-blob/egg information. You could do this in a statistical manner (average readings and such over time, so you know what an "average clean nest" looks like, and subtract that from a "filled nest" - everything else should be an egg, or nothing), or you could just try to filter it out manually using filters/light - or some combination (most likely). All of this probably wouldn't fit on an Arduino; the Arduino would just be a means to an end, and the processing would likely have to be carried out on a PC or something else (maybe another Arduino - use multiple processors for the need). You might also want to incorporate other sensors (a thermal/temperature sensor would be ideal) to detect the presence of a chicken on the nest; when the chicken leaves (temp drops), then check for eggs.

Your egg, containing lots of liquid, will have a high thermal capacity and will remain warm long after the nest has cooled. Therefore you might find that if you can detect the hen leaving and make an appropriate IR measurement after a certain delay then you may be able to distinguish egg from empty-nest.

Just an idea.

i like Dr_Ugi idea
detect the entering/leaving the nest have a slight delay and get IR measurement

do your chooks only enter the nest when they lay? if so just detect enter/leaving the nest ( i ask this because my chooks spend most of their time off the nest except for when they lay)

and how big are your chooks if they laying 10cm eggs!

Hi Madlan,

Cool problem. Interested to hear the final solution. However, I can't believe nobody has asked; "WHY do you need to detect an egg in a nest?"

What are you really trying to accomplish? Maybe additional background info will spark more ideas.

For example: If a robotic arm is going to retrieve the egg, you might not care if an egg is actually present or not. Just run the roboticArm(GetChickenEgg) function every day at 8:00 AM. If an egg is there, great! If not, well, you wasted a small amount of electricity trying to pick up an egg that doesn't exist yet. Or, research how commercial egg farmers harvest their eggs. They may have some simple mechanical solutions for egg retrieval.

Could the chickens be genetically modified to lay eggs with shells that glow under black light? Might make image recognition easier.

-John

How about a combination of heat and weight? (pressure pad and thermometer)

If the chicken is in the nest you get weight and heat. If an egg, you get heat. If neither, you get nothing.

Just a thought.

Pokey:
If the chicken is in the nest you get weight and heat. If an egg, you get heat. If neither, you get nothing.

From my experience there's always varying levels of poop present.

I never used "nests" but I assumed that once a hen had laid an egg that it wouldn't move from it.

you could weigh the hen, if it looses xx grams it probably has laid an egg
( OK there can be zillion other reasons :wink:

you can have a (laser)pointer & sensor -> assuming the egg "rises" above the nest it could interrupt a beam (similar with a distance-sensor?)

Or ultrasound, the egg's hard surface would bounce much more distinctly than the feathers of a chikin :slight_smile: or the straw surrounding the egg. (I don't know if the birds would hear the sound and be scared off by it.)

The reason for this is to log when an egg has been laid, no robotic arms or anything fancy just pure sensing.

I currently have a webcam above the nest and using a PC to compare images to determine if an egg has been laid. The problem is the nest changes quite often, the chickens move the straw about causing the reference image of the empty nest to become invalid.
The eggs are laid in various places, in varying numbers and at different times of the day!

The hen's lay and egg and move quite soon after (They won't start sitting on them until there’s quite a few in the nest or they are broody.

Ultrasound would be ideal, as the egg is much more dense than the surrounding straw\feathers - I started to investigate this but all ultrasound seems to be range finding only, no examples or notes on testing density.

They sometimes sleep in the nest, sometimes lay first thing in the morning and sometimes they come back to the nest during the day to lay - so quite difficult to track laying with the hens movements.

I currently have a webcam above the nest and using a PC to compare images to determine if an egg has been laid.

You should make a frequence diagram of the colors of the image. A changing nest still has mostly the same color pixels. An egg would probably disturb the frequency pattern.

Simplest way I can think of is to detemine the average color, here done for the blue channel only, to get the idea

void loop()
{
  for (int x=0; x< width; x++)
    for (int y=0; y<height; y++)
    {
      color = getpixel(x,y);
      sumBlue += color.Blue;
    }
  }
  val = sumBlue/(height*width);
  if (val > average*1.3) then 
  {
    Serial.println("Egg alert");
  }