I wrote some code to send data between Arduino and esp32. For 2 reasons. Actually 3 and maybe more.
1st, I want the esp32 to know what the battery level is. I want it to sleep if the battery is low. I could have just added a voltage divider and wired it up to battery like the arduino, but it is deep in the mess of wires and has some hot glue holding it in place, didn't want to pull it and solder an analog wire on
2nd When the robot is being controlled manually, I'd like the sensors to be visible on the control webpage.
3rd, I may want to upload some or all of that data at some point.
Most of all of this is about timing, because if the ESP32 is asleep most the time, when it wakes up it sends a code over Serial to Arduino, and the arduino replies with the sensor readings, including the battery voltage.
I was having all sorts of issues debugging why it wasnt working properly. I did find some bugs and improve the serial code, but I was still having issues. Eventually I figured out the library I was using for the DHT11 sensor wasn't working properly. It would get stuck while trying to read the sensor. I just found a different library and it was working great after that.
The second issue is I want the arduino to sleep at times as well... what if the arduino is asleep when the esp32 wakes up and needs data?
I figured out I can wake the Arduino with the Serial RX pin. So when esp32 sends that control character, the device wakes up.
I am working on setting up a second wifi router I plan on having connected to a raspberry pi. the robot will use this wifi connection, and I am hoping I can tailscale into the pi and control the robot from anywhere in the world. We'll see...
my cat still doesnt know what to think of the MINIBOT.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.