Close
0%
0%

Reading a bunch of BLE sensors with raspberryZero

Reading up to 9 XIaomi Mi Temperature and humidity sensors using nodeRed+Bash+gatttool

Public Chat
Similar projects worth following

I was looking for a cheap offtheself sensor (battery powered) to add them around my house and dump data into a database.

This things costs around 5€ in aliexpress, i cant wrap my head around how can they make them so cheap, the BLE chip alone in digikey costs 4€

https://es.aliexpress.com/item/1005001676531931.html

Or 10€ from the original store

https://buy.mi.com/es/item/3204600074

I guessed & decoded the BLE characteristic this Sensors use to transmit Temperature humidity and battery voltage.

Now im reading 9 of them at the same time with my raspiZero and visualice everything with nodered

  • 1 × raspberry Pi Zero
  • 9 × Xiaomi Mi Temperature & humidity

  • The coincells are dry.

    Javier02/10/2022 at 16:57 0 comments

    Apparently maintaining an onpen BLE conection uses a lot of precious miliamps.

    The modules ran out of battery after 1 month of constant streaming.
    Only one sensor is still working, they stopped broadcasting one by one in the spam of one week.


    I have in mind two solutions for this:
    1. Instead of a permanent BLE connection and constant streaming of data,
      the raspberry could each 2-5 minutes create a BLE conection and read the temp+humidity data once, then close the connection.
    2. Modify the firmware/use a modified version of the xiaomi sensors, so they include temperature and humidity data in their advertisment data.

    https://microchipdeveloper.com/wireless:ble-link-layer-packet-types

  • signed integer overflow :,(

    Javier01/26/2022 at 17:33 0 comments

    TODO: review and fix the javascript nodered node, it looks like we have a signed/unsigned problem.
    I only noticed because this days temperatures dropped below 0ºC

    parseInt()<----yes im talking to you  

    Edit: i found out javascript is expecting us to add the "-0001" character for negative hex values (instead of translating the int16_t 2's complement "ffff" so we need to parse it ourselves)
    https://stackoverflow.com/questions/13468474/javascript-convert-a-hex-signed-integer-to-a-javascript-value

    msg.temperatura = parseInt(msg.temperatura, 16);
    if ((msg.temperatura & 0x8000) > 0) {
       msg.temperatura = msg.temperatura - 0x10000;
    }
    msg.temperatura=msg.temperatura/100;

  • BLE conections didnt fail yet

    Javier01/18/2022 at 09:34 0 comments

    BLE conections are still working after 2 days

    Now i can start to see what a day temperature/humidity footprint looks like


    Its funny how it looks kind of like the charging and discharging of a battery

  • storing data in a database

    Javier01/17/2022 at 08:43 0 comments

    Managed to save received data to influxDB and display it with graphana.
    So far only two devices are connected, 12h working uninterrupted .TODO: update the uild steps with influxdb and grapana setups

  • Hello World x9 times

    Javier12/15/2021 at 23:09 0 comments

    I managed to maintain 9 simultaneous BLE conexions, enable the notifications for the specific characteristic im interested in.

    Receive all notifications and decode the bytes in the payload


    The gatttool doesnt allow me to connect a 10th BLE device, i feel the bluetooth chip really struggling when opening more than 5 BLE conections, this would not happen with a raspberryPi4 (different more powerfull wirelles chip) or a raspberryPi3 without active wifi conections

View all 5 project logs

  • 1
    Setting up the raspi

    First i flashed my Sandisk 16GB SD card with a Debian Desktopless image.

    I would only need Node-red and ssh to interface with the raspi anyway.

    After connecting the raspberryPi to my local wifi i started a putty ssh sesion:

    Updating the system and installing nodered

    sudo apt-get update
    sudo apt-get upgrade
    

    enabling the launch of nodered at startup with systemctl

    bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)
    
    sudo systemctl enable nodered.service 
    

    Now i need to install the Dashboard nodes im using to visualize the data (no grafana nor influxdb yet)

    cd ~/.node-red
    
    npn install node-red-dashboard

    Reboot to allow the changes to take place

    sudo reboot now

    After this we should be able to connect to nodered with any PC in the same local network
    Nodered's default port is :1880

    My raspi's ip is 192.168.0.178 so i its nodered service is reachable by my browser with:

    http://192.168.0.178:1880
  • 2
    Sniffing and decoding the BLE characteristics (of the XIAOMI MI sensors)

    My BLE swissknife debugger of choice is LightBlue, i had it installed on my phone a while back.

    Once there we Scan for our Sensor:

    We connect to our sensor and the app automatically discovers all the BLE characteristics& reads their descriptors for us:

    The interesting characteristic is the one with the descriptor "Temperature and Humidity"

    We hit subscribe which effectively does two things

    • The app sends the commad to the BLE sensor to enable its notifications for that characteristic.
    • The app remains connected and prints the received values as they come.

    Now the data just arrives without us having to read every time

    Now the fun part, guessing what 88 07 34 39 0B actually means.
    Using My Low level Infering powers i noticed:

    • ALL values are littleendianed
    • First two bytes 88 07 tell us the temperaturex100
      0x0788== 1928 ---> 19,28ºC
    • Third byte tell us the humidity %
      0x34== 52%
    • Fourth and fifth bytes tell us the Voltage level of the coin cell (this was a hard one to come up with)
      0x0B39== 2873mV
  • 3
    Trying out GATTTOOL

    Now that i know how to access and decode the data lets try the Raspi GATTTOOL default BLE handler:
    Native to Debian and a lso to a bunch of linux distros or so i've heard of .

    First i reset the bluetooth of the raspi, just in case:

    sudo service bluetooth restart
    

     This is how we scan for ble devices

    sudo hcitool lescan
    
    LE Scan ...
    33:26:36:CF:E7:FB (unknown)
    2D:CE:BB:73:00:AC (unknown)
    00:80:E1:26:C2:49 MyCST
    00:80:E1:26:C2:49 (unknown)
    18:C1:44:DF:5E:37 (unknown)
    44:49:9C:22:F8:F1 (unknown)
    78:A7:EB:13:64:09 (unknown)
    A4:C1:38:CB:65:E0 (unknown)
    4A:5F:3A:35:5F:D0 (unknown)
    4A:5F:3A:35:5F:D0 (unknown)
    13:D3:50:F5:38:95 (unknown)
    5E:BC:E1:D4:66:76 (unknown)
    A4:C1:38:57:E7:CA (unknown)
    A4:C1:38:57:E7:CA LYWSD03MMC
    A4:C1:38:6A:3B:0C (unknown)
    A4:C1:38:6A:3B:0C LYWSD03MMC
    78:A7:EB:13:64:09 Mi Air2
    A4:C1:38:28:CE:FF (unknown)
    A4:C1:38:28:CE:FF LYWSD03MMC
    A4:C1:38:99:73:93 (unknown)
    A4:C1:38:B0:60:59 (unknown)
    A4:C1:38:B0:60:59 LYWSD03MMC
    A4:C1:38:51:D1:B1 (unknown)

    Now we start an interactive session (we manually prompt the commands to the gatttool service)

    sudo gatttool -b A4:C1:38:57:E7:CA -I
    [A4:C1:38:57:E7:CA][LE]> connect
    Attempting to connect to A4:C1:38:57:E7:CA
    Connection successful

     We are connected to the BLE sensor!, lets discover its characteristics.

    [A4:C1:38:57:E7:CA][LE]> char-desc
    

     It has maaaany:

    handle: 0x0001, uuid: 00002800-0000-1000-8000-00805f9b34fb
    handle: 0x0002, uuid: 00002803-0000-1000-8000-00805f9b34fb
    handle: 0x0003, uuid: 00002a00-0000-1000-8000-00805f9b34fb
    handle: 0x0004, uuid: 00002803-0000-1000-8000-00805f9b34fb
    handle: 0x0005, uuid: 00002a01-0000-1000-8000-00805f9b34fb
    handle: 0x0006, uuid: 00002803-0000-1000-8000-00805f9b34fb
    handle: 0x0007, uuid: 00002a04-0000-1000-8000-00805f9b34fb
    handle: 0x0008, uuid: 00002800-0000-1000-8000-00805f9b34fb
    handle: 0x0009, uuid: 00002803-0000-1000-8000-00805f9b34fb
    handle: 0x000a, uuid: 00002a05-0000-1000-8000-00805f9b34fb
    handle: 0x000b, uuid: 00002902-0000-1000-8000-00805f9b34fb
    handle: 0x000c, uuid: 00002800-0000-1000-8000-00805f9b34fb
    handle: 0x000d, uuid: 00002803-0000-1000-8000-00805f9b34fb
    handle: 0x000e, uuid: 00002a24-0000-1000-8000-00805f9b34fb
    handle: 0x000f, uuid: 00002803-0000-1000-8000-00805f9b34fb
    handle: 0x0010, uuid: 00002a25-0000-1000-8000-00805f9b34fb
    handle: 0x0011, uuid: 00002803-0000-1000-8000-00805f9b34fb
    handle: 0x0012, uuid: 00002a26-0000-1000-8000-00805f9b34fb
    handle: 0x0013, uuid: 00002803-0000-1000-8000-00805f9b34fb
    handle: 0x0014, uuid: 00002a27-0000-1000-8000-00805f9b34fb
    handle: 0x0015, uuid: 00002803-0000-1000-8000-00805f9b34fb
    handle: 0x0016, uuid: 00002a28-0000-1000-8000-00805f9b34fb
    handle: 0x0017, uuid: 00002803-0000-1000-8000-00805f9b34fb
    handle: 0x0018, uuid: 00002a29-0000-1000-8000-00805f9b34fb
    handle: 0x0019, uuid: 00002800-0000-1000-8000-00805f9b34fb
    handle: 0x001a, uuid: 00002803-0000-1000-8000-00805f9b34fb
    handle: 0x001b, uuid: 00002a19-0000-1000-8000-00805f9b34fb
    handle: 0x001c, uuid: 00002902-0000-1000-8000-00805f9b34fb
    handle: 0x001d, uuid: 00002800-0000-1000-8000-00805f9b34fb
    handle: 0x001e, uuid: 00002803-0000-1000-8000-00805f9b34fb
    handle: 0x001f, uuid: 00010203-0405-0607-0809-0a0b0c0d2b12
    handle: 0x0020, uuid: 00002901-0000-1000-8000-00805f9b34fb
    handle: 0x0021, uuid: 00002800-0000-1000-8000-00805f9b34fb
    handle: 0x0022, uuid: 00002803-0000-1000-8000-00805f9b34fb
    handle: 0x0023, uuid: ebe0ccb7-7a0a-4b0c-8a1a-6ff2997da3a6
    handle: 0x0024, uuid: 00002901-0000-1000-8000-00805f9b34fb
    handle: 0x0025, uuid: 00002803-0000-1000-8000-00805f9b34fb
    handle: 0x0026, uuid: ebe0ccb9-7a0a-4b0c-8a1a-6ff2997da3a6
    handle: 0x0027, uuid: 00002901-0000-1000-8000-00805f9b34fb
    handle: 0x0028, uuid: 00002803-0000-1000-8000-00805f9b34fb
    handle: 0x0029, uuid: ebe0ccba-7a0a-4b0c-8a1a-6ff2997da3a6
    handle: 0x002a, uuid: 00002901-0000-1000-8000-00805f9b34fb
    handle: 0x002b, uuid: 00002803-0000-1000-8000-00805f9b34fb
    handle: 0x002c, uuid: ebe0ccbb-7a0a-4b0c-8a1a-6ff2997da3a6
    handle: 0x002d, uuid: 00002901-0000-1000-8000-00805f9b34fb
    handle: 0x002e, uuid: 00002803-0000-1000-8000-00805f9b34fb
    handle: 0x002f, uuid: ebe0ccbc-7a0a-4b0c-8a1a-6ff2997da3a6
    handle: 0x0030, uuid: 00002901-0000-1000-8000-00805f9b34fb
    handle: 0x0031, uuid: 00002902-0000-1000-8000-00805f9b34fb
    handle: 0x0032, uuid: 00002803-0000-1000-8000-00805f9b34fb
    handle: 0x0033, uuid: ebe0ccbe-7a0a-4b0c-8a1a-6ff2997da3a6
    handle: 0x0034, uuid: 00002901-0000-1000-8000-00805f9b34fb
    handle: 0x0035, uuid: 00002803-0000-1000-8000-00805f9b34fb
    handle: 0x0036, uuid: ebe0ccc1-7a0a-4b0c-8a1a-6ff2997da3a6 <---this one is "Temperature and Humidity"
    handle: 0x0037, uuid: 00002901-0000-1000-8000-00805f9b34fb
    handle: 0x0038, uuid: 00002902-0000-1000-8000-00805f9b34fb <--- this one is the characteristic configuration
    handle: 0x0039, uuid: 00002803-0000-1000-8000-00805f9b34fb
    handle: 0x003a, uuid: ebe0ccc4-7a0a-4b0c-8a1a-6ff2997da3a6
    handle: 0x003b, uuid: 00002901-0000-1000-8000-00805f9b34fb
    handle: 0x003c, uuid: 00002803-0000-1000-8000-00805f9b34fb
    handle: 0x003d, uuid: ebe0ccc8-7a0a-4b0c-8a1a-6ff2997da3a6
    handle: 0x003e, uuid: 00002901-0000-1000-8000-00805f9b34fb
    handle: 0x003f, uuid: 00002803-0000-1000-8000-00805f9b34fb
    handle: 0x0040, uuid: ebe0ccd1-7a0a-4b0c-8a1a-6ff2997da3a6
    handle: 0x0041, uuid: 00002901-0000-1000-8000-00805f9b34fb
    handle: 0x0042, uuid: 00002803-0000-1000-8000-00805f9b34fb
    handle: 0x0043, uuid: ebe0ccd7-7a0a-4b0c-8a1a-6ff2997da3a6
    handle: 0x0044, uuid: 00002901-0000-1000-8000-00805f9b34fb
    handle: 0x0045, uuid: 00002803-0000-1000-8000-00805f9b34fb
    handle: 0x0046, uuid: ebe0ccd8-7a0a-4b0c-8a1a-6ff2997da3a6
    handle: 0x0047, uuid: 00002901-0000-1000-8000-00805f9b34fb
    handle: 0x0048, uuid: 00002803-0000-1000-8000-00805f9b34fb
    handle: 0x0049, uuid: ebe0ccd9-7a0a-4b0c-8a1a-6ff2997da3a6
    handle: 0x004a, uuid: 00002901-0000-1000-8000-00805f9b34fb
    handle: 0x004b, uuid: 00002902-0000-1000-8000-00805f9b34fb
    handle: 0x004c, uuid: 00002803-0000-1000-8000-00805f9b34fb
    handle: 0x004d, uuid: ebe0cff1-7a0a-4b0c-8a1a-6ff2997da3a6
    handle: 0x004e, uuid: 00002901-0000-1000-8000-00805f9b34fb
    handle: 0x004f, uuid: 00002800-0000-1000-8000-00805f9b34fb
    handle: 0x0050, uuid: 00002803-0000-1000-8000-00805f9b34fb
    handle: 0x0051, uuid: 8edffff1-3d1b-9c37-4623-ad7265f14076
    handle: 0x0052, uuid: 00002901-0000-1000-8000-00805f9b34fb
    handle: 0x0053, uuid: 00002803-0000-1000-8000-00805f9b34fb
    handle: 0x0054, uuid: 8edffff3-3d1b-9c37-4623-ad7265f14076
    handle: 0x0055, uuid: 00002901-0000-1000-8000-00805f9b34fb
    handle: 0x0056, uuid: 00002902-0000-1000-8000-00805f9b34fb
    handle: 0x0057, uuid: 00002803-0000-1000-8000-00805f9b34fb
    handle: 0x0058, uuid: 8edffff4-3d1b-9c37-4623-ad7265f14076
    handle: 0x0059, uuid: 00002901-0000-1000-8000-00805f9b34fb
    handle: 0x005a, uuid: 00002803-0000-1000-8000-00805f9b34fb
    handle: 0x005b, uuid: 8edfffef-3d1b-9c37-4623-ad7265f14076
    handle: 0x005c, uuid: 00002901-0000-1000-8000-00805f9b34fb
    handle: 0x005d, uuid: 00002902-0000-1000-8000-00805f9b34fb
    handle: 0x005e, uuid: 00002800-0000-1000-8000-00805f9b34fb
    handle: 0x005f, uuid: 00002803-0000-1000-8000-00805f9b34fb
    handle: 0x0060, uuid: 00000004-0000-1000-8000-00805f9b34fb
    handle: 0x0061, uuid: 00002901-0000-1000-8000-00805f9b34fb
    handle: 0x0062, uuid: 00002803-0000-1000-8000-00805f9b34fb
    handle: 0x0063, uuid: 00000010-0000-1000-8000-00805f9b34fb
    handle: 0x0064, uuid: 00002901-0000-1000-8000-00805f9b34fb
    handle: 0x0065, uuid: 00002902-0000-1000-8000-00805f9b34fb
    handle: 0x0066, uuid: 00002803-0000-1000-8000-00805f9b34fb
    handle: 0x0067, uuid: 00000017-0000-1000-8000-00805f9b34fb
    handle: 0x0068, uuid: 00002901-0000-1000-8000-00805f9b34fb
    handle: 0x0069, uuid: 00002902-0000-1000-8000-00805f9b34fb
    handle: 0x006a, uuid: 00002803-0000-1000-8000-00805f9b34fb
    handle: 0x006b, uuid: 00000018-0000-1000-8000-00805f9b34fb
    handle: 0x006c, uuid: 00002901-0000-1000-8000-00805f9b34fb
    handle: 0x006d, uuid: 00002902-0000-1000-8000-00805f9b34fb
    handle: 0x006e, uuid: 00002803-0000-1000-8000-00805f9b34fb
    handle: 0x006f, uuid: 00000019-0000-1000-8000-00805f9b34fb
    handle: 0x0070, uuid: 00002901-0000-1000-8000-00805f9b34fb
    handle: 0x0071, uuid: 00002902-0000-1000-8000-00805f9b34fb
    handle: 0x0072, uuid: 00002800-0000-1000-8000-00805f9b34fb
    handle: 0x0073, uuid: 00002803-0000-1000-8000-00805f9b34fb
    handle: 0x0074, uuid: 00000101-0065-6c62-2e74-6f696d2e696d
    handle: 0x0075, uuid: 00002901-0000-1000-8000-00805f9b34fb
    handle: 0x0076, uuid: 00002902-0000-1000-8000-00805f9b34fb
    handle: 0x0077, uuid: 00002803-0000-1000-8000-00805f9b34fb
    handle: 0x0078, uuid: 00000102-0065-6c62-2e74-6f696d2e696d
    handle: 0x0079, uuid: 00002901-0000-1000-8000-00805f9b34fb
    handle: 0x007a, uuid: 00002902-0000-1000-8000-00805f9b34fb

    As seen in previous step i already knew which Characteristic UUID corresponds with "Temperature and Humidity"
    (uuid: ebe0ccc1-7a0a-4b0c-8a1a-6ff2997da3a6

    I also know that in order to Activate Notifications i need to write a 0100 in the Characteristic configuration/properties
    (uuid: 00002902-0000-1000-8000-00805f9b34fb)

    Why 0100? .... remember LittleEndianess

    https://dev.ti.com/tirex/content/simplelink_academy_cc2640r2sdk_2_40_03_00/modules/blestack/ble_01_basic/ble_01_basic.html#introduction
    .........

    its a bit confusing, some places call this characteristic value notify and others broadcast

    #define GATT_PROP_BCAST 0x01 //!< Permits broadcasts of the Characteristic Value

    ........

    Gatttool asigned the handle 0x0036 to "Temperature and Humidity"
    Gattol asigned the handle 0x0038 to "Temperature and Humidity"'s config

    I order to activate the notifications, we write the value 0100 into the config characteristic

    [A4:C1:38:57:E7:CA][LE]> char-write-req 0x0038 0100

     the sensor starts to notify periodically "Temperature and Humidity" 's value

    Notification handle = 0x0036 value: 78 07 32 0f 0b
    Notification handle = 0x0036 value: 79 07 32 0f 0b
    Notification handle = 0x0036 value: 7b 07 32 0f 0b
    Notification handle = 0x0036 value: 7a 07 32 0f 0b
    Notification handle = 0x0036 value: 7b 07 32 0f 0b
    Notification handle = 0x0036 value: 7c 07 32 0f 0b
    Notification handle = 0x0036 value: 78 07 32 0f 0b
    Notification handle = 0x0036 value: 7b 07 32 0f 0b
    Notification handle = 0x0036 value: 7b 07 32 0f 0b
    Notification handle = 0x0036 value: 7b 07 32 0f 0b

View all 6 instructions

Enjoy this project?

Share

Discussions

[deleted]

[this comment has been deleted]

Javier wrote 05/11/2022 at 07:26 point

Thanks ghost

  Are you sure? yes | no

Rod wrote 01/19/2022 at 17:24 point

Sorry about my ignorance, I wanted to do this before with other devices, but started seen a lot of issues with devices colliding. How doable is to have 100s of sensors like this?

  Are you sure? yes | no

Javier wrote 01/19/2022 at 17:44 point

Check out @Tom Nardi  comment.

He proposes to modify the firmware inside the Xiaomi sensors so they advertise temp and hummidity , no connection needed.

So far im guetting issues connecting more than 9 with a raspi zero. But 5 are enough for my House.

  Are you sure? yes | no

Rod wrote 01/19/2022 at 19:26 point

Yes, I did some experiments, seems that the Bluetooth bandwidth gets saturated when you start putting a lot of them, I did an experiment with more than 50, I think for that density, the best is to use WiFi. But maybe I did something wrong, maybe it is possible, that's why I'm asking.

  Are you sure? yes | no

alexwhittemore wrote 01/19/2022 at 21:04 point

@rod - I think that's actually the opposite of the case: WiFi is particularly bad for high density, and a single access point typically tops out around 50 devices, maybe up to 100 for a premium home device optimized for one base station. Commercial deployments use lots of scattered, lower-powered APs for exactly this reason.

50 Beats the typical BLE device connection limit of 5-10, but only by so much (I've never come across a device supporting more than I think 12 simultaneous connections, and IIRC that's the latest iPhone)

If you want high density to a single gateway device, the only real way to get there is advertising, and throttling down the advertising frequency to avoid band contention. 

  Are you sure? yes | no

Rod wrote 02/10/2022 at 16:25 point

@alexwhittemore advertising means not subscribing ?  do you have examples??  I'm really looking for a solution at this.

  Are you sure? yes | no

alexwhittemore wrote 02/10/2022 at 16:45 point

@rod It sounds pedantic, but BLE has some specific terminology to keep things straight: Advertising is a mechanism where one radio broadcasts a brief message, without necessarily expecting a reply. The message can be connectable, i.e. "hey I'm a device if you wanna connect" or not, and it can optionally have a payload, like temp and humidity. A connection is a negotiated communication scheme - a listener hears a connectable advertiser, initiates a connection, then they periodically send messages to each other on a schedule (typ. 25ms) to keep the connection alive from that point on. Subscribing is a further feature of connections where one device can ask for the other to send any state changes that happen, rather than having to poll for them regularly only to get the same old data back and waste air time.

The key point in this discussion is that advertisements are small, and arbitrarily infrequent. If you had a thousand devices in a room, you could "hear from" all of them without crowding the airspace by simply designing them to only advertise once every few seconds. The disadvantage is having to ensure a statistically acceptable likelihood that you will hear them, for a few different reasons.

Connections, on the other hand, have two disadvantages: 1) the connection interval, which sets a lower bar on how frequently devices MUST use the airtime, and 2) memory required to maintain a connection - you can only have a handful (5-10) at a time, simply because the real-time system operating the radio has limited resources in terms of memory to keep track of connections, and time slots to make sure it's maintaining the correct communications interval for each. 

