This project demonstrates how to use the Omnimo nRF52840 Dev Board in conjunction with the TempHum 23 Click sensor (SHT4x) and the Android application Bluefruit LE Connect for monitoring temperature and humidity levels. Thanks to two accessible user buttons, users may switch between different measurement modes and display the current mode and environmental data via Bluetooth Low Energy (BLE).
The TempHum 23 Click is a mikroBUS-based click board that features the SHT4x sensor, known for its high accuracy over an extensive measurement range. By integrating this sensor with the Omnimo nRF52840 and leveraging BLE through the Bluefruit LE Connect app, we create a powerful IoT solution for environmental monitoring.
---
RequirementsHardware- Omnimo nRF52840: A development board equipped with BLE capabilities.
- TempHum 23 Click: A mikroBUS-compatible click board featuring the SHT45 sensor.
- Android device with the Bluefruit LE Connect app installed.
Python libraries:
adafruit_sht4x
: For interfacing with the SHT4x sensor.adafruit_ble
: For handling BLE communication.- Python libraries:
adafruit_sht4x
: For interfacing with the SHT4x sensor.adafruit_ble
: For handling BLE communication. - Bluefruit LE Connect app: Available for both Android and iOS devices, enabling wireless communication with BLE-enabled projects.
- Connect the TempHum 23 Click to the Omnimo nRF52840 using a mikroBUS connector.
- Install CircuitPython or MicroPython on your Omnimo nRF52840 if not already done.
- Install the necessary Python libraries (
adafruit_sht4x
,adafruit_ble
) onto your board. You can find installation instructions in their respective repositories.
- Copy the provided Python code snippet into a file named
code.py
. - Transfer this file to the root directory of your Omnimo nRF52840.
- Download and install the Bluefruit LE Connect app from Google Play Store or another trusted source.
- Open the app and scan for nearby BLE devices.
- Connect to your Omnimo nRF52840 once it appears in the list of available devices.
- Use Plot to Monitor the temperature and humidity values
- Press the button
BTN1
to cycle through various measurement modes supported by the SHT4x sensor. - Press the button
BTN2
to send the name of the current mode over BLE to the connected Android device. - Monitor the current mode (in addition to the temperature and humidity values) via the UART console feature within the Bluefruit LE Connect app.
Below is a breakdown of key sections within the provided code:
modes = [
adafruit_sht4x.Mode.NOHEAT_HIGHPRECISION,
adafruit_sht4x.Mode.NOHEAT_MEDPRECISION,
adafruit_sht4x.Mode.NOHEAT_LOWPRECISION,
adafruit_sht4x.Mode.HIGHHEAT_1S,
adafruit_sht4x.Mode.HIGHHEAT_100MS,
adafruit_sht4x.Mode.MEDHEAT_1S,
adafruit_sht4x.Mode.MEDHEAT_100MS,
adafruit_sht4x.Mode.LOWHEAT_1S,
adafruit_sht4x.Mode.LOWHEAT_100MS
]
- Defines all possible operating modes for the SHT4x sensor, allowing flexibility in power consumption vs precision trade-offs.
if not BTN1.value:
current_mode_index = (current_mode_index + 1) % len(modes)
sht.mode = modes[current_mode_index]
time.sleep(0.5)
- Detects when the mode-switch button is pressed, increments the current mode index, updates the sensor's mode accordingly, and applies a short debounce delay.
if not BTN2.value:
uart_server.write("{}\n".format(adafruit_sht4x.Mode.string[modes[current_mode_index]]))
time.sleep(0.5)
- When the display-mode button is pressed, sends the string representation of the current mode over BLE to the connected device, followed by a debounce delay.
temperature, relative_humidity = sht.measurements
uart_server.write("{},{}\n".format(temperature, relative_humidity))
- Measures the current temperature and humidity values, then transmits them as comma-separated values over BLE to the connected device.
This project highlights the capabilities of the Omnimo nRF52840 combined with the TempHum 23 Click sensor and Bluefruit LE Connect app for creating a robust IoT environmental monitoring solution. It showcases how easy it is to integrate advanced sensors with BLE technology to provide real-time data access remotely.
Feel free to customize and extend this project further based on your specific needs!
eAFAQ

Comments
Please log in or sign up to comment.