กลับไปหน้ารวมไฟล์
pid-position-control-of-a-levitating-balsa-disc-assembly-inside-a-graduated-cylinder-12f2ed-en.md

The PID Position Control of a levitating balsa disc assembly inside a 500ml graduated cylinder is a system designed for educational purposes . It complements the PID Temperature Control of a Miniature Thermal Chamber project found on Arduino Project Hub at https://projecthub.arduino.cc/lenfromtoronto/pid-temperature-control-of-a-small-thermal-chamber-df6567 in that it is a relatively fast responding process control system with very different process dynamics compared to the PID Temperature Control system. These differences will require very different PID tuning constants.

The system could be used as an inexpensive process control lab with many useful educational outcomes such as developing an understanding of process control and the effects of process dynamics on selecting the optimum PID (proportional, integral, and derivative) tuning constants. The lab would be suitable for students in electrical/electronics, mechanical, or chemical engineering / engineering technology .

The electronics for the P ID Position Control System project and the PID Temperature Control of a Miniature Thermal Chamber project is the same . The IDE is the Arduino IDE and the serial plotter is used for both. Only the C code will differ.

The system hardware consists of a 500 ml plastic graduated cylinder with the bottom reamed out, a control board and an interface board , two 12 V DC fans , and an ultrasonic sensor . The balsa disc assembly is easily constructed using 4 pins and 2 45 mm discs cut using an exacto knife.

The control board consists of an Arduino Nano , a setpoint potentiometer for setting desire position in cm and a disturbance potentiometer that adjusts the disturbance fan.. The outputs from the Nano are 2 pulse width modulated signals that produce a variable DC voltage that drives the 2 fans.

The interface board utilizes 2 N Channel power Mosfets and uses the PWM signals from the Nano to produce a PWM output with a maximum voltage of 12VDC to supply the ther2 fans.

The following is a block diagram of the system:

The Arduino Serial Plotter is used to display the Position, Position Setpoint and the Disturbance. The following are the commands that are set from the Arduino IDE Serial Plotter:

  1. PB+ Doubles the current Proportional Band (decreasing the gain).
  2. PB- Halves the current Proportional Band (increasing the gain)
  3. Ti+ Doubles the current Integral Time
  4. Ti- Halves the current Integral Time
  5. Td+ Increases the Derivative Time by 0.1 sec
  6. Td- Decreases the Derivative Time by 0.1 sec
  7. enDist Enables the Disturbance Fan to turn on and off in a square wave manner
  8. disDist Disables the On/Off Square wave action of the Disturbance Fan turning it Off

The video describes the features and operation of the system.

The features of the PID Position Control are as follows:

  1. Graduated Cylinder and Balsa Disc Assembly
  2. Standard 500 ml plastic graduated cylinder
  3. HCSR04 Ultrasonic Position sensor
  4. 2 45mm balsa disc assembly
  1. PID Controller
  2. Standard (sometimes called Mixed) algorithm
  3. Most commonly used in industry
  4. Reverse Acting

Display

Runs independently with LCD display or along with Arduino Serial Plotter

LCD

  1. Position Cm
  2. Setpoint cm
  3. Proportional Band
  4. Integral Time
  5. Derivative Time
  6. Proportional Component in %
  7. Integral Component in %
  8. Derivative Component in %
  9. Controller output - total of three PID components in %

Electronics

Arduino Nano microcontroller

  1. Connects to LCD Display via I2C bus
  2. Generates 2 PWM outputs to Power Mosfet Interface board
  3. C Code generated from Arduino IDE
  4. Setpoint and disturbance generated from 2 potentiometers connected to Nano analog inputs
  5. Ultrasonic Sensor calibrated 0 to 27 cm

Interface Board

  1. Power Mosfets IRF540N are switched at 490 Hz and operate via Pulse Width Modulation to vary the voltage on the heaters
  2. Red LED intensity varies with Voltage supplied to the heater
  3. Yellow LED intensity varies with Voltage supplied to the fan

Fluid Dynamics & Calculus: The Levitating PID Cylinder

Controlling the speed of a car on the ground is simple physics. Suspending an object perfectly in open space while battling gravity and turbulent wind vectors is a monumental control-systems problem. The PID Levitating Balsa Disc project violently forces the Arduino processor to read ultrasonic proximity data 200 times a second, adjusting a massive Brushless Drone Motor (EDF fan) to blast a column of air underneath a disc, achieving stable, unassisted aerodynamic levitation!

The Floating Physics Trap

If you supply a simple static 50% PWM speed to an upward-blowing fan inside a cylinder, the disc will NOT levitate at 50%. It will violently bounce from the floor, fly to the ceiling, smash the glass, and fall back down!

  1. This is because Air Friction (Drag) is non-linear.
  2. The Sensor Interface: An HC-SR04 Sonar or ToF Sensor is mounted at the very top of the massive acrylic cylinder, pointing down. It constantly measures exactly how far away the floating balsa-wood disc is (e.g., 45.4cm).