WiFi has similar problems with respect to overcrowding airspace, and resources to maintain connections. For instance, most home routers simply don't support more than 30 or 50 wifi device connections. To achieve more connections than that, you kind of need multiple access points and lower TX powers so that all the devices are having shorter, quieter conversations and not shouting over each other.

  Are you sure? yes | no

alexwhittemore wrote 02/10/2022 at 16:46 point

@rod and as far as examples, can't beat Adafruit's circuitpython guides and code examples, for advertising, connections, etc. https://learn.adafruit.com/circuitpython-ble-advertising-beacons?view=all

  Are you sure? yes | no

Javier wrote 02/10/2022 at 17:11 point

Im talking without having a lot of experience with BLE mesh but:IF you dared to compile your own code for this chip.....

Datasheet for Telink TLSR8251 says:

1.2.7 BLE Mesh featuresTelink Proprietary BLE Mesh features include:

2) Supports switch control for over 200 nodes without delay;

3) Supports real time status update for over 200

you just need to spread them out i guess (or f*** up their antennas)

  Are you sure? yes | no

Rod wrote 02/11/2022 at 20:16 point

@alexwhittemore pedantic?? on the contrary!! teach me more!!   regarding "The disadvantage is having to ensure a statistically acceptable likelihood that you will hear them, for a few different reasons."  what are these reasons? what's your experience?

  Are you sure? yes | no

