Maakni KahinaEmma DebarNicolas DAILLY
Published © GPL3+

Smart Bird Feeder

Conception of connected bird feeders, able to alert if the seed tank is empty and analyses its use by birds.

AdvancedShowcase (no instructions)24 hours16,392

Things used in this project

Hardware components

Arduino MKR Fox 1200
Arduino MKR Fox 1200
×1
Pycom LoRa/Sigfox Antenna
×1
Ultrasonic Sensor - HC-SR04 (Generic)
Ultrasonic Sensor - HC-SR04 (Generic)
×2
Photo resistor
Photo resistor
×2
5 mm LED: Yellow
5 mm LED: Yellow
×2
Resistor 100 ohm
Resistor 100 ohm
×4
Jumper wires (generic)
Jumper wires (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE
Fusion 360
Autodesk Fusion 360
Sigfox
Sigfox

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)
Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Custom parts and enclosures

Small Cork

Small Cork (top of the tank lid)

side box

Side box to mask electronics

Ultrasonic Sensor Lid

Top lid of the feeder

Top lid of the Feeder

Bird Feeder Main Part

Main part of the bird feeder

Inside tank base

Tank = Famous Soda Bottle

Outside Tank Base

Tank = famous soda bottle

Electronic card box

bottom of the feeder, to install the electronics sigfox card

Top tank support

Tank = famous soda bottle

Schematics

Scheme

Electronic scheme

Scheme

Electronic Scheme

Code

SigfoxBirdFeeder.ino

Arduino
Arduino Code of the Bird Feeder Project
/**
 * Project Bird Feeder
 * 
 * Emma Debar / Maakni Kahina
 * 
 * ESIEE-Amiens - RIOC - Rseaux Informatiques et Objets Connects
 */

#include <SigFox.h>
#include <ArduinoLowPower.h>

//Capteur de graines 1 (vert/orange)
const int seedSensor1=A0; //vert
const int led1=6; //vert
const int consigne1=8; //orange

//Capteur de graines 2 (bleu/jaune)
const int seedSensor2=A1; //bleu
const int led2=7; //bleu
const int consigne2=9; //jaune

//Gestion de Ultra Son
const int trig1=2;
const int echo1=3;

const int trig2=4;
const int echo2=5;

uint8_t mydata[4] = {0x00, 0x00, 0x00, 0x00};

long temps;
long freq_envoie=1000*60*60; //1000ms*60sec*60min
int nb_mesures=0;
int nb_birds;
long freq_mesure=1000*30; // une mesure toutes les 30 secondes

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);

  pinMode(led1, OUTPUT);
  pinMode(consigne1, OUTPUT);
  pinMode(led2, OUTPUT);
  pinMode(consigne2, OUTPUT);
  
  pinMode(trig1, OUTPUT);
  digitalWrite(trig1, LOW);
  pinMode(echo1, INPUT);

  pinMode(trig2, OUTPUT);
  digitalWrite(trig2, LOW);
  pinMode(echo2, INPUT);

  delay(10000);
  
  sendMyData();
}

void loop()
{
  //on mesure le temps en dbut de boucle
  temps=millis();
  nb_mesures=0;
  nb_birds=0;

  while(millis()-temps<freq_envoie)
  {
    nb_mesures++;
    nb_birds+=bird_detection();
    delay(freq_mesure);
  }

  mydata[1]=(uint8_t)nb_birds;
  mydata[2]=(uint8_t)nb_mesures;
  mydata[3]=4-seed_detection()-seed_detection();
  
  sendMyData();
}

int bird_detection()
{
  int birdy=0;
  
  //sensor 1
  
  //on s'assure que l'metteur n'envoie rien
  digitalWrite(trig1, LOW);
  delayMicroseconds(2);

  //on envoie un signal
  digitalWrite(trig1, HIGH);
  delayMicroseconds(10);
  digitalWrite(trig1, LOW);

  //on regarde le temps de propagation du signal
  long duration1=pulseIn(echo1, HIGH);

  long distance1=duration1/58.2;

  Serial.print("Distance 1=");
  Serial.println(distance1);

  if(distance1<10)
  {
    birdy++;
  }

  //sensor 2
  
  //on s'assure que l'metteur n'envoie rien
  digitalWrite(trig2, LOW);
  delayMicroseconds(2);

  //on envoie un signal
  digitalWrite(trig2, HIGH);
  delayMicroseconds(10);
  digitalWrite(trig2, LOW);

  //on regarde le temps de propagation du signal
  long duration2=pulseIn(echo2, HIGH);

  long distance2=duration2/58.2;

  Serial.print("Distance 2=");
  Serial.println(distance2);

  if(distance2<20)
  {
    birdy++;
  }

  return(birdy);
}

int seed_detection()
{
  int sensorValue1, sensorValue2, difference, result;

  result=0;
  
  //mesure cot (vert/orange)
  digitalWrite(consigne1, HIGH); //on active le capteur
  delay(10); //on attends un peu
  sensorValue1=analogRead(seedSensor1); //on lit la valeur
  digitalWrite(led1, HIGH); //on allume la led 1
  delay(10); //on attends un peu
  sensorValue2=analogRead(seedSensor1); //on lit la valeur
  digitalWrite(led1, LOW); //on eteint la led 1
  digitalWrite(consigne1, LOW); //on desactive le capteur
  
  Serial.print("Valeur 1 : ");
  Serial.print(sensorValue1);
  Serial.print(" -> ");
  Serial.print(sensorValue2);
  Serial.print("\r\n");

  if(sensorValue2-sensorValue1>40)
  {
    result++;
  }
  
  //mesure cot (bleu/jaune)
  digitalWrite(consigne2, HIGH); //on active le capteur
  delay(10); //on attends un peu
  sensorValue1=analogRead(seedSensor2); //on lit la valeur
  digitalWrite(led2, HIGH); //on allume la led 2
  delay(10); //on attends un peu
  sensorValue2=analogRead(seedSensor2); //on lit la valeur
  digitalWrite(led2, LOW); //on eteint la led 2
  digitalWrite(consigne2, LOW); //on desactive le capteur
  
  Serial.print("Valeur 2 : ");
  Serial.print(sensorValue1);
  Serial.print(" -> ");
  Serial.print(sensorValue2);
  Serial.print("\r\n");  

  if(sensorValue2-sensorValue1>7)
  {
    result++;
  }

  return(result);
}

void sendMyData()
{
  // Start the module
  if(!SigFox.begin())
  {
    Serial.println("Error with SigFox Shield");
    return;    
  }

  // Wait at least 30mS after first configuration (100mS before)
  delay(100);

  Serial.print("Module temperature: ");
  float to=SigFox.internalTemperature();
  Serial.println(to);

  mydata[0]=(uint8_t)floor(to+50);

  SigFox.beginPacket();
  
  SigFox.write(mydata, sizeof(mydata));

  int ret = SigFox.endPacket();  // send buffer to SIGFOX network
  
  if (ret > 0) {
    Serial.println("No transmission");
  } else {
    Serial.println("Transmission ok");
  }

  SigFox.end();
}

Credits

Maakni Kahina

Maakni Kahina

1 project • 1 follower
Student in IT ingeneering at ESIEE-Amiens.
Emma Debar

Emma Debar

1 project • 1 follower
Nicolas DAILLY

Nicolas DAILLY

24 projects • 16 followers
Associated Professor at UniLaSalle - Amiens / Head of the Computer Network Department / Teach Computer and Telecommunication Networks

Comments