How to make a cardiograph from a computer. Do-it-yourself electrocardiograph. Heart and vascular diseases are the main cause of death in old age

The heart is the most important organ in the human body. It is often compared to a motor, which is not surprising, because the main one is the constant pumping of blood in the vessels of our body. The heart works 24 hours a day! But it happens that it cannot cope with its functions due to illness. Of course, it is necessary to monitor general health, including for heart health, but in our time this is not possible for everyone and not always.

A little history about the appearance of the ECG

Back in the mid-19th century, doctors began to think about how to track work, identify deviations in time and prevent the terrible consequences of the functioning of a diseased heart. Already at that time, doctors discovered what was happening in the contracting heart muscle and began to conduct the first observations and studies on animals. Scientists from Europe began to work on creating a special device or a unique technique for monitoring and finally the world's first electrocardiograph was created. All this time, science did not stand still, so in modern world They use this unique and already improved device, which produces so-called electrocardiography, also called ECG for short. This method of recording heart biocurrents will be discussed in the article.

ECG procedure

Today, this is an absolutely painless procedure that is accessible to everyone. An ECG can be done in almost any medical institution. Consult your family doctor and he will tell you in detail why this procedure is necessary, how to take an ECG and where it can be done in your city.

Short description

Let's look at the steps of how to take an ECG. The algorithm of actions is as follows:

  1. Preparing the patient for future manipulation. Laying him down on the couch, the health care worker asks him to relax and not tense up. Remove all unnecessary items, if any, that may interfere with the cardiograph recording. Free the necessary areas of skin from clothing.
  2. They begin to apply electrodes strictly in a certain sequence and order of application of electrodes.
  3. Connect the device to work while observing all the rules.
  4. Once the device is connected and ready to use, start recording.
  5. A paper with a recorded electrocardiogram of the heart is removed.
  6. The ECG result is handed over to the patient or doctor for subsequent interpretation.

Preparing for an ECG

Before you learn how to take an ECG, let's consider what steps you need to take to prepare the patient.

An ECG machine is available in every medical facility; it is located in a separate room with a couch for the convenience of the patient and medical staff. The room should be bright and cozy, with an air temperature of +22...+24 degrees Celsius. Since it is possible to correctly take an ECG only if the patient is completely calm, such an environment is very important for carrying out this manipulation.

The subject is placed on a medical couch. In a lying position, the body easily relaxes, which is important for future cardiograph recordings and for assessing the work of the heart itself. Before applying ECG electrodes, a cotton swab moistened with medical alcohol must be used to treat the desired areas of the patient’s arms and legs. Re-treatment of these areas is carried out with saline solution or a special medical gel intended for these purposes. The patient must remain calm during the cardiograph recording, breathe evenly, moderately, and not worry.

How to take an ECG correctly: applying electrodes

You need to know in what order the electrodes need to be applied. For the convenience of the personnel performing this manipulation, the inventors of the ECG device defined 4 colors for the electrodes: red, yellow, green and black. They are applied in exactly this order and in no other way, otherwise conducting an ECG will not be advisable. It is simply unacceptable to confuse them. Therefore, medical personnel who work with an ECG device undergo special training, then pass an exam and receive an admission or certificate that allows them to work specifically with this device. The health worker in the ECG room, according to his work instructions, must clearly know the location of the electrodes and correctly perform the sequence.

So, the electrodes for the arms and legs look like large clamps, but don’t worry, the clamp is placed on the limb absolutely painlessly, these clamps different colors and are applied to certain places on the body as follows:

  • Red - wrist right hand.
  • Yellow - left wrist.
  • Green - left leg.
  • Black - right leg.

Application of chest electrodes

Nowadays, chest electrodes come in different types, it all depends on the manufacturer. They are disposable and reusable. Disposable ones are more convenient to use and do not leave unpleasant traces of irritation on the skin after removal. But if there are no disposable ones, then reusable ones are used; they are similar in shape to hemispheres and tend to stick. This property is necessary for clear placement in exactly the right place with subsequent fixation for the right time.

A medical professional, who already knows how to take an ECG, sits on the couch to the right of the patient in order to correctly apply the electrodes. It is necessary, as already mentioned, to pre-treat the patient’s chest skin with alcohol, then with saline solution or medical gel. Each chest electrode is marked. To make it clearer how to take an ECG, a diagram of the application of electrodes is presented below.

Let's begin applying electrodes to the chest:

  1. First, we find the patient’s 4th rib and place the first electrode under the rib, which has the number 1 on it. In order for the electrode to successfully position itself in the required place, you need to use its suction property.
  2. We also place the 2nd electrode under the 4th rib, only on the left side.
  3. Then we proceed to applying not the 3rd, but the 4th electrode at once. It is placed under the 5th rib.
  4. Electrode number 3 must be placed between the 2nd and 4th ribs.
  5. The 5th electrode is installed on the 5th rib.
  6. We place the 6th electrode at the same level as the 5th, but a couple of centimeters closer to the couch.

Before turning on the device for recording an ECG, we once again check the correctness and reliability of the applied electrodes. Only after this can you turn on the electrocardiograph. Before this, you need to set the paper speed and configure other indicators. During recording, the patient must be in a state of complete rest! At the end of the operation of the device, you can remove the paper with the cardiograph record and release the patient.

We take ECGs for children

Since there are no age restrictions for performing an ECG, ECGs can also be taken for children. This procedure is done in the same way as for adults, starting at any age, including (as a rule, such early age An ECG is done exclusively to eliminate suspicion of heart disease).

