What is more lovely than helping these lovely birds getting food during cold winters ?
When you are a geek, you also want to get more information about them and the first thing to know, is how many times a day they would eat and if they need more food depending on the weather.
This project introduces you to the future of the bird feeders. More features will be suggested at the end of the presentation if you ever need more ideas.
Every time a bird lands on the bird feeder, the Arduino MKR FOX 1200 will send a SigFox message including the current temperature in Celsius and the current percentage of humidity.
On the SigFox backend, two requests will be made when a message is received :
- The temperature and humidity are stored in the database located on Thinger.io
- A tweet is sent using IFTTT. The twitter account is : https://twitter.com/Iot_Birdfeeder
Before going to the details of the project, I would like to show the installation and the results on Twitter and Thinger.io.
1. Hardware schematics
The schematic is quite simple. Four AA batteries are connected to the Arduino (see the section Power Consumption). You can find the Fritzing file below.
Warning : The batteries are actually connected to the battery connector and not VIN and GND but I could not add it here.
- Temperature sensor
My temperature sensor was not working correctly so I decided to use the internal temperature sensor of the SigFox module. A method is already present in the SigFox library to read the current temperature.
For a better accuracy, I could use a real temperature sensor such as the DS18B20 which is a One-Wire device with a -55°C to +125°C range.
Also, I could use a DHT22 sensor which can measure the humidity and the negative temperatures as well.
- Humidity sensor
I used the DHT11 sensor as a humidity sensor. I could not use it to get the current temperature because it can measure only positive temperatures.
As said before, the DHT22 should be better as humidity and temperature sensor (range -40°C to +80°C).
- Vibration sensor
To detect the presence of a bird, I decided to use a vibration sensor. It is an open collector output and has a potentiometer to select the sensitivity of it. I have bought it on Amazon France : https://www.amazon.fr/gp/product/B00AYB1F7C/ref=oh_aui_detailpage_o06_s00?ie=UTF8&psc=1
3. Source Code
I have done some power consumption measurements to have an idea about the battery that I need to use.
I saw that the consumption when the Arduino is in sleep mode is around 1.8 mA while it can reach 45 mA when sending the SigFox message.
I made the hypothesis that a bird is coming every ten seconds during 12h and no birds coming at night.
If we check on a complete day, here is what we can see :
In that case, we would have an average power consumption of 6.825 mA.
If we use 4 AA batteries of 1.5 Volts as following, I will get a voltage of 3V and a capacity of 5000mAh.
In that case, I would have to change the battery more or less every month. We can add more batteries if needed.
On the SigFox backend, two POST requests will be send when it receives a new message.
- The first POST request is sent to IFTT in order to tweet. This is the easiest way I have found to tweet from the there.
- It stores the data (humidity and temperature) in a database located on thinger.io.
In order to tweet from the SigFox backend, the easiest way to do it was using IFTTT.
When the SigFox backend receives a message, it sends a POST request with the humidity and the temperature to IFTTT which will format the message and tweet.
I wanted to store the data on database to display them on a web page and I think Thinger.io is a pretty nice and easy way to do it.
You can find the Thinger.io dashboard here : https://goo.gl/V3FNR7
At the moment, it displays the temperature and humidity when the latest bird came to eat.
On Sunday, November 12, I have done the real tests and it works pretty well. Between 11am and 6pm, around 20 birds came to the bird feeder.
Therefore I noticed a bug on the humidity sensor which always displayed 42%.
The rain also generated some SigFox messages at night while no birds were present.
As said in introduction, a couple of features could be developed based on this project. Here are a couple of exciting and interesting examples :
1. More sensors
- In order to have a better understanding when the birds come and eat we could add more sensors. For example a rain sensor and a barometric pressure sensor to see if the birds are still coming when the weather is bad, if they come more often before the rain, etc.
- Another idea would be to add some sensors to detect the level of food and water. Like that, if the bird feeder is away from your place, you can get a notification when it needs to be refilled. For that, we can simply use an ultrasonic sensor on top of the water and food tubes.
2. Make it autonomous
As said earlier, we may need a couple of AA batteries per year. For multiple reasons, we agree it is not a very ecological, it is not convenient to change the battery and at the end it can also be expensive. For that, a solar panel can be added on the roof of the bird feeder.
A size calculation can be made to know why solar panel are needed, depending on the daily sunrise, the exposure, the number of days without sun, etc.
3. Improve the server management
Because it was easier and faster, I decided to use Thinger.io to store the data and display a dashboard.
Therefore, it has some limitation, I can't display on the dashboard the number of entries in the database (aka. number of birds which landed on the bird feeder), I can't send notifications to phones, etc.
A complete control of the backend could be done. For example :
- Custom database
- Web service to decode the SigFox messages and take actions
- Develop a custom web page to see all the statistics
- Develop smartphone apps connected to this database