2WD Self Balancing Robot
SuperDroid Robots, Inc
Contact
224 Technology Park Lane
(919) 557-9162
Fuquay Varina, NC 27526
Revised: February 8, 2019
Page 5 of 6
VNH3SP30.h
Kalman.h
PID_v1.h
Timer.h
To verify this step has been completed properly, you can open a blank Arduino sketch and navigate to Sketch-
>Import Library. The libraries should show up on this list. If not, go to Sketch->Import Library->Add Library
and select the missing libraries.
The firmware will not compile without successfully completing this step.
4.
Once the code is compiling, you are ready to start tuning the PID parameters. The parameter values are
located in the “hardware.h” file within the Self Balancing Robot firmware package.
These values will control
how the motor reacts to off center angles in order to balance. More than likely, these values will need to be
tuned/changed to get good results. If you are new to the PID algorithm please read through
This system has an inner and outer PID loop. The outer loop parameters will affect the target angle needed
to return to the starting position. The feedback sources here are motor encoders. The corresponding PID
parameters are labeled “
SpeedKp
”, “
SpeedKi
”, and “
SpeedKd
”.
The inner loop uses the IMU feedback in order to calculate error between target and measured angles. The
result is a target speed which is sent as commands to the motor controller. The inner loop PID parameters
are labeled “
Angle
Kp”, “
Angle
Ki”, and “
Angle
Kd”.
To start tuning the PID you may tune the inner loop first to
do this you can go to line 58 and set SpeedPID.SetMode(MANUAL). After you have a good tuning you can
set that back to AUTOMATIC.
While tuning these values, it’s advised to elevate the wheelbase until the robot
seems stable. An unstable PID loop due to erroneous parameter values can cause damage to the robot or
its surroundings. There are multiple methods to go about tuning a PID. Please read through the links above
before proceeding.
Operation
For testing/operation, stand the robot straight up and turn on the power. Hold it upright for
approximately five seconds so the robot can calibrate a zero angle and it will begin balancing. For
charging locate the LIPO balance lead and connect to the corresponding charger. Each battery charge
individually.
General Terms
1.
SuperDroid Robots, Inc is not responsible for special incidental or consequential damages resulting from any
warranty or under any legal theory, including, but not limited to lost profits, downtime, goodwill, damage to,
or replacement equipment or property, or any cost of recovering, reprogramming, or reproducing any data
stored. ANY LIABILITY SHALL BE LIMITED TO REPLACEMENT OF DEFECTIVE PARTS. SuperDroid Robots, Inc. is