Recently, I made a "four-purpose" power supply that combines current source, voltage source, charging and soldering iron in one, and also has a display screen. During the design process, I used two single-chip microcomputers, one for variable acquisition and the other for display. So my colleagues called this "monster" a "dual-core independent display" power supply.
The core is to control a voltage regulator board built by MOS tubes, which can digitally control the voltage, so as to obtain a voltage source; through current feedback, the voltage is adjusted to obtain a current source; through current and voltage feedback, a lithium battery charger is obtained; through soldering iron temperature feedback, a constant temperature soldering iron controller is obtained. This is the idea. The microcontroller is Freescale QD4, two 16-bit timers/PWM, four-channel 10-bit AD. Its main functions are: 1. Voltage source; 2. Current source; 3. Charger; 4. Constant temperature soldering iron controller.
The following is the circuit diagram:
Main control circuit
Voltage regulation circuit
The NMOS in the voltage regulation circuit is based on the circuit of the white light soldering iron, but in order to make a fast switch, R9 in the figure cannot be too large. I use 500 ohms, and PWM 2KHZ is OK. The pull-up resistor R13 is also very important. When the microcontroller is abnormal, it ensures that the output is turned off. For the circuit of the MOS back end, you can refer to the DC chip data.
I will not write about the specific welding process. I believe you can make the corresponding product based on the circuit diagram I gave.
Here are some general and test pictures:
Overall appearance
The power input is a laptop power supply. The output is a USB port. I don't usually need a large current, 3A is enough, step 10ma. The maximum output voltage is close to the input voltage, step 0.01V. The display is a nokia5110 display (the above picture is powered by 5V, the screen has spots, the following is changed to 3.7V, the screen is perfect).
The input consists of a potentiometer and a button. The potentiometer can be used like an oscilloscope, and can be selected up and down, or a set value can be entered. A short press of the button is used for "confirmation", and a long press is used for "return". This information is collected by microcontroller 1 and sent to microcontroller 2 through a single line for display. Single-line communication took a lot of effort. The sampling resistor is 50m ohms and is amplified by 358. After the current is collected, it needs to be calibrated to eliminate the deviation.
After making all these things, we need to perform basic functional tests on them.
1. Voltage Source
In the figure below: 9.22V is the real voltage collected in real time, S: set value, I: current
The voltage output responds very quickly, oscilloscope screenshot
Quickly twist the potentiometer and you can draw with an oscilloscope
2. Current Source
In the figure below: 0.44A is the real current collected in real time, S: set value, V: voltage
3. Charging Mode
For testing, I took out the battery core of my mobile power bank. At that time, the cross-current charging current was 300ma, which was really a wait.
But it's nice to see so much output information.
0264mA is the cumulative charging capacity, I: current charging current, V: battery voltage
4. Soldering Iron Mode
The smoke is curling up... The company's thermal imager was sent for inspection, but the temperature cannot be calibrated. I used the formula to calculate it directly, but it seems to be too low. However, it is powered by a laptop, just right. I love this soldering iron
Introduce this USB soldering iron
The soldering iron is modified from Baiguang 936 soldering iron handle, connected to a USB head, the outer side is used as power line, and the USB data line is connected to the feedback resistor. After testing, 3A current, the USB port has no problem, and the temperature rise is also good, so the program is limited to 3A. If the current is too large, the laptop power supply will protect.
Here is a picture of me assembling the product into the box:
The shell was made by removing the plastic shell of a 12V/2A power supply. It took a lot of effort to stuff such a big thing in there.
Finally it's almost full
Entered!! The left picture
The right one
The above is the boot-up picture (why does it look like a mobile phone)...
So far, all the production has been completed.
During the production process, I would like to tell you some of my programming experience.
1. Time base function
I now think that this function should be necessary for every project, but when I think back to the microcontroller books I have read, it seems that this point has not been mentioned. I regret not meeting it earlier.
void TimePro()
{
if (! b_8msFG)
return;
b_8msFG = 0;
Tim8ms++;
PIHtim++;
if (KeyTim < 255)
KeyTim++;
if (PIHtim > 4)
{
TPM2C0SC = 0x48; //Open external interrupt
}
LCDTim++;
LCDFlashTim++;
if (Tim1ms > 124)
{
Tim1ms = 0;
Tim1S++;
……
……
……
}
}
The above is a "time base function". When your program has several peripherals that need to be controlled at the same time, and then use NOP delay, the linear execution is already too busy, and you need to use the above function.
b_8msFG is set to 1 in the 8ms timer interrupt. TimePro() is called in the main function. In this way, the timing variables such as KeyTim and LCDTim are always timing. For example, when calling the keyboard program, it is determined whether KeyTim has reached the time. If it has reached the time, it will be executed, KeyTim will be cleared, if not, it will return, and then call other function bodies. In this way, the CPU is reused in time, avoiding NOP to waste system resources, especially when the execution cycles of several peripherals are different.
2. AD sampling (digital filtering)
This program is a standard module of the company. When I was in college, I used AD directly after sampling. I found that this was not good until I started working. After sampling, I had to do digital filtering. Digital filtering, I don’t know who gave it such a nice name, it fooled many people. In fact, it is very simple, but very practical. Here, the actual operation is: sample six times, remove the maximum and minimum values, and find the average of the remaining four. I didn’t have a deep understanding of its role before. When there was a project in which a single-chip microcomputer directly measured the true effective value of AC, an unsightly waveform entered the single-chip microcomputer. After digital filtering, the value was stable and did not jump randomly, which made me feel emotional.
Below is the program:
void ADPro()
{
uchar n, i;
if (ADTim < 10) return;
ADTim = 0;
for (n=0; n<6; n++)
{
ADChannel = Channelin; //Channel selection;
while (!ADC1SC1_COCO) NOP(); //Wait for conversion to complete
ADC1SC1_COCO = 0;
ADNum = ADC1R; //Get AD value
// ADNum = 298;
if (0==n)
{
m_ADCSum = 0;
m_ADCMax = ADNum;
m_ADCMin = ADNum;
}
if (ADNum < m_ADCMin)
{
m_ADCMin = ADNum;
}
else if (ADNum > m_ADCMax)
{
m_ADCMax = ADNum;
}
m_ADCSum += ADNum;
ADNum = 0;
}
m_ADCSum=m_ADCSum-m_ADCMax;
m_ADCSum = m_ADCSum-m_ADCMin; //Subtract the maximum and minimum values
m_ADCSum = m_ADCSum》》2; //Get the average
switch (Channelin)
{
case 0:
ADSet = m_ADCSum;
break;
case 1:
ADI = m_ADCSum;
break;
case 2
:
ADTemp = m_ADCSum;
break;
case 3:
ADV = m_ADCSum;
break;
default:
break;
}
Channelin ++; //Switch channel
if (Channelin 》 3)
Channelin = 0;
}
If AD is used to control the output, it is even more necessary to do this. Avoid malfunction at critical values.
3. Keyboard program
//---------------------------------
//Key program
//---------------------------------
void KeyPro()
{
if (KeyScanTim < 200) //20ms scan time base function timing
return;
KeyScanTim = 0;
//KeySet
if (!PI_KeySet)
{
if (b_KeySetBac)
{
if (KeySetCount < 255)
KeySetCount ++;
}
else
b_KeySetBac = 1;
if (KeySetCount > 6)
{
b_KeySetLong = 1; //Long press, no need to release to generate
KeyNum = 0;
KeySetCount = 0;
b_KeySetBac = 0;
LongKeyExitTim = 0;
}
}
else
{
if (b_KeySetBac && LongKeyExitTim > 2) //Prevent a redundant short key from being generated after a long press
{
b_KeySet = 1; //Short press, generates
KeyNum = 0 after releasing;
}
b_KeySetBac = 0;
KeySetCount = 0;
}
}
A button can respond to both long press and short press.
Previous article:Creative solar inflatable lamp: 360 degrees lighting in the room after power outage
Next article:Goal Zero Switch 8 Solar Charging Kit
- MathWorks and NXP Collaborate to Launch Model-Based Design Toolbox for Battery Management Systems
- STMicroelectronics' advanced galvanically isolated gate driver STGAP3S provides flexible protection for IGBTs and SiC MOSFETs
- New diaphragm-free solid-state lithium battery technology is launched: the distance between the positive and negative electrodes is less than 0.000001 meters
- [“Source” Observe the Autumn Series] Application and testing of the next generation of semiconductor gallium oxide device photodetectors
- 采用自主设计封装,绝缘电阻显著提高!ROHM开发出更高电压xEV系统的SiC肖特基势垒二极管
- Will GaN replace SiC? PI's disruptive 1700V InnoMux2 is here to demonstrate
- From Isolation to the Third and a Half Generation: Understanding Naxinwei's Gate Driver IC in One Article
- The appeal of 48 V technology: importance, benefits and key factors in system-level applications
- Important breakthrough in recycling of used lithium-ion batteries
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- How can the pyboard measure frequency and duty cycle?
- About Udc on the modulation board
- Human body sensing circuit analysis help
- Pressure sensor/pressure transmitter failure phenomena and solutions
- [National Technology N32G457 Review] 2. Unboxing + Lighting
- KiCad Production File Generator
- Those who work in transportation electronics can come out and talk.
- 5G base station architecture and antenna measurement technology
- Brief Introduction of AGC, ALC, AFC, ANC, ARC and APC Automatic Control Circuits
- Design of luminous signboard circuit