基于ESP32和STPD01的双通道智能电源 - SmartPower3
使用ESP32为控制器,支持双通道可调电压、可调电流,每个通道支持最大3A的电流输出,显示屏为480*320 TFT LCD
标签
测试
电源
refdesignshare
更新2022-06-03
2070

技术指标:

输出通道 双通道(最大 50W + 50W)  
输出电压 DC 3.0 V ~ 输入电压 -1 V  
输出电流 每通道DC 3A (最大)   
测量 电压, 电流, 功率 : 最大采样率 : 200Hz (5毫秒 间隔)  
偏移 典型3% (高于5V 1A)  
MCU ESP32-WROOM-32E  
LCD 480×320 3.5“ TFT LCD IPS A
LED RED(电源), BLUE(工作) C, D
按键 ON/OFF/Menu/Cancel, 输出通道 On/Off B, E, F
编码器按键 选择/设置 G
编码器旋钮 调节电压和电流
USB-C 端口 与PC数据通信(5ms ~ 1s sampling rate), F/W 升级 H
输出端子 4mm直径香蕉头x 2 J, I
输入电压 DC 9V ~ 21V K

组件:

 

应用及测试结果:

中断

The interrupts of SmartPower3 are generated from buck converter(STPD01).

Please refer to the STPD01 datasheet for more details.

O.P (过压保护)

The protection is triggered when the voltage sensed on the VSNS pin rises over the OVP threshold.

S.P (短路保护)

The protection is triggered when the output voltage is under the SCP threshold and the Ipk threshold is detected. The device acts by suddenly switching off both HS and LS MOSFET. The device follows a soft-start procedure after 300 ms with default output voltage value.

T.P (过热保护)

The protection is triggered when the internal temperature is over the OTP threshold and the device acts by suddenly switching off both HS and LS MOSFET

T.W (过热报警)

This interrupt is just the alarm at temperature 145-celsius degree.

I.P (电感峰值电流)

The condition is checked cycle-bye-cycle on the high-side and triggered once the current cross the IPK threshold.

记录Smartpower3的数据

This protocol supports firmware Dec 14 2021 or above. If you use old firmware, please refer to this link.
old_protocol

You can collect power data of two channels and the interrupts such as (OTW)Over Temperature Warning via Serial communication on SmartPower3.

需要的硬件

  • SmartPower3
  • Type-C USB cable
  • Host-PC

设置串口记录

After connecting SmartPower3 to your Host-PC through the Type-C cable, you should enable “Serial Logging” with baud rate and interval.
First of all, change to the setting screen with “Menu/Cancel” button. After that move to “Serial Logging” section with the dial and set the baud rate and interval with the dial button as following gif image.

When the logging is enabled, you can see the green log icon in the top right corner on the LCD.

在上位机上运行串行记录

There are many applications for serial communication. You can choose your preferred serial program.

The following picture is that I run “GNU screen” for serial communication on my Linux PC. “Gnu Screen” makes it easy to save as a file.

welcome to minicom 2.7.1

OPTIONS: I18n 
Compiled on Dec 23 2019, 02:06:26.
Port /dev/ttyUSB0, 18:41:50

Press CTRL-A Z for help on special keys

0000815169,15296,0036,00550,0,00000,0000,00000,0,00,00000,0000,00000,0,00,14,12
0000816107,15298,0038,00581,0,00000,0000,00000,0,00,00000,0000,00000,0,00,13,15
s

数据记录协议
(ms) , volt(mV) , ampere(mA) , watt(mW) , on/off , volt(mV) , ampere(mA) , watt(mW) , on/off , interrupts , volt(mV) , ampere(mA) , watt(mW) , on/off , interrupts , CheckSum8 2s Complement , CheckSum8 Xor '\r\n'

校验

The checksums are determined by the sum of “Time”, “Channel 0 Output” and “Channel 1 Output”. The size is 74bytes.
https://www.scadacore.com/tools/programming-calculators/online-checksum-calculator/

中断

0 Overvoltage protection
1 Constant current function
2 Short-circuit protection
3 Power-on
4 Watchdog
5 Overtemperature protection Junction temperatrue 165 Celsius
6 Overtemperature warning Junction temperature 145 Celsius
7 Inductor peak current protection

For example,

012346286,19146,0086,01646,0,00000,0000,00000,0,00,00000,0000,00000,0,00,38,22

Logging with telnet on Smartpower3

