-
Example with ESP32DevKitC Board to add a custom menu to UI to switch ON/OFF a relay OUTPUT
8 hours ago • 0 commentsSushi - IoT MicroPython example
- Project: Menu example
- Description: Add a custom menu to physical user interface to switch ON/OFF a relay OUTPUT
- Video demo : Sushi IoT on instagram
Source files
- "menu_example.py" : main example code
- "menu_example_config.py" : sushi IoT configuration
Source files on GitHub : dkc_menu example
Instructions
- Connect the components on the breadboard.
- Download and flash the Sushi IoT Firmware onto the board.
- Connect ESP32DevKitC to your PC by the USB connector (or use WebREPL if you prefer).
- If you are new to MicroPython see this basic MicroPython guide.
- Transfer the '.py' example source files to the board using your favourite MicroPython interface.
- Run the main script file. Note that it's normal on the first run (and in general, if the device configuration has changed): the device will store the settings and restart itself.
Hardware components
This project uses the following hardware:
- CPU : ESP32DevKitC-WROVER module
- Display : SSD1306 OLED
- Relay: D1 mini relay module
- Keypad : 1x4 membrane keypad
In each component overview file there are some brief info. All components can be found widely on the web, so just as example it's provided some link where can be bought.
Overview
Hardware connections table
Pin Connected To Type Note ESP32.USB USB Power suppplier 5V PowerPowers the board and peripherals ESP32.GND BB.GND GNDCommon ground network (1) ESP32.5V BB.VCC 5VShared power rail (1) Relay.VCC BB.VCC 5VPower supply for relay module Relay.GND BB.GND GNDCommon ground Relay.IN ESP32.GPIO15 DigitalRelay control signal Keypad.GND BB.GND GNDCommon ground Keypad.K1 ESP32.GPIO19 DigitalButton 1 Keypad.K2 ESP32.GPIO18 DigitalButton 2 Keypad.K3 ESP32.GPIO5 DigitalButton 3 Keypad.K4 ESP32.GPIO4 DigitalButton 4 OLED.VCC BB.VCC 5VPower supply (2) OLED.GND BB.GND GNDCommon ground OLED.SDA ESP32.GPIO21 SDAI2C data OLED.SCL ESP32.GPIO22 SCLI2C clock Notes:
- (1) “BB.VCC” & “BB.GND” indicates a connection to the breadboard power or ground rails.
- (2) Some OLED may require 3.3V, in this case connect to ESP32.3V3 pin.
Resources
Sushi IoT Firmware download
Online coding manual
Sushi IoT project overviewQuick reference
In the REPL, run:sushi.help()
or see the result directly here.
Marco