Silicon Chip – July 2019

(Frankie) #1

102 Silicon chip Australia’s electronics magazine siliconchip.com.au


I wanted to use the ECG project from
the October 2015 issue (siliconchip.
com.au/Article/9135) without need-
ing to connect it to a PC. So I wrote
some software for the Micromite Plus
Explore 100 module (September &
October 2016; siliconchip.com.au/Se-
ries/304) with a 5-inch touchscreen, to
provide an ECG display using the Oc-
tober 2015 shield.
Once you’ve built and tested the
Explore 100 and built the ECG shield,
combining them is easy. The 5V and
GND pins are connected together, pro-
viding power to the shield board from
the Explore 100, and the digital D7
and analog A0 pins on the shield go
to pins 51 and 77 on the Explore 100
respectively.
The only other component you need
to add is a 5.6kW resistor from A0 to
GND. This works in conjunction with
the 2.2kW resistor in series with the out-
put of the ECG shield, providing a volt-
age divider to limit the analog output
voltage to 3.3V, to suit the Micromite.
The software is called “ECG with
Peak detect.bas” and this can be down-
loaded from the Silicon chip website.
Load it into the Explore 100 in the
usual manner (eg, using XMODEM or
MMEdit), then issue the “RUN” com-
mand; issuing “OPTION AUTORUN


ON” first is a good idea, so it will au-
tomatically start at power-up.
You could also use a Micromite Plus
Explore 64 with an LCD screen con-
nected. The analog and digital pins
used would need to be reconfigured in
the software; see the variables “ch1”
for the analog input pin and “input_
gain” for the gain switch input pin (on
lines 28 and 29 of the code).
Once sampled, the data is level shift-
ed and scaled relative to the gain set-
ting; a four-period moving average is
applied to smooth the data for display.

Electrocardiogram (ECG) based on a Micromite Explore 100


At the end of data display, the sam-
pled data is checked for the number
of peaks above a set trigger value and
the number of peaks per minute cal-
culated and displayed.
If the save data box is checked, the
sampled data is saved in CSV format to
SD card with a time and date stamped
file name.
The file name contains the date and
time that the sample was taken, eg,
“ECG 12-01-2019 15-12-38.txt”
Neil Cox,
West Haven, NSW ($85).

Sample output from the
electrocardiogram, displayed on an
LCD connected to the Explore 100.


Features


  • Operates in sample-only or
    sample and display mode

  • Selectable sample rate and
    display update rate

  • Time and date display

  • Freeze the display (using
    checkbox)

  • Option to save data to an SD
    card, with time and date stamp
    in CSV file format

  • ECG gain setting display

  • Sample and display trace times
    are shown in milliseconds

  • Optional grid

  • Display brightness controlled
    using spinbox

  • Peaks are detected and average
    beats per minute displayed

Free download pdf