Deploy Controller to Hardware

By combining with the Microcontroller Kit, you can quickly generate and deploy code on a microcontroller to make it run a standalone controller. In this example, a controller to balance a ball on a beam is designed and deployed.

Find a linearized state-space representation of the relationship between the position and velocity of the ball and the beam angle.

Calibrate models for the hardware components and get their transfer functions. You can refer to the Microcontroller Kit in the Documentation Center and follow along with the step-by-step instructions.

Get the transfer functions for the IR sensor, servo and potentiometer.

Limit the extreme movements of the servo and model the comparator and a component transforming the PID output to the suitable servo input.

Obtain a PID controller using the auto-tuning features, based on the linearized model.

Connect the modeled hardware components and create a feedback model with the PID controller.

Define the machine-specific settings to communicate with the Arduino Uno board.

Set up the servo library and connections to pins on the Arduino.

Define the sampling period.

Deploy the controller into the Arduino Uno.

Related Examples

de es fr ja ko pt-br zh