LIDAR/Ultrasonic Transducer -- MC1 Obstacle Avoiding Robot W/Arduino Uno

by mtripoli3 in Circuits > Robots

1856 Views, 29 Favorites, 0 Comments

LIDAR/Ultrasonic Transducer -- MC1 Obstacle Avoiding Robot W/Arduino Uno

MC1_00.jpg

I needed a platform for testing an ultrasonic ranging transducer (based on sound) and a LIDAR sensor (based on Time of Flight - ToF of laser reflection) off objects and figured it would be fun to put together a small robot as a test platform. Using a combination of the two devices I made an obstacle avoiding robot. Currently it just tools around avoiding obstacles with no real goal. Ultimately I'll use the solar cell on the top of the "head" (which is a repurposed lawn ornament striped of it's electronics) to make a "light tracking robot" where it will drive around looking for the brightest spot. As the light changes throughout the day the robot will track the brightest spot.

BTW: I consider this to come under a "true" robot category in that there is no remote control; the robot is fully autonomous, no user intervention. I put "robots" with remote control more under "toy robots".

Supplies

MC1_chassis.jpg
UNO.jpg
motorshield.jpg
chassis_motor_shield.jpg
drok,jpg.jpg

List of components:

Base chassis: for this, I used a robot kit designed for use with a Raspberry Pi. It was convenient to purchase a chassis instead of starting from scratch. The goal here was to test transducers so I didn't get hung up on buy vs. build. Clicking the items in the list are links to Amazon where I purchased the majority of components.

Arduino UNO R3

Arduino motor shield

Arduino blank breadboards as well as headers designed for making a shield

10mm RGB common anode diffused LED's

DROK SMPS power supply - convert the 8.4VDC battery to 5VDC to drive the steering servo

Ultrasonic Model HC-SR04

VL53L0X Time-of-flight Distance Sensor

Start With Bare Chassis With 2 Drive Motors and a Servo Steering

MC1_chassis.jpg

The motors came with some insanely thin wires; I replaced these with some more substantial wire. Each rear wheel has it's own motor. Currently they are run in tandem; the go forward and reverse together at the same time. Eventually I'll add a bit more sophistication and drive the wheels individually in conjunction with the front steering servo.

Attach Arduino UNO

chassis_uno.jpg
chassis_motor_shield.jpg

Drill out a pattern to mount the Arduino UNO R3. I used M3 metric brass stand-offs. The motor shield was then attached to the UNO.

LED EYE's for Fun and Feedback

eye_led_w_resistors_begin.jpg
eye_led_resistors.jpg
eye_led__no-shrink.jpg
eye_led_done.jpg

No robot would be complete with LED "eye's". I in this case I used 10mm RGB diffused LED's. Ballast resistors were soldered to each of LED's. Heatshrink tubing was then applied over the resistor and connection. Note that wires and heatshrink match the color LED to keep things simple when being wired into their drive circuit. These are common anode LED's being driven by a higher voltage than 5V so a small drive circuit is needed. This is a simple 2N7000 N-channel MOSFET in an "open drain" configuration so the logic level from the Arduino UNO can turn on the MOSFET, in turn turning on the respective LED color. A routine in the Arduino drives the LED's GREEN when it the robot is running forward; when it encounters an obstacle, the GREEN is turned off and the RED LED's flash for a short duration during the "avoidance" mode. The code actually has routines for every common color that can be had with RGB LED's (yellow, magenta, white) but these haven't been tied to a function, yet.

Building a "breadboard Shield"

breadboard_complete_00.jpg
breadboard_finished_00.jpg
breadboard_finished_01.jpg
breadboard_00.jpg

There's a bit of interface circuitry needed to drive the EYE LED's, as well as a DC-dc voltage converter circuit. Shown here is the completed shield, attached to the UNO. In order to get the pins lined up straight into the breadboard, the headers are placed into position and inserted into the UNO to hold them in position. The board's leads are then very carefully soldered into place, being careful not to get too much solder running down the pin or else it won't insert into the UNO correctly.

Attach EYE LED's and Power Converter Circuitry

breadboard circuitry closeup.jpg
MC1_00.jpg
magenta eyes.jpg
solar cell and shield.jpg

Shown in this photo is the DROK SMPS (switch mode power supply) connected to the power pin of the steering servo. Not seen are the the three (3) 2N7000 MOSFET's connected to the EYE LED's. These are connected in an "open drain" configuration where the LED is "in the drain" and the Arduino drives the gates. This is a very common circuit and a quick search on Google will show hundreds of examples. In this photo you can see the solar cell (that outputs approximately 4V in bright light) and the breadboard shield.

Battery Power

battery and motors.jpg

We need some battery power to make this all work. I build custom battery packs, so I put together a 8.4V@2500mAh Li-Ion pack. In the lower left hand corner of the photo you can see the switch that either turns on the robot in one position, or charges the battery in the other position. Some zip ties keep the battery in place. You can also see the dual motor drive with the motors and gearheads.

Ultrasonic Transducer

ultrasonic sensor 00.jpg
ultrasonic sensor green eyes.jpg

Finally we come to the reason for building the robot, testing the performance of the ultrasonic transducer. The sensor consists of two sensors, a "send" and a "receive" bells. This unit can be seen below the LED EYE"S in the photo. The sensor is a "time of flight" device; the transmit sensor is driven with a high voltage for 10µS. This causes the device to emit a pulse at a particular frequency. As soon as the pulse is sent, the circuit switches to receive mode and "listens" for the frequency of the return pulse bouncing off an object. The time from when the pulse was generated and the return signal is measured and converted into whatever units you like, in my case it returns the distance in centimeters.


VL53L0X Time-of-Flight Flight Distance Measurement Sensor

tof.jpg
ultrasonic sensor green eyes.jpg

The VL53L0X is a "time of flight" transducer, also referred to as LIDAR which stands for "Light Detection and Ranging". Borrowing and paraphrasing from Wikipedia, "LIDAR is a method for determining ranges (variable distance) by targeting an object or a surface with a laser and measuring the time for the reflected light to return to the receiver". The concept is similar to the ultrasonic transducer; one using sound, the other using light. The photos show the LIDAR device; it is the tiny little device with the white rectangle around it. It contains a laser at 940nM sending out pulses and measuring the time it takes to return to the device. In my testing, the device appears to have about a 2 meter range. By using the ultrasonic device pointed up, and the LIDAR pointing essentially level with the ground (it points up slightly) the ultrasonic device measures one field of view (FOV) while the VL53L0X measures another FOV.

Putting It All Together W/CODE

The video shows the robot tooling around my living room. The algorithm for maneuvering around is very simple; if an obstacle is detected, a random routine is called that turns the steering right or left until the obstacle is no longer detected. It then centers the steering and continues driving around. It still needs some fine tuning, however, the solar cell light detector routine will integrate with this so that it steers to the brightest spot.