Tuesday 3 April 2018

ECG on Orange Pi Zero

This project utilizes the MCP3208 A2D convertor to serve analogue data collected from an Instrumental Amplifier circuit that reads my heart beat.

The MCP3208 uses Spi-dev as detailed here which installs on Armbian. You can also install ASCII-Graph via PIP and produce a barchart of your heart beat.
Edit spiread.py as follows:

if __name__ == '__main__':
        spi = MCP3208(0)

        count = 0
        a0 = 0
        a1 = 0
        a2 = 0
        a3 = 0
        graph = Pyasciigraph()
        while True:
                count += 1
                a0 += spi.read(4)
                a1 += spi.read(5)
                a2 += spi.read(6)
                a3 += spi.read(7)
                data = [('Output',a3/300)]
                for line in graph.graph('Output', data):
                        print(line)

The circuit is taken from here and uses the first stage filter to produce a rudimentary ECG.

The electrodes are here . The signal vary's from 400 to 0 and the gain of the amplifier can be changed using a variable resistor over pin 1,5 of the Instrumental Amplifier. The first stage filter is necessessary to exclude noise from power source.

If you hold both the inputs you will see the voltage difference drop to zero. If you connect the electrodes and place them on your chest (Left side) the signal will vary with your heart rate.

No comments:

Post a Comment