© 2024 EasyEDA Some rights reserved ISO/IEC
Brand new interactions and interfaces
Smooth support for design sizes of over 3W
devices or 10W pads
More rigorous design constraints, more
standardized processes
For enterprises, more professional users
Easy to use and quick to get started
The process supports design scales of 300
devices or 1000 pads
Supports simple circuit simulation
For students, teachers, creators
PRO Programmable ammeter
Mode:
The programmable ammeter is an ammeter that supports the current protection function, which can check the power supply voltage and current in real time, and prompt the current limit value in real time. Fast response, timely protection of the safety of the back-load circuit, fast adjustment, easy to use.
This project is licensed under the GPL 3.0 open source license and can be freely copied, modified and distributed.
1. Support fast charging power supply, USB power supply voltage range of 5-35V, wide working voltage range;
2. Programmable protection current 20mA - 3000mA continuously adjustable, adjustable trigger cycle, fast response;
3. The tolerance is adjustable, and for small fluctuations, the allowable small fluctuations can be set;
4. High current fast response, when the instantaneous current exceeds 1.2 times of the set value, the post-circuit will be disconnected immediately;
5. Provide source code, optimization and improvement are easier.
This project is the first public and is my original project. The project has not won an award in another competition.
1. 2023-07-12 The project won the bid and confirmed the start of the design plan.
2. 2023-07-14 Complete the hardware circuit design and place an order for PCB proofing.
3. 2023-07-18 Received the PCB board and started the soldering test.
4. 2023-07-28 Complete the program design, start the functional test and video recording.
5、2023-07-30 Finally, the sampling data is filtered and optimized to make the display smoother, and the overall production is completed, waiting for acceptance.
6. 2023-07-31 Task acceptance and content optimization.
7. 2023-08-16 Code optimization and panel redesign.
8. 2023-09-07 The new version of the panel proofing has arrived and will be submitted for review again.
The overall design idea: because this time is mainly to achieve a programmable ammeter, the first is the display of current, the second is to programmable current protection function, the requirements are not complicated, but considering that it is used as the middleware of the charger, there may be QC in the later stage, and there is a relatively high voltage, so it is necessary to support a wide voltage power supply, so a DC-DC step-down circuit is used here, and the power supply voltage range can reach 5-20V. Using two-stage voltage regulation, the DC-DC voltage is first reduced to 5V, and then the 5V is further reduced to 3.3V through the LDO, which can improve the stability of the MCU power supply voltage, so as to obtain a smoother power supply, and also improve the stability of ADC sampling.
1. Power supply circuit
The power supply is directly supplied by USB, using a DC-DC step-down chip JW5015A to reduce the input voltage to 5V, and then using LDO SK6014 to stabilize to 3.3V, between which a recoverable fuse and ESD are used for post-stage protection to prevent the safety of the post-stage circuit when there is a problem with the front-stage DC circuit.
The DC-DC step-down chip currently used is the best one to use, mainly because it supports a wide range and can have a very stable output at low voltage. When the input voltage is 5.12V, the measured 5V output can reach 5.08V (the error value may be related to the accuracy of the FB feedback terminal), there is almost no voltage drop, and the output voltage is also very stable in the entire power supply range.
2. Output control and current sampling circuit
The output control uses a PMOS WSD30L20DN from Weishuo, which supports a maximum voltage of 30V and a current of 20A (under good heat dissipation), and is affordable, DFN 3*3 package, and small size.
The working principle is simple analysis: PMOS is low-level conduction, so when the initial power is on, R3 applies a high level to the G-pole of Q2, and Q2 cuts off by default. When it needs to be opened, the input level of the VBUS_CTRL is high, so that Q1 is turned on, the Q2 G pole voltage is pulled down, Q2 is opened, and the power supply is supplied to the rear stage, so the whole switching process is realized, because the Vgs voltage of Q2 is 20V, in order to protect the MOS tube, the voltage division is done to prevent the Vgs voltage from being too high and damaging the MOS tube.
Current sampling uses INA180A3, the gain of this A3 is 100, what I understand is to amplify 100 times, which plays the role of amplifying the small voltage, which is convenient for us to sample to improve the sampling accuracy, and the sampling output terminal also uses a 3.3V ESD to prevent the chip from being connected to the high voltage and damaging the MCU.
3. USB voltage sampling
Voltage sampling is mainly to use a resistor with an accuracy of 0.1% as much as possible in order to improve the sampling accuracy.
4. LCD ST7789 1.14 inch screen display circuit:
The 1.14-inch screen used here is an 8-pin plug-in screen, this screen is very easy to buy, and the price is low, and it is very widely used. Here, additional circuitry has been added to the backlight so that it is easy to use PWM to control the brightness.
5. Key circuit:
Two buttons and a dial encoder are used here, and this button is a soft silicone key, which feels better. The encoder uses EC12B's dial encoder, which is really not too much in Taobao, but the price is not high, only 4 yuan, but the postage is slightly higher, and it is still acceptable to buy a little more at a time.
The reason why the keys are taken out separately here is,Don't save the hardware anti-shake capacitor of the keys in parallel.,This anti-shake can play a very good role.,Don't think it's useless and don't solder.
6. Passive buzzer drive circuit:
The buzzer should be bought passively, don't buy it as active, because here it uses PWM driver to make sound.
7. Main control circuit:
The main control uses the N32G430C8L7 of national technology, Flash 64K, SRAM 16K, LCSC or Taobao can be bought, and the domestic chip is also cheap and good.
1. Development environment:
The software was developed using Keil 5.36, which is relatively stable. N32G430C8L7 SDK version 1.1.0 is used.
2. ADC sampling:
The DMA method is used for ADC sampling, which reduces the involvement of the MCU, and is fast and efficient.
There are 3 channels sampled here, which are voltage, current, and built-in temperature sampling, but the temperature is not used. The sampling uses 16 times oversampling, which reduces the drift of ADC sampling and improves the accuracy of sampling, but the disadvantage is that the sampling time is extended.
The above is the interrupt after the DMA sampling transmission is completed, and it will go into the interrupt after each sample of a set of data, so that we can do some data processing.
Regarding the current limit protection, it is also placed here for processing, so that the response can be prioritized, the response speed is fast, and the safety of the post-stage circuit is protected in time.
High-precision time is very important in program design, so it is very important to turn on a high-precision clock, don't think about the ticking timer, one is that the accuracy is not high, and the other is that it will consume MCU time and waste a lot of MCU resources. The millisecond timer is involved in almost all modules of this program, which is particularly important.
Since the time timer is a time counting function, the basic timer TIM6 can meet the requirements without wasting the resources of other general-purpose timers or advanced timers.
In the timer update interrupt, there are more functions than just time counting.
1) Because there is no idle interrupt in the N32G430 serial port, it can only realize the idle interrupt by itself, so as to realize the indefinite length receiving function of the serial port;
2) Automatically carry out the ring stop function of the buzzer, make a time recording mark, and automatically stop when the specified time is reached, so that there is no need to write an additional check program;
3) After entering the current limit protection, different sound processing is also processed here, and there is no need to use Delay to wait.
Note that the sampling resistor R11 R12 recommends using a resistor with an accuracy of 0.1%, and the minimum is also an accuracy of 1%, otherwise the accuracy of voltage sampling will be affected.
Demo video: Upload attachments to demo videos, attachments can only be long-distance transmission of 50M files, files larger than 50M can be placed on other network disks or video websites, just put the address link here.
Project attachments: The works participating in the activity must upload the project-related program attachments to the open source platform or personal code storage cloud, and the attachments can be uploaded up to 50M (please do not upload them in the LC workspace, there are restrictions)
There is a size limit for the attachment, and you can visit Station B to view high-definition videos:
#OSHWhub stars# Programmable Ammeter_Demo Video: https://www.bilibili.com/video/BV19u4y1k7Jf/
#OSHWhub stars# Programmable ammeter _ISP download demo: https://www.bilibili.com/video/BV1yV4y1i7iF/
Purchase links for a few components that Luxon doesn't have (you can look for them yourself, here is just to reduce the trouble of searching):
EC12B 1510001A : https://item.taobao.com/item.htm?spm=a1z09.2.0.0.16852e8dHDosl1&id=622986639277&_u=7otnt32a9b
DC-DC Chip JW5015A : https://item.taobao.com/item.htm?spm=a1z09.2.0.0.16852e8dHDosl1&id=704422089732&_u=7otnt3c943
1.14" ST7789 8P Plug-in Screen: https://item.taobao.com/item.htm?spm=a1z09.2.0.0.67002e8dEAHchZ&id=671435982680&_u=6otnt31283
For other components, it is recommended to give priority to buying and find some reliable malls to prevent problems with replication.
Designed by YuToo (from OSHWHub)
Loading...
Do you need to add this project to the album?