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 https://github.com/satr/Robot-vacuum-cleaner-controlled-by-Arduino-and-motor-shield
4 Comments
7 years ago
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.
Reply 7 years ago
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. http://www.forkrobotics.com/2012/04/run-arduino-code-on-an-attiny )
If the speed of the robot not need to be adjustable - no PWM required, just two digital pins used to change motor direction.
7 years ago
where did you connect the ultrasonic sensor.? pls hel us in making a project like this
Reply 7 years ago
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..
Examples:
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}"