smallembedded

2019 Question H: Simulated electromagnetic direct fire gun-563353A

 
Overview

Brief description

The basic principle of the electromagnetic curved gun is to use the change in the magnetic resistance of the ferromagnetic circuit of the driving coil to attract the movement of the iron core to accelerate the magnetic projectile. This system uses the STM32F042f6p6 main control board as the core controller and designs a simulated electromagnetic cannon device composed of a matching energy storage capacitor group and an electromagnetic coil. The device is a 10~60V adjustable and controllable low-voltage electromagnetic gun version. It is controlled by sensors. The data obtained by the ultrasonic US-100 and the openMV image processing module are integrated, and functions such as fixed distance, fixed angle launch and self-search bombardment are basically smoothly realized. Based on the design of the electromagnetic gun in 2019, the mechanical structure and control system were redesigned and a fully automatic simulated electromagnetic cannon was produced, which has functions such as automatic loading, wireless sensing, and automatic aiming. The control terminal can use the mobile phone APP to wirelessly control the electromagnetic gun through the HC-05 Bluetooth module.

solikworks model diagram:

QQ picture 20201231203223.png

Final physical picture:

IMG20201125233848.jpg

Question analysis

The 2019 question H electromagnetic gun can be said to be a comprehensive question involving circuits, analog electronics, and control. The most difficult part is the stability and accuracy of the electromagnetic gun launch. The key to the stability design lies in the selection of the MOS tube or relay (however, because the MOS was often burned at the time, for the sake of stability, I ended up using the MG996 servo to control the mechanical switch in the 2019 competition), while accuracy requires attention to the gun. The design of the tube should try not to allow bullets to collide inside the barrel, and of course, ensure the stability of the capacitor voltage (it turns out that the unstable impact point is due to the leakage of the electrolytic capacitor causing fluctuations in the launch voltage).

The picture below shows the actual electromagnetic gun I made in 2019:

1565715514891.jpeg

System solutions

(1) The structure and principle of the electromagnetic curved gun

1. The structure of the electromagnetic deflection gun. The electromagnetic deflection gun can be divided into three types according to its structure: electromagnetic rail gun, electromagnetic coil gun, and electromagnetic reconnection gun. We chose the electromagnetic coilgun design. Our electromagnetic coil gun consists of a launch barrel wrapped with a solenoid, a capacitor, a switch control system and a magnetic projectile. Its basic structure is an LC loop.

image.png

2. The working principle of the electromagnetic coil gun. The magnetoresistive coil gun uses the change in the magnetic resistance of the ferromagnetic circuit of the driving coil to attract the movement of the iron core to accelerate the magnetic projectile. The electromagnetic gun we designed is a single-stage reluctance coil gun. After closing the launch switch, the capacitor serves as a pulsed DC power supply to discharge the coil. The capacitor is instantly discharged to generate a huge current. The current passes through the coil to generate a strong magnetic field, which accelerates the projectile instantaneously. Relying on inertia to shoot out the barrel.

(2) Plan demonstration

1. Demonstration and Selection of Stabilized Power Supply Module The question explains that a DC stabilized power supply can be used for power supply, but after comprehensive consideration, a 3s lithium battery is selected to power the device.

2. Demonstration and selection of capacitor energy storage module 1: Use supercapacitors (100F, 2.5V, 12 in series) as the energy storage element to discharge the coil. Supercapacitors have a large capacitance and can withstand multiple voltage changes and have stable discharge, but their voltage is small and they cannot provide a large enough pulse current. Option 2: Use electrolytic capacitors (4700μF, 63V, 8 identical capacitors in parallel, a total of 37.6mF) to discharge the coil. Electrolytic capacitors have high voltage resistance and can provide large enough pulse current, but their capacitance is small and they are easily damaged. Based on the preliminary test results, option 2 is selected.

3. Demonstration and selection of switch control system In order to achieve a more stable and accurate "one-button start" system and pulse current to discharge the coil, we selected the STM32F042f6p6 main control board. On this basis we discuss switch selection options for capacitor charging and discharging circuits. Option 1: Both parts of the circuit use MOS tubes as switches. The rated power of the MOS tube is small, and the two parts must be connected to the common ground. Option 2: Both parts of the circuit use relays as switches. However, the available current range of the relay is small. All things considered, the MOS tube is smaller and is convenient for welding and PCB. At the same time, the instantaneous current value of the capacitor to solenoid discharge circuit is as high as 27A. Here, a MOS electronic switch is used as the main component of the switch control system.

(3) Final system solution

As shown below:

Hardware structure architecture diagram.png

System theory analysis and calculation

(1) Calculation of electromagnetic gun parameters

In the design process, only the influence of electromagnetic force on the movement of the electromagnetic gun projectile is considered, and the effects of air resistance and guide rail friction in the barrel are ignored. According to the principle of electromagnetic induction, the average magnetic induction intensity B can be expressed as: image.png

(2) Ballistic analysis

Considering the projectile trajectory of the electromagnetic gun as an oblique throwing motion considering air resistance, it can be known from physical knowledge: image.png

Therefore, after collecting the distance data, the angle required to control the gimbal can be obtained.

(3) Energy calculation

The energy storage formula of the capacitor:image.png

