Posts

Showing posts from March, 2022

ESP32 Bluetooth Communication

Image
Welcome back to my blog! This week, I'm going to try experimenting with one of the wireless connections, Bluetooth. ESP32 has a built-in Bluetooth feature so we can readily use it. There are two kinds of Bluetooth connections: 1. Bluetooth classic, used for a wireless headset, speaker, or microphone 2. Bluetooth low energy, used for wearable devices such as health band Bluetooth Classic Now, let's experiment with the classic one first! First, you need to prepare a Bluetooth Terminal application for your smartphone. I'm using this Android application called "Serial Bluetooth Terminal" that you can download in Play Store. You also have to prepare the components (you'll use these components for all experiments for this week): 1. ESP32 2. Laptop/PC 3. Micro USB 4. Breadboard 5. Male-to-male jumper 6. LED 7. 330-ohm resistor 8. Smartphone Before starting the project to exchange data, we can test the Bluetooth connection first.  1. Connect ESP32 with a laptop/PC usi...

ESP32 I2C Serial Communication

Image
Welcome back to my blog! This week's project is about serial communication on ESP32, especially I2C. We'll try connecting ESP32 with the BMP280 sensor and OLED Display by this serial communication protocol.  I2C communication protocol uses two wires to share information, one for clock signal (SCL) and one for sending and receiving data (SDA). To connect devices with I2C, you have to know the addresses of its slaves (the devices controlled). It can be usually found on the component's datasheet. To connect multiple I2C devices, you just have to connect both peripherals to the ESP32 SCL and SDA lines and refer to each peripheral by its address in the code. For this project, we'll try to connect BMP280 sensor and OLED Display. These are the components you need to prepare before starting: 1. ESP32 2. OLED Display 3. BMP280 4. Breadboard 5. Male-to-male jumpers 6. Micro USB 7. Laptop/PC Before starting, make sure you've installed the required software like Arduino IDE and...

ESP32 OLED Display and ESP32 PWM

Image
Heelloo! Welcome back. This week's topic is to experiment with an external sensor and PWM. First, I'll talk about the external sensor. For this experiment, we are free to choose any external display. The most common displays used are LCDs, OLEDs, or TFTs. I'll use OLED for this experiment because its difference in price with LCD is not much but it can show wider display, bright colors, and has higher display response speed. The OLED I'm using looks like this. It is the SSD1306 model. It's a mono-color 0.96-inch display. It has four pins and I'll connect them all to the ESP32 in this tutorial. I followed the wiring in randomnerdtutorials . The VCC pin in OLED is connected to 3.3V, GND to GND, SCL to GPIO 22, and SDA to GPIO 21. We're using I2C so the most suitable pins for I2C communication in the ESP32 are GPIO 22 (SCL) and GPIO 21 (SDA). Before progressing even further, make sure you've installed Arduino IDE and prepare these components: 1. ESP32 2. OLE...