Add an Ultrasonic Sonar to the Robot Vacuum Cleaner





Introduction: Add an Ultrasonic Sonar to the Robot Vacuum Cleaner

Sonar LV-MaxSonar-EZ1 is tested.
More than one sonar can be connected such way.
Controlled by Arduino with motor shield.
Sonar is connected to analog input pin.
Project is on GitHub 



    • Casting Contest

      Casting Contest
    • Planter Challenge

      Planter Challenge
    • Clocks Contest

      Clocks Contest

    We have a be nice policy.
    Please be positive and constructive.




    Do we just copy-paste and add the code from the link above from the original code in Robot Vacuum floor cleaning robot? And also, aside from the Arduino Atmega48, what other MCU can we use as an alternative? Thank you.

    1 reply

    As far as I remember - the code by the link is fully-functional robot logic, with two bumpers and up to 5 ultrasonic sensors.

    I used only ATmega MCUs. Other people also use PIC and other controllers. MCU need enough digital and analog (ADC) pins for required amount of bumpers and sensors, also two pins with PWM.

    Probably even MCU ATtiny maigh be sufficient (e.g. )

    If the speed of the robot not need to be adjustable - no PWM required, just two digital pins used to change motor direction.

    where did you connect the ultrasonic sensor.? pls hel us in making a project like this

    1 reply

    Program, by the link in the instructables, has comment on top. It describes how the sonar was connected:

    "Ultrasonic sonars can be connected to analog inputs (tested on LV-MaxSonar-EZ1):
    - put pins in array sonarPins in following order: left, right, front, others..
    1. only left and right sonars connected to pins 2 and 3: sonarPins[] = {2,3}
    2. left, right and front sonars connected to pins 2, 3 and 5: sonarPins[] = {2,3,5}
    3. only front sonar connected to pin 5: sonarPins[] = {-1,-1,5}
    4. only left sonar connected to pin 2: sonarPins[] = {2}
    5. only right sonar connected to pins 3: sonarPins[] = {-1,3}
    6. 5 sonars connected to pins 1,2,3,4,5: sonarPins[] = {1,2,3,4,5}"