Inspiration & What it does?
This project is created during Major League Hacking (MLH) Electric City Hacks 2016. We received the 3rd place by Major League Hacking, and the SAP innovation award.
The inspiration for this project started after reading about big data in Agri-tech and the use of drones in the farm management system. Researchers are trying to use drones to find out the quality of their crops on a large scale via imaging. What if by using modular ground level sensors we could also easily assess the quality of the farmland at the current time and also be able to monitor long and short term trends? This will also allow us to cross check with drone imaging and all together create a big data warehouse which could give a lot of information to users.
The problem is sensors/server are expensive, are hard to setup for non-technical people and the interfaces are user friendly. As a farmer, I want to have access to my farms current state from wherever I am in the world and if I ever decide to expand my farm, I should be able to connect more sensors easily. Farm yard does just that. Our dashboard allows you to look into the state of your farm in one glance and look for any potential hazards. It is connected into a distributed server in such a way that, adding a new sensor is as easy as plugging one wire.
How we built it
The hardware system is designed to be modular and portable. The central part of the system is a box with 8 separate input ports, along with the microcontroller (ATmega2560) inside. There is also a Nest Camera on the top of the box, mounted on a motor. The box is designed to be modular and can recognize incoming sensor with set-ups from the dashboard. The box is open to most of the digital and analog sensors. (ex. soil-Moisture, light, fire, water level, heat-motion, temperature, humidity, etc.).
The software system is based on Sinatra, the reason we used Sinatra over Ruby on Rails is because Sinatra is very lightweight. Using Sinatra, we would do a GET request to a server to get a JSON file, which is then parsed by the controllers to separate data out from 8 different sensors that are fed in at the same time using a serial port on our micro-processor. This data is then connected to a dashing framework which is based on jQuery, Bootstrap, HTML5 and SCSS front end in real time. We run a multi-threaded program within the controller which does a periodic polling every 1s and gets new data.
Communication between hardware and server
For our project we decided that we need one dedicated person to guide us through the project as multi-tasking is the enemy of greatness.
Versions (Milestones): FarmRadar Hardware (Mohammed Ridwanul & Simon Zirui Guo): Version 0 (Minimum Viable Product): One sensor’s data is captured onto a micro-processor. Version 1: One sensor’s data is captured onto a micro-processor and fed into a computer via a streaming server. Version 1.1: 3 sensor’s data is captured onto a micro-processor and fed into a computer via a streaming server. Version 2: 8 sensor’s data is captured onto a micro-processor and fed into a computer via a streaming server.
FarmRadar Software (Joshua Arts & Jason Cheung): Version 0: Sample sensor data is parsed and displayed onto an HTML5 page dynamically. Version 1: Sinatra framework is setup and data displays on erb template accurately. Version 3: Front end development is completed, data is visualized. Version 4: Interface is made to connect front end to actual server data from sensors.
The software and hardware is worked on in parallel and independently because they are only dependent on a client-server relationship.
We used Tello to keep care of organizing tasks.
Challenges we ran into
Tested several kinds of wireless communication, and tries to create .json file for server. Creating a server and having a real time changes of data in python is surprisingly difficult. We were introduced to various concepts in CGI etc. But it's capabilities of a built in wifi made it attractive. We decided to adopt an Arduino instead because of our familiarity with C and the platform.
The most problems we faced were in software actually. The fact that we settled on a Sinatra app without much knowledge of it seemed difficult. Sinatra connect models, views and controllers in a very "magical" way that took a lot of exposure to get used to.
Nest Camera (livesteam)
We got the camera connection with the computer, but there is huge delay between frames due to the poor wifi environment. We decided to abandon it to improve user experience, but for future development, we will try to get this feature working.
Accomplishments that we're proud of
- Our system has been generating interests in the community. Professor Omar Alam, wants to use the data we receive cross-check them with drone images to assess the health of crops. He is now in talks with the Ministry of Environment in Peterborough to see how they can use a more complete version of our system.
- Our system is fully modular and portable.
- Our system gives the user rapid feedback and warns them of any potential hazards.
- Our system solves a real world problem.
- We can build upon our system, to do Big Data Analysis, to find out when is the best time for different crops and how environment conditions effect crops.
- Some of us were brought up in a farm and it feels good to contribute via technology.
What we learned
- Sinatra, ruby on rails, hardware hacking, building server, parsing data, taking care of edge cases, project management, big data strategy, python, raspberry pi 3, Arduino, sensor calibration.
What's next for Farm Radar
We plan to continue to pursue this project in the open source space as we feel this can help the environment and help us grow better crops! We plan to use more I2C pins in order to connect more sensors, and also auto-recognize the input sensor.