'uSTM32'에 해당되는 글 5건

STM32duino를 이용한

심전도 표시장치

패드의 부착상태 때문에

움직이면 노이즈가 심하나

앉아 있는 상태에서 볼만하게 나옴

병원의 12 ECG는 아니고

AD8232를 이용한 2점 방식

 

외국자작 사이트

http://www.theorycircuit.com/heart-rate-monitor-ad8232-interface-arduino/

 

Heart Rate Monitor AD8232 Interface Arduino

Share on Tumblr   The AD8232 from Analog Devices is a dedicated single lead heart rate monitor front end integrated circuit.  The AD8232 is an integrated signal conditioning block for ECG and other biopotential measurement applications. It is designed to e

www.theorycircuit.com

 

STM32를 이용한 ECG 장치

 

코드 : 아두이노 IDE에서 STM32선택하고 

// ==============================================================
// I2C : Copyright (C)2015 Rinky-Dink Electronics, Henning Karlsen.
// All right reserved web: http://www.RinkyDinkElectronics.com/
// for Arduino Lib and works on STM32 too
// To use the hardware I2C (TWI) interface of the Arduino you must connect
// --------------------------------------------------------------
// STM32 Display : SDA pin -> PB10, SCL pin -> PB11
// --------------------------------------------------------------
// The internal pull-up resistors will be activated when using the
// hardware I2C interfaces.
// --------------------------------------------------------------
#include <OLED_I2C.h>
extern uint8_t SmallFont[];
OLED  myOLED(PB10, PB11, 8);	// OLED  myOLED(SDA, SCL, 8);
const int analogInputPin = PA0;
// --------------------------------------------------------------
double perspective = 100.0f;
long stime;
int x = 0, y = 0;
int lastx = 0, lasty = 0;
int LastTime = 0, ThisTime = 0;
bool BPMTiming = false;
bool BeatComplete = false;
int adcValue = 0, adcValueF = 0, BPM = 0;
#define UpperThreshold 560
#define LowerThreshold 530
// --------------------------------------------------------------
void setup() 
{
  myOLED.begin();
  myOLED.setFont(SmallFont);
  myOLED.clrScr();
  stime = micros();
  pinMode(PC14, INPUT); // Setup for leads off detection LO +
  pinMode(PC15, INPUT); // Setup for leads off detection LO -
  pinMode(analogInputPin, INPUT_ANALOG);
  Serial.begin(115200);
}
// --------------------------------------------------------------
void loop() 
{
  if (x > 127) 
  {		// OLED pixel : 128x64
    myOLED.clrScr();
    x = 0;
    lastx = x;
  }
  ThisTime = millis();
  if ((digitalRead(PC14) == 1) || (digitalRead(PC15) == 1)) {
    Serial.println('!');
  }
  else 
  {
    // send the value of analog input 0:
    adcValue = analogRead(analogInputPin) / 4; // STM32=12bits
    Serial.println(adcValue);
    detectBPM();
    displayBPM();
    delay(1);
  }
  stime = micros();
}
// --------------------------------------------------------------
void detectBPM() 
{
  // calc bpm
  if (adcValue > UpperThreshold) {
    if (BeatComplete) 
    {
      BPM = ThisTime - LastTime;
      BPM = int(60 / (float(BPM) / 1000));
      BPMTiming = false;
      BeatComplete = false;
      //tone(8,1000,250);
    }
    if (BPMTiming == false) 
    {
      LastTime = millis();
      BPMTiming = true;
    }
  }
  if ((adcValue < LowerThreshold) & (BPMTiming))
    BeatComplete = true;
}
// --------------------------------------------------------------
void displayBPM() 
{     	// display bpm
  y = 60 - (adcValue / 16);		// OLED pixel : 128x64
  myOLED.drawLine(lastx, lasty, x, y);
  //myOLED.update();
  lasty = y;
  lastx = x;
  //myOLED.drawRect(0,50,128,16);
  if(BPM<180 && BPM>10)
  {
    myOLED.printNumI(BPM, 0, 0, 3); // x=0,y=0,limit 3 digits
    myOLED.print(" BPM", 24, 0);
  }
  myOLED.update();
  x++;
}
// ==============================================================

 

 

코드 올리기 참조

https://diyworld.tistory.com/59

 

STM32duino 만들기

STM32mini를 아두이노 개발환경에서 USB-TTL 변환기 또는 ST-LINK 없이 단지 USB 케이블만을 이용하여 스케치를 업로드 하는 방법 STM32 미니 ebay, amazon, aliexpress 에서 싸게 팔지만 국내에서도 2천원 정도..

diyworld.tistory.com

 

 

결선도

참고 : STM32 핀배열

 

블로그 이미지

DIYworld

,