LC-AI-SC02

From LCWIKI
Jump to: navigation, search

Specifications

Arduino Smart Car Kit.


Overview

LC Arduino mecanum wheel car uses a PCB with better mechanical strength than acrylic as the car chassis, and uses Arduino UNO as the main control MCU. With the 4-way H-bridge L298N motor drive module and Mecanum wheels, it can realize conventional forward, backward, turning and horizontal translation functions that ordinary tires do not have. It is suitable for programming practice of electronic enthusiasts, students and other groups, making programming full of fun!


Feature

1.PCB chassis parameters

  • Support installation of Arduino UNO R3 development board
  • Support the installation of Raspberry Pi Raspberry 2B/3B/3B+/4 and other development boards
  • Supports the installation of DC3-6V TT DC geared motors, with motor clips, easy and reliable assembly
  • With two 18650 battery box installation positions
  • With the installation position of L298N 4-way motor drive module in our shop
  • Support installation of SG90 and camera pan/tilt
  • Support the installation of various sensors, such as: infrared obstacle avoidance, infrared tracking, ultrasonic obstacle avoidance modules, etc.
  • Chassis size: 263*150mm


2.Arduino UNO parameters

  • Microcontroller: ATmega328
  • Working voltage: 5V
  • Number of digital I/O pins: 14 (6 of which provide PWM output)
  • Number of Analog I/O Pins: 6
  • Flash Memory: 32KB, of which 0.5KB is occupied by the boot loader
  • SRAM: 2KB
  • EEPROM: 1KB
  • Clock speed: 16MHz


3.L298N motor driver board

  • Driver IC: 2 pieces of double H-bridge L298N, which can drive 4 DC motors to realize forward rotation, reverse rotation and braking functions
  • Driving voltage VSS1 and VSS2: 5-30V (5V by default)
  • Onboard high current 5V regulator chip LM2596-5.0
  • Logic voltage: 5V
  • Power supply voltage: limit 6-30V, recommended 7-12V
  • Single bridge maximum drive current: 2A
  • 4-way H-bridge maximum total output power: 50W
  • Onboard 4-way 5V pin headers and 1-way USB 5V power output
  • Onboard 3-way 5V servo interface


4. Tire parameters

  • 2 L+2 R mecanum wheels
  • Dimensions: inner diameter: 6.5mm, outer diameter: 80mm, thickness: 37mm


5. Function introduction

  • Forward, backward, turn, horizontal movement
  • Ultrasonic obstacle avoidance, infrared obstacle avoidance, infrared tracking, PS2 handle remote control (optional)
  • You can also add more sensors for DIY

Introduction

1.Introduce for interface
Smartcar-1.png

Smartcar-2.png
1.PCB chassis
2.Arduino UNO R3 main control MCU
3.2 rechargeable 18650 batteries (need to be purchased separately)
4.L298N motor module: can drive 4 motors to rotate forward, reverse and stop
5.Mecanum wheel: Contains 2 R wheels + 2 L wheels, which can realize horizontal movement
6.Infrared obstacle avoidance module: when an obstacle is detected, the indicator light is on and outputs a low level
7.HC-SR04 ultrasonic ranging module: used for ultrasonic obstacle avoidance
8.Infrared tracking module: when the tracking module is pressed to the black line when the car is patrolling the line, the indicator light will light up and output a low level, so that the car can make corresponding attitude adjustments
9.SG90 steering gear: used to support the ultrasonic module
10.DC3-6V DC deceleration TT motor
11.In addition, it also supports remote control by connecting PS2 handles. Customers in need can purchase them
Smartcar-3.png



Hardware connection

1.Installation tutorial
(1)Prepare a PCB chassis of the car, and break off the 8 motor clips of the motor
Smartcar-4.png

Smartcar-5.png

(2)welding motor
①Prepare 4 motors and 8 male-to-female cables
Smartcar-6.png

②Cut off the female head of the cable, then tin the four motor copper sheets, and then solder the cable to the motor lead end
Smartcar-7.png

Smartcar-8.png

