Project #11: ESP32 - Bluetooth IoT - Mk12
https://www.donluc.com/?p=4244
#DonLucElectronics #DonLuc #ESP32 #Bluetooth #Elecrow #DFRobot #Arduino #Project #Patreon #Electronics #Microcontrollers #IoT #Fritzing #Programming #Consultant
Bluetooth
Bluetooth is a short-range wireless technology standard that is used for exchanging data between fixed and mobile devices over short distances and building personal area networks. In the most widely used mode, transmission power is limited to 2.5 milliwatts, giving it a very short range of up to 10 metres. It employs UHF radio waves in the ISM bands, from 2.402 GHz to 2.48 GHz.
You can pair all kinds of Bluetooth devices with your PC, including keyboards, mice, phones, speakers, IoT, and a whole lot more. To do this, your PC needs to have Bluetooth. Some PCs, such as laptops and tablets, have Bluetooth built in. If your PC doesnââ¬â¢t, you can plug a USB Bluetooth adapter into the USB port on your PC to get it.
DL2501Mk01
1 x DFRobot FireBeetle 2 ESP32-E
1 x Fermion: 2.0" 320x240 IPS TFT LCD
1 x GDL Line 10 CM
1 x Crowtail- Rotary Angle Sensor 2.0 - 10K Ohm
1 x Crowtail- LED 2.0 - Yellow
1 x Crowtail- LED 2.0 - Green
1 x Lithium Ion Battery - 1000mAh
1 x Switch
1 x Bluetooth Serial Terminal for Windows 10
1 x USB 3.1 Cable A to C
FireBeetle 2 ESP32-E
POT - A0
LEG - 16
LEY - 17
DC - D2
CS - D6
RST - D3
RX2 - Bluetooth
TX2 - Bluetooth
VIN - +3.3V
GND - GND
DL2501Mk01p
DL2501Mk01p.ino
/****** Don Luc Electronics © ******
Software Version Information
Project #11: ESP32 - Bluetooth IoT - Mk12
11-12
DL2501Mk01p.ino
DL2501Mk01
1 x DFRobot FireBeetle 2 ESP32-E
1 x Fermion: 2.0" 320x240 IPS TFT LCD
1 x GDL Line 10 CM
1 x Crowtail- Rotary Angle Sensor 2.0 - 10K Ohm
1 x Crowtail- LED 2.0 - Yellow
1 x Crowtail- LED 2.0 - Green
1 x Lithium Ion Battery - 1000mAh
1 x Switch
1 x Bluetooth Serial Terminal for Windows 10
1 x USB 3.1 Cable A to C
*/
// Include the Library Code
// Arduino
#include <Arduino.h>
// Wire
#include <Wire.h>
// DFRobot Display GDL API
#include <DFRobot_GDL.h>
// Bluetooth Serial
#include "BluetoothSerial.h"
#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)
#error Bluetooth is not enabled! Please run `make menuconfig` to and enable it
#endif
// Bluetooth Serial
BluetoothSerial SerialBT;
// 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);
// Potentiometer
int iPot = A0;
int iPotVal = 0;
// Change Your Threshold Here
int Threshold = 2000;
// Full String
String FullString = "";
// LED Yellow
int iLEDY = 17;
// LED Green
int iLEDG = 16;
// Software Version Information
String sver = "11-12";
void loop() {
// Potentiometer
isPotentiometer();
// Delay 2 Second
delay( 2000 );
}
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("Don Luc Electronics");
// Don Luc Electronics
screen.setCursor(0, 60);
screen.println("DFRobot Display");
// Version
screen.setCursor(0, 90);
screen.println("Version");
screen.setCursor(0, 120);
screen.println( sver );
}
// isDisplay Green
void isDisplayG(){
// 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);
// Don Luc Electronics
screen.setCursor(0, 30);
screen.println("Don Luc Electronics");
// LED Yellow
screen.setCursor(0, 60);
screen.println("LED Green");
// Potentiometer Value
screen.setCursor(0, 90);
screen.println( iPotVal );
}
// isDisplay Yellow
void isDisplayY(){
// 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);
// Don Luc Electronics
screen.setCursor(0, 30);
screen.println("Don Luc Electronics");
// LED Yellow
screen.setCursor(0, 60);
screen.println("LED Yellow");
// Potentiometer Value
screen.setCursor(0, 90);
screen.println( iPotVal );
}
getPotentiometer.ino
// Potentiometer
// Potentiometer
void isPotentiometer(){
// Connect Potentiometer to Analog 0
iPotVal = analogRead( iPot );
// Threshold
if (iPotVal > Threshold) {
// LED Yellow
digitalWrite(iLEDY, LOW);
// isDisplay Green
isDisplayG();
// LED Green
digitalWrite(iLEDG, HIGH);
// FullString
FullString = "LED Green = " + String(iPotVal) + "\r\n";
}
else {
// LED Green
digitalWrite(iLEDG, LOW);
// isDisplay Yellow
isDisplayY();
// LED Yellow
digitalWrite(iLEDY, HIGH);
// FullString
FullString = "LED Yellow = " + String(iPotVal) + "\r\n";
}
// FullString Bluetooth Serial + Serial
for(int i = 0; i < FullString.length(); i++)
{
// Bluetooth Serial
SerialBT.write(FullString.c_str()[i]);
// Serial
Serial.write(FullString.c_str()[i]);
}
}
setup.ino
// Setup
void setup()
{
// Serial Begin
Serial.begin(115200);
Serial.println("Starting BLE work!");
// Bluetooth Serial
SerialBT.begin("Don Luc Electronics");
Serial.println("Bluetooth Started! Ready to pair...");
// Delay
delay(100);
// DFRobot Display 240x320
screen.begin();
// Delay
delay(100);
// Initialize the LED Yellow
pinMode(iLEDY, OUTPUT);
// Initialize the LED Green
pinMode(iLEDG, OUTPUT);
// DFRobot Display 240x320 - UID
// Don Luc Electronics
// Version
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/
Patreon: https://patreon.com/DonLucElectronics59
DFRobot: https://learn.dfrobot.com/user-10186.html
Elecrow: https://www.elecrow.com/share/sharepj/center/no/760816d385ebb1edc0732fd873bfbf13
TikTok: https://www.tiktok.com/@luc.paquin8
Twitch: https://www.twitch.tv/lucpaquin
LinkedIn: https://www.linkedin.com/in/jlucpaquin/
Don Luc