王达业

#The 7th Lichuang Electric Competition#usb ammeter

 
Overview

This project is the 12th assignment of the Circuit Design Training Camp
 
 
* 1. Project Function Introduction
This is a USB ammeter that supports 5V 1A. It can display current, voltage and charging power in real time.
 
*2. The project attributes
are not original, and it is the 12th assignment of the Circuit Design Training Camp
* 3.
Please enter the content of the open source agreement...
 
Note: Altruism is self-interest, please read the following content carefully.
Embrace open source and give the project unlimited value. It is recommended that more than 80% of the core functions of the project be open source;
if a part of the function is irreplaceable and the project cannot solve the corresponding problem after deleting it, then the function implemented by this part is the core function of the project; for example, if an electronic load is designed and a host computer software is designed to monitor power changes, the electronic load is the core function and the host computer software is an auxiliary function; for example, an isolated 485 module is used in the electronic load to communicate with the host computer, then the communication function implemented by this 485 module is an auxiliary function;
the project should choose an open source protocol that suits it. If the project references other open source projects, the source should be indicated and the open source protocol of the original author should be followed; the original project is recommended to use the GPL3.0 open source protocol;
the functions implemented by directly referencing the original circuit or original code of the open source project cannot be used as the core functions of your own project, and the functions directly implemented by using general modules on the market cannot be used as the core functions of your own project.
 
Please fill in the following in the competition stage↓
 