(3)Install the motors: Fix the four motors to the chassis with M3*30 screws and motor clips, with the motor leads facing inward.
(If the motor is loose, you can try to stuff some cardboard between the motor and the PCB. It is best to keep the gap between the 4 motors and the PCB chassis consistent, otherwise the car may go off track)
Smartcar-9.png

Smartcar-10.png

Smartcar-11.png

(4)install tires
①Take out 4 tires (2 L wheels + 2 R wheels) and 4 fastening screws (if any)
Smartcar-12.png

Smartcar-13.png

②Insert the tire into the motor and tighten the fixing screws, pay attention to the installation position of the L and R wheels can not be mistaken, as follows:
Smartcar-14.png

Smartcar-15.png

Smartcar-16.png

(5)Installing the 18650 battery pack
Smartcar-17.png

Smartcar-18.png

(6)Use M3*30+6 copper posts to fix the L298N motor drive module, and connect the red and black power cables of the battery box to the VCC and GND of the L298N module respectively
Smartcar-19.png

Smartcar-20.png

(7)Connect the motor drive cable to the L298N drive module:
The two wires of the left motor are connected to OUT1 and OUT2

The two wires of the motor on the right are connected to OUT3 and OUT4

The two wires of the second left motor are connected to OUT5 and OUT6

The two wires of the second motor on the right are connected to OUT7 and OUT8
Remarks: If a certain motor turns in the opposite direction during the test, you can exchange the drive wire of the motor
Smartcar-21.png

Smartcar-22.png

The position of the wheel is defined as follows (Note: L and R here only refer to the position of the wheel, not the type of Mecanum wheel mentioned above)
Smartcar-23.png

(8)Use M3*20+6 copper pillars to fix the Arduino UNO development board
Smartcar-24.png

Smartcar-25.png

(9)Installing the ultrasonic module
Smartcar-26.png

①Use M2*10 screws to fix the SG90 steering gear (pay attention to the direction of the steering gear, the ultrasonic module can be rotated about 90 degrees to the left and right after the ultrasonic module is installed)
Smartcar-27.png

②Use thin wire/screws to fix the HC-SR04 ultrasonic module to the ultrasonic bracket
Smartcar-28.png

③Use M2*6 self-tapping screws to fix the bracket to the blade of the steering gear, and cut the two screws on the blade a bit shorter, if it is too long, it will touch the shell of the SG90 steering gear and affect the rotation
Smartcar-29.png

④Then fix the blades of the servo on the SG90 servo, and it is recommended to straighten the pins of the HC-SR04 for easy wiring
Smartcar-30.png

(10)Install the infrared obstacle avoidance module using M3 * 9+6 copper pillars
Smartcar-31.png

Smartcar-32.png

(11)Install infrared tracking and obstacle avoidance using M3 * 20+6 copper pillars
Smartcar-33.png

Smartcar-34.png

(12)The effect picture after assembly
Smartcar-35.png

Smartcar-36.png

Introduce for module

1.Arduino UNO development board
Smartcar-37-1.jpg

Performance parameter
Smartcar-38.png

Arduino UNO slot port list

Logo Description Logo Description
IOREF Provide reference voltage for the controller (if it is not 5V) AREF Reference voltage input of analog input interface (default is 5V);
RESET Reset Arduino when pulled low GND Ground wire;
3.3V 3.3V voltage output 13 Digital port 13, SCK pin of SPI interface;
5V 5V voltage output 12 digital port 12, MISO pin of SPI interface;
GND Ground wire -11 Digital port 11, PWM output port, MOSI pin of SPI interface;
GND ground wire -10 digital port 10, PWM output port, SS pin of SPI interface;
Vin External voltage input, instead of USB/DC socket -9 Digital port 9, PWM output port;
A0 The first analog input interface 8 Digital port 8;
A1 The second analog input interface 7 Digital port 7;
A2 The third analog input interface -6 Digital port 6, PWM output port;
A3 The 4th analog input interface -5 Digital port 5, PWM output port;
A4 The fifth analog input interface can also be used as the SDA pin of the TWI interface 4 、 -3 Digital port 4; Digital port 3, PWM output port;
A5 The sixth analog input interface can also be used as the SCL pin of the TWI interface 2 、 TX -> 、 RX< - Digital port 2; Digital port 1, serial port output pin; Digital port 0, Serial port input pin;

