I’ve made some progress with the issue of watchdog timers (a known issue that affects ESP32’s running in the Arduino framework). The code is at least at a point now where it will self-recover in the event of a problem (and yes, there are still regular problems causing the device to reset).
What does this mean for you?
You can now set about using this as a solution for presence detection. I’ve added a LWT message to the code, so it will now let you know if the sensor node has gone down and needs a reset.
I just have a questions, since there is no Mac Look up.
How can this track individual people? I live in an apartment bloc and there is a lot of randomize BLE mac addresses around.
You’ll need to use an app on your phone to broadcast as a beacon. I’m still having trouble getting the device name, but I may have a better solution in the future.
Because this will only track BLE, you’ll need to configure your phone to broadcast a BLE advertisement. You can also track other BLE devices which advertise, such as dedicated beacon hardware, some fitness trackers, and other devices using a given BLE beacon standard (iBeacon, Eddystone, etc).
If you’re using an Android phone, check out the Beacon Scope app. You can emulate various beacons, and I’m using emulated iBeacons in my apartment to track a couple phones, and it’s working very reliably. You configure the device according to the docs, using the ID generated by the app.
Sounds like it’s time to put together a decent readme file. I’ll try and put some time into documentation soon (never been a strength of mine to document my work).
Now building it on Atom, but getting the error: C:/Users/Maxi1134/Documents/ESP32-mqtt-room-master/ESP32-mqtt-room.ino:27:28: fatal error: Settings_local.h: No such file or directory When trying to compile.
I’ve followed the Github instructions and modified both files.
You’re quick! I’m still working on the documentation and putting together a new release.
You’ll need to copy the Settings.h file to Settings_local.h and populate with your desired settings. Haven’t managed to automate the build process to do this for you yet.
Yeah, I am trying to do per room automation since I received those ESP32s a week ago. Got 7 of them to set up.
Pretty excited about this! I am uploading the firmware as soon as i get home. Turns out that the one I left pluged to my USB port is not usable trough RDP.
Okay, I’ve created a new release (v0.0.3) for the latest changes. Please make sure you’ve pulled before you upload to the devices. I’ve managed to include OTA updates from the PlatformIO command line, so going forward you won’t have to pull all your ESP32s out unless the device hard-faults into an irrecoverable state (hopefully that won’t happen).
Finally, the on-board LED is now useful! It’ll blink for 1/10th of a second for each device found during a scan, and will light solidly if the device isn’t connected to WiFi. During OTA updates, it will alternate blinking as the firmware is loaded onto the device.
Thanks man! Just did the update to my 7 ESP32s and all are working and reporting the position of people!
I’ve set the scan frequency to 1s and it is working.
I do see a LOT of disconnected from MQTT in the logs tho(After each scan). It does reconnect immediately and keeps working. But thought I’d let you know
That’s great news, actually. I’ve been waiting for MONTHS for ESP32s to arrive (ordered in September when I started this project). If you’re willing to help me test, can you open an issue on the GitHub repository?
The devices are likely crashing regularly, it’s a known bug in the Bluetooth/WiFi coexistence. I’ve managed to get it to a point where it should self-recover, so seeing the announcement and disconnection messages gives me some idea of the scope of the problem. You can try adjusting the scan duration to see if that has any impact, although a shorter scan in a busy environment may not give you optional results.
Hopefully the OTA will facilitate some testing. Unfortunately, I’m running out of memory space, so a full web UI won’t be possible from the ESP itself without some serious redesign.
Man, I am waiting to get this to work since months!
And I can’t buy multiple Zero Ws since I am in canada too.
I will be more than happy to assist you!
I have 7 of them So I can test on all of them to make sure it is not hardware issues when i encounter a bug.
Unfortunately, the Arduino framework implementation (used by PlatformIO) done by espressif appears to have a bug with the wifi/bluetooth coexistence. This means that your ESP32 will be doing something, but it’ll reboot itself regularly every time it crashes. Keep an eye on your network to make sure that it is able to self-recover.
I’ve finally gotten a few more ESP32 modules to work with. This means I’ll be able to put some load testing on these devices, just in time for the holidays. I expect to be putting in some time next week to get things to be a little more stable.
Sadly, what my testing has revealed is that it’s unlikely to be possible to get a solid, stable build that will maintain a WiFi connection (complete with MQTT listeners) while at the same time running a BLE scan. I’m hopeful that this will not be a fatal problem, as I can ideally maintain an open MQTT session while allowing the WiFi to take a back seat to the BLE scan. However, it adds complexity, and I’m not a “real” developer in C/C++, so you’ll have to bear with me.
What does this mean for you?
Likely, nothing. I’m going to continue chipping away at the bugs, and hopefully they’ll behave a little better. I expect to have a new release ready within the first couple weeks of the new year.
I am pretty new to Atom Platformio but I think I figured out how to load it into PlatformIO. However, when trying to build the project I am getting errors.
@ptrsnja, Thanks a lot! I am really looking forward to use this project for presence detection on room level. Would be fun to make music follow you through the house and also control the heating (personalized) and stuff like that
Okay, a new release has been published. v0.0.4 includes a fix for the breaking changes in AsyncTCP in the latest version of the espressif IDF.
If you run into difficulty building or uploading, you may need to remove the .piolibdeps folder and rebuild the project. This will clear out any older libraries brought in at the time you built the project.
I have removed the .piolibdeps folder and did a ‘build’. However, I am getting different errors now:
ip_api_call_data*)'
.piolibdeps\[email protected]\src\AsyncTCP.cpp:259:12: note: class type 'tcpip_api_call' is incomplete
struct tcpip_api_call call;
^
.piolibdeps\[email protected]\src\AsyncTCP.cpp: In function 'esp_err_t _tcp_bind(tcp_pcb*, ip_addr_t*, uint16_t)':
.piolibdeps\[email protected]\src\AsyncTCP.cpp:382:63: error: invalid conversion from 'err_t (*)(tcpip_api_call*) {aka signed char (*)(tcpip_api_call*)}' to 'tcpip_api_call_fn {aka sign
ed char (*)(tcpip_api_call_data*)}' [-fpermissive]
tcpip_api_call(_tcp_bind_api, (struct tcpip_api_call*)&msg);
^
.piolibdeps\[email protected]\src\AsyncTCP.cpp:382:63: error: cannot convert 'tcpip_api_call*' to 'tcpip_api_call_data*' for argument '2' to 'err_t tcpip_api_call(tcpip_api_call_fn, tcp
ip_api_call_data*)'
.piolibdeps\[email protected]\src\AsyncTCP.cpp:259:12: note: class type 'tcpip_api_call' is incomplete
struct tcpip_api_call call;
^
.piolibdeps\[email protected]\src\AsyncTCP.cpp: In function 'tcp_pcb* _tcp_listen_with_backlog(tcp_pcb*, uint8_t)':
.piolibdeps\[email protected]\src\AsyncTCP.cpp:397:65: error: invalid conversion from 'err_t (*)(tcpip_api_call*) {aka signed char (*)(tcpip_api_call*)}' to 'tcpip_api_call_fn {aka sign
ed char (*)(tcpip_api_call_data*)}' [-fpermissive]
tcpip_api_call(_tcp_listen_api, (struct tcpip_api_call*)&msg);
^
.piolibdeps\[email protected]\src\AsyncTCP.cpp:397:65: error: cannot convert 'tcpip_api_call*' to 'tcpip_api_call_data*' for argument '2' to 'err_t tcpip_api_call(tcpip_api_call_fn, tcp
ip_api_call_data*)'
.piolibdeps\[email protected]\src\AsyncTCP.cpp:259:12: note: class type 'tcpip_api_call' is incomplete
struct tcpip_api_call call;
^
.piolibdeps\[email protected]\src\AsyncTCP.cpp: At global scope:
.piolibdeps\[email protected]\src\AsyncTCP.cpp:624:6: error: prototype for 'void AsyncClient::_dns_found(ip_addr_t*)' does not match any in class 'AsyncClient'
void AsyncClient::_dns_found(ip_addr_t *ipaddr){
^
In file included from .piolibdeps\[email protected]\src\AsyncTCP.cpp:24:0:
.piolibdeps\[email protected]\src\AsyncTCP.h:84:10: error: candidate is: void AsyncClient::_dns_found(_ip_addr*)
void _dns_found(struct _ip_addr *ipaddr);
^
.piolibdeps\[email protected]\src\AsyncTCP.cpp:946:6: error: prototype for 'void AsyncClient::_s_dns_found(const char*, ip_addr_t*, void*)' does not match any in class 'AsyncClient'
void AsyncClient::_s_dns_found(const char * name, ip_addr_t * ipaddr, void * arg){
^
In file included from .piolibdeps\[email protected]\src\AsyncTCP.cpp:24:0:
.piolibdeps\[email protected]\src\AsyncTCP.h:164:17: error: candidate is: static void AsyncClient::_s_dns_found(const char*, _ip_addr*, void*)
static void _s_dns_found(const char *name, struct _ip_addr *ipaddr, void *arg);
^
*** [.pioenvs\esp32\libc9d\[email protected]\AsyncTCP.cpp.o] Error 1
[ERROR] Took 28.12 seconds
Sorry if I am doing something wrong, I am very new to Atom and PlatformIO.
I ran the command pio update from the terminal in the project directory: Updating tool-scons @ 2.20501.7 [Up-to-date] Updating tool-unity @ 1.20403.0 [Up-to-date] Updating contrib-pysite @ 2.27.181225 [Up-to-date] Updating contrib-piohome @ 2.0.0 [Up-to-date]