Bought some PY32F002AF15P6TU in Lichuang Mall, so in order to test the performance of a simple battery internal resistance tester, the measurement range is divided into milliohm and ohm two gears, milliohm gear measurement range shows 00.00 to 60.00 milliohm, the smallest resolution 0.01 milliohm, ohm gear shows 0.000 to 2.000 ohm, the smallest resolution of 1 milliohm, the measurement of current 20mA. Voltage mainly for single lithium batteries, isolation capacitor selected low voltage, to measure the voltage of the battery to change the amplifier output isolation capacitor.

Can be used to measure the battery internal resistance, capacitance ESR, current sampling resistance.

Hardware

common-positive digital tube (electronics)!

The right side is a common power supply and display part will not speak, the main introduction of the left signal part, microcontroller output all the way to 1KHZ PWM model, after RC filtering into a sinusoidal wave, and then through the c15 isolation capacitor, capacitance behind the lift to VCC/2, in the U2.1 voltage follower into the.

After getting raised to VCC/2 sine wave into U2.2 constant current circuit, the sampling resistor is three parallel 100-ohm resistors, TVS protects the op-amp, and then the 1KHZ AC signal is injected into the battery through four parallel 10uF capacitors.

H3, H4, H5, H6 port connected to the Kelvin four-wire test clip, H3, H5 for the current excitation port, H4, H6 for the voltage signal port, through the C43, C44 100NF capacitance isolation capacitor isolation battery DC voltage only to take out the 1KHZ AC voltage, capacitance behind the lift to 1.65V, four transistors here as a diode, leakage than the diode is small.

Then it goes to an instrumentation amplifier consisting of three op-amps with 21 times amplification.

Then enter the U5 analog switch, sampling first attenuation after the amplification mode to achieve the two-stage switching, the benefit is that the phase shift of the two gears is the same as only calibrate a gear on the line, amplify the end of the direct access to the microcontroller ADC.

The microcontroller part is relatively simple, PB3 outputs 1KHZ sine wave, PA0 and PA1 are shorted ADC ports, PB0, PA7, PA4 are SPI ports. H8 SWDIO, H9 SWCLK are SWD debug ports for debugging and downloading programs, PA2 and PA3 are key input ports.

SWD debugging port

H8 SWDIO, H9 SWCLK, the other one is connected to GND.

Four-wire test clip port, one clip for amplifier output + and signal think +, one clip for negative and negative.

Software part
The software is written in GNU ARM assembly, compiler ARM-NONE-EABI.

Timer output 1KHZ sine wave, PA0 and PA1 open two channels of ADC sampling, with another timer to set the trigger frequency of 100KHZ trigger ADC sampling, sampling through the DMA transfer to memory, DMA using cyclic mode sampling 1000 points, SYSTICK timer set to 10 milliseconds to interrupt a time, the following code to realize the above said function.

__adc_dma: ldr r0, = 0x40020000 ldr r1, = 0x40012440 @外设地址 str r1, [r0, # 0x10] ldr r1, = 0x20000160 @储存器地址 str r1, [r0, # 0x14] ldr r1, = 1000 @传输数量 str r1, [r0, # 0x0c] ldr r1, = 0x35a1 @ 0x583 @ 5a1 @传输模式 str r1, [r0, # 0x08] _adcchushihua: ldr r0, = 0x40012400 @ adc基地址 ldr r1, = 0x80000000 str r1, [r0, # 0x08] @ ADC 控制寄存器 (ADC_CR) @adc校准 _dengadcjiaozhun: ldr r1, [r0, # 0x08] movs r1, r1 bmi _dengadcjiaozhun @ 等ADC校准 _tongdaoxuanze: ldr r1, = 0x20000000 str r1, [r0, # 0x10] @时钟分频 movs r1, # 0x03 str r1, [r0, # 0x28] @ 通道选择寄存器 (ADC_CHSELR) ldr r1, = 0x8c3 @0x3003 @连续0x2003 @触发0x8c3 @ 0xc43 @TIM3 0x8c3 @0x2003 @0x8c3 str r1, [r0, # 0x0c] @ 配置寄存器 1 (ADC_CFGR1) movs r1, # 0 str r1, [r0, # 0x14] @ ADC 采样时间寄存器...
Read more »