The only difference between how to take an ECG for an adult and a child is that a child needs a special approach, everything needs to be explained and shown to him, and reassured if necessary. The electrodes on the child’s body are fixed in the same places as on adults, and must correspond to the child’s age. You have already learned how to apply ECG electrodes to the body. In order not to upset the little patient, it is important to ensure that the child does not move during the procedure, support him in every possible way and explain everything that is happening.

Very often, when prescribing pediatricians, they recommend additional tests, with physical activity or with the prescription of a particular drug. These tests are carried out in order to promptly identify abnormalities in the functioning of the child’s heart, correctly diagnose a particular heart disease, prescribe treatment in a timely manner, or dispel the fears of parents and doctors.

How to take an ECG. Scheme

In order to correctly read the recording on the paper tape that the ECG machine gives us at the end of the procedure, it is certainly necessary to have medical education. The record must be carefully studied by a physician or cardiologist in order to promptly and accurately diagnose the patient. So, what can an incomprehensible curved line, consisting of teeth, individual segments at intervals, tell us? Let's try to figure this out.

The recording will analyze how regular the heart contractions are, identifying the heart rate, the source of excitation, the conductive ability of the heart muscle, the determination of the heart in relation to the axes, and the condition of the so-called cardiac waves in medicine.

Immediately after reading the cardiogram, an experienced doctor will be able to make a diagnosis and prescribe treatment or give the necessary recommendations, which will significantly speed up the recovery process or protect against serious complications, and most importantly, a timely ECG can save a person’s life.

It is necessary to take into account that the cardiogram of an adult differs from the cardiogram of a child or a pregnant woman.

Is ECG taken for pregnant women?

In what cases is a pregnant woman prescribed a heart electrocardiogram? If at the next appointment with an obstetrician-gynecologist the patient complains of chest pain, shortness of breath, large fluctuations during control blood pressure, headaches, fainting, dizziness, then, most likely, an experienced doctor will prescribe this procedure in order to promptly reject bad suspicions and avoid unpleasant consequences for the health of the expectant mother and her baby. There are no contraindications for undergoing an ECG during pregnancy.

Some recommendations before the planned ECG procedure

Before taking an ECG, the patient must be instructed about what conditions need to be met the day before and on the day of removal.

  • The day before, it is recommended to avoid nervous tension, and the duration of sleep should be at least 8 hours.
  • On the day of delivery, you need a small breakfast of food that is easily digestible, required condition- do not overeat.
  • Eliminate foods that affect heart function for 1 day, such as strong coffee or tea, spicy seasonings, alcoholic drinks, and smoking.
  • Do not apply to the skin of hands, feet, chest cream and lotions, action fatty acids which may subsequently deteriorate the conductivity of the medical gel on the skin before applying the electrodes.
  • Absolute calm is necessary before taking an ECG and during the procedure itself.
  • Be sure to avoid physical activity on the day of the procedure.
  • Before the procedure itself, you need to sit quietly for about 15-20 minutes, breathing calmly and evenly.

If the subject has severe shortness of breath, then he needs to undergo an ECG not lying down, but sitting, since it is in this position of the body that the device will be able to clearly record cardiac arrhythmia.

Of course, there are conditions in which it is absolutely impossible to perform an ECG, namely:

  • In acute myocardial infarction.
  • Unstable angina.
  • Heart failure.
  • Some types of arrhythmia of unknown etiology.
  • Severe forms of aortic stenosis.
  • PE syndrome (pulmonary embolism).
  • Dissection of aortic aneurysm.
  • Acute inflammatory diseases of the heart muscle and pericardial muscles.
  • Severe infectious diseases.
  • Severe mental illness.

ECG with mirror arrangement of internal organs

Mirror arrangement internal organs implies their arrangement in a different order, when the heart is not on the left, but on the right. The same applies to other organs. It's pretty a rare event, nevertheless it occurs. When a patient with a mirror arrangement of internal organs is prescribed to undergo an ECG, he must warn the nurse who will perform this procedure about his peculiarity. In this case, young specialists working with people with mirror arrangement of internal organs have a question: how to take an ECG? On the right (the removal algorithm is basically the same), the electrodes are placed on the body in the same order as in ordinary patients they would be placed on the left.

Take care of your health and the health of your loved ones!

Another method of obtaining information about the work of the heart is electrocardiography, which is an inexpensive method of instrumental diagnostics of the heart, allowing you to check its work and determine abnormalities in it. For this purpose the company has developed chip AD8232. The AD8232 is an integrated signal processing unit for ECG and other biopotential applications. The microcircuit is designed to receive, amplify and filter weak biopotential signals in conditions of strong interference.

AD8232 Key Features:

  • Low current consumption: 170 µA
  • Supply voltage: unipolar from 2 to 3.5 V
  • Rail to Rail output signal
  • Number of electrodes: 2 or 3
  • Number of ECG leads: 1
  • Built-in RF interference filter
  • 2-pole high pass filter
  • 3-pole filter low frequencies
  • Common mode rejection ratio: 80 dB
  • Electrode Contact Detector
  • Output signal: analog

Based on this microcircuit, there are modules on sale that are convenient for learning and using; the kit includes not only a board with AD8232 and wiring, but also a set of electrodes depending on the configuration.

Module diagram:

To obtain a cardiogram, electrodes are attached to the chest and limbs (depending on the selected lead), from which signals of the electrical activity of the heart are taken.

