Please enable JavaScript to view this site.

Waijung 2 User Guide

Navigation: ESP32 target > Tutorials

Model-Based Design (MBD) & Internet of Things (IoT) tutorials for ESP32

Scroll Prev Top Next More

Introduction

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.

 

1.MATLAB Onramp

2.Simulink Onramp

3.Stateflow Onramp

 

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)  

 

Basic MBD learning roadmap

#

Project

Learning objectives

Overview

1

Road safety warning light

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

project1_sil_overall_zoom18

2

Basic traffic light controller

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)

project2_sil_overall_zoom16

3

Temporary traffic light controller

1.How to use Stateflow to model a more complex event-driven system

project3_sil_overall_zoom13

4

Temporary traffic light controller with manual dip switch

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

project4_sil_overall_zoom14

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

project5_sil_overall_zoom15

 

Basic IoT learning roadmap

#

Project

Learning objectives

Overview

6

Control algorithm design for Light Dependent Resistor (LDR) input to Light Emitting Diode (LED) output

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

project6_overall_zoom22

7

Hardware in the Loop (HIL) simulation for Project 6

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

project7_overall_zoom14

8

Control LEDs from a webpage

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

project8_sa_overall_zoom14

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

project9_sa_overall_zoom14

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

project10_sa_overall_zoom15

Copyright 2023 Aimagin Co.,Ltd. Rev.869