The TCP logging(telnet) on SmartPower3 was deprecated, please use UDP logging instead. In the case of TCP, the speed of SP3 slows down a lot while waiting for an ACK.

Logging with telnet on SmartPower3

UDP logging on SmartPower3

The firmware build date of Smartpower3 has to be “2021/DEC/14” or above. Please refer setting menu on your SmartPower3 to check the build date.

Hardware Requirements

  • SmartPower3
  • Type-C USB cable
  • Host-PC
  • WiFi router(2.4GHz)

Configuring an WiFi via serial port

First of all, you have to connect SmartPower3 with Host-PC via Type-C USB cable. And then, run your preferred terminal program.
The baud rate has to be the same as the value shown on your smart power3 setting menu.

For example, in Linux.

odroid@odroid:~$ sudo apt install minicom
odroid@odroid:~$ ls /dev/ttyUSB*
/dev/ttyUSB0
odroid@odroid:~$ sudo minicom -D /dev/ttyUSB0 -b921600

Enter a command mode in your SmartPower3

After that, type CTRL-C to enter into the command line mode in your SmartPower3. You can see the following menu in your terminal.

>>> WIFI Command mode entered <<<

[ WIFI Command mode menu ]
1. Connection AP Info
2. Connection UDP client Info
3. Scan & Connection AP
4. Set IP address of UDP client for data logging
5. WiFi Command mode exit
Command :

Select the number 3 menu and connect with your WiFi router. You can show the ”WiFi Icon“ in the setting menu including your IP address.

Set log interval

In order to log via UDP, you need to set up an interval in the setting menu.

Set UDP client

Set IP address of your Host-PC include UDP port.

Enter a command mode in your SmartPower3

After that, type CTRL-C to enter into the command line mode in your SmartPower3. You can see the following menu in your terminal.

>>> WIFI Command mode entered <<<

[ WIFI Command mode menu ]
1. Connection AP Info
2. Connection UDP client Info
3. Scan & Connection AP
4. Set IP address of UDP client for data logging
5. WiFi Command mode exit
Command :

Select the number 4 menu and input the IP address of your UDP client and port. You can show the IP address and port in the setting menu.

Read UDP log data on HOST-PC

Run netcat in your Host-PC.

odroid@odroid:~$ netcat -u -l 6000
012346286,19146,0086,01646,0,00000,0000,00000,0,00,00000,0000,00000,0,00,38,22
012346297,19146,0086,01646,0,00000,0000,00000,0,00,00000,0000,00000,0,00,36,22
012346304,19146,0086,01646,0,00000,0000,00000,0,00,00000,0000,00000,0,00,41,29
012346315,19146,0086,01646,0,00000,0000,00000,0,00,00000,0000,00000,0,00,3f,29
012346326,19146,0086,01646,0,00000,0000,00000,0,00,00000,0000,00000,0,00,3d,29
012346332,19146,0086,01646,0,00000,0000,00000,0,00,00000,0000,00000,0,00,40,2c
012346344,19146,0086,01646,0,00000,0000,00000,0,00,00000,0000,00000,0,00,3d,2d
012346353,19146,0086,01646,0,00000,0000,00000,0,00,00000,0000,00000,0,00,3d,2b
012346367,19146,0086,01646,0,00000,0000,00000,0,00,00000,0000,00000,0,00,38,2c
012346376,19146,0086,01646,0,00000,0000,00000,0,00,00000,0000,00000,0,00,38,2c
012346384,19146,0086,01646,0,00000,0000,00000,0,00,00000,0000,00000,0,00,39,21
012346392,19146,0086,01646,0,00000,0000,00000,0,00,00000,0000,00000,0,00,3a,26
012346407,19146,0086,01646,0,00000,0000,00000,0,00,00000,0000,00000,0,00,3d,2d
012346413,19143,0087,01665,0,00000,0000,00000,0,00,00000,0000,00000,0,00,41,2d
012346425,19143,0090,01722,0,00000,0000,00000,0,00,00000,0000,00000,0,00,4a,2c
012346437,19143,0090,01722,0,00000,0000,00000,0,00,00000,0000,00000,0,00,47,2f
012346444,19143,0090,01722,0,00000,0000,00000,0,00,00000,0000,00000,0,00,49,2b
012346454,19143,0090,01722,0,00000,0000,00000,0,00,00000,0000,00000,0,00,48,2a
012346466,19143,0090,01722,0,00000,0000,00000,0,00,00000,0000,00000,0,00,45,2b
012346473,19143,0090,01722,0,00000,0000,00000,0,00,00000,0000,00000,0,00,47,2f
012346484,19143,0090,01722,0,00000,0000,00000,0,00,00000,0000,00000,0,00,45,27
012346496,19143,0090,01722,0,00000,0000,00000,0,00,00000,0000,00000,0,00,42,24
012346503,19143,0090,01722,0,00000,0000,00000,0,00,00000,0000,00000,0,00,4d,29
012346514,19143,0090,01722,0,00000,0000,00000,0,00,00000,0000,00000,0,00,4b,2f
012346525,19143,0090,01722,0,00000,0000,00000,0,00,00000,0000,00000,0,00,49,2d
012346537,19143,0087,01665,0,00000,0000,00000,0,00,00000,0000,00000,0,00,3a,2a
012346544,19143,0083,01588,0,00000,0000,00000,0,00,00000,0000,00000,0,00,3c,2a
012346556,19143,0083,01588,0,00000,0000,00000,0,00,00000,0000,00000,0,00,39,29

