Project #29 - DFRobot - SHT40 - Mk08
https://www.donluc.com/?p=3893
https://youtu.be/aYV72wplgOw
#DonLucElectronics #DonLuc #DFRobot #SHT40 #FireBeetle2ESP32E #ESP32 #IoT #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
Fermion: SHT40 Temperature And Humidity Sensor
The SHT4X is the 4th generation digital temperature and humidity sensor from Sensirion. In line with Sensirion’s industry-proven humidity and temperature sensors, the SHT40 offers consistent high accuracy within measuring range. The SHT40 sensor covers a humidity measurement range of 0 to 100%RH and a temperature detection range of -40°C to 125°C. The internal variable power heater enables the device to work properly under extreme operating conditions like condensing environment.
The board supply voltage of 3.3V to 5V and an current consumption below 0.15mA in low power mode make the SHT40 perfectly suitable for mobile or wireless battery-driven applications. It is suitable for urban environment monitoring, intelligent buildings, industrial automation, smart home and other Internet of Things applications.
DL2403Mk04
1 x DFRobot FireBeetle 2 ESP32-E
1 x Fermion: SHT40 Temperature & Humidity Sensor
1 x 1 x Lithium Ion Battery - 1000mAh
1 x Rocker Switch - SPST
1 x Resistor 10K Ohm
1 x USB 3.1 Cable A to C
DFRobot FireBeetle 2 ESP32-E
LED - 2
RSW - 17
SDA - 21
SCL - 22
VIN - +3.3V
GND - GND
DL2403Mk04p.ino
/****** Don Luc Electronics © ******
Software Version Information
Project #29 - DFRobot - SHT40 - Mk08
29-08
DL2403Mk04p.ino
DL2403Mk04
1 x DFRobot FireBeetle 2 ESP32-E
1 x Fermion: SHT40 Temperature & Humidity Sensor
1 x 1 x Lithium Ion Battery - 1000mAh
1 x Rocker Switch - SPST
1 x Resistor 10K Ohm
1 x USB 3.1 Cable A to C
*/
// Include the Library Code
// Bluetooth LE keyboard
#include <BleKeyboard.h>
// Fermion: SHT40 Temperature & Humidity Sensor
#include "Adafruit_SHT4x.h"
// Bluetooth LE Keyboard
BleKeyboard bleKeyboard;
String sKeyboard = "";
// Send Size
byte sendSize = 0;
// Fermion: SHT40 Temperature & Humidity Sensor
Adafruit_SHT4x sht4 = Adafruit_SHT4x();
// Temperature
float T;
// Humidity
float H;
// The number of the Rocker Switch pin
int iSwitch = 17;
// Variable for reading the button status
int SwitchState = 0;
// Define LED
int iLED = 2;
// Software Version Information
String sver = "29-08";
void loop() {
// Fermion: SHT40 Temperature & Humidity Sensor
isSHT40();
// Read the state of the Switch value:
SwitchState = digitalRead(iSwitch);
// Check if the button is pressed. If it is, the SwitchState is HIGH:
if (SwitchState == HIGH) {
// Bluetooth LE Keyboard
isBluetooth();
}
// Delay 1 Second
delay(1000);
}
getBleKeyboard.ino
// Ble Keyboard
// Bluetooth
// isBluetooth
void isBluetooth() {
// ESP32 BLE Keyboard
if(bleKeyboard.isConnected()) {
// Send Size Length
sendSize = sKeyboard.length();
// Send Size, charAt
for(byte i = 0; i < sendSize+1; i++){
// Write
bleKeyboard.write(sKeyboard.charAt(i));
delay(50);
}
bleKeyboard.write(KEY_RETURN);
}
}
getSHT40.ino
// Fermion: SHT40 Temperature & Humidity Sensor
// SHT40 Temperature & Humidity
void isSHT40(){
// Fermion: SHT40 Temperature & Humidity Sensor
// Sensors Event
sensors_event_t humidity, temp;
// Populate temp and humidity objects
sht4.getEvent(&humidity, &temp);
// Temperature
T = temp.temperature;
// Humidity
H = humidity.relative_humidity;
// DFR|Version|Temperature|Humidity|*
sKeyboard = "DFR|" + sver + "|" + String(T) + "C|" + String(H) + "% rH|*";
}
setup.ino
// Setup
void setup()
{
// Give display time to power on
delay(100);
// Bluetooth LE keyboard
bleKeyboard.begin();
// Give display time to power on
delay(100);
// Fermion: SHT40 Temperature & Humidity Sensor
sht4.begin();
// You can have 3 different precisions, higher precision takes longer
sht4.setPrecision(SHT4X_HIGH_PRECISION);
// You can have 6 different heater settings
sht4.setHeater(SHT4X_NO_HEATER);
// Give display time to power on
delay(100);
// Initialize the Switch pin as an input
pinMode(iSwitch, INPUT);
// Initialize digital pin iLED as an output
pinMode(iLED, OUTPUT);
// Outputting high, the LED turns on
digitalWrite(iLED, HIGH);
// Delay 5 Second
delay( 5000 );
}
People can contact us: http://www.donluc.com/?page_id=1927
Teacher, Instructor, E-Mentor, R&D and Consulting
-Programming Language
-Microcontrollers (PIC, Arduino, Raspberry Pi, Arm, Silicon Labs, Espressif, Etc...)
-IoT
-Wireless (Radio Frequency, Bluetooth, WiFi, Etc...)
-Robotics
-Automation
-Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
-Unmanned Vehicles Terrestrial and Marine
-Machine Learning
-Artificial Intelligence (AI)
-RTOS
-Sensors, eHealth Sensors, Biosensor, and Biometric
-Research & Development (R & D)
-Consulting
-Etc...
Follow Us
Luc Paquin – Curriculum Vitae - 2024
Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
LinkedIn: https://www.linkedin.com/in/jlucpaquin/
Don Luc