1. Project function introduction
Main control chip N32G430C8L7;
Motor driver AS4950;
Attitude sensor MPU6050; Control forward and backward through ESP8266 communication, and upload attitude information to the peripheral ranging ultrasonic module
of the host computer 2. Project attributes Participate in the summer vacation held by Lichuang & National Technology The training camp was delayed due to various unexpected events. 3. Open source agreement GPL3.0 4. The hardware part, frame and battery , can be purchased according to the situation. In fact, the frame can also be made using PCB (you have to draw it yourself). Just buy two coded motors. Pay attention to the copper of the PCB board and the frame. The post holes must correspond, otherwise there will be no room for installation. The company that controls the part of the company. Filter capacitor Each power interface is connected to a 100nf capacitor for filtering, and an additional 4.7uf capacitor is added to one pin. BOOT BOOT1 has been pulled up internally by default. The hardware only needs to be configured with BOOT0. The serial port downloads BOOT0 and connects to 3v3. The SWD or JTAG download grounding crystal oscillator 32.768k is not needed, so it is not soldered, but it is necessary; 30pf for C1 and C2 is a bit large, I actually I used 22pf, but as long as it can start up, the problem is not big. There are many ways to test the oscillation. You can check it online. I had a problem with the crystal oscillator not being able to oscillate before. It was stuck for a while. Later I found out that it was a chip problem... Power supply It is not recommended to directly 12V->3v3 for the input and step-down circuit. The voltage drop is too large and the current will be hot when the current is high. It first goes through 78M05 and then goes through 1117 to step down the voltage to 3v3. 78M05 can also power the ultrasonic module; use a 0R resistor to drive the motor. Isolated from chip ground. The driver chip used to drive the motor is AS4950. This is the first time I have used it, and many problems have occurred. When the control method is all low to stop, the above situation will occur; yellow is the normal PWM signal, and green is the voltage of the motor. The signal will have a strong back electromotive force, especially when the duty cycle is low, and it will not move at all; but when I switch to the full height to stop state, it can be controlled normally, and no back electromotive force appears; simply find a solution Method, I have used TB6612 before and did not have this problem, but this one is cheaper and can be used. What needs to be noted about the motor interface is that the timer only has encoder mode for channels 1 and 2; pay attention to the positive and negative of the motor encoder, if it is connected reversely, it will cause a short circuit. MPU6050 should be the most familiar attitude sensor, and the price is not expensive. ESP8266 leads to the serial port interface and BOOT interface. When downloading, connect BOOT to ground; pay attention to the serial port and N32 connection after soldering. If you want to download, the serial port of N32 cannot be used. You must first burn the ordinary program (LED routine and the like), and download it. The ESP8266 program, and then the N32 program, are a bit troublesome, but not bad. Ultrasound (not necessary) I use an external MCU to perform ultrasonic ranging, and then output high and low levels to N32 to reduce the burden on N32, but this MCU Jialichuang does not have it, and the burning conditions of this chip are harsh, so it is not necessary It is recommended to use; in the picture above, you can short-circuit ECO and DATA, CLK and TRI with 0R resistors, and directly control them with N32; if you really don't want to bother, don't forget this part. 5. For the software part, refer to the official training camp case - attitude display: [Training camp official case] Real-time attitude based on N32G430, - use the host computer and sending function given in the official case; ADC, serial port transmission and reception use DMA transmission , reduce the use of CPU resources; pwm control driver speed, timer encoder mode speed measurement; I2C acquisition of MPU6050 data (transplantation of official documents); external interrupts occur through the MPU6050 interrupt pin for data acquisition, processing and control; ESP8266 arduino development, I I am also a novice, and I basically learn and sell now. There will be packet loss when transmitting data (we will see if there is a solution later), but the successfully transmitted data is still enough. The last thing is the algorithm, which is also balanced. The core part of the car, recommended: Walking around the world, I feel it is very well explained, and then use N32 as ST to configure my project
