Internet of Things
A.A. 2022/23
Prof.ssa Lidia Fotia
ZM1Evaluat ion board
ADC can be enabled on D2, D15, D27, D26, D25, D33,
D35, D39, D36, D34, D32, D14, D12, D13, D0 , D4
PWM can be enabled on
3V3 GND
EN D23
SERIAL2 RX2 D36 D22
D39 ZM1 D1 TX0
SERIAL0
SERIAL1 RX1 D34 IoT Module D3 RX0
FCC ID: 2AC7Z-WROOM32SE D21
D35
SERIAL2 TX2 D32 RoHS GND
D33 D19
D25 D18
D26 D5
D27 D17 SCL0
I2C0
SCLK0 D14 D16 SDA0
MISO0 D12 D4 TX1 SERIAL1
SPI0
GND D0
MOSI0 D13 D2
RESERVED D9 D15
D10 D8 RESERVED
RESERVED D11 D7 RESERVED
5V D6 RESERVED
D0 User button
Reset
Pin Product documentation
USB SERIAL0
Downloading MicroPython Firmware
Go to the MicroPython Downloads
page: https://micropython.org/download/.
Select the type of board you’re using. Here is the quick link for ESP32
board:
ESP32 MicroPython firmware
You should see a web page with links to download .bin files.
Download the latest release.
Flashing Firmware using Thonny IDE
Follow the next steps:
1) Connect your ESP32 board to your computer.
2) Open Thonny IDE. Go to Tools > Options > Interpreter.
3) Select the interpreter you want to use accordingly to the board
you’re using and select the COM port your board is connected to.
Finally, click on the link Install or update firmware.
Flashing Firmware using Thonny IDE
Flashing Firmware using Thonny IDE
Select the port once again, and then click on the Browse.. button to open
the .bin file with the firmware you’ve downloaded on the previous step.
Select the options as shown in the picture below and finally click on Install.
Testing the Installation
Connect the board to your computer using a USB cable. To test the
installation, you need to tell Thonny that you want to run MicroPython
Interpreter and select the board you are using.
1. Go to Tools > Options and select the Interpreter tab. Make sure you’ve
selected the right interpreter for your board as well as the COM port.
You can also select the “Try to detect automatically” option, but only if you
just have one board connected to your computer at a time. Otherwise, select
the specific port for the board you’re using.
2. Thonny IDE should now be connected to your board and you should see
the prompt on the Shell.
Testing the Installation
3. Type the command help() in the Shell and see if it responds back.
Breadboard
• To simplify the realization of prototype circuits, without
soldering components, a breadboard can be used to realize
the connections.
Breadboard
• The “holes” are internally connected by horizontal or
vertical conductors
Breadboard
• Components are put in the holes, and additional
connections are realized using jumper wires
How to select
resistors
How to connect a LED to your board?
Pull-down resistor
Pull-down
Pull-up resistor
Pull-up
Photoresistor
Duty Cycle
Brightness control of a LED with PWM: fading
• Write a program that controls the intensity of a led in a timed manner
in order to create a fade effect.
• PIN PWM: D2 D10 D5 D15 D18 D19 D21 D22 D23 D25
D27 D26 D33
Buzzer piezo
Buzzer control with PWM
• Write a program that plays two pieces of music on a piezo
buzzer (given the frequency of each note). The two pieces of
music will be played consecutively with a one second pause.
Servo motor with PWM
Data sheet
motore
servo
Brightness control of a led with PWM and button
• Write a program which, when the external button configured in
PULLDOWN mode is pressed, increases the brightness of the external
LED (which is off at startup) until it reaches maximum brightness. In
this latter state, a further pressure causes the LED to switch off, and
then switch back on again at minimum brightness.
Buzzer control with PWM and button
• Write a program that reproduces a sequence of notes on a piezo buzzer (given the frequency of
each note) in a cyclical manner. When the button (BTN0) is pressed, the program must allow the
reproduction speed to be varied (from 1x to 2x and vice versa).
A4 – 400Hz
C#5 – 550 Hz
E5 – 660 Hz
A5 – 880 Hz
Pattern: A4, C#5, E5, A5, A5, E5, C#5, A4
Set the duration of each sound to 500ms for 1x speed