Battery
Project #29 – DFRobot – Fermion MEMS Smoke Gas – Mk06
——
#DonLucElectronics #DonLuc #DFRobot #MEMSSmokeGas #FireBeetle2ESP32E #ESP32 #IoT #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
Fermion: MEMS Smoke Gas Detection Sensor
Fermion: MEMS Smoke Gas Detection Sensor employs state-of-the-art microelectromechanical system (MEMS) technology, endowing the sensor with compact dimensions, low power consumption, minimal heat generation, short preheating time, and swift response recovery. The sensor can measure smoke concentration qualitatively and is suitable for smoke alarm and other application scenarios.
Precautions for use:
- Kindly remove the protective film before usage.
- To prevent exposure to volatile silicon compounds vapors.
- Refrain from prolonged exposure to extreme environments.
- Avoid contact with water, condensation, and freezing.
- Minimize excessive vibration, impact, and dropping.
- For extended periods of non-usage, it is advisable to preheat the module for at least 24 hours.
DL2403Mk02
1 x DFRobot FireBeetle 2 ESP32-E
1 x Fermion: MEMS Smoke Gas Detection 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
SMO – A0
VIN – +3.3V
GND – GND
——
DL2403Mk02p.ino
/****** Don Luc Electronics © ****** Software Version Information Project #29 - DFRobot - Fermion MEMS Smoke Gas - Mk06 29-06 DL2403Mk02p.ino 1 x DFRobot FireBeetle 2 ESP32-E 1 x Fermion: MEMS Smoke Gas Detection 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> // Bluetooth LE Keyboard BleKeyboard bleKeyboard; String sKeyboard = ""; // Send Size byte sendSize = 0; // Fermion: MEMS Smoke Gas Detection Sensor int iSmokeGas = A0; int iSmokeGasVal = 0; // 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-06"; void loop() { // Fermion: MEMS Smoke Gas Detection Sensor isSmokeGas(); // 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); } }
getSmokeGas.ino
// Fermion: MEMS Smoke Gas Detection Sensor // Smoke Gas void isSmokeGas(){ // Connect Smoke Gas Sensor to Analog 0 iSmokeGasVal = analogRead( iSmokeGas ); // bleKeyboard (10-1000ppm) // DFR|Version|Smoke Gas Detection|* sKeyboard = "DFR|" + sver + "|" + String(iSmokeGasVal) + "|*"; }
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); // 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: https://www.donluc.com/?page_id=1927
Teacher, Instructor, E-Mentor, R&D and Consulting
- Programming Language
- Single-Board 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
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/
Don Luc
Project #29 – DFRobot – Soil Moisture – Mk05
——
#DonLucElectronics #DonLuc #DFRobot #SoilMoistureSensor #FireBeetle2ESP32E #ESP32 #IoT #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
Soil Moisture
Soil moisture is the critical parameter in agriculture. If there is a shortage or overabundance of water, plants may die. At the same time, this data depends on many external factors, primarily weather conditions and climate changes. That is why it is so vital to understand the most effective methods for analyzing soil moisture content.
This term refers to the entire quantity of water in the ground’s pores or on its surface. The moisture content of soil depends on such factors as weather, type of land, and plants. The parameter is vital in monitoring soil moisture activities, predicting natural disasters, managing water supply, etc. This data may signal a future flood or water deficit ahead of other indicators.
Soil moisture affects:
- Content of air, salinity, and amount of toxic substances.
- Ground structure and thickness.
- Temperature and heat capacity of the ground.
DL2403Mk01
1 x DFRobot FireBeetle 2 ESP32-E
1 x Gravity: Analog Soil Moisture Sensor
1 x Fermion: BLE Sensor Beacon
1 x CR2032 Coin Cell Battery
1 x 1 x Lithium Ion Battery – 1000mAh
1 x Rocker Switch – SPST
1 x Resistor 10K Ohm
1 x SparkFun Serial Basic Breakout – CH340G
1 x SparkFun Cerberus USB Cable
1 x USB 3.1 Cable A to C
DFRobot FireBeetle 2 ESP32-E
LED – 2
RSW – 17
VIN – +3.3V
GND – GND
——
DL2403Mk01p.ino
/****** Don Luc Electronics © ****** Software Version Information Project #29 - DFRobot - Soil Moisture - Mk05 29-05 DL2403Mk01p.ino 1 x DFRobot FireBeetle 2 ESP32-E 1 x Gravity: Analog Soil Moisture Sensor 1 x Fermion: BLE Sensor Beacon 1 x CR2032 Coin Cell Battery 1 x 1 x Lithium Ion Battery - 1000mAh 1 x Rocker Switch - SPST 1 x Resistor 10K Ohm 1 x SparkFun Serial Basic Breakout - CH340G 1 x SparkFun Cerberus USB Cable 1 x USB 3.1 Cable A to C */ // Include the Library Code // Bluetooth LE keyboard #include <BleKeyboard.h> // Arduino #include <Arduino.h> // BLE Device #include <BLEDevice.h> // BLE Utils #include <BLEUtils.h> // BLEScan #include <BLEScan.h> // BLE Advertised Device #include <BLEAdvertisedDevice.h> // BLE Eddystone URL #include <BLEEddystoneURL.h> // BLE Eddystone TLM #include <BLEEddystoneTLM.h> // BLE Beacon #include <BLEBeacon.h> // ENDIAN_CHANGE #define ENDIAN_CHANGE_U16(x) ((((x)&0xFF00) >> 8) + (((x)&0xFF) << 8)) // Bluetooth LE Keyboard BleKeyboard bleKeyboard; String sKeyboard = ""; // Send Size byte sendSize = 0; // Gravity: Analog Soil Moisture Sensor float Sensor_Data; // In seconds int scanTime = 5; // BLE Scan BLEScan *pBLEScan; // My Advertised Device Callbacks class MyAdvertisedDeviceCallbacks : public BLEAdvertisedDeviceCallbacks { // onResult void onResult(BLEAdvertisedDevice advertisedDevice) { // Advertised Device if (advertisedDevice.haveName()) { // Name: Fermion: Sensor Beacon if(String(advertisedDevice.getName().c_str()) == "Soil Moisture"){ // strManufacturerData std::string strManufacturerData = advertisedDevice.getManufacturerData(); uint8_t cManufacturerData[100]; strManufacturerData.copy((char *)cManufacturerData, strManufacturerData.length(), 0); // strManufacturerData.length for (int i = 0; i < strManufacturerData.length(); i++) { // cManufacturerData[i] cManufacturerData[i]; } // Sensor_Data Sensor_Data = int(cManufacturerData[2]<<8 | cManufacturerData[3]); } } } }; // 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-05"; void loop() { // ScanResults isBLEScanResults(); // Gravity: Analog Soil Moisture Sensor isSoilMoisture(); // 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 2 Second delay(2000); }
getBLEScan.ino
// getBLEScan // Setup BLE Scan void isSetupBLEScan(){ // BLE Device BLEDevice::init(""); // Create new scan pBLEScan = BLEDevice::getScan(); // Set Advertised Device Callbacks pBLEScan->setAdvertisedDeviceCallbacks(new MyAdvertisedDeviceCallbacks()); // Active scan uses more power, but get results faster pBLEScan->setActiveScan(true); // Set Interval pBLEScan->setInterval(100); // Less or equal setInterval value pBLEScan->setWindow(99); } // BLE Scan Results void isBLEScanResults(){ // Put your main code here, to run repeatedly: BLEScanResults foundDevices = pBLEScan->start(scanTime, false); // Delete results fromBLEScan buffer to release memory pBLEScan->clearResults(); }
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); } }
getSoilMoisture.ino
// Gravity: Analog Soil Moisture Sensor // Soil Moisture void isSoilMoisture(){ // bleKeyboard // DFR|Version|Soil Moisture|* // SData => 0~900 Soil Moisture float SData = map( Sensor_Data, 1, 3000, 0, 900); sKeyboard = "DFR|" + sver + "|" + String(SData) + "|*"; }
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); // Setup BLE Scan isSetupBLEScan(); // 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: https://www.donluc.com/?page_id=1927
Teacher, Instructor, E-Mentor, R&D and Consulting
- Programming Language
- Single-Board 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
- eHealth Sensors, Biosensor, and Biometric
- Research & Development (R & D)
- Consulting
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/
Don Luc
Project #29 – DFRobot – Gravity Soil Moisture Sensor – Mk04
——
#DonLucElectronics #DonLuc #DFRobot #SoilMoistureSensor #FireBeetle2ESP32E #ESP32 #IoT #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
Gravity: Analog Soil Moisture Sensor
A soil moisture sensor can read the amount of moisture present in the soil surrounding it. It’s an ideal for monitoring an urban garden, or your pet plant’s water level. This is a must have component for a IOT Garden / Agriculture. The new soil moisture sensor uses Immersion Gold which protects the nickel from oxidation. Electroless nickel immersion gold has several advantages over more conventional surface platings such as HASL, including excellent surface planarity, good oxidation resistance, and usability for untreated contact surfaces such as membrane switches and contact points.
This Soil Moisture Sensor uses the two probes to pass current through the soil, and then it reads that resistance to get the moisture level. More water makes the soil conduct electricity more easily, while dry soil conducts electricity poorly. This sensor will be helpful to remind you to water your indoor plants or to monitor the soil moisture in your garden.
DL2402Mk04
1 x DFRobot FireBeetle 2 ESP32-E
1 x Gravity: Analog Soil Moisture 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
SMS – A0
VIN – +3.3V
GND – GND
——
DL2402Mk04p.ino
/****** Don Luc Electronics © ****** Software Version Information Project #29 - DFRobot - Gravity Soil Moisture Sensor - Mk04 29-04 DL2402Mk04p.ino 1 x DFRobot FireBeetle 2 ESP32-E 1 x Gravity: Analog Soil Moisture Sensor 1 x Rocker Switch - SPST 1 x Resistor 10K Ohm 1 x 1 x Lithium Ion Battery - 1000mAh 1 x USB 3.1 Cable A to C */ // Include the Library Code // Bluetooth LE keyboard #include <BleKeyboard.h> // Bluetooth LE Keyboard BleKeyboard bleKeyboard; String sKeyboard = ""; // Send Size byte sendSize = 0; // Gravity: Analog Soil Moisture Sensor int iSoilMoisture = A0; int iSoilMoistureVal = 0; // 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-04"; void loop() { // Gravity: Analog Soil Moisture Sensor isSoilMoisture(); // 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); } }
getSoilMoisture.ino
// Gravity: Analog Soil Moisture Sensor // Soil Moisture void isSoilMoisture(){ // Connect Soil Moisture Sensor to Analog 0 iSoilMoistureVal = analogRead( iSoilMoisture ); // SData => 0~900 Soil Moisture float SData = map( iSoilMoistureVal, 1, 3000, 0, 900); // bleKeyboard // DFR|Version|Soil Moisture|* sKeyboard = "DFR|" + sver + "|" + String(SData) + "|*"; }
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); // 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: https://www.donluc.com/?page_id=1927
Teacher, Instructor, E-Mentor, R&D and Consulting
- Programming Language
- Single-Board 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
- eHealth Sensors, Biosensor, and Biometric
- Research & Development (R & D)
- Consulting
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/
Don Luc
Project #29 – DFRobot – Fermion BLE Sensor Beacon – Mk03
——
#DonLucElectronics #DonLuc #DFRobot #FermionBLESensorBeacon #AmbientLight #FireBeetle2ESP32E #ESP32 #IoT #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
Fermion: BLE Sensor Beacon
BLE Beacon, also known as Low Energy Bluetooth Beacon, is a small wireless device that broadcasts signals using BLE technology. Due to its broadcast nature, pairing is not required between the beacon and receiving devices. Each beacon contains a unique identifier, detectable by nearby devices equipped with Bluetooth technology, such as ESP32 and smartphones supporting BLE scanning.
This Bluetooth beacon has a built-in 11-bit ADC, Fermion version, and multiple I/Os that can be multiplexed to SDA/SCL while broadcasting over Bluetooth. Users can access sensor data within broadcast range on a Bluetooth-equipped device such as a Smartphone or ESP32. This BLE beacon has a built-in 11-bit ADC and an I2C interface, allowing it to real-time collect and broadcast data from various types of sensors, including analog, digital, and I2C sensors.
DL2402Mk03
1 x DFRobot FireBeetle 2 ESP32-E
1 x Fermion: BLE Sensor Beacon
1 x Gravity: Analog Ambient Light Sensor
1 x CR2032 Coin Cell Battery
1 x 1 x Lithium Ion Battery – 1000mAh
1 x Rocker Switch – SPST
1 x Resistor 10K Ohm
1 x SparkFun Serial Basic Breakout – CH340G
1 x SparkFun Cerberus USB Cable
1 x USB 3.1 Cable A to C
DFRobot FireBeetle 2 ESP32-E
LED – 2
RSW – 17
VIN – +3.3V
GND – GND
——
DL2402Mk03p.ino
/****** Don Luc Electronics © ****** Software Version Information Project #29 - DFRobot - - Mk03 29-03 DL2402Mk03p.ino 1 x DFRobot FireBeetle 2 ESP32-E 1 x Fermion: BLE Sensor Beacon 1 x Gravity: Analog Ambient Light Sensor 1 x CR2032 Coin Cell Battery 1 x 1 x Lithium Ion Battery - 1000mAh 1 x Rocker Switch - SPST 1 x Resistor 10K Ohm 1 x SparkFun Serial Basic Breakout - CH340G 1 x SparkFun Cerberus USB Cable 1 x USB 3.1 Cable A to C */ // Include the Library Code // Bluetooth LE keyboard #include <BleKeyboard.h> // Arduino #include <Arduino.h> // BLE Device #include <BLEDevice.h> // BLE Utils #include <BLEUtils.h> // BLEScan #include <BLEScan.h> // BLE Advertised Device #include <BLEAdvertisedDevice.h> // BLE Eddystone URL #include <BLEEddystoneURL.h> // BLE Eddystone TLM #include <BLEEddystoneTLM.h> // BLE Beacon #include <BLEBeacon.h> // ENDIAN_CHANGE #define ENDIAN_CHANGE_U16(x) ((((x)&0xFF00) >> 8) + (((x)&0xFF) << 8)) // Bluetooth LE Keyboard BleKeyboard bleKeyboard; String sKeyboard = ""; // Send Size byte sendSize = 0; // Gravity: Analog Ambient Light Sensor float Sensor_Data; // In seconds int scanTime = 5; // BLE Scan BLEScan *pBLEScan; // My Advertised Device Callbacks class MyAdvertisedDeviceCallbacks : public BLEAdvertisedDeviceCallbacks { // onResult void onResult(BLEAdvertisedDevice advertisedDevice) { // Advertised Device if (advertisedDevice.haveName()) { // Name: Fermion: Sensor Beacon if(String(advertisedDevice.getName().c_str()) == "Fermion: Sensor Beacon"){ // strManufacturerData std::string strManufacturerData = advertisedDevice.getManufacturerData(); uint8_t cManufacturerData[100]; strManufacturerData.copy((char *)cManufacturerData, strManufacturerData.length(), 0); // strManufacturerData.length for (int i = 0; i < strManufacturerData.length(); i++) { // cManufacturerData[i] cManufacturerData[i]; } // Sensor_Data Sensor_Data = int(cManufacturerData[2]<<8 | cManufacturerData[3]); } } } }; // 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-03"; void loop() { // ScanResults isBLEScanResults(); // Gravity: Analog Ambient Light Sensor isAmbientLight(); // 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 2 Second delay(2000); }
getAmbientLight.ino
// Gravity: Analog Ambient Light Sensor // Ambient Light void isAmbientLight(){ // bleKeyboard // DFR|Version|Lux|* // SData => 1~6000 Lux float SData = map(Sensor_Data, 1, 3000, 1, 6000); sKeyboard = "DFR|" + sver + "|" + String(SData) + "|*"; }
getBLEScan.ino
// getBLEScan // Setup BLE Scan void isSetupBLEScan(){ // BLE Device BLEDevice::init(""); // Create new scan pBLEScan = BLEDevice::getScan(); // Set Advertised Device Callbacks pBLEScan->setAdvertisedDeviceCallbacks(new MyAdvertisedDeviceCallbacks()); // Active scan uses more power, but get results faster pBLEScan->setActiveScan(true); // Set Interval pBLEScan->setInterval(100); // Less or equal setInterval value pBLEScan->setWindow(99); } // BLE Scan Results void isBLEScanResults(){ // Put your main code here, to run repeatedly: BLEScanResults foundDevices = pBLEScan->start(scanTime, false); // Delete results fromBLEScan buffer to release memory pBLEScan->clearResults(); }
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); } }
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); // Setup BLE Scan isSetupBLEScan(); // 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: https://www.donluc.com/?page_id=1927
Teacher, Instructor, E-Mentor, R&D and Consulting
- Programming Language
- Single-Board 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
- eHealth Sensors, Biosensor, and Biometric
- Research & Development (R & D)
- Consulting
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/
Don Luc
Project #28 – Sensors – MMA7361 – Mk14
——
#DonLucElectronics #DonLuc #Sensors #MMA7361 #Adafruit #SparkFun #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
SparkFun Triple Axis Accelerometer Breakout – MMA7361
This is a breakout board for Freescale’s MMA7361L three-axis analog MEMS accelerometer. The sensor requires a very low amount of power and has a g-select input which switches the accelerometer between ±1.5g and ±6g measurement ranges. Other features include a sleep mode, signal conditioning, a 1-pole low pass filter, temperature compensation, self test, and 0g-detect which detects linear freefall. Zero-g offset and sensitivity are factory set and require no external devices.
This breadboard friendly board breaks out every pin of the MMA7361L to a 9-pin, 0.1″ pitch header. The sensor works on power between 2.2 and 3.6VDC (3.3 Volt optimal), and typically consumes just 400µA of current. All three axes have their own analog output.
- Two selectable measuring ranges (±1.5g, ±6g)
- Breadboard friendly – 0.1″ pitch header
- Low current consumption: 400 µA
- Sleep mode: 3 µA
- Low voltage operation: 2.2 Volt – 3.6 Volt
- High sensitivity (800 mV/g at 1.5g)
- Fast turn on time (0.5 ms enable response time)
- Self test for freefall detect diagnosis
- 0g-Detect for freefall protection
- Signal conditioning with low pass filter
- Robust design, high shocks survivability
DL2401Mk04
1 x SparkFun Thing Plus – ESP32 WROOM
1 x DS3231 Precision RTC FeatherWing
1 x SparkFun Triple Axis Accelerometer Breakout – MMA7361
1 x Rocker Switch – SPST
1 x Resistor 10K Ohm
1 x CR1220 3V Lithium Coin Cell Battery
1 x 1 x Lithium Ion Battery – 1000mAh
1 x Terminal Block Breakout FeatherWing
1 x SparkFun Cerberus USB Cable
SparkFun Thing Plus – ESP32 WROOM
LED – LED_BUILTIN
SDA – Digital 23
SCL – Digital 22
SW1 – Digital 21
XAC – Analog A0
YAC – Analog A1
ZAC – Analog A2
VIN – +3.3V
GND – GND
——
DL2401Mk04p.ino
/****** Don Luc Electronics © ****** Software Version Information Project #28 - Sensors - MMA7361 - Mk14 28-14 DL2401Mk04p.ino 1 x SparkFun Thing Plus - ESP32 WROOM 1 x DS3231 Precision RTC FeatherWing 1 x SparkFun Triple Axis Accelerometer Breakout - MMA7361 1 x Rocker Switch - SPST 1 x Resistor 10K Ohm 1 x Lithium Ion Battery - 1000mAh 1 x CR1220 3V Lithium Coin Cell Battery 1 x Terminal Block Breakout FeatherWing 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // Bluetooth LE keyboard #include <BleKeyboard.h> // Two Wire Interface (TWI/I2C) #include <Wire.h> // Serial Peripheral Interface #include <SPI.h> // DS3231 Precision RTC #include <RTClib.h> // Bluetooth LE Keyboard BleKeyboard bleKeyboard; String sKeyboard = ""; // Send Size byte sendSize = 0; // DS3231 Precision RTC RTC_DS3231 rtc; String dateRTC = ""; String timeRTC = ""; // Accelerometer MMA7361 int XAc = A0; int YAc = A1; int ZAc = A2; // Read int x = 0; int y = 0; int z = 0; // The number of the Rocker Switch pin int iSwitch = 21; // Variable for reading the button status int SwitchState = 0; // Software Version Information String sver = "28-14"; void loop() { // Date and Time RTC isRTC (); // Accelerometer MMA7361 isMMA7361(); // 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); }
getAccelerometer.ino
// Accelerometer MMA7361 // isMMA7361 void isMMA7361(){ // Accelerometer Read x = analogRead(XAc); y = analogRead(YAc); z = analogRead(ZAc); sKeyboard = sKeyboard + String(x) + "|" + String(y) + "|" + String(z) + "|*"; }
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); } }
getRTC.ino
// Date & Time // DS3231 Precision RTC void isSetupRTC() { // DS3231 Precision RTC if (! rtc.begin()) { //Serial.println("Couldn't find RTC"); //Serial.flush(); while (1) delay(10); } if (rtc.lostPower()) { //Serial.println("RTC lost power, let's set the time!"); // When time needs to be set on a new device, or after a power loss, the // following line sets the RTC to the date & time this sketch was compiled rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); // This line sets the RTC with an explicit date & time, for example to set // January 21, 2014 at 3am you would call: //rtc.adjust(DateTime(2023, 8, 10, 11, 0, 0)); } } // Date and Time RTC void isRTC () { // Date and Time dateRTC = ""; timeRTC = ""; DateTime now = rtc.now(); // Date dateRTC = now.year(), DEC; dateRTC = dateRTC + "/"; dateRTC = dateRTC + now.month(), DEC; dateRTC = dateRTC + "/"; dateRTC = dateRTC + now.day(), DEC; // Time timeRTC = now.hour(), DEC; timeRTC = timeRTC + ":"; timeRTC = timeRTC + now.minute(), DEC; timeRTC = timeRTC + ":"; timeRTC = timeRTC + now.second(), DEC; // bleKeyboard sKeyboard = "SEN|" + sver + "|" + String(dateRTC) + "|" + String(timeRTC) + "|"; }
setup.ino
// Setup void setup() { // Give display time to power on delay(100); // Bluetooth LE keyboard bleKeyboard.begin(); // Wire - Inialize I2C Hardware Wire.begin(); // Give display time to power on delay(100); // Date & Time RTC // DS3231 Precision RTC isSetupRTC(); // Give display time to power on delay(100); // Initialize the Switch pin as an input pinMode(iSwitch, INPUT); // Initialize digital pin LED_BUILTIN as an output pinMode(LED_BUILTIN, OUTPUT); // Turn the LED on HIGH digitalWrite(LED_BUILTIN, HIGH); // Delay 5 Second delay( 5000 ); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Teacher, Instructor, E-Mentor, R&D and Consulting
- Programming Language
- Single-Board 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
- eHealth Sensors, Biosensor, and Biometric
- Research & Development (R & D)
- Consulting
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/
Don Luc
Project #29 – DFRobot – Gravity Analog Ambient Light Sensor – Mk02
——
#DonLucElectronics #DonLuc #DFRobot #AmbientLight #FireBeetle2ESP32E #ESP32 #IoT #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
Gravity: Analog Ambient Light Sensor
This Gravity: Analog ambient light sensor can assist you in detecting light density and provide an analog voltage signal to the controller as feedback. Additionally, you have the ability to trigger other components within your project by setting voltage thresholds. This ambient light sensor is operational within the voltage range of 3.3 to 5 volts.
DL2402Mk02
1 x DFRobot FireBeetle 2 ESP32-E
1 x Gravity: Analog Ambient Light 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
ALS – A0
VIN – +3.3V
GND – GND
——
DL2402Mk02p.ino
/****** Don Luc Electronics © ****** Software Version Information Project #29 - DFRobot - FireBeetle 2 ESP32-E - Mk02 29-02 DL2402Mk02p.ino 1 x DFRobot FireBeetle 2 ESP32-E 1 x Gravity: Analog Ambient Light Sensor 1 x Rocker Switch - SPST 1 x Resistor 10K Ohm 1 x 1 x Lithium Ion Battery - 1000mAh 1 x USB 3.1 Cable A to C */ // Include the Library Code // Bluetooth LE keyboard #include <BleKeyboard.h> // Bluetooth LE Keyboard BleKeyboard bleKeyboard; String sKeyboard = ""; // Send Size byte sendSize = 0; // Gravity: Analog Ambient Light Sensor int iAmbientLight = A0; int iAmbientLightVal = 0; // 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-02"; void loop() { // Gravity: Analog Ambient Light Sensor isAmbientLight(); // 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); }
getAmbientLight.ino
// Gravity: Analog Ambient Light Sensor // Ambient Light void isAmbientLight(){ // Connect Ambient Light Sensor to Analog 0 iAmbientLightVal = analogRead( iAmbientLight ); // bleKeyboard // DFR|Version|Lux|* sKeyboard = "DFR|" + sver + "|" + String(iAmbientLightVal) + "|*"; }
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); } }
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); // 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: https://www.donluc.com/?page_id=1927
Teacher, Instructor, E-Mentor, R&D and Consulting
- Programming Language
- Single-Board 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
- eHealth Sensors, Biosensor, and Biometric
- Research & Development (R & D)
- Consulting
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/
Don Luc
Project #29 – DFRobot – FireBeetle 2 ESP32-E – Mk01
——
#DonLucElectronics #DonLuc #DFRobot #FireBeetle2ESP32E #ESP32 #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
——
——
FireBeetle 2 ESP32-E
FireBeetle 2 ESP32-E, specially designed for IoT, is an ESP-WROOM-32E-based main controller board with dual-core chips. It supports WiFi and Bluetooth dual-mode communication and features a small size, ultra-low power consumption, on-board charging circuit, and easy-to-use interface, which can be conveniently used for smart home IoT, industrial IoT applications, and wearable devices, and so on. You can easily create your own IoT smart home system when connecting it with an IoT platform like IFTTT. FireBeetle 2 ESP32-E supports Arduino programming.
- Compatible with DFRobot FireBeetle V2 Series
- Small Size of 25.4 mm × 60 mm
- ESP32 Dual-core low power maincontroller, WiFi+BT4.0
- GDI Display Port, say to connect
- Onboard Charging Circuit and PH2.0 li-ion Battery Port
- Operating Voltage: 3.3 Volt
- Input Voltage: 3.3 Volt -5.5 Volt (Support USB Charging)
DL2402Mk01
1 x DFRobot FireBeetle 2 ESP32-E
1 x 1 x Lithium Ion Battery – 1000mAh
1 x USB 3.1 Cable A to C
DFRobot FireBeetle 2 ESP32-E
LED – 2
VIN – +3.3V
GND – GND
——
DL2402Mk01p.ino
/****** Don Luc Electronics © ****** Software Version Information Project #29 - DFRobot - FireBeetle 2 ESP32-E - Mk01 29-01 DL2402Mk01p.ino 1 x DFRobot FireBeetle 2 ESP32-E 1 x 1 x Lithium Ion Battery - 1000mAh 1 x USB 3.1 Cable A to C */ // Include the Library Code // Define LED int iLED = 2; // Software Version Information String sver = "29-01"; void loop() { // Outputting high, the LED turns on digitalWrite(iLED, HIGH); // Delay 1 Second delay(1000); // Outputting low, the LED turns off digitalWrite(iLED, LOW); // Delay 1 Second delay(1000); }
setup.ino
// Setup void setup() { // Initialize digital pin iLED as an output pinMode(iLED, OUTPUT); // Delay 5 Second delay( 5000 ); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Teacher, Instructor, E-Mentor, R&D and Consulting
- Programming Language
- Single-Board 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
- eHealth Sensors, Biosensor, and Biometric
- Research & Development (R & D)
- Consulting
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/
Don Luc
Project #28 – Sensors – PIR Motion Sensor – Mk13
——
#DonLucElectronics #DonLuc #Sensors #PIR #Adafruit #SparkFun #Pololu #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
PIR Motion Sensor (JST)
This is a simple to use motion sensor. Power it up and wait 1-2 seconds for the sensor to get a snapshot of the still room. If anything moves after that period, the “Alarm” pin will go low. This unit works great from 5 to 12 Volt. The alarm pin is an open collector meaning you will need a pull up resistor on the alarm pin. The open drain setup allows multiple motion sensors to be connected on a single input pin. If any of the motion sensors go off, the input pin will be pulled low.
At their most fundamental level, PIR sensor’s are infrared-sensitive light detectors. By monitoring light in the infrared spectrum, PIR sensors can sense subtle changes in temperature across the area they’re viewing. When a human or some other object comes into the PIR’s field-of-view, the radiation pattern changes, and the PIR interprets that change as movement. All that’s left for us to connect is three pins: power, ground, and the output signal.
DL2401Mk02
1 x SparkFun Thing Plus – ESP32 WROOM
1 x DS3231 Precision RTC FeatherWing
1 x PIR Motion Sensor
1 x Pololu 5V Step-Up Voltage Regulator U1V10F5
1 x Rocker Switch – SPST
1 x Resistor 10K Ohm
1 x CR1220 3V Lithium Coin Cell Battery
1 x 1 x Lithium Ion Battery – 1000mAh
1 x Terminal Block Breakout FeatherWing
1 x SparkFun Cerberus USB Cable
SparkFun Thing Plus – ESP32 WROOM
LED – LED_BUILTIN
SDA – Digital 23
SCL – Digital 22
SW1 – Digital 21
PIR – Digital 14
VIN – +3.3V
VIN – +5V
GND – GND
——
DL2401Mk01p.ino
/****** Don Luc Electronics © ****** Software Version Information Project #28 - Sensors - PIR Motion Sensor - Mk13 28-13 DL2401Mk01p.ino 1 x SparkFun Thing Plus - ESP32 WROOM 1 x DS3231 Precision RTC FeatherWing 1 x PIR Motion Sensor 1 x Pololu 5V Step-Up Voltage Regulator U1V10F5 1 x Rocker Switch - SPST 1 x Resistor 10K Ohm 1 x Lithium Ion Battery - 1000mAh 1 x CR1220 3V Lithium Coin Cell Battery 1 x Terminal Block Breakout FeatherWing 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // Bluetooth LE keyboard #include <BleKeyboard.h> // Two Wire Interface (TWI/I2C) #include <Wire.h> // Serial Peripheral Interface #include <SPI.h> // DS3231 Precision RTC #include <RTClib.h> // Bluetooth LE Keyboard BleKeyboard bleKeyboard; String sKeyboard = ""; // Send Size byte sendSize = 0; // DS3231 Precision RTC RTC_DS3231 rtc; String dateRTC = ""; String timeRTC = ""; // PIR Motion // Motion detector const int iMotion = 14; // Proximity int proximity = LOW; String Det = ""; // The number of the Rocker Switch pin int iSwitch = 21; // Variable for reading the button status int SwitchState = 0; // Software Version Information String sver = "28-13"; void loop() { // Date and Time RTC isRTC (); // isPIR Motion isPIR(); // 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); } }
getPIR.ino
// PIR Motion // Setup PIR void setupPIR() { // Setup PIR Montion pinMode(iMotion, INPUT_PULLUP); } // isPIR Motion void isPIR() { // Proximity proximity = digitalRead(iMotion); if (proximity == LOW) { // PIR Motion Sensor's LOW, Motion is detected Det = "Motion Yes"; } else { // PIR Motion Sensor's HIGH Det = "No"; } sKeyboard = sKeyboard + String(Det) + "|*"; }
getRTC.ino
// Date & Time // DS3231 Precision RTC void isSetupRTC() { // DS3231 Precision RTC if (! rtc.begin()) { //Serial.println("Couldn't find RTC"); //Serial.flush(); while (1) delay(10); } if (rtc.lostPower()) { //Serial.println("RTC lost power, let's set the time!"); // When time needs to be set on a new device, or after a power loss, the // following line sets the RTC to the date & time this sketch was compiled rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); // This line sets the RTC with an explicit date & time, for example to set // January 21, 2014 at 3am you would call: //rtc.adjust(DateTime(2023, 8, 10, 11, 0, 0)); } } // Date and Time RTC void isRTC () { // Date and Time dateRTC = ""; timeRTC = ""; DateTime now = rtc.now(); // Date dateRTC = now.year(), DEC; dateRTC = dateRTC + "/"; dateRTC = dateRTC + now.month(), DEC; dateRTC = dateRTC + "/"; dateRTC = dateRTC + now.day(), DEC; // Time timeRTC = now.hour(), DEC; timeRTC = timeRTC + ":"; timeRTC = timeRTC + now.minute(), DEC; timeRTC = timeRTC + ":"; timeRTC = timeRTC + now.second(), DEC; // bleKeyboard sKeyboard = "SEN|" + sver + "|" + String(dateRTC) + "|" + String(timeRTC) + "|"; }
setup.ino
// Setup void setup() { // Give display time to power on delay(100); // Bluetooth LE keyboard bleKeyboard.begin(); // Wire - Inialize I2C Hardware Wire.begin(); // Give display time to power on delay(100); // Date & Time RTC // DS3231 Precision RTC isSetupRTC(); // Give display time to power on delay(100); // PIR Motion // Setup PIR setupPIR(); // Initialize the Switch pin as an input pinMode(iSwitch, INPUT); // Initialize digital pin LED_BUILTIN as an output pinMode(LED_BUILTIN, OUTPUT); // Turn the LED on HIGH digitalWrite(LED_BUILTIN, HIGH); // Delay 5 Second delay( 5000 ); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Teacher, Instructor, E-Mentor, R&D and Consulting
- Programming Language
- Single-Board 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
- eHealth Sensors, Biosensor, and Biometric
- Research & Development (R & D)
- Consulting
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/
Don Luc
Project #8: Servo – Moteino R2 (RFM12B) – Mk02
——
#DonLucElectronics #DonLuc #Servo #Moteino #Transceiver #RadioFrequency #Pololu #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
Moteino
Moteino began as a low power wireless Arduino compatible development platform based on the popular ATmega328p chip used in the Arduino UNO. There are now several Moteino development boards including MoteinoMEGA based on the Atmega1284P and MoteinoM0 based on the SAMD21G18 Cortex M0+. For programming you will need an external FTDI-Adapter to load sketches, the advantages being lower cost, smaller size.
Servo Motor
A servo motor is a rotary actuator or linear actuator that allows for precise control of angular or linear position, velocity and acceleration. It consists of a suitable motor coupled to a sensor for position feedback. It also requires a relatively sophisticated controller, often a dedicated module designed specifically for use with servo motors.
Servo motors have been around for a long time and are utilized in many applications. They are small in size but pack a big punch and are very energy-efficient. These features allow them to be used to operate remote-controlled or radio-controlled toy cars, robots and airplanes. Servo motors are also used in industrial applications, robotics, in-line manufacturing, pharmaceutics and food services.
Pololu Adjustable Boost Regulator 2.5-9.5 Volt
This powerful, adjustable boost regulator can generate an output voltage as high as 9.5 Volt from an input voltage as low as 1.5 Volt, all in a compact. A trimmer potentiometer lets you set the boost regulator’s output voltage to a value between 2.5 and 9.5 Volt.
DL2310Mk03
2 x Moteino R2 (Transceiver RFM12B)
1 x Pololu Adjustable Boost Regulator 2.5-9.5V
2 x Lithium Ion Battery – 1Ah
1 x Sub-Micro Servo 3.7g
1 x LED Green
1 x Tactile Button
1 x Resistor 10K Ohm
1 x SparkFun FTDI Basic Breakout – 5V
1 x SparkFun Cerberus USB Cable
Moteino R2 (Send)
TR0 – Digital 2
TBI – Digital 6
LED – Digital 9
TR1 – Digital 10
TR2 – Digital 11
TR3 – Digital 12
TR4 – Digital 13
VIN – +5V
VIN – +3.3V
GND – GND
——
DL2310Mk03ps.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #8: Servo - Radio Frequency - Mk02 6-02 Send DL2310Mk03ps.ino 2 x Moteino R2 (Transceiver RFM12B) 1 x Pololu Adjustable Boost Regulator 2.5-9.5V 2 x Lithium Ion Battery - 1Ah 1 x Sub-Micro Servo 3.7g 1 x LED Green 1 x Tactile Button 1 x Resistor 10K Ohm 1 x SparkFun FTDI Basic Breakout - 5V 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // RFM12B Radio #include <RFM12B.h> // Sleep #include <avr/sleep.h> // You will need to initialize the radio by telling it what ID // it has and what network it's on // The NodeID takes values from 1-127, 0 is reserved for sending // broadcast messages (send to all nodes) // The Network ID takes values from 0-255 // By default the SPI-SS line used is D10 on Atmega328. // You can change it by calling .SetCS(pin) where pin can be {8,9,10} // Network ID used for this unit #define NODEID 2 // The network ID we are on #define NETWORKID 99 // The node ID we're sending to #define GATEWAYID 1 // # of ms to wait for an ack #define ACK_TIME 50 // Serial #define SERIAL_BAUD 115200 // Encryption is OPTIONAL // to enable encryption you will need to: // - provide a 16-byte encryption KEY (same on all nodes that talk encrypted) // - to call .Encrypt(KEY) to start encrypting // - to stop encrypting call .Encrypt(NULL) uint8_t KEY[] = "ABCDABCDABCDABCD"; // Wait this many ms between sending packets int interPacketDelay = 50; // Input char input = 0; // Need an instance of the RFM12B Radio Module RFM12B radio; // Send Size byte sendSize = 0; // Payload char payload[100]; // Request ACK bool requestACK = false; // LED int iLED = 9; // The number of the Tactile Button pin int iTButton = 6; // Variable for reading the button status int TButtonState = 0; // The previous reading from the input pin int lastTButtonState = LOW; // The following variables are unsigned longs // because the time, measured in // milliseconds, will quickly become a bigger // number than can be stored in an int. // The last time the output pin was toggled unsigned long lastDebounceTime = 0; // The debounce time; increase if the output flickers unsigned long debounceDelay = 50; // String String zzzzzz = ""; int iSER = 0; // Software Version Information String sver = "8-02"; void loop() { // Tactile Button isTButton(); // is RFM12B Radio isRFM12BRadio(); // Inter Packet Delay delay(interPacketDelay); }
getRFM12BRadio.ino
// RFM12B Radio void isSetupRFM12BRadio(){ // RFM12B Radio radio.Initialize(NODEID, RF12_433MHZ, NETWORKID); // Encryption radio.Encrypt(KEY); // Sleep right away to save power radio.Sleep(); // Transmitting Serial.println("Transmitting...\n\n"); } // is RFM12 BRadio void isRFM12BRadio(){ // zzzzzz "" zzzzzz = ""; // zzzzz = "<SER|" + iSER + "|*"; zzzzzz = "<SER|"; zzzzzz = zzzzzz + iSER; zzzzzz = zzzzzz + "|*"; // sendSize Length sendSize = zzzzzz.length(); // sendSize payload[sendSize]; // sendSize, charAt for(byte i = 0; i < sendSize+1; i++){ payload[i] = zzzzzz.charAt(i); } // payload Serial.print(payload); // Request ACK requestACK = sendSize; // Wakeup radio.Wakeup(); // Turn the LED on HIGH digitalWrite( iLED , HIGH); // Send radio.Send(GATEWAYID, payload, sendSize, requestACK); // Request ACK if (requestACK) { Serial.print(" - waiting for ACK..."); if (waitForAck()){ Serial.print("Ok!"); } else Serial.print("nothing..."); } // Turn the LED on LOW digitalWrite( iLED , LOW); // Sleep radio.Sleep(); // Serial Serial.println(); } // Wait a few milliseconds for proper ACK, return true if received static bool waitForAck(){ // Now long now = millis(); // ACK while (millis() - now <= ACK_TIME){ if (radio.ACKReceived(GATEWAYID)){ return true; } } return false; }
getTButton.ino
// Tactile Button void isTButton(){ // Read the state of the Button value: int reading = digitalRead(iTButton); // Check to see if you just pressed the TButton // (i.e. the input went from LOW to HIGH), and you've waited long enough // since the last press to ignore any noise: // If the TButton changed, due to noise or pressing: if (reading != lastTButtonState) { // Reset the debouncing timer lastDebounceTime = millis(); } if ((millis() - lastDebounceTime) > debounceDelay) { // Whatever the reading is at, it's been there for // longer than the debounce // delay, so take it as the actual current state: // if the button state has changed: if (reading != TButtonState) { TButtonState = reading; // Check if the TButton is pressed. If it is, the TButtonState is HIGH: if (TButtonState == HIGH) { iSER = 1; } else { iSER = 0; } } } // Save the reading. Next time through the loop, // it'll be the lastTButtonState: lastTButtonState = reading; }
setup.ino
// Setup void setup(){ // Serial Serial.begin(SERIAL_BAUD); // LED pinMode( iLED , OUTPUT); // Initialize the Button pin as an input pinMode(iTButton, INPUT); // Setup RFM12B Radio isSetupRFM12BRadio(); }
Moteino R2 (Receive)
TR0 – Digital 2
LED – Digital 9
TR1 – Digital 10
TR2 – Digital 11
TR3 – Digital 12
TR4 – Digital 13
VIN – +5V
VIN – +3.3V
GND – GND
—
DL2310Mk03Mkpr.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #8: Servo - Radio Frequency - Mk02 6-02 Receive DL2310Mk03pr.ino 2 x Moteino R2 (RFM12B) 1 x Pololu Adjustable Boost Regulator 2.5-9.5V 2 x Lithium Ion Battery - 1Ah 1 x Sub-Micro Servo 3.7g 1 x LED Green 1 x Tactile Button 1 x Resistor 10K Ohm 1 x SparkFun FTDI Basic Breakout - 5V 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // RFM12B Radio #include <RFM12B.h> // Servo #include <Servo.h> // You will need to initialize the radio by telling it what ID // it has and what network it's on // The NodeID takes values from 1-127, 0 is reserved for sending // broadcast messages (send to all nodes) // The Network ID takes values from 0-255 // By default the SPI-SS line used is D10 on Atmega328. // You can change it by calling .SetCS(pin) where pin can be {8,9,10} // Network ID used for this unit #define NODEID 1 // The network ID we are on #define NETWORKID 99 // Serial #define SERIAL_BAUD 115200 // Encryption is OPTIONAL // to enable encryption you will need to: // - provide a 16-byte encryption KEY (same on all nodes that talk encrypted) // - to call .Encrypt(KEY) to start encrypting // - to stop encrypting call .Encrypt(NULL) uint8_t KEY[] = "ABCDABCDABCDABCD"; // Need an instance of the RFM12B Radio Module RFM12B radio; // Message String msg = ""; // Servo int iSER = 0; String sSER = ""; int firstClosingBracket = 0; // LED int iLED = 9; int iLEDG = 7; // Servo control Servo serv; const int pinServo = 6; // Software Version Information String sver = "8-02"; void loop() { // is RFM12B Radio isRFM12BRadio(); }
getRFM12BRadio.ino
// RFM12B Radio void isSetupRFM12BRadio() { // RFM12B Radio radio.Initialize(NODEID, RF12_433MHZ, NETWORKID); // Encryption radio.Encrypt(KEY); // Transmitting Serial.println("Listening..."); } // is RFM12 BRadio void isRFM12BRadio() { // Receive if (radio.ReceiveComplete()) { // CRC Pass if (radio.CRCPass()) { // Serial Serial.print('['); Serial.print(radio.GetSender()); Serial.print("] "); // Message msg = ""; // Can also use radio.GetDataLen() if you don't like pointers for (byte i = 0; i < *radio.DataLen; i++) { Serial.print((char)radio.Data[i]); msg = msg + (char)radio.Data[i]; } // Turn the LED on HIGH digitalWrite( iLED , HIGH); // Servo isServo(); // ACK Requested if (radio.ACKRequested()) { // Send ACK radio.SendACK(); Serial.print(" - ACK Sent"); } // Turn the LED on LOW digitalWrite( iLED , LOW); } else { // BAD-CRC Serial.print("BAD-CRC"); } // Serial Serial.println(); } }
getServo.ino
// Servo void isServo(){ // Message //Serial.println( msg ); // msg = "<SER|0|*"; firstClosingBracket = 0; // "<SER|" firstClosingBracket = msg.indexOf('|'); //Serial.println( msg ); msg.remove(0, 5); //Serial.println( msg ); // Servo firstClosingBracket = msg.indexOf('|'); sSER = msg; sSER.remove(firstClosingBracket); //Serial.println( sSER ); iSER = sSER.toInt(); //Serial.println( iSER ); int x = iSER; if (x == 1) { digitalWrite(iLEDG, HIGH); // Set servo to unlock serv.write( 0 ); delay(15); } else { digitalWrite(iLEDG, LOW); // Set servo to lock serv.write( 90 ); delay(15); } }
setup.ino
// Setup void setup() { // Serial Serial.begin(SERIAL_BAUD); // LED pinMode( iLED , OUTPUT); pinMode( iLEDG , OUTPUT); // Attach Servo serv.attach( pinServo ); // RFM12B Radio isSetupRFM12BRadio(); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Teacher, Instructor, E-Mentor, R&D and Consulting
- Programming Language
- Single-Board 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
- eHealth Sensors, Biosensor, and Biometric
- Research & Development (R & D)
- Consulting
Follow Us
Luc Paquin – Curriculum Vitae – 2023
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/
Don Luc
Project #26 – Radio Frequency – Universally Unique IDentifier – Mk27
——
#DonLucElectronics #DonLuc #RadioFrequency #Bluetooth #UUID #Display #SparkFun #Adafruit #BME280 #CCS811 #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
Universally Unique IDentifier
A Universally Unique IDentifier (UUID) is a 128-bit label used for information in computer systems. When generated according to the standard methods, UUIDs are, for practical purposes, unique. Their uniqueness does not depend on a central registration authority or coordination between the parties generating them, unlike most other numbering schemes. While the probability that a UUID will be duplicated is not zero, it is generally considered close enough to zero to be negligible.
Thus, anyone can create a UUID and use it to identify something with near certainty that the identifier does not duplicate one that has already been, or will be, created to identify something else. Information labeled with UUIDs by independent parties can therefore be later combined into a single database or transmitted on the same channel, with a negligible probability of duplication. Adoption of UUIDs is widespread, with many computing platforms providing support for generating them and for parsing their textual representation.
DL2307Mk08
2 x SparkFun Thing Plus – ESP32 WROOM
1 x SparkFun BME280 – Temperature, Humidity, Barometric Pressure, and Altitude
1 x SparkFun Air Quality Breakout – CCS811
1 x Adafruit SHARP Memory Display Breakout
1 x Adalogger FeatherWing – RTC + SD
1 x 8 GB MicroSD Memory Card
1 x CR1220 3V Lithium Coin Cell Battery
2 x Lithium Ion Battery – 850mAh
2 x SparkFun Cerberus USB Cable
SparkFun Thing Plus – ESP32 WROOM (Server)
LED – LED_BUILTIN
SDA – Digital 23
SCL – Digital 22
RX2 – Bluetooth
TX2 – Bluetooth
VIN – +3.3V
GND – GND
——
DL2307Mk08ps.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #26 - Radio Frequency - Universally Unique IDentifier - Mk27 26-27 DL2307Mk08ps.ino 2 x SparkFun Thing Plus - ESP32 WROOM 1 x SparkFun BME280 - Temperature, Humidity, Barometric Pressure, and Altitude 1 x SparkFun Air Quality Breakout - CCS811 1 x Adafruit SHARP Memory Display Breakout 1 x Adalogger FeatherWing - RTC + SD 1 x 8 GB MicroSD Memory Card 1 x CR1220 3V Lithium Coin Cell Battery 2 x Lithium Ion Battery - 850mAh 2 x SparkFun Cerberus USB Cable */ // Include the Library Code // BLE Device #include <BLEDevice.h> // BLE Utils #include <BLEUtils.h> // BLE Serve #include <BLEServer.h> // Two Wire Interface (TWI/I2C) #include <Wire.h> // SparkFun BME280 - Temperature, Humidity, Barometric Pressure, and Altitude #include <SparkFunBME280.h> // SparkFun CCS811 - eCO2 & tVOC #include <SparkFunCCS811.h> // See the following for generating UUIDs: // https://www.uuidgenerator.net/ #define SERVICE_UUID "7c394dc4-49a8-4c22-8a5b-b1612d8c13c1" #define CHARACTERISTIC_UUID "a4c4cec2-f394-4f7a-b9de-89047feca74b" #define CHARACTERISTIC_TEM_UUID "74bd92c6-89d0-4387-823e-97e7e0fb7a2b" #define CHARACTERISTIC_HUM_UUID "1b63f246-b97f-4d2e-b8eb-f69e20a23a34" #define CHARACTERISTIC_BAR_UUID "43788175-37a7-4280-93c6-c690324d088e" #define CHARACTERISTIC_ALT_UUID "609deed9-a72d-45c3-aaba-14a73b0d8fda" #define CHARACTERISTIC_ECO_UUID "ab17aace-c0b9-4bd3-bb93-7715d9afaeea" #define CHARACTERISTIC_VOC_UUID "6a8bf86a-9d40-457c-9f7f-f13a3d6803f1" // Makes the chracteristic globlal static BLECharacteristic *pCharacteristicTEM; static BLECharacteristic *pCharacteristicHUM; static BLECharacteristic *pCharacteristicBAR; static BLECharacteristic *pCharacteristicALT; static BLECharacteristic *pCharacteristicECO; static BLECharacteristic *pCharacteristicVOC; // SparkFun BME280 - Temperature, Humidity, Barometric Pressure, and Altitude BME280 myBME280; float BMEtempC = 0; float BMEhumid = 0; float BMEpressure = 0; float BMEaltitudeM = 0; String FullString = ""; // SparkFun CCS811 - eCO2 & tVOC // Default I2C Address #define CCS811_ADDR 0x5B CCS811 myCCS811(CCS811_ADDR); float CCS811CO2 = 0; float CCS811TVOC = 0; String FullStringA = ""; // Software Version Information String sver = "26-27"; void loop() { // SparkFun BME280 - Temperature, Humidity, Barometric Pressure, and Altitude isBME280(); // SparkFun CCS811 - eCO2 & tVOC isCCS811(); // Delay 1 sec delay(1000); }
getBME280.ino
// SparkFun BME280 - Temperature, Humidity, Barometric Pressure, and Altitude // isBME280 - Temperature, Humidity, Barometric Pressure, and Altitude void isBME280(){ // Temperature Celsius BMEtempC = myBME280.readTempC(); // Humidity BMEhumid = myBME280.readFloatHumidity(); // Barometric Pressure BMEpressure = myBME280.readFloatPressure(); // Altitude Meters BMEaltitudeM = (myBME280.readFloatAltitudeMeters(), 2); // setValue takes uint8_t, uint16_t, uint32_t, int, float, double and string pCharacteristicTEM->setValue(BMEtempC); pCharacteristicHUM->setValue(BMEhumid); pCharacteristicBAR->setValue(BMEpressure); pCharacteristicALT->setValue(BMEaltitudeM); // FullString FullString = "Temperature = " + String(BMEtempC,2) + " Humidity = " + String(BMEhumid,2) + " Barometric = " + String(BMEpressure,2) + " Altitude Meters = " + String(BMEaltitudeM,2) + "\r\n"; // FullString Bluetooth Serial + Serial for(int i = 0; i < FullString.length(); i++) { // Serial Serial.write(FullString.c_str()[i]); } }
getCCS811.ino
// CCS811 - eCO2 & tVOC // isCCS811 - eCO2 & tVOC void isCCS811(){ // This sends the temperature & humidity data to the CCS811 myCCS811.setEnvironmentalData(BMEhumid, BMEtempC); // Calling this function updates the global tVOC and eCO2 variables myCCS811.readAlgorithmResults(); // eCO2 Concentration CCS811CO2 = myCCS811.getCO2(); // tVOC Concentration CCS811TVOC = myCCS811.getTVOC(); // setValue takes uint8_t, uint16_t, uint32_t, int, float, double and string pCharacteristicECO->setValue(CCS811CO2); pCharacteristicVOC->setValue(CCS811TVOC); // FullStringA FullStringA = "TVOCs = " + String(CCS811TVOC,2) + " eCO2 = " + String(CCS811CO2,2) + "\r\n"; // FullStringA Bluetooth Serial + Serial for(int i = 0; i < FullStringA.length(); i++) { // Serial Serial.write(FullStringA.c_str()[i]); } }
setup.ino
// Setup void setup() { // Serial Begin Serial.begin(115200); Serial.println("Starting BLE work!"); // Give display time to power on delay(100); // Wire - Inialize I2C Hardware Wire.begin(); // Give display time to power on delay(100); // SparkFun BME280 - Temperature, Humidity, Barometric Pressure, and Altitude myBME280.begin(); // CCS811 - eCO2 & tVOC myCCS811.begin(); // Initialize digital pin LED_BUILTIN as an output pinMode(LED_BUILTIN, OUTPUT); // Turn the LED on HIGH digitalWrite(LED_BUILTIN, HIGH); // BLE Device Init BLEDevice::init("Don Luc Electronics Server"); BLEServer *pServer = BLEDevice::createServer(); BLEService *pService = pServer->createService(SERVICE_UUID); BLECharacteristic *pCharacteristic = pService->createCharacteristic( CHARACTERISTIC_UUID, BLECharacteristic::PROPERTY_READ | BLECharacteristic::PROPERTY_WRITE ); pCharacteristicTEM = pService->createCharacteristic( CHARACTERISTIC_TEM_UUID, BLECharacteristic::PROPERTY_READ | BLECharacteristic::PROPERTY_WRITE ); pCharacteristicHUM = pService->createCharacteristic( CHARACTERISTIC_HUM_UUID, BLECharacteristic::PROPERTY_READ | BLECharacteristic::PROPERTY_WRITE ); pCharacteristicBAR = pService->createCharacteristic( CHARACTERISTIC_BAR_UUID, BLECharacteristic::PROPERTY_READ | BLECharacteristic::PROPERTY_WRITE ); pCharacteristicALT = pService->createCharacteristic( CHARACTERISTIC_ALT_UUID, BLECharacteristic::PROPERTY_READ | BLECharacteristic::PROPERTY_WRITE ); pCharacteristicVOC = pService->createCharacteristic( CHARACTERISTIC_VOC_UUID, BLECharacteristic::PROPERTY_READ | BLECharacteristic::PROPERTY_WRITE ); pCharacteristicECO = pService->createCharacteristic( CHARACTERISTIC_ECO_UUID, BLECharacteristic::PROPERTY_READ | BLECharacteristic::PROPERTY_WRITE ); pCharacteristic->setValue("Luc Paquin"); pService->start(); // This still is working for backward compatibility // BLEAdvertising *pAdvertising = pServer->getAdvertising(); // BLE Advertising BLEAdvertising *pAdvertising = BLEDevice::getAdvertising(); pAdvertising->addServiceUUID(SERVICE_UUID); pAdvertising->setScanResponse(true); // Functions that help with iPhone connections issue pAdvertising->setMinPreferred(0x06); pAdvertising->setMinPreferred(0x12); BLEDevice::startAdvertising(); }
——
SparkFun Thing Plus – ESP32 WROOM (Client)
LED – Digital 21
SCK – Digital 13
MOSI – Digital 12
SS – Digital 27
MISO – Digital 19
MOSI – Digital 18
SCK – Digital 5
CS – Digital 33
SDA – Digital 23
SCL – Digital 22
RX2 – Bluetooth
TX2 – Bluetooth
VIN – +3.3V
GND – GND
——
DL2307Mk08pr.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #26 - Radio Frequency - Universally Unique IDentifier - Mk27 26-27 DL2307Mk08pr.ino 2 x SparkFun Thing Plus - ESP32 WROOM 1 x SparkFun BME280 - Temperature, Humidity, Barometric Pressure, and Altitude 1 x SparkFun Air Quality Breakout - CCS811 1 x Adafruit SHARP Memory Display Breakout 1 x Adalogger FeatherWing - RTC + SD 1 x 8 GB MicroSD Memory Card 1 x CR1220 3V Lithium Coin Cell Battery 2 x Lithium Ion Battery - 850mAh 2 x SparkFun Cerberus USB Cable */ // Include the Library Code // Bluetooth BLE Device #include "BLEDevice.h" // SHARP Memory Display #include <Adafruit_SharpMem.h> // Adafruit GFX Library #include <Adafruit_GFX.h> // Date and Time #include "RTClib.h" // SD Card #include "FS.h" #include "SD.h" #include "SPI.h" // SHARP Memory Display // any pins can be used #define SHARP_SCK 13 #define SHARP_MOSI 12 #define SHARP_SS 27 // Set the size of the display here, e.g. 144x168! Adafruit_SharpMem display(SHARP_SCK, SHARP_MOSI, SHARP_SS, 144, 168); // The currently-available SHARP Memory Display (144x168 pixels) // requires > 4K of microcontroller RAM; it WILL NOT WORK on Arduino Uno // or other <4K "classic" devices. #define BLACK 0 #define WHITE 1 // 1/2 of lesser of display width or height int minorHalfSize; // The remote service we wish to connect to. static BLEUUID serviceUUID("7c394dc4-49a8-4c22-8a5b-b1612d8c13c1"); // The characteristic of the remote service we are interested in. static BLEUUID charUUID("a4c4cec2-f394-4f7a-b9de-89047feca74b"); // Use the same UUID as on the server static BLEUUID charTEMUUID("74bd92c6-89d0-4387-823e-97e7e0fb7a2b"); static BLEUUID charHUMUUID("1b63f246-b97f-4d2e-b8eb-f69e20a23a34"); static BLEUUID charBARUUID("43788175-37a7-4280-93c6-c690324d088e"); static BLEUUID charALTUUID("609deed9-a72d-45c3-aaba-14a73b0d8fda"); static BLEUUID charECOUUID("ab17aace-c0b9-4bd3-bb93-7715d9afaeea"); static BLEUUID charVOCUUID("6a8bf86a-9d40-457c-9f7f-f13a3d6803f1"); static boolean doConnect = false; static boolean connected = false; static boolean doScan = false; static BLERemoteCharacteristic* pRemoteCharacteristic; static BLERemoteCharacteristic* pRemoteCharacteristicTEM; static BLERemoteCharacteristic* pRemoteCharacteristicHUM; static BLERemoteCharacteristic* pRemoteCharacteristicBAR; static BLERemoteCharacteristic* pRemoteCharacteristicALT; static BLERemoteCharacteristic* pRemoteCharacteristicECO; static BLERemoteCharacteristic* pRemoteCharacteristicVOC; static BLEAdvertisedDevice* myDevice; float TEMValue; float HUMValue; float BARValue; float ALTValue; float ECOValue; float VOCValue; int iLED = 21; // Date and Time // PCF8523 Precision RTC RTC_PCF8523 rtc; String dateRTC = ""; String timeRTC = ""; // microSD Card const int chipSelect = 33; String zzzzzz = ""; // Software Version Information String sver = "26-27"; void loop() { // Bluetooth BLE isBluetoothBLE(); // Date and Time isRTC(); // Display Environmental isDisplayEnvironmental(); // microSD Card isSD(); }
getBluetoothBLE.ino
// Bluetooth BLE // isBluetoothBLE void isBluetoothBLE(){ // If the flag "doConnect" is true then we have scanned for // and found the desired // BLE Server with which we wish to connect. Now we connect to it. // Once we are connected we set the connected flag to be true. if (doConnect == true) { if (connectToServer()) { Serial.println("We are now connected to the BLE Server."); } else { Serial.println("We have failed to connect to the server; there is nothin more we will do."); } doConnect = false; } // If we are connected to a peer BLE Server, update the characteristic each time we are reached // with the current time since boot. if (connected) { String newValue = "Time since boot: " + String(millis()/1000); //Serial.println("Setting new characteristic value to \"" + newValue + "\""); // Set the characteristic's value to be the array of bytes that is actually a string. // pRemoteCharacteristic->writeValue(newValue.c_str(), newValue.length());//***********JKO }else if(doScan){ BLEDevice::getScan()->start(0); // this is just example to start scan after disconnect, most likely there is better way to do it in arduino } // read the Characteristics and store them in a variable // This also makes the print command do float handling TEMValue = pRemoteCharacteristicTEM->readFloat(); HUMValue = pRemoteCharacteristicHUM->readFloat(); BARValue = pRemoteCharacteristicBAR->readFloat(); ALTValue = pRemoteCharacteristicALT->readFloat(); ECOValue = pRemoteCharacteristicECO->readFloat(); VOCValue = pRemoteCharacteristicVOC->readFloat(); } // Notify Callback static void notifyCallback( BLERemoteCharacteristic* pBLERemoteCharacteristic, uint8_t* pData, size_t length, bool isNotify) { Serial.print("Notify callback for characteristic "); Serial.print(pBLERemoteCharacteristic->getUUID().toString().c_str()); Serial.print(" of data length "); Serial.println(length); Serial.print("data: "); Serial.println((char*)pData); } // My Client Callback class MyClientCallback : public BLEClientCallbacks { void onConnect(BLEClient* pclient) { } void onDisconnect(BLEClient* pclient) { connected = false; Serial.println("onDisconnect"); } }; // Connect To Server bool connectToServer() { Serial.print("Forming a connection to "); Serial.println(myDevice->getAddress().toString().c_str()); BLEClient* pClient = BLEDevice::createClient(); Serial.println(" - Created client"); pClient->setClientCallbacks(new MyClientCallback()); // Connect to the remove BLE Server. // if you pass BLEAdvertisedDevice instead of address, //it will be recognized type of peer device address (public or private) pClient->connect(myDevice); Serial.println(" - Connected to server"); //set client to request maximum MTU from server (default is 23 otherwise) pClient->setMTU(517); // Obtain a reference to the service we are after in the remote BLE server. BLERemoteService* pRemoteService = pClient->getService(serviceUUID); if (pRemoteService == nullptr) { Serial.print("Failed to find our service UUID: "); Serial.println(serviceUUID.toString().c_str()); pClient->disconnect(); return false; } Serial.println(" - Found our service"); // Obtain a reference to the characteristic in the service of the remote BLE server. pRemoteCharacteristic = pRemoteService->getCharacteristic(charUUID); if (pRemoteCharacteristic == nullptr) { Serial.print("Failed to find our characteristic UUID: "); Serial.println(charUUID.toString().c_str()); pClient->disconnect(); return false; } Serial.println(" - Found our characteristic"); // Temperature Obtain a reference to the characteristic in the service // of the remote BLE server. pRemoteCharacteristicTEM = pRemoteService->getCharacteristic(charTEMUUID); if (pRemoteCharacteristicTEM == nullptr) { Serial.print("Failed to find our characteristic UUID Temperature: "); Serial.println(charTEMUUID.toString().c_str()); pClient->disconnect(); return false; } // Humidity Obtain a reference to the characteristic in the service // of the remote BLE server. pRemoteCharacteristicHUM = pRemoteService->getCharacteristic(charHUMUUID); if (pRemoteCharacteristicHUM == nullptr) { Serial.print("Failed to find our characteristic UUID Temperature: "); Serial.println(charHUMUUID.toString().c_str()); pClient->disconnect(); return false; } Serial.println(" - Found our characteristic"); // Barometric Obtain a reference to the characteristic in the service // of the remote BLE server. pRemoteCharacteristicBAR = pRemoteService->getCharacteristic(charBARUUID); if (pRemoteCharacteristicBAR == nullptr) { Serial.print("Failed to find our characteristic UUID Barometric: "); Serial.println(charBARUUID.toString().c_str()); pClient->disconnect(); return false; } Serial.println(" - Found our characteristic"); // Altitude Obtain a reference to the characteristic in the service // of the remote BLE server. pRemoteCharacteristicALT = pRemoteService->getCharacteristic(charALTUUID); if (pRemoteCharacteristicALT == nullptr) { Serial.print("Failed to find our characteristic UUID Altitude: "); Serial.println(charALTUUID.toString().c_str()); pClient->disconnect(); return false; } // eCO2 Concentration Obtain a reference to the characteristic in the service // of the remote BLE server. pRemoteCharacteristicECO = pRemoteService->getCharacteristic(charECOUUID); if (pRemoteCharacteristicECO == nullptr) { Serial.print("Failed to find our characteristic UUID eCO2 Concentration: "); Serial.println(charECOUUID.toString().c_str()); pClient->disconnect(); return false; } Serial.println(" - Found our characteristic"); // tVOC Concentration Obtain a reference to the characteristic in the service // of the remote BLE server. pRemoteCharacteristicVOC = pRemoteService->getCharacteristic(charVOCUUID); if (pRemoteCharacteristicVOC == nullptr) { Serial.print("Failed to find our characteristic UUID tVOC Concentration: "); Serial.println(charVOCUUID.toString().c_str()); pClient->disconnect(); return false; } Serial.println(" - Found our characteristic"); // Read the value of the characteristic. if(pRemoteCharacteristic->canRead()) { std::string value = pRemoteCharacteristic->readValue(); Serial.print("The characteristic value was: "); Serial.println(value.c_str()); } if(pRemoteCharacteristic->canNotify()) pRemoteCharacteristic->registerForNotify(notifyCallback); connected = true; return true; } /** * Scan for BLE servers and find the first one that advertises the service we are looking for. */ class MyAdvertisedDeviceCallbacks: public BLEAdvertisedDeviceCallbacks { /** * Called for each advertising BLE server. */ void onResult(BLEAdvertisedDevice advertisedDevice) { Serial.print("BLE Advertised Device found: "); Serial.println(advertisedDevice.toString().c_str()); // We have found a device, let us now see if it contains the service we are looking for. if (advertisedDevice.haveServiceUUID() && advertisedDevice.isAdvertisingService(serviceUUID)) { BLEDevice::getScan()->stop(); myDevice = new BLEAdvertisedDevice(advertisedDevice); doConnect = true; doScan = true; } // Found our server } // onResult }; // MyAdvertisedDeviceCallbacks
getDisplay.ino
// Display // SHARP Memory Display - UID void isDisplayUID() { // Text Display // Clear Display display.clearDisplay(); display.setRotation(2); display.setTextSize(3); display.setTextColor(BLACK); // Don Luc Electronics display.setCursor(0,10); display.println( "Don Luc" ); display.setTextSize(2); display.setCursor(0,40); display.println( "Electronics" ); // Version display.setTextSize(3); display.setCursor(0,70); display.println( "Version" ); display.setTextSize(2); display.setCursor(0,100); display.println( sver ); display.setCursor(0,125); display.println( dateRTC ); display.setCursor(0,150); display.println( timeRTC ); // Refresh display.refresh(); delay( 5000 ); } // Display Environmental void isDisplayEnvironmental(){ // Text Display Environmental // Clear Display display.clearDisplay(); display.setRotation(2); display.setTextSize(2); display.setTextColor(BLACK); // Temperature Celsius display.setCursor(0,5); display.print( "T: " ); display.print( TEMValue ); display.println( "C" ); // Humidity display.setCursor(0,25); display.print( "H: " ); display.print( HUMValue ); display.println( "%" ); // Pressure display.setCursor(0,45); display.print( "B: " ); display.print( BARValue ); display.println( "" ); // Altitude Meters display.setCursor(0,65); display.print( "A: " ); display.print( ALTValue ); display.println( "M" ); // eCO2 Concentration display.setCursor(0,85); display.print( "C: " ); display.print( ECOValue ); display.println( "ppm" ); // tVOC Concentration display.setCursor(0,105); display.print( "V: " ); display.print( VOCValue ); display.println( "ppb" ); // Date display.setCursor(0,125); display.println( dateRTC ); // Time display.setCursor(0,145); display.println( timeRTC ); // Refresh display.refresh(); delay( 100 ); }
getRTC.ino
// Date & Time // PCF8523 Precision RTC void setupRTC() { // Date & Time // pcf8523 Precision RTC if (! rtc.begin()) { while (1); } if (! rtc.initialized()) { // Following line sets the RTC to the date & time this sketch was compiled rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); // This line sets the RTC with an explicit date & time, for example to set // January 21, 2014 at 3am you would call: //rtc.adjust(DateTime(2023, 7, 24, 11, 0, 0)); } } // Date and Time RTC void isRTC () { // Date and Time dateRTC = ""; timeRTC = ""; DateTime now = rtc.now(); // Date dateRTC = now.year(), DEC; dateRTC = dateRTC + "/"; dateRTC = dateRTC + now.month(), DEC; dateRTC = dateRTC + "/"; dateRTC = dateRTC + now.day(), DEC; // Time timeRTC = now.hour(), DEC; timeRTC = timeRTC + ":"; timeRTC = timeRTC + now.minute(), DEC; timeRTC = timeRTC + ":"; timeRTC = timeRTC + now.second(), DEC; }
getSD.ino
// microSD Card // microSD Setup void setupSD() { // microSD Card pinMode( chipSelect , OUTPUT ); if(!SD.begin( chipSelect )){ ; return; } uint8_t cardType = SD.cardType(); if(cardType == CARD_NONE){ ; return; } //Serial.print("SD Card Type: "); if(cardType == CARD_MMC){ ; } else if(cardType == CARD_SD){ ; } else if(cardType == CARD_SDHC){ ; } else { ; } uint64_t cardSize = SD.cardSize() / (1024 * 1024); } // microSD Card void isSD() { zzzzzz = ""; // BLE|Version|Date|Time|Temperature Celsius|Humidity|Barometric Pressure //|Altitude Meters|eCO2 Concentration|tVOC Concentration|* zzzzzz = "BLE|" + sver + "|" + dateRTC + "|" + timeRTC + "|" + TEMValue + "|" + HUMValue + "|" + BARValue + "|" + ALTValue + "|" + ECOValue + "|" + VOCValue + "|*\r"; char msg[zzzzzz.length() + 1]; zzzzzz.toCharArray(msg, zzzzzz.length() + 1); appendFile(SD, "/espdata.txt", msg ); } // List Dir void listDir(fs::FS &fs, const char * dirname, uint8_t levels){ dirname; File root = fs.open(dirname); if(!root){ return; } if(!root.isDirectory()){ return; } File file = root.openNextFile(); while(file){ if(file.isDirectory()){ file.name(); if(levels){ listDir(fs, file.name(), levels -1); } } else { file.name(); file.size(); } file = root.openNextFile(); } } // Write File void writeFile(fs::FS &fs, const char * path, const char * message){ path; File file = fs.open(path, FILE_WRITE); if(!file){ return; } if(file.print(message)){ ; } else { ; } file.close(); } // Append File void appendFile(fs::FS &fs, const char * path, const char * message){ path; File file = fs.open(path, FILE_APPEND); if(!file){ return; } if(file.print(message)){ ; } else { ; } file.close(); }
setup.ino
// Setup void setup() { // Serial Serial.begin(115200); Serial.println("Starting Arduino BLE Client application..."); // Initialize digital pin iLED as an output pinMode(iLED, OUTPUT); // Turn the LED on HIGH digitalWrite(iLED, HIGH); // SHARP Display start & clear the display display.begin(); display.clearDisplay(); // Date & Time RTC // PCF8523 Precision RTC setupRTC(); // Date & Time isRTC(); // Display UID isDisplayUID(); // microSD Card setupSD(); // Bluetooth BLE BLEDevice::init(""); // Give display time to power on delay(100); BLEScan* pBLEScan = BLEDevice::getScan(); pBLEScan->setAdvertisedDeviceCallbacks(new MyAdvertisedDeviceCallbacks()); pBLEScan->setInterval(1349); pBLEScan->setWindow(449); pBLEScan->setActiveScan(true); pBLEScan->start(5, false); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Programming Language
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
- Robotics
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Machine Learning
- RTOS
- Research & Development (R & D)
Instructor, E-Mentor, STEAM, and Arts-Based Training
- Programming Language
- IoT
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
Follow Us
Luc Paquin – Curriculum Vitae – 2023
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/
Don Luc