Open-source automated external defibrillator

The Automated External Defibrillator (AED) is a medical device that analyzes a patient’s electrocardiogram in order to establish whether he/she is suffering from the fatal condition of Sudden Cardiac Arrest (SCA), and subsequently allows the release of a therapeutic dose of electrical energy (i.e. defibrillation). SCA is responsible for over 300,000 deaths per year both in Europe and in USA, and immediate clinical assistance through defibrillation is fundamental for recovery. In this context, an open-source approach can easily lead in improvements to the distribution and efficiency of AEDs. The proposed Open-Source AED (OAED) is composed of two separate electric boards: a high voltage board (HV-B), which contains the circuitry required to perform defibrillation and a control board (C-B), which detects SCA in the patient and controls the HV-B. Computer simulations and preliminary tests show that the OAED can release a 200 J biphasic defibrillation in about 12 s and detects SCA with sensitivity higher than 90% and specificity of about 99%. The OAED was also conceived as a template and teaching tool in the framework of UBORA, a platform for design and sharing medical devices compliant to international standards. 2017 The Authors. Published by Elsevier Ltd. This is an open access article under the CCBY license (http://creativecommons.org/licenses/by/4.0/). Specifications table Hardware name OAED Subject area Engineering Medical Cardiology Educational Tools and Open Source Alternatives to Existing Infrastructure Hardware type Performing defibrillation Measuring patient’s electrocardiogram and impedance Automated diagnose of Sudden Cardiac arrest Electrical engineering and computer science High voltage Open Source License GPL Cost of Hardware 400 € (single prototype) Source File Repository https://github.com/CentroEPiaggio/Open-Automated-External-Defibrillator 1. Hardware in context An Automated External Defibrillator (AED) is a portable electronic medical device capable of automatically diagnosing whether a patient is suffering from Sudden Cardiac Arrest (SCA), and allows treating him/her through defibrillation when necessary. In SCA, the heart suddenly and unexpectedly stops beating rhythmically and changes to a chaotic beat. When this happens, blood stops flowing to the brain and other vital organs. In these conditions, the patient can be considered dead, and he will remain in this state unless someone helps him immediately by ‘‘resetting” the heart. SCA is a very dangerous condition, responsible every year for over 300,000 deaths both in Europe and in the United States [1,2]. The most effective way to treat a SCA is with defibrillation, namely a therapeutic dose of electrical energy. The necessity of performing defibrillation within a few minutes of SCA has led to the development of AEDs: their timely use can improve outcome after SCA [3,4]. For this reason, AEDs have been designed to be used with little or no medical knowledge allowing the widespread distribution of these devices for reducing SCA victims. AEDs should be present in public places with the highest probability to have SCA events, such as public transportation areas (train stations or airports), rather than City Halls [5]. Furthermore many AEDs are deployed in schools and working areas, which are normally closed during off-hours, limiting their use [3]. The open source approach would help this distribution, with the additional advantage of improving the existing designs. AEDs have existed for over twenty years but no open-source blueprints are currently available, in contrast, to several open-source tools developed, for example, for acquisition [6,7], analysis and visualization [8–12] of electrocardiogram (ECG). The external defibrillator as we know it today was invented in 1930, but the first proof-of-concept prototype was demonstrated in the late 19th century [13]. The first prototype of 1930 used the alternate current (AC) from the mains after high voltage transformation from 240 V to 1 kV; and it was connected to the exposed heart with paddle-like electrodes. It was until the early 1950s that defibrillation still needed an open-chest approach. The closed-chest defibrillator was invented by the Russian doctor V. Eskin, and used an AC with a voltage higher than 1 kV [14]. The next major breakthrough was the introduction of portable defibrillators, which could be used outside hospitals. These were mostly carried in ambulances, allowing treatment of the patient before arrival at the hospital. The continuous improvement of electronics in the last decades has gradually reduced the weight and dimensions of defibrillators as well as increased the chances of resuscitation. Finally, the introduction of microprocessors and microcontrollers has led to the development of defibrillators that can automatically diagnose SCA in the patient (AEDs). The Open-Source AED (OAED) presented in this work has been developed in the framework of UBORA, a project funded by the European Commission, which aims at developing a Europe-Africa e-infrastructure for open-source co-design of new solutions to face the current and future healthcare challenges of Europe and Africa (http://ubora-biomedical.org). The UBORA e-infrastructure enables peer-to-peer evaluation of biomedical designs before submitting the documentation for the formal certification route. This double check of the design, coupled with compliance to international design standards, can lead to safer medical products because a large community as well as regulatory authorities are performing the evaluation. 2. Hardware description As shown in Fig. 1, the OAED is divided into two main electric boards powered by a battery: a High-voltage board (HV-B) and a control board (C-B). The HV-B contains the circuitry necessary to perform defibrillation: capacitor, used to store the energy to be released to the patient; charging circuit, which rapidly charges the capacitor; H-Bridge circuit, required to perform biphasic defibrillation; internal discharge circuit, used to dump the unused residual energy; and two selectors, used to isolate the patient from the capacitor, and to route the ECG signal to the C-B. The C-B represents the device’s brain. It contains a Programmable System on Chip (Cypress PSoC), which -amongst other functionsintegrates the analogical front-end used to acquire the ECG and impedance measurements from the patient. The PSoC also contains an ARM Cortex-M3 CPU, used to analyze the signals and asses the defibrillation needs. According to MDD 93/42, AEDs are classified as Class IIb devices because they are ‘‘therapeutic devices intended to administer energy in a potentially hazardous way” [15]. The design has been done ensuring compliance with the standards of the IEC 60601 family [16]. Comparing the standards above with the commercially available AEDs, we can outline the following technical specifications: Nominal voltage: 1700 V; Defibrillation energy: 200 J; Charging time: 12 s, defined as the maximum time from activation of the rhythm detector to the defibrillator being ready for discharge at maximum energy; Patient leakage currents (not during defibrillation): 50 lA; SCA recognition algorithms: Sensitivity >95%, specificity >95%. 62 J. Ferretti et al. / HardwareX 2 (2017) 61–70


Hardware in context
An Automated External Defibrillator (AED) is a portable electronic medical device capable of automatically diagnosing whether a patient is suffering from Sudden Cardiac Arrest (SCA), and allows treating him/her through defibrillation when necessary.
In SCA, the heart suddenly and unexpectedly stops beating rhythmically and changes to a chaotic beat. When this happens, blood stops flowing to the brain and other vital organs. In these conditions, the patient can be considered dead, and he will remain in this state unless someone helps him immediately by ''resetting" the heart. SCA is a very dangerous condition, responsible every year for over 300,000 deaths both in Europe and in the United States [1,2]. The most effective way to treat a SCA is with defibrillation, namely a therapeutic dose of electrical energy. The necessity of performing defibrillation within a few minutes of SCA has led to the development of AEDs: their timely use can improve outcome after SCA [3,4]. For this reason, AEDs have been designed to be used with little or no medical knowledge allowing the widespread distribution of these devices for reducing SCA victims. AEDs should be present in public places with the highest probability to have SCA events, such as public transportation areas (train stations or airports), rather than City Halls [5]. Furthermore many AEDs are deployed in schools and working areas, which are normally closed during off-hours, limiting their use [3].
The open source approach would help this distribution, with the additional advantage of improving the existing designs. AEDs have existed for over twenty years but no open-source blueprints are currently available, in contrast, to several open-source tools developed, for example, for acquisition [6,7], analysis and visualization [8][9][10][11][12] of electrocardiogram (ECG).
The external defibrillator as we know it today was invented in 1930, but the first proof-of-concept prototype was demonstrated in the late 19th century [13]. The first prototype of 1930 used the alternate current (AC) from the mains after high voltage transformation from 240 V to 1 kV; and it was connected to the exposed heart with paddle-like electrodes. It was until the early 1950s that defibrillation still needed an open-chest approach. The closed-chest defibrillator was invented by the Russian doctor V. Eskin, and used an AC with a voltage higher than 1 kV [14]. The next major breakthrough was the introduction of portable defibrillators, which could be used outside hospitals. These were mostly carried in ambulances, allowing treatment of the patient before arrival at the hospital. The continuous improvement of electronics in the last decades has gradually reduced the weight and dimensions of defibrillators as well as increased the chances of resuscitation. Finally, the introduction of microprocessors and microcontrollers has led to the development of defibrillators that can automatically diagnose SCA in the patient (AEDs).
The Open-Source AED (OAED) presented in this work has been developed in the framework of UBORA, a project funded by the European Commission, which aims at developing a Europe-Africa e-infrastructure for open-source co-design of new solutions to face the current and future healthcare challenges of Europe and Africa (http://ubora-biomedical.org). The UBORA e-infrastructure enables peer-to-peer evaluation of biomedical designs before submitting the documentation for the formal certification route. This double check of the design, coupled with compliance to international design standards, can lead to safer medical products because a large community as well as regulatory authorities are performing the evaluation.

Hardware description
As shown in Fig. 1, the OAED is divided into two main electric boards powered by a battery: a High-voltage board (HV-B) and a control board (C-B).
The HV-B contains the circuitry necessary to perform defibrillation: capacitor, used to store the energy to be released to the patient; charging circuit, which rapidly charges the capacitor; H-Bridge circuit, required to perform biphasic defibrillation; internal discharge circuit, used to dump the unused residual energy; and two selectors, used to isolate the patient from the capacitor, and to route the ECG signal to the C-B.
The C-B represents the device's brain. It contains a Programmable System on Chip (Cypress PSoC), which -amongst other functions-integrates the analogical front-end used to acquire the ECG and impedance measurements from the patient. The PSoC also contains an ARM Cortex-M3 CPU, used to analyze the signals and asses the defibrillation needs.
According to MDD 93/42, AEDs are classified as Class IIb devices because they are ''therapeutic devices intended to administer energy in a potentially hazardous way" [15].
The design has been done ensuring compliance with the standards of the IEC 60601 family [16]. Comparing the standards above with the commercially available AEDs, we can outline the following technical specifications: Nominal voltage: 1700 V; Defibrillation energy: 200 J; Charging time: 12 s, defined as the maximum time from activation of the rhythm detector to the defibrillator being ready for discharge at maximum energy; Patient leakage currents (not during defibrillation): 50 lA; SCA recognition algorithms: Sensitivity >95%, specificity >95%.

High-voltage board
The High-voltage board contains two main circuits, the charging circuit and the H-Bridge.

Charging circuit
From an engineering point of view, defibrillation can be approximated as a capactive discharge on a pure resistive load. Defibrillation can be schematized with an RC circuit, where the patient is represented as a resistor, while a capacitor represents the defibrillator. For this reason, the most critical aspect of an AED is the charging time of the capacitor, because more than one charge-discharge cycle is usually needed to save a life [17]. An AED needs a charging circuit with the following characteristics: ability of producing a high-voltage output from a low-voltage input; high efficiency; fast charging speed; compact dimensions and low weight; low cost; compatibility with pure capacitive loads; and safety and robustness.
The final charging circuit was designed as a self-oscillating flyback converter, also known as Ringing Choke Converter (RCC) [18].
The RCC is derived from the flyback converter (Fig. 2). The flyback converter works using a PWM signal to operate its switch. When this signal is high, the switch is closed and a current flows through the primary coil of the transformer. The flyback diode on the secondary side of the circuit prevents the current from flowing, therefore the transformer accumulates energy. When the PWM signal is low, the switch is open and the transformer releases the energy it had accumulated during the ''on" time in the secondary coil. In a traditional flyback configuration, the PWM signal has a fixed frequency while its duty cycle may vary according to the load. The disadvantage of this configuration is that when the duty cycle is low (meaning a short ''on" time), there will be an excess of dead time, during which the circuit has no current flowing in it. On the other hand, if the duty cycle is high (meaning a long ''on" time), the transformer might not have enough time to release all its energy onto the capacitor. These two operating modes are commonly known as discontinuous conduction mode and continuous conduction mode respectively.
The purpose of the RCC is to avoid working in both of these two conduction modes. In fact, the RCC is obtained by adding a third coil to the flyback transformer, which will be used to automatically generate a PWM signal. The peculiarity of this approach is that only a few components are sufficient to bring the flyback circuit to work at the exact point of transition between discontinuous and continuous conduction modes. In this condition, as soon as the transformer releases all the energy, the switch is closed again avoiding dead times and energy residuals in the transformer. The schematic of the RCC is presented in Fig. 3. The MOSFET S 1 , in the left side of the circuit, represents the Flyback switch. S 1 activation is controlled by the third coil of the Flyback transformer, and by the BJT transistor Q 1 . The injection of a current in the base of Q 1 causes the opening of the MOSFET S 1 . Exploiting this property allows a voltage control on the output capacitor. For this purpose, on the right side of the circuit there is a voltage divider composed of R d1 and R d2 . The divider is designed in order to ensure that the voltage across R d2 is 2.5 V when the capacitor voltage is 1700 V. When this happens, the shunt regulator D 2 permits conduction, causing the injection of a current in the Q 1 base, which stops S 1 oscillations; and thus prevents the capacitor charging.
Finally, the last element on the right side is an op-amp buffer that provides a charge feedback of the capacitor to the PSoC on the C-B.

H-Bridge
The basic principle of defibrillation is that by applying a current to the patient's heart it is possible to stop it at once so the pacemaker cells can restore cardio-myocyte synchronization.
Amongst the various defibrillation parameters that can be modulated to improve the chances of resuscitation, the most important are the energy released and the waveform. While increasing the first can raise the chances of resuscitation, there On the left side: the switch S1 controls the current flow in the transformer; and the components required to automatically generate the PWM signal that operates on S1. On the right: voltage feedback control made of a voltage divider (resistors Rd1 and Rd2), which generates a 2.5 V reference when the capacitor is charged at a nominal voltage V0 = 1700 V. This reference is used as a feedback signal to the PSoC, through the buffer on the right, and as a direct negative feedback that turns the charging circuit off through the phototransistor in the center of the circuit. is a trend to reduce the energy as much as possible, because higher energies may cause burning of the patient's skin and require larger batteries.
On the other hand, the defibrillation waveform can increase the chances of resuscitation and thus reduce the required energy.
Currently, the most promising waveform is biphasic defibrillation. The biphasic waveform is obtained by stopping defibrillation, and re-applying it after inverting the polarities [17,19,20].
In the OAED, biphasic defibrillation is achieved using the H-Bridge circuit, in which each switch is implemented with two IGBTs, as shown in Fig. 4. Each IGBT requires a voltage between the gate and the emitter of about 15 V. Thus, they require a dedicated insulated power source and an insulated driver. The first is obtained using galvanic-insulated DC/DC converters, Fig. 4. OAED H-Bridge. Each switch of the classic H-Bridge configuration is implemented with two IGBTs, and their respective driving circuits. The H-Bridge circuit controls the polarity of defibrillation discharges, allowing to release poly-phasic defibrillations, which ensures higher resuscitation chances even at lower energies. whilst the latter requires a photo-coupled driver. Since IGBTs require considerable currents when switching and usually these small, insulated DC/DC converters cannot provide the sought currents, an additional capacitor was added to each converter in order to store the energy required for commutation.
Two IGBTs per switch are required for two main reasons: IGBTs with inverse tension higher than 1500 V are considerably more expensive and bulky; and the use of two IGBTs gives higher de-rating values.

Control board
The Cypress PSoC 5LP is at heart of the C-B. The PSoC is a one-chip solution integrating analog front-end, digital logic and user interface integrated circuits, with an ARM Cortex-M3 CPU. Its internal circuits can be re-arranged using the Cypress software, in order to obtain various circuit configurations.
In the OAED, the PSoC blocks are configured to perform various operations. The general I/O blocks are reported in Fig. 5. These are necessary to communicate with the operator and the High-voltage board and are hereinafter explained: a) The first is a redundant control for the H-Bridge circuit. The block on the left is a software-set register, updated every time the firmware wants to control the H-Bridge. The output is evaluated with logic blocks in order to provide a degree of redundancy. The right block represents the connection to physical pins. b) These are the physical pins used to control the inner, and outer selectors. c) "Charge_En" is the pin used to enable the charging circuit. d) The first block on the right represents the physical pin to be connected at the push-button that the operator should press to release the defibrillation. Due to its criticality, a de-bouncer is used, which directly calls an interrupt (here represented as lightening). e) This contains the pins connected to the LED diodes. These, as the resistors, are not inside the PSoC, but on the control board. f) This block is required to implement USB UART protocols. g) This block is used to evaluate the capacitor voltage. The label "V sense " represents the pin attached to the charging circuit buffer output, presented in Fig. 3. This pin is connected to two comparators. When it reaches a value of 2.5 V, the first comparator calls an interrupt to communicate to the processor that the capacitor is ready. On the other hand, when its value falls below 256 mV, the second comparator calls another interrupt, used to communicate to the processor that the capacitor's voltage is below 10% of its nominal value V 0 . h) Finally, the last block on the left is the DAC that controls the speaker. The speaker is used to warn bystanders that a defibrillation is about to be released. As for (e), the speaker and the passive elements are outside the PSoC.  finally put in the Static RAM (SRAM). The ECG signal is stored in the SRAM as blocks of 4-s-long acquisitions with a sampling frequency of 500 sps.
Since the focus of OAED is the ease of use, only one couple of electrodes will be applied on the patient. Therefore, ECG and impedance acquisitions share the same electrodes. Impedance measurement is a very critical aspect in AEDs, because it is used to ascertain if a patient is connected to the device, and to calculate the discharge time required to release a precise amount of energy into the patient. If defibrillation is schematized with an RC circuit, defibrillation time T depends on the following relation (Eq. (1)): where: Z is the patient impedance (varying from 25 to 180 X, according to 60601-2-4); C is the capacitor value (150 lF); U is the energy to release (200 J); and V 0 is the nominal tension at which the capacitor is charged (1700 V).
For the impedance acquisition, a known current is injected in the patient, and the voltage it produces across the electrodes is evaluated. Keeping in mind that impedance and ECG signals have to share the same connections, there are two modalities for impedance measurement: one involves the use of a direct current (DC), and the other an alternate current (AC) with a frequency of 250 Hz. Both of them are implemented in OAED (Fig. 6).

