Chapter 18 - Pros & Cons of various sensors

Pros & Cons of various sensors - Picking the correct sensor for the job:

We have looked at some of the sensors included in our robotic kit in the past few chapters. We know sensors are the input for a robot system.
All sensory(sensor) modules are interfaced to the computing unit (microcontroller) as an input for the robot to make a certain pre-programmed decision.

In this chapter, we will have a brief look at choosing a sensor for your robot & compares some pros and cons you will need to consider when choosing.

We have added two somewhat similar sensors (function, not appearance) into your box of goodies.
Ultrasonic Sensor (HC-SR04)
 Optical time-of-flight (ToF) sensors (VL6180X)

They both measure the distance to the obstacle before them but use vastly different techniques to accomplish the task.



Wiring up the sensors:

Included in your box kits are some Grove cable to female Dupont connectors.  Follow the wiring pinout correctly to prevent damaging either the sensors or the ESP32-C3 CoreModule.


Ultrasonic Sensor (HC-SR04):

HC-SR04 ultrasonic sensor provides a very low-cost and easy method for distance measurement. It measures distance using sonar, an ultrasonic (well above human hearing, unless you are part dog) pulse is transmitted from the sensor unit, and distance-to-target is determined by measuring the time required for the echo to return.

 The ultrasonic sensor module included in your box kit is the newest variant supporting I2C communication. Do not mix in with other ultrasonic sensors you might have!! (They have the same model number & look virtually the same)

Specification:
Ultrasonic Driver IC: RCWL-9206 (Datasheet)
Interface type: i2C interface (i2C Address: 0x57) <-- Fix address
Range: 4cm to 6m 

- Able to detect a transparent obstacle.
- Wide, cone-like field of sensing.
- Virtually blind when proximity is less than 4cm.
- Slower response time.
- Cheaper.

 VCC (Red) is connected to VIN and NOT 2v8.



Optical time-of-flight (ToF) sensors (VL6180X):

The sensor contains a tiny invisible laser beam/source and a matching sensor/detector. The VL6180X can detect the "time of flight," or how long the light takes to bounce back to the sensor.

Specification:
ToF IC: VL6180X (Datasheet)
Interface type: i2C interface (i2C Address: 0x29) <-- Fix address
Range: 5mm to 20cm

- Unable to detect transparent obstacles like glass/acrylic.
- Precise field of sensing.
- Extremely precise for near proximity.
- Fast response time.
- More expensive.

 Todo:

  • Determine a correct Arduino library that works with the VL6180X module. Implement the code necessary to display the range input from the ToF sensor on the OLED display module.

  • Implement a simple proximity sentry alarm for your robot.
    If your robot senses someone approaching (from the front), sound the siren !! 

  • (Just for fun) Did you know that you could mount the ultrasonic sensor on a 9g servo motor? This setup would give the signature radar sweep we often see in war battleship movies.