硬件(原理图和数据手册)

 

软件: 2022/Feb/22(v1.9)

Summary

2022/Jan/28(v1.8)

Summary

2021/Dec/14

Summary

2021/Nov/26

Summary

2021/Nov/03

Summary

  • #1 Reading moving average current values from PAC1933
  • Optimized “refresh” command for PAC1933
  • Remove unused constant current icon on UI
  • Remove fan control in setting

Thanks to @tomek-szczesny who raised an accuracy issue and gave us many ideas to make a more accurate power measuring.

2021/Oct/13

Summary

  • Initial Release Version (1st Production)

How to update the latest firmware

If you want to flash the latest firmware without building the source code, follow these instructions.

Windows

The instruction were tested on Windows 10. Some users reported it also worked on Windows 7.
You might need to install the USB-UART CP2104 VCP driver for Windows.
VCP driver for Windows
You need to check the COM port number with Device Manager.
Refer to this guide.

1. Get a Firmware image

2. Download ESP32 flash download tool

3. Connect your SmartPower3 to PC via Type-C USB cable

 

4. Run the ESP flash tool

5. Select ESP32

6. Erase

You must erase the flash of ESP32 before uploading a new firmware. Select parameters as shown in the below picture and check your COM port.
Then, click ERASE button.

Check COM port with Device Manager

ERASE

7. Import binaries and start to upload

Select .img file and input parameters as shown in the below picture and check your COM port.
Then, click START button.

Don't forget to reconnect an input power source for resetting the SmartPower3 manually after uploading.

8. Reconnect the input power source

Don't forget to reconnect an input power source for resetting the SmartPower3 manually after uploading.

Linux 1. Install the requirements

Open a terminal and run commands below.

host
sudo apt install python-pip
sudo pip install esptool pyserial

2. Get a Firmware image

Firmware release info : https://github.com/hardkernel/smartpower3/releases

host
wget https://github.com/hardkernel/smartpower3/releases/download/v1.5/smartpower3-firmware-20211103.img

3. Check your serial node

Connect your SmartPower3 to HOST-PC via Type-C USB cable. Then, you should check that your serial node is similar to ”/dev/ttyUSB0“ or ”/dev/ttyUSB1“
If have another serial device connected, you have to disconnect them on your Host PC first.

host
$ ls /dev/ttyUSB*
/dev/ttyUSB0

4. Run upload script

Type the following in terminal.

host
sudo esptool.py -p [usb_port] -b [upload_speed] write_flash [flash_address] [firmware_image]

Example

host
sudo esptool.py -p /dev/ttyUSB0 -b 921600 write_flash 0 smartpower3-firmware-20211103.img

Mac OS

How to build Smartpower3 firmware from source code Linux(platformio) Install platformio

Get the Smartpower3 source code

git clone https://github.com/hardkernel/smartpower3
cd smartpower3
git submodule init
git submodule update

Compile & Upload

pio run --target upload
pio run --target uploadfs
附件下载
smartpower3_pdf.pdf
KiCad绘制的原理图,PDF格式
团队介绍
ODROID WIKI
评论
0 / 100
查看更多
目录
硬禾服务号
关注最新动态
0512-67862536
info@eetree.cn
江苏省苏州市苏州工业园区新平街388号腾飞创新园A2幢815室
苏州硬禾信息科技有限公司
Copyright © 2024 苏州硬禾信息科技有限公司 All Rights Reserved 苏ICP备19040198号