Logic Machine Forum
BLE - Sensirion SHT31 Smart Gadget - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Gateway (https://forum.logicmachine.net/forumdisplay.php?fid=10)
+--- Thread: BLE - Sensirion SHT31 Smart Gadget (/showthread.php?tid=2846)



BLE - Sensirion SHT31 Smart Gadget - Todayslife - 16.09.2020

Has anyone connected a "Sensirion SHT31 Smart Gadget" to a BLE-Interface on LM5?

(The "Sensirion SHT31 Smart Gadget" is featured with an humidity and temperature and also it has a BLE Interface)

https://developer.sensirion.com/platforms/sht31-smart-gadget-development-kit/

https://www.sensirion.com/fileadmin/user_upload/customers/sensirion/Dokumente/2_Humidity_Sensors/Sensirion_Humidity_Sensors_SHT3x_Smart-Gadget_User-Guide.pdf


RE: BLE - Sensirion SHT31 Smart Gadget - admin - 17.09.2020

Try this, no guarantee that this will work, change MAC to your device MAC. If connect fails try setting random to true.
Code:
require('ble')

mac = '01:02:03:04:05:06'
random = false

sock = ble.sock()
ble.settimeout(sock, 10)
res = ble.connect(sock, mac, random)

if res then
  humidity = ble.sockreadhnd(sock, 48)
  temperature = ble.sockreadhnd(sock, 53)

  loghex(humidity)
  loghex(temperature)
else
  log('ble connect failed')
end

Another option is to use ZigBee which will be ready for testing soon. There are temperature/humidity sensors (for example CCT593011_AS) which will work without any additional profiles/configuration.