Hello everybody. I'm developing an electronic lock program using Arduino and ESP32. ESP32 checks the state of a document in Firebase, and if it's true, it releases the lock.
what is the role of the UNO ? the ESP32 is far more powerful - cannot it do the whole task?
this thread arduino-mega-2560-serial-communication-to-esp8266-nodemcu should give to some ideas for connecting the UNO to an ESP32
note:
I would have thought a level converter would enable the ESP32 3.3V to drive a 5V lock
however, it is possible to send serial data from an ESP32 to a UNO, e.g. the ESP32 can use Serial1 hardware port
// ESP32-CAM Serial1 test
#define RXD1 14
#define TXD1 15
void setup() {
// initialize both serial ports:
Serial.begin(115200);
Serial1.begin(9600, SERIAL_8N1, RXD1, TXD1);
Serial.println();
Serial.println("serial1 test Rx pin 14 Tx pin 15");
}
void loop() {
// read from port 1, send to port 0:
if (Serial1.available()) {
int inByte = Serial1.read();
Serial.write(inByte);
}
// read from port 0, send to port 1:
if (Serial.available()) {
int inByte = Serial.read();
//Serial.write(inByte);
Serial1.write(inByte);
}
}
note that the UNO uses 5V logic and the ESP32 3.3V logic therefore if you are sending sending from UNO to ESP32 you require a level converter on the UNO Tx signal
Hi,
Have you got the gnds of the ESP and the UNO connected?
Does "exactly" mean you must also use UART?
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
Hand drawn and photographed is perfectly acceptable.
Please include ALL hardware, component names and pin labels.
Just have the ESP32 drive a pin HIGH/LOW as if it were directly driving the lock.
The UNO does nothing but monitor the input from that pin, and drive an output pin for the lock.
No need for serial communications at all, just a highly inefficient 3.3V to 5V signal converter.
In fact, I chose UART because it was recommended. About the circuit by hand, I don't have one drawn, sorry, I'm extremely beginner in this arduino world. But I can post a picture of my assembled system if you want
Exactly, the ESP32 receives the lock status from Firebase (this part is already working), and sends the status to the Arduino Uno, which is responsible for opening or closing the lock.