Post a new topicPost a reply Page 1 of 1   [ 4 posts ]
Author Message
 Post subject: My BLE device isn't turning off
PostPosted: Thu Oct 19, 2017 4:50 am 

Joined: Mon Jul 24, 2017 8:47 am
Posts: 7
Hello, I need your help that to reset or turn glucose BLE Pro sensor off.
sensor has communicated to my smartphone and disconnected 28 hours before.
but it has on and blinking blue indicator since that.
I tried to press the button for a few seconds, but the situation remained the same.

How to reset or turn device off?


Top
 Profile  
 
 Post subject: Re: My BLE device isn't turning off
PostPosted: Thu Oct 19, 2017 6:32 am 

Joined: Mon Sep 28, 2009 11:06 am
Posts: 10492
Hello jini7927,

We think you're referring to the sensor Blood Pressure BLE Sensor PRO
https://www.cooking-hacks.com/blood-pressure-ble-sensor-mysignals-ehealth-medical/
because the glucose sensor has no blue light.

It is a very strange behavior that we have never observed, all our sensors are tested here, can you send a video showing this behavior?

It is important to clarify that the button is capacitive and it is necessary to touch it with the naked finger, without any gloves.

Regards


Top
 Profile  
 
 Post subject: Re: My BLE device isn't turning off
PostPosted: Thu Oct 19, 2017 8:13 am 

Joined: Mon Jul 24, 2017 8:47 am
Posts: 7
Oh, I'm sorry for I referred to a different sensor for previous article.
That's right, it was "Blood pressure" BLE sensor PRO. XD

Umm.. I recoded a video but nothing except just blinked blue indicator sustainedly.
and I touched(pushed) a button briefly(during a few seconds) with my naked finger already.

I'll send a recorded video if you want, but I think that there is nothing I can do about this problem until discharging a sensor.
Please tell me that how to turn sensor off or reset it.

Regards


Top
 Profile  
 
 Post subject: Re: My BLE device isn't turning off
PostPosted: Fri Oct 20, 2017 6:18 am 

Joined: Mon Sep 28, 2009 11:06 am
Posts: 10492
Hello jini7927,

the blinking blue light in the sensor means that is not connected via BLE with MySignals. We have checked that the sensor in this state (blinking light - not connected) always turns off automatically at passed 3 minutes.

Anyway, there is a way to turn off the sensor by sending a command through MySignals once the connection is made

Code:
MySignals_BLE.attributeWrite(MySignals_BLE.connection_handle.connection_handle,  18, "i");


For example you can use the basic code to take a measure that includes this line at the end:

Code:
/*

    Copyright (C) 2017 Libelium Comunicaciones Distribuidas S.L.
   http://www.libelium.com

    By using it you accept the MySignals Terms and Conditions.
    You can find them at: http://libelium.com/legal

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

    Version:           2.0
    Design:            David Gascon
    Implementation:    Luis Martin / Victor Boria
*/

#include <Adafruit_GFX_AS.h>
#include <Adafruit_ILI9341_AS.h>
#include <MySignals.h>
#include <MySignals_BLE.h>


// Write here the MAC address of BLE device to find
char MAC_BP[14] = "A4D57812A409";


uint8_t available_bp = 0;
uint8_t connected_bp = 0;
uint8_t connection_handle_bp = 0;

#define BP_HANDLE 18

char buffer_tft[30];

Adafruit_ILI9341_AS tft = Adafruit_ILI9341_AS(TFT_CS, TFT_DC);

//!Struct to store data of the glucometer.
struct bloodPressureBLEDataVector
{
  uint16_t systolic;
  uint16_t diastolic;
  uint16_t pulse;
};

//!Vector to store the glucometer measures and dates.
bloodPressureBLEDataVector bloodPressureBLEData;

