Build a Miniature Smart Bike with a Safety Helmet!
Meet Ryder — a miniature Arduino bike that won't start without a helmet, checks for alcohol before riding, flashes automatic turn signals, and brakes itself when something's in the way.
๐ช Say hi to Ryder, your smart safety bike!
What Is a Smart Bike Safety System, Anyway?
Real motorcycles and scooters are starting to include smart safety features — and you can build a miniature version! Ryder combines four safety ideas in one small Arduino brain: it checks that the rider is wearing a helmet, checks for alcohol before allowing the "engine" to start, automatically flashes turn indicators based on handlebar movement, and uses an ultrasonic sensor to brake before hitting an obstacle.
What You'll Need
Gather these parts before you start building your smart bike!
Arduino Uno
The brain that runs all four safety systems.
MQ-3 Alcohol Sensor
Mounted near the helmet's chin strap to sniff for alcohol.
IR Proximity Sensor
Detects whether the helmet is actually on someone's head.
Relay Module
Acts as the "ignition switch" that only engages when it's safe.
Small DC Motor
Represents the bike's engine/rear wheel drive.
Ultrasonic Sensor (HC-SR04)
Watches ahead for obstacles to avoid a collision.
SG90 Micro Servo
Acts as an auto-brake, pressing the brake lever when needed.
Micro Push Buttons
Mounted on the handlebar to sense a left or right turn.
Amber LEDs
Left and right automatic turn indicators.
Status LED + Buzzer
Shows system status and warns of obstacles or blocks.
Miniature Bike Model
A toy or 3D-printed bike frame to mount everything on.
Jumper Wires + Breadboard
Connects every sensor and output.
The Circuit Diagram
All four safety systems connect to one Arduino Uno, working together to keep the ride safe.
Step-by-Step Build Instructions
We'll build each safety system one at a time, then combine them. Work with an adult on wiring the relay and motor!
Mount the alcohol sensor on the helmet
Position the MQ-3 sensor near the chin strap area of the helmet, facing where a rider's breath would pass, and route its wires down to the bike's Arduino.
๐ก Tip: MQ-3 sensors need a short warm-up time after power-on before readings become stable — wait about 20 seconds before testing.Add the helmet-worn sensor
Mount the small IR proximity sensor inside the helmet so it detects when a head is actually inside, not just resting nearby.
Wire the relay and motor "ignition"
Connect the relay between the Arduino and the small DC motor representing the engine. The Arduino will only close the relay (allowing power through) when both safety checks pass.
Mount the ultrasonic sensor and brake servo
Attach the ultrasonic sensor facing forward on the handlebars, and mount the servo so its arm can press the brake lever when triggered.
Add the turn buttons and indicator LEDs
Mount one small push button on each side of the handlebar grips (pressed automatically when the rider turns the handlebar that direction), and place an amber LED on each side of the bike as the indicator light.
Add the status LED and buzzer
Mount the status LED where it's easy to see (green = safe to ride, red = blocked) and the buzzer nearby for collision and safety alerts.
Wire everything and test
Double-check every connection against the circuit diagram, upload the code, and test each system one at a time — helmet check, alcohol check, turn signals, then collision braking.
The Arduino Code
This code needs the Servo library. Copy it into the Arduino IDE, adjust the alcohol threshold for your sensor, then click Upload.
// ๐ฒ๐ค Ryder the Smart Bike & Helmet Safety System — Arduino Robotics Project // Combines helmet detection, alcohol sensing, auto turn signals, and collision avoidance #include <Servo.h> // ---- Safety sensors ---- const int alcoholPin = A0; const int helmetPin = 2; const int relayPin = 3; const int alcoholLimit = 400; // tune this after testing your sensor // ---- Collision avoidance ---- const int trigPin = 4, echoPin = 5; const int safeDistanceCM = 20; Servo brakeServo; const int brakeServoPin = 9; // ---- Turn indicators ---- const int leftButtonPin = 6; const int rightButtonPin = 7; const int leftLEDPin = 10; const int rightLEDPin = 11; // ---- Status ---- const int statusLEDPin = 12; const int buzzerPin = 8; void setup() { pinMode(helmetPin, INPUT); pinMode(relayPin, OUTPUT); pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT); pinMode(leftButtonPin, INPUT_PULLUP); pinMode(rightButtonPin, INPUT_PULLUP); pinMode(leftLEDPin, OUTPUT); pinMode(rightLEDPin, OUTPUT); pinMode(statusLEDPin, OUTPUT); pinMode(buzzerPin, OUTPUT); brakeServo.attach(brakeServoPin); brakeServo.write(0); // brake released Serial.begin(9600); Serial.println("Warming up alcohol sensor..."); delay(20000); // MQ-3 sensors need time to warm up } void loop() { bool safeToRide = checkStartConditions(); digitalWrite(relayPin, safeToRide ? HIGH : LOW); digitalWrite(statusLEDPin, safeToRide ? HIGH : LOW); if (safeToRide) { handleTurnSignals(); handleCollisionAvoidance(); } } // Checks helmet + alcohol before allowing the ignition relay to engage bool checkStartConditions() { bool helmetOn = (digitalRead(helmetPin) == HIGH); int alcoholLevel = analogRead(alcoholPin); bool sober = (alcoholLevel < alcoholLimit); if (!helmetOn) { Serial.println("Blocked: put on your helmet!"); return false; } if (!sober) { Serial.println("Blocked: alcohol detected!"); tone(buzzerPin, 500, 500); return false; } return true; } // Lights the matching indicator LED automatically when a turn button is pressed void handleTurnSignals() { digitalWrite(leftLEDPin, digitalRead(leftButtonPin) == LOW ? HIGH : LOW); digitalWrite(rightLEDPin, digitalRead(rightButtonPin) == LOW ? HIGH : LOW); } // Measures distance ahead and auto-brakes if something is too close void handleCollisionAvoidance() { long distance = readDistanceCM(); if (distance > 0 && distance < safeDistanceCM) { tone(buzzerPin, 1200, 150); brakeServo.write(90); // press the brake lever } else { brakeServo.write(0); // release the brake } } // Measures distance using the ultrasonic sensor long readDistanceCM() { digitalWrite(trigPin, LOW); delayMicroseconds(2); digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin, LOW); long duration = pulseIn(echoPin, HIGH, 20000); return duration * 0.034 / 2; }
How Does Ryder Actually Work?
Here are the big robotics ideas hiding inside this project:
Safety Interlocks
The relay only lets power through when both the helmet check and alcohol check pass — a real interlock system won't let the "engine" run unless every safety condition is met.
Gas Sensing
The MQ-3 sensor's internal material changes resistance when it detects alcohol vapor, giving a higher analog reading — the code just compares that number to a safe limit.
Reactive Automation
The turn indicators don't need a separate "on/off" toggle — they simply mirror whatever the turn buttons are doing in real time, every loop.
Distance-Triggered Braking
The same ultrasonic-distance trick used in parking sensors and robot vacuums is used here to decide, moment by moment, whether it's safe to keep moving.
๐ง๐ฌ Safety First!
- Build with an adult, especially when wiring the relay, motor, and alcohol sensor.
- This is a scaled-down learning model using a small motor — it is not a certified vehicle safety system and should never be relied on for a real bike or motorcycle.
- MQ-3 sensors get warm during use — avoid touching the sensor element directly.
- Keep fingers clear of the servo brake arm and motor while powered on.
- Never test the alcohol sensor with real alcohol — household rubbing alcohol fumes from a safe distance are enough to demonstrate the concept, with adult supervision.
Frequently Asked Questions
What counts as "automatic road sign indicator" in this project?
This build focuses on automatic turn indicators that respond to handlebar movement. Reading actual road signs would need a camera and image recognition — a bigger project on its own that pairs well with this one!
How do I find the right alcohol threshold?
Watch the raw sensor values in the Serial Monitor in clean air first to find a normal baseline, then set alcoholLimit a bit above that baseline so it only triggers on a real change.
Can the turn signals auto-cancel like a real bike?
Yes! Add a timer using millis() that turns the LED off automatically a few seconds after the button is released, instead of following it exactly.
What age group is this project good for?
Because it combines several safety-critical sensors and a relay, this project is best suited for kids around age 10+ working closely with an adult.
Comments
Post a Comment