I started researching and growing an automated food growing system in 2009. After a decade of passively working, I finally had a design that was worthy of a first implementation in early 2020.
Raspeberry Pi Quadcopter Hacking
In order to begin acquiring real world data, I needed a cheap, computer vision controlled quadcopter. Unfortunately, there wasn’t anything that quite did what I needed, so I had to create it myself. Here’s an overview of how I used a Raspberry Pi 4 and Pi Cam to hack a JJRC H36F Mini Drone and control it with computer vision.
I picked the JJRC H36F Mini Drone because it’s not only a quadcopter, it’s also a hovercraft.
Instead of buying a separate controller and emulating the quadcopter protocols, I opted to hack the controller that came with the drone. I sell the quadcopter with a modified controller, but here’s how to make one If you want to buy your own set and know how to solder:
Pins 8, 10, 12 and 16 are data lines I selected at random, but these are the pins that I picked for use in the program I wrote, so keep that in mind if you want to change the pins. I will eventually post the entire process, including the code that got me from a Raspberry Pi, a Pi Cam and a $20-30 quadcopter to a computer vision controlled quadcopter. For technically savvy readers however, here’s an overview of what I did:
- Wrote a program to simulate the joysticks. I found that on a scale of 1-100, a .01 second delay between accepting user input is best, and that it is best to adjust the throttle by steps of 2 and the tilt by 1 when first experimenting with quadcopter in flight.
- After getting control of the quadcopter with the keyboard, I installed OpenCV python libraries that allowed me to use computer vision with the Raspberry Pi Camera video.
- Added a filter that was able to track the red light on the hovercraft and put a box around it to show tracking for the user.
- I put a vertical line on the screen representing where I wanted the hovercraft engine shutoff to occur.
Here is a video of the results:
I ended up taking a break at this point because I realized that some of the AI I needed would require more work than I was willing to put in at that time. With recent leaps forward in AI capabilities, I will hopefully be able to move forward in 2025 only needing to do a fraction of the work that would have been required had I continued to work to complete this project back in 2020. I’ll post about progress as soon as is legally feasible.