High Voltage Converter And Flash-Tube (Part 1)

High Voltage Converter And Flash-Tube (Part 1) © GPL3+

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

  • 2 respects

Components and supplies

Ph a000053 iso (1) pnkpri8a6q
Arduino Micro
Resistor 47 kOhm
Mfr 25frf52 10k sml
Resistor 10k ohm
Resistor 390 Ohm
Resistor 8.2 MegaOhm
Resistor 150 KiloOhm
Transistor BC 550 C
Diode BYM 26 C
Power-MOSFET BUK 437-400 B
Inductor 82 MicroHenry, ferrite, 3 Ampere
Panasonic eca 1em102
Capacitor 1000 µF
Kemet c320c104k5r5ta image
Capacitor 100 nF
Capacitor 820 MicroFarad, 350 Volt
Capacitor 1 NanoFarad, Ceramic

About this project


This project generates high voltages that may impact your health or threaten your life!


In this project the generation of high voltages (Part 1) and the use of an electronic flashtube (Part 2) is shown. The DC-to-DC converter shown in Part 1 is simple to build with a few components and can be used to generate a wide variety of voltages (selectable value in Arduino software). The flashlight in Part 2 is an example of how to use the high voltage and can also be adapted easily (Arduino software) to other purposes than shown below.

The intention for the publication of this project is two-fold:

  • If you are professionally developing microcontroller applications in a small company you sometimes do not have the capacity or time to develop a small DC-DC converter to support the need for high voltage generation: So please feel free to make use of the information in this project;
  • In education this project can be used to educate tightly integrated hardware and software solutions. Due to the risk introduced by high voltages, this project should be used at the earliest in an advanced class.

The project is based on the Arduino Micro using the ATmega32U4 microcontroller. However you will find, that the circuit and software can be easily moved to other pin's (e.g. to be integrated into an existing design) or can be moved to a different microcontroller (Atmel ATmega series or different brand).


High Voltage Boost ConverterC/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

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).


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


Similar projects you might like

AVR High Voltage Programmer 2

Project tutorial by Dilshan Jayakody

  • 15 respects

Arduino Theremin

Project tutorial by Arnov Sharma

  • 5 respects

Ways to Use Arduino as USB to TTL Converter

by Patel Darshil

  • 17 respects

Autonomous High Altitude Glider

Project in progress by Abdullah Tarik Agcayazi and kemfic

  • 85 respects
Add projectSign up / Login