Introduction: Simplest Light-Source Follower Robot

Hello everyone,

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 :

  1. soldering
  2. buy electronics components (online or offline)
  3. make circuits (handmade on prefboards like me / etching / online circuit ordering / breadboarding will also work, but it will be messy)
  4. programming msp430g2452 using the TI launchpad and code composer studio (other msp430 - 20 pin microcontrollers will also work)
  5. learn how to use hot glue gun (actually i used my solder iron for hot glue)
  6. know a little bit about every component to be used in the circuit
  7. 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 :

  1. an old tooth brush
  2. a pen cap
  3. an LDR
  4. wire
  5. black color / black tape
  6. knife/blade/small saw
  7. hot glue

Steps of construction :

  1. cut the hairy part of the toothbrush using a knife or a blade, dont cut yourself
  2. cut the closed end of the pen cap
  3. fix the LDR in the cap in the position as shown in the figure, using hot glue
  4. fix the cap on the toothbrush handle too
  5. solder insulated wires with the LDR as its extension
  6. 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 :

  1. the sensor module
    1. 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.
    2. you can get more info about this module all over the internet (example1, example2), there are many circuit using this technique like :
      1. automatic street light lamp
      2. color sensor in line follower robots
      3. fire alarm circuits
  2. the computational module
    1. to build the computational unit, i have used the microcontroller MSP430G2452, reasons behind using this IC are :
      1. Texas instruments gives this IC for free (samples)
      2. there is no need of crystal oscilator, it has internal oscillator
      3. It is easy to program with the TI launchpad, by 4 pins (gnd,vcc,test,rest)
    2. you can use any other MSP430G2xxxx microcontroller also. If you want to use any other micro controller like PIC/Atmega etc then you will have to write your own code (the algo is already explained)
  3. the actuator module
    1. 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. 1 x LM358 - comparator
  2. 1 x MSP430G2452 - microcontroller
  3. 1 x L293D - motor driver
  4. 1 x 8pin & 16pin & 20pin IC base
  5. 3 x 10k
  6. 1 x LDR
  7. 1 x 20k potentiometer
  8. 1 x small red LED
  9. 1 x 7805
  10. 1 x micro switch
  11. 3 x 4148 diode
  12. 1 x 100-1000uf capacitor
  13. 2 x 60-500rpm motors
  14. 2 x wheels
  15. 1 x castor wheel / ball wheel
  16. berg strip
  17. berg strip connector wires
  18. prefboard (mine was about 7x12cm)
  19. TIN wire (28 guage) or other wires according to your method of building the PCB
  20. hardboard
  21. 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:

  1. breadboarding
    1. in this method, you make the circuit on the breadboard, put components on the breadboard and connect them through wires.
    2. this method is useful for the people who are not good with soldering
    3. this is unstable method
    4. you can reuse the components in other projects
    5. i would prefer not to use it because the circuit is quite big for breadboarding and you can end up confusing yourself
    6. but its okay if you want to check your components before actually making the PCB
  2. etching
    1. in this method, you print the circuit design (from the pcb.brd file) to a paper
    2. transfer the ink to a copper plated PCB
    3. put the PCB into an acidic solution for sometime
    4. shake the solution for fast action
    5. clean the PCB with water, now unwanted copper will get dissolved in the acid and we will get our tracks
    6. take off the ink from the tracks
    7. drill the holes
    8. mount the components
  3. online PCB shops
    1. in this process, you can just send the PCB design online and they will send the PCB through courier/mail.
  4. hand made PCB using prefboard - my method
    1. in this process you create your PCB using dotted PCB.
    2. unlike me, through out the internet people doesnt make neat PCBs using this method.
    3. so i am thinking of doing an instructable on this soon.
    4. but you will have good idea seeing the images.
    5. i used TIN wire to make tracks on the PCB boards.
    6. 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.

Attachments

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.