## Based on Lichuang Liangshan School Smart Car Design
### Circuit design
1. Power supply circuit design.
By consulting the microcontroller design schematic diagram and chip manual, we learned that the microcontroller supports 5V power supply, and other chips and peripherals are compatible with 5V power supply. Two lithium batteries are selected to be connected in series with 7.4V for power supply, and the LDO step-down circuit is used to reduce the voltage to a suitable voltage, thereby supplying power to the entire car system.
![image-20230214120959875.png]

2. The motor drive circuit design
uses RZ7899 motor drive chip. Looking at the chip manual, we can see that RZ7899 is a DC bidirectional motor driver chip that controls the forward, backward and braking of the motor through two logical input terminals BI and FI. It can be combined with the timer PWM output function of the microcontroller to control the motor speed, thereby changing the speed of our smart car.
![image-20230214121625728.png]

3. The obstacle avoidance circuit design
uses the HC-SR04 ultrasonic ranging module to achieve the obstacle avoidance effect of the car by measuring the obstacles ahead.
![Screenshot 2023-02-14 122228.png]

4. The tracking circuit design
uses the internally integrated infrared transmitting tube and infrared receiving tube ITR9909 and the LM393 voltage comparator to design the tracking circuit. It makes use of the principle that infrared light encounters different colors of ground with different reflection degrees. It is connected to the IO port of the microcontroller to receive high and low levels, and the tracking function of the black line is realized through software.
![Screenshot 2023-02-14 122157.png]

5. The Bluetooth circuit design
uses the HC-05 Bluetooth module to receive the Bluetooth signal of the mobile phone to achieve remote control of the car.
![image-20230214122035352.png]

6. Button circuit design
Design two buttons, one is used to start the car, and the other is used to switch the car remote control/intelligent mode.
![Screenshot 2023-02-14 122239.png]

7. LED circuit design
uses two high-brightness LED lights to achieve the effect of car front lights, and two ordinary LED lights to respond to the buttons.
![Screenshot 2023-02-14 122121.png]

8. The power
supply of the power detection circuit is connected to the pins of the microcontroller through resistor voltage division to realize the monitoring of power through the ADC function.
![Screenshot 2023-02-14 122052.png]

9. The buzzer circuit
uses an NPN transistor as a switch to drive the buzzer to sound to achieve the car whistle effect.
![Screenshot 2023-02-14 122217.png]

### The Bluetooth APP implementation
is based on the [App Inventor](http://app.gzjkw.net/login/) website.
![WeChat picture_20230214155511.jpg]

### Code debugging
-LED
-button
-Bluetooth serial communication
-adc collection
-buzzer
-ultrasonic obstacle avoidance
-tracking
### Actual picture
![IMG_20230220_154031.jpg]

![IMG_20230220_154228 .jpg]

![IMG_20230220_154237.jpg]

![IMG_20230220_154245.jpg]

![IMG_20230220_155540.jpg]

![IMG_20230220_155553.jpg]