Make a low-cost rhythmic Holter with a communication in real-time of the electrocardiogram from patient to doctor.
To detect the Wemos, you have to add library on arduino. This link explains how to install them.
Arduino Leonardo pin (Arduino that I used previously) is different from Wemos D1R1. The LO- pin of the AD8232 have to be linked at D8 pin of Wemos. LO+ have to be linked at D2pin.
So we have these connections between AD8232 and Wemos D1R1:
Moreover, the previous code has to be changed. The nomination of Wemos pin is different in Arduino code. pin 2 is named in 4. Pin 8 is named in 15. So we obtained the code in the folder "Code Wemos USB" on github.
Here, we have a signal in serial and we can have a first graph with the tracer of arduino software.
We obtained the following graph depending where we put the electrodes.
Electrodes close to the heart in USB with serial tracer
LA and RA electrodes on the clavicle, ground on the hip
It seems that there is less interferences where electrodes are on a bone localisation. Compare to a normal electrocardiogram, the scale on x axis need to be change. However, we can easily see the different wave and detect an heart problem.
We search to have a wifi signal. So we use the following code on github called "Code Wemos wifi" to connect it to the computer via router.
Don't forget to put the IP of your computer (line 20) and the name and password of your router ( line 43 ).
You can use an external battery in USB to supply wemos.
Now we need a code to collect and make a graph with the data from the Wemos.
For that, we use a python code called "ECG-live.py" in the folder "Code_python_wemos", which make an electrocardiogram in real time. Moreover, the code recorded the data in a csv file to see it later. You can use the code called "ECG-graph.py" to see the graph.
The fact that we used a battery in USB to powered the arduino prevent the interferences that we see if the arduino is charged directly by the computer. However, the battery doesn’t detect the arduino, so it turns off rapidly. You can try different battery in USB or use a lithium battery.
Moreover, there is a lag in transfer of data. The computer cannot plot the different point rapidly, so stock the data in the fast-memory. It’s because the code is not optimized, and a list is not a good way to deal with it. If we remove the line plt.pause, we can see all the data on the screen at the real-time, however there is no plot. It can be more interesting to use vispy to have a graph moving depending the time.