Introduction: Arduino Leonardo LED Radar

Using an Ultrasonic sensor, LED light and a stepper motor, I created a radar like contraption which makes the LED light up when the sensor senses something within a chosen distance, indicating that there is an object in that direction. The machine is simple to make but fun to use. The three main components, the stepper motor, ultrasonic sensor and a LED light can be easily installed. The three components can be set up separately. All you need to know to make this device would be how to individually and separately setup the three components. Then, using coding, you make connections between the three components, creating a perfect device, perfectly using all three components. NONETHELESS, BECAUSE ARDUINO CAN NOT HAVE TWO SETS OF DEVICES WORKING SIMULTANEOUSLY, SO YOU WOUL HAVE TO USE TWO SEPARATE DEVICES (ARDUINOS) IN ORDER TO HAVE THE PERFECT LED RADAR.

Step 1: Materials / Supplies

1. Stepper Motor x1

2. Arduino chords and USB chord

3. Ultrasonic Sensor x1

4. Arduino LED x1

5. Arduino resistor x1

Step 2: Circuit

The circuit is simple. All you have to do is install and set up the three main components separately (LED, Ultrasonic Sensor, Stepper motor). Follow the picture above to finish the circuit part of this project. WHEN DOING THE CIRCUIT, FIRST DO THE ULTRASONIC SENSOR AND THE LED LIGHT, THEN INSTAL THE STEPPER MOTOR SEPARATELY ON ANOTHER ARDUINO DEVICE.

Step 3: Coding / Code


int ardublockUltrasonicSensorCodeAutoGeneratedReturnCM(int trigPin, int echoPin)
{ long duration; pinMode(trigPin, OUTPUT);

pinMode(echoPin, INPUT);

digitalWrite(trigPin, LOW);


digitalWrite(trigPin, HIGH);


digitalWrite(trigPin, LOW);

duration = pulseIn(echoPin, HIGH);

duration = duration / 59;

if ((duration < 2) || (duration > 300)) return false;

return duration; }

void setup()


digitalWrite( 6 , LOW );

pinMode( 5 , OUTPUT); }

void loop()

{ Serial.print("distance:");

Serial.print(" ");

Serial.print( ardublockUltrasonicSensorCodeAutoGeneratedReturnCM( 6 , 7 ));

Serial.print(" ");


if (( ( ( ardublockUltrasonicSensorCodeAutoGeneratedReturnCM( 6 , 7 ) )

< ( 30.0 ) ) && ( ( ardublockUltrasonicSensorCodeAutoGeneratedReturnCM( 6 , 7 ) ) > ( 0.0 ) ) )) { digitalWrite( 5 , HIGH ); }



digitalWrite( 5 , LOW ); } }


void __StepMotor(int MotorStep,int MotorSpeed,int pinNumberA, int pinNumberB,int pinNumberC,int pinNumberD)

pinMode(pinNumberA, OUTPUT);

pinMode(pinNumberB, OUTPUT);

pinMode(pinNumberC, OUTPUT);

pinMode(pinNumberD, OUTPUT);

for(int i=0;i

digitalWrite(pinNumberA, HIGH);

digitalWrite(pinNumberB, LOW);

digitalWrite(pinNumberC, LOW);

digitalWrite(pinNumberD, LOW);


digitalWrite(pinNumberA, LOW);

digitalWrite(pinNumberB, HIGH);


digitalWrite(pinNumberB, LOW);

digitalWrite(pinNumberC, HIGH);


digitalWrite(pinNumberC, LOW);

digitalWrite(pinNumberD, HIGH);



digitalWrite(pinNumberD, LOW); }

void setup()



void loop()

{ __StepMotor(1024.0, 10.0, 8, 9, 10, 11);

delay( 1000.0 );

__StepMotor(1024.0, 10.0, 11, 10, 9, 8);


Step 4: Decorating

Use a box (plastic or cardboard) which has the dimensions of16cm x 10cm x 5cm, which is the perfect size, allowing the Arduino and board to fit in the box. Then, according to how you personally set up the device and the breadboard, different set ups should have different places to cut holes. Whereever your LED light is and where you want to set up the sensor and motor, those are the places you would like to cut holes. The holes will allow your components to stick out of the box, performing the functions while hiding the ugly chords and wires.

Step 5: DONE!!!

After you have finished the steps above and have done the steps correctly, the device should work, allowing you to have your own mini radar made with a low budget. Have some fun with it!!!