The heart's electrical system controls the generation and propagation of electrical signals through the heart muscle, causing the heart to contract and relax periodically to pump blood. During the heart cycle, an orderly process of depolarization occurs. Depolarization is a sudden change in the electrical state of a cell, when the negative internal charge of the cell becomes positive for a short time. In the heart, depolarization begins in specialized pacemaker cells in the sinoatrial node. Next, the excitation wave propagates through the atrioventricular (atrioventricular) node down to the His bundle, passing into the Purkinje fibers and further leads to contraction of the ventricles. Unlike other nerve cells, which are unable to generate an electrical signal in a self-oscillating mode, the cells of the sinoatrial node are capable of creating a rhythmic electrical signal without external influence. More precisely, external influences (for example, exercise stress) affect only the oscillation frequency, but are not needed to start this “generator”. In this case, periodic depolarization and repolarization of pacemaker cells occurs. The pacemaker also has a stable frequency generator that acts as the sinoatrial node. The membranes of living cells act as capacitors. Due to the fact that the processes in cells are electrochemical and not electrical, depolarization and repolarization in them occurs much more slowly than in a capacitor of the same capacity.

Electrodes placed on the patient's body detect small changes in potentials on the skin, which arise due to the depolarization of the heart muscle with each contraction.

Thus, based on the AD8232, it is possible to build portable devices for monitoring the health of the cardiac system (ECG, cardiac monitors, etc.). In addition, this microcircuit is suitable for using data on contractions of other muscles, which potentially makes it possible to use it in bionics and prosthetics. In this case, it is necessary to connect electrodes to the muscles whose activity is monitored.

When choosing STM32 microcontrollers for portable devices, it is rational to use L series microcontrollers with low current consumption to increase battery life. In our case, STM32F1 is used for review.

The circuit is based on an STM32F103C8T6 microcontroller; an ILI9341 TFT LCD display with an SPI interface is used for display. The circuit is powered from 5 volts (you can use a Power Bank), up to required level The supply voltage is reduced using the AMS1117 3v3 voltage stabilizer or any other voltage stabilizer with the required parameters. In addition to the display, a buzzer with a built-in generator is used as a heartbeat indicator. When a peak in the heartbeat appears, the buzzer is turned on for the duration of this peak.

The microcontroller program has two menus: the main menu, where the cardiogram is built on the display and the heart rate is displayed, and the settings menu, where you can set the coefficients for displaying the cardiogram in height and width, as well as set the threshold for counting heartbeats. The last parameter is set relative to the cardiogram window from 0 to 200 - this is a threshold that includes only the peaks of heart beats. The settings are saved in the microcontroller's flash memory. For reliability, the last page of memory is used so as not to cross the memory in which the microcontroller program is written. To control the menu, three buttons S2-S4 are used. The S2 button switches the menu, and the S3 and S4 buttons adjust the settings. The settings values ​​here are quite abstract and tied to the code. The first setting specifies the delay time between ADC measurements and plotting, that is, what longer delay, the more time it takes to fill the screen and the more compressed the schedule. The second setting sets the coefficient that divides the measured ADC value - with a maximum value of 4095, divide by 20 and get 204.75, that is, we fit almost the entire range of values ​​into 200 pixels of the screen allocated for the graph. By changing this factor, you can increase or decrease the graph along the Y axis. The last setting sets the threshold, taking into account the second setting to determine the peak. Going beyond this value, the program understands when a heart beat occurred. Between these peaks, the time is recorded from which the heart rate is calculated.

The program contains a visualization of the deviation of the heart rate (heart rate), if it is too small or too large, the ECG graph on the display begins to appear in red. Module MOD1 is the module in question based on AD8232. Heart rate is calculated as the average of the last five measurements.

The three electrodes included in the kit are connected to the module via a connector and the electrodes themselves are attached to the human body. In my case, the yellow electrode corresponds to RL (right leg), red RA (right arm), green LA ( left hand). The electrodes are also attached to the chest accordingly. These electrode contacts on the module are also duplicated in the form of contacts to which you can connect your own wires with electrodes. When using the wires from the kit, be sure to ring the contacts to make sure they match the colors, which is not always the case. The round electrodes included in the kit are disposable. After their use, the adhesiveness deteriorates sharply, and the gel in the middle dries out to obtain reliable contact with the skin. After the first experiments, you should not rush to throw them away; to continue the experiments, just moisten the gel with water (I added a little salt to the water), then it will again become viscous, sticky and conductive. Such electrodes are the cheapest and simplest; if you wish, you can find on sale reusable electrodes without adhesive elements that work like suction cups. But even in this case, you need to use a special gel to ensure reliable contact of the electrode with the skin. The most simple option The electrode may be a metal plate or washer (coin) soaked in salt water, connected to the AD8232 module. This electrode option is the most budget-friendly and is not suitable for long-term use - when the water dries, the contact will begin to deteriorate, which will lead to a deterioration in the measurement results.

The AD8232 module has an electrode connection detector - contacts L+ and L- output logical ones if the electrodes are not connected and logical zero if they are connected. This is indicated on the display screen by the symbols L+ and L-. If their color is green, then the electrodes are connected, if red, then they are disconnected. The presence of noise on the ECG graph may be associated with such nuances as the contact of the electrodes and their correct location on the body, the presence of defects in the electrode wires and their damage. Unlike optical sensors, body movements during measurement produce much less distortion of the graph on the screen, but they still do, since when moving, the tension of other muscles of the body located close to the electrode also gives some impulses.

This circuit does not exclude the use of other sensors with analog output, for example, those discussed earlier. It is enough to connect pins PA1 and PA2 of the microcontroller to ground or power so that the symbols on the display do not blink.

P.S. This device cannot be used for self-diagnosis; only a qualified doctor can make any conclusions about health. This device was created for educational and informational purposes only.

List of radioelements

Designation Type Denomination Quantity NoteShopMy notepad
IC1 MK STM32

STM32F103C8

1 To notepad
VR1 Linear regulator

AMS1117-3.3