void setup()
{

  MySignals.begin();

  tft.init();
  tft.setRotation(2);
  tft.fillScreen(ILI9341_BLACK);
  tft.setTextColor(ILI9341_WHITE, ILI9341_BLACK);

  //TFT message: Welcome to MySignals
  strcpy_P((char*)buffer_tft, (char*)pgm_read_word(&(table_MISC[0])));
  tft.drawString(buffer_tft, 0, 0, 2);

  Serial.begin(115200);

  MySignals.initSensorUART();
  MySignals.enableSensorUART(BLE);

  //Enable BLE module power -> bit6: 1
  bitSet(MySignals.expanderState, EXP_BLE_POWER);
  MySignals.expanderWrite(MySignals.expanderState);

  //Enable BLE UART flow control -> bit5: 0
  bitClear(MySignals.expanderState, EXP_BLE_FLOW_CONTROL);
  MySignals.expanderWrite(MySignals.expanderState);


  //Disable BLE module power -> bit6: 0
  bitClear(MySignals.expanderState, EXP_BLE_POWER);
  MySignals.expanderWrite(MySignals.expanderState);

  delay(500);

  //Enable BLE module power -> bit6: 1
  bitSet(MySignals.expanderState, EXP_BLE_POWER);
  MySignals.expanderWrite(MySignals.expanderState);
  delay(1000);
 
  MySignals_BLE.initialize_BLE_values();



  if (MySignals_BLE.initModule() == 1)
  {

    if (MySignals_BLE.sayHello() == 1)
    {
      //TFT message: "BLE init ok";
      strcpy_P((char*)buffer_tft, (char*)pgm_read_word(&(table_MISC[1])));
      tft.drawString(buffer_tft, 0, 15, 2);
    }
    else
    {
      //TFT message:"BLE init fail"
      strcpy_P((char*)buffer_tft, (char*)pgm_read_word(&(table_MISC[2])));
      tft.drawString(buffer_tft, 0, 15, 2);


      while (1)
      {
      };
    }
  }
  else
  {
    //TFT message: "BLE init fail"
    strcpy_P((char*)buffer_tft, (char*)pgm_read_word(&(table_MISC[2])));
    tft.drawString(buffer_tft, 0, 15, 2);

    while (1)
    {
    };
  }


}

void loop()
{
  available_bp = MySignals_BLE.scanDevice(MAC_BP, 1000, TX_POWER_MAX);

  tft.drawString("BP available:", 0, 30, 2);
  tft.drawNumber(available_bp, 110, 30, 2);



  if (available_bp == 1)
  {

    if (MySignals_BLE.connectDirect(MAC_BP) == 1)
    {
      tft.drawString("Connected    ", 0, 45, 2);
      connected_bp = 1;
      delay(8000);
      //To subscribe the BP measure write an ASCII letter "e"
      if (MySignals_BLE.attributeWrite(MySignals_BLE.connection_handle,  BP_HANDLE, "e", 1) == 0)
      {

        tft.drawString("Subscribed", 0, 60, 2);
       
        unsigned long previous = millis();
        do
        {

          if (MySignals_BLE.waitEvent(1000) == BLE_EVENT_ATTCLIENT_ATTRIBUTE_VALUE)
          {
            //Search letter "g" in ASCII
            if (MySignals_BLE.event[9] == 0x67)
            {

              if (MySignals_BLE.event[10] == 0x2f)
              {
                //Ojo esto esta mal en la guia de comandos

                //Primero da la alta -> sistolica
                uint8_t sh = MySignals_BLE.event[11] - 48;
                uint8_t sm = MySignals_BLE.event[12] - 48;
                uint8_t sl = MySignals_BLE.event[13] - 48;
                bloodPressureBLEData.systolic = (sh * 100) + (sm * 10) + sl;

                //Primero da la baja -> diastolica
                uint8_t dh = MySignals_BLE.event[15] - 48;
                uint8_t dm = MySignals_BLE.event[16] - 48;
                uint8_t dl = MySignals_BLE.event[17] - 48;
                bloodPressureBLEData.diastolic = (dh * 100) + (dm * 10) + dl;

                uint8_t ph = MySignals_BLE.event[19] - 48;
                uint8_t pm = MySignals_BLE.event[20] - 48;
                uint8_t pl = MySignals_BLE.event[21] - 48;
                bloodPressureBLEData.pulse = (ph * 100) + (pm * 10) + pl;


                sprintf(buffer_tft, "S:%d D:%d P:%d      ", bloodPressureBLEData.systolic, bloodPressureBLEData.diastolic, bloodPressureBLEData.pulse);
                tft.drawString(buffer_tft, 0, 75, 2);

                connected_bp = 0;

              }
            }
          }
        }
        while ((connected_bp == 1) && ((millis() - previous) < 40000));


        MySignals_BLE.attributeWrite(MySignals_BLE.connection_handle,  BP_HANDLE, "i" , 1);
        delay(100);


        MySignals_BLE.disconnect(MySignals_BLE.connection_handle);

        connected_bp = 0;

      }
      else
      {
        tft.drawString("Error subscribing", 0, 60, 2);
      }

    }
    else
    {
      connected_bp = 0;
      tft.drawString("Not Connected", 0, 45, 2);
    }
  }
  else if (available_bp == 0)
  {
    //Do nothing
  }
  else
  {
    MySignals_BLE.hardwareReset();
    MySignals_BLE.initialize_BLE_values();
    delay(100);
   
  }
  delay(1000);
}



Regards


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 1   [ 4 posts ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Libelium theme based on 610nm Style by Daniel St. Jules of http://www.gamexe.net


© Libelium Comunicaciones Distribuidas S.L. | Terms of use.