[go: nahoru, domu]

Skip to content

Simulink implementation of Arduino Pololu library for VL53L0X distance sensor.

Notifications You must be signed in to change notification settings

PeterChmurciak/Simulink-Pololu-VL53L0X

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Simulink Pololu VL53L0X

Simulink S-function block that allows Simulink to receive data from the VL53L0X distance sensor through an Arduino board. It is based on Pololu library. Confirmed to work in Simulink R2019a on Arduino Uno R3.

The block was created to suit the needs of AutomationShield project. If you are interested in control engineering and/or you want to learn about educative experiments that can be done using Arduino boards, pay a visit to the project wiki page.

How to install

To be able to work with Arduino in Simulink you have to have Simulink Support Package for Arduino installed.

To be able to create and compile the code in Simulink external mode you will need MinGW-w64 C/C++ Compiler and possibly (this one might not be needed) Simulink Coder add-on installed.

Assuming you have installed it already, to use this block you have to copy the Pololu_VL53L0X folder somewhere on your computer and add its content to the Matlab search path.

For example if its current location is C:\Program Files\myProject\myFile\Pololu_VL53L0X you would use Matlab command addpath('C:\Program Files\myProject\myFile\Pololu_VL53L0X').

Now Matlab should be able to recognize the S-function inside of this file. To check if was detected sucessfully use Matlab command which('PololuVL53L0X').

You should see the path to the file PololuVL53L0X.mexw64 located in the Pololu_VL53L0X folder.

How to use

  • Firstly, you have to change the execution mode of your Simulink model from Normal to External and choose your board from the list located in Model Configuration Parameters - Hardware Implementation - Hardware board: - for example Arduino UNO

  • The next thing you need to do, is to add the S-function block to the model. Using Library Browser it can be found in Simulink/User-Defined Functions. When added, change its parameters followingly:

    S-function name: PololuVL53L0X
    S-function modules: 'PololuVL53L0X_wrapper'
    
  • Now connect the output port of S-function block to a Display or a Scope block and press Run to see if everything works as it should

Note

The block uses continuous reading mode with 20 millisecond measure timing budget. That means you should not use sampling step size smaller than 0.02 seconds to prevent overrun.

About

Simulink implementation of Arduino Pololu library for VL53L0X distance sensor.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published