Firmware
OAED was programmed with custom firmware in C programming language. The firmware acts as a finite-state machine, in which each state is used to enable or disable specific circuits depending on the state itself. The five different states are presented in Fig. 7, and their operations are: Measurement mode is the starting state. In measurement mode, the device has not yet diagnosed SCA in the patient. Therefore, the operations are limited to continuously acquiring ECG and impedance signals from the patient. Charging mode state is reached when OAED successfully diagnoses SCA for the first time. As a result, the charging circuit is enabled, while the patient is still monitored for SCA. Discharge enabled mode is entered when the patient is both suffering from SCA and the capacitor is ready. In this mode the defibrillator is armed and ready to deliver the shock when the operator will press the ''defibrillate" button.  6. OAED signal acquisition blocks. Starting from the left and going clockwise there are: the physical pins connected to the electrodes; the IDAC that generates the impedance excitation signal; the Delta-Sigma ADC and its three DMA channels; a comparator that monitors in real time whether the electrodes are connected or not. Finally, in the center there is a buffered voltage reference that can be applied to the patient in order to produce a controlled offset.
Internal discharge mode represents an emergency stop for OAED. Whenever something is not working properly and the capacitor is charged (even partially), OAED will dump the defibrillation energy to the internal discharge circuit, which is a power resistor. Lead-Off mode is an idle state in which OAED just waits for a patient to be connected. Thereafter in this state, OAED will only perform impedance acquisitions. When it recognizes a patient, lead-off mode is switched to Measurement mode.
The firmware also includes five different algorithms used in combination to analyze the ECG signals and assert whether the patient is suffering from SCA. These algorithms are: Threshold Crossing Interval (TCI) [21], VF filter [22], Threshold Crossing Sample Count (TCSC) [23], Phase Shift Reconstruction (PSR) [24], and Hilbert Transform Algorithm (HTA) [25]. Each ECG segment obtained by the acquisition chain is evaluated with all the algorithms and the decision is majority based. If at least two of the last three ECG segments are SCA positive, then OAED diagnoses the heartbeat as pathologic.  Hardware is the repository containing OAED schematics in KiCad format [26].

