DIY Linefollower PCB

In this instructable, I'll show you how I designed and created my first linefollower PCB.

The Linefollower will have to travel around the parcour above at a speed of about 0.7 m/s.

For the project, I chose the ATMEGA 32u4 AU as controller because of its simplicity and ease to program it.
The sensors used to follow the line are 6 optical sensors of the type QRE1113GR. These are analog sensors.
Because we use named ATMEGA, we're limited to 6 sensors, because this chip only has 6 analog ports.

Our motors are metal geared 6V DC motors. These are tiny motors, but are powerful enough for this use. These motors will be powered by an H-Bridge, the DRV8833PWP, using PWM.

This is the heart of our Linefollower. Other details will be explained below.

Step 1: Designing the Scheme

To design the scheme and the PCB, I used EAGLE. This is free software by Autodesk. It's a bit of a learning curve to use this program. But it's good software and it's FREE :)

I began by importing the ATMEGA. It's important to inspect the datasheet of this chip. Lots of components required to use this chip are described in the datasheet. After importing all required components, I started importing the H-bridge and the sensors. Again, it's important to inspect those datasheets to know how to connect them to which pins of the ATMEGA and what components (resistors, capacitors...) they need.

I added the file with all components used.

Step 2: Designing the PCB

My PCB is double sided. This makes it easier to place a wide variety of components on a small footprint.

Again, designing this isn't easy, it takes time to learn to use this software, but there are lots of educational videos on youtube to help you get going.

Make sure that every pin of the controller or component is connected to something and that every path has it required width.

Step 3: Ordering the PCB

With the finnished designs, you're ready to order!

First you'll have to export the designs as gerber files.

I ordered my PCB's at JLCPCB.com, which I can highly recommend. Fair pricing, fast shipment and good quality boards.

Step 4: Soldering Your PCB

After receiving the PCB's, you can start to solder all the components on it.

Good flux, a themperature regulated solder station and a PCB holder are highly recommended.

There are good youtube video's on how to solder SMD components (Louis Rossman is a hero at this).

Step 5: Flashing Bootloader

After the PCB is succesfully soldered, it's time to flash the bootloader to your ATMEGA.

Follow this link to help you through this:
https://www.arduino.cc/en/Tutorial/ArduinoISP

Step 6: Programming the Linefollower

After flashing the bootloader, you'll be able to access the linefollower in Arduino IDE.

I wrote the program below for the linefollower.

It uses a PID controller to be able to follow the line as good as possible.

Step 7: Configuring the PID Controller

To configure the PID controller, there are a few values to set up.

Kp: this is the amplification, this regulates the speed at which the linefollower reacts to an error. To configure the PID controller its recommended to get as close as possible to a stable system by configuring only the Kp value.

Ki: This integrates the error and hereby, it will correct the error quite brutal. After configuring Kp, Ki can be configured, Kp will have to lowered in normal conditions to be able to have a stable system with Ki added.

Kd: This differentiates the errors. If the linefollower is oscillating, Kd will have to be increased until it stops oscillating.

Share

    Recommendations

    • Growing Beyond Earth Maker Contest

      Growing Beyond Earth Maker Contest
    • Frozen Treats Challenge

      Frozen Treats Challenge
    • Beauty Tips Contest

      Beauty Tips Contest

    Discussions