lunes, 13 de agosto de 2018

EKG SIMULATOR




1.We built a 10 * 10 square pyramid with breadboard wire creating a mesh, welding all the crosses for a better support.





2. An EKG simulator was desgined using a graphical interface in MATLAB with the following steps:

2.1)  The signals were taken on file .txt The signal had three columns where only one was chosen to create a vector in MATLAB but we used 300 values, because there were many data and the Arduino could be saturated. Later, a graphical interface was created with a MATLAB guide, if you press a pushbutton, you can see the respective pathologie.


Graphical interface in MATLAB


 2.2) To send each vector´s value was necessary to normalize it calculating maximums and minimums, transcribing the data in numbers between zero and one. Then each number of the vector was multiplied by 255 because it is the equivalent value to an output of 8 bits in the Arduino board ,to eliminate the decimals we made the conversion of the value to "uint8”.

Code to normalize the vector and show the signal in the graphical interface.




2.3)  To make the serial communication between MATLAB and Arduino we had to download the support Package  Manager for Arduino. Into MATLAB code is made the activation and recognition of the port where the Arduino is connected with the command a=arduino(‘serial port’) indicating the serial port where the data is sent to the Arduino and it was saved in any variable.

2.4)  When you want to send each data of the vector is not possible to load it directly in the Arduino´s port, we have to decompose the number that is in uint8 (type o data) to bits. Them we send each bit to an individual digital  pin in the Arduino. To send the vector and make the conversion to each bit we created a for cycle that starts from the first position ,with increment one up to 700 because is the total size of the vector. the following code expain this step:


Code to transcrib from Uint8 to bits

Using the command bitget (out230 (i), 8:-1:1) The conversion of all the vector´s  values  to bits is made separately saving in the variable bit, then the bits are separated with the command  a0=bit(end) Where you take the least significant bit and save it in the variable a0 and so on with the other bits subtracting units (end-1) to go through the number positions and go saving until completing the 8 bits.

Done this, the command writeDigitalpin( a, ‘D2’,a0) is used to send the data values   Indicating: a The port where the Arduino is connected, D2 The pin where the bit will be sent and finally the a0 (variable) Where you save the bit .


NOTCH FILTER




For the design of the Notch filter, we used the following equation:



the fc is 60 Hz and a capacitor ‘s value is 100nf , with these values we replaced in the equation looking for  R’s value. In this case the resistor’s value is 26.5kΩ taking a commercial 27 kΩ resistor for the circuit.



NON INVERTING SUMMING AMPLIFIER

To contaminate  pathologie's signals we developed a summing circuit from a lf353 amplifier used in not inverting configuration as shown in the following diagram:




RESULT

The pathologie signals created in MATLAB were shown in the osciloscope .

generating the patholgies 


Amplitude/ fercuency changing

in the fisrt part of the video, you can see the maximum amplitude of the signal, but when we increment the slider, the amplitude will decrease like in the final part of the video.


The EKG simulator signal is connected to the not inverting summing amplifier with noise (from signal generator) to prove the fuctioning of the Notch filter.

Simulator signal with noise vs outfilter signal

As you can see in the video, the signal blue is the contaminated with noise and the yellow signal is the output of the Notch filter.


GLOSSARY


  •  breadboard: protoboard 
  • mesh: malla
  • wire: cable
  • welding: soldadura
  • uint8: variables in MATLAB of data type (class) uint8 are stored as 1-byte (8-bit) unsigned integers.


No hay comentarios:

Publicar un comentario