Note: * is a required field,
please fill it in during the registration stage↓
* 1. Introduction to project functions
This project uses the N32G430 series produced by National Technology as the main control, and the data acquisition module uses the MPU6050 six-axis acceleration sensor module to obtain attitude information. It is widely used in flight control, balance car and other fields. It can be seen that it has very powerful functions and is deeply loved by every electronic person. The control module uses a two-dimensional pan-tilt, which is a module that every college student majoring in electronics often comes into contact with. It includes many fields such as motion posture analysis and steering gear motion control. This project combines the two-dimensional pan-tilt and the MPU6050 module to see what kind of sparks they can create.
*2. Project attributes
This project is the first public project, the project is original by the author himself, the project has not won any awards in other competitions, and the project has not participated in the defense at school.
* 3. Open source agreement
GPL3.0,
please fill in during the competition stage↓
*4. Hardware part
4.1 Main control circuit and MCU6050 module data acquisition module

4.2 Servo interface circuit
This module uses optocoupler for isolation. The original intention of the design is that when using the servo, due to the moment of stalling or rapid rotation of the servo, a relatively large reverse current will be generated. If it is not handled properly, it is easy to burn the MCU or some sensors. Therefore, in general, the control signal of the servo needs to be isolated when using the servo. The hardware wiring of the servo is also relatively simple. We only need three lines: power line, signal line, and ground line;

the isolation circuit is as follows:

This is a classic optocoupler isolation circuit. From the schematic diagram, we can see the working principle of optocoupler isolation. On the right, it is the signal input. The PWM in and out will make the light-emitting diode inside the optocoupler isolator emit light. It is a process of converting an electrical signal into an optical signal. The optical signal will be transmitted to the left, and the left is a device similar to a triode. The left is the process of converting the optical signal into an electrical signal, and the energy comes from the external 5V_DJ, and the transmission in the middle is transmitted by light. In this case, the current can only flow forward but not backward, thus protecting the MCU and the sensor.
*5. Software part
Because the MPU6050 module I used is the official one of Zhengdian Atom, its SDA and SCL pins are opposite to those of the MPU6050 module used by the training camp, so I modified the code and swapped the original SDA and SCL, and finally successfully drove the official MPU6050 of Zhengdian Atom. Later, because I added a two-dimensional pan-tilt control, the main control chip needs to generate PWM to drive. So I found in the official data manual that timer 2 can be used to generate two PWMs to control the two servos of the two-dimensional pan-tilt separately. They are PA1 of channel 2 and PA2 of channel 3, as shown in the figure below:

Servo description:
This two-dimensional pan-tilt is equipped with two SG90 servos. This servo is relatively cheap and is the best choice for beginners to get started with servos.

The control of the servo requires the MCU to generate a pulse signal with a period of 20ms, and control the rotation angle of the servo with a high level of 0.5ms to 2.5ms. *6. Please enter the content of
the BOM list ... Note: The BOM list involved in the project. Please upload a screenshot of the BOM in this position. Please upload the list details in the attachment in PDF format. It is recommended to include model, brand, name, package, procurement channel, purpose, etc. The specific content and form should be based on the clear expression of the project composition. *7. Competition LOGO verification loClick zip to download the competition logo! (Competition logo).zip * 8. Demonstrate your project and record it into a video to upload the video requirements: Please shoot horizontally, with a resolution of not less than 1280×720, format Mp4/Mov, and a single video size limited to 100M; video title: Lichuang Electric Competition: {Project Name}-{Video Module Name}; such as Lichuang Electric Competition: "Autopilot"-Team Introduction. More details: https://diy.szlcsc.com/posts/d76d9cb41705430e9a54e7a5feed07a5