Overruling Gravity (PID Control Logic)

The Arduino implements the heavy <PID_v1.h> algorithm architecture specifically to tame chaotic turbulence.

  • When the user turns a potentiometer knob to Target Height: 20cm, the code creates an massive error delta!
Setpoint = 20.0; // Where we WANT the disc
Input = getSonarDistance(); // Where the disc IS right now (e.g. 45!)
myPID(&Input, &Output, &Setpoint, Kp, Ki, Kd, DIRECT);
analogWrite(fanMosfetPin, Output); // Violently change the fan speed based on PID calculation!
  • The Derivative Braking: As the massive fan blasts the wood disc from the floor up toward 20cm, the (D) factor of the calculus algorithm recognizes it is flying upwards too fast. It violently kills the fan power to 10% right before it reaches the target, gently capturing the disc and perfectly suspending it motionless in mid-air!

Aerodynamic Control Hardware

  • Arduino Uno/Mega (Mega preferred if you are running graphic-heavy tracking output on an LCD simultaneously!).
  • Large Acrylic or Polycarbonate Graduated Cylinder (Usually 3 feet tall).
  • EDF (Electric Ducted Fan) Brushless Motor + corresponding Electronic Speed Controller (ESC). Note: ESCs must be controlled using the <Servo.h> writeMicroseconds() protocol, NOT analogWrite()!
  • A 12V High-Amp Power Supply or massive 3S LiPo battery.
  • HC-SR04 Sonar or a VL53L0X Laser Tracker.

How Does the PID Work?

Before the use of microcontrollers and computers PID controllers were implemented with analog electronic devices, the principle one being the operational amplifier.

Implementing PID control digitally uses an algorithm. There are several versions of the PID controller. The one implemented in this project is sometimes referred to as the Mixed or Standard implementation.

The mathematics of the PID mixed PID controller can be represented as the following.

Mixed PID

Where:

Kc is the controller gain, Ti is the integral time, Td is the derivative time, and e is the error. Sometimes controller gain is represented as Kc = 100%/PB where PB is referred to as Proportional Band . A smaller PB then results in a larger gain .

The following is pseudo code for implementing the PID algorithm. It is not in the form of an actual programming language but more in the form of a flow diagram.

ข้อมูล Frontmatter ดั้งเดิม

apps:
  - "1x Arduino IDE 2.2.1"
author: "lenfromtoronto"
category: "Science & Simulation"
components:
  - "1x 5 mm LED: Red"
  - "2x Resistor 220 ohm"
  - "2x Diode 1N4001"
  - "1x 5 mm LED: Yellow"
  - "1x Yungui 12 PCs Universal PCB Board Single Sided"
  - "1x 5K Potentiometer"
  - "1x Ultrasonic Sensor - HC-SR04"
  - "1x Arduino Nano"
  - "1x Rotary Potentiometer, 10 kohm"
  - "1x Gikfun 2 pin and 3 pin Screw Terminal Blocks"
  - "1x 500 Ml Graduated Cylinder"
  - "1x Jumper wires (generic)"
  - "1x Soldering Station"
  - "1x Resistor 10k ohm"
  - "2x irf540n n-channel mosfet"
  - "1x Alphanumeric LCD, 20 x 4"
  - "2x Fan 12 V 50x50x10 mm"
description: "Pneumatic flight mechanics! Execute incredibly dense PID array stabilization algorithms to battle dynamic air-drag physics, levitating a heavy disk perfectly in mid-air using PWM brushless fan manipulation."
difficulty: "Intermediate"
documentationLinks: []
downloadableFiles:
  - "https://projects.arduinocontent.cc/b456be0b-4695-4000-9913-3c75d6f72fa7.ino"
encryptedPayload: "U2FsdGVkX18cCygUfXwuPs2mTbgWdlU4pA8A92LnQD5CnN2N5Y8XKdFwQBGFR+WmG9rBWn4oNMA1dleknanvWETx/wiuNNEXgarUJiMI4d0="
heroImage: "https://cdn.jsdelivr.net/gh/bigboxthailand/arduino-assets@main/images/projects/pid-position-control-of-a-levitating-balsa-disc-assembly-inside-a-graduated-cylinder-12f2ed_cover.jpg"
lang: "en"
likes: 0
passwordHash: "1c479000130641c1fa3effb508272c57a8ddffe9f77657da2dd5e42a63cd4245"
price: 699
seoDescription: "PID Position Control of a levitating balsa disc inside a Graduated Cylinder. A project to teach control of a fast responding positional system."
tags:
  - "Embedded"
title: "PID Position Control of a Levitating Balsa Disc Assembly Inside a  Graduated Cylinder"
tools: []
videoLinks:
  - "https://www.youtube.com/watch?v=CjTJ0bQsVH4"
views: 1741