File Exchange Pick of the Week

Our best user submissions

Lego Mindstorms EV3 Bike Project

Sean‘s pick this week is Lego Mindstorms EV3 Bike Project by Michele Basso and a team of students at University of Florence.

This submission contains the work done for a senior design project to build a Lego motorcycle and control it. The authors
have provided:

  • Simulink simulation model, including 3d animation!
  • Simulink model that is connected to the Lego
  • Lego hardware design steps
  • MATLAB script to generate parameters used by the models
  • Report and presentation covering the project

They’ve also provided a very nice overview video. In it, one of the authors describes the hardware design, and discusses how Simulink was used to design the controller.

Because there is a simulation-only model, those of us without the hardware can run it and see the behavior with the 3d animation.
Note: Simulink 3d Animation required.

The simulation is set up to stream data to Simulink Data Inspector so you can compare simulation runs and see the design choices they made.

My only point of feedback would be to use Stateflow for the switching logic for calibration/control/stopping. Right now, the model is keeping track of time itself with an integrator, implementing a bunch of logic to check which state is current, and then enabling the correct subsystem. This strategy doesn’t scale well and could easily yield bugs if the logic allows multiple states to be active at the same time. I’ve highlighted it below with the purple area and will send MathWorks swag to whoever emails me ( or posts a link to a working version of this model using a Stateflow chart that gives identical results.


Give it a try and let us know what you think here or leave a comment for Michele and the team at University of Florence.

Published with MATLAB® R2017a

  • print


To leave a comment, please click here to sign in to your MathWorks Account or create a new one.