David Plass wrote 01/19/2022 at 16:57 point

Ha I stupidly built my own! https://hackaday.io/project/181885-thermometer-network

  Are you sure? yes | no

Javier wrote 01/19/2022 at 17:43 point

Looks very neat, which protocol are you using for the esp? 

I am using also Arduino-esp8266 with Mqtt reading DhT22 sensors.

I choose Xiaomi because they are cheaper and way more accurate un their readings than my esp8266, and they work with a coincell battery

  Are you sure? yes | no

Ivan Stepaniuk wrote 12/21/2021 at 13:35 point

I couldn't make these work with a raspi3 reliably. They would work for a few days and then inexplicably stopped responding until paired again. I used the mitemp_bt Home Assistant "platform" to read them, but the problem seems to be at the BT level. I ended up switching to their Zigbee equivalents without a display, and at 3 times the cost per sensor :( I

  Are you sure? yes | no

Javier wrote 12/21/2021 at 13:59 point

They worked non stop for me (1month) untill their battery ran out of juice. The point of using nodered for me is to reuse an already in place database logging MQTT messages. By using nodered i just have to place the new nodes. and voilá. If i were you id give a try to the custom FW <a data-mention-user-id="1022" href="/hacker/1022">@Tom Nardi </a>suggested. (connectionless characteristic broadcast)

  Are you sure? yes | no

Tom Nardi wrote 12/16/2021 at 00:35 point

Why not use Aaron Christophel's firmware for these thermometers? That way they can just broadcast out their data over BLE advertising packets and you don't have to individually connect to them.

I wrote a review of the firmware last year which includes a simple Python program that will let you capture the data from all the thermometers within range:

https://hackaday.com/2020/12/08/exploring-custom-firmware-on-xiaomi-thermometers/

  Are you sure? yes | no

Javier wrote 12/21/2021 at 13:59 point

Hi Tom , that looks like advanced wizardy worth exploring.

Connectionless BLE data reading looks like the easyest scalability fix to my 9 devices limit.But for now lets see if i can manage with the default factory FW.

  Are you sure? yes | no

morgan wrote 01/19/2022 at 18:24 point

It helps a lot. I've got about 12 of these throughout my house and have had success with that firmware and 3 ESP32s running ESPHome. A recent update to ESPHome has allowed 4-5 sensors per ESP32 without running out of memory.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates