Line Follower Robot With PIC18F

About: Student of Mechatronics

Intro: Line Follower Robot With PIC18F

RACE LINK

I made this line follower robot for my microcontroller course in university. So I made this basic line follower robot with using Pic 18f2520 and used the compiler of PIC CCS. There is many line follower project on the internet with ardunio or pic but many of projects are very similar. Because of this reason, I will explain how I chose components and why chose and I will give some tips for efficient line follower robot.

I designed sensor card with using CNY70 and I set up the circuit on the breadboard. If you want you can design a monolithic PCB for all components but it will be troublesome if you do not have enough experiences about how to PCB.

Step 1: Choosing PIC Microcontroller

Some 16f pics are very convenient for line follower and they are quite cheap. I chose 18F2520 because it has enough I/O and 32k program memory and the most important thing is it supports oscillator up to 40MHZ and it is quite important to process data.

Step 2: Motors and Battery

I used 4 micro dc motors 6v 350 rpm. You can provide very good balance with 4 motor and very basic code against 2 motors. If you want you can choose a motor which has highest rpm but 350 rpm has quite fast for me and they have very large torque. Additionally, four motors have very efficient movement and turning.

Li-Po battery feed my robot, sensor card, motors, Pic and other components.My lipo was 30c 7.4v 1250ma.I did not encounter about energy problem in the race but four motors consume high energy and you should 1750 ma battery if you want to make a lot of test.

Step 3: Components

  1. Pic 18f2520
  2. 20mhz crystal
  3. R1....................................................................4.7k resistor
  4. C1 and C2...................................................... 33pf cap.
  5. Button
  6. 7805 voltage regulator
  7. 16v 100 uf capacitor(electrolytic)
  8. C4 C5 C6 and C7............................................100pf x4
  9. SN74HC14n
  10. D1....................................................................Led
  11. L293B x2

  12. Switch

  13. Micro dc motor 6v 350rpm x4 (you can choose another option)

  14. Wheels x4 (I chose R5 mm wheels)

  15. Lipo Battery 7.4v 1250ma (1750 ma could be better)

  16. Step down circuit (Optionally, It depends on your battery and motors)

  17. Jumper cable

For Sensor Card

  1. CNY70 X5
  2. R10 R11 R12 R13 R14..................................................20k resistor X5 (I used 1206 smd resistors, as you wish you can choose dip package)
  3. RV1 RV2 RV3 RV4 RV5.................................................22k trimpot X5
  4. CR2 CR3 CR4 CR5 CR6...............................................330 ohm X5
  5. J1 male header
  6. Printed circuit materials

Step 4: Circuit Schema

Step 5: Sensor Card

I glue the sensor card under the breadboards but the distance between CNY and floor must be appropriate. Aproppimatly 1-0.5 cm is enough.I soldered jumpers cables on J2 to J6 and connected them on sn74hc14n inputs.

Step 6: Codes

You can download the codes. Basically, there is a forward, left and right return codes included. If you want to increase the speed of robot you should change the delay codes.

Step 7: Critical Hints!

  • One of the most important part is sensor card so you should receive good data. Distance from CNY and floor must be appropriate, therefore, you measure the voltages on CNY's emitter and you calibrate it with pot. When I was racing the floor was dark so sensors were not working good and I put white LEDs under the breadboard and I calibrate again in this way, I obtained better data.
  • Another important thing is 4 motors. If you use 4 motor instead of 2 motors you can obtain better balance and it will be very successful in returns.

Share

    Recommendations

    • Plastics Contest

      Plastics Contest
    • Electronics Tips & Tricks Challenge

      Electronics Tips & Tricks Challenge
    • Audio Contest 2018

      Audio Contest 2018

    Discussions

    1
    None
    tomatoskins

    3 months ago

    That's a great robot! Thanks for sharing!