1 To notepad
MOD1 ECG moduleAD82321 To notepad
HG1 TFT LCDILI93411 To notepad
Z1 Quartz8 MHz1 To notepad
HL1 Light-emitting diode 1 To notepad
EP1 Boozer5V1 With built-in generator To notepad
S1-S4 Tact button 4 To notepad
C1, C2 Capacitor22 pF2

We consider a simple cardiograph that fits in a pocket and provides recording of an electrocardiogram (pulse rate), temperature and position of the human body. These parameters are stored on a micro SD memory card, from where they can later be copied to a personal computer (PC) and, using a special program, displayed in the form of graphs (linked to the time and date of shooting) for detailed study.

The device was developed to study human sleep behavior, but could also be useful for athletes and doctors. Beginning radio amateurs will be interested in the scheme for recording biocurrents (when the human body becomes the source of the signal) and an example of the use of widely used SD memory cards for storing diverse information.

Schematic diagram cardiograph is shown in Fig. 1.

Fig 1 - Schematic diagram of a simple cardiograph

A cardiac signal amplifier is assembled on elements DA1, DA2, DA3. This is a regular ULF with a differential input and high input impedance. A pair of electrodes attached to the body in the area of ​​the heart is connected to the amplifier inputs E+ and E- to pick up the initial cardiac signal. Elements DA1.1 and DA1.2 work as repeaters, providing high input impedance. Instrumentation amplifier DA3 amplifies the signal approximately 6 times (the coefficient is set by resistor R4) before applying it to microcontroller ADC DD1.

In addition to the useful signal biological origin on electrodes E+ and E- there is common-mode interference (primarily 50 Hz from the lighting network), the amplitude of which is thousands of times higher than the useful signal. To suppress them, an “active ground” is used: a third electrode E0 is attached to the body, to which the common-mode component of the input signal is supplied from the output of DA2.1 in antiphase. Its selection is performed by the adder on R1 and R2, and DA2.1 – amplification and inversion. Thanks to this peculiar negative feedback the magnitude of common mode interference is sharply reduced, and then it is effectively suppressed by DA3. To form the reference voltage (midpoint) for op-amps DA2.1 and DA3, elements R6, R7, C1, C2, DA2.2 are used.

To measure temperature and body position, integrated temperature sensors VK1 and acceleration VK2 are connected to the microcontroller DD1 via a two-wire I 2 C interface. The I 2 C bus specification is implemented in software. Resistors R8 and R10 serve as loads for the interface lines. Resistors R9, R11, as well as R5, R12, R14, R15 protect the pins of the microcontroller and peripherals from overloads in the event of MK failures (they do not need to be installed in a debugged device).

The accelerometer BK2 is powered through the diode VD1, which reduces the supply voltage of BK2 by 0.7 V so that the voltage of the “freshly charged” Ni-MH battery GB1 (4.2 V) does not exceed the rating value for the BK2 MMA7455LT (3.6 V). Body position is determined by the projection of gravity on the sensitivity axis BK2, which, for example, allows you to clearly distinguish the following body positions: standing, lying on your back, on your stomach, on your left or right side. Changes in acceleration are used to record motor activity.

The functioning of the device as a whole is controlled by the DD1 microcontroller. Immediately after power is applied, the device operates in recording mode: DD1 periodically polls sensors BK1 and BK2, measures the frequency at the CCP1 input and digitizes the cardiac signal. The combined information stream is recorded in a file on a micro SD memory card (connector X1), and is also sent to a PC via the RS-232 interface (connector X2) for control and visualization. Using a command from your computer, you can stop recording and switch the device to download mode for saved files.

Information is saved on a micro SD memory card, which is connected via connector X1. During operation, the card can consume up to 100 mA (per pulse), creating powerful power supply noise, so it is powered directly from the GB1 source, and the rest of the circuit is powered through the RC filter R16 C5.

We had to abandon the use of the standard FAT file system on the SD card: it is not resistant to sudden power outages, and the MK memory is not enough to buffer incoming real-time data. An alternative format for storing information has been developed. Writing to the card is carried out sequentially, sector by sector. The four-byte number of the first free sector EmptyPos, into which new data should be written, is stored in the EEPROM of the microcontroller. After writing the next sector, the EmptyPos number is incremented.

In each sector of the SD card (512 bytes in size), along with useful data, a signature and a 4-byte number of the first sector of the file are stored. Thus, although data is written to the card strictly sequentially, it is structured in the form of files, Fig. 2. The logic for obtaining a list of all files is implemented by a program on a personal computer; at the same time, efforts are being made additional measures for error control and correction.


Fig 2 - Mechanism for sequentially writing files to an SD card

