Skip to the content
2 layers11.6 × 11.6 mmSchemat, the printed circuit board in 3D

Fast LineFollower Robot project. Build on STM32 F7 microcontroller with custom PCB. Software, Hardware and QT Application.

Size
11.6 × 11.6 mm
Copper layers
2
Thickness
1.6 mm
Parts
10
Nets
15
Pads
26
Tracks, vias
42, 3
Routed
Yes
KiCad
KiCad 8.0 (file 20240108)
Created
14 Sep 2024
Updated
17 Nov 2024

Overview

Schemat is an open-source printed circuit board by konrad1s, from the konrad1s/LineFollower-Kwark repository on GitHub, published under the MIT licence. It is a 2-layer board of 11.6 × 11.6 mm with 10 parts on 15 nets, routed with 42 tracks and 3 vias.

Its parts include 1 capacitor and 1 IC. It belongs with the robots and motor control boards and the STM32 boards of this library.

README

README.md

Introduction

The LineFollower Robot is an autonomous robot designed to follow a predefined path marked by a black or white line.
This project serves a quite advanced solution including hardware project, embedded software and PC QT application.

A short video demo is available on YouTube.

LineFollower Youtube Video

Example - one of the first - linefollower run:

Hardware

High level block diagram

Schematic and PCB

Electronic circuit diagrams are available in the Hardware/release/schematic folder.
Gerbers files are available in the Hardware/release/gerbers folder.

Main board:

Sensor board:

Encoder board:

Component Details

  1. STM32F722 MCU
    ARM Cortex M7 microcontroller operating at the 216MHz with FPU, Cache, ITCM, DTCM. It powerful enough to handle algorithms and real-time processing required in linefollower applications.
  2. 12x KTIR0711S
    Phototransistor-based infrared sensors used to detect the line by measuring reflected IR light. Arranged in a array at the front of the robot to detect the position of the line. Outputs are connected to the MCU's ADC channels for monitoring.
  3. 12x LEDs
    Each LED corresponds to a KTIR0711S sensor, turned on when the sensor detects the line.
  4. 2x AMS AS5040 Encoders
    10-bit contactless magnetic rotary encoders providing precise angular position measurements. Thanks to the closed-loop control, encoders enables precise control of motor by providing feedback (velocity) for PID controllers.
  5. 2x Pololu TB6612FNG Motor Driver Modules
    H-bridge motor driver modules capable of controlling DC motors. Controller channels are combined to obtain higher current capacity.
  6. 2x Pololu Motor 10:1 HPCB 6V DC Motors
    High-power micro metal gearmotors with a 10:1 gear ratio
  7. Bluetooth Module JDY-31
    Bluetooth serial module enables wireless communication between the robot and PC application.
  8. Power Supply Components
    LiPo 7.4V battery used due to high energy density and ability to deliver powerful burst of current.
    3.3V Low dropout voltage regulator - steps down the battery voltage for MCU, sensors and others modules.

Software

Main run loop

The core functionality is implemented through an event-driven state machine. The primary signal is the LF_SIG_ADC_DATA_UPDATED, which is raised whenever new ADC data is available. Currently every 5ms, however increasing this frequency can lead to better control results.

The activity diagram presents simplified main robot algorithm in RUN state:

Code Structure

Short brief about implemented software components:

  • linefollower: The core component of the software, manages the main event driven state machine. It handles the initialization of all subsystems. This component integrates sensor data processing, PID control algorithms, encoder feedback, and motor management. Additionally, it facilitates communication with the PC application for debugging and configuration purposes.
  • linefollower_config: Defines the default configurations and settings for the robot. This ensures that all hardware related configurations is easily adjustable.
  • lf_signal_queue: Implements a signal queue used for managing events and signals within the state machine.
  • linefollower_commands: Handles the processing of serial communication protocol (SCP) commands received from the PC application. It defines a set of commands for controlling the robot's modes, resetting the MCU, initiating calibration, reading and writing NVM data, toggling debug mode, retrieving session information, and entering the bootloader for firmware updates.
  • lf_calibrate: Manages the calibration process for the sensors. It handles the collection of sensor data during calibration runs, computes appropriate threshold values based on the collected values.
  • sensors: The module is responsible for interfacing with the robot's sensors to detect the line. It processes ADC data to determine states and manages the associated LEDs. Also implements algorithms to detect specific straight lines and right angles.
  • pid: Implements the PID control algorithms used to regulate the robot's motor speeds based on sensor and encoder feedback.
  • encoder: Manages the interfacing with the motor encoders to track the robot's velocity.
  • tb6612_motor: The module interfaces with the TB6612 motor driver hardware to control the robot's motors.
  • nvm: The module handles non-volatile memory operations, enabling the storage and retrieval of configuration data, calibration settings, and runtime parameters. The module ensures data integrity through CRC verification. The nvm module allows the robot to retain configurations across power cycles.
  • scp: Implements the Serial Communication Protocol (SCP) used for communication between the robot and external interfaces such as the PC application.
  • scp_dispatcher: The module acts as a handler for processing SCP commands received via the scp module. It manages a global command queue using a circular buffer to store incoming data, parses SCP packets, verifies data integrity using CRC, and dispatches valid commands to their respective handlers.

