Cognoscis

Think. Understand. Apply

Simple line follower

Posted by cognoscis on 6th November 2009

I have covered the sensors part in detail in previous posts. Now I will go ahead and describe how to build a very simple line follower (Something I should have done a long time ago). There are a few important things that you must consider before actually building a line-follower. First and foremost, what kind of sensors are you going to use? LDRs are easy to build and very cheap but are not efficient in noisy environment. If the environment in which you intend to use it is noiseless (Has uniform lighting or illumination) then you can go ahead and use LDRs. On the other hand, if you are looking at a sensor that can withstand high noise, then IR sensors are the way to go. The choice of sensor is independent of the rest of the circuit. It is only important from the sensitivity point of view.

Now that you have chosen a sensor, always remember that it will give you a HIGH or a LOW output at the end. Now you can make this high to represent either a presence or absence of a white line (say). It is completely in your control. For the sake of example let us consider a white line on a black background. Now, you place your sensors so that it is on the background, then the sensor sees black. Now set your comparator such that it will output a high when this voltage is fed at its input. A NOT gate can be used to reverse this if you want to. It is completely flexible and in your hands to modify. Next is to decide on a logic circuit to drive the bot. Depending on your logic, the number of sensors will vary. In this example, I am going a use a very simple logic that requires only two sensors. Next, you must consider the placement of sensors. Lastly, the motor driver, meaning, the circuit that will enable you to drive the motors. So, lets start building now.

I will build a white line follower (White line on a black background). For this, LDR or IR sensors can be used. For construction of LDR sensor click here and for IR click here. Now, we have two sensors which are like two eyes of our bot. Using these “eyes” we make it see the line and make it follow the line. Once you have built the sensors’ circuits and tested them individually as explained in those posts, you must no consider their placement. Placement is very very important. Make sure you place them towards the front of the vehicle and they must be on the black background when stationary and not on white line. Now you may wonder why that would be? That is because, its the best way to follow any line. Always, try to locate the background (this I learnt from experience). Refer the figure below to understand it

Placement of the sensors

Placement of the sensors

In the figure, the green circles are the two sensors that hover over the sides of the central white line that is to be followed. The yellow part to which we attach all our circuits, motors and batteries is called the chassis (Pronounced cha-see). Anyway, Now that the placement of the sensors is taken care of, i.e., the eyes have been placed. Now, you need to give it “legs” that being the motors and wheels.

For this purpose, there are many methods that are used. first lets see our “driving force” that is given by the motors. Two important considerations are to be kept in mind. First, what will be the total weight that will be driven by these motors. That will help you in choosing the right torque for the motors. Generally speaking, most of the motors are rated in terms of rpm (rotations per minute). One thumb rule is that lower the rpm of a motor, higher is its torque for the same voltage. So, for starters, I would suggest you to go for 150 – 200 rpm 12 V motors. This will give you reasonable torque and controllable speed for our primitive logic circuit. Second, consideration is the battery power. As suggested above, if you use 12 V motors, you can run them on a 9 V battery, but its rpm and torque will be reduced because the energy supplied by the battery is not what the motor expects for full performance. Of course, you can use 9 V + 3 V to make 12 V and supply it to the motors. That time the motors will run at full speed. But once the battery drains (which is fast if the robot is heavy) the rpm will reduce. You need to consider these things when you start building high precision robots. But for now, we can ignore it for time being.

For wheels, you can use wooden wheels. I use wooden wheel that we got from a wood works shop after a lot of requesting. You can also try toy wheels and use adhesives to fix the wheel to the shaft. You might go for the commercial wheels sold in shops along with the motors if you can access them. When using wooden wheels do remember to put a piece of cycle tube around it for frictional purposes. As for the front, you get Caster wheels wheel that are the best suited for such applications, the ones that are used in movable chairs and stools, but only very small in size. This can be seen in the image below

Ball caster wheels

Ball caster wheels

