Code Monkey home page Code Monkey logo

pid-ballonplate's Introduction

PID-ballonplate

the complete assembly

A simple-ish project using a Raspberry Pi and three servos.

SEE IT IN ACTION!

Principle behind the project:

  1. A Pi camera tracks the position of the ball, using OpenCV. A mask is first applied separating the orange color of the ball from the rest. The mask is then eroded twice, blurred, and finally a 'smallest enclosing circle' command returns the radius and the center position.

  2. This information is then filtered by radius. If it is part of the range of radii that the ball is expected to have, the program calculates the error between the position of the ball and the center of the plate. Three errors total are calculated, one for each servos' line of action.

  3. These three errors are then input in the three PID Controllers, including past errors and past derivatives. The PID Controllers then output a change of angle for each servo, which is first normalized against computing time to account for small variations, and then sent using AdaFruit's servo library to the motors.

Improvements / Failures

My current platform is unstable at best, and requires constant recalibration (Done through the GUI); a more stable platform could be obtained with a better interface between the arms. Ball bearings could be used to further smoothen the motion of the platform, and more drastically three more servos could be added for a full on Stewart platform. At this scale however with this level of precision, the current platform is suitable enough.

One could also use Dynamixel Servos for a more accurate position control, although this would significantly increase the price of the whole assembly.

Parts list :

  • Raspberry Pi 4b 8 gb
  • Pi Camera V2
  • Adafruit Camera cable extension
  • Three DIYMORE Full metal servos
  • Waveshare Servo HAT
  • Pimoroni Fan Shim
  • Three Dexter Cardan Joints (Universal joints)

The rest of the parts are 3D printed.

Part selection really doesn't matter that much apart from the RPi and the PiCamera. Use what is available to you for a fair price, and adapt the parts to your needs.

Want to replicate this project yourself ?

Great idea! If you need any help, feel free to shoot me a message on reddit (/u/parisiancyclist) or Instagram (@nicohmje). You can also directly contact me through GitHub.

Happy building!

pid-ballonplate's People

Contributors

nicohmje avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.