此仓库包含使用 Raspberry Pi 和 Teachable Machine 上的 TensorFlow-Lite 创建的项目。 将 AI 和 ML 功能集成到机器人软件中
此仓库包含使用 Raspberry Pi 和 Teachable Machine 上的 TensorFlow-Lite 创建的项目。 将 AI 和 ML 功能集成到机器人软件中
Updated to work with the latest Raspberry Pi OS (Trixie, Debian 13).
Visit the website:
Youtube Channel:
Building on Robotics Level 3, this level runs machine learning on the robot itself. The camera feed is passed through a TensorFlow Lite model on the Pi — no cloud, no account, no network round trip — and what the model sees drives the motors.
Everything from the earlier levels is still here: camera, lights, distance sensor, speaker, the direction pad, and the phone-sensor pages.
One page drives all of it. The five ML projects run along the top, the live camera feed fills the middle, and the direction pad and speed sit on the right, with the distance reading, the lights and the speaker around the edges. Reload the page and the controls come back as you left them — they report what the robot is actually doing, not what was last clicked.
The green badge beside AI ROBOTICS says which backend the models will use: Coral USB Accelerator when one is plugged in, CPU when it is not. It asks the same code the robot does, so the badge and the rover cannot disagree.
| Project | What the robot does |
|---|---|
| Object Detection | Watches for one chosen object and raises an alarm on the control panel when it appears |
| Object Tracking | Follows a ball, with the camera view visible in a browser while it tracks |
| Human Following | Follows a person |
| Image Classification | Streams the camera view with the model's guess overlaid, and speaks the name of what it recognises |
| Gesture Control | Recognises hand gestures using a model trained with Google's Teachable Machine. Swap the model files in earthrover/tm/ to teach it something else |
Each folder has its own README.md with the detail.
Everything from level 3, plus:
Some things worth knowing before you build this level:
Two commands on a Raspberry Pi already running Raspberry Pi OS 12 or 13.
curl -fsSL https://raw.githubusercontent.com/jiteshsaini/robotics-level-4/main/earthrover/setup_level4.sh -o setup_level4.shbash setup_level4.shNot with sudo — the script calls sudo itself, and says so if you try.
Downloading first, rather than piping into a shell, lets you read the script before it runs.
It fetches the code and the ML models, installs them to
/var/www/html/earthrover and /var/www/html/all_models, and sets up
everything they need. An existing install is moved aside rather than
overwritten. Then open:
http:///earthrover/Allow an hour or more on a first run. The script brings the whole OS up to date before installing the camera and vision packages, so they are not built against an older kernel. Nothing reboots by itself — it tells you at the end if a restart is needed.
Worth doing only on a 512 MB board such as the Pi 3A+, where the desktop is the difference between a detector that runs and one that lives in swap. The installer points this out when it finds such a board, but does not do it for you, because it also closes VNC:
sudo systemctl set-default multi-user.target
sudo systemctl disable lightdm
sudo systemctl disable --now wayvnc
sudo rebootbash setup_level4.sh --fix-perms |
re-apply web-root ownership without reinstalling |
bash setup_level4.sh --verify |
check everything end to end, change nothing |
bash setup_level4.sh --help |
the notes at the top of the script |
--verify is the one to reach for when something misbehaves: it needs no
password and touches nothing.
Tested on Raspberry Pi OS Trixie (Debian 13), on a Raspberry Pi 3A+ and a Raspberry Pi 4 Model B.
ai-edge-litert) and OpenCV./var/www/html.camera_auto_detect=1 in
/boot/firmware/config.txt. Along with a new kernel, this is why a run
sometimes ends by asking for a reboot.The GPIO library is rpi-lgpio rather than the older RPi.GPIO, because the
older one does not work on a Raspberry Pi 5. raspi-gpio was removed from
Raspberry Pi OS and pinctrl replaces it.
| Folder | Role |
|---|---|
control_panel/ |
The main UI, direction pad, speed control |
vars.php, util.py |
Pin map and movement functions, for PHP and Python |
camera_lights/ |
MJPEG video stream and the LED switching |
range_sensor/, speaker/ |
Distance sensor and text to speech |
accelerometer/, compass/, voice_control/ |
The phone-sensor control pages |
object_detection/, object_tracking/, human_following/, image_classification/, tm/ |
The five ML projects |
logs/ |
Worker output — the first place to look when an ML feature misbehaves |
all_models/ |
The .tflite models and label files, alongside earthrover/ |
setup_level4.sh |
The installer above |
Worker logs are written to logs/ rather than /tmp on purpose: Apache gives
itself a private /tmp, so anything written there is invisible from a normal
shell.
暂无开放 Issues,或尚未同步最近议题。