*4. The main
control
N32G430C8L7 microcontroller product of the hardware part adopts a high-performance 32-bit ARM Cortex™-M4F core, integrates a floating-point unit (FPU) and digital signal processing (DSP), and supports parallel computing instructions. The maximum operating frequency is 128MHz, with up to 64KB of on-chip encrypted storage Flash, and supports multi-user partition authority management, and supports 16KB of embedded SRAM. It has a built-in internal high-speed AHB bus, two low-speed peripheral clock buses APB and bus matrix, supports 40 reusable I/Os, provides a rich high-performance analog interface, including a 12-bit 4.7Msps ADC, supports 16 external input channels and 3 internal channels, and provides a variety of digital communication interfaces, including 4 U(S)ARTs, 2 I2Cs, 2 SPI/I2S, and 1 CAN 2.0B communication interface. The N32G430C8L7 microcontroller product can work stably in the temperature range of -40°C to +105°C, with a supply voltage of 2.4V to 3.6V, and provides a variety of power consumption modes. This case uses few resources, and the internal clock has been open source to meet the design requirements, so there is no need for an external clock circuit. It should be noted that each power pin of the chip needs to be connected to an additional 100nF external filter capacitor, and the 1st pin of the chip needs to be connected to an additional 4.7uf filter capacitor.
picture.pngReset circuit, BOOT circuit
Since this design is to adapt to the public version shell, the reset circuit and BOOT circuit are not designed with buttons, and two solder joints are used as short circuits. The
picture.pngpicture.pngburning interface
chip supports a variety of burning methods, such as the common ST-Link, USB-TTL, Jlink and other burners on the market. The corresponding interface has been brought out with a 2.54 spacing pin header for burning in the case.
picture.pngVoltage conversion
Although the MCU used in this case supports a maximum voltage of 5V, considering the possible unstable voltage factors on the USB voltage or other voltages, a 6V to 3.3V LDO is used to power the chip. Even in the case of unstable power supply, the MCU can work normally. It should be noted that the LDO input and output must be connected to 22uF and 100nF capacitors.
picture.pngCurrent sampling, USB input/output
USB input/output
The USB input uses a Type-A male plug, which inputs a 5V voltage. This interface supports a maximum output of 3A. If it is a little larger, it will get a little hot. It is recommended not to exceed 3A of current. If you need to use a larger current, please replace the Type-A male plug.
picture.pngThe USB output uses a 4P sinker female socket. In order to adapt to the public version of the shell, the maximum rated current of this female socket is 1.5A. The actual measurement is 2.5A, but it is not suitable for long-term operation at this current. If you need to use a larger current, please replace it yourself. Current
picture.pngsampling
The current sampling part is the INA199B1DCKR current sensing amplifier (also called a current sensing amplifier) ​​which is commonly used for overcurrent protection, precision current measurement for system optimization, or closed-loop feedback circuits. This series of devices can sense the voltage drop across the shunt resistor at a common-mode voltage of –0.3V to 26V independent of the power supply voltage. There are three fixed gains to choose from: 50V/V, 100V/V, and 200V/V. This series of devices uses a zero-drift architecture with low offset, so the maximum voltage drop across the shunt resistor can be kept to a minimum of 10mV full-scale when sensing current. The parameters are as follows:
Common-mode range: –0.3V to 26V
Offset voltage: ±150μV (maximum)
Supports 10mV full-scale shunt voltage drop
Quiescent current: 100μA (maximum)
Sampling resistor selection
Inserting a low-resistance detection resistor in series in the current path will form a small voltage drop, which can be amplified and thus treated as a signal proportional to the current. However, depending on the specific application environment and the location of the detection resistor, this technology will pose different challenges to the detection amplifier. Generally, the resistance value of the sampling resistor is below 1 ohm, which is a milliohm-level non-inductive resistor, but some resistors have requirements such as sampling voltage, and large resistance value resistors must be selected, but the resistance base is large and the error is large. In this case, it is necessary to select a high-precision non-inductive resistor (which can reach 0.01% accuracy, that is, one ten-thousandth accuracy) to make the sampled data very reliable. The temperature coefficient of the chip ultra-low resistance resistors (0.0005 ohms, 2 milliohms, 3 milliohms, 10 milliohms, etc.), chip alloy resistors, high-power resistors (20W, 30W, 35W, 50W, 100W) and other products is plus or minus 5PPM.
Sampling method
This sampling uses the low-side sampling method, that is, the sampling resistor is connected to the GND loop. This design can calculate the complete differential, follow, amplify, and output when the differential signal is sent to the op amp. If high-side sampling is used, that is, the sampling resistor is placed at a high position between the power supply and the load, although this placement method not only eliminates the ground interference generated in the low-side detection scheme, but also detects the accidental short circuit from the battery to the system ground, but the high-side detection requires the detection amplifier to handle the common-mode voltage close to the power supply voltage. This common-mode voltage value range is very wide, ranging from the level required to monitor the processor core voltage (about 1V) to hundreds of volts commonly used in industrial, automotive and telecommunications applications. Application cases include typical laptop battery voltage (17 to 20V), 12V, 24V or 48V batteries in automotive applications, 48V telecommunications applications, high-voltage motor control applications, current detection for avalanche diodes and PIN diodes, and high-voltage LED backlights. Therefore, an important advantage of high-side current detection is that the detection amplifier has the ability to handle large common-mode voltages. Therefore, the current sampling method of sampling resistor plus op amp is best performed at the low end. Although, low-end sampling will affect the ripple of the signal due to common ground interference. But compared to the high end, the solution is simple, low cost and high reliability.
Note: If the stock of INA199B1DCKR is insufficient, you can replace it with INA199A3DCKT. It should be noted that the amplification factor of INA199B1DCKR is 50. If you use other factors, you need to modify the program and calibrate again.
picture.pngVoltage sampling
The voltage sampling part is composed of a voltage divider circuit composed of two resistors. Its principle is the knowledge of resistor series voltage division. Its typical circuit is as follows:
imagepicture.pngDisplay part
The display part uses a 0.91-inch 4P white OELD screen module, using IIC communication, and the display effect is clear.
imageDesign display effect
QQ picture 20220729114119.jpg 
 
 
 
 
 
*5, software part
compilation parameters
compiler: ARM Compiler version 5 (-O0)
MDK version: 5.31
debugger: ST-Link V2
Notes
If the sampled voltage or current is inaccurate, you can modify the VOLTAGE_FACTOR and CURRENT_FACTOR values ​​in the main.c file according to the actual value. The specific calculation formula is:
VOLTAGE_FACTOR = actual voltage / display voltage
CURRENT_FACTOR = actual current / display current
 
 
*6, 3D diagram
 
 
*7, demonstration
参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2024-11-21 12:47:32

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

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号