These tutorials use a project-based learning approach and real-life examples. All projects are connected to one another, so please do them in the order presented. These will teach you about:
1.Basic Model-Based Design (MBD) workflow
2.How to deploy MATLAB to low-cost powerful embedded hardware (ESP32)
3.Integrate Internet of Things (IoT) with MBD
Before starting, it is recommended to go through these resources.
The following software will also be required:
1.Matlab (Release R2020a or later), which must include:
a.Simulink
b.Matlab coder
c.Simulink coder
d.Embedded coder
e.Stateflow
2.Waijung 2 for ESP32 (How to get Waijung 2, Waijung 2 installation & activation)
# |
Project |
Learning objectives |
Overview |
1 |
1.How to create a simple Simulink model 2.Model-Based Design (MBD) workflow a.How to use ESP32 and its pins b.How to simulate the model (Software in the Loop - SIL simulation) c.How to deploy the simulation model to hardware (ESP32) d.How to run simulation with real hardware (Hardware in the Loop - HIL simulation) e.How to deploy as a Stand Alone (SA) device |
||
2 |
1.How to use Stateflow to model an event-driven system 2.Using Stateflow and Simulink together 3.Display multiple signals in Scope 4.More about MBD workflow (SIL, HIL, SA) |
||
3 |
1.How to use Stateflow to model a more complex event-driven system |
||
4 |
1.What is a DIP switch 2.How to interface with a DIP switch 3.How to use Stateflow to model a more complex control system |
||
5 |
Temporary traffic light controller with automatic distance sensor |
1.What is I2C 2.How to interface with a distance sensor using I2C 3.How to use Stateflow to model a more complex control system |
# |
Project |
Learning objectives |
Overview |
6 |
1.How to model reading LDR in Simulink 2.How to model driving LED through LDR input in Simulink 3.How to use Simulink Dashboard components to aid visualization |
||
7 |
1.How to read LDR using Waijung 2 Analog to Digital Converter (ADC) block 2.How to drive LED using Waijung 2 Digital to Analog Converter (DAC) block 3.How to monitor signals and tune parameters in real-time using HIL simulation (External Mode) with real hardware (ESP32) 4.How to use Simulink Dashboard components to control parameters in real-time |
||
8 |
1.How to configure ESP32 as a web server (Access Point - AP mode) for control application 2.Understand how to develop HTML, CSS, and JavaScript to control on-chip hardware peripherals 3.How to store web pages in ESP32’s internal memory (SPIFFS) 4.How to use Waijung 2 to deploy Simulink model to a web server 5.How to make the ESP32 a Stand-Alone web-based controller |
||
9 |
Display ADC reading and voltage drop of LDR sensor on a webpage |
1.How to configure ESP32 as a web server (Access Point - AP mode) for data acquisition application 2.Understand how to develop HTML, CSS, and JavaScript to display embedded system status on a webpage 3.How to make the ESP32 a Stand-Alone data acquisition device |
|
10 |
Complete web-enabled embedded controller for LDR and LED control |
1.Combine all the previous knowledge to create a complete web-based control system using Waijung 2 and Simulink 2.How to store data to non-volatile storage so that the system starts up with the same settings as before |