ArminSchweizer
Published © GPL3+

High Voltage Converter And Flash-Tube (Part 1)

Show simple way to generate high voltages with Arduino and an example (flash-tube) how to use it

AdvancedProtip3,250
High Voltage Converter And Flash-Tube (Part 1)

Things used in this project

Hardware components

Arduino Micro
Arduino Micro
×1
Resistor 47 kOhm
×1
Resistor 10k ohm
Resistor 10k ohm
×1
Resistor 390 Ohm
×1
Resistor 8.2 MegaOhm
×2
Resistor 150 KiloOhm
×1
Transistor BC 550 C
×1
Diode BYM 26 C
×2
Power-MOSFET BUK 437-400 B
×1
Inductor 82 MicroHenry, ferrite, 3 Ampere
×1
Capacitor 1000 µF
Capacitor 1000 µF
×1
Capacitor 100 nF
Capacitor 100 nF
×1
Capacitor 820 MicroFarad, 350 Volt
×1
Capacitor 1 NanoFarad, Ceramic
×1

Story

Read more

Schematics

High Voltage Push Converter

Simple and inexpensive circuit allowing Arduino to generate a high voltage

Hardware Information

describes the way the high voltage boost converter works

Code

High Voltage Boost Converter

C/C++
Code and Description on how the software for a high voltage boost converter works
/*
  High-Voltage Converter and Flash-Light
  ======================================

  Control a DC-DC converter to generate High Voltage for Flash and trigger flashlight once the required 
  working-voltage is reached. This project uses an Arduino Micro (5V power) with Aref connected to a voltage 
  of 4.096 Volts. Pin numbers refer to the Arduino Micro Pin numbering

  Revision History
  ----------------
  2017-06-12 wasc High voltage generation code
  2017-07-09 wasc Added code for triggering flash-light 
  2017-07-28 wasc reformatted to fit with the published paper

  ------------------------------------------------------------------------------------------------------------------
*/


// define constants and variables with global scope in this module

// Part 1: High Voltage boost converter
const int PWM11 = 11;                  // this PWM (Timer-Counter 0) can be configured to run quite fast, see setup()
const int HighVoltageInput = 6;        // Analog 6 input (A6) is used to read the high voltage value
const int MaxPulseWidth = 255;         // Maximum value for the pulse width setting (hardware determined)
const int BoostPulseWidth = 210;       // Pulse width to be used in PWM when HV is generated 
const int SleepPulseWidth = 3;         // Pulse width to be used in PWM when HV has reached working value
const int MaxHighVoltageValue = 445;   // this is the value to set the expected High Voltage 
                                       // 110 = approx. 50V
                                       // 220 = approx. 100V
                                       // 445 = approx. 200V
                                       // 560 = approx. 250V
const int HVhysteresis = 10;           // To ensure sufficient trigger pulse width for thyristor, trigger pulse will end 
                                       // only when high-voltage has decreased by hysteresis value

// part 2: electronic flash-tube
const int FlashPin = 7;                // Digital Pin 7 is used as output to fire the flash



// ----------------------------------------------SETUP-------------------------------------------------------------
// This function is executed one single time at the start of the microcontroller (HW&SW initialisation)
void setup() {

  // Set Arduino Micro Pin D11 as PWM-output and set the prescaler of Timer/Counter 0 to 1x to allow 65kHz
  pinMode( PWM11, OUTPUT);
  TCCR0B = 0x01;                // This will result in a frequency of about 65 kHz at PWM11
                                // This changes the predefined Arduino environment -- see hardware manual
                                // INFO: This changes also the delay() function which provides much shorter delays now!

  // use the 4.096 Volts reference at Aref pin
  analogReference( EXTERNAL );

  // set Digital Pin 7 as output
  pinMode( FlashPin, OUTPUT);
  digitalWrite(FlashPin, LOW);  // Just to be sure the Thyristor will not be triggered yet

}



