Pendulum Kit - Tutorial
Topics:
Examples with DAQ1 (USB):
Examples with DAQ2 (NI PCIe-6321), follow the sequence of examples:
-
Example Experiment: Inverted Pendulum Control (coming soon)
Safety Guidelines
(updated on 7/10/2026)


Safety Guidelines
If improperly used, EMB can cause serious injuries!
Every user must read and understand the EMB Safety Manual before using this kit: EMB SAFETY MANUAL (MUST READ)

General Features and Quick Start
The EMB Pendulum kit is similar to the Spring-Mass-Damper Kit (SMD Kit) as it is an attachment to the SMD kit.
It consists of 1 linear slide with optical linear encoder, an actuator with rack and pinion, and the pendulum attachment with an optical rotary encoder and pendulum arm.
To create more complex pendulum plants, components such springs, dashpot, mass blocks, and accelerometer can be added.
IMPORTANT: Operate the device only in the approved orientation, with the breadboard plate parallel to the table surface.
Operation in a perpendicular or angled orientation is prohibited and may result in equipment damage, instability, or personal injury.
Failure to follow these instructions may result in serious injury or equipment damage!
Robots5 assumes no responsibility or liability for injury, damage, or loss resulting from improper installation, improper use, or failure to follow the safety instructions and operating guidelines provided in this manual.
Correct Orientation: The breadboard plate must be positioned parallel to the table surface during operation:


Prohibited Configuration: Never operate the unit with the breadboard plate perpendicular to or angled relative to the table surface:

Certain components are secured with Torx fasteners, which are factory-installed and not intended for user access. These fasteners must not be removed, loosened, or adjusted by the user.
Removal or modification of Torx fasteners may compromise mechanical alignment, create unsafe operating conditions, and result in equipment damage.
Users should only interact with Hex fasteners (not Torx!).

Before using the EMB system, ensure the following:
-
All users read the safety section above and are following safety precaution
-
The power supply to the amplifier is turned off
-
The E-STOP button is pressed to disable any potential motion
-
All components such as pendulum attachment, mass blocks, springs, and dashpots are properly installed and secured for motion
-
The pendulum can swing freely without colliding to the EMB-LM1 encoder cable or table. If your kit has the breadboard legs (add-on components) the height clearance will be sufficient for full swing. If your kit has the standard breadboard feet, placing the kit towards the edge of table or lifting the kit will be necessary to provide enough height for full swing
-
The pendulum encoder cable (EMB-SM1) can move with the carriage and not cause side loading to the pendulum module, biasing its motion
-
The hard stops are properly installed and tested by manually moving the linear slide
Follow the next procedures to run your experiment:
-
Step 1: Plug the EMB-DAQ to the computer
-
Step 2: With the E-STOP button still engaged (disabled), turn on the amplifier power supply. We recommend setting the power supply to 12 V with a 3 A current limit. The ESCON amplifier should power on but remain disabled, as indicated by the red LED. The amplifier's default configuration is Current Mode, so increasing the power supply voltage to 18 V or 24 V will not significantly affect the system's response. However, using a higher supply voltage provides additional headroom to absorb regenerative energy returned from the motor to the power supply.
-
Step 3: Start your software application (MATLAB® and Simulink® for example)
-
Step 4: Enable the E-STOP (turn to reset). The ESCON amplifier should still have a red LED, as the input signal (PWM) and the enable signal are not proper yet (ESCON2 with analog voltage input behavior is slightly different)
-
Step 5: Run your code in the DAQ and be ready for motion
Immediately press the E-STOP in case of unexpected behavior or emergency!
To turn off the system, follow these steps:
-
Press the E-STOP button
-
Turn-off the ESCON power supply
-
Close the software application (MATLAB® and Simulink® for example)
-
For USB-based DAQ: Either unplug the DAQ PWR USB cable from the computer or turn the computer off completely. The DAQ LED should not be illuminated when not in use.
-
For PCIe-based DAQ: we recommend to turn the computer off. The DAQ PWR LED should not be illuminated when not in use.
We strongly advise against leaving the EMB-DAQ and associated electronics powered on for extended periods, such as overnight.
While physically unplugging the USB from the computer or DAQ will power it off, it can cause wear to the USB connector over time. Therefore, turning off the USB port via software or shutting down the computer is the preferred method.
Power Supply for Maxon ESCON
To power the Maxon ESCON with a laboratory power supply, use the included cables to connect to the + and - binding posts using the banana plugs or cables with ferrules with the thumb nuts, as pictured below:



Drive System (Rack and Pinion)
An actuator (EMB-AM2 or EMB-AM4 for example) drives a rack and pinion, applying a force to a carriage. The standard pinion we configure our kits is metric, stainless steel, has 20 teeth, and is module 20. The theoretical acting force radius is 0.01 m (pitch circle).

