Creating a PID (Proportional-Integral-Derivative) control project in Tinkercad Circuits
is an excellent way to simulate real-world automation without needing physical hardware. Top Tinkercad PID Projects
The most common and effective "pieces" to build involve stabilizing a system using an Arduino Uno DC Motor Speed Control
: Use a DC motor with an encoder to maintain a precise RPM. The PID controller adjusts the
(Pulse Width Modulation) signal to keep the motor spinning at your target speed, even if you apply physical resistance. Temperature Regulation : Build a system using a TMP36 sensor
and a heating element (simulated with a resistor or LED). The PID loop manages the heat output to reach and hold a specific temperature. Servo Position Tuning servo motor
where the setpoint is controlled by a potentiometer. This is a classic "robotic arm" simulation where the PID ensures smooth, jitter-free movement to the target angle. Essential Components
To get started, you'll typically need these items from the Tinkercad library: Arduino Uno : The brain that runs the PID math. Potentiometer
: Used to manually adjust the "Setpoint" (your desired target). rotary encoder for speed or a LCD Display
: Helpful for visualizing the Error, Setpoint, and Output values in real-time. Actionable Tip: Use the Serial Plotter One of the best features for PID in Serial Plotter . By printing your ActualValue tinkercad pid control
to the Serial Monitor, you can open the graph view to watch the "curves" as your controller hunts for stability. This is the easiest way to visually tune your Kp, Ki, and Kd constants sample Arduino code snippet
to paste into your Tinkercad project to get a motor running? DC Motor Speed Control System using PID - Tinkercad DC Motor Speed Control System using PID. PID Servo Position Controller Using Temperature - Tinkercad
PID Servo Position Controller Using Temperature - Tinkercad. PID SPEED DC MOTOR CONTROL - Tinkercad
This is a remix of LCD + PID SPEED DC MOTOR CONTROL by Alessandro Pilloni. PID speed control of a DC motor - Tinkercad PID speed control of a DC motor - Tinkercad. PID Control - Black DC Motor with Encoder - Tinkercad
Proportional-Integral-Derivative (PID) control in Tinkercad allows you to simulate precise system regulation, such as maintaining a constant motor speed or temperature, without risking physical hardware
. Since Tinkercad does not support external library uploads, you must implement the PID logic manually or paste the library code directly into the text editor. 1. Essential Components for a PID Circuit
To build a functional PID simulation, you typically need three main parts: The Controller (Arduino Uno): Processes the PID algorithm. The Feedback (Sensor): Provides the current "state" of the system (e.g., a Potentiometer for position or a for temperature). The Actuator: The device being controlled, such as a with an H-Bridge driver (like the L293D) or a (simulated by an LED or specialized circuit). 2. Implementation: Basic PID Code Structure
Below is a foundational structure for a PID controller in Tinkercad's "Text" code view. This example uses a potentiometer as feedback to reach a specific setpoint. // PID Constants - Adjust these to "tune" your system // Proportional // Integral // Derivative setpoint = // Desired target (middle of 0-1023 range) lastError = integral = setup() { pinMode( , OUTPUT); // PWM Output to motor/LED Serial.begin( currentVal = analogRead(A0); // Feedback from sensor error = setpoint - currentVal; // Calculate PID terms integral += error; derivative = error - lastError; // Compute total output
output = (Kp * error) + (Ki * integral) + (Kd * derivative); // Constrain output for PWM (0-255) pwmValue = constrain(output, ); analogWrite( , pwmValue); You can view and "tinker" with these community-made
lastError = error;
Serial.print( "Target: " ); Serial.print(setpoint); Serial.print( " | Actual: " ); Serial.println(currentVal); delay( Use code with caution. Copied to clipboard Manual tuning tip: Start with at zero and increase until the system responds quickly. Then add to remove steady-state error and to reduce overshoot. 3. Top Project Examples to Explore
You can view and "tinker" with these community-made PID models:
We don't have external libraries in standard Tinkercad, so we will write a simple PID class.
// Simple PID Structure float setpoint = 50.0; // We want 50 degrees Celsius float input, output; float Kp = 10, Ki = 0.5, Kd = 5; // These are "Tuning" constantsfloat integral = 0; float previous_error = 0; unsigned long last_time = 0;
float computePID(float setpoint, float input) unsigned long now = millis(); float time_change = (now - last_time) / 1000.0; // Seconds if (time_change <= 0) time_change = 0.1;
// Calculate Error float error = setpoint - input;
// Proportional float P = Kp * error;
// Integral (Accumulate error over time) integral = integral + (error * time_change); float I = Ki * integral;
// Derivative (Rate of change of error) float derivative = (error - previous_error) / time_change; float D = Kd * derivative;
// Total Output float output = P + I + D;
// Clamp output to PWM range (0 to 255) if (output > 255) output = 255; if (output < 0) output = 0;
// Save for next loop previous_error = error; last_time = now;
return output;
// PID temperature control for Tinkercad simulation
#include <PID_v1.h>
const int sensorPin = A0;
const int pwmPin = 5;
double setpoint = 50.0; // target temp (°C)
double inputTemp; // measured temp
double outputPWM; // 0..255
// PID tuning
double Kp = 25.0;
double Ki = 0.8;
double Kd = 120.0;
PID myPID(&inputTemp, &outputPWM, &setpoint, Kp, Ki, Kd, DIRECT);
unsigned long lastMillis = 0;
const unsigned long sampleTime = 1000; // ms
// convert ADC to temperature for 10k NTC (simple approximation)
double adcToTemp(int adc)
double V = adc * (5.0 / 1023.0);
double Rfixed = 10000.0;
double Rntc = Rfixed * (5.0 / V - 1.0);
// Steinhart-Hart (approx constants for common 10k NTC)
const double A = 0.001129148;
const double B = 0.000234125;
const double C = 8.76741e-08;
double lnR = log(Rntc);
double invT = A + B*lnR + C*lnR*lnR*lnR;
double Tkelvin = 1.0 / invT;
return Tkelvin - 273.15;
void setup()
pinMode(pwmPin, OUTPUT);
analogWrite(pwmPin, 0);
myPID.SetOutputLimits(0, 255);
myPID.SetMode(AUTOMATIC);
Serial.begin(9600);
void loop()
if (millis() - lastMillis >= sampleTime)
lastMillis = millis();
int raw = analogRead(sensorPin);
inputTemp = adcToTemp(raw);
myPID.Compute();
analogWrite(pwmPin, (int)outputPWM);
Serial.print(millis()); Serial.print(",");
Serial.print(inputTemp); Serial.print(",");
Serial.println(outputPWM);
Most PID tutorials jump straight to hardware: an Arduino Uno, a DC motor with an encoder, an H-bridge, and a pile of jumper wires. If something goes wrong (oscillations, smoke, a loose wire), debugging is a nightmare for a beginner.
Tinkercad eliminates those barriers:
In other words, Tinkercad is the ideal PID sandbox.