WOLFRAM SYSTEMMODELER

ModelPlug

Connecting to the real world with Arduino

Package Contents

GettingStarted

Step-by-step guide to running your first model using ModelPlug

Pins

Components to access the board I/O

Boards

Components to connect to the Firmata boards

Examples

A collection of examples to help you get started

Internal

Internal classes that should not be used directly by the user

Information

What Is ModelPlug?

ModelPlug is a library that allows you to connect your simulations with the real world. It uses an Arduino board (or compatible) to send analog and digital signals to physical devices and receive signals from them.

What Can You Do with It?

  • Interact with your model by using buttons, switches, knobs, etc.
  • Input sensor information, for example, about light, temperature, position, pressure, etc.
  • Use actuators like motors, servos, and relays.
  • Quickly prototype your system by using SystemModeler blocks.

 

With ModelPlug, you can combine simulation models and real hardware. For example, you can get data from your hardware, design a control, and test it in real time.

 

 You can build a real control panel and use it to control your simulation models. 

Overview of the Components

ModelPlug provides the following components:

   Inputs  
Analog input Reads analog values from the pins  
Digital input Reads digital values from the pins  
   Output  
Analog output Writes analog values to the pins  
Digital output Writes digital values to the pins  
Servo control Writes the angle to servo motors  
   Board Handlers  
Arduino Connects to Arduino boards like Arduino Uno, Arduino Mega 2560  
Arduino Leonardo Connects to Arduino Leonardo boards and boards using native USB  
StandardFirmata Connects to Arduino-compatible boards  
CustomFirmata Connects to any board supporting Firmata  

How Does It Work?

ModelPlug connects with the boards using USB serial communication. In order to configure, read, and write to the board, ModelPlug uses the Firmata protocol v2.3 (http://www.firmata.org). This protocol allows you to connect not only to Arduinos, but also to many boards compatible with Arduino. Examples of other boards supporting the Firmata protocol are:

  • Teensy Development Board: Using AVR or ARM processors
  • chipKIT: Using PIC32 processors

ModelPlug wraps the functionality of Firmata by providing easy-to-use Modelica models that you can connect in your simulations.

New in Version 1.2

  • Allows defining initial values in AnalogInput and DigitalInput Pins
  • Improved support for Windows 10

Limitations

ModelPlug requires a board with Firmata Version 2.3 or higher.

Currently ModelPlug does not support sensors that communicate through I2C or SPI with the board.

The minimum synchronization interval is 1 ms; therefore, ModelPlug cannot have a sampling interval smaller than that. The standard Firmata allows a minimum sampling interval of 10 ms.

ModelPlug uses a serial protocol; therefore, the transfer speed is constrained by the serial port speed. This can be problematic when reading or writing too many inputs/outputs with a small sampling interval.

Links

Ask questions about SystemModeler and ModelPlug

http://community.wolfram.com

Find out how to connect sensors and actuators to the Arduino

http://playground.arduino.cc

Get details about the Firmata protocol

http://www.firmata.org

The breadboard diagrams were created using Fritzing

http://fritzing.org