Note: For more details about Arduino UNO, please refer to the getting started guide document in the documentation.


2.L298N 4-way motor driver board
(1)Introduction of pins and parameters:
Smartcar-39-2.jpg

performance parameter

Working mode H-bridge drive (4 channels) Main control chip 2 double H-bridge L298N
Driving voltage VSS1 and VSS2 (5V by default) 5-30V Power chip LM2596-5.0 switching power supply, better than LM7805;
Logic Voltage 5V Logic Current 0-36mA:
Supply voltage VCC (recommended value) 7-12V Supply voltage VCC (limit value) 6-30V;
single bridge maximum drive current 2A maximum total power consumption 20W;

(2)Instructions for use:
As the main driver chip, L298N has the characteristics of strong driving ability, low heat generation and strong anti-interference ability.
At the same time, the equipped LM2596 switching power supply IC also maximizes the power supply efficiency, lower power consumption, and stronger power!

Connect the steering gear: There are three steering gear interfaces on the board, each of which contains three pins of S, 5V, and GND. The three yellow, red and brown wires of the SG90 servo are plugged in corresponding to S1, 5V, and GND respectively, and the PWM signal for controlling the servo is input from the A1 pin next to it, and the remaining unused servo ports can be used to supply power to external 5V devices.

When in use, VCC and GND are connected to 18650 batteries; IN1-IN8 are connected to the high and low levels output by Arduino to control the forward and reverse rotation and stop of the motor; EN1-EN4 are enable/speed regulation pins.The speed can be adjusted by using the PWM with variable duty cycle output by the single chip microcomputer. If the speed adjustment is not required, the jumper cap can be used to connect to the 5V on the L298N module (at this time, it is running at full speed).
The following is the control logic of IN1-IN8 when controlling the DC motor:
Smartcar-40.png
Note: If the program and the wiring of IN1-IN8 are correct but the direction of a certain motor is reversed, such as motor M1: just exchange the two wires OUT1 and OUT2.


3.HC-SR04 Ultrasonic ranging module
(1)Introduction of pins and parameters:
Smartcar-41.png

performance parameter

Supply voltage ‎DC5V Quiescent current Less than 2mA
Level output High 5V Level output Low 0V
Sensing angle No more than 15 degrees Detection distance 2cm-450cn

(2)Instructions for use:
①Use IO to trigger ranging, and give a high-level signal of at least 10us;
②The module automatically sends 8 square waves of 40khz, and automatically detects whether there is a signal return;
③When a signal returns, a high level is output through the IO, and the duration of the high level is the time from the ultrasonic wave to its return. Test distance = (high level time * speed of sound (340M/S))/2.
Connect the Trig and Echo pins of the ultrasonic ranging module to the I/O port of Arduino, and use digitalWrite(pin, value) to send a high-level trigger signal with a duration greater than 10us to the Trig pin.Then use the pulseIn(pin, value) function to read the high level duration of the Echo pin to calculate the measured distance.


4.Infrared obstacle avoidance module
(1) Introduction to pins and parameters:
Smartcar-42.png

Supply Voltage ‎DC 3.3V-5V Comparator LM393
Detection distance About 2-15cm Detection angle 35°
Output signal Digital signal (0 and 1) Mounting hole 3mm mounting hole

(2)Instructions for use:
When the module detects the obstacle signal in front, the red indicator light on the circuit board lights up, and at the same time, the OUT port continues to output a low-level signal. The detection distance of the module is about 2-15cm, and the detection angle is 35°. The detection distance can be adjusted by the potentiometer. Adjustment, adjust the potentiometer clockwise, the detection distance will decrease; adjust the potentiometer counterclockwise, the detection distance will increase.
The OUT terminal of the infrared obstacle avoidance module is connected to the I/O port of Arduino, and the digitalRead(pin) function is used to detect the level status, so as to judge whether it encounters an obstacle, and make the car take corresponding evasive actions.


