You are on page 1of 3

9. Informatic application.

In this section we will develop two projects with the objective of showing the terms mentioned in the whole essay. They will include the way we did it and we will see with the most interest the programming factor. These projects will be about robots: the first one will be related with industrial machinery and the 2nd one with the use of intelligent robots. The first one will catch an object and will take the object to another point by following some orders that a program developed by us will give. The 2nd one will get out from a maze using two or three sensors and a board where we will charge a program developed by us. Here we want to show you the real application of the things you read some pages ago, where we taught you what a resistor is, what a DC motor is... We will also deal with a problem related with DC motors, which cannot be accurately controlled by their own. Servomotors have got many other parts so we can control them easily and without adding anything to it. For example, if we wanted to make the motor round in a certain sense we would have to supply it in a certain way too. If we wanted to make it in the other sense, then we would need to supply it in the opposite way. So if we wanted to make the motors round in the opposite way they make by their own in an automatic way, what must we do? We'll also teach you how the robots work and how the program interacts with the robot. Let's see it.

B-1
B-1 isn't a very complex robot. It takes the straight distance he has until he hits the wall and when he's close it stars to round so it doesn't hit it. It uses a SRF02 sensor, which is an ultrasonic range finder. It sends ultrasonic waves and wait the time the wave lates to get back. These ultrasonic waves hit objects in front of the emitter and go back to the emitter. The sensor measures the time the wave takes to get 15. Robot's program. back and then sends the signal to the master device.

In this application we've got to make a robot avoid objects. Here we want to show you how does a closed loop machine work like. Now, we'll explain in general words how the code works. In the board Arduino we've got a master device and in the sensor we've got a slave device. Then there are two servo motors which are attached to two pins of the board. When we demand Arduino to do it, it sends a signal to the I2C bus with the code 112. Our slave devices (in this case only one sensor) receive that code and start to listen to the device. It sends it two bytes, one of them to make the I2C stay alert and a second one which tells the I2C what does it have to do. In this case, we tell the sensor that it has to measure distances in centimetters. Then we delay the board about 70ms to let the sensor get the distances and then the master device sends another byte (0x02) and waits for the answer. When it gets the answer makes the answer equal to a variable called reading after translating it into bytes (and not bites). The board takes that information and compares it to a number. In this case we've chosen less than 23 centimetters because of two reasons: the sensor isn't very exact and it can be wrong sometimes. If the condition of the distance becomes true then something which we'll tell later happens. In the other part of the robot we've got two servomotors which in the program are called siz and sder. We attach them to two pins (6-9) and we send them a signal to move. Signals may vary from 0 to 180 and in this case we've modified the servomotors to allow them move more than 360. If we send 0 it moves in one sense at full speed and if we send 180 it moves in the other sense at full speed. If we send 90 it doesn't move, so if we send values between 90 to 180 it'll move in one sense in increasing speed. The same will happen with values between 90 and 0. When the sensors get a value which is less than 23, then the left servo stops moving for a second (1000ms) and only the right one does it so the robot changes its orientation. Possible modifications of the robot are the addition of a new sensor which may help the robot to get orientated, the improvement of the speed of the servos (the robot doesn't go totally straight) and the addition of batteries, which may make the robot more autonomous.

Handyman V1
Handyman is a robotic hand that has got five DC motors and, obviously, 5 freedom degrees. We have developed a very simple Visual C++ application which communicates with the robotic hand by serial communication. It gets guidance by using time orders. This is not a very good system because the motor speed may vary but it works if we run it under some specific conditions, like new batteries, good temperature this is a very unstable system that can't be take seriously in the industry, where they search for the best precision. We'll see more about this robot now.

You can see how to reproduce these robots in our blog.

As we said in the mechanics part, there are many kinds of robots. In toys neither stepper motors nor servomotors are used, using DC motors. They're cheaper. Why do people carry on using servomotors? They use them because with them it's very simple to make a motor change the sense of the movement and the gear box is also assembled with the motor, so it's easier to use. However, when you've got a stable system it's enough with a gear box attached to the robot skeleton and an extern way of changing polarity. This robot brings a symmetrical power supply (it has got 4x1.5v batteries) so we've made a circuit with 3 transistors for every motor and we've attached many cables to every circuit (5 each circuit; power supply +, power supply -, 2 for control and 1 connected with the motor) and when we send a signal through one of the control the connected with the motor sends -3v or +3v, so the motor rounds in the other way. To control it from a computer we've connected the circuit with arduino in 12 pins, 10 for motors, 1 for the led and 1 to the ground. We've developed an application in visual C++ that sends a number by the serial port when we click on a button of the application mentioned. In arduino, at the other part of the serial port, we've programmed a switch sentence that has a case for every pin so, for example, when we give the motor click to the number one (+) then we send to Arduino a number which is 50 and when the variable is considered by the sentence switch and arduino sees that the variable value is 50, it opens the connection determined. It also as got a last number that creates a series of movements. The purpose of this is that we want to show how this kind of robots work in real life. This has got many obvious mistakes because the robot doesn't know if his state is 0 so we have to give it that state with the buttons in the application (manually) and it's time guided so if it has got low batteries the series will be useless. Here goes a little piece of the program in Arduino.

16. A part of the conditional sentence that we use to communicate the Arduino board with the robot.

You might also like