A small amount of backlash between the rack and pinion gear is normal. During assembly, we use precision gauges and fixtures to set the backlash to the optimal specification.
With the rack and pinion engaged, the carriage should move smoothly throughout its full range of travel when slid by hand. There should be no significant binding, sticking, or locking. If the motion is not smooth, the rack height should be adjusted.
In some cases, the rack may need to be adjusted or reinstalled, particularly if you notice excessive backlash, increased play, or sticky carriage movement. This procedure can be performed by the user; there is no need to return any hardware to the factory. We can provide remote guidance and step-by-step instructions throughout the process. The procedure requires a set of alignment pins and feeler gauges.
Beginning in mid-2026, we introduced an updated rack design that uses a white polyacetal rack instead of the earlier blue nylon version. Polyacetal offers improved dimensional stability and provides smoother, more consistent carriage motion over time. If your system is equipped with the blue nylon rack and you are interested in upgrading to the new design, contact us.
Pendulum Attachment
The Pendulum attachment consists a machined aluminum plate with 2 dovetail clamps, an EMB-SM1 incremental rotary encoder, pendulum rod, and pendulum mass (or disk, to match the terminology used in certain textbooks).
The pendulum rod is secured to the encoder shaft (or potentiometer) with a soft-tip M4 setscrew (2.0 mm hex drive).
To change the dynamics of the pendulum, the mass (disk) can be moved up and down the pendulum rod or removed. Locking the mass (disk) is done with the setscrews (2.0 mm hex drive).
To mount the Pendulum attachment to the linear slide carriage (EMB-LM1 or EMB-LM2), use the dovetail clamp with two M4 fasteners (part of the dovetail clamp) with a 2.5mm hex drive. Note that the Pendulum attachment does not need to be centered with the linear slide carriage.


Two yellow sensor cables with M12-5pole connectors should be used to provide feedback from the linear and rotary encoders. Our code examples assumes that the EMB-LM1 (linear carriage encoder) is connected to "Encoder 1" of the DAQ and the pendulum rotary encoder EMB-SM1 to "Encoder 2". Of course, this can be easily changed if preferred.
Make sure the sensor cable of the rotary encoder is free to move with the carriage movement (side-to-side).
Hard Stops
The proper use of hard stops is critical to prevent permanent damage of the linear slides and/or dashpot module from an end of travel collision, by limiting the travel to a safe region.
The contact point on our hard stops have a durometer 70A rubber bumper. There should never be metal-to-metal contact!

To secure the hard stop to the breadboard, an M6 fastener and washer is used (orient the washer face with the rounded edge away from the anodized surface, so no surface damage occurs due to washer edge burrs):

If the fastener is excessively tight and requires additional torque for removal, use the L-Allen wrench supplied with the EMB-Spring Set rather than the precision screwdrivers to avoid tool damage and ensure proper leverage.
The placement of the hard stops vary depending on your plant configuration and needs, we recommend at least 10 millimeters of buffer, between the internal hard stop of the linear slides (EMB-LM1 or EMB-LM2) and the external hard stop. Remember, the internal hard stops of the linear slides should never be used as system hard stops, as they are not meant for external loading, only internal to hold the bearing balls in place. Please refer to the EMB-LM1 manual for additional details.
For the Pendulum Kit, 2 hard stops are required (left and right).
End of Travel Limit Switches (EoTS)
As an optional module for our EMB systems, the End-of-Travel Switches (EoTS) enhance functionality and safety. Their primary purpose is to serve as limit switches: when triggered, a fault is generated and the system stops. Additionally, the EoTS can be used to home the carriage position.
The only contact point of the switch and the moving carriage should be the switch lever.

We offer a right and a left EoTS designed for each side of the linear slide.
To secure the hard stop to the breadboard, an M6 fastener and washer is used (orient the washer face with the rounded edge away from the anodized surface, so no surface damage occurs due to washer edge burrs):

These EoTS should not be used as hard stops, this will cause permanent damage. The switches should be placed right before a hard stop. Make sure the switch opens (clicks) but the switch doesn't bottom out before hitting the hard stop.
For placement, you can make use of the mount slot and the angle adjustment M6 fastener. Make sure all fasteners are secured before running experiments and no cables are on the travel path (cables not shown in renders).
Connect the EoTS switches to the EMB-EoTS Module with the 3.5mm stereo connectors. The EoTS module connects to the EMB-DAQ1/EMB-DAQ2 using the cable with pigtail with ferrules (no polarity).
Depending on the size of your kit and the number of switches, the EMB-EoTS module will have 2, 4, or 6 switch inputs. These inputs are connected in series and all switches must be connected for the circuit to be closed.
Nomenclature legend:
- SW1-L: Left Switch of carriage 1
- SW1-R: Right Switch of carriage 1
- SW2-L: Left Switch of carriage 2
- SW2-R: Right Switch of carriage 2
- SW3-L: Left Switch of carriage 3
- SW3-R: Right Switch of carriage 3

