ECG data acquisition with Analog device frontend and Redbear nano BLE
Dependencies: BLE_API mbed nRF51822
Fork of BLENano_SimpleControls by
Reference Design
2 channel EKG with Redbear BLE reference and Analog Device amplifier to generate RAW EKG data fed into Medtrics MaaS service . Medtrics API can consumer raw input with given parameters of ADC sample frequency and scaling factor
Specification
- Application Processor: nRF51822/BLE , Analog frontend: AD8232 /
- Input Analog Voltage = 3.3V
- 10 bit ADC input range = (0-1023) or scaling factor= 3.22mV/unit (this is ADC resolution)
- ADC sample frequency (BLE pull rate) = 250Hz (4ms per sample)
Reference IOS and Android app will be online soon!
Revision 4:b95d3432a495, committed 2017-01-07
- Comitter:
- pkweitai
- Date:
- Sat Jan 07 06:20:36 2017 +0000
- Parent:
- 3:f530ca03e014
- Commit message:
- medtricsIO ECG data collection via BLE Redbear reference design
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Jan 07 02:43:53 2016 +0000 +++ b/main.cpp Sat Jan 07 06:20:36 2017 +0000 @@ -29,16 +29,20 @@ #define TXRX_BUF_LEN 20 #define DIGITAL_OUT_PIN P0_9 //TXD -#define DIGITAL_IN_PIN P0_10 //CTS -#define PWM_PIN P0_11 //RXD +#define DIGITAL_IN_PIN10 P0_10 //CTS +#define DIGITAL_IN_PIN11 P0_11 //RXD + +//#define PWM_PIN P0_11 //RXD #define SERVO_PIN P0_8 //RTS #define ANALOG_IN_PIN P0_4 //P04 BLE ble; DigitalOut LED_SET(DIGITAL_OUT_PIN); -DigitalIn BUTTON(DIGITAL_IN_PIN); -PwmOut PWM(PWM_PIN); +DigitalIn P10(DIGITAL_IN_PIN10); +DigitalIn P11(DIGITAL_IN_PIN11); + +//PwmOut PWM(PWM_PIN); AnalogIn ANALOG(ANALOG_IN_PIN); Servo MYSERVO(SERVO_PIN); @@ -108,8 +112,8 @@ } else if(buf[0] == 0x02) { - float value = (float)buf[1]/255; - PWM = value; + //float value = (float)buf[1]/255; + //PWM = value; } else if(buf[0] == 0x03) { @@ -118,8 +122,8 @@ else if(buf[0] == 0x04) { analog_enabled = 0; - PWM = 0; - MYSERVO.write(0); + //PWM = 0; + //MYSERVO.write(0); LED_SET = 0; old_state = 0; } @@ -148,7 +152,12 @@ void m_status_check_handle(void) { uint8_t buf[3]; - if (analog_enabled) // if analog reading enabled + //if (analog_enabled) // if analog reading enabled + if ( 1 && ((P10 ==1) || (P11==1))) + { + //idle + } + else { // Read and send out float s = ANALOG; @@ -160,11 +169,11 @@ } // If digital in changes, report the state - if (BUTTON != old_state) - { - old_state = BUTTON; + //if (BUTTON != old_state) + // { + // old_state = BUTTON; - if (BUTTON == 1) + if (P10 == 1) { buf[0] = (0x0A); buf[1] = (0x01); @@ -178,14 +187,14 @@ buf[2] = (0x00); ble.updateCharacteristicValue(rxCharacteristic.getValueAttribute().getHandle(), buf, 3); } - } + //} } int main(void) { Ticker ticker; - ticker.attach_us(m_status_check_handle, 200000); + ticker.attach_us(m_status_check_handle, 4000); ble.init(); ble.onDisconnection(disconnectionCallback);