A self-balancing ball system using PID #Python #OpenCV #PID @MicrochipMakes
Johan Link describes on Instructables a system that balances a ball on a plate:
This system holds a ball in balance on a plate. A webcam films the system and a python program analyzes the images to find the position of the ball. The python program calculates the tilting of the tray to prevent the ball from falling.
A proportional-integral-derivative (PID) regulator is used to compensate the movements of the ball. The position and speed of the ball are measured by the camera and these measurements are used by the PID regulator in the Python program.
The base is moved using a Microchip ATmega 32u4 microcontroller while the computer vision portion is on a laptop with connected USB camera. The computer uses a Python program and OpenCV to track the orange ball similar to this tutorial.
The code is available on GitHub here. It’s under a CC by SA 4.0 license.
Have an amazing project to share? The Electronics Show and Tell is every Wednesday at 7:30pm ET! To join, head over to YouTube and check out the show’s live chat and our Discord!
Python for Microcontrollers – Adafruit Daily — Python on Microcontrollers Newsletter: A New Arduino MicroPython Package Manager, How-Tos and Much More! #CircuitPython #Python #micropython @ThePSF @Raspberry_Pi
EYE on NPI – Adafruit Daily — EYE on NPI Maxim’s Himalaya uSLIC Step-Down Power Module #EyeOnNPI @maximintegrated @digikey