Bootloader

Implemented bootloader allows for over the air firmware updates without the need of programmer. This is particularly useful for making quick updates "on the road." The bootloader uses the implemented SCP (Serial Communication Protocol) to receive firmware updates over Bluetooth.

There are 2 methods to enter the Bootloader:

  1. Command-Based Entry From Application
    Send a specific command to trigger reset to the bootloader.
  2. Backdoor Entry
    Enter the bootloader upon power-up by sending a specific command. Ensures that firmware updates are always possible, even if the application has errors causing continuous resets.

FLASH memory layout:

QT Application

The QT Application provides a graphical interface to control, configure, and monitor the robot. The main sections of the interface and their functionalities are as follows:

  1. Connection Panel
    Connection indicator and buttons to establish or terminate Bluetooth communication.
  2. Control Panel
    Starting, stopping, resetting, and calibrating the robot, along with options to enable debug mode, read/write NVM, and display real-time data (speed, error, and timing metrics).
  3. Sensors Panel
    Real-time sensor data display showing actual values, calibration references, and sensor weights.
  4. Configuration
    Includes settings for general parameters, PID tuning for motor control, and encoder adjustments.
  5. Graph
    A real-time graph displaying motor speeds, speed reduction, sensors error, enabling data analysis and adjustments for optimal performance.
  6. Bootloader
    Firmware update controls, including options to enter bootloader mode, switch to the main application and flash new firmware via Bluetooth.
  7. Logs
    Real-time log display with options to save or clear logs, providing detailed event tracking for debugging.

QtApplication

Parts

10
QtyValueFootprintReferences
6TestPointConnector_Wire:SolderWirePad_1x01_SMD_1x2mmTP3, TP4, TP5, TP6, TP7, TP8
2TestPointTestPoint:TestPoint_THTPad_1.0x1.0mm_Drill0.5mmTP1, TP2
1100nFCapacitor_SMD:C_0603_1608Metric_Pad1.08x0.95mm_HandSolderC1
1AS5040Package_SO:SSOP16IC1

More from konrad1s/LineFollower-Kwark

2
  • 4 layers139.7 × 41.3 mmSchemat, the printed circuit board in 3D

    Schemat

    konrad1s/LineFollower-Kwark

    Fast LineFollower Robot project. Build on STM32 F7 microcontroller with custom PCB. Software, Hardware and QT Application.

    74 parts12MIT
  • 2 layers116.8 × 21.9 mmSchemat, the printed circuit board in 3D

    Schemat

    konrad1s/LineFollower-Kwark

    Fast LineFollower Robot project. Build on STM32 F7 microcontroller with custom PCB. Software, Hardware and QT Application.

    42 parts12MIT

Similar boards

  • 2 layers57 × 55.2 mmLogicAnalyzer, the printed circuit board in 3D

    LogicAnalyzer

    gusmanb/logicanalyzer

    24 channel, 100Msps logic analyzer hardware and software

    10 parts5.1kGPL-3.0
  • 2 layers32.2 × 15.4 mmProtector, the printed circuit board in 3D

    Protector

    byrantech/laptop

    anyon_e, a highly integrated, high end, open source laptop. Attempt the impossible.

    10 parts4.3kMIT
  • 2 layers26 × 18 mmConn, the printed circuit board in 3D

    Conn

    yaqwsx/KiKit

    Automation tools for KiCAD

    10 parts2.1kMIT
  • 2 layers44.3 × 30.5 mmLime2-SATA RevA, the printed circuit board in 3D

    Lime2-SATA RevA

    OLIMEX/OLINUXINO

    OLINUXINO is Open Source / Open Hardware, low cost from EUR 24 Linux Industrial grade Single Board Computer capable to operate -25+85C

    10 parts1.5k
  • 2 layers17.8 × 43.2 mmNano Adapter, the printed circuit board in 3D

    Nano Adapter

    VoronDesign/Voron-Hardware

    Cool Hardware designed by the Voron Design group

    10 parts1.1kGPL-3.0
  • 2 layers53.9 × 23.2 mmBuffer, the printed circuit board in 3D

    Buffer

    hoglet67/RGBtoHDMI

    Bare-metal Raspberry Pi project that provides pixel-perfect sampling of Retro Computer RGB/YUV video and conversion to HDMI

    10 parts1kGPL-3.0

Questions

How big is the Schemat PCB?

It measures 11.6 × 11.6 mm and has 2 copper layers, 1.6 mm thick.

What parts does the Schemat use?

10 parts. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the Schemat KiCad files?

From the konrad1s/LineFollower-Kwark repository on GitHub, at the commit this page was made from: the board is Hardware/encoder_pcb/schemat.kicad_pcb and its schematic Hardware/encoder_pcb/schemat.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the Schemat design in my own project?

Its repository publishes it under the MIT licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).