yahboom
HomeLearn
Solution
Blog
Online Store
About Us
EN/中文
8-Channel Tracking Module📖
0. 8-channel line tracking module usage
  • 8-channel line tracking module usage
1. Single board tutorials
1.arduino
  • I2C method
  • IO method
  • Serial port method
2.STM32
  • I2C method
  • IO method
  • Serial Port method
3.MSPM0G3507
  • I2C method
  • IO method
  • Serial Port method
5.Raspberry Pi
  • I2C method
  • IO method
  • Serial Port method
4.MSPM0G3519
  • I2Cnew
  • IOnew
  • Serial Portnew
2. Car Tutorials
  • 1.STM32-Wheeled car chassis_V1
  • 2.STM32-Wheeled car chassis_V2
  • 3.STM32 development board car
  • 4.STM32 self-balancing car
  • 5.MSPM0-Wheeled car chassis_V1
  • 6.MSPM0G3507-Wheeled car chassis_V2
  • 7.MSPM0G3519-Wheeled car chassis_V2new
  • 8.Arduino car(Roboduino)
  • 9.Raspberry Pi car(RaspbotV2)
3. Expansion Tutorialsnew
  • 1.Autonomous driving car
  • 2.Vehicle-mounted balance ball motion control system
Download
  • Code
  • Protocol
Download ZIP

Welcome to 8-Channel Tracking Module repository

9.Raspberry Pi car(RaspbotV2)

RaspbotV2 patrol car

RaspbotV2 patrol car1. Experimental preparation2. Car wiring2.1 Wiring of Roboduino and infrared sensor (this example uses serial communication)Main proceduresExperimental phenomenon:

1. Experimental preparation

  1. Material preparation

  • RaspbotV2 car *1

  • Eight-way tracking module *1

  • 7.4V battery *1

  • Several Dupont wires

  • Several M3 copper pillars and M3 screws

2. Car wiring

After assembling the car, it will look like the following figure

image-2024110100001

2.1 Wiring of Roboduino and infrared sensor (this example uses serial communication)

RaspbotV2Infrared sensor
TXRX
RXTX
5V5V
GNDGND

If the cable is not long enough, you can use a ch340 to connect to the USB port of the Raspberry Pi, and then connect the line tracking module to the ch340, and then comment line 17 of tracking.py and uncomment line 18. image-2024110100002

PID.py and tracking.py must be placed in the same folder in the car's image before they can be run. Otherwise, an error will be reported that the third-party library cannot be found in the following environment. You can install the corresponding library according to the information provided by the car to solve the error.

Main procedures

​x
#Main function
if __name__ == "__main__":
    print("start it")
    
    try:
        while True:
            usart_deal()
    except KeyboardInterrupt:
        pass
    finally:
       #Stop Movement
        bot.Ctrl_Car(0,1,0) #L1 motor backward 0 speed
        bot.Ctrl_Car(1,1,0) #L2 motor backward 0 speed
        bot.Ctrl_Car(2,1,0) #R1 motor backward 0 speed
        bot.Ctrl_Car(3,1,0) #R2 motor backward 0 speed
        ser.write(bytes("$0,0,0#",'utf-8'))

The main function is to perform PID processing for line patrol according to the value of the infrared probe, so that line patrol can be completed on the map with black lines and white background.

In tracking.py, there is a parameter for adjusting PID line patrol. If you want to increase or decrease the speed and optimize the effect, you can adjust the macro definition value inside.

xxxxxxxxxx
#Initialize pid
P = 6
I = 0
D = 0
middle_error = 0 #center
go_speed = 20

  • P: P value of pid line patrol

  • I: I value of pid line patrol

  • D: D value of pid line patrol

  • go_speed: speed of line patrol

 

Experimental phenomenon:

On the premise of ensuring that the wiring and installation are correct, after the 8-way line patrol module is calibrated, the following command can be used to start line patrol.

xxxxxxxxxx
python3 tracking.py

If the 8-way module probe still cannot detect the black and white lines normally, you need to wait until the module works normally before starting the command.

Arduino car(Roboduino)
Autonomous driving car

COMPANY

  • About us
  • Team Style
  • Blog

LEARNING & EXPLORATION

  • Tutorials
  • Edge AI hardware
  • Educational robots
  • Embedded intelligent hardware

WHERE TO BUY

  • Yahboom Online Store
  • Amazon
  • Alibaba
  • AliExpress
  • Mercado

TECHNOLOGY SUPPORT

  • Email: support@yahboom.com

BE A DISTRIBUTOR

  • Email: sales@yahboom.com
QR Code
QR Code

Copyright © 2017-2026 Yahboom. All Rights Reserved.

EN/中文