top of page
rodripage1728

Arduino/ESP32 class final project

Actualizado: 2 may 2021

Bluetooth, voice commands


In this class, we learn to use arduino and ESP32 to turn on different adjuncts like a fan, sensors, LEDs, a speaker and a potentiometer


First, let me explain about Arduino and the ESP32 module.

Arduino is a development platform based on a free hardware electronic board that incorporates a re-programmable microcontroller and a series of female pins. These allow to establish connections between the microcontroller and the different sensors and actuators in a very simple way (mainly with dupont cables).




The ESP32 module is an all-in-one, integrated and certified Wi-Fi / Bluetooth solution that provides not only wireless radio, but also an integrated processor with interfaces to connect to various peripherals. The processor actually has two processing cores whose operating frequencies can be independently controlled between 80 megahertz (MHz) and 240 MHz.


I had a lot o fun in this class, but also I had many complications, it was a challenge for me. For the final project we made the ESP32 bluetooth to interact with all the components, mainly LEDs, through voice commands


The code I made is the next:


#include <BluetoothSerial.h> //Library

BluetoothSerial ESP_BT;

String voice;

int BLUE = 32;

int ORANGE = 35;

int WHITE = 34;

int GREEN = 33;


void setup() {

Serial.begin(115200);

ESP_BT.begin("My ESP32_LED_Control_also some bluetooth"); //Change the name of your ESP32

pinMode(BLUE, OUTPUT);

pinMode(ORANGE, OUTPUT);

pinMode(WHITE, OUTPUT);

pinMode(GREEN, OUTPUT);

}


void loop() {

while(ESP_BT.available()) {

delay(10);

char c=ESP_BT.read();

if(c=='#')

{break; }

voice += c;

}


if (voice.length() > 0) {

ESP_BT.println(voice);

if (voice == "azul")

{

digitalWrite (BLUE, HIGH);


}

else if(voice =="azul" || voice =="blue on"){

digitalWrite (BLUE, HIGH);

}

else if(voice =="azul off"){

digitalWrite (BLUE, LOW);

}

}


//NARANJA


else if(voice =="naranja" || voice =="orange on"){

digitalWrite (ORANGE, HIGH);

}

else if(voice =="naranja off"){

digitalWrite (ORANGE, LOW);

}


//AMARILLO


else if(voice =="blanco" || voice =="blanco on"){

digitalWrite (WHITE, HIGH);

}

else if(voice =="blanco off"){

digitalWrite (WHITE, LOW);

}



//VERDE


else if(voice =="verde" || voice =="green on"){

digitalWrite (GREEN, HIGH);

}

else if(voice =="verde off"){

digitalWrite (GREEN, LOW);

}

voice="";




}






6 visualizaciones0 comentarios

Entradas Recientes

Ver todo

Comments


bottom of page