Page 1 of 1
[SOLVED] ESP32-CAM and EspSoftwareSerial with CamerWebServer
Posted: Mon Jul 29, 2019 9:14 am
by Federico66
Hallo,
has anyone tried to use EspSoftwareSerial (
https://github.com/plerup/espsoftwareserial) with ESP32-CAM?
I tried with simple tests to connect it with Arduino Uno and it works well, but as soon as I use it with the CamerWebServer sketch, ESP32-Cam can no longer identify the camera!
I tried with all the free pins, but the result is always the same.
For pin connection i used a Bi-Directional Logic Level Converter (3.3V<->5V)
I'm not using the SD card.
Code: Select all
//... omissis
#include <SoftwareSerial.h>
#define RX_PIN 2
#define TX_PIN 4
#define BAUD_RATE 57600
SoftwareSerial sSerial;
#define CAMERA_MODEL_AI_THINKER
//... omissis
void startCameraServer();
void setup() {
Serial.begin(115200);
Serial.setDebugOutput(true);
Serial.println();
sSerial.begin(BAUD_RATE, RX_PIN, TX_PIN, SWSERIAL_8N1, false, 95, 11);
//... omissis
sSerial.write(WiFi.localIP());
}
//... omissis
TIA
Federico
PS
Sorry for my english
Re: ESP32-CAM and EspSoftwareSerial with CamerWebServer
Posted: Tue Jul 30, 2019 4:08 am
by VladTheImpaler
Why would you use softserial on a chip with 2 hardware serial?
Do you understand softwareserial is a cripple going "bang" if there is a small delay in interrupt handling? Do you understand softserial wastes cpu cycles and is unreliable? Avoid that shit like tha plague.
If you insist on using softserial be aware the cam uses timer1 so your softcripple has to use timer2.
Re: ESP32-CAM and EspSoftwareSerial with CamerWebServer
Posted: Tue Jul 30, 2019 8:01 am
by Federico66
VladTheImpaler wrote:
Why would you use softserial on a chip with 2 hardware serial?
I'm sorry, I'm new to ESP32 and in the pinout of the ESP32-CAM module I only see U2RXD on GPIO16, but I don't see a U2TXD!
The GPIO17 (U2TXD) on the chip does not seem to be usable in this module.
So, how can I use the second hardware serial in ESP32-CAM?
VladTheImpaler wrote:
If you insist on using softserial be aware the cam uses timer1 so your softcripple has to use timer2.
Thanks for the information, I will keep it in mind
TIA
Federico
Re: ESP32-CAM and EspSoftwareSerial with CamerWebServer
Posted: Tue Jul 30, 2019 10:59 am
by lukas1000
I'm not an expert, but some days ago I used all 3 HW serial ports on an ESP32 Pico Kit.
As I now, you can map TX RX to nearly every pin you like.
Code: Select all
#include <HardwareSerial.h>
HardwareSerial mySerial(1);
HardwareSerial mySerial2(2);
uint8_t byteFromSerial;
void setup() {
Serial.begin(115200); 17 TX / 16 RX
mySerial.begin(115200, SERIAL_8N1, 23, 19); <- set your TX/RX Pin
mySerial2.begin(115200, SERIAL_8N1, 9, 10); <- set your TX/RX Pin
}
void loop() {
while (mySerial.available() > 0) {
byteFromSerial= mySerial.read();
Serial.write(byteFromSerial);
}
while (mySerial2.available() > 0) {
byteFromSerial= mySerial2.read();
Serial.write(byteFromSerial);
}
while (Serial.available() > 0) {
byteFromSerial = Serial.read();
mySerial.write(byteFromSerial);
mySerial2.write(byteFromSerial);
}
}
Re: ESP32-CAM and EspSoftwareSerial with CamerWebServer
Posted: Tue Jul 30, 2019 11:54 am
by VladTheImpaler
Define your own pins.
https://circuits4you.com/2018/12/31/esp ... 2-example/
"Like all peripherals, the pins for the UARTs can be logically mapped to any of the available pins on the ESP32. "
Re: ESP32-CAM and EspSoftwareSerial with CamerWebServer
Posted: Tue Jul 30, 2019 3:14 pm
by Federico66
VladTheImpaler wrote:
"Like all peripherals, the pins for the UARTs can be logically mapped to any of the available pins on the ESP32. "
I tried with pins 16 and 14 (RX2, TX2) and it seems to work, many thanks.
Still taking advantage of your availability, on ESP32-CAM, if I use the sd card, in addition to pin 16, there are no other pins available, correct?
TIA
Federico
Re: ESP32-CAM and EspSoftwareSerial with CamerWebServer
Posted: Mon Aug 05, 2019 6:19 pm
by Federico66
I solved by setting SDMMC to 1-line mode (SDMMC_HOST_FLAG_1BIT); in this mode the pins 4,12,13 are available, so I used pins 16 and 13 for a second hardware serial.
Federico
Re: [SOLVED] ESP32-CAM and EspSoftwareSerial with CamerWebServer
Posted: Sun Dec 01, 2019 11:20 pm
by wattexi
Hello, @Federico66 => I play with esp32-cam and I want to use "1-line mode" for use SoftwareSerial. I want to put myself in this mode but I do not know how. can you help me?
Federico66 wrote:
I solved by setting SDMMC to 1-line mode (SDMMC_HOST_FLAG_1BIT); in this mode the pins 4,12,13 are available, so I used pins 16 and 13 for a second hardware serial.
Federico
Re: [SOLVED] ESP32-CAM and EspSoftwareSerial with CamerWebServer
Posted: Wed Feb 17, 2021 4:03 pm
by nacxo@hotmail.com
Dear @federico66 can you say how we can do that?
Use finally gpios as UART por Hardware/Software comunication with other devices? (in my case Mp3-tf-16p)
I can use the next code without problems until y run the camera... then its reboot continiusly:
SoftwareSerial secondarySerial(14, 15); // RX, TX
DFMiniMp3<SoftwareSerial, Mp3Notify> mp3(secondarySerial);
PD: I get the cameraweb IDE demo and i dont use the sdcard so...