Bluetooth did'nt connect with iOS - HM-10

Hello,

I want to use the YF-S201 (Hall efect http://www.hobbytronics.co.uk/yf-s201-water-flow-meter ) sensor, but it’s necessary to function to calibrate.

I can insert a code in the sketch and to use the Blynk?

Thank you

Igor

Yes I use this sensor in my Garden Watering system.

Check out my project here: Release Minor fixes and remove SimpleTimer · jaminNZx/Garduino-ESP-Blynk · GitHub

The code you need is here: https://github.com/jaminNZx/Garduino-ESP-Blynk/blob/v0.1.5/functions.h#L48

TL:DR

void setup(){
  // ... insert in to setup
  // FLOW METER
  pulseCount        = 0;
  flowRate          = 0.0;
  flowMilliLitres   = 0;
  totalMilliLitres  = 0;
  attachInterrupt(FLOW_SENSOR, pulseCounter, FALLING);
  // start the timer 
  timer.setInterval(1000, flowSensor);
  // ...
}


/**************************************************************
                     Flow Sensor
 **************************************************************/
/*
   pulseCounter() -
      - attached to an interrupt counting the pulses from the sensor then used to calculate the rate
*/
void pulseCounter() {
  pulseCount++;
}
/*
   flowSensor() -
      - uses interrupt on the sensor pin
      - calculates the flowRate in mL/s then converts to L/s
      - update Blynk virtual pins with the data
      - calculate and compile the water cost based on the price set in settings and usage
      - calculate and compile the monthly water cost and usage
*/
void flowSensor() {
  detachInterrupt(FLOW_SENSOR);
  flowRate = pulseCount / FLOW_CALIBRATION;
  pulseCount = 0;
  attachInterrupt(FLOW_SENSOR, pulseCounter, FALLING);
  //calc totals
  flowMilliLitres = (flowRate / 60) * 1000;
  totalMilliLitres += flowMilliLitres;
  totalMilliLitres_month += flowMilliLitres;
  Blynk.virtualWrite(vPIN_WATER_TOTAL, (float)totalMilliLitres / 1000);
  Blynk.virtualWrite(vPIN_WATER_FLOW,  String((float)flowMilliLitres, 0));
  Blynk.virtualWrite(vPIN_WATER_TOTAL_MONTH, (float)totalMilliLitres_month / 1000);
  waterCost = waterCost + ( ( ( (float)flowMilliLitres / 1000 ) * WATER_PRICE ) / 100);
  Blynk.virtualWrite(vPIN_WATER_COST, String(waterCost, 6));
  waterCost_month = waterCost_month + ( ( ( (float)flowMilliLitres / 1000 ) * WATER_PRICE ) / 100);
  Blynk.virtualWrite(vPIN_WATER_COST_MONTH, String(waterCost_month, 6));
}

Yes Blynk can do almost anything. I have the same meter and it’s fine with Blynk. Use it without Blynk first, learn to Blynk and then incorporate the sensor into your Blynk project.

1 Like

Hello,

Thank you very much! I gonne read your topic later.

Can I connect bluetooth HM-10 to iOS? I tried this connection before and failed.

Tks!

Igor

Yes, it should work

Eugene,

I think Blynk App doesn’t work with iPhone bluetooth 4.0 (MH-10). With LightBlue App, iPhone connected successfully.

I tryed to connect with Motorola Moto G2 and dind’t work too, but with LightBlue App, Motorola Moto G2 also worked.

I have tried to format my notebook and it didn’t solve my problem anyway.

Thank you

Igor

I have just successfully tested BLE connection using Arduino Uno and HM-10 module with latest iOS Blynk app.
Please check your setup. Refer to this post: A classic one : Arduino + Iphone + nrf8001 - #24 by Eugene

1 Like

A post was split to a new topic: Arduino Nano using HM-10