It’s a arduino project prototype, focus on motorbike riders. This product advise with lights to the people that is not respecting the "law of distancie with the vehicles" on you when you ride. If the car is getting closer than beetwen 3m or 1,5m, the red leds of the helmet gets on, and if they go less than 1,5m change to orange leds. This leds are used for warning other cars and prevent an accident.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: The Problem That Worries Us

Nowadays, in traffic accidents, the highest percentage is due to a motorcycle accident. Cars never respect safety distances, hence there are collisions from behind. With motoalert the cars will be warned if they get too close to your bike, and that can avoid many accidents of people driving clumsily.

Step 2: Write the Code

#define trigPin 13
#define echoPin 12

#define led 11

#define led2 10

void setup() {

Serial.begin (9600);

pinMode(trigPin, OUTPUT);

pinMode(echoPin, INPUT);

pinMode(led, OUTPUT);

pinMode(led2, OUTPUT); }

void loop() {

long duration, distance;

digitalWrite(trigPin, LOW);


digitalWrite(trigPin, HIGH);

// delayMicroseconds(1000);


digitalWrite(trigPin, LOW);

duration = pulseIn(echoPin, HIGH);

distance = (duration / 2) / 29.1;

if (distance >= 150 && distance < 300) {

digitalWrite(led, HIGH);

digitalWrite(led2, LOW);


else if (distance >= 0 && distance < 150) {

digitalWrite(led, LOW);

digitalWrite(led2, HIGH);


else {

digitalWrite(led, LOW);

digitalWrite(led2, LOW);


if (distance >= 300 || distance <= 0) {

Serial.println("Out of range");


else {


Serial.println(" cm");


delay(500); }

Step 3: Material for Electronic Sensor Part

We need:

- 5 red leds

- 5 orange leds

- 2 resistors of 56 ohms

- 2 resistors of 220 ohms

- 2 Transistors bjt npn

- Arduino uno

- Ultrasonic sensor HC-SR04

- Cables

Step 4: Weld Leds Base and Made Circuit

For not use one pin for each led, we use 1 transistor bjt npn, for active all leds of the line. We conect all leds to resistence for limit current and protect leds and transistors.

Step 5: Prove the Circuit

We made all circuit and connected to the computer and we it works good!

Step 6: Build the Prototype

Using a helmet carcase, we installed the sensor, leds base and the arduino. For not connect arduino to the computer, we put a 9v battery source.

Step 7: Let's Drive Now Safety!

Arduino Contest 2017

Participated in the
Arduino Contest 2017

LED Contest 2017

Participated in the
LED Contest 2017

Be the First to Share


    • Made with Math Contest

      Made with Math Contest
    • Multi-Discipline Contest

      Multi-Discipline Contest
    • Robotics Contest

      Robotics Contest

    4 Discussions


    1 year ago

    Hey !
    You are onto a brilliant idea here. In my opinion, all vehicles should be equipped with a similar system.

    I don't know if you are using the helmet om the road in this state, or if it is just a prototype, but i do want to let you know that it might not be safe to drill holes in your helmet and mount electronics inside.
    The holes might alter the structural integrity of your helmet, stopping it from protecting your head.
    Also, the parts inside of the helmet may cause injury to your head should you crash.

    Depending on where you live you can also get in trouble with the law and insurance. In my country (the Netherlands), and probably a lot of other European countries, too, you are not allowed to alter your helmet in any way, or have a damaged helmet. The police can give you a ticket for it, and it may void your insurance.

    But then again, it is a brilliant concept and the safety/law concerns are really the only flaws in your idea, if the helmet shown is not just a prototype.

    peace and keep riding and inventing

    1 reply

    Reply 1 year ago

    Yes, he got a point, maybe you could use it on your motorbike! And you could add also buzzer or a loudspeaker with a warning to the car saying you are too close! or something, eventhough nice project!


    1 year ago



    1 year ago

    That's a neat solution, it's easy to manage and to see :)