Welcome to installment number twenty three of the Design Challenge Project Summary series here at Element14. For those of you who are new to my content, in this series I will pick a single Design Challenge project from the current challenge, and write a short summary of the project to date. Over the course of each challenge, I try to revisit each project that I cover at least once, and I am sure that some project summaries will get more than one update if they themselves are updated frequently. Unfortunately, projects that stall out, or get abandoned, will not receive any updates. Some project creators like to keep their own project summary going, and this series is not meant to overshadow those post, but to highlight each project from an outsider's perspective.
The subject of this installment is project Plant Health Camera by Gerrit Polder (gpolder). Kicking the project off, Gerrit discussed the merits of using near-infrared bands captured from an infrared sensitive camera to measure several different parameters of soil and plant health in agricultural settings. Drawing off past experiences with the Raspberry Pi Noir camera, he plans to use the new revision of the Pi Noir to develop a system that will enable such analysis in an easy and affordable package. The system will make use of OpenCV, something we have seen used many times in previous design challenges.
There are issues with using just one camera system to gather data, though, and is the basis behind Gerrit’s decision to include a normal Pi Camera into the project as well. The problem is caused by the sun lighting portions of a patch of plants differently due to shadows, sun angle, etc. By adding this second camera, he can capture a normal image and then extract the red channel values. “The NDVI algorithm subtracts the red reflectance values from the near-infrared and divides it by the sum of near-infrared and red bands, he said.” “This formulation allows us to cope with the fact that two identical patches of vegetation could have different values if one were, for example in bright sunshine, and another under a cloudy sky. The bright pixels would all have larger values, and therefore a larger absolute difference between the bands.This is avoided by dividing by the sum of the reflectances.Theoretically, NDVI values are represented as a ratio ranging in value from -1 to 1 but in practice extreme negative values represent water, values around zero represent bare soil and values over 6 represent dense green vegetation.”
In the project’s second update, Gerrit showed off the official challenger kit that had arrived earlier that day. As you can see from the image above, he received the following items.
- Raspberry Pi 3Raspberry Pi 3
- Raspberry Pi model B+Raspberry Pi model B+
- Raspberry Pi Camera V2Raspberry Pi Camera V2
- Raspberry Pi Noir Camera V2Raspberry Pi Noir Camera V2
- Raspberry Pi 7" Touchscreen DisplayRaspberry Pi 7" Touchscreen Display
- 16GB Noobs SD Card16GB Noobs SD Card
- EnOcean PiEnOcean Pi
- EnOcean Pi Sensor KitEnOcean Pi Sensor Kit
- EnOcean Pi Switch Design KitEnOcean Pi Switch Design Kit
- PiFace RackPiFace Rack
Gerrit posted update number three about a month later, and the project build officially began with installing raspbian onto the Raspberry Pi 3 and getting the the Raspberry Pi 7” Touchscreen up and running. I really would have liked to have seen Gerrit post the steps that it took to get the touchscreen up and running, but to his credit, he did post a link to a wonderful tutorial by rhavourd. The update was closed out with a look into the future of the project, and a decision being made on which case he would chose to buy to house the project. The Smarti Pi Touch case was chosen due to its compatibility with the 7” touchscreen, and lego-based camera mounting solutions.
Update number four focused on the Smarti Pi Touch Case and its camera housings. To accommodate the second Raspberry Pi needed for this project, Gerrit purchased the Smarti Pi case, that is compatible with the Pi Touch Case, and also includes lego mounting options. To get this case to mount up to the Pi Touch Case, a mount had to be created, and to do this, Gerrit modified a small piece of acrylic to feature a GoPro style mount that would bolt to the Pi Touch Case’s VESA mounting points. I like this idea a lot, and have been toying with a similar mounting option for my Smarti Pi Touch Case to accommodate two additional Raspberry Pi’s, and impressed with how well it turned out in this instance!
In his fifth update, Gerrit dove head first into OpenCV with the Raspberry Pi 3, and wrote a wonderful tutorial on how to get all of the programs prerequisites installed before installing OpenCV itself. I gave Gerrit a bit of grief earlier in this post for not including a tutorial on how to install the Raspberry Pi 7” Touchscreen, but he completely made up for that with this post. All of the commands you need as well as a tutorial on how to test OpenCV once its up and running. If you are interested in using OpenCV, this would be the post to start with.
Update: 9-24-2016
With the Raspberry Pi 3, and first camera up and running, it was time to focus on getting the second camera and slave Raspberry Pi sorted out, and that is what update number six was all about. Continuing on with the SmartiPi case system, Gerrit piggybacked the Raspberry Pi B+ onto the larger SmartiePi Touch case, and connected the second camera using the unique lego-like mounting system that the second case features. “The slave Pi is connected by using the SSHFS file sharing protocol which allows you to mount a Raspberry Pi's filesystem over an SSH session. This works very convenient,” he said. “In order to set this up I first had to install SSHFS on the client system, the Pi 3 in this case.” The post concluded with the bash commands needed to get everything working.
In update number seven, Gerrit quickly showed us how he managed to sync up both of the camera systems so that each camera snaps a photo at exactly the same time. “I wrote some python code which will run on the slave system. It will wait for a trigger pulse on GPIO 23 and then take an image and save it on the share as described in the previous post. The master system will output the trigger on GPIO 18,” he said. The post was brief due to Gerrit having very little time this week to dedicate to the project, but he did manage to include the bash commands, and the edits needed to the rc.local file that are required to sync everything up.
Update number eight made up for the previous post’s length in a big way. Since the camera’s are both on the same mount, they are somewhat aligned correctly from the start, but for data analysis purposes, they need to be more precisely aligned. This is much easier to do in the software, and trying to modify the lego-style mount that is featured on their case. Using OpenCV, Gerrit was able to successfully test a software alignment method using different algorithms. “Since the cameras are placed next to each other a translation over 1 dimension ( x ) should in principle be sufficient, but since plants are 3D object I expect that the Homography is needed for situations where there is much depth in the images. Luckily using this OpenCV function we can easily test the different options,” he said. With the testing figured out, he asked the community for their input on which algorithm they thought would give the best results, and he linked to a poll at the bottom of the post.
Update number nine tackled a major obstacle for the project: how to extract the BNDVI and GNDVI images from the cameras. To accomplish this, Gerrit had to write a small program in Pyton that would take the color image data from each camera’s photo, and then convert it to either the BNDVI or GNDVI final image. “The range of the original NDVI images is -1 to +1. In order to display this properly I converted these values to the range 0-255 and applied a colormap such that NDVI value 0 is green, -1 is blue and +1 is red,” he said. The image above is the GNDVI example that he posted. In this image the green channel has been extracted by the software, leaving an image that can be processed for the data that is required for comparison to the BNDVI to test a plant’s current condition.
Update number ten was quite short, but interesting nonetheless. Up until this post, both the master and slave Raspberry Pi boards were connected to Gerrit’s home network. This provided an easy backbone for both Pi to talk to each other over. Unfortunately this will not work when they are removed from the home and placed in the garden to monitor his plants. To remedy this situation, Gerrit connected both devices to each other via a single Ethernet cable. Getting this setup to work was as simple as adding four lines of code to the to the /etc/dhcpcd.conf file. This allowed the Pi B+ to piggyback onto the network connection between the Pi 3’s WiFi and the home network. It’s actually an ingenious solution to a pesky problem, and I am sure I will steal this idea for future projects.
Gerrit wrapped up the project in update number eleven with a final push to get everything working together. He briefly detailed the NDVICam program he wrote in python that basically ties everything together, and produces an image that is able to inform the user on a plants health based on the light readings it is emitting. “After quite a bit of hard work during the last days, the project reached its end. Of course many improvements can be made, and other features can be added, but that is for later, after the challenge,” he said. “I had the plan to add humidity, pressure and temperature measurements with the SenseHat, but unfortunately SenseHatSenseHat, Wi-Pi and PiFace digitalPiFace digital were missing from my kit.” He wrapped up the post with some images that were taken of a hydrangea that explain exactly what this system does. Head over to the final post to check it out.
That is going to wrap up my project summary coverage of project Plant Health Camera. Check out the full project by visiting its blog page. Tune in next week for another Design Challenge Project Summary here at Element14. Until then, Hack The World, and Make Awesome!
Top Comments