-
April 18, 2015 - The shortcircuit test
04/27/2015 at 14:46 • 0 commentsSo I tested it for the shortcircuit response time, and the result is that...
The response is ultra-fast!
Here are some nice oscillographs showing the quick recovery after a shortcircuit event. It takes less than 350ms to recover to the original voltage configured as shown in the second picture. The CH1 (Yellow) is connected to the output, and the CH2 (Cyan) is connected to the shunt. The first picture shows the quick voltage drop on output, and an increase on the shunt, as expected.
A few more tests shown that I can get 26V and 5Amps max with a TL082 and 31.5V and 4Amps max with the LM384, yet the latter is too close to its voltage limits.
All's done, I'll just update the project description with code and PCB details as well as pictures with my construction. Those of you interested in building one, feel free to ask any questions or send suggestions. Thanks for your interest!
-
April 17, 2015 - first tests
04/27/2015 at 14:38 • 0 commentsADC on port PC4 is used to read output voltage through a 10K/100K resistive divider. PC5 is connected to the shunt and used to read the current.
I measured the transformer output, immediately after the filter capacitors following the rectifier. I get 16.1V with the center tap and 33.8V on the full secondary. With full output, using the TL082, I only get 14.56V vs 16.1V and 26.26V vs 33.8V.
Finally the PWM code is in place, and I can now adjust not only the duty cycle, to vary the DAC output from 0 to 5V, but also the frequency. I wanted to see the ripple. So I connected the oscilloscope , CH1 (yellow) on the RC low pass filter capacitor and CH2(cyan) on the OpAmp output, right where the signal goes to the base of the power transistors.
It's not much. The question is what's the best frequency to use with this setup? With a small RC filter cap, it's clear that we need higher frequency values. After a few tests, I opted for 100KHz.
At 100KHz I get some ripple close to 0.05V, which is good. Next thing to do is to have the output control code in place. As said previously, that needs to be fast. All ADC conversions must be done as interrupts, to avoid the main program loop delaying the critical response (as in case of shortcircuit).The only problem is ADC can do a single conversion at a time, so we need to measure voltage and current alternatively since we use two separate ADC channels for that. A 16Mhz crystal is used with the Atmega8 and an ADC prescaler of 128 to increase the conversion speed to maximum. Here's the code logic:
1) Initialization
float vref = 5.0; #define MODE_MEASURE_CURRENT 0 #define MODE_MEASURE_VOLTAGE 1 volatile bool adc_mode = MODE_MEASURE_CURRENT; volatile float current = 0, voltage = 0;
// setup ADC to measure as interrupt: go for current first adc_mode = MODE_MEASURE_CURRENT; ADMUX = PC5; ADCSRA = (1<<ADEN) | (1<<ADIE) | (1<<ADIF) | (1<<ADSC) | (1<<ADPS2) | (1<<ADPS1) | (1<<ADPS0); // set prescaler to 128 (16M/128=125kHz, above 200KHz 10bit results are not reliable) sei();
2) interrupt
// Interrupt service routine for the ADC completion // we measure the current (PC5) and the voltage (PC4) alternatively ISR(ADC_vect){ uint16_t analogVal = ADCL | (ADCH << 8); if (adc_mode == MODE_MEASURE_CURRENT) { current = (analogVal / 1024.0 * vref) / 0.55; // alternate mode adc_mode = MODE_MEASURE_VOLTAGE; ADMUX = PC4; // next time we will do ADC on PC4, to get the voltage } else if (adc_mode == MODE_MEASURE_VOLTAGE) { float R14 = 10, //10k R13 = 100; //100K voltage = analogVal / 1024.0 * (R13 + R14) / R14 * vref; // alternate mode adc_mode = MODE_MEASURE_CURRENT; ADMUX = PC5; // next time we will do ADC on PC5, to get the current } // Not needed because free-running mode is enabled, so the convertion will restart by itself // start another ADC convertion //aux_ADCReadIntr(PC5); // ADCSRA |= 1<<ADSC; ADCSRA = (1<<ADEN) | (1<<ADIE) | (1<<ADIF) /* | (1<<ADFR) */ | (1<<ADSC) | (1<<ADPS2) | (1<<ADPS1) | (1<<ADPS0); // set prescaler to 128 (16M/128=125kHz, above 200KHz 10bit results are not reliable) }
Next thing to do is to test the supply for a shortcircuit! In the interrupt code, right in the if (adc_mode == MODE_MEASURE_CURRENT) { , if the current is dangerously high I need to reduce the DAC by lowering the duty cycle, to limit the output. How fast can this be done, is something we need to see.fingers crossed...
-
April 16, 2015 - the first PCB prototype is ready
04/27/2015 at 13:53 • 0 commentsI was able to make a first PCB and write some of the code. The display now works and I can do the first tests. I decided to go with the PWM based DAC. The RC filter output is buffered with the first half of a TL082. The second half is used as a non-inverting amplifier and directly commands the bases of the 4 TIP3055 mounted in parallel on the heatsink. The transistors use equalising resistors of 0.1Ohm / 5W on each emitter.
I went with the TL082 because of its voltage ratings. Instead of a bipolar source, the plan is to have it hooked on ground and max voltage. It should work fine like that, because all I need is positive output .
So, this will be an experiment: will it work or will it fry. I just broke my printer's cartridge, and with the last print I was able to do this PCB.
I surely hope the shortcircuit answer will be fast enough. As for the laser printer cartridges, just a piece of advise for others: don't try cleaning the cylinders!
The electrolytics should be 50V, but I only had 35V in my toolbox. They're ok for the first tests. Here's the circuit so far:
-
April 8, 2015 - first steps with the design
04/27/2015 at 13:30 • 0 commentsI started designing the PCB. Here's what I have so far:
I plan to go with the DAC based on PWM + RC Low pass filter, yet I am concerned about the shortcircuit time of response. If it's not fast enough, the entire work is in vain.
For the output control block, controlling both the output current and the voltage, will rely on the DAC resolution, but also on the ADC resolution of the feedback loop.
If ADC is 10bits (max on atmega8), then this will allow us to select voltage levels with in Vo0 = 35x1/2^10 ~= 35mV minimum steps. For 8bits, that's even worse, only 35/2^8~=136mV.
To help the response time, a solution is to do all time critical operations as interrupts, for example the ADC convertions responsabile for reading voltage and current.