Project #29 - DFRobot - SHTC3 - Mk30
https://www.donluc.com/?p=4139
#DonLucElectronics #DonLuc #DFRobot #ASM #SHTC3 #FireBeetle2ESP32C6 #Display #EEPROM #ESP32 #IoT #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
Fermion: SHTC3 Temperature and Humidity Sensor
The SHTC3 digital humidity sensor from Sensirion builds on the success of the proven SHTC1 sensor and offers consistent high accuracy within the measuring range. The sensor covers a humidity measurement range of 0 to 100% RH and a temperature detection range of -40 Celsius to 125 Celsius with a typical accuracy of ±2% RH and ±0.2 Celsius. The board supply voltage of 3.3 Volt to 5 Volt and a current consumption below 0.15mA in low power mode make the SHTC3 perfectly suitable for mobile or wireless battery-driven applications.
DL2409Mk06
1 x FireBeetle 2 ESP32-C6
1 x Fermion: SHTC3 Temperature & Humidity Sensor
1 x Fermion: 2.0" 320x240 IPS TFT LCD
1 x GDL Line 10 CM
1 x Gravity: Analog Soil Moisture Sensor
1 x 3 AAA Battery Holder with On/Off Switch and 2-Pin JST
3 x AAA Battery
1 x SparkFun Solderable Breadboard - Large
1 x USB 3.1 Cable A to C
FireBeetle 2 ESP32-C6
SCL - 20
SDA - 19
ASM - A1
LED - 15
DC - D2
CS - D6
RST - D3
VIN - +3.3V
GND - GND
DL2409Mk06p
DL2409Mk06p.ino
/****** Don Luc Electronics © ******
Software Version Information
Project #29 - DFRobot - SHTC3 - Mk30
29-30
DL2409Mk06p.ino
DL2409Mk06
1 x FireBeetle 2 ESP32-C6
1 x Fermion: SHTC3 Temperature & Humidity Sensor
1 x Fermion: 2.0" 320x240 IPS TFT LCD
1 x GDL Line 10 CM
1 x Gravity: Analog Soil Moisture Sensor
1 x 3 AAA Battery Holder with On/Off Switch and 2-Pin JST
3 x AAA Battery
1 x SparkFun Solderable Breadboard - Large
1 x USB 3.1 Cable A to C
*/
// Include the Library Code
// EEPROM Library to Read and Write EEPROM
// with Unique ID for Unit
#include "EEPROM.h"
// Arduino
#include <Arduino.h>
// Wire
#include <Wire.h>
// DFRobot Display GDL API
#include <DFRobot_GDL.h>
// Fermion: SHTC3 Temperature & Humidity Sensor
#include"DFRobot_SHTC3.h"
// Fermion: SHTC3 Temperature & Humidity Sensor
DFRobot_SHTC3 SHTC3;
uint32_t id = 0;
float temperature;
float humidity;
// Defined ESP32
#define TFT_DC D2
#define TFT_CS D6
#define TFT_RST D3
/*dc=*/ /*cs=*/ /*rst=*/
// DFRobot Display 240x320
DFRobot_ST7789_240x320_HW_SPI screen(TFT_DC, TFT_CS, TFT_RST);
// Gravity: Analog Soil Moisture Sensor
int iSoilMoisture = A1;
int iSoilMoistureVal = 0;
int zz = 0;
// Change Your Threshold Here
int Threshold = 300;
String SM = "";
// LED Green
int iLEDGreen = 15;
// EEPROM Unique ID Information
#define EEPROM_SIZE 64
String uid = "";
// Software Version Information
String sver = "29-30";
void loop() {
// SHTC3 Temperature and Humidity Sensor
isSHTC3();
// Gravity: Analog Soil Moisture Sensor
isSoilMoisture();
// DFRobot Display 240x320 - ASM - Temperature and Humidity
isDisplayTH();
// Delay 5 Second
delay( 5000 );
}
getDisplay.ino
// DFRobot Display 240x320
// DFRobot Display 240x320 - UID
void isDisplayUID() {
// DFRobot Display 240x320
// Text Display
// Text Wrap
screen.setTextWrap(false);
// Rotation
screen.setRotation(3);
// Fill Screen => black
screen.fillScreen(0x0000);
// Text Color => white
screen.setTextColor(0xffff);
// Font => Free Mono 9pt
screen.setFont(&FreeMono9pt7b);
// TextSize => 1.5
screen.setTextSize(1.5);
// DFRobot Display
screen.setCursor(0, 30);
screen.println("DFRobot Display");
// Don Luc Electronics
screen.setCursor(0, 60);
screen.println("Don Luc Electronics");
// Version
screen.setCursor(0, 90);
screen.println("Version");
screen.setCursor(0, 120);
screen.println( sver );
// EEPROM
screen.setCursor(0, 150);
screen.println("EEPROM");
screen.setCursor(0, 180);
screen.println( uid );
}
// DFRobot Display 240x320 - ASM - Temperature and Humidity
void isDisplayTH() {
// DFRobot Display 240x320
// Text Display
// Text Wrap
screen.setTextWrap(false);
// Rotation
screen.setRotation(3);
// Fill Screen => black
screen.fillScreen(0x0000);
// Text Color => white
screen.setTextColor(0xffff);
// Font => Free Mono 9pt
screen.setFont(&FreeMono9pt7b);
// TextSize => 1.5
screen.setTextSize(1.5);
// Soil Moisture Sensor
screen.setCursor(0, 30);
screen.println("Soil Moisture Sensor");
// Gravity: Analog Soil Moisture Sensor
screen.setCursor(0, 60);
screen.println( "ASM: " );
screen.setCursor(60, 60);
screen.println( iSoilMoistureVal );
screen.setCursor(0, 90);
screen.println( SM );
// SHTC3 Temperature
screen.setCursor(0, 120);
screen.println( "Tem: " );
screen.setCursor(60, 120);
screen.println( temperature );
screen.setCursor(120, 120);
screen.println( "C" );
// SHTC3 Humidity
screen.setCursor(0, 150);
screen.println( "Hum: " );
screen.setCursor(60, 150);
screen.println( humidity );
screen.setCursor(120, 150);
screen.println( "%RH" );
}
getEEPROM.ino
// EEPROM
// isUID EEPROM Unique ID
void isUID() {
// Is Unit ID
uid = "";
for (int x = 0; x < 7; x++)
{
uid = uid + char(EEPROM.read(x));
}
}
getSHTC3.ino
// SHTC3 Temperature and Humidity Sensor
// SHTC3
void isSHTC3(){
// SHTC3 Temperature and Humidity Sensor
/**
* Mode For configuring sensor working mode
* SHTC3:
PRECISION_HIGH_CLKSTRETCH_ON Clock Stretching Enabled
* PRECISION_HIGH_CLKSTRETCH_OFF Clock Stretching Disabled
* PRECISION_LOW_CLKSTRETCH_ON Clock Stretching Enabled & Low Power
* PRECISION_LOW_CLKSTRETCH_OFF Clock Stretching Disabled & Low Power
*/
temperature = SHTC3.getTemperature(PRECISION_HIGH_CLKSTRETCH_ON);
/**
* Mode For configuring sensor working mode
* SHTC3
* PRECISION_HIGH_CLKSTRETCH_ON Clock Stretching Enabled
* PRECISION_HIGH_CLKSTRETCH_OFF Clock Stretching Disabled
* PRECISION_LOW_CLKSTRETCH_ON Clock Stretching Enabled & Low Power
* PRECISION_LOW_CLKSTRETCH_OFF Clock Stretching Disabled & Low Power
*/
humidity = SHTC3.getHumidity(PRECISION_HIGH_CLKSTRETCH_OFF);
}
getSoilMoisture.ino
// Gravity: Analog Soil Moisture Sensor
// Soil Moisture
void isSoilMoisture(){
// Connect Soil Moisture Sensor to Analog 0
zz = analogRead( iSoilMoisture );
// iSoilMoistureVal => 0~900 Soil Moisture
iSoilMoistureVal = map( zz, 0, 4095, 0, 900);
// Threshold
if (iSoilMoistureVal > Threshold)
// 300~950 - Humid Soil
SM = "Humid Soil";
else {
// 0-300 Dry Soil
SM = "Dry Soil";
}
}
setup.ino
// Setup
void setup()
{
// Give display time to power on
delay(100);
// EEPROM Size
EEPROM.begin(EEPROM_SIZE);
// EEPROM Unique ID
isUID();
// Delay
delay( 100 );
// Wire
Wire.begin();
// Delay
delay( 100 );
// DFRobot Display 240x320
screen.begin();
// Delay
delay(100);
// Fermion: SHTC3 Temperature & Humidity Sensor
SHTC3.begin();
/*SHTC3 is set to sleep mode by default. Please wake it up before use.
Use SHTC3.sleep() to let SHTC3 enter sleep mode; SHTC3
stops working in sleep mode*/
SHTC3.wakeup();
// Delay
delay(100);
// Initialize the LED Green
pinMode(iLEDGreen, OUTPUT);
// iLEDGreen HIGH
digitalWrite(iLEDGreen, HIGH );
// DFRobot Display 240x320 - UID
// Don Luc Electronics
// Version
// EEPROM
isDisplayUID();
// Delay 5 Second
delay( 5000 );
}
People can contact us: http://www.donluc.com/?page_id=1927
Electronics, IoT, Teacher, Instructor, 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
https://www.donluc.com/luc/
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/
DFRobot Luc.Paquin: https://edu.dfrobot.com/dashboard/makelogs
Hackster.io: https://www.hackster.io/neosteam-labs
ELECROW: https://www.elecrow.com/share/sharepj/center/no/760816d385ebb1edc0732fd873bfbf13
TikTok: www.tiktok.com/@luc.paquin8
LinkedIn: https://www.linkedin.com/in/jlucpaquin/
Don Luc