Then depending on your motors you can use either L-clamp or U-clamp to fix the motors to your chassis. Now comes the electronics part of the robot. Remember, if you use 12 V DC motors, then you will need two separate power supplies. One 12 V for your motors, and the other 5 V for your sensor and control circuit ICs. Since this is not feasible, we will use a “Voltage Regulator” that will take 12 V as input and give 5 V as output. There are many such ICs, we will use the popular LM 7805 voltage regulator (its datasheet can be downloaded from here). The circuit diagram and the image of the IC is as shown in the figure below. The two capacitors are very crucial and must not be omitted from the circuit.

LM 7805 IC with Circuit Diagram

LM 7805 IC with Circuit Diagram

Once we have over come the issue of dual power supply, we can now go ahead and try to run the motors. But, there is a problem, the output of sensors is 5 V but the motors need 9-12 V at least to run. That means, we need to have some kind of a mechanism to convert that 5 V signal to 12 V signal. A number of options are available for this. Pure mechanical relays can be used but these are bulky and not preferred by many. We can then turn to what are called as motor driver ICs which are specially made for this purpose. One more advantage of using them is that we will get some familiarity at the initial stage itself and we will be one step ahead while designing more complex robots as we may require to operate the motors in two different directions (ex. Remote controlled vehicle). That time, these motor drivers come in very handy and will considerably reduce the circuit size. There are a number of motor drivers in the market, many beginners prefer ULN 2003, but I think we can go for L293D motor driver or rather quadraple half H-Drivers as they are called. Datasheet can be found here. Just observe the circuit diagram of the IC in the figure below

L293D internal circuitry

L293D internal circuitry

As seen in the internal diagram, this driver IC has 4 half H-drivers (Triangular buffers in the figure). Each of this driver is made up of transistors to form a H-bridge (totally 6 transistors) that are capable of driving the motors in one direction. So, to drive a motor in both the directions, we need to utilize two such half bridges. As shown above, the pins 4, 5, 13 and 12 are ground pins that must be connected to your circuit ground. Pin 16 is Vcc1 which supplies for the IC. So, we connect it to 5 V as shown in figure below. Now, a 5 V at pin 1 will enable the driver 1 and driver 2 where as a 5V at pin 9 will enable driver 3 and driver 4. In our circuit below, we are using drivers 1 and 4 for the convenience of connection and hence we connect pin 1 and pin 9 to Vcc1 which is 5 V. Since we only go forward following the line, we will use only half the bridge. So, we connect one end of the motor to output of the driver which is pin 3 for driver 1 and pin 14 for driver 4. The other end of the motor is grounded. Make sure that same ends of motor are grounded and the motor is rotating in the forward direction only. If it is rotating in reverse direction, just interchange the connections and you will be able to drive the motors forward all the time. Now, the output of your two sensors must be given as input to these motor driver bridges. That is pin 2 for driver 1 and pin 15 for driver 4 as shown in the figure below. Finally, the most important part is the 12V connection must connected to pin 8 which is Vcc2. Make sure you connect the left sensor output to left motor driver and right sensor output to right motor driver.

L293D with Circuit Diagram

L293D with Circuit Diagram

Thats all! Now just to clarify, for the chassis you can use almost anything. You can use a piece of plywood sheet, or a switch board plate which is a Bakelite plastic or you can use Aluminium sheet or perforated sheets that you gets in some shops. It totally depends on you and what materials are available to you. Now that we are done, its time to try out the line follower. Take a big sheet and paint it black and make a white track. Then calibrate your sensors ( on how to calibrate refer the sensor related posts that here towards the end of the post). Once that is done, just place your robot on the track and watch it go. Once you actually make this first robot, you will become aware of all the practical difficulties that one faces during making a robot work. This is the first step one must take to enter the field of robotics. The first one I ever made, I made it “see” the white line (which I advised you to avoid) and hence it was not very successful when it was presented with obstacle. Watch the 3gp video of the same :D

Any problems, suggestions, broken links; please notify using the comments :)

Tags: , , , , , , , , , , , , , , ,
Posted in Robotics | 2 Comments »

Logical Beings – Robots

Posted by cognoscis on 3rd February 2008