5.Infrared tracking module
(1)Introduction to pins and parameters:
Smartcar-43.png
performance parameter

Supply Voltage ‎DC 3.3V-5V Comparator LM393
Detection distance About 2-15cm Drive capability Approximately 15mA
Output signal Digital signal (0 and 1) Mounting hole 3mm mounting hole

(2)Instructions for use:
The infrared emitting diode of the TCRT5000 sensor continuously emits infrared rays. When the emitted infrared rays are not reflected back or are reflected back but the intensity is not strong enough, the phototransistor is always in the off state. At this time, the output terminal of the module is at a high level, indicating that the diode is always off;
When the detected object appears within the detection range, the infrared rays are reflected back and the intensity is large enough to saturate the phototransistor. At this time, the output terminal of the module is at a low level, indicating that the diode is lit.
When doing infrared tracking experiments, you can use black electrical tape to lay a track on the ground (the test program only supports the test of circular or elliptical tracks that are convex outward, and the program needs to be improved for tracks that are convex and concave for a while) The OUT terminal of the infrared tracking module is connected to the I/O port of Arduino, and the level status is detected by the digitalRead(pin) function. Under normal circumstances, OUT outputs a low-level signal. The infrared rays cannot be reflected back or the intensity is not enough. At this time, the OUT terminal outputs a high level, so as to judge whether the car has deviated from the runway.


6. PS2 remote controller
(1) Introduction of pins and parameters:
Smartcar-44-1.jpg
PS2 Handle Receiver Pin Definition:

1 2 3 4 5 6 7 8
DAT CMD NC GND GND VDD SEL CLK ACK

(2)Instructions for use:
The PS2 receiver has a total of 9 pins, only need to use 6 pins of VCC, GND, SEL, CMD, CLK, DAT, which can be directly connected to Arduino, or can be connected through an adapter board, VCC, GND connected to 5V , GND; SEL, CMD, CLK, and DAT are respectively connected to pins 10, 11, 12, and 13 of Arduino. Turn the switch of the handle to ON. At this point, the car can be remotely controlled through the handle (if there is no data transmission within a few minutes, the handle will enter a dormant state, and the connection can be re-established by pressing the START button at this time).

Basic Test

The test program and pin definitions provided in the data are for reference, and customers can make corresponding modifications according to their actual needs and different test environments.
For example, adjust the wheel speed, turning angle, etc. according to different ground friction and battery power to achieve the best results.
The several programs contained in the data are used to test different peripheral modules. The following is an example of the program to test the motor when starting up. Others are similar.
There are detailed wiring and precautions in each program, so I won't repeat them here.

1.Boot Test
(1)Wiring method:
The red and black wires of the battery box are respectively connected to the VCC and GND of the L298 module, and the Vin and GND of the Arduino board are connected to any 5V and GND on the L298N module, and then

L298 electrical machinery
OUT1,OUT2 Left1
OUT3,OUT4 Right1
OUT5,OUT6 Left2
OUT7,OUT8 Right2


Drive motor

Arduino
A0 IN1
A1 IN12
A2 IN3
A3 IN4
A4 IN5
A5 IN6
0 IN7
1 IN18


Control motor forward and reverse rotation, stop

Arduino
3 EN1
5 EN12
6 EN3
9 EN4

The L298 enable terminal is used to control the motor speed, and it can also be directly connected to 5V with a jumper cap to run at full speed.
As shown below:
Smartcar-45.png

Smartcar-46.png

Smartcar-47.png

Smartcar-48.png

(2)Test Methods
Download the "Basic_Test" in the "Test Program" folder, turn on the power switch on the L298 module, and observe whether the four tires are turning forward (the end of the ultrasonic module is the front),If not, change the wiring of the motor at the OUT of the L298N module. For example, if the left motor is wrong, just swap OUT1 and OUT2. For the tests of other routines, please refer to the instructions in each program.