readme update

main
Jake 2026-07-20 10:15:37 +08:00
parent d47909a26c
commit 4bd94bcc32
2 changed files with 59 additions and 36 deletions

View File

@ -1,53 +1,76 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-H2 | ESP32-H21 | ESP32-H4 | ESP32-P4 | ESP32-S2 | ESP32-S3 | Linux |
| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | --------- | -------- | -------- | -------- | -------- | ----- |
# linefollower_eye
# Hello World Example
ESP32-S3 camera board that finds a coloured blob and reports its position over I2C. Meant to sit on a robot as the “eye”, with something like a Pico as the master.
Starts a FreeRTOS task to print "Hello World".
## What it does
(See the README.md file in the upper level 'examples' directory for more information about examples.)
The ESP runs HSV blob detection on the camera. A MicroPython master can turn the camera on, set colour, and poll for a target. Optionally it can join WiFi so you can open a browser page to tune the colour live.
## How to use example
Target position from `read_target()` is relative to the image centre (320x240). Positive x is right, positive y is up. No target returns `None`.
Follow detailed instructions provided specifically for this example.
## Hardware
Select the instructions depending on Espressif chip installed on your development board:
ESP pins for the I2C slave:
- [ESP32 Getting Started Guide](https://docs.espressif.com/projects/esp-idf/en/stable/get-started/index.html)
- [ESP32-S2 Getting Started Guide](https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/get-started/index.html)
- SDA: GPIO19
- SCL: GPIO20
- Address: 0x42
Example Pico wiring:
## Example folder contents
- GP0 (SDA) -> ESP GPIO19
- GP1 (SCL) -> ESP GPIO20
- GND shared
- Use external pull-ups on SDA/SCL (about 2k24k7 to 3V3)
The project **hello_world** contains one source file in C language [hello_world_main.c](main/hello_world_main.c). The file is located in folder [main](main).
Camera and WiFi stay off until the master enables them.
ESP-IDF projects are built using CMake. The project build configuration is contained in `CMakeLists.txt` files that provide set of directives and instructions describing the project's source files and targets (executable, library, or both).
## Firmware
Below is short explanation of remaining files in the project folder.
ESP-IDF project for ESP32-S3. Build and flash as usual:
```
├── CMakeLists.txt
├── pytest_hello_world.py Python script used for automated testing
├── main
│ ├── CMakeLists.txt
│ └── hello_world_main.c
└── README.md This is the file you are currently reading
idf.py build
idf.py -p PORT flash monitor
```
For more information on structure and contents of ESP-IDF projects, please refer to Section [Build System](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/build-system.html) of the ESP-IDF Programming Guide.
## MicroPython master
## Troubleshooting
Files live in `mp_i2c_master/`. Copy `vision.py` (and `main.py` if you want the demo) onto the board.
* Program upload failure
```python
from vision import Vision
import time
* Hardware connection is not correct: run `idf.py -p PORT monitor`, and reboot your board to see if there are any output logs.
* The baud rate for downloading is too high: lower your baud rate in the `menuconfig` menu, and try again.
eye = Vision(sda=0, scl=1)
eye.start()
## Technical support and feedback
# Optional: browser UI for tuning colour
# eye.set_wifi("YourSSID", "YourPassword")
# print(eye.wifi_ip())
Please use the following feedback channels:
while True:
t = eye.read_target()
if t is None:
print("no target")
else:
x, y = t
print(x, y)
time.sleep(0.1)
```
* For technical queries, go to the [esp32.com](https://esp32.com/) forum
* For a feature request or bug report, create a [GitHub issue](https://github.com/espressif/esp-idf/issues)
Useful calls:
We will get back to you as soon as possible.
- `eye.start()` — camera on and local detection
- `eye.set_hsv(h, s, v)` / `eye.set_tolerance(...)` — colour (or tune in the browser)
- `eye.set_wifi(ssid, password)` / `eye.wifi_off()` / `eye.wifi_ip()`
- `eye.read_target()``(x, y)` or `None`
## Web UI
After WiFi is up, open the ESPs IP in a browser. You get the live image, colour picker / eyedropper, mask options, and timing. Colour changes there are what the I2C master reads next.
## Other folders
- `pc_vision/` — older desktop viewer; the on-device web UI replaces it for tuning
- `main/` — ESP firmware

View File

@ -1,9 +1,9 @@
# PC vision (legacy desktop UI)
# PC vision
The primary camera + vision tuner now runs **on the ESP** when WiFi is on:
Optional desktop client. Prefer the ESP web UI after `eye.set_wifi(ssid, password)`.
1. Enable camera from the I2C master (`eye.start()`), then WiFi:
`eye.set_wifi("YourSSID", "YourPassword")`.
2. Open the ESPs IP in a browser → video, eyedropper, HSV/tolerance, mask, drive pad.
If you still want this app:
This folders `viewer.py` is an optional desktop client that talks to the same HTTP/WS APIs.
```
python viewer.py --ip <ESP_IP>
```