PINGBot - Explorer Robot

by BIGDOG1971 in Circuits > Robots

16673 Views, 73 Favorites, 0 Comments

PINGBot - Explorer Robot

IMG_20121208_225137.jpg
PINGBot is the Explorer Robot that uses an ultrasonic sensor to be able to dodge objects present in its path.

The ultrasonic sensor emits pulses at a frequency of 40KHz (imperceptible to the human ear and animals), these pulses when hitting an object, they are reflected and return to the sensor after a certain time; knowing the total time round the wrists and the speed of sound in the medium (the air), it is easy to calculate the distance traveled by the wrists and thus determine the distance of the object relative to the sensor.
See the post about PING sensor for details in https://www.instructables.com/id/Basic-Principles/ 

We will use the same chassis of the BUGBot https://www.instructables.com/id/Basic-Principles/ ... but currently with a dual H-BRIDGE / L298H to control two DC motors (control direction and speed), which will give greater flexibility to our prototype.

The basic operation is as follows:

When booting the robot will remain stopped and the sensor calculates the distance FRONT, RIGHT and LEFT, he will compare these distance with a threshold distance (i.e.20 cm) so it can decide which is the best way to forward (the longest path will always be the best option! ).
After that the Robot will begin to running forward until the moment they will find an object interfering with your progress (it should approach the maximum limit up to a distance, in inches, of the object), when it happens: it will stop and analise again distances: FRONT, RIGHT and LEFT, so he could again decide which is the best way to forward - returning again to the operating cycle.

Programming Logic

1.png
2.png
3.png
4.png
Speaking in terms of logic of programming, we have:

- including libraries;
- initialize variables and constants;
- define and initialize the pins;
- initialize serial communication;
- "BEGIN"
- call routine to stop motors;
- positioning servo to 90 degrees;
- read FRONT distance and store;
- servo position at 0 degrees;
- read LEFT distance and to store;
- positioning servo to 180 degrees;
- read RIGHT distance and to store;
- comparison (1): FRONT is greater than LEFT?;
- yes: - comparison (2): FRONT is greater than RIGHT?;
- yes: - call routine to move forward;
- no: - call routinel to turn right;
- no: - (comparison (1) is less than: - call routine to turn left;
- If any condition is possible (all distances are exactly equals: - move forward and stop for a while, and so begin the cycle again.
- walking distance to detect less than 20 cm;
- loop to the "BEGIN";

Note - 1:
The motors must be connected in order to have the same rotation speed and  direction, so that to take the robot forward - high value on pin 2 of each motor and pin 1 maintained at a low level.

The flowchart show us, how to perform these programming functions (only as example):

Note - 2:
Using the same hardware, a second version with a simpler code was created. Where the operation is as below:

Initially the robot walks forward until he encounter an obstacle at a distance less than the distance limit;
Then he analyzes the "Right" distance - If the "Right" distance is greater than the limit distance - he chooses to turn "Right" and move forward;
If the "Right" distance is smaller than the limit distance - he analyses the "Left"  distance - if the "Left" distance is greater than the limit distance - he chooses to turn "Left" and move forward;
If none of the distances, both "Right" and "Left" is not satisfactory - he turn 180 degrees and move forward.
Starting a new cycle.

In the Software and Programming section, you will find both versions for download.

Hardware and Materials

HXT-900.JPG
L298N Dual H Bridge.jpg
hc-sr041.png
arduino.png
bateria clip.png
bateria-vertical-alkalina-9v-170mah-nao-recarregavel.png
dc-toy-motor1.png
index-php.jpeg
pinos HXT900.JPG
In this section we will examine the needs in terms of materials and hardware used.

We will use the chassis built for BUGBot - Light Follower Robot.
See the post for more construction details...  https://www.instructables.com/id/Basic-Principles/


Material List:
1 x Arduino UNO, Mega, Duemilanove, Duecemila or Teensy + + 2.0
1 x Ultrasonic Sensor HC-SR04
1 x Dual H-BRIDGE
1 x Servo Motor HXT900 9g / 1.8 Kg
1 x Kit Tamiya Gear Box with two 3-6V DC motors
Battery pack to power the Arduino and motors (9V)
Chassis for mounting
Wires and cables for connections.

Layout and Schematics

PINGBot circuit.jpg
DC-Motor noise solution.png
The Arduino power feed, can be used from the H-Bridge.
I advise to use an independent power feed but with GNDs in common
between Arduino and H-Bridge. (due to high current drawn by the motor)

Take care to not reverse the connections of power feed ... the damage may be irreversible.

Pins Correspondence:
Arduino pins -X- External devices' pins:


0 -> N / A
1 -> N / A
2 -> N / A
3 -> PING Sensor echo pin
4 -> PING Sensor Trigger pin
5 -> H-BRIDGE port-A enable pin
6 -> H-BRIDGE in1 pin
7 -> H-BRIDGE in2 pin
8 -> H-BRIDGE in3 pin
9 -> H-BRIDGE in4 pin
10 -> to attach the servo motor
11 -> H-BRIDGE port-B enable pin
12 -> buzzer
13 -> N / A

"I had many problems with noise in the distance sensor system, which was solved by
adding 100nF capacitor between pins of the DC motors and their
carcasses (besides the capacitor which is usually added among its pins).

Software and Programming

SW01.PNG
SW02.PNG
SW03.PNG
SW04.PNG
SW05.PNG
SW06.PNG
SW07.PNG
SW08.PNG
SW09.PNG
SW10.PNG
SW11.PNG

Many versions were created in the construction initial phase of the PINGBot.
It were created a version to manage the DC motors (direction, speed, to turn left, to turn right and for to turn 180 degrees).

And also were created the continous rotation servo motor's version. If you need this version, contact me please and I am willing to help you.

I had a lot of work to do the final adjustments in the Robot (and I think that is not too good so far). First, because the DC motors noise as I already commented, and then for the movements adjust and batery consuption.

About 30 hours were spent in this project. I believe that for any kind of chassis, we will need spent time for the adjustments and debug.

You can download the arduino sketches and libraries directly from the GitHub below:

https://github.com/Arduinobymyself/PINGBot.git

Videos

IMG_20121201_192550.jpg
Watch directly on YouTube, or on screencast (for better quality and download).
I am so sorry, but the videos are in Portuguese yet.


PINGBot version 4 (video 1):
screencast: http://www.screencast.com/t/C6KN0SNhO69p
youtube: http://youtu.be/h5sZfQm27yI

 

PINGBOT version 4 (video 2):
screencast: http://http://www.screencast.com/t/lMa4ZLQIAJj
youtube: http://youtube.com/watch?v=T-sAsfuGtDs

 

PINGBot version 5:
screencast: http://www.screencast.com/t/7pmwaWJhu4dy
youtube: http://youtu.be/b4cjVJgoDPc

 

PINGBot - General operation of the Robot, in action - leaving a deadlock.
screencast: http://www.screencast.com/t/9Uow4fyDy
youtube: http://www.youtube.com/watch?v=KMZmRc_-FhQ

 










Others Projects:

https://www.instructables.com/id/LINUSBot-Line-Follower-Robot/
https://www.instructables.com/id/Basic-Principles/
https://www.instructables.com/id/Dual-H-Bridge-L298-Breakout-Board-Homemade/
https://www.instructables.com/id/3x3x3-LED-Cube-1/
https://www.instructables.com/id/LINUSBot-Line-Follower-Robot-with-PID-control/

Pictures and Photos

IMG_20121201_192438.jpg
IMG_20121201_192452.jpg
IMG_20121201_192501.jpg
IMG_20121201_192522.jpg
IMG_20121201_192533.jpg
IMG_20121201_192550.jpg
IMG_20121201_192559.jpg
IMG_20121201_232044.jpg
IMG_20121201_232107.jpg
IMG_20121201_232112.jpg
IMG_20121201_232118.jpg
IMG_20121201_232209.jpg
IMG_20121201_232217.jpg
IMG_20121201_232224.jpg
IMG_20121208_225026.jpg
IMG_20121208_225038.jpg
IMG_20121208_225049.jpg
IMG_20121208_225111.jpg
IMG_20121208_225124.jpg
IMG_20121208_225137.jpg
IMG_20121210_222814_2.jpg
IMG_20121212_111000.jpg
IMG_20121212_111015.jpg
IMG_20121212_111037.jpg
The problem of battery compartment, was solved using two plastic parts (used in carpentry and furniture making).
The parts were placed on top of the 360 degrees wheel, using the same fixing screws (or ball caster if you are using).
In this way the problem was solved and gave more stability to the chassis.

Note that the DC motor battery is rechargeable type ... it helps us to save money and give more energy to the car.
Use a 9V/900mAh Nickel Metal Hydride (NiMH) batery.