Page 6 of 14
Re: ESP32-CAM as doorbell with camera
Posted: Sunday 23 August 2020 23:00
by stack
Looks good.
Re: ESP32-CAM as doorbell with camera
Posted: Saturday 29 August 2020 18:46
by joostnl
Looking great! Upload your files if you have time i can help you improve it.
Re: ESP32-CAM as doorbell with camera
Posted: Saturday 29 August 2020 21:00
by hoeby
I am a little stuck with adding the wifi-manager.
Enough examples for esp8266 environment, but those are not working on an esp32. This is one which first needs to work.
As a start inhave taken the esp32camera example out the ode program.
Re: ESP32-CAM as doorbell with camera
Posted: Saturday 29 August 2020 22:05
by jvdz
I can have a look when you can share the current project. I've converted an esp8266 project using telegram/webserver and wifimanager to an esp32 and got that working. You do have to use the wifimanager development branch for esp32.
Jos
Re: ESP32-CAM as doorbell with camera
Posted: Sunday 30 August 2020 13:37
by hoeby
Could you say which branch you used?
Re: ESP32-CAM as doorbell with camera
Posted: Sunday 30 August 2020 13:46
by jvdz
The project I converted was a local private esp program I use, hence the request for your source as I don't have anything yet for this project.
I have no ESP with camera to test, but can at least check whether I am able to convert and compile it for esp32 and load it on an ESP32 without cam.
Jos
Re: ESP32-CAM as doorbell with camera
Posted: Monday 31 August 2020 19:07
by hoeby
This is what i have for now.
It is only the wifi-manager. I first want that to work and then build further.
This wifi-manager works.
It starts an AP with the name ESP-32-CAM (pass: 12345678)
I can choose a wifi-ssid and connect. All that works.
Now i have to extend the code, that it looks if there is a saved config. That it will not restart the wifi-manager.
When a ssid if configured, then it restart. After the restart it again start the wifi-manager. But it has not to do that, otherwise this unsecure AP stays open. It is unsecure, because the default password is online.
Code: Select all
#include <WiFi.h>
#include <WebServer.h> // https://github.com/zhouhan0126/WebServer-esp32
#include <DNSServer.h> // https://github.com/zhouhan0126/DNSServer---esp32
#include <WiFiManager.h> // https://github.com/zhouhan0126/WIFIMANAGER-ESP32
void setup() {
Serial.begin(115200);
WiFiManager wifiManager;
// wifiManager.setAPCallback(configModeCallback);
// wifiManager.setSaveConfigCallback(saveConfigCallback);
wifiManager.autoConnect("ESP_32_CAM", "12345678");
if(!wifiManager.startConfigPortal("ESP_32_CAM", "12345678") ){
Serial.println("Failed, going to restart");
delay(2000);
ESP.restart();
delay(1000);
}
Serial.println("Connect to ESP_32_CAM");
}
void loop() {
}
Re: ESP32-CAM as doorbell with camera
Posted: Monday 31 August 2020 19:46
by jvdz
You basically start the portal after you successfully connected to the WiFi with this line:
Code: Select all
if(!wifiManager.startConfigPortal("ESP_32_CAM", "12345678") ){
Just look at the examples you find it the library, but basic operation is to simply remove that if block.
Code: Select all
void setup()
{
Serial.begin(115200);
WiFiManager wifiManager;
wifiManager.autoConnect("ESP_32_CAM", "12345678");
Serial.println("Connected to WiFi");
}
Jos
Re: ESP32-CAM as doorbell with camera
Posted: Monday 31 August 2020 20:28
by hoeby
Changed the code to this.
It looks to work. Is this a good way to program this kind of feature?
Next on the road: Find a way that the IP-address, when connected to the SSID, is projected on a page. So you know to which IP to connect.
Code: Select all
#include <WiFi.h>
#include <WebServer.h> // https://github.com/zhouhan0126/WebServer-esp32
#include <DNSServer.h> // https://github.com/zhouhan0126/DNSServer---esp32
#include <WiFiManager.h> // https://github.com/zhouhan0126/WIFIMANAGER-ESP32
void setup() {
Serial.begin(115200);
WiFiManager wifiManager;
// wifiManager.setAPCallback(configModeCallback);
// wifiManager.setSaveConfigCallback(saveConfigCallback);
wifiManager.autoConnect("ESP_32_CAM", "12345678");
if (WiFi.SSID() =="") {
if(!wifiManager.startConfigPortal("ESP_32_CAM", "12345678") ){
Serial.println("Failed, going to restart");
delay(2000);
ESP.restart();
delay(1000);
} else {
Serial.println("Connect to SSID");
}
}
if (WiFi.status()!=WL_CONNECTED){
Serial.println("failed to connect, finishing setup anyway");
} else{
Serial.print("local ip: ");
Serial.println(WiFi.localIP());
}
}
void loop() {
}
Re: ESP32-CAM as doorbell with camera
Posted: Monday 31 August 2020 21:20
by jvdz
Not sure why you have coded it that way with the 2 if's. They do not really serve a purpose, but guess it should work.
To get the IP address is easy: "WiFi.localIP().toString()" returns a String with the IP address.
Jos
Re: ESP32-CAM as doorbell with camera
Posted: Monday 31 August 2020 22:28
by hoeby
The double if:
The idea is to use it because if (WiFi.SSID() =="") closes not all posibilities.
example, you connect to wifi-ssid-1, but your home network changes to wifi-ssid-2.
Then the extra if could start the portal again, so you can access it. Otherwise you never can access again, without modifying the code.
Of course it is on the wishlist, that there will be a html page, where you could remove it, but this is just in case
Re: ESP32-CAM as doorbell with camera
Posted: Monday 31 August 2020 23:00
by jvdz
The portal will always start when it is unable to connect to the saved SID, so that logic isn't needed as far as I know.
Just give it a try and you will see.
Re: ESP32-CAM as doorbell with camera
Posted: Tuesday 01 September 2020 8:21
by hoeby
It looks like this line
"WiFi.localIP().toString()" isn't going to work.
When testing the portal opens and starts the AP on the ESP. Then there is a wifi setup done and after that the AP is closed and it connects to its wifi.
Then the connetion to 192.168.4.1 is already lost when i want to do the
"WiFi.localIP().toString()"
To get that working, it needs to be added in the library.
Is my thinking right?
Also strange, i don't see these Serial lines in the monitor. It stays at a serial which starts with a
(WM). Looks like the serial from the wifimanager.
Code: Select all
if (WiFi.status()!=WL_CONNECTED){
Serial.println("failed to connect, finishing setup anyway");
} else{
Serial.print("local ip: ");
Serial.println(WiFi.localIP());
}
Re: ESP32-CAM as doorbell with camera
Posted: Tuesday 01 September 2020 9:52
by jvdz
No sure I understand what you mean... this seems to work fine:
Code: Select all
#include <WiFi.h>
#include <WebServer.h> // https://github.com/zhouhan0126/WebServer-esp32
#include <DNSServer.h> // https://github.com/zhouhan0126/DNSServer---esp32
#include <WiFiManager.h> // https://github.com/zhouhan0126/WIFIMANAGER-ESP32
void setup()
{
Serial.begin(115200);
delay(1000);
WiFiManager wifiManager;
wifiManager.autoConnect("ESP_32_CAM", "12345678");
Serial.println("Connected to Wifi");
Serial.print("local ip: ");
Serial.println(WiFi.localIP());
}
void loop()
{
Serial.print("local ip: ");
Serial.println(WiFi.localIP());
delay(1000);
}
Re: ESP32-CAM as doorbell with camera
Posted: Saturday 05 September 2020 14:04
by hoeby
Started on V2, but also stopped with it.
This goes out of my head to get those things working.
Got the camera working, but then i don't get it to work to build an active webpage for your settings.
When i start with an active wegpage for the settings, then the camera isn't working.
The wifimanager was the first thing i dropped in the bin, didn't got it to work that i get full control back.
I parked it. Maybe something in the future, but for now i will keep the code i changed a few pages back.
i am not a programmer and need to everything with google. this is going to take to much time i don't want to spend to it.
ps.
can't share the code i had for V2. Tried that many things, that the code isn't working anymore at all
Re: ESP32-CAM as doorbell with camera
Posted: Wednesday 09 September 2020 21:48
by stack
Anyway thanks for your time in this project, been running v1 for a while and very happy. We may see an update in the future.
Re: ESP32-CAM as doorbell with camera
Posted: Thursday 10 September 2020 13:15
by hoeby
stack wrote: ↑Saturday 01 August 2020 8:55
want to use motioneye for motion detection
Could you tell me what you do with the motion detection?
Does it send a message, flips a switch or triggers a script?
Would love to know, where you use this function for.
Re: ESP32-CAM as doorbell with camera
Posted: Friday 11 September 2020 15:08
by stack
motion detection is an addition to this doorbell.
This goes via motioneye and it gives a telegram message with a screenshot when there is movement.
Re: ESP32-CAM as doorbell with camera
Posted: Friday 11 September 2020 17:32
by hoeby
Is that the only reason you have it on motioneye, to do the motion detection?
Re: ESP32-CAM as doorbell with camera
Posted: Sunday 13 September 2020 22:00
by stack
hoeby wrote: ↑Friday 11 September 2020 17:32
Is that the only reason you have it on motioneye, to do the motion detection?
yes for now