Seed blockage detection using IR sensors

Hello dear Arduino form community,
i'm working on seed blockage detection using IR sensors and arduino board ...please help me in coding on arduino board.
If anyone have related code please share with me.

You ask specifically for coding help, which implies your hardware is defined. So post hardware details, and your code so far.

edit: And also explain what this:

sadiq017:
seed blockage detection

... actually means.

const byte SeedBlockageDetector_DIPin = 4;
boolean PreviousBlockageState = false;

void setup()
{
  Serial.begin(115200);
  pinMode(SeedBlockageDetector_DIPin, INPUT_PULLUP);
}

void loop()
{
  boolean blockageState = (digitalRead(SeedBlockageDetector_DIPin) == LOW);


  if (blockageState != PreviousBlockageState)
  {
    PreviousBlockageState = blockageState;
    if (blockageState)
      Serial.println(F("Blockage detected!"));
    else
      Serial.println(F("Blockage cleared"));
  }
}

You need to introduce a time constant or changes within a period, otherwise a single sample can register as ‘blocked’.
If the input is toggling regularly, there are variations at the sensor, the grain is moving... if the sensor is ‘stuck’ on or off for more than a few millis, the grain isn’t moving.

lastchancename:
You need to introduce a time constant or changes within a period, otherwise a single sample can register as ‘blocked’.
If the input is toggling regularly, there are variations at the sensor, the grain is moving... if the sensor is ‘stuck’ on or off for more than a few millis, the grain isn’t moving.

It all depends on what assumptions you make about the unspecified "IR sensors". I chose assumptions that made the code easiest to write since I'm the software designer and the hardware designer didn't provide a proper specification. :slight_smile:
Feel free to write code based on whatever assumptions you want to make. :slight_smile: