Test home robot version 0.3.1


Test the automatic driving mode home robot based on data from the infrared, ultrasonic range finder and encoders.

This article is a continuation of the previous review home robot ver 0.3 .
The idea is to make the robot able to move independently around the house without human intervention. About the selected platform chassis described in the previous article. In the process of implementing and testing was found less acceptable obstacle detection system and will tell you about below.

It is based on radar so to speak - on rotating micro servo, range finders.




Infrared rangefinder SHARP GP2Y0A41SKOF, stated that the measures at a distance of 4 to 30 inches. In reality, however, is able to measure and on, but with greater accuracy. When an obstacle to 4 inches provides distorted information as if an obstacle is on. Sector small beam.


From the graph we can roughly understand the dependence of the signal on the distance.


Test code for the EDM SHARP GP2Y0A41SKOF.

 & lt; code & gt; #define pin A1 void setup () {Serial.begin (9600); pinMode (pin, INPUT); } Void loop () {uint16_t value = analogRead (pin); double distance = get_ GP2Y0A41SKOF (value); // Calculation based on an analog value of the distance in centimeters Serial.println (value); Serial.print (distance); Serial.println (& quot; cm & quot;); Serial.println (); delay (500); } // Return distance (cm) double get_ GP2Y0A41SKOF (uint16_t value) {if (value & lt; 16) value = 16; return 2076.0 / (value - 11.0); } & Lt; / code & gt;  pre> 
 Ultrasonic distance HC-SR04, stated that the measures at a distance of 2 to 450 centimeters. Sector large measure depending on the side ranges from 30 to 60 degrees. Calculating the distance linearly, while the reflected sound is divided by the speed of sound.

Sample code for rangefinder HC-SR04.
 & lt; code & gt; digitalWrite (Trig, HIGH); // Sends a signal to the microcontroller output delayMicroseconds (10); // Hold 10 microseconds digitalWrite (Trig, LOW); // Then remove time_us = pulseIn (Echo, HIGH); // Measures the length of the pulse distance_sm = time_us / 58; // Recalculate in centimeters Serial.println (distance_sm); // Display the port & lt; / code & gt;  pre> 
 And the function pulseIn can set the maximum waiting time signal differently in the absence of the reflected sound waves, he can wait a long time thereby blocking the execution of the program, I have empirically found the following value
 & lt; code & gt; time_us = pulseIn (Echo, HIGH, 50000); & lt; / code & gt;  pre> 
 Just have to say that depending on the surface of the obstacle and the angle of reflection range finders can vary lie. The use of two different types of rangefinder in one direction helps to improve the measurement accuracy. At the moment I primarily motivated by data from the infrared range finder, when it fails, take the data from the ultrasound.

Serva rangefinders rotates 30 to 150 degrees in increments of 30 degrees, the number of empirically taken for simplicity and rapidity of measurements. The measurements are stored in the array and on-demand at any time can be carried out checks on the hit obstacles in a rectangular area in front of the robot.

As part of the robot, for whatever reason did not detect obstacles, decided to determine the robot crashed and can not continue on the data from the encoder mounted on the axle shaft.

Encoders are used here are.

Their mechanism of action is simple, there is an optical sensor on the clearance holes in the disk. Hung sensor change interrupt arduino, sample code below:
 & lt; code & gt; void LwheelSpeed ​​() {coderLeft ++; // Count the left wheel encoder interrupts} void setup () {attachInterrupt (LEFT, LwheelSpeed, CHANGE); } & Lt; / code & gt;  pre> 
 About once every 200 milliseconds, calculated speed of the wheels. Accordingly, if the movement speed of the wheels falls off rapidly, it is considered that the robot collided with an obstacle. After that, he pulls back and turns.

This is not clever sensor system reached almost one hundred percent guarantee obstacle detection. The video can be seen as a robot fulfills all of these situations.

Now I wait microswitches and finish 3d printer, make a robot bumper. Then think will work almost every possible situation.

Some pictures of the robot from different angles.

Open open sours project on the robot, the robot completed yet as to more or less sane state of the circuit design and lay out the source code, if someone need right now in a personal email.

More information, news, photos and videos, see the group vkontakte on this project - vk.com/club23358759

Please comment on what topic to write the next article, to make a video.

Source: habrahabr.ru/post/222657/

Tags

See also

New and interesting