๐ด Urban Lab: Building a Smart Scooter with AI and Reinforcement Learning
What happens when you combine 3D printing, open-source hardware, AI and reinforcement learning?
That's the idea behind Urban Lab, an experimental smart-mobility project developed in Rimini, Italy.
The project explores how accessible technologies can be combined to prototype a connected electric scooter platform.
๐ฏ The Vision
Urban Lab brings together:
- ๐จ๏ธ 3D printing
- โก Electric mobility
- ๐ง Artificial intelligence
- ๐ค Reinforcement learning
- ๐ก IoT sensors
- ๐ง ESP32 hardware
- ๐ฑ Mobile applications
- ๐ Open-source software
The goal isn't simply to build a scooter.
The goal is to create an open platform for experimentation.
๐ง Why Reinforcement Learning?
One of the most interesting areas we're exploring is Reinforcement Learning (RL).
Instead of explicitly programming every possible situation, an RL agent can learn a policy through interaction with a simulated environment.
For a smart mobility platform, interesting research areas include:
| Challenge | RL Research Direction |
|---|---|
| Dynamic control | Policy optimization |
| Energy efficiency | Reward optimization |
| Terrain adaptation | Robust control |
| Braking | Control optimization |
| Navigation | Policy-based decision making |
These are experimental research directions. Any deployment on a real vehicle requires extensive simulation, testing and safety validation.
๐๏ธ RL Architecture
The proposed architecture looks like this:
text
โโโโโโโโโโโโโโโโโโโโโโโ
โ Scooter Sensors โ
โ IMU / GPS / Battery โ
โโโโโโโโโโโโฌโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโ
โ Simulation / RL โ
โ Training โ
โโโโโโโโโโโโฌโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโ
โ Trained Policy โ
โ ONNX / Runtime โ
โโโโโโโโโโโโฌโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโ
โ Edge Controller โ
โ ESP32 โ
โโโโโโโโโโโโฌโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโ
โ Motor / Brake / I/O โ
โโโโโโโโโโโโโโโโโโโโโโโ
The important principle is to keep the training environment separated from the physical vehicle.
๐ฆ Technology Stack
The experimental software stack includes:
Python
Gymnasium
PyTorch
ONNX
ONNX Runtime
ESP32
C/C++
React Native
Where appropriate, RL libraries can be evaluated and integrated during development.
๐งช Simulation Environment
A simplified Gymnasium environment could represent the scooter using observations such as:
class ScooterEnv(gym.Env):
"""
Example observation space:
- speed
- inclination
- battery level
- obstacle distance
- motor RPM
- motor temperature
Example actions:
- acceleration
- braking
- steering
"""
def __init__(self):
super().__init__()
def reset(self, seed=None, options=None):
pass
def step(self, action):
pass
The simulation environment is important because it allows us to test policies before considering physical deployment.
๐ PPO Training
One possible algorithm for experimentation is Proximal Policy Optimization (PPO).
Example configuration:
algorithm:
name: PPO
learning_rate: 0.0003
n_steps: 2048
batch_size: 64
n_epochs: 10
gamma: 0.99
gae_lambda: 0.95
clip_range: 0.2
network:
architecture: mlp
hidden_layers:
- 256
- 256
- 128
activation: tanh
training:
total_timesteps: 1000000
These values are starting points for experimentation rather than guaranteed optimal parameters.
๐จ๏ธ 3D Printing
3D printing is another important part of Urban Lab.
Potential printed components include:
Component Material
Electronics enclosure PETG
ESP32 mount PLA/PETG
Battery enclosure prototype PETG
Cable management TPU
Mudguards TPU
Mechanical prototypes PETG/ABS
Structural components must be properly engineered and validated before being used in a vehicle.
๐ก Sensors & Electronics
The experimental architecture includes:
Sensor Example Purpose
GPS NEO-6M Position
IMU MPU6050 Motion
Proximity HC-SR04 Obstacle detection
NFC RC522 Authentication
Display OLED Local status
The ESP32 provides a low-cost platform for connecting these components.
๐ป ESP32 Firmware
A simplified firmware architecture:
#include <Arduino.h>
struct ScooterState {
float speed = 0;
float battery = 100;
float temperature = 25;
bool isMoving = false;
bool isLocked = false;
};
ScooterState scooterState;
void setup() {
Serial.begin(115200);
setupSensors();
setupWiFi();
setupBLE();
}
void loop() {
readSensors();
updateTelemetry();
checkErrors();
delay(100);
}
The firmware is designed around a simple pipeline:
Sensors โ Processing โ Telemetry โ Decision Support
๐ฑ Mobile Application
A future mobile application can provide:
Battery monitoring
Vehicle status
Sensor information
BLE connectivity
GPS information
Maintenance notifications
AI-assisted diagnostics
Example:
const connectDevice = async (device) => {
const connectedDevice = await device.connect();
await connectedDevice
.discoverAllServicesAndCharacteristics();
const data = await readCharacteristic();
setScooterData(parseData(data));
setConnected(true);
};
๐ฌ Safety First
A smart vehicle is a safety-critical system.
For that reason, Urban Lab follows an important development principle:
Simulation first. Hardware testing second. Public-road operation only after appropriate safety and regulatory validation.
RL policies should never directly control a real vehicle without appropriate safeguards, limits, emergency controls and extensive validation.
๐ Project Structure
urban-lab-scooter/
โ
โโโ 3d-printing/
โ โโโ stl-files/
โ โโโ slicer-profiles/
โ
โโโ rl/
โ โโโ environments/
โ โโโ configs/
โ โโโ scripts/
โ
โโโ firmware/
โ
โโโ app/
โ
โโโ docs/
๐ Roadmap
Current
โ
Project architecture
โ
Hardware research
โ
3D-printing development
โ
ESP32 development
๐ RL experimentation
Next
โณ Simulation environment
โณ RL training
โณ Model evaluation
โณ Sensor integration
โณ Edge inference experiments
โณ Physical prototype testing
Future
๐ Open datasets
๐ค Improved control policies
๐ Telemetry dashboard
๐ง AI-assisted diagnostics
๐ด Advanced mobility experiments
๐ค Contributing
Urban Lab is an open-source experiment.
You can contribute with:
๐ง AI / ML
๐ค Reinforcement Learning
๐ง Firmware
๐ก IoT
๐จ๏ธ 3D design
๐ฑ Mobile development
๐ Documentation
๐งช Testing
Issues and pull requests are welcome.
๐ Projects
Urban Lab
https://github.com/DanielIoni-creator/urban-lab
MyZubster
https://github.com/myzubster/myzubster
If you're interested in open-source AI, hardware and sustainable technology, follow the development and get involved.
๐ Final Thoughts
Urban Lab is an experiment at the intersection of:
Open Source ร AI ร Robotics ร IoT ร Sustainable Mobility
We're starting with a scooter, but the bigger objective is to build an open environment where hardware and software can evolve together.
Build. Simulate. Test. Improve. Share.
๐ด๐ค๐ฑ
Urban Lab โ Open-source mobility from Rimini.
Top comments (0)