Posts

Showing posts from March, 2022

Bluetooth Classic and Low Energy with Arduino IDE and ESP32

Image
 Welcome to Another Article...! Today's article will show how to use both Bluetooth Classic and Bluetooth Low Energy which featured in ESP32. Bluetooth feature in ESP32 allow data to be exchanged between it and an Android smartphone. STEP 1: Required Hardware and Software 1. ESP32 Development Board 2. PC (with Arduino IDE) 3. BMP280 sensor (any sensor will suffice) 4. Jumper wires 5. Breadboard 6. Android Smartphone (with Serial Bluetooth Terminal) STEP 2: Circuit Assembling Since BMP280 using I2C protocol, I will be using 4 pins. The pins are shown in picture below. STEP 3: Source Code The code will be shown below.  We include 3 libraries, those are "Wire.h" for I2C, "Adafruit_BMP280.h" for BMP280, and "BluetoothSerial.h" for bluetooth. Then initialize variable needed. For the setup, begin the serial and serial Bluetooth. I will be using "ESP32" for its name. Then initialize the BMP280 sensor. For the loop, it will print in Serial Bluetooth ...

Multiple I2C Devices using ESP32

Image
 Hello, Dear Reader! In today's article, I will be showing how to setup multiple devices with I2C communication protocol using ESP32 development board. It requires knowledge about I2C so make sure to find some information about the communication protocol. I2C Communication Protocol I2C (Inter-Integrated Circuit) is one of the serial communication protocol beside SPI and UART. It is a two line communication between modules which using SDA (Serial Data Line) and SCL (Serial Clock Line). It uses 2 pin which are GPIO 21 (SDA) and GPIO 22 (SCL) in ESP32. Even with only 2 pins, it can control 2 or more devices as long as the devices doesn't have same address. STEP 1: Required Hardware and Software 1. ESP32 Development Board, 2. PC (with Arduino IDE), 3. OLED display (I2C version), 4. BMP280 sensor, 5. Jumper wires, 6. Breadboard I will be using BMP280 and OLED display for both I2C devices. They have different address (0x3C for OLED and 0x76 or 0x77 for BMP280) so both devices can be ...