// ------------------------------------------------------LOOP-------------------------------------------------------
// This function is executed repeatedly forever (make sure it can run through quickly and will not be stuck in a waiting loop)
void loop() {

  // define some variables to be used here
  int PulseWidth;                     // the pulse width to be set in the PWM, computed by algorithm below
  int HighVoltageValue;               // the ADC reading for the high voltage 0 = 0V to 1023 = 409.5V
  

  // This is the control section to control the generation of the high-voltage. A timer of the Arduino is used as PWM 
  // to generate the pulses for the simple boost converter. The microcontroller generates the pulses and controls the pulse 
  // width to generate the desired high voltage value.

  // measure the high voltage value with analog input
  HighVoltageValue = analogRead( HighVoltageInput );                  // will be used for setting the required pulse width of the PWM
                                                                      // as well as (in this sample code) to trigger the 
                                                                      // flash-light when working voltage is reached
  
  //now compute the required pulse width
  if (HighVoltageValue <= MaxHighVoltageValue) PulseWidth = BoostPulseWidth;  // Full Pulse width while high voltage is below target value.
  else PulseWidth =SleepPulseWidth;                                           // Once high voltage reaches target voltage, reduce 
                                                                              // pulse width so far as to disable the Power FET
                                                                       
  // now set the PWM to the desired pulse width
  analogWrite( PWM11, (MaxPulseWidth - PulseWidth) );         // Note: Pulse is inverted by hardware to ensure proper operation 
                                                              // when pin is tri-stated (e.g. at startup)

 
  // Trigger flash when expected high voltage is reached. This results in a 'traffic flashlight'. 
  // Here would be the place to trigger the flash for another reason, e.g. based on an photosensor signal, electrical contact etc.
  if (HighVoltageValue >= MaxHighVoltageValue )    digitalWrite(FlashPin, HIGH);                      // trigger flash when expected voltage is reached
  else if (HighVoltageValue < (MaxHighVoltageValue - HVhysteresis))  digitalWrite(FlashPin, LOW);     // stop trigger pulse only when the high voltage 
                                                                                                      // has decreased below the working voltage
                                                                                           
}


INFORMATION
The Arduino development and run-time environment is very comfortable and offers -- together with the microcontroller hardware -- analog outputs in form of pulse width modulators (PWM). For switch mode power supplies in general and also the push converter shown here, the inductor (or coil) and capacitors will be smaller and cheaper the higher the working frequency is. The working frequency of the PWM offered by Arduino is quite low: However the Arduino development environment offers the possibility to change the values in the microcontrollers configuration registers quite easily. This is done by the code line
TCCR0B = 0x01;
This changes the value in the timer-counter control-register 0B and changes the pre-scaler (see the hardware manual of the microcontroller for details). As a result the PWM used here is running 64 times faster and ends up with a frequency of approx. 65kHz. 
Note: The change of this pre-scaler is also influencing some other functions used in Arduino, e.g. the delay() function. This is however not really a problem, since in a real-time application the delay() function is not really of use.
The rest of the code is quite straight forward: The PWM is used to generate the high voltage, which is stored in this example in capacitor C3.
As mentioned in the hardware section above, the hardware circuit is inverting the pulse and the software's PWM setting must consider this inversion: This is done with the subtraction in the command where the PWM's pulse-width is set:
analogWrite( PWM11, (MaxPulseWidth - PulseWidth) );
The pulse width can be selected in a wide range. For a fast loading the pulse width should be as wide as possible (it can be easily adapted here to other values of the inductor/coil). The pulse width can be chosen in a way to keep electromagnetic radiation low: The inductor (L) and the capacitors (C) form an LC system which resonates and turning the power-MOSFET off when voltage and current are close to zero can be achieved by adequate selection of the pulse width.
The high-voltage generated will be monitored with the help of an analog input (we use Analog Input 6 in this case). While the high voltage is below the expected value, the pulse width will be set to a large value to allow for a good performance in loading the capacitor. as soon as the desired voltage is reached, the sample code is turning the power-MOSFET off (when using a very narrow pulse, the power-MOSFET will not be turned on and off). This is resulting in a simple direct digital control also called a 'bang-bang' regulation. 
if (HighVoltageValue <= MaxHighVoltageValue) PulseWidth = BoostPulseWidth;
else PulseWidth =SleepPulseWidth;
While such a simple regulation of the high voltage is sufficient here, a DC-to-DC converter using this circuit (e.g. to generate 48 volts for telephony) may require a slightly better regulation. Such a regulation can be implemented easily by using a few lines of code replacing the above bang-bang regulator and selecting more values for the pulse width (e.g. pulse width proportional to the difference of the expected high voltage minus the actual high voltage to achieve a P-regulator).

Credits

ArminSchweizer

ArminSchweizer

4 projects • 1 follower

Comments