When the voltage is 40V, the theoretical storage energy of the selected capacitor group is 30.8J.

Mechanical design

Overall block diagram

image.png

In order to realize automatic loading, this system has designed a magazine to store projectiles, and also designed a servo dial so that projectiles can drop from the top of the platform into the barrel. The effect is as follows:

Preview of homemade fully automatic electromagnetic gun_Trim.gif

In order to better match different firing voltages, this system designed an innovative barrel. The barrel integrates a single-point laser for aiming, and a servo pushrod to match different capacitor voltages to increase launch distance and improve energy efficiency; a photoresistor interface is also reserved to monitor in real time whether there are residual bullets.

laser image.png

Photogates and actuators SDMEMS_IZ)B8%0Z$@K~BX5.png

In terms of coil design, since this device is a low-voltage version and has a large output current, the diameter of the coil needs to be larger (more than 10mm). To generate a stronger magnetic field, we only need to increase the number of turns of the coil (the middle part of the coil can be wound with a few more layers)

image.png

hardware design

Please refer to the third part of the system design for details on hardware connection and functional classification .

Since this system uses an integrated circuit board, the electromagnetic gun charging, power generation, and pan/tilt control functions are all integrated on a PCB. Therefore, for hardware design, please see the schematic diagram and PCB in the document section, which are all drawn using Jialichuang EDA. There is more detailed information and will not be introduced here. Special note: This device is reserved for host computer control (USB serial port) and CAN control (isolated master control), but both cannot be used at the same time. Special note: whether the CAN communication terminal resistance welding is welded depends on the connection method of the CAN communication network (Baidu can check it in detail), and the PCB CAN should use differential wiring as much as possible. Physical map:

image.png

software design

The software only needs to be divided into 3 parts

1. Electromagnetic gun control panel

image.png

Detailed explanation of some source codes

/**
* @brief 云台控制
* @param None
* @retval None
*/
void GimbalCtrl(void)
{
   //电磁炮自动旋转(-30°~30°)
    static int i=0,dir=0;//dir为转动方向标志
    if(dir == 0){
        i++;
    }
    if(i >= 30){
        dir = 1;
    }
    if(dir == 1){
        i--;
    }
    if(i <= -30){
        dir = 0;
    }
    yawset = i;
    float yawPWM = yawbasic - yawset*11.11f;//根据角度计算出yaw舵机的PWM
    if(yawPWM > 2600) yawPWM = 2600;
    else if(yawPWM < 400) yawPWM = 400;
    TIM3->CCR2 = yawPWM;
    float pitchPWM = pitchbasic + pitchset*11.11f;
    if(pitchPWM > 1900) pitchPWM = 1900;
    else if(pitchPWM < 1290) pitchPWM = 1290;
    TIM3->CCR4 = pitchPWM;
}
/**
* @brief 发射子弹
* @param None
* @retval None
*/
void ShootBullet(void)
{
    HAL_GPIO_WritePin(GPIOA,GPIO_PIN_6,GPIO_PIN_RESET);//开启灯光指示
    TIM2->CCR1 = 0;
    HAL_Delay(800);//延迟一会儿
    TIM2->CCR2 = 19999;//控制N-Mos的栅极,高PWM使能mos
    HAL_Delay(1500);
    TIM2->CCR2 = 0;//关闭mos
    HAL_GPIO_WritePin(GPIOA,GPIO_PIN_6,GPIO_PIN_SET);//关闭灯光指示
    mycommand = 0;
}

If you want to use CAN to control the electromagnetic gun, you need to use the following CAN communication protocol: DLC is 0x08

Instruction set description: 1 is for charging the capacitor bank; 2 is for launching the electromagnetic gun

Effective range of PTZ parameter control: -90°~90°

Instructions for whether the projectile is loaded : 1 means loading is complete, 0 means no projectile

StdId it bit0 bit1 bit2 bit3
0x101 Instruction set: launch as 2 None Capacitor voltage high 8 bits Capacitor voltage low 8 bits
0x102 Input voltage high 8 bits Input voltage low 8 bits Capacitor voltage high 8 bits Capacitor voltage low 8 bits
StdId it bit4 bit5 bit6 bit7
0x101 yaw*1000 high 8 digits yaw*1000 low 8 bits pitch*1000 high 8 bits pitch*1000 low 8 bits
0x102 Whether the projectile is loaded None None None

2. Since the attached code of the PTZ control panel has many comments, it will not be introduced in detail here. The idea block diagram is as follows:

image.png

3. openMV image processing board openMV has many ready-made routines, and the attached source code has many comments, so I won’t go into details here. The idea block diagram is as follows:

image.png

APP design

Overall block diagram:

image.png

APP design This system uses E4A, which uses Chinese + graphical programming. There is not much to pay attention to in APP design. You only need to use the corresponding module interface. Warm reminder: E4A has many routines! The APP interface is as follows: image.png

Summarize

In general, the electromagnetic gun in 2019 is a comprehensive question, which tests the integration ability of the participating team members.

This system took three weeks and the functions have been debugged. Please see the attachment for a summary of the data.

For more details, please view my B-site: Homemade Fully Automatic Electromagnetic Gun

Everyone is welcome to leave a message for discussion.

参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-06-23 10:48:51

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
community

Robot
development
community

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号