When driving the motor, for instance in a Controls experiment, we strongly recommend using end-of-travel switches on both sides of the driving carriage (with the rack-and-pinion).
Example Experiment: Inverted Pendulum Control with DAQ1 (USB)
(updated on 7/10/2026)
EXAMPLE: Inverted Pendulum Control, LQR and Observer
With this example, we develop a mathematical model for the plant, design a controller using LQR, implement an observer to get all states (carriage position, carriage velocity, pendulum angle, and pendulum angular velocity), and run in real-time.
The setup uses our EMB-SMD 1DOF kit (or EMB-Pendulum Kit), with EMB-AM4 actuator, a maxon ESCON amplifier in current mode (standard configuration), and an EMB-DAQ1 with MATLAB® and Simulink®.

You can download the model by clicking here: R5_EMB_INVERTED_PENDULUM_DAQ1.ZIP (205KB) or from our GitHub. Make sure to always use the latest version.
Always be aware of the carriage(s) location and pendulum angle before running the program, as the encoder is an incremental encoder, not absolute. When the program starts, the encoder position is set to zero.
The pendulum rod starts at the low position and is slowly moved up manually counter-clockwise. It is important to move it slowly to avoid aggressive motion when the LQR controller is engaged. Moving it up slowly also allows enough time for the observer to converge.
Make sure the carriage travel is sufficient for the experiment. Limit the input force as necessary to avoid end of travel collisions.

To apply a force to the carriage, we apply a current to the motor. With the ESCON configured in current mode (refer to maxon ESCON Amplifier - Tutorial for details), we input a PWM to the N0 block (General Pulse Output), with a gain of 0.159. Note that we need to bias the PWM signal (0.1 to 0.9 range for the ESCON) and take the absolute value of the input signal.
To convert force to current, we divide the pinion radius by the torque constant of the motor. The pinion used has 20 teeth and has module 1.0, therefore the theoretical radius is 0.01m.
For the direction of the force, we use a "Compare To Zero" block and set the Digital Ouput as high/low.
In addition to the E-STOP, the system implements a software-based travel limit using the encoder position. The cart position is continuously computed from the encoder measurement. The absolute cart position is compared against a predefined travel limit (|Position| ≥ 0.035 m, change as needed). If this limit is exceeded, the comparator outputs a Boolean fault signal indicating that the cart has moved beyond the allowable operating range, stopping the model.
The Subsystem is pictured below:

To run the model:
-
In the MATLAB® Command Window, enter the sampling time (T=0.001, for example) and simulation Stop Time (S=inf). These variables can be incorporated into a MATLAB® Script (.m file) that runs before the Simulink® model. We included an .m script with the link above for download. We recommend using sampling time between 0.001s to 0.010, depending on your model. Be careful with signal noise due to spatial quantization and excessive phase lag. We find a sampling time of about 0.002s to 0.004s is a good balance for our electro-mechanical plants. Here we use 0.001s to push the dynamics of the system. You might need to change to 0.002s ~ 0.004s depending on your computer's specs.
-
Run the necessary parts of the script before running the Simulink® model. This will set the parameters and gains needed in Simulink®.
-
In Simulink®, open R5_EMB_INVERTED_PENDULUM_DAQ1 model, enter the DESKTOP REAL-TIME tab, and click Run in Real-Time. If you run the model from the SIMULATION tab (green Run button), it won't work properly, and the EMB-DAQ1 will need to be reset. To reset the DAQ, power cycling the board is required by unplugging the USB cable and DAQ power cable, waiting 10 seconds, and plugging back into the computer and power supply.
-
After clicking in Run in Real-Time, many processes take place, including building, code generation, and deployment of code to the target. These processes take between 5s and 30s.
-
If the model doesn't run, check if the E-STOP or one of the End-of-Travel-Switches (optional) are pressed.
-
To stop the model from running, you can click Stop in Simulink®, press the E-STOP (if configured), press the End-of-Travel-Switch, or any logic fed into the Stop Simulation Block in Simulink®. We strongly recommend the use of these features to keep operation of EMB safe!

Looking a bit deeper into the R5_EMB_INVERTED_PENDULUM_DAQ1 script, we set plant parameters for a mathematical model. These are a mixture of measured, experimental, and guessed parameters. For improved performance, we recommend you performing system identification in your system to get better values:

Next we generate the State-Space matrices:

Pole-Zero Map:

We include LQR gains chosen manually by experimentation (you may need to choose different gains for your configuration):

We also included a Physics-based tuning process to select LQR gains:

Lastly, we implement an Observer to get the carriage velocity and pendulum angular velocity:

