You will also want to install CH34SER.EXE if you don't have it. It is part of the Freenove tutorial download. Once you open the file, click the CH343 folder and download from there....I knew I was missing something! This is a nice and easy project to get familiar with the board. The goal is to use the camera and integrate the camera into various projects.....stay tuned 👍
@hemersonallan7 күн бұрын
Awesome tutorial ! Greetings from Brazil !!
@BMonsterLaboratory7 күн бұрын
Thanks! I appreciate your comment. Hello Brazil! 👋
@sedrik20002 ай бұрын
Great video! I really appriciate that you walked-thru the code and explained it, many videos doesn't. Would love to see you make a video about the s3 and it's wifi features
@BMonsterLaboratory2 ай бұрын
Thank you! I'm definitely not done with the s3. 👍
@BMonsterLaboratory5 ай бұрын
Here is the sketch I used in the video for temperature and humidity monitoring. It is not in the tutorial. /* BLE Environmental Monitor: An Arduino sketch for ESP32S3 that reads temperature and humidity using a DHT11 sensor and transmits the data via BLE to the LightBlue app for real-time monitoring on a smartphone. */ #include "BLEDevice.h" #include "BLEServer.h" #include "BLEUtils.h" #include "BLE2902.h" #include #define DHT_PIN 15 // GPIO pin connected to the DHT11 sensor #define DHT_TYPE DHT11 // DHT11 sensor type // UUIDs for BLE services and characteristics #define SERVICE_UUID "6E400001-B5A3-F393-E0A9-E50E24DCCA9E" #define CHARACTERISTIC_UUID_TX "6E400003-B5A3-F393-E0A9-E50E24DCCA9E" DHT dht(DHT_PIN, DHT_TYPE); BLECharacteristic *pCharacteristicTX; bool deviceConnected = false; BLEServer *pServer; class MyServerCallbacks : public BLEServerCallbacks { void onConnect(BLEServer* pServer) { deviceConnected = true; Serial.println("Device connected"); }; void onDisconnect(BLEServer* pServer) { deviceConnected = false; Serial.println("Device disconnected"); // Start advertising again to allow auto-reconnection pServer->getAdvertising()->start(); } }; class MyCallbacks : public BLECharacteristicCallbacks { void onWrite(BLECharacteristic *pCharacteristic) { std::string rxValue = pCharacteristic->getValue(); if (!rxValue.empty()) { String command = String(rxValue.c_str()); command.trim(); command.toUpperCase(); Serial.println("Command received: " + command); if (command == "ON") { // Handle other commands if needed } else if (command == "TEMP") { // Read temperature and humidity float humidity = dht.readHumidity(); float temperatureC = dht.readTemperature(); float temperatureF = (temperatureC * 9 / 5) + 32; // Convert Celsius to Fahrenheit // Check if any reads failed if (isnan(humidity) || isnan(temperatureF)) { Serial.println("Failed to read from DHT sensor!"); return; } // Prepare and send the data over BLE char tempHumidValue[40]; sprintf(tempHumidValue, "T: %.1fF, H: %.1f%%", temperatureF, humidity); pCharacteristicTX->setValue(tempHumidValue); pCharacteristicTX->notify(); Serial.print("Sent to app: "); Serial.println(tempHumidValue); } } } }; void setupBLE(String BLEName) { BLEDevice::init(BLEName.c_str()); pServer = BLEDevice::createServer(); pServer->setCallbacks(new MyServerCallbacks()); BLEService *pService = pServer->createService(SERVICE_UUID); pCharacteristicTX = pService->createCharacteristic( CHARACTERISTIC_UUID_TX, BLECharacteristic::PROPERTY_NOTIFY ); pCharacteristicTX->addDescriptor(new BLE2902()); pService->start(); // Start advertising pServer->getAdvertising()->start(); Serial.println("BLE advertising started. Waiting for a client connection..."); } void setup() { Serial.begin(115200); dht.begin(); // Initialize the DHT sensor setupBLE("ESP32S3_Env_Monitor"); // Setup BLE with a specific device name for the environment monitoring } void loop() { delay(5000); // Wait for 5 seconds between readings // Read temperature and humidity float humidity = dht.readHumidity(); float temperatureC = dht.readTemperature(); float temperatureF = (temperatureC * 9 / 5) + 32; // Convert Celsius to Fahrenheit // Check if any reads failed and exit early (to try again). if (isnan(humidity) || isnan(temperatureF)) { Serial.println("Failed to read from DHT sensor!"); return; } // Prepare and send the data over BLE char tempHumidValue[40]; sprintf(tempHumidValue, "T: %.1fF, H: %.1f%%", temperatureF, humidity); pCharacteristicTX->setValue(tempHumidValue); pCharacteristicTX->notify(); Serial.print("Sent to app: "); Serial.println(tempHumidValue); }
@BMonsterLaboratory5 ай бұрын
Here is the sketch for the Bluetooth LED control. You'll find it in the tutorial under Sketch_13.2 /********************************************************************** Filename : BLE_USART Description : Esp32 communicates with the phone by BLE and sends incoming data via a serial port Auther : www.freenove.com Modification: 2022/10/26 **********************************************************************/ #include "BLEDevice.h" #include "BLEServer.h" #include "BLEUtils.h" #include "BLE2902.h" #include "String.h" BLECharacteristic *pCharacteristic; bool deviceConnected = false; uint8_t txValue = 0; long lastMsg = 0; char rxload[20]; #define SERVICE_UUID "6E400001-B5A3-F393-E0A9-E50E24DCCA9E" #define CHARACTERISTIC_UUID_RX "6E400002-B5A3-F393-E0A9-E50E24DCCA9E" #define CHARACTERISTIC_UUID_TX "6E400003-B5A3-F393-E0A9-E50E24DCCA9E" #define LED 2 class MyServerCallbacks : public BLEServerCallbacks { void onConnect(BLEServer *pServer) { deviceConnected = true; }; void onDisconnect(BLEServer *pServer) { deviceConnected = false; } }; class MyCallbacks : public BLECharacteristicCallbacks { void onWrite(BLECharacteristic *pCharacteristic) { std::string rxValue = pCharacteristic->getValue(); if (rxValue.length() > 0) { for (int i = 0; i < 20; i++) { rxload[i] = 0; } for (int i = 0; i < rxValue.length(); i++) { rxload[i] = (char)rxValue[i]; } } } }; void setupBLE(String BLEName) { const char *ble_name = BLEName.c_str(); BLEDevice::init(ble_name); BLEServer *pServer = BLEDevice::createServer(); pServer->setCallbacks(new MyServerCallbacks()); BLEService *pService = pServer->createService(SERVICE_UUID); pCharacteristic = pService->createCharacteristic(CHARACTERISTIC_UUID_TX, BLECharacteristic::PROPERTY_NOTIFY); pCharacteristic->addDescriptor(new BLE2902()); BLECharacteristic *pCharacteristic = pService->createCharacteristic(CHARACTERISTIC_UUID_RX, BLECharacteristic::PROPERTY_WRITE); pCharacteristic->setCallbacks(new MyCallbacks()); pService->start(); pServer->getAdvertising()->start(); Serial.println("Waiting a client connection to notify..."); } void setup() { pinMode(LED, OUTPUT); setupBLE("ESP32test"); Serial.begin(115200); Serial.println(" The device started, now you can pair it with Bluetooth!"); } void loop() { long now = millis(); if (now - lastMsg > 100) { if (deviceConnected && strlen(rxload) > 0) { if (strncmp(rxload, "led_on", 6) == 0) { digitalWrite(LED, HIGH); } if (strncmp(rxload, "led_off", 7) == 0) { digitalWrite(LED, LOW); } Serial.println(rxload); memset(rxload,0,sizeof(rxload)); } lastMsg = now; } }