Instead of the usual formatting operations (when installing a new SD card) and deleting files (when the card's capacity is exhausted), the user performs the operation of installing EmptyPos on the initial sector with the number 65536. The first 65536 sectors of the card are not used in order to preserve the “real” file system existing on the card.

The device connects to the computer via the RS-232 interface via connector X2. Resistor R13 limits the current through the RX pin of the MK in conditions when the input signal voltage is higher than the supply voltage of the MK. The signals on the X2 connector are at TTL levels, so you cannot directly connect a computer to the X2 connector! You should use a ready-made USB-COM adapter from cell phone(usually such adapters have TTL levels) or make such an adapter yourself based on the FT232R microcircuit according to a standard circuit. As a last resort, you can assemble a level converter to TTL on a MAX232 chip or according to the circuit in Fig. 3. Connector X2 (pins 5 and 8) can also charge battery GB1.

The exchange rate between the device and the computer is fixed: 57600 baud. Just to speed up the copying of files from an SD card to a PC, the speed can be increased to 460800, 806400 or 921600 baud (if the computer supports them). Data output in this case is carried out by the MK programmatically to the RC0 output (and the TX output is turned off).


Rice. 3 - Simple TTL to RS-232 converter

Designed to work with the device special program for PC (program file EKG_SD_2010.exe is attached), which allows you to visualize the cardiogram and sensor readings during recording, read a list of files from the SD card and copy the necessary ones to the computer, save the cardiac signal in the standard WAVE PCM format, process recordings to isolate R- waves and pulse rate calculations, visualize and save the resulting time dependencies in a unified format. Working with the program is described in more detail in the attached “operator’s manual” EKG_SD_2010.doc.

MK DD1 measures the signal frequency at pin 13, which can be used to connect additional sensors to the device. The signal frequency should not exceed 8 KHz (relative measurement error no worse than 10 -6, measurement period ~ 0.25 sec).

Details and design. As DA1 and DA2, you can use any widely used op-amps that are operable in the supply voltage range from 2.7 to 4.2 V. We will replace the DA3 instrumentation amplifier with a conventional op-amp connected according to the circuit in Fig. 4. However, it is advisable to select similar resistances of resistors R18 and R19, R20 and R21 (as well as R1 and R2).

A socket must be provided for the DD1 microcontroller. You should add the program from the attached file EKG_SD_Pic.hex into it (the “fuses” are stored inside the firmware).


Rice. 4 - Functional replacement for DA3 AD623

The device can operate without an SD card or sensors BK1 and BK2 with a corresponding decrease in functionality. This allows novice radio amateurs to simplify the device at their discretion without the need to change the DD1 firmware or computer programs. For example, if you only need to observe biocurrents in real time, and recording to an SD card is not required, then the card (as well as additional sensors) does not need to be installed.

A micro SD ® SD adapter is used as connector X1 to connect a micro SD card (they are sold together with micro SD cards). The contacts of the adapter are carefully tinned, and then connected to the circuit using short MGTF-0.05 wires. In Fig. Figure 5 shows the numbering and designations of contracts for a macro SD card (i.e., adapter). It is advisable to use SD class 4 cards and higher (due to the small memory capacity of the MK, the maximum recording delay for one sector should be less than 40 ms). HC cards (capacity ³ 4 GB) are supported.


Rice. 5 - Numbering of contacts of a regular SD card (adapter)

Connector X2 – type DB9F or smaller (suitable for the used COM-USB adapter).

The BK1 temperature sensor is fixed on the body with a plaster, and is connected to the main circuit with 4 MGTF-0.05 wires twisted into a bundle, up to 50 cm long.

Installation of the BK2 MMA7455LT accelerometer (dimensions 3´5´1 mm) requires some dexterity. The easiest way is to glue the sensor to the board with the contacts facing up and solder it to the circuit with 0.1 mm wires. Capacitors C3, C4 should be located in close proximity to VK2. As planned, the sensor should retain enough permanent position relative to the torso (or other selected body part). To achieve this, BK2 can be placed either in the cardiograph body, or made remote, connecting to the main circuit with wires in the same way as BK1.

Electrodes E+, E-, E0 are metal circles Æ 10 mm made of titanium, which are fixed in the heart area with a plaster. You can use small coins for experiments - but from prolonged contact with the body they begin to rust! The electrodes are connected with unshielded wires MGTF-0.05 (if possible, the wires to E+ and E- should be twisted, and the wire to E0 should be wrapped around).

Electrode E0 is attached anywhere (for example, approximately between E+ and E-). In medicine, special arrangements of electrodes on the body and corresponding methods for analyzing cardiograms are used. However, to determine the pulse rate, electrodes E+ and E- can be placed in the heart region quite arbitrarily, as long as sufficiently clear pulses of positive polarity are observed (as in Fig. 6). The cardiac signal can also be taken from the hands, but the impulses are weaker (and their automatic selection is difficult).


Rice. 6 - Example of the original cardiac signal

The device is powered by a 3.6 V battery. Current consumption depends on the SD card and averages 20-30 mA. GB1 capacity of more than 400 mA/hour is selected based on the required recording time (8 - 12 hours). It should be noted that the voltage of a fresh battery reaches 4.2 V, exceeding the established limit for an SD card (3.6 V). However, practice has shown that they can withstand increased voltage.

Setting up. The digital part of the circuit does not need to be adjusted. After initializing the SD card, 1-2 seconds after turning on SA1, a signal should appear at the TX DD1 output to transmit a data stream to the PC. If you now connect a PC to the device and select the correct COM port in the EKG_SD_2010.exe program, the screen should display the recording status, EmptyPos sector number, sensor readings BK1, BK2 and a graph of the digitized cardiac signal. Next, press the “STOP” button and perform “formatting”. The success of these operations indicates correct communication between the device and the PC. By clicking the “Initialization” button, you check whether the device correctly recognizes the SD card.

While the electrodes E+, E-, E0 are not connected anywhere, a working cardiac signal amplifier should “catch” (and the computer display) a 50 Hz interference signal from the network. When E+, E-, E0 are connected to each other, the noise amplitude should decrease sharply, and at pin 6 of DA3 there should be approximately half the supply voltage.

Next, electrodes E+, E-, E0 are attached to the body and try to detect impulses correlated with heart beats. If there are problems, you should ensure that the skin is moisturized at the site of contact with the electrode and vary their position in search of the best signal. You can also increase the gain of DA3 by decreasing the resistance of R4.

1. Baranovsky A.L. ECG continuous monitoring equipment. M.: Radio and communication, 1993. – 248 p.
2. Averbukh V. Instrumental amplifiers. Circuitry, 2001. – No. 1. – P. 26.
3. Gordeychuk A.P. "Active ground" system in electrocardiographs. – St. Petersburg Journal of Electronics, 2005. – No. 2. – P. 37.
4. http://www.sdcard.org/developers/tech/sdcard/pls/Simplified_Physical_Layer_Spec.pdf
5. Terekhin Yu. Musical call with MMC card. Radio, 2009. – No. 9. – pp. 24-27.
6. http://www.ftdichip.com/Documents/DataSheets/DS_FT232R.pdf
7. Sizentseva G.P. - Toolkit on electrocardiography (to help the nurse). – M.: Publishing house NTsSSKh im. Bakuleva RAMS, 1998. – 68 p.

You can download the sources, firmware, software and other files for the project below

List of radioelements

Designation Type Denomination Quantity NoteShopMy notepad
Rice. 1
DD1 MK PIC 8-bit

PIC16F873

1 To notepad
DA1, DA2 OUKR1446UD12 To notepad
DA3 Instrumentation amplifierAD6231 To notepad
BK1 temperature sensor

DS1621

1 To notepad
BK2 AccelerometerMMA7455LT1 To notepad
VD1 Diode

KD522A

1 To notepad
C1, C2 Capacitor0.22 µF2 To notepad
C3 Capacitor2.2 µF1 To notepad
C4, C6, C8 Capacitor0.1 µF3 To notepad
C5, C7 Electrolytic capacitor1000 µF2 To notepad
R1, R2, R4 Resistor

20 kOhm

3 To notepad
R3 Resistor

720 kOhm

1 To notepad
R5, R9, R11, R13-R15 Resistor

300 Ohm

6 To notepad
R6, R7 Resistor

150 kOhm

2 To notepad
R8, R10 Resistor

4.7 kOhm

2 To notepad
R12 Resistor

150 Ohm

1 To notepad
R16 Resistor

10 ohm

1

Wandering around the Internet, you often come across inventions by “home craftsmen” - either a device for ionizing water, or a do-it-yourself quartz lamp. But for a pocket electrocardiograph, and even with your own hands...

We consider a simple cardiograph that fits in a pocket and provides recording of an electrocardiogram (pulse rate), temperature and position of the human body. These parameters are stored on a micro SD memory card, from where they can later be copied to a personal computer (PC) and, using a special program, displayed in the form of graphs (linked to the time and date of shooting) for detailed study.

The device was developed to study human sleep behavior, but could also be useful for athletes and doctors. Beginning radio amateurs will be interested in the scheme for recording biocurrents (when the human body becomes the source of the signal) and an example of the use of widely used SD memory cards for storing diverse information.

The schematic diagram of the cardiograph is shown in Fig. 1.


Fig 1 - Schematic diagram of a simple cardiograph

A cardiac signal amplifier is assembled on elements DA1, DA2, DA3. This is a regular ULF with a differential input and high input impedance. A pair of electrodes attached to the body in the area of ​​the heart is connected to the amplifier inputs E+ and E- to pick up the initial cardiac signal. Elements DA1.1 and DA1.2 work as repeaters, providing high input impedance. Instrumentation amplifier DA3 amplifies the signal by approximately 6 times (the coefficient is set by resistor R4) before feeding it to the ADC of microcontroller DD1.

In addition to the useful signal of biological origin, the electrodes E+ and E- contain common-mode interference (primarily 50 Hz from the lighting network), the amplitude of which is thousands of times higher than the useful signal. To suppress them, an “active ground” is used: a third electrode E0 is attached to the body, to which the common-mode component of the input signal is supplied from the output of DA2.1 in antiphase. Its selection is performed by the adder on R1 and R2, and DA2.1 - amplification and inversion. Thanks to this kind of negative feedback, the amount of common mode interference is sharply reduced, and then it is effectively suppressed by DA3. To form the reference voltage (midpoint) for op-amps DA2.1 and DA3, elements R6, R7, C1, C2, DA2.2 are used.

To measure temperature and body position, integrated temperature sensors VK1 and acceleration VK2 are connected to the microcontroller DD1 via a two-wire I 2 C interface. The I 2 C bus specification is implemented in software. Resistors R8 and R10 serve as loads for the interface lines. Resistors R9, R11, as well as R5, R12, R14, R15 protect the pins of the microcontroller and peripherals from overloads in the event of MK failures (they do not need to be installed in a debugged device).

The accelerometer BK2 is powered through the diode VD1, which reduces the supply voltage of BK2 by 0.7 V so that the voltage of the “freshly charged” Ni-MH battery GB1 (4.2 V) does not exceed the rating value for the BK2 MMA7455LT (3.6 V). Body position is determined by the projection of gravity on the sensitivity axis BK2, which, for example, allows you to clearly distinguish the following body positions: standing, lying on your back, on your stomach, on your left or right side. Changes in acceleration are used to record motor activity.

The functioning of the device as a whole is controlled by the DD1 microcontroller. Immediately after power is applied, the device operates in recording mode: DD1 periodically polls sensors BK1 and BK2, measures the frequency at the CCP1 input and digitizes the cardiac signal. The combined information stream is recorded in a file on a micro SD memory card (connector X1), and is also sent to a PC via the RS-232 interface (connector X2) for control and visualization. Using a command from your computer, you can stop recording and switch the device to download mode for saved files.

Information is saved on a micro SD memory card, which is connected via connector X1. During operation, the card can consume up to 100 mA (per pulse), creating powerful power supply noise, so it is powered directly from the GB1 source, and the rest of the circuit is powered through the RC filter R16 C5.

We had to abandon the use of the standard FAT file system on the SD card: it is not resistant to sudden power outages, and the MK memory is not enough to buffer incoming real-time data. An alternative format for storing information has been developed. Writing to the card is carried out sequentially, sector by sector. The four-byte number of the first free sector EmptyPos, into which new data should be written, is stored in the EEPROM of the microcontroller. After writing the next sector, the EmptyPos number is incremented.

In each sector of the SD card (512 bytes in size), along with useful data, a signature and a 4-byte number of the first sector of the file are stored. Thus, although data is written to the card strictly sequentially, it is structured in the form of files, Fig. 2. The logic for obtaining a list of all files is implemented by a program on a personal computer; At the same time, additional measures are taken to control and correct errors.


Fig 2 - Mechanism for sequentially writing files to an SD card

Instead of the usual formatting operations (when installing a new SD card) and deleting files (when the card's capacity is exhausted), the user performs the operation of installing EmptyPos on the initial sector with the number 65536. The first 65536 sectors of the card are not used in order to preserve the “real” file system existing on the card.

The device connects to the computer via the RS-232 interface via connector X2. Resistor R13 limits the current through the RX pin of the MK in conditions when the input signal voltage is higher than the supply voltage of the MK. The signals on the X2 connector are at TTL levels, so you cannot directly connect a computer to the X2 connector! You should use a ready-made USB-COM adapter from a cell phone (usually such adapters have TTL levels) or make such an adapter yourself based on the FT232R chip according to a standard circuit. As a last resort, you can assemble a level converter to TTL on a MAX232 chip or according to the circuit in Fig. 3. Connector X2 (pins 5 and 8) can also charge battery GB1.

The exchange rate between the device and the computer is fixed: 57600 baud. Just to speed up the copying of files from an SD card to a PC, the speed can be increased to 460800, 806400 or 921600 baud (if the computer supports them). Data output in this case is carried out by the MK programmatically to the RC0 output (and the TX output is turned off).


Rice. 3 - Simple TTL to RS-232 converter

To work with the device, a special program for PC has been developed (the program file EKG_SD_2010.exe is attached), which allows you to visualize the cardiogram and sensor readings during recording, read a list of files from the SD card and copy the necessary ones to the computer, save the cardiac signal in the standard WAVE PCM format, process records in order to isolate R-waves and calculate pulse rate, visualize and save the resulting time dependencies in a unified format. Working with the program is described in more detail in the attached “operator’s manual” EKG_SD_2010.doc.

MK DD1 measures the signal frequency at pin 13, which can be used to connect additional sensors to the device. The signal frequency should not exceed 8 KHz (relative measurement error no worse than 10 -6, measurement period ~ 0.25 sec).

Details and design. As DA1 and DA2, you can use any widely used op-amps that are operable in the supply voltage range from 2.7 to 4.2 V. We will replace the DA3 instrumentation amplifier with a conventional op-amp connected according to the circuit in Fig. 4. However, it is advisable to select similar resistances of resistors R18 and R19, R20 and R21 (as well as R1 and R2).

A socket must be provided for the DD1 microcontroller. You should add the program from the attached file EKG_SD_Pic.hex into it (the “fuses” are stored inside the firmware).


Rice. 4 - Functional replacement for DA3 AD623

The device can operate without an SD card or sensors BK1 and BK2 with a corresponding decrease in functionality. This allows novice radio amateurs to simplify the device at their discretion without the need to change the DD1 firmware or computer programs. For example, if you only need to observe biocurrents in real time, and recording to an SD card is not required, then the card (as well as additional sensors) does not need to be installed.

A micro SD ® SD adapter is used as connector X1 to connect a micro SD card (they are sold together with micro SD cards). The contacts of the adapter are carefully tinned, and then connected to the circuit using short MGTF-0.05 wires. In Fig. Figure 5 shows the numbering and designations of contracts for a macro SD card (i.e., adapter). It is advisable to use SD class 4 cards and higher (due to the small memory capacity of the MK, the maximum recording delay for one sector should be less than 40 ms). HC cards (capacity ³ 4 GB) are supported.


Rice. 5 - Numbering of contacts of a regular SD card (adapter)

Connector X2 - type DB9F or smaller (suitable for the used COM-USB adapter).

The BK1 temperature sensor is fixed on the body with a plaster, and is connected to the main circuit with 4 MGTF-0.05 wires twisted into a bundle, up to 50 cm long.

Installation of the BK2 MMA7455LT accelerometer (dimensions 3´5´1 mm) requires some dexterity. The easiest way is to glue the sensor to the board with the contacts facing up and solder it to the circuit with 0.1 mm wires. Capacitors C3, C4 should be located in close proximity to VK2. By design, the sensor should maintain a fairly constant position relative to the torso (or other selected body part). To achieve this, BK2 can be placed either in the cardiograph body, or made remote, connecting to the main circuit with wires in the same way as BK1.

Electrodes E+, E-, E0 are metal circles Æ 10 mm made of titanium, which are fixed in the heart area with a plaster. You can use small coins for experiments - but from prolonged contact with the body they begin to rust! The electrodes are connected with unshielded wires MGTF-0.05 (if possible, the wires to E+ and E- should be twisted, and the wire to E0 should be wrapped around).

Electrode E0 is attached anywhere (for example, approximately between E+ and E-). In medicine, special arrangements of electrodes on the body and corresponding methods for analyzing cardiograms are used. However, to determine the pulse rate, electrodes E+ and E- can be placed in the heart region quite arbitrarily, as long as sufficiently clear pulses of positive polarity are observed (as in Fig. 6). The cardiac signal can also be taken from the hands, but the impulses are weaker (and their automatic selection is difficult).


Rice. 6 - Example of the original cardiac signal

The device is powered by a 3.6 V battery. Current consumption depends on the SD card and averages 20-30 mA. GB1 capacity of more than 400 mA/hour is selected based on the required recording time (8 - 12 hours). It should be noted that the voltage of a fresh battery reaches 4.2 V, exceeding the established limit for an SD card (3.6 V). However, practice has shown that they can withstand increased voltage.

Setting up. The digital part of the circuit does not need to be adjusted. After initializing the SD card, 1-2 seconds after turning on SA1, a signal should appear at the TX DD1 output to transmit a data stream to the PC. If you now connect a PC to the device and select the correct COM port in the EKG_SD_2010.exe program, the screen should display the recording status, EmptyPos sector number, sensor readings BK1, BK2 and a graph of the digitized cardiac signal. Next, press the “STOP” button and perform “formatting”. The success of these operations indicates correct communication between the device and the PC. By clicking the “Initialization” button, you check whether the device correctly recognizes the SD card.

While the electrodes E+, E-, E0 are not connected anywhere, a working cardiac signal amplifier should “catch” (and the computer display) a 50 Hz interference signal from the network. When E+, E-, E0 are connected to each other, the noise amplitude should decrease sharply, and at pin 6 of DA3 there should be approximately half the supply voltage.

Next, electrodes E+, E-, E0 are attached to the body and try to detect impulses correlated with heart beats. If there are problems, you should ensure that the skin is moisturized at the site of contact with the electrode and vary their position in search of the best signal. You can also increase the gain of DA3 by decreasing the resistance of R4.

.
or a cheap USB-sound board for SKYPE telephony.

Allows you to write a cardiogram to a .bin file
and also reproduce the results of saved measurements in real time.
Unfortunately, I did not find programs for decoding cardiograms
and I don’t know how to save the file correctly, so it’s just a *.bin file.
May be useful for detecting rare ECG abnormalities,
which can be difficult to record when rare
and short visits to the ECG room
or just to monitor your heart if you know a cardiologist (.

View the list of references on this topic and add your information
it is possible on the forum in the topic What books do you recommend?

Find out what to do with the received cardiogram
and you can suggest your option on the forum
on topic Cardiogram received. What's next?

Since the amplifiers do not have galvanic isolation, all experiments for safety reasons and to reduce interference must be carried out with a laptop not connected to a 220V network.

Program ECG.llb For version LabVIEW5.0

Amplifier module - any amplifier with a closed (>4 µF) input and Kus >=100

In my case, I use the KARDIO module from a USB oscilloscope.

The diagram and design look like this:


DA1 can be omitted, but the RRL wire can be connected to ground.

R6+R7+R8 = 100-400 Ohm (150)

Connect the left and right hand inputs to R11 and R12 through non-polar capacitors 8.0 -10.0 µF to eliminate possible galvanic offset (up to hundreds of µV)

  • Cardio amplifier board file in JPG format: CARDIO_JPG.zip in PCB2004 format: Kardio_PCB2004.zip

    The microcontroller module board and firmware are on the oscilloscope module page.

    Everything is combined into one housing for compactness. If this is not necessary, you can simply use the oscilloscope module
    paired with a cardiac amplifier module. Or make your own device that transmits data in the format specified in the oscilloscope module.

    Corrector program. Korrektor.llb


    Allows you to align the cardiogram:

    This option might look like this:

    2. Cardiograph based on USB sound card
    ECG of the USB sound card

    Version for USB sund card based on a chip for SKYPE phones AP-T6911 or any other that allows you to measure DC voltage:

    1 . We buy something like this for $2-10: for example this one: http://www.dealextreme.com/details.dx/sku.22475
    2 . Disable microphone amplifier. All that remains is a 10-bit ADC with an input offset of about 2.5 volts
    which will have to be compensated if you measure constant voltage.
    Upgrading the USB - Sound board (See pictures)

    It looks something like this:

    Provided that there is a SKYPE phone chip AP-TP6911_02EV10

    Warning: models change constantly.....

    Unfortunately, the USB and SOUND options create *.bin files with different signal sampling rates.
    If in ECG_USB_SND.llb this can be corrected in the program, then the EXE version is hardcoded at 48000/32 samples per second.
    If you are working with a standard sound card, you will have to find adapter capacitors in the microphone input channel
    (usually 1 at the input and 1 in the microphone amplifier) ​​and increase their capacitance to tens of microfarads.

    3. Cardiograph based on bluetooth headset with BC31A223A chip (From Sony Ericsson phones):

    1. Preparing the headset.
    It consists of disconnecting the microphone by removing the capacitor C10 and connecting it to the differential input connector
    microcircuit microphone amplifier (MIC_N and MIC_P) and voltage VOUT (2.7V) to power amplifiers connected to the connector.
    How this was done is shown in the figure below.
    I decided not to touch the headset phone for now in order to use it for its intended purpose.

    2. Installing BLUETOOTH drivers with headset support.
    In my case, the following drivers did not work:

    The issue is quite problematic, so someone may have to solve it differently.

    After this, you can start experimenting.

    On this moment the following results are available:

    The maximum input signal has a swing of +/- 32 mV with 15 bits of resolution and a sampling frequency of 8 kHz, which allows you to take a cardiogram
    when connecting electrodes through an isolation capacitor to the MIC_N and MIC_P contacts connected to an external connector.
    An example of pictures is shown in the figure.



    The connection turned out to be quite poor quality. Quite often there are interferences or interruptions in the flow, which manifests itself in the form of pulsed noise.
    So Holter ECG monitoring via Bluetooth headset seems to be impossible.

    After the usual procedure for connecting the headset, the cardiogram can be recorded in a convenient way for you in a *.wav file
    for further processing or use the above program Cardiograph based on USB sound board

    If there is such a beautiful thing as PSoC, then you can try to assemble a cardiograph for example on



  • If you find an error, please select a piece of text and press Ctrl+Enter.