Arduino Robot Arm

The Wolfram ModelPlug library allows you to connect your simulation models to the real world using Arduino boards, thereby further increasing the capability for fast prototyping in SystemModeler. Here, we will show how ModelPlug can be used to interactively control a robot arm from a control panel.

Combining Simulation Models and Real Hardware

The models used in this example were created with the ModelPlug library and basic blocks from the Modelica Standard Library. A very useful feature in connecting hardware to SystemModeler is that no manual coding is required, only graphic drag-and-drop modeling, which makes fast protoyping simpler and more time efficient.
The simulation model as seen in the diagram view in Model Center, with the control panel and robot arm models expanded. Continuous filters from Modelica.Blocks are used to filter the signals from the control panel and thereby achieve softer transitions when the robot arm moves from one position to another.
The simulation model contains, besides blocks from the Modelica Standard Library, a control panel model and a robot arm model that are both based on components from the ModelPlug library, among others. The control panel model is linked to a physical control panel through a USB port on the computer. The port number is set as a parameter in the model (see below). The physical robot arm prototype is connected to the robot arm model in the same manner.
The physical control panel is connected to the control panel model by specifying the Port parameter, which in this case is "COM3".

Real-Time Interactivity

With the simulation model and hardware set up, we can now simulate the model and use the knobs on the physical control panel to control the movements of the robot arm, all in real time.
The experimental setup with hardware (control panel, robot arm) and software (simulation model in SystemModeler).
Check out the video below to see how the control panel is used to steer the robot arm using SystemModeler and the simulation model as an interface between them.
Three different knobs on the control panel are used to control the three different servo motors, each with an angular range of 0-180 degrees. Each plot visible on the laptop screen corresponds to the signal from one of the servos.