This repository provides sample code and documentation for the Obo-Play Kit.
- OLED Display Control: Initialize the SSD1306 display over I2C, clear the screen, display text, and even draw images.
- Easy Setup: Step‑by‑step instructions to flash MicroPython and upload the files via Thonny IDE.
-
Install Thonny IDE:
- Download and install Thonny IDE from Thonny.org.
-
Install MicroPython on ESP32:
- Open Thonny IDE.
- Go to
Run -> Configure Interpreter
. - In the "Interpreter" section, select:
- MicroPython (ESP32) under "MicroPython family."
- For the "Port," choose < Try to detect port Automatically >
- Click Install or update MicroPython (esptool).
- Choose:
- For the "Target Port," choose the correct Target Port for your ESP32 (e.g.,
COM3
,COM4
,/dev/ttyUSB0
). - MicroPython family: ESP32.
- Variant: Espressif ESP32 / WROOM.
- For the "Target Port," choose the correct Target Port for your ESP32 (e.g.,
- Click Install to flash MicroPython onto your ESP32.
-
Upload the Test Code:
- Create a new file in Thonny.
- Copy the contents of
main.py
into the file. - Click Save
- Select 'Micropython device'
- Rename as
main.py
- Select OK
- Extra : If a dialogue box appeared asking overwriting click OK
Once MicroPython is installed, you can connect to the ESP32 via Thonny and start using the SDK. Continue with the usage examples and SDK features listed above!
If you encounter issues such as a "Backend not ready" warning or the program seems stuck, follow these steps to reset your ESP32:
-
Press the Stop Button:
- In Thonny, click the red Stop button located at the top to interrupt any running code.
-
Reset via Shell:
- If pressing the stop button doesn’t resolve the issue:
- Make sure you do not click or interact with the shell section in Thonny.
- Instead, press Ctrl + C twice in quick succession to force a reset of the ESP32.
- If pressing the stop button doesn’t resolve the issue:
-
Reconnect the Device:
- If the device still doesn't respond, unplug and replug your ESP32.
- Go to
Run -> Configure Interpreter
and verify the Target Port is still correctly set.
-
Reinstall MicroPython (Optional):
- If the problem persists, you may need to reinstall MicroPython using the instructions provided above.
With these steps, you should be able to regain control of your ESP32 and continue using the OBOPlay SDK.
Toggles an LED on and off at 1-second intervals, demonstrating a simple digital output.
Lights a series of LEDs in a chase sequence, forward and backward—like the Knight Rider effect.
Reads a push button using an internal pull-up resistor. Prints “Pressed!” or “Released!” based on the state.
Reads an analog value from a potentiometer using an ADC pin, then prints the raw reading and approximate voltage.
Uses PWM to fade an LED in and out by varying the duty cycle on a GPIO pin.
- File Saving: Replace your "main.py" with the new content ( for ex: blink an LED.py)
- Pin Assignments: Adjust pin numbers as needed for your board’s layout or built-in LED.
- Timing: Modify
time.sleep()
calls or loop ranges to speed up or slow down the effects. - Circuit Setup: Always use current-limiting resistors for LEDs, and wire push buttons or potentiometers correctly (with appropriate pull-ups or pull-downs if needed).
- ADC Range: The ESP32 ADC typically returns values from 0 to 4095 (12-bit resolution). Voltage references can vary; check your board specs.
- PWM: By default in MicroPython, duty cycles range from 0 to 1023 (0–100% duty).
Enjoy exploring these basic MicroPython features on your OBO-PLAY ESP32 kit!