100% Guaranteed Results


ECE40862 – Solved
$ 29.99
Category:

Description

5/5 – (1 vote)

ECE40862: Software for Embedded Systems
Lab 3 – Wi-Fi Networking, Touch Pad Inputs, and Sleep/Wake-Up

1. Overview
This assignment deals with connecting your ESP32 board to the Internet over WiFi and exploring sleep modes and wake up sources in the ESP32. You will also be using the RTC module and the on-board touch sensor in this lab. The hardware and software implementation details for this assignment are described in the following sections.
2. Programming Exercise
2.1. Hardware Interfacing
Interface the following components to the board:
• Two external LEDs (red and green) as GPIO outputs.
o The red LED should indicate if the board is awake (ON) or in sleep mode (OFF).
o The green LED should be controlled by touch-based input (see Table 1).
• One external push button as a GPIO input to use as a wake-up source.
• One external Male-Male jumper wire connected to a Touch-enabled pin. Insert the wire into the header on the board. This page gives information about the Touch-enabled pins: http://docs.micropython.org/en/latest/esp32/quickref.html#capacitive-touch. You can select any of the 10 capacitive-touch enabled pins on the board with the following caveat. The pins indicated on the webpage above are for the ESP32 microcontroller itself. On your board however, only 6 out of the 10 touch-enabled pins are available for use. You can figure out the 6 pins by trial and error (HINT: you will get a ‘ValueError’ if you try to assign an unavailable pin as a TouchPad input).
2.2. Software Implementation (main.py)
Your program should implement the following functionality.
2.2.1.Connect to the Internet over WiFi
• The program should use the network module in MicroPython to connect your ESP32 to a WiFi network using the ‘SSID’ and ‘Password’ for that network. You can create a WiFi hotspot on your mobile/laptop and connect your ESP32 to the hotspot. Refer to the example given in the MicroPython documentation for the network module [1]
e.g., if your mobile hotspot has an SSID: ‘Lenovo-SSID’ and Password: ‘12345678’, then use this SSID and password for connecting the ESP32 to the Internet.
NOTE: You can also connect to any other WiFi network which works directly with an SSID and password. However, be aware that enterprise networks such as PAL3.0 which require SSID, username, password, certificates, etc., are unfortunately not supported in Micro Python.
• Each time the board successfully connects to Wi-Fi, the program should print the SSID it has connected to and the interface’s IP address.
Connected to Lenovo-SSID
IP Address: 192.168.0.107
Time: 10:00:00 HRS
2.2.3. Green LED Control by Touch Input
• Initialize the Touchpad-enabled pin connected to the jumper wire and calibrate it by observing how the touchpad pin values change when you physically touch the jumper wire.
• Initialize a second hardware timer and read the touch pin values every 50 milliseconds using a Timer interrupt/callback and implement the following pattern. Use calibrated values to detect whether the wire is touched or not.
o Touch Pin not touched: Green Led should be OFF o Touch Pin touched: Green Led should be ON
2.2.4. Red LED, Deep Sleep and Different Wake Up Sources
• The red LED should be ON whenever the ESP32 is awake and OFF when it is in sleep mode.
• Use a third hardware timer to put the ESP32 into deep sleep every 30 seconds for a duration of 1 minute. Print out a message on the terminal before going to sleep like:
I am going to sleep for 1 minute.
AWAKE duration: 30 seconds (this will be the duration of the third hardware timer)
SLEEP duration: 1 minute (do not need a timer for this, check this link for details on deep sleep: https://docs.micropython.org/en/latest/esp32/quickref.html#deep-sleep-mode)
• You will be using two different sources of waking up from deep sleep. Your program should check for both sources and the board should be able to wake up from either source.
2.2.4.1. Wake up Sources
• Timer Wake Up: Wake up the ESP32 after the predefined sleep duration (1 minute) and print that it’s a timer wake-up.
2.3. Overall Program Flow and Sample Output
Table 1. Sleep and Wake Up Program Flow
Mode Touch Pin Switch Red Led Green Led
Sleep Not Pressed: No Effect Not Pressed: No Effect Off Off
Sleep Pressed: No Effect Pressed: Wake-Up Off Off
Awake Not Pressed: Green LED off Not Pressed: No Effect On Off
Awake Pressed: Green LED on Pressed: No Effect On On
Sample Output
I (200) wifi: wifi driver task: 3ffe2c34, prio:23, stack:3584, core=0
……… Wi-Fi connection
………
……… messages posted by
I (22233) network: CONNECTED ESP
I (22883) event: sta ip: 192.168.0.107, mask: 255.255.255.0, gw: 192.168.0.1
I (22883) network: GOT_IP
Connected to Lenovo-SSID
IP Address: 192.168.0.107
Time: 10:00:15 HRS

Time: 10:00:30 HRS

I am going to sleep for 1 minute.

rst:0x5 (DEEPSLEEP_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) configsip: 0, SPIWP:0xee……………
…………………
…………………
I (0) cpu_start: Starting scheduler on APP CPU.

I (200) wifi: wifi driver task: 3ffe2c34, prio:23, stack:3584, core=0

///continues
3. Submission
Make sure you follow these instructions precisely. You need to turn in your code on Brightspace. Please create a directory named username_lab3, where username is your CAREER account login ID. This directory should contain only the following files, i.e., no executables, no temporary files, etc.
1. main.py: your program (2.2)
2. A README file named username_lab3_README.txt that contains a description of your hardware connections (which pins you used, exactly what they were connected to, etc.).
Zip the directory and name it as username_lab3.zip and upload the .zip file to Brightspace.
BONUS CREDIT: You will receive 20% bonus credit on the lab for creating a short video that shows you demonstrating your working solution (explain your hardware connections briefly before demonstrating the working solution). Please do not upload video files directly on Brightspace. Instead, upload the video to YouTube (or other such video hosting platform) and include the link to the video in your README file above.
4. Grading
REFERENCES
[1] Getting started with MicroPython on the ESP32 https://docs.micropython.org/en/latest/esp32/tutorial/intro.html
[2] ESP32 WROOM-32 Datasheet https://www.espressif.com/sites/default/files/documentation/esp32-wroom32_datasheet_en.pdf
[3] ESP32 Technical Reference Manual https://www.espressif.com/sites/default/files/documentation/esp32_technical_reference _manual_en.pdf
[4] Adafruit HUZZAH32 – ESP32 Feather Online Manual https://learn.adafruit.com/adafruit-huzzah32-esp32-feather
[5] Adafruit ESP32 Feather Schematics https://cdnlearn.adafruit.com/assets/assets/000/041/630/original/feather_schem.png?1494449413
[6] MicroPython GitHub https://github.com/micropython/micropython
[7] REPL http://docs.micropython.org/en/latest/esp8266/tutorial/repl.html
[8] Thonny IDE https://thonny.org
[9] Rshell GitHub https://github.com/dhylands/rshell
[10] Sleep Modes API in C https://docs.espressif.com/projects/esp-idf/en/latest/apireference/system/sleep_modes.html
[11] Touch Sensor API in C https://docs.espressif.com/projects/esp-idf/en/latest/apireference/peripherals/touch_pad.html
[12] ESP32 specific functionalities in MicroPython http://docs.micropython.org/en/latest/library/esp32.html

Reviews

There are no reviews yet.

Be the first to review “ECE40862 – Solved”

Your email address will not be published. Required fields are marked *

Related products