When someone says Robot, a picture of a human looking machine with lots of light work and weird sound comes to our mind. But that is only one small tiny part of a wide range of Robotic models that exists in today’s world. Then one wonders what more designs could be there!

mars_rover-small1.jpg

Setting apart the mythology, we can trace back the evolution of this amazing field of automata to the time before Christ was born. Around 250 BC an ancient Greek engineer named Ctesibus made organs and water clocks with movable figures. According to the Lie Zi text written in 3rd century BC in China, Yan Shi invented a life sized Humanoid Robot that had all the organs made of wood, resin and leather. It could see, walk, sing and even wink when touched at the appropriate positions that were indeed the switches. Removing of an organ would shut down one of its function. This was in 3rd century BC. One more Robot that I like to mention is a mechanical duck made by Jacques de Vaucanson in the 1700s that could EAT grains, FLAP wings and even EXCRETE. Throughout the history, there have been inventions of automatic machines and it is still going on. There have been engineers who drew the models of Robots; how can we forget the great Leonardo DaVinci who made the sketch of a Humanoid Robot called the Mechanical Knight. There have been Authors like Mary Shelly created the Robotic monster called Frankenstein’s monster.

The major difference between the earlier inventions and now is the fact that the Robot of today is an electromechanical system whereas the ancient Robots were Mechanical systems. The greatest addition of the modern world to the Field of automata is the fact that now the Robots have a brain that runs on electricity. With the introduction of the Microprocessors, Microcontrollers, the memory elements and the Stored Program Concept (SPC), Artificial Intelligence (AI) not only gained huge momentum, but also new dimensions. Now there is a whole new world of Robotics out there.

Almost everything in today’s world is being made automatic. The industrial Robots work 24 hours a day and make the products with high precision and are the most widely needed Robots as of today. Robotic limb that can be given to the amputees is definitely something that engineers are proud of. Think of the technology where you could control that arm just by thinking about the action you want to perform. The special instrument on your head will take the generated brain signals and give it to the robotic arm and the arm will do what you want it to do. This technology is still in the RnD stage. The satellites, unmanned aircrafts; Robots that can perform welding in inhuman environments; Robots that can perform the most sensitive, life saving surgeries; Robots that can entertain you, explore the surface of Mars, orbit around other planets and satellites, security systems, gas analyzer that are used in mines, your fuzzy logic equipped washing machine? There are endless robots in this world and there is an endless possibility of making new ones too. Think of a robotic vehicle that can go into a building and diffuse a bomb, the risk of human life is no longer an issue while diffusing the bomb!

With the onset of AI, it has brought in its own fears too. The first popular fear came out as a Novel that I mentioned earlier,Hospitality of Robots. This is from the Seoul airport, Korea that is meant greet the passengers and to prvide them information about the flightsThe Frankenstein. I, Robot a novel by Isaac Asimov (That also came out as a movie later) even gave us three laws that would make sure that here would be no threat by Robots to Humans They are

  1. 1. A robot may not injure a human being or, through inaction, allow a human being to come to harm.
  2. 2. A robot must obey orders given to it by human beings, except where such orders would conflict with the First Law.
  3. 3. A robot must protect its own existence as long as such protection does not conflict with the First or Second Law.

But we all know how that ended. Throughout the time there have been such stories being told of world domination by Robots. Terminator, Matrix and many such movies tell us how AI imbibed machines will take over the world and how humans will have to fight for their survival. The three laws of Robotics

So, in the end I put it this way; Robotics is the field that showcases the creativity and innovation of an engineer, something that is equivalent to art; watching the living things, understanding the mechanics and then creating its mechanical version. The field of Robotics is something that has more good than bad (The main drawback is the fact that it takes away the jobs of people). So, there is so much that has been done and there is so much more that can be done. It is an exciting field to work in both full time or just as a hobby. I have started working in this field recently and right now I and my friends are building our second Robot. I will try and publish more articles on Robotics and any help from your side will be appreciated

-Anoop

Tags: ,
Posted in Robotics | No Comments »