Design files
Firmware is the repository containing OAED firmware. In order to compile and program the PSoC, Cypress PSoC Creator IDE is required (available with a free-of-charge license) [27]. All prices are based on a single OAED unit purchase. Increasing numbers significantly reduces prices.

Operation instructions
In order to perform a defibrillation on a patient the operator has to: connect OAED to the electrodes; clear the patient area correctly apply electrodes on the patient; switch on OAED; wait for the diagnosis; when OAED detects SCA an orange led is turned on; wait for the green led to be turned on; press the defibrillate button; apply more defibrillation until an emergency unit arrives, or OAED asserts the patient is not suffering any more from SCA.

Validation and characterization
Starting from the high-voltage board, the RCC circuit operations were extensively simulated using LTspice [28]. The circuit was able to charge the 150 lF capacitor (C out ) at the nominal voltage of 1700 V in around 6 s. The operating frequencies varied from 75 kHz to 225 kHz, allowing therefore the use of a small transformer with high efficiency.
The tests on the H-Bridge involved the validation for the control signals, with particular regard to timing. None of the tests showed the joint closure of the IGBT in the same branch.
For the control board, tests were performed on the firmware. Fig. 8 shows an ECG signal obtained using the development version of OAED. As far as the firmware is concerned, preliminary tests of the SCA recognition algorithms showed a specificity close to 99.9%, and a sensitivity higher than 95%. These tests used signals from the PhysioNet database [29].
A final note on the battery: our calculations indicate that an 18 V, 2Ah battery can sustain around 240 charge cycles of the charging circuit; while the PSoC operations consume the equivalent energy of one charge cycle every 10 min.