Hello,
I have a program which communicates with android phone over serial bluetooth. (SerialBT) of ESP32. When my ESP32 is connected with my laptop, the bluetooth communication works fine. Here also after uploading the program first time I need to open the Serial monitor and only after that I can connect with ESP32 bluetooth. However after that if I remove and replug the laptop cable the Bluetooth communication works without Serial monitor.
When I power my ESP32 through external power supply, I am unable to connect with it from my app. I have checked the voltage supplied by the external power and it is providing 3.1V. I have tried pressing Enable button to reset the ESP32 but it has not helped either. Any inputs are appreciated.
My code is as follows.
#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 BluetoothSerial SerialBT; String t,h; int tval, hval; int thresholdH=0; int thresholdT=0; void setup() { // put your setup code here, to run once: Serial.begin(115200); SerialBT.begin("ESP32smarshoe"); //Bluetooth device name Serial.println("The device started, now you can pair it with bluetooth!"); } void loop() { // put your main code here, to run repeatedly: t="T"; h="H"; tval=analogRead(34); hval=analogRead(35); t+=tval; t+="T"; t+=hval; Serial.println(t); SerialBT.println(t); delay(200); }
Manoj
Hello Manoj and thanks for posting your question.
I haven’t used BluetoothSerial with the ESP32, yet. I have that topic lined up to be added to the ESP32 as the next Unit/Module.
Which ESP32 development board are you using?
- You need to provide 5V in the Vin pin or use a USB power source with 5V…
- Alternatively, you can power the ESP with 3.3V directly in the 3.3V pin, but you can’t just supply 3.1V…
Hello Rui,
Thanks for your prompt reply. I will try the alternatives you have suggested and revert back.
Hi Rui,
Thanks for your inputs. The problem got solved by providing 3.1V in the 3.3V pin. It also works with 5V USB but we didn’t use that option.
Thanks again.
Manoj