The Miniature balancing robot: 
A low-cost mobile lab experiment kit for education

MinSeg!

Click here to edit subtitle

Simulink SFunctions, Diagrams, and Supporting Libraries For Raspberry Pi:

These downloads are for the MinSegPi which is comming soon!


Below are several SFunciton written to support the Raspberry Pi in Simulink

Check back often as more are on the way

 

MPU6050 I2C  example for Raspberry Pi Simulink using WiringPiI2C


A simple single axis and full 6 axis example with DLPF using WiringPiI2C to communicate with the MPU6050.  

You must run "gpio load i2c" from the RPi to start the I2C interface.  The text file above explains a method to automatically run this command when your RPi starts

See the Arduino MPU6050 download to view the complete list of MPU6050 registers.

Digital Out SFunciton example for Raspberry Pi Simulink


Simple digital out exmaple showing basic usage of the WiringPi library included in the Mathworks RPi image
 

Soft PWM Out SFunciton 

PWM SFunction using the Soft PWM function in the WiringPi library

 

Motor Driver H-Bridge SFunciton example for Raspberry Pi Simulink (tested with SN754410 and DRV8833)


Basic motor driver SFunction to control magnitude and direciton with a H-Brige driver like the SN754410 and the DRV8833.  The DRV8833 exhibits highly linear behavior and reduced dead band around zero speed by setting zero speed with both PWM lines high (fully duty cycle on both motor leads)

The figure below shows the results if the motor is driven from a zero speed at PWM of zero duty cycle for both the SN754410 and DRV8833 drivers.  Notice the typical dead band at zero speed and the nonliear behavior.

If the motor are driven with from zero speed with both terminals are high, the retulting speed curve is highly linear with much reduced deadband.  

This greatly improves motor response and performance, but may cause increased power draw (power draw has not been measured)
 

Quadrature Encoder SFunction Block


Quadrature Encoder block using interrupt routines from WiringPi