Introduction: Simplest Light-Source Follower Robot
If you are interested to make a simple robot which follows light, or should i say which walks towards a light source, then you are at the right place...
You can see robot in the two youtube videos in the attachments.
I made this robot for a competition in my college. The specification of the competition may confuse you. I have uploaded the details of the event, but you dont need to go through it. I just wanted to give some additional information.
The best thing about this robot is that it walks to the light source by using just one LDR (light dependent resistor).
For the new bees here, i will give links so that they can catch up fast.
The technique i used for the circuit building is quite unique, i think i must do an instructable on that too. This technique helps me to build small/stable/cheap custom circuits very easily and without going through the etching process or anything else.
for those we wants the PCB design, I will give the eagle files of the circuit board. But do make sure to check the design by yourself, because i will not be able to check them by etching.
the things you would want to know before you would want to make this robot is :
- buy electronics components (online or offline)
- make circuits (handmade on prefboards like me / etching / online circuit ordering / breadboarding will also work, but it will be messy)
- programming msp430g2452 using the TI launchpad and code composer studio (other msp430 - 20 pin microcontrollers will also work)
- learn how to use hot glue gun (actually i used my solder iron for hot glue)
- know a little bit about every component to be used in the circuit
- know a little bit about C programming, so that you can alter your code according to your needs
Feel free to experiment with the design of the robot and do ask me questions, or give me suggestions, i may reply late, but I am honest when it comes to have fun with electronics...
Step 1: The Algorithm
The Basic algorithm used is that :
Step 1 : rotate until the LDR senses light.
Step 2 : while the LDR is sensing light move straight forward.
Step 3 : if the LDR looses the light, rotate the robot in the opposite direction until the LDR senses light
Step 4 : repeat step 2 and 3 forever
the basis of the algorithm is that while the robot is rotating, if it finds a light source, we command the robot to stop. Now due to the time difference between sensing the light and robot coming to rest(fraction of seconds), the robot goes a little bit out of aligned from the light source. hence the next time after the robot looses the light source while moving forward, the robot is made to rotate in the opposite direction.
I have added a few extra things in the algorithm to make robot work smoother, but the basic algorithm remains unchanged.
Step 2: The Light Sensor With Limited Angle Range
Building this light sensor with limited angle range is pretty easy,
all you need is :
- an old tooth brush
- a pen cap
- an LDR
- black color / black tape
- knife/blade/small saw
- hot glue
Steps of construction :
- cut the hairy part of the toothbrush using a knife or a blade, dont cut yourself
- cut the closed end of the pen cap
- fix the LDR in the cap in the position as shown in the figure, using hot glue
- fix the cap on the toothbrush handle too
- solder insulated wires with the LDR as its extension
- color the outer part of the cap black, or you can use black tape too, this is to avoid light.
Step 3: The Circuit Diagram
The circuit is divided into 3 parts :
- the sensor module
- this is the simple circuit module, which is widely used. In short we can say that this is 1-bit analog to digital converter module. If voltage at a point goes below the reference voltage, then the output goes down, and if the voltage at that point is higher than the reference voltage, the output is high. That reference voltage can be adjusted by the potentiometer connected at the pin no.2 of LM358.
- you can get more info about this module all over the internet (example1, example2), there are many circuit using this technique like :
- automatic street light lamp
- color sensor in line follower robots
- fire alarm circuits
- to build the computational unit, i have used the microcontroller MSP430G2452, reasons behind using this IC are :
- Texas instruments gives this IC for free (samples)
- there is no need of crystal oscilator, it has internal oscillator
- It is easy to program with the TI launchpad, by 4 pins (gnd,vcc,test,rest)
- This module is based on the IC L293D, this is motor driver IC, it takes input from the controller and drives the motors accordingly.
Step 4: Building the Circuit
Now this is the most important part of the process.
components needed to build the robot:
- 1 x LM358 - comparator
- 1 x MSP430G2452 - microcontroller
- 1 x L293D - motor driver
- 1 x 8pin & 16pin & 20pin IC base
- 3 x 10k
- 1 x LDR
- 1 x 20k potentiometer
- 1 x small red LED
- 1 x 7805
- 1 x micro switch
- 3 x 4148 diode
- 1 x 100-1000uf capacitor
- 2 x 60-500rpm motors
- 2 x wheels
- 1 x castor wheel / ball wheel
- berg strip
- berg strip connector wires
- prefboard (mine was about 7x12cm)
- TIN wire (28 guage) or other wires according to your method of building the PCB
- hot glue
If you have some experience making printed circuit boards then you can use the attached eagle file.
along with the design files, i have uploaded the different views of the PCB, to help you to place components correctly. when you open your file, dont forget to click on the 'ratsnest' button in order to fill the gaps between the lines. (see images)
Do cross check the PCB design with the circuit diagram of your own before implementing it, because i have not etched the board myself.
people who are new to circuit building, you can use many methods to make the circuit, i am just giving the over view of the methods, you should search about the method which ever suits you:
- in this method, you make the circuit on the breadboard, put components on the breadboard and connect them through wires.
- this method is useful for the people who are not good with soldering
- this is unstable method
- you can reuse the components in other projects
- i would prefer not to use it because the circuit is quite big for breadboarding and you can end up confusing yourself
- but its okay if you want to check your components before actually making the PCB
- in this method, you print the circuit design (from the pcb.brd file) to a paper
- transfer the ink to a copper plated PCB
- put the PCB into an acidic solution for sometime
- shake the solution for fast action
- clean the PCB with water, now unwanted copper will get dissolved in the acid and we will get our tracks
- take off the ink from the tracks
- drill the holes
- mount the components
- in this process, you can just send the PCB design online and they will send the PCB through courier/mail.
- in this process you create your PCB using dotted PCB.
- unlike me, through out the internet people doesnt make neat PCBs using this method.
- so i am thinking of doing an instructable on this soon.
- but you will have good idea seeing the images.
- i used TIN wire to make tracks on the PCB boards.
- you may need a little bit of practise to make such clean PCBs, but its not that hard to do.
Battery : I used three 4v/500mA batteries, connected them in series to get 12v, it is heavy duty and works just fine.
Motors : I used 100RPM motors, but you can use anything between 60-500RPM.
Chassis : I used hardboard, hot glued it to build an open box and fixed the motors on the sides. I fixed a castor wheel at the centre under the box as shown in the image.
Step 5: Hardware Compilation
The LDR sensor which we made in the earlier steps will be fixed at the centre of the circuit board facing forward.
I have not permanently fixed the circuit on the box, i used the battery to keep the circuit from falling, hence it can be detached. This makes it easier to take this robot anywhere.
I used berg strip to attach the motors and battery in order to give it flexibility to change the polarities of the motors and to detach it easily.
Step 6: The C Code
I used Code composer studio to compile and burn the code.
I do not take off the microcontroller to program it, i use the 4 pins on the circuit board (gnd, vcc, test, reset) to do so.
I connected a berg strip to these 4 pins and whenever want to program the controller, i just connect these strip to the 4 pins on the TI Launchpad to feed in the code.
the image here is from another project, but will help you to create a picture of this method.
Step 7: Execution
Feel free to alter the design of the hardware and software, i hope it will give you a good time.
Any suggestions or questions are most welcomed.
7 years ago
hey can we use any other micro-controller in this project.can we use f series micro-controller
7 years ago
This is great!