Compare commits

...

88 Commits

Author SHA1 Message Date
Miroslav Pivovarsky db0112e9c2
Update README.md 2025-01-02 21:28:35 +01:00
Miroslav Pivovarsky 9a70b1c31b update picture 2025-01-02 21:27:35 +01:00
Miroslav Pivovarsky d42ba99511 added picture 2025-01-02 21:19:43 +01:00
Miroslav Pivovarsky 0b1f3b75cd
Merge pull request #67 from devsfan3/patch-1
Update README
2025-01-02 21:01:26 +01:00
Miroslav Pivovarsky 8dd9cf66e9 fix typo 2025-01-02 20:18:19 +01:00
Miroslav Pivovarsky 10cb00fdcd update build script 2025-01-02 20:17:04 +01:00
Miroslav Pivovarsky 5608b4c4c4 added ESP32-S3 WROOM Freenove board 2025-01-02 20:16:52 +01:00
Miroslav Pivovarsky df58d5d5cb update libs 2025-01-02 20:16:06 +01:00
Miroslav Pivovarsky 80711f9722
Update mcu_cfg.h 2025-01-02 20:12:03 +01:00
Miroslav Pivovarsky d7e39a1a4d
Merge pull request #92 from muesli/bump-version
Bump to v1.1.1
2025-01-02 20:08:52 +01:00
Miroslav Pivovarsky 5888e42c9d
Update README.md 2024-12-28 13:05:06 +01:00
Miroslav Pivovarsky 1770b0bc62
Update README.md 2024-12-28 13:03:55 +01:00
Miroslav Pivovarsky 734fe6325b Updated documentation for ESP32-S3 WROOM Freenove 2024-12-28 12:58:21 +01:00
Miroslav Pivovarsky e93f7ee0e4 update pinout for ESP32-S3 wroom Freenove 2024-12-28 12:55:25 +01:00
Miroslav Pivovarsky 999968ef94 Added support for ESP32-S3 Wroom Freenove 2024-12-27 23:34:48 +01:00
Miroslav Pivovarsky 8180aa84c0 update libs 2024-12-27 23:33:40 +01:00
Christian Muehlhaeuser 7a90f47a1e Bump to v1.1.1 2024-12-03 00:08:31 +01:00
Miroslav Pivovarsky aebd048651 Merge branch 'master' of https://github.com/prusa3d/Prusa-Firmware-ESP32-Cam 2024-11-26 21:58:37 +01:00
Miroslav Pivovarsky 607c768832 update jquery lib to 3.7.1 2024-11-26 21:58:18 +01:00
Miroslav Pivovarsky 41fad4bcd3 change stack size 2024-11-26 21:57:49 +01:00
Miroslav Pivovarsky 5d0527e7a2
Merge pull request #89 from muesli/readme-link
Fix Freenove ESP32-S3 link
2024-11-25 16:59:27 +01:00
Christian Muehlhaeuser bc8d613edb Fix Freenove ESP32-S3 link 2024-11-22 02:44:43 +01:00
Miroslav Pivovarsky 78ed136785 update readme 2024-11-20 21:15:35 +01:00
Miroslav Pivovarsky 1e22640cdf update tasks stack size 2024-11-20 21:15:18 +01:00
Miroslav Pivovarsky d55035b31a Added FW version in the info message for the Prusa Connect 2024-11-20 21:14:27 +01:00
Miroslav Pivovarsky d9394e4c6b Update libs. arduino-esp32, ESPAsyncWebServer, AsyncTCP, ArduinoJson, DHTnew 2024-11-20 21:13:53 +01:00
Miroslav Pivovarsky cf6af3958f regenerate WebPage.h 2024-11-20 21:13:00 +01:00
Miroslav Pivovarsky cd63bcb8ad init freenove esp32-s3-wroom cam docu 2024-11-20 21:09:24 +01:00
Miroslav Pivovarsky 7148425bd6
Merge pull request #88 from muesli/readme-cleanup
Typo and rewording of the central README
2024-11-20 20:46:55 +01:00
Christian Muehlhaeuser e5814de1ad Typo and rewording of the central README 2024-11-19 10:52:56 +01:00
Miroslav Pivovarsky 6f787e3f9d
Merge pull request #87 from muesli/typo-readme
Fix various typos in READMEs
2024-11-19 07:26:07 +01:00
Christian Muehlhaeuser fab36176f7 Fix various typos in READMEs 2024-11-19 06:13:28 +01:00
Miroslav Pivovarsky 08a3f076ab
Merge pull request #77 from ZevEisenberg/master
Fix typos and add .gitignore
2024-11-18 20:58:55 +01:00
Miroslav Pivovarsky 1394cc891f
Merge pull request #80 from muesli/typo-erase
Fix "erase" typo in docs
2024-11-18 20:58:04 +01:00
Miroslav Pivovarsky 09fce11834
Merge pull request #83 from ZevEisenberg/patch-1
Indicate that the printer must be powered on
2024-11-18 20:57:40 +01:00
Miroslav Pivovarsky e73241d68b
Merge pull request #86 from BNoiZe/patch-1
Update README.md
2024-11-18 20:57:13 +01:00
Roman Schmerold 948ebdbd4d
Update README.md
Fixed a typo (--erase-all)
2024-11-17 21:37:39 +01:00
Zev Eisenberg 4b2fde2a21
Indicate that the printer must be powered on. 2024-10-30 22:49:11 -04:00
Christian Muehlhaeuser ba3d4660c7 Fix typo in docs 2024-10-26 00:47:55 +02:00
Zev Eisenberg 4edd60f1c3 Clarify comments. 2024-10-21 22:52:59 -04:00
Zev Eisenberg 39f10d23df Fix copypasta action comment. 2024-10-21 22:51:15 -04:00
Zev Eisenberg b29b541eb3 Add newline at end of file. 2024-10-21 22:31:03 -04:00
Zev Eisenberg a80b349576 Wording. 2024-10-21 22:30:56 -04:00
Zev Eisenberg 9b9fc6cf8a Add .gitignore. 2024-10-21 22:27:53 -04:00
Zev Eisenberg 49c4bb80fe Pluralize seconds. 2024-10-21 22:23:28 -04:00
devsfan3 8e87eaca88
Add files via upload 2024-09-12 17:12:45 -05:00
devsfan3 b29945df10
Update README.md 2024-09-12 17:12:13 -05:00
devsfan3 009ff6741c
Update README.md
Added a how-to on how to use ESP Tool on Chrome to flash boards.
2024-09-12 17:06:02 -05:00
Miroslav Pivovarsky 6d13443061
Update README.md 2024-08-30 22:41:02 +02:00
Miroslav Pivovarsky 5a78bc6df3
Update README.md 2024-08-30 22:39:37 +02:00
Miroslav Pivovarsky 65383926d7
Update README.md 2024-08-30 22:39:18 +02:00
Miroslav Pivovarsky 92a8ccfe75
Update README.md 2024-08-30 22:38:53 +02:00
Miroslav Pivovarsky 24e71d5ade
Update README.md 2024-08-30 22:37:34 +02:00
Miroslav Pivovarsky fa57491e22
Merge pull request #60 from OniriCorpe/patch-1
set wifi password input field as a "password" type
2024-08-22 22:06:59 +02:00
OniriCorpe 496fd111af
set wifi password input field as a "password" type
else the autocorrection is enabled on smartphone and it's really annoying af
2024-08-13 13:38:53 +02:00
Miroslav Pivovarsky 5c420e384c
Update README.md 2024-08-05 21:36:30 +02:00
Miroslav Pivovarsky 8d6c15d3f2 Merge branch 'master' of https://github.com/prusa3d/Prusa-Firmware-ESP32-Cam 2024-08-05 18:25:26 +02:00
Miroslav Pivovarsky 9bd5861a0c updated arduino-esp32 to 3.0.4 2024-08-05 18:23:57 +02:00
Miroslav Pivovarsky b5872f4cf9
Update README.md 2024-08-03 21:53:35 +02:00
Miroslav Pivovarsky 0d94e0a069 Merge branch 'master' of https://github.com/prusa3d/Prusa-Firmware-ESP32-Cam 2024-08-03 21:52:37 +02:00
Miroslav Pivovarsky 218a3cb02d updated WiFi WDG 2024-08-03 21:47:15 +02:00
Miroslav Pivovarsky be284668b1 update arduino-esp32 to 3.0.3 2024-08-03 21:44:39 +02:00
Miroslav Pivovarsky 627b951155 added serial command loglevel 2024-08-03 21:44:09 +02:00
Miroslav Pivovarsky 87b950ad2e
Update README.md 2024-08-02 20:06:15 +02:00
Miroslav Pivovarsky 6bf260b72c Added a parameter to disable password checks for WiFi AP networks that are not encrypted. 2024-07-31 21:26:34 +02:00
Miroslav Pivovarsky 71de485127 added help 2024-07-31 21:00:26 +02:00
Miroslav Pivovarsky 84f4c965a2
Update README.md 2024-07-18 21:08:58 +02:00
Miroslav Pivovarsky cff7cf2d19
Update README.md 2024-07-18 21:03:53 +02:00
Miroslav Pivovarsky ed6e85c494
Update README.md 2024-07-18 20:38:01 +02:00
Miroslav Pivovarsky dc4a0a6d40 Merge branch 'master' of https://github.com/prusa3d/Prusa-Firmware-ESP32-Cam 2024-07-12 23:37:00 +02:00
Miroslav Pivovarsky d1949c0159 update docu 2024-07-12 23:36:35 +02:00
Miroslav Pivovarsky 1c44231b82 update docu 2024-07-12 23:31:45 +02:00
Miroslav Pivovarsky c314783328 update docu 2024-07-12 22:25:31 +02:00
Miroslav Pivovarsky b559cbaa42 update build script 2024-07-12 22:00:28 +02:00
Miroslav Pivovarsky 220573519a update 2024-07-12 22:00:01 +02:00
Miroslav Pivovarsky 3f85abd5f3 update cfg for the ESP32-S3-cam board 2024-07-12 21:58:19 +02:00
Miroslav Pivovarsky 2dedf106d1 disable WiFi sleep 2024-07-12 21:56:58 +02:00
Miroslav Pivovarsky 3eb1262366 changed function for sending big data from WEB server 2024-07-12 21:56:09 +02:00
Miroslav Pivovarsky 44e6028a0a update stack size 2024-07-12 21:54:50 +02:00
Miroslav Pivovarsky 20d030c808 added default cfg for the external temperature sensor 2024-07-12 21:53:50 +02:00
Miroslav Pivovarsky adf6747aa9 added support for the ESP32-S3-CAM board 2024-07-12 21:52:54 +02:00
Miroslav Pivovarsky b64d86d308 "Added support for an external temperature sensor to more boards. 2024-07-12 21:51:29 +02:00
Miroslav Pivovarsky d17f037507 added css version, and added notification for sending snapshot 2024-07-12 21:50:13 +02:00
Miroslav Pivovarsky 572da07167 Update ESPAsyncWebServer to 3.0.6 2024-07-12 21:46:53 +02:00
Miroslav Pivovarsky ed92eb2fdb update FW name for XIAO cam 2024-07-12 21:46:45 +02:00
Miroslav Pivovarsky 7a787943dd added support for the XIAO ESP32-S3 2024-07-12 21:45:22 +02:00
Miroslav Pivovarsky e99a5b6afa First version of the external temperature/humidity sensor 2024-07-12 21:44:08 +02:00
Miroslav Pivovarsky b0c88946b4
Update README.md 2024-06-30 11:26:05 +02:00
204 changed files with 344854 additions and 243 deletions

70
.gitignore vendored Normal file
View File

@ -0,0 +1,70 @@
# Created by https://www.toptal.com/developers/gitignore/api/c++,macos
# Edit at https://www.toptal.com/developers/gitignore?templates=c++,macos
### C++ ###
# Prerequisites
*.d
# Compiled Object files
*.slo
*.lo
*.o
*.obj
# Precompiled Headers
*.gch
*.pch
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# Fortran module files
*.mod
*.smod
# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# Executables
*.out
*.app
### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### macOS Patch ###
# iCloud generated files
*.icloud
# End of https://www.toptal.com/developers/gitignore/api/c++,macos

View File

@ -8,11 +8,12 @@
This project uses other libraries. It is necessary to install them in the arduino IDE.
- Library - License - Version - Link
- ESPAsyncWebServer - LGPL 3.0 - 3.0.3 - https://github.com/mathieucarbou/ESPAsyncWebServer
- AsyncTCP - LGPL 3.0 - 3.1.4 - https://github.com/mathieucarbou/AsyncTCP
- ArduinoJson - MIT - 7.1.0 - https://github.com/bblanchon/ArduinoJson
- ESPAsyncWebServer - LGPL 3.0 - 3.4.5 - https://github.com/mathieucarbou/ESPAsyncWebServer
- AsyncTCP - LGPL 3.0 - 3.3.1 - https://github.com/mathieucarbou/AsyncTCP
- ArduinoJson - MIT - 7.3.0 - https://github.com/bblanchon/ArduinoJson
- ArduinoUniqueID - MIT - 1.3.0 - https://github.com/ricaun/ArduinoUniqueID
- arduino-esp32 - LGPL 2.1 - 3.0.2 - https://github.com/espressif/arduino-esp32
- arduino-esp32 - LGPL 2.1 - 3.1.0 - https://github.com/espressif/arduino-esp32
- DHTnew - MIT - 0.5.2 - https://github.com/RobTillaart/DHTNew
Arduino IDE configuration for the MCU are stored in the module_XXX.h file.
@ -95,6 +96,9 @@ void setup() {
/* init class for communication with PrusaConnect */
Connect.Init();
/* init external temperature sensor */
ExternalTemperatureSensor.Init();
/* init wdg */
SystemLog.AddEvent(LogLevel_Info, F("Init WDG"));
esp_task_wdt_config_t twdt_config;
@ -102,28 +106,28 @@ void setup() {
twdt_config.idle_core_mask = (1 << portNUM_PROCESSORS) - 1, /* Bitmask of all cores */
twdt_config.trigger_panic = true;
esp_task_wdt_init(&twdt_config); /* enable panic so ESP32 restarts */
esp_task_wdt_init(&twdt_config); /* enable panic so ESP32 restarts */
esp_task_wdt_reconfigure(&twdt_config);
ESP_ERROR_CHECK(esp_task_wdt_add(NULL)); /* add current thread to WDT watch */
esp_task_wdt_reset(); /* reset wdg */
ESP_ERROR_CHECK(esp_task_wdt_add(NULL)); /* add current thread to WDT watch */
esp_task_wdt_reset(); /* reset wdg */
/* init tasks */
SystemLog.AddEvent(LogLevel_Info, F("Start tasks"));
xTaskCreatePinnedToCore(System_TaskMain, "SystemNtpOtaUpdate", 6200, NULL, 1, &Task_SystemMain, 0); /*function, description, stack size, parameters, priority, task handle, core*/
xTaskCreatePinnedToCore(System_TaskMain, "SystemNtpOtaUpdate", 5200, NULL, 1, &Task_SystemMain, 0); /*function, description, stack size, parameters, priority, task handle, core*/
ESP_ERROR_CHECK(esp_task_wdt_add(Task_SystemMain));
xTaskCreatePinnedToCore(System_TaskCaptureAndSendPhoto, "CaptureAndSendPhoto", 4400, NULL, 2, &Task_CapturePhotoAndSend, 0); /*function, description, stack size, parameters, priority, task handle, core*/
ESP_ERROR_CHECK(esp_task_wdt_add(Task_CapturePhotoAndSend));
xTaskCreatePinnedToCore(System_TaskWifiManagement, "WiFiManagement", 2800, NULL, 3, &Task_WiFiManagement, 0); /*function, description, stack size, parameters, priority, task handle, core*/
xTaskCreatePinnedToCore(System_TaskWifiManagement, "WiFiManagement", 2700, NULL, 3, &Task_WiFiManagement, 0); /*function, description, stack size, parameters, priority, task handle, core*/
ESP_ERROR_CHECK(esp_task_wdt_add(Task_WiFiManagement));
#if (true == ENABLE_SD_CARD)
xTaskCreatePinnedToCore(System_TaskSdCardCheck, "CheckMicroSdCard", 3000, NULL, 4, &Task_SdCardCheck, 0); /*function, description, stack size, parameters, priority, task handle, core*/
ESP_ERROR_CHECK(esp_task_wdt_add(Task_SdCardCheck));
#endif
xTaskCreatePinnedToCore(System_TaskSerialCfg, "CheckSerialConfiguration", 2600, NULL, 5, &Task_SerialCfg, 0); /*function, description, stack size, parameters, priority, task handle, core*/
xTaskCreatePinnedToCore(System_TaskSerialCfg, "CheckSerialConfiguration", 2300, NULL, 5, &Task_SerialCfg, 0); /*function, description, stack size, parameters, priority, task handle, core*/
ESP_ERROR_CHECK(esp_task_wdt_add(Task_SerialCfg));
xTaskCreatePinnedToCore(System_TaskStreamTelemetry, "PrintStreamTelemetry", 2200, NULL, 6, &Task_StreamTelemetry, 0); /*function, description, stack size, parameters, priority, task handle, core*/
ESP_ERROR_CHECK(esp_task_wdt_add(Task_StreamTelemetry));
xTaskCreatePinnedToCore(System_TaskSysLed, "SystemLed", 2100, NULL, 7, &Task_SysLed, 0); /*function, description, stack size, parameters, priority, task handle, core*/
xTaskCreatePinnedToCore(System_TaskSystemTelemetry, "PrintSystemTelemetry", 2200, NULL, 6, &Task_SystemTelemetry, 0); /*function, description, stack size, parameters, priority, task handle, core*/
ESP_ERROR_CHECK(esp_task_wdt_add(Task_SystemTelemetry));
xTaskCreatePinnedToCore(System_TaskSysLed, "SystemLed", 2000, NULL, 7, &Task_SysLed, 0); /*function, description, stack size, parameters, priority, task handle, core*/
ESP_ERROR_CHECK(esp_task_wdt_add(Task_SysLed));
xTaskCreatePinnedToCore(System_TaskWiFiWatchdog, "WiFiWatchdog", 2200, NULL, 8, &Task_WiFiWatchdog, 0); /*function, description, stack size, parameters, priority, task handle, core*/
ESP_ERROR_CHECK(esp_task_wdt_add(Task_WiFiWatchdog));

View File

@ -0,0 +1,151 @@
/**
@file ExternalTemperatureSensor.cpp
@brief Library for external temperature sensor control
@author Miroslav Pivovarsky
Contact: miroslav.pivovarsky@gmail.com
@bug: no know bug
*/
#include "ExternalTemperatureSensor.h"
ExternalSensor ExternalTemperatureSensor(DHT_SENSOR_PIN, DHT_SENSOR_ENABLE, &SystemLog, &SystemConfig);
ExternalSensor::ExternalSensor(uint8_t i_pin, bool i_enable, Logs *i_log, Configuration *i_cfg) : DhtSensor(i_pin) {
Pin = i_pin;
SystemEnable = i_enable;
log = i_log;
config = i_cfg;
}
void ExternalSensor::Init() {
log->AddEvent(LogLevel_Info, F("Init external temperature sensor"));
Unit = (TemperatureSensorUnit_enum) config->LoadExternalTemperatureSensorUnit();
UserEnable = config->LoadExternalTemperatureSensorEnable();
//DhtSensor.setHumOffset(10);
//DhtSensor.setTempOffset(-3.5);
ReadSensorData();
}
String ExternalSensor::GetSensorStatus() {
String status = "";
if (false == SystemEnable) {
status = "Unsupport sensor";
} else if (false == UserEnable) {
status = "Sensor disabled";
} else {
status = "Detected: ";
SensorType = DhtSensor.getType();
switch (SensorType) {
case 0:
status += "not defined";
break;
case 11:
status += "DHT11";
break;
case 22:
status += "DHT22";
break;
case 23:
status += "DHT22";
break;
case 70:
status += "Sonoff Si7021";
break;
default:
status += "Unknown";
break;
}
}
return status;
}
void ExternalSensor::EnableSensor(bool i_enable) {
if (true == SystemEnable) {
UserEnable = i_enable;
config->SaveExternalTemperatureSensorEnable(UserEnable);
} else {
UserEnable = false;
config->SaveExternalTemperatureSensorEnable(UserEnable);
}
}
void ExternalSensor::ReadSensorData() {
if ((true == SystemEnable) && (true == UserEnable)) {
DhtSensor.read();
}
}
void ExternalSensor::SetUnit(TemperatureSensorUnit_enum i_unit) {
Unit = i_unit;
config->SaveExternalTemperatureSensorUnit(Unit);
}
float ExternalSensor::GetTemperature() {
float temp = 0.0;
if ((true == SystemEnable) && (true == UserEnable)) {
if (Unit == TEMPERATURE_UNIT_CELSIUS) {
temp = DhtSensor.getTemperature();
} else if (Unit == TEMPERATURE_UNIT_FAHRENHEIT) {
temp = DhtSensor.getTemperature() * 9.0 / 5.0 + 32.0;
}
}
return temp;
}
float ExternalSensor::GetHumidity() {
if ((true == SystemEnable) && (true == UserEnable)) {
return DhtSensor.getHumidity();
} else {
return 0.0;
}
}
String ExternalSensor::GetTemperatureString() {
String temp = "";
if (false == SystemEnable) {
temp = "Unsupport";
} else if ((false == UserEnable) || (false == SystemEnable)) {
temp = "Disabled";
} else {
if (Unit == TEMPERATURE_UNIT_CELSIUS) {
temp = String(GetTemperature(), 1) + " °C";
} else if (Unit == TEMPERATURE_UNIT_FAHRENHEIT) {
temp = String(GetTemperature(), 1) + " °F";
}
}
return temp;
}
String ExternalSensor::GetHumidityString() {
String hum = "";
if (false == SystemEnable) {
hum = "Unsupport";
} else if ((false == UserEnable) || (false == SystemEnable)) {
hum = "Disabled";
} else {
hum = String(GetHumidity(), 1) + " %";
}
return hum;
}
bool ExternalSensor::GetUserEnableSensor() {
return UserEnable;
}
TemperatureSensorUnit_enum ExternalSensor::GetTemperatureUnit() {
return Unit;
}
/* EOF */

View File

@ -0,0 +1,59 @@
/**
@file ExternalTemperatureSensor.h
@brief Library for external temperature sensor control
@author Miroslav Pivovarsky
Contact: miroslav.pivovarsky@gmail.com
@bug: no know bug
*/
#pragma once
#include <Arduino.h>
#include "log.h"
#include "mcu_cfg.h"
#include "module_templates.h"
#include <dhtnew.h>
#include "cfg.h"
#include "ExternalTemperatureSensorTypes.h"
class Logs;
class Configuration;
class ExternalSensor {
private:
TemperatureSensorUnit_enum Unit; ///< unit number
DHTNEW DhtSensor; ///< DHT sensor object
uint8_t Pin; ///< pin number
bool SystemEnable; ///< system enable flag
bool UserEnable; ///< user enable flag
uint8_t SensorType; ///< sensor type
Logs *log; ///< log object
Configuration *config; ///< configuration object
public:
ExternalSensor(uint8_t, bool, Logs *, Configuration *);
~ExternalSensor(){};
void Init();
String GetSensorStatus();
void EnableSensor(bool);
void ReadSensorData();
void SetUnit(TemperatureSensorUnit_enum);
float GetTemperature();
float GetHumidity();
String GetTemperatureString();
String GetHumidityString();
bool GetUserEnableSensor();
TemperatureSensorUnit_enum GetTemperatureUnit();
};
extern ExternalSensor ExternalTemperatureSensor;
/* EOF */

View File

@ -0,0 +1,19 @@
/**
@file connect_types.h
@brief Here are defined types for communication with prusa connect backend
@author Miroslav Pivovarsky
Contact: miroslav.pivovarsky@gmail.com
@bug: no know bug
*/
#pragma once
enum TemperatureSensorUnit_enum {
TEMPERATURE_UNIT_CELSIUS = 0, ///< Celsius
TEMPERATURE_UNIT_FAHRENHEIT = 1 ///< Fahrenheit
};
/* EOF */

View File

@ -28,8 +28,8 @@ const char index_html[] PROGMEM = R"rawliteral(
<meta name="Prusa ESP32-cam" content="width=device-width, initial-scale=1">
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
<link rel="stylesheet" type="text/css" href="styles.css">
<script src="jquery-3.7.0.min.js"></script>
<link rel="stylesheet" type="text/css" href="styles.css?v=1.0.0">
<script src="/jquery-3.7.0.min.js"></script>
<script>
$(document).ready(function () {
$("a").click(function (e) {
@ -50,6 +50,7 @@ const char index_html[] PROGMEM = R"rawliteral(
<img src="esp32_cam.svg" id=logo alt="Logo image" style="margin-left: 10px;" />
<ul class="top_bar" style="justify-content:flex-start;">
<li><a class=p5 href="https://forum.prusa3d.com/forum/prusa-connect-prusalink" id="forum-link">Forum</a></li>
<li><a class=p5 href="https://help.prusa3d.com/guide/esp-camera-for-prusa-connect_390199" id="forum-link">Help</a></li>
</ul>
<ul class="top_bar" style="justify-content:flex-end;">
<li><a class=p4 href="#" onclick="javascript:actionButton('/action_led',true,'')"><div id="light-icon"></div> Light </a></li>
@ -68,7 +69,7 @@ const char index_html[] PROGMEM = R"rawliteral(
<article>
<p class="p1">Trigger interval: <b><span id="refreshInterval"></span><b>s</p><br><br>
<button class="btn" onclick="actionButton('/action_capture',true,'')">Refresh Snapshot</button> <br><br>
<button class="btn" onclick="actionButton('/action_send',false,'')">Send snapshot</button><br><br><br>
<button class="btn" onclick="actionButton('/action_send',false,'Sending snapshot...')">Send snapshot</button><br><br><br>
<button class="btn" onclick="window.open('saved-photo.jpg')">Download snapshot</button><br><br>
<button class="btn" onclick="window.open('stream.mjpg')">Start stream</button><br><br>
</article>
@ -82,6 +83,7 @@ const char index_html[] PROGMEM = R"rawliteral(
<li><a href="page_wifi.html">Wi-Fi</a></li>
<li><a href="page_auth.html">Authentication</a></li>
<li><a href="page_system.html">System</a></li>
<li><a href="page_temperature.html">Temperature</a></li>
</div>
</div>
</div>
@ -96,19 +98,19 @@ const char index_html[] PROGMEM = R"rawliteral(
<td><a href="https://github.com/Prusa-Development/Prusa-Firmware-ESP32-Cam/" id="github-link"><svg height="25"><image href="github-icon.svg"></svg></a></td>
</tr></table>
</body>
<script src="scripts.js"></script>
<script>
sliderCheck();
get_data();
addClickListener('github-link');
addClickListener('forum-link');
</script>
<script src="scripts.js"></script>
<script>
sliderCheck();
get_data();
addClickListener('github-link');
addClickListener('forum-link');
</script>
</html>
)rawliteral";
/* ------------------------------------------------------------------------------------------------------------ */
const char page_auth_html[] PROGMEM = R"rawliteral(
<style>@import url("styles.css");</style>
<style>@import url("styles.css?v=1.0.0");</style>
<script src="jquery-3.7.0.min.js"></script>
<body>
<center>
@ -133,7 +135,7 @@ const char page_auth_html[] PROGMEM = R"rawliteral(
/* ------------------------------------------------------------------------------------------------------------ */
const char page_wifi_html[] PROGMEM = R"rawliteral(
<style>@import url("styles.css");</style>
<style>@import url("styles.css?v=1.0.0");</style>
<script src="jquery-3.7.0.min.js"></script>
<body>
<table id="center_tb">
@ -174,7 +176,7 @@ const char page_wifi_html[] PROGMEM = R"rawliteral(
<table>
<tr><td class="w1">Connect to Wi-Fi network</td></tr>
<tr><td class="w2" align="right">Wi-Fi network name (SSID) </td><td><input type="text" name="wifi_ssid" id=wifi_ssid_id ></td></tr>
<tr><td class="w2" align="right">Password </td><td><input type="text" name="wifi_pass" id=wifi_pass_id></td></tr>
<tr><td class="w2" align="right">Password </td><td><input type="password" name="wifi_pass" id=wifi_pass_id></td></tr>
<tr><td></td><td align="center"><button class="btn_save_w" onclick="setWifi(document.getElementById('wifi_ssid_id').value, document.getElementById('wifi_pass_id').value)">Save & Connect</button></td></tr>
</table>
</td><td></td></tr>
@ -208,12 +210,12 @@ const char page_wifi_html[] PROGMEM = R"rawliteral(
setTimeout(function(){GetDataAndPrintTableWiFi();}, 500);
get_data("wifi");
setupCollapsibleButtonsWiFi();
</script>
</script>
)rawliteral";
/* ------------------------------------------------------------------------------------------------------------ */
const char page_config_html[] PROGMEM = R"rawliteral(
<style>@import url("styles.css");</style>
<style>@import url("styles.css?v=1.0.0");</style>
<script src="jquery-3.7.0.min.js"></script>
<body>
<center><table id="data">
@ -306,7 +308,7 @@ const char page_config_html[] PROGMEM = R"rawliteral(
/* ------------------------------------------------------------------------------------------------------------ */
const char page_system_html[] PROGMEM = R"rawliteral(
<style>@import url("styles.css");</style>
<style>@import url("styles.css?v=1.0.0");</style>
<script src="jquery-3.7.0.min.js"></script>
<body>
<center>
@ -364,6 +366,37 @@ const char page_system_html[] PROGMEM = R"rawliteral(
</script>
)rawliteral";
/* ------------------------------------------------------------------------------------------------------------ */
const char page_temperature_html[] PROGMEM = R"rawliteral(
<style>@import url("styles.css?v=1.0.0");</style>
<script src="jquery-3.7.0.min.js"></script>
<body>
<center>
<table>
<tr><td class=pa3>External temperature sensor DHT22/DHT11</td><td></td></tr>
<tr><td class=pa1 align="right">Enable sensors</td><td><label class="switch"><input type="checkbox" name="extsens_en" id="extsetsid" onchange="changeValue(this.checked, 'set_bool?extsens_enable=', 'temp')"><span class="checkbox_slider round"></span></label></label> <span class=pa1 id="status_extsens"></span></td></tr>
<tr><td class="ps1">Sensor status: </td><td class="pa2" id="extsens_stat"></td></tr>
<tr><td style="height: 1px;"></td><td style="height: 1px;"></td></tr>
<tr>
<td class="pa1">Temperature Unit</td><td><label for="temp_unit"></label>
<select class="select" id="temp_unitid" name="temp_unit" onchange="changeValue(this.value, 'set_int?temp_unit=', 'temp')">
<option value="0">Celsius</option>
<option value="1">Fahrenheit</option>
</select>
</td>
</tr>
<tr><td style="height: 1px;"></td><td style="height: 1px;"></td></tr>
<tr><td class="pa1">Temperature</td><td class="pa2" id="ext_temp"></td></tr>
<tr><td class="pa1">Humidity</td><td class="pa2" id="ext_hum"></td></tr>
</table>
</center>
</body>
<script src="scripts.js"></script>
<script>
get_data("temp");
</script>
)rawliteral";
/* ------------------------------------------------------------------------------------------------------------ */
const char styles_css[] PROGMEM = R"rawliteral(
body {
@ -995,6 +1028,14 @@ function get_data(val) {
document.getElementById('mdnsid').value = obj.mdns;
document.getElementById('loglevelid').value = obj.log_level;
}
if (val == "temp") {
$("#extsens_stat").text(obj.extsens_stat);
document.getElementById('extsetsid').checked = obj.extsen_en;
document.getElementById('temp_unitid').value = obj.exttemp_unit;
$("#ext_temp").text(obj.ext_temp);
$("#ext_hum").text(obj.ext_hum);
}
},
error: function(html) {
console.log("json Timeout or error");
@ -1301,7 +1342,7 @@ function updateProgress() {
function checkUpdate() {
var xmlHttp = new XMLHttpRequest();
alert("Connecting to server... Please wait several second");
alert("Connecting to server... Please wait several seconds");
xmlHttp.open("GET", "/check_web_ota_update", false);
xmlHttp.send(null);
alert(xmlHttp.responseText);
@ -1370,7 +1411,7 @@ function setupCollapsibleButtonsWiFi() {
/* ------------------------------------------------------------------------------------------------------------ */
const char license_html[] PROGMEM = R"rawliteral(
<style>@import url("styles.css");</style>
<style>@import url("styles.css?v=1.0.0");</style>
<script src="jquery-3.7.0.min.js"></script>
<center><p>The software for device falls under the <a href="https://www.gnu.org/licenses/gpl-3.0.html" id="license-link">GPL-3.0 license terms</a>. To read the license terms please visit <a href="https://www.gnu.org/licenses/gpl-3.0.html" id="license-link-sec">this page</a>.</p></center>
<script src="scripts.js"></script>
@ -1382,7 +1423,7 @@ const char license_html[] PROGMEM = R"rawliteral(
/* ------------------------------------------------------------------------------------------------------------ */
const char gtac_html[] PROGMEM = R"rawliteral(
<style>@import url("styles.css");</style>
<style>@import url("styles.css?v=1.0.0");</style>
<script src="jquery-3.7.0.min.js"></script>
<center><p>To read the General Terms and Conditions, please visit <a href="https://www.prusa3d.com/page/general-terms-and-conditions_231236/" id="gtac-link">this page</a>.</p></center>
<script src="scripts.js"></script>
@ -1393,7 +1434,7 @@ const char gtac_html[] PROGMEM = R"rawliteral(
/* ------------------------------------------------------------------------------------------------------------ */
const char privacypolicy_html[] PROGMEM = R"rawliteral(
<style>@import url("styles.css");</style>
<style>@import url("styles.css?v=1.0.0");</style>
<script src="jquery-3.7.0.min.js"></script>
<center><p>To read the Privacy Policy, please visit <a href="https://www.prusa3d.com/en/page/privacy-policy_231258/" id="privacy-link">this page</a>.</p></center>
<script src="scripts.js"></script>
@ -1404,7 +1445,7 @@ const char privacypolicy_html[] PROGMEM = R"rawliteral(
/* ------------------------------------------------------------------------------------------------------------ */
const char cookies_html[] PROGMEM = R"rawliteral(
<style>@import url("styles.css");</style>
<style>@import url("styles.css?v=1.0.0");</style>
<script src="jquery-3.7.0.min.js"></script>
<center><p>To read the Cookie policy, please visit <a href="https://www.prusa3d.com/en/page/privacy-policy_231258/" id="cookies-link">this page</a>.</p></center>
<script src="scripts.js"></script>

View File

@ -47,15 +47,24 @@ void Server_InitWebServer() {
SystemCamera.SetPhotoSending(true);
SystemLog.AddEvent(LogLevel_Verbose, "Photo size: " + String(SystemCamera.GetPhotoFb()->len) + " bytes");
if (SystemCamera.GetPhotoExifData()->header != NULL) {
/* send photo with exif data */
SystemLog.AddEvent(LogLevel_Verbose, F("Send photo with EXIF data"));
size_t total_len = SystemCamera.GetPhotoExifData()->len + SystemCamera.GetPhotoFb()->len - SystemCamera.GetPhotoExifData()->offset;
auto response = request->beginResponseStream("image/jpg");
auto response = request->beginChunkedResponse("image/jpg", [total_len](uint8_t *buffer, size_t maxLen, size_t index) -> size_t {
size_t len = 0;
if (index < SystemCamera.GetPhotoExifData()->len) {
len = min(maxLen, SystemCamera.GetPhotoExifData()->len - index);
memcpy(buffer, SystemCamera.GetPhotoExifData()->header + index, len);
} else {
size_t offset = index - SystemCamera.GetPhotoExifData()->len + SystemCamera.GetPhotoExifData()->offset;
len = min(maxLen, SystemCamera.GetPhotoFb()->len - offset);
memcpy(buffer, SystemCamera.GetPhotoFb()->buf + offset, len);
}
return len;
});
response->addHeader("Content-Length", String(total_len));
response->write(SystemCamera.GetPhotoExifData()->header, SystemCamera.GetPhotoExifData()->len);
response->write(&SystemCamera.GetPhotoFb()->buf[SystemCamera.GetPhotoExifData()->offset], SystemCamera.GetPhotoFb()->len - SystemCamera.GetPhotoExifData()->offset);
request->send(response);
} else {
@ -150,7 +159,7 @@ void Server_InitWebServer_WebPages() {
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: Get index.html"));
if (Server_CheckBasicAuth(request) == false)
return;
Server_handleCacheRequest(request, "text/html", index_html);
});
@ -177,7 +186,7 @@ void Server_InitWebServer_WebPages() {
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: Get page_config.html"));
if (Server_CheckBasicAuth(request) == false)
return;
Server_handleCacheRequest(request, "text/html", page_config_html);
});
@ -186,7 +195,7 @@ void Server_InitWebServer_WebPages() {
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: Get page_wifi.html"));
if (Server_CheckBasicAuth(request) == false)
return;
Server_handleCacheRequest(request, "text/html", page_wifi_html);
});
@ -195,7 +204,7 @@ void Server_InitWebServer_WebPages() {
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: Get page_auth.html"));
if (Server_CheckBasicAuth(request) == false)
return;
Server_handleCacheRequest(request, "text/html", page_auth_html);
});
@ -204,16 +213,25 @@ void Server_InitWebServer_WebPages() {
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: Get page_system.html"));
if (Server_CheckBasicAuth(request) == false)
return;
Server_handleCacheRequest(request, "text/html", page_system_html);
});
/* route for temperature web page */
server.on("/page_temperature.html", HTTP_GET, [](AsyncWebServerRequest* request) {
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: Get page_temperature.html"));
if (Server_CheckBasicAuth(request) == false)
return;
Server_handleCacheRequest(request, "text/html", page_temperature_html);
});
/* route to license page */
server.on("/license.html", HTTP_GET, [](AsyncWebServerRequest* request) {
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: Get license.html"));
if (Server_CheckBasicAuth(request) == false)
return;
Server_handleCacheRequest(request, "text/html", license_html);
});
@ -222,7 +240,7 @@ void Server_InitWebServer_WebPages() {
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: Get gtac.html"));
if (Server_CheckBasicAuth(request) == false)
return;
Server_handleCacheRequest(request, "text/html", gtac_html);
});
@ -231,7 +249,7 @@ void Server_InitWebServer_WebPages() {
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: Get privacypolicy.html"));
if (Server_CheckBasicAuth(request) == false)
return;
Server_handleCacheRequest(request, "text/html", privacypolicy_html);
});
@ -240,7 +258,7 @@ void Server_InitWebServer_WebPages() {
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: Get cookie.html"));
if (Server_CheckBasicAuth(request) == false)
return;
Server_handleCacheRequest(request, "text/html", cookies_html);
});
@ -257,6 +275,24 @@ void Server_InitWebServer_WebPages() {
request->send(404, "text/plain", "Micro SD card not found with FAT32 partition!");
}
});
/* route to get temperature */
server.on("/get_temp", HTTP_GET, [](AsyncWebServerRequest* request) {
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: Get get_temp"));
if (Server_CheckBasicAuth(request) == false)
return;
request->send(200, "text/plain", String(ExternalTemperatureSensor.GetTemperature()));
});
/* route to get humidity */
server.on("/get_hum", HTTP_GET, [](AsyncWebServerRequest* request) {
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: Get get_hum"));
if (Server_CheckBasicAuth(request) == false)
return;
request->send(200, "text/plain", String(ExternalTemperatureSensor.GetHumidity()));
});
}
/**
@ -270,7 +306,7 @@ void Server_InitWebServer_Icons() {
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: Get esp32_cam.svg"));
if (Server_CheckBasicAuth(request) == false)
return;
Server_handleCacheRequest(request, "image/svg+xml", esp32_cam_logo_svg);
});
@ -279,7 +315,7 @@ void Server_InitWebServer_Icons() {
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: Get github-icon.svg"));
if (Server_CheckBasicAuth(request) == false)
return;
Server_handleCacheRequest(request, "image/svg+xml", github_icon_svg);
});
@ -297,7 +333,7 @@ void Server_InitWebServer_Icons() {
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: Get light-icon.svg"));
if (Server_CheckBasicAuth(request) == false)
return;
Server_handleCacheRequest(request, "image/svg+xml", light_icon_off_svg);
});
@ -468,7 +504,7 @@ void Server_InitWebServer_Actions() {
SystemCamera.SetCameraFlashEnable(false);
SystemCamera.SetFlashStatus(false);
request->send(200, "text/plain", "Flash OFF");
} else {
request->send(400, "text/plain", "Invalid request");
}
@ -484,7 +520,7 @@ void Server_InitWebServer_Actions() {
ESP.restart();
});
/* route for change LED status */
/* route for change LED status */
server.on("/action_sderase", HTTP_GET, [](AsyncWebServerRequest* request) {
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: /action_sderase remove files from SD card"));
if (Server_CheckBasicAuth(request) == false)
@ -636,6 +672,14 @@ void Server_InitWebServer_Sets() {
response = true;
}
/* set saturation */
if (request->hasParam("temp_unit")) {
SystemLog.AddEvent(LogLevel_Verbose, F("Set temp_unit"));
ExternalTemperatureSensor.SetUnit((TemperatureSensorUnit_enum) request->getParam("temp_unit")->value().toInt());
response_msg = MSG_SAVE_OK;
response = true;
}
if (true == response) {
request->send(200, F("text/html"), response_msg.c_str());
}
@ -734,27 +778,36 @@ void Server_InitWebServer_Sets() {
response = true;
}
/* set service AP */
if (request->hasParam("serviceap_enable")) {
SystemLog.AddEvent(LogLevel_Verbose, F("Set service AP enable"));
SystemWifiMngt.SetEnableServiceAp(Server_TransfeStringToBool(request->getParam("serviceap_enable")->value()));
response = true;
}
/* set timelaps enable */
if (request->hasParam("timelaps_enable")) {
SystemLog.AddEvent(LogLevel_Verbose, F("Set timelaps enable"));
#if (ENABLE_SD_CARD == true)
bool val = Server_TransfeStringToBool(request->getParam("timelaps_enable")->value());
if ((true == val ) && (SystemLog.GetCardDetectedStatus() == true)) {
if ((true == val) && (SystemLog.GetCardDetectedStatus() == true)) {
Connect.SetTimeLapsPhotoSaveStatus(val);
} else {
Connect.SetTimeLapsPhotoSaveStatus(false);
}
#else
Connect.SetTimeLapsPhotoSaveStatus(false);
Connect.SetTimeLapsPhotoSaveStatus(false);
#endif
response = true;
}
/* set external temperature sensor enable */
if (request->hasParam("extsens_enable")) {
SystemLog.AddEvent(LogLevel_Verbose, F("Set enable ext temperature"));
ExternalTemperatureSensor.EnableSensor(Server_TransfeStringToBool(request->getParam("extsens_enable")->value()));
response = true;
}
if (true == response) {
request->send(200, F("text/html"), MSG_SAVE_OK);
}
@ -803,12 +856,17 @@ void Server_InitWebServer_Sets() {
}
/* check min and max length WI-FI ssid and password */
#if (WIFI_DISABLE_UNENCRYPTED_STA_PASS_CHECK == false)
if (((TmpPassword.length() > 0) && (TmpSsid.length() > 0)) && ((TmpPassword.length() < EEPROM_ADDR_WIFI_PASSWORD_LENGTH) && (TmpSsid.length() < EEPROM_ADDR_WIFI_SSID_LENGTH))) {
#else
if ((TmpSsid.length() > 0) && (TmpSsid.length() < EEPROM_ADDR_WIFI_SSID_LENGTH)) {
#endif
/* send OK response */
request->send(200, F("text/html"), MSG_SAVE_OK_WIFI);
/* save ssid and password */
SystemWifiMngt.SetStaCredentials(TmpSsid,TmpPassword);
SystemWifiMngt.SetStaCredentials(TmpSsid, TmpPassword);
SystemWifiMngt.WiFiStaConnect();
} else {
@ -816,7 +874,7 @@ void Server_InitWebServer_Sets() {
}
});
/* route for set WI-FI static IP address */
/* route for set WI-FI static IP address */
server.on("/wifi_net_cfg", HTTP_GET, [](AsyncWebServerRequest* request) {
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: set WI-FI static IP address"));
if (Server_CheckBasicAuth(request) == false)
@ -848,10 +906,8 @@ void Server_InitWebServer_Sets() {
}
/* check min and max length network parameters */
if (((tmpIp.length() > 0) && (tmpMask.length() > 0) && (tmpGw.length() > 0) && (tmpDns.length() > 0)) &&
((tmpIp.length() <= IPV4_ADDR_MAX_LENGTH) && (tmpMask.length() <= IPV4_ADDR_MAX_LENGTH) &&
(tmpGw.length() <= IPV4_ADDR_MAX_LENGTH) && (tmpDns.length() <= IPV4_ADDR_MAX_LENGTH))) {
if (((tmpIp.length() > 0) && (tmpMask.length() > 0) && (tmpGw.length() > 0) && (tmpDns.length() > 0)) && ((tmpIp.length() <= IPV4_ADDR_MAX_LENGTH) && (tmpMask.length() <= IPV4_ADDR_MAX_LENGTH) && (tmpGw.length() <= IPV4_ADDR_MAX_LENGTH) && (tmpDns.length() <= IPV4_ADDR_MAX_LENGTH))) {
/* save ssid and password */
SystemWifiMngt.SetNetworkConfig(tmpIp, tmpMask, tmpGw, tmpDns);
@ -911,7 +967,7 @@ void Server_InitWebServer_Sets() {
/* send OK response */
if (true == ret) {
request->send(200, F("text/html"), MSG_SAVE_OK);
} else {
String msg = MSG_SAVE_NOTOK;
msg += " " + ret_msg;
@ -1010,8 +1066,7 @@ void Server_InitWebServer_Update() {
SystemLog.AddEvent(LogLevel_Error, String(SYSTEM_MSG_UPDATE_FAIL));
}
}
}
);
});
/* route for start web OTA update from server */
server.on("/web_ota_update", HTTP_GET, [](AsyncWebServerRequest* request) {
@ -1079,8 +1134,20 @@ void Server_resume() {
* @param const char* - content type
* @param const char* - data
*/
void Server_handleCacheRequest(AsyncWebServerRequest* request, const char *contentType, const char *data) {
AsyncWebServerResponse *response = request->beginResponse(200, contentType, data);
void Server_handleCacheRequest(AsyncWebServerRequest* request, const char* contentType, const char* data) {
/*
AsyncWebServerResponse* response = request->beginResponse(200, contentType, data);
response->addHeader("Cache-Control", "public, max-age=" + String(WEB_CACHE_INTERVAL));
request->send(response);
*/
AsyncWebServerResponse* response = request->beginChunkedResponse(contentType, [data](uint8_t *buffer, size_t maxLen, size_t index) -> size_t {
const char* dataStart = data + index; // current position in data
size_t dataLeft = strlen(data) - index; // how many bytes are left to send
size_t chunkSize = dataLeft < maxLen ? dataLeft : maxLen; // how many bytes we can send now
memcpy(buffer, dataStart, chunkSize); // copy chunk of data to buffer
return chunkSize; // return chunk size
});
response->addHeader("Cache-Control", "public, max-age=" + String(WEB_CACHE_INTERVAL));
request->send(response);
}
@ -1174,6 +1241,11 @@ String Server_GetJsonData() {
doc_json["sw_build"] = SW_BUILD;
doc_json["sw_ver"] = SW_VERSION;
doc_json["sw_new_ver"] = FirmwareUpdate.NewVersionFw;
doc_json["extsens_stat"] = ExternalTemperatureSensor.GetSensorStatus();
doc_json["extsen_en"] = ExternalTemperatureSensor.GetUserEnableSensor();
doc_json["ext_temp"] = ExternalTemperatureSensor.GetTemperatureString();
doc_json["ext_hum"] = ExternalTemperatureSensor.GetHumidityString();
doc_json["exttemp_unit"] = ExternalTemperatureSensor.GetTemperatureUnit();
serializeJson(doc_json, string_json);
SystemLog.AddEvent(LogLevel_Verbose, string_json);
@ -1200,8 +1272,8 @@ bool Server_CheckBasicAuth(AsyncWebServerRequest* request) {
@param AsyncWebServerRequest - request
@return void
*/
void Server_streamJpg(AsyncWebServerRequest *request) {
AsyncJpegStreamResponse *response = new AsyncJpegStreamResponse(&SystemCamera, &SystemLog);
void Server_streamJpg(AsyncWebServerRequest* request) {
AsyncJpegStreamResponse* response = new AsyncJpegStreamResponse(&SystemCamera, &SystemLog);
if (!response) {
request->send(501);
return;

View File

@ -31,6 +31,7 @@
#include "connect.h"
#include "wifi_mngt.h"
#include "WebStream.h"
#include "ExternalTemperatureSensor.h"
extern AsyncWebServer server; ///< global variable for web server

View File

@ -237,6 +237,7 @@ void Camera::SetPhotoSending(bool i_data) {
*/
void Camera::SetFlashStatus(bool i_data) {
#if (true == ENABLE_CAMERA_FLASH)
/* PWM control of the FLASH */
#if (true == CAMERA_FLASH_PWM_CTRL)
if (true == i_data) {
ledcWrite(FLASH_GPIO_NUM, FLASH_ON_STATUS);
@ -244,6 +245,7 @@ void Camera::SetFlashStatus(bool i_data) {
ledcWrite(FLASH_GPIO_NUM, FLASH_OFF_STATUS);
}
/* Digital control of the FLASH */
#elif (true == CAMERA_FLASH_DIGITAL_CTRL)
if (true == i_data) {
digitalWrite(FLASH_GPIO_NUM, HIGH);
@ -251,6 +253,15 @@ void Camera::SetFlashStatus(bool i_data) {
digitalWrite(FLASH_GPIO_NUM, LOW);
}
#endif
/* rgbLedWrite control of the FLASH */
#if (true == CAMERA_FLASH_NEOPIXEL)
if (true == i_data) {
rgbLedWrite(FLASH_NEOPIXEL_LED_PIN, RGB_BRIGHTNESS, RGB_BRIGHTNESS, RGB_BRIGHTNESS);
} else if (false == i_data) {
rgbLedWrite(FLASH_NEOPIXEL_LED_PIN, 0, 0, 0);
}
#endif
#endif
}

View File

@ -175,6 +175,8 @@ void Configuration::DefaultCfg() {
SaveNetworkDns(FACTORY_CFG_NETWORK_STATIC_DNS);
SaveCameraImageExifRotation(FACTORY_CFG_IMAGE_EXIF_ROTATION);
SaveTimeLapseFunctionStatus(FACTORY_CFG_TIMELAPS_ENABLE);
SaveExternalTemperatureSensorEnable(FACTORY_CFG_ENABLE_EXT_SENSOR);
SaveExternalTemperatureSensorUnit(FACTORY_CFG_EXT_SENSOR_UNIT);
Log->AddEvent(LogLevel_Warning, F("+++++++++++++++++++++++++++"));
}
@ -852,6 +854,26 @@ void Configuration::SaveTimeLapseFunctionStatus(bool i_data) {
SaveBool(EEPROM_ADDR_TIMELAPS_ENABLE_START, i_data);
}
/**
@info Save external temperature sensor enable
@param bool - value
@return none
*/
void Configuration::SaveExternalTemperatureSensorEnable(bool i_data) {
Log->AddEvent(LogLevel_Verbose, F("Save external temperature sensor enable: "), String(i_data));
SaveBool(EEPROM_ADDR_EXT_SENS_ENABLE_START, i_data);
}
/**
@info Save external temperature sensor unit
@param uint8_t - value
@return none
*/
void Configuration::SaveExternalTemperatureSensorUnit(uint8_t i_data) {
Log->AddEvent(LogLevel_Verbose, F("Save external temperature sensor unit: "), String(i_data));
SaveUint8(EEPROM_ADDR_EXT_SENS_UNIT_START, i_data);
}
/**
@info load refresh interval from eeprom
@param none
@ -1363,4 +1385,37 @@ bool Configuration::LoadTimeLapseFunctionStatus() {
return (bool) ret;
}
/**
* @brief Load external temperature sensor enable
*
* @return bool - status
*/
bool Configuration::LoadExternalTemperatureSensorEnable() {
uint8_t ret = EEPROM.read(EEPROM_ADDR_EXT_SENS_ENABLE_START);
Log->AddEvent(LogLevel_Info, F("External temperature sensor enable: "), String(ret));
if (ret == 255) {
ret = 0;
}
return (bool) ret;
}
/**
* @brief Load external temperature sensor unit
*
* @return uint8_t - unit
*/
uint8_t Configuration::LoadExternalTemperatureSensorUnit() {
uint8_t ret = EEPROM.read(EEPROM_ADDR_EXT_SENS_UNIT_START);
Log->AddEvent(LogLevel_Info, F("External temperature sensor unit: "), String(ret));
if (ret == 255) {
ret = 0;
}
return ret;
}
/* EOF */

View File

@ -74,6 +74,8 @@ public:
void SaveNetworkDns(String);
void SaveCameraImageExifRotation(uint8_t);
void SaveTimeLapseFunctionStatus(bool);
void SaveExternalTemperatureSensorEnable(bool);
void SaveExternalTemperatureSensorUnit(uint8_t);
uint8_t LoadRefreshInterval();
String LoadToken();
@ -116,6 +118,8 @@ public:
String LoadNetworkDns();
uint8_t LoadCameraImageExifRotation();
bool LoadTimeLapseFunctionStatus();
bool LoadExternalTemperatureSensorEnable();
uint8_t LoadExternalTemperatureSensorUnit();
private:
Logs *Log; ///< Pointer to Logs object

View File

@ -269,6 +269,9 @@ void PrusaConnect::SendInfoToBackend() {
JsonObject config = json_data["config"].to<JsonObject>();
config["name"] = wifi->GetMdns();
config["firmware"] = SW_VERSION;
config["manufacturer"] = F("Prusa");
config["model"] = BOARD_NAME;
JsonObject resolution = config["resolution"].to<JsonObject>();
resolution["width"] = SystemCamera.GetFrameSizeWidth();

File diff suppressed because one or more lines are too long

View File

@ -7,22 +7,22 @@
Contact: miroslav.pivovarsky@gmail.com
@bug: no know bug
*/
#ifndef _MCU_CFG_H_
#define _MCU_CFG_H_
/* ----------------- CAMERA TYPE ---------------*/
#define AI_THINKER_ESP32_CAM true
#define ESP32_WROVER_DEV false
#define CAMERA_MODEL_ESP32_S3_DEV_CAM false
#define CAMERA_MODEL_ESP32_S3_EYE_2_2 false
#define CAMERA_MODEL_XIAO_ESP32_S3_CAM false
#define CAMERA_MODEL_ESP32_S3_CAM false
#define AI_THINKER_ESP32_CAM true
#define ESP32_WROVER_DEV false
#define CAMERA_MODEL_ESP32_S3_DEV_CAM false
#define CAMERA_MODEL_ESP32_S3_EYE_2_2 false
#define CAMERA_MODEL_XIAO_ESP32_S3_CAM false
#define CAMERA_MODEL_ESP32_S3_CAM false
#define ESP32_S3_WROOM_FREENOVE false
/* ---------------- BASIC MCU CFG --------------*/
#define SW_VERSION "1.1.0-rc1" ///< SW version
#define SW_VERSION "1.1.2" ///< SW version
#define SW_BUILD __DATE__ " " __TIME__ ///< build number
#define CONSOLE_VERBOSE_DEBUG false ///< enable/disable verbose debug log level for console
#define DEVICE_HOSTNAME "Prusa-ESP32cam" ///< device hostname
@ -46,7 +46,7 @@
#define TASK_SDCARD 25000 ///< sd card task interval [ms]
#define TASK_WIFI 28000 ///< wifi reconnect interval. Checking when is signal lost [ms]
#define TASK_SERIAL_CFG 1000 ///< serial cfg task interval [ms]
#define TASK_STREAM_TELEMETRY 30000 ///< stream telemetry task interval [ms]
#define TASK_SYSTEM_TELEMETRY 30000 ///< stream telemetry task interval [ms]
#define TASK_WIFI_WATCHDOG 20000 ///< wifi watchdog task interval [ms]
#define TASK_PHOTO_SEND 1000 ///< photo send task interval [ms]
#define TASK_SDCARD_FILE_REMOVE 30000 ///< sd card file remove task interval [ms]
@ -90,6 +90,7 @@
/* ----------------- WiFi CFG -------------------*/
#define WIFI_STA_WDG_TIMEOUT 60000 ///< STA watchdog timeout [ms]
#define WIFI_DISABLE_UNENCRYPTED_STA_PASS_CHECK false ///< enable/disable WEP/WPA/WPA2/... encryption for STA mode . for the wifi network without encryption set to false
/* ----------------- NTP CFG --------------------*/
#define NTP_SERVER_1 "pool.ntp.org" ///< NTP server
@ -145,6 +146,8 @@
#define FACTORY_CFG_NETWORK_STATIC_DNS F("255.255.255.255") ///< Static DNS
#define FACTORY_CFG_IMAGE_EXIF_ROTATION 1 ///< Image rotation 1 - 0°, 6 - 90°, 3 - 180°, 8 - 270°
#define FACTORY_CFG_TIMELAPS_ENABLE 0 ///< enable timelaps functionality
#define FACTORY_CFG_ENABLE_EXT_SENSOR 0 ///< enable DHT22 sensor
#define FACTORY_CFG_EXT_SENSOR_UNIT 0 ///< 0 = celsius, 1 = fahrenheit
/* ---------------- CFG FLAGS ------------------*/
#define CFG_WIFI_SETTINGS_SAVED 0x0A ///< flag saved config
@ -283,6 +286,12 @@
#define EEPROM_ADDR_TIMELAPS_ENABLE_START (EEPROM_ADDR_IMAGE_ROTATION_START + EEPROM_ADDR_IMAGE_ROTATION_LENGTH)
#define EEPROM_ADDR_TIMELAPS_ENABLE_LENGTH 1
#define EEPROM_ADDR_EXT_SENS_ENABLE_START (EEPROM_ADDR_TIMELAPS_ENABLE_START + EEPROM_ADDR_TIMELAPS_ENABLE_LENGTH)
#define EEPROM_ADDR_EXT_SENS_ENABLE_LENGTH 1
#define EEPROM_ADDR_EXT_SENS_UNIT_START (EEPROM_ADDR_EXT_SENS_ENABLE_START + EEPROM_ADDR_EXT_SENS_ENABLE_LENGTH)
#define EEPROM_ADDR_EXT_SENS_UNIT_LENGTH 1
#define EEPROM_SIZE (EEPROM_ADDR_REFRESH_INTERVAL_LENGTH + EEPROM_ADDR_FINGERPRINT_LENGTH + EEPROM_ADDR_TOKEN_LENGTH + \
EEPROM_ADDR_FRAMESIZE_LENGTH + EEPROM_ADDR_BRIGHTNESS_LENGTH + EEPROM_ADDR_CONTRAST_LENGTH + \
EEPROM_ADDR_SATURATION_LENGTH + EEPROM_ADDR_HMIRROR_LENGTH + EEPROM_ADDR_VFLIP_LENGTH + \
@ -297,7 +306,8 @@
EEPROM_ADDR_AEC_VALUE_LENGTH + EEPROM_ADDR_GAIN_CTRL_LENGTH + EEPROM_ADDR_AGC_GAIN_LENGTH + EEPROM_ADDR_LOG_LEVEL_LENGTH + \
EEPROM_ADDR_HOSTNAME_LENGTH + EEPROM_ADDR_SERVICE_AP_ENABLE_LENGTH + EEPROM_ADDR_NETWORK_IP_METHOD_LENGTH +\
EEPROM_ADDR_NETWORK_STATIC_IP_LENGTH + EEPROM_ADDR_NETWORK_STATIC_MASK_LENGTH + EEPROM_ADDR_NETWORK_STATIC_GATEWAY_LENGTH + \
EEPROM_ADDR_NETWORK_STATIC_DNS_LENGTH + EEPROM_ADDR_IMAGE_ROTATION_LENGTH + EEPROM_ADDR_TIMELAPS_ENABLE_LENGTH) ///< how many bits do we need for eeprom memory
EEPROM_ADDR_NETWORK_STATIC_DNS_LENGTH + EEPROM_ADDR_IMAGE_ROTATION_LENGTH + EEPROM_ADDR_TIMELAPS_ENABLE_LENGTH + \
EEPROM_ADDR_EXT_SENS_ENABLE_LENGTH + EEPROM_ADDR_EXT_SENS_UNIT_LENGTH) ///< how many bits do we need for eeprom memory
#endif

View File

@ -59,7 +59,9 @@
#define ENABLE_CAMERA_FLASH true ///< Enable camera flash function
#define CAMERA_FLASH_DIGITAL_CTRL false ///< Enable camera flash digital control
#define CAMERA_FLASH_PWM_CTRL true ///< Enable camera flash PWM control
#define CAMERA_FLASH_NEOPIXEL false ///< Enable camera flash NeoPixel control
#define FLASH_GPIO_NUM 4 ///< Flash control pin
#define FLASH_NEOPIXEL_LED_PIN -1 ///< External flash control pin. RGB LED NeoPixel
#define FLASH_OFF_STATUS 0 ///< PWM intensity LED for OFF. 0-2^FLASH_PWM_RESOLUTION = 0-255
#define FLASH_ON_STATUS 205 ///< PWM intensity LED for ON. limitation to 80%. 2^FLASH_PWM_RESOLUTION * 0.8% = 204
#define FLASH_PWM_FREQ 2000 ///< frequency of pwm [240MHz / (100 prescale * pwm cycles)] = frequency
@ -73,7 +75,7 @@
#define SD_PIN_DATA0 2 ///< GPIO pin for SD card data 0
/* ---------- RESET CFG CONFIGURATION ----------*/
#define CFG_RESET_PIN 12 ///< GPIO 16 is for reset CFG to default
#define CFG_RESET_PIN 12 ///< GPIO 12 is for reset CFG to default
#define CFG_RESET_LED_PIN 4 ///< GPIO for indication of reset CFG
#define CFG_RESET_LED_LEVEL_ON HIGH ///< GPIO pin level for status LED ON
@ -82,5 +84,9 @@
#define STATUS_LED_GPIO_NUM 33 ///< GPIO pin for status LED
#define STATUS_LED_OFF_PIN_LEVEL LOW ///< GPIO pin level for status LED ON
/* -------------- DHT SENSOR CFG ----------------*/
#define DHT_SENSOR_ENABLE true ///< enable/disable DHT sensor
#define DHT_SENSOR_PIN 13 ///< GPIO pin for DHT sensor
#endif // AI_THINKER_ESP32_CAM
/* EOF */

View File

@ -5,8 +5,28 @@
@author Miroslav Pivovarsky
Contact: miroslav.pivovarsky@gmail.com
Board configuration in the arduino IDE 2.3.2
Tools -> Board -> ESP32 Arduino -> ESP32S3 Dev Module
Tools -> USB CDC on BOOT -> Disable
Tools -> CPU Frequency -> 240MHz (WiFi/BT)
Tools -> Core debug level -> None
Tools -> USB DFU on BOOT -> Disable
Tools -> Erase all Flash Before Sketch Upload -> Disable (first flash, new board = enable. otherwise = disable)
Tools -> Events Run On -> Core 1
Tools -> Flash Mode -> DIO 80MHz
Tools -> Flash Size -> 16MB
Tools -> Jtag Adapter -> Disable
Tools -> Arduino Runs On -> Core 1
Tools -> USB Firmware MSC On Boot -> Disable
Tools -> Partition scheme -> Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)
Tools -> PSRAM -> OPI PSRAM
Tools -> Upload Mode -> UART0 / Hardware CDC
Tools -> Upload Speed -> 921600
Tools -> USB Mode -> Hardware CDC and JTAG
Tools -> Zigbee mode -> Disable
@bug: NOT COMPLETED!
@bug:
*/
@ -36,40 +56,46 @@
/* ------------------ MCU CFG ------------------*/
#define BOARD_NAME F("ESP32-S3-CAM") ///< Board name
#define ENABLE_BROWN_OUT_DETECTION false ///< Enable brown out detection
#define ENABLE_PSRAM true ///< Enable PSRAM
#define ENABLE_BROWN_OUT_DETECTION false ///< Enable brown out detection
#define ENABLE_PSRAM true ///< Enable PSRAM
/* --------------- OTA UPDATE CFG --------------*/
#define OTA_UPDATE_FW_FILE PSTR("esp32-s3-cam.bin") ///< OTA update firmware file name
#define FW_STATUS_LED_PIN 4 ///< GPIO pin for status FW update LED
#define FW_STATUS_LED_LEVEL_ON HIGH ///< GPIO pin level for status LED ON
#define FW_STATUS_LED_PIN 2 ///< GPIO pin for status FW update LED
#define FW_STATUS_LED_LEVEL_ON HIGH ///< GPIO pin level for status LED ON
/* --------------- FLASH LED CFG ---------------*/
#define ENABLE_CAMERA_FLASH false ///< Enable camera flash function
#define CAMERA_FLASH_DIGITAL_CTRL false ///< Enable camera flash digital control
#define CAMERA_FLASH_PWM_CTRL false ///< Enable camera flash PWM control
#define FLASH_GPIO_NUM 48 ///< Flash control pin. RGB LED NeoPixel
#define FLASH_OFF_STATUS 0 ///< value for turn off flash
#define FLASH_ON_STATUS 205 ///< value for turn on flash
#define ENABLE_CAMERA_FLASH true ///< Enable camera flash function
#define CAMERA_FLASH_DIGITAL_CTRL true ///< Enable camera flash digital control
#define CAMERA_FLASH_PWM_CTRL false ///< Enable camera flash PWM control
#define CAMERA_FLASH_NEOPIXEL true ///< Enable camera flash NeoPixel control
#define FLASH_GPIO_NUM 47 ///< Flash control pin.
#define FLASH_NEOPIXEL_LED_PIN 48 ///< External flash control pin. RGB LED NeoPixel
#define FLASH_OFF_STATUS LOW ///< value for turn off flash
#define FLASH_ON_STATUS HIGH ///< value for turn on flash
//#define FLASH_PWM_FREQ 2000 ///< frequency of pwm [240MHz / (100 prescale * pwm cycles)] = frequency
//#define FLASH_PWM_CHANNEL 0 ///< channel 0
//#define FLASH_PWM_RESOLUTION 8 ///< range 1-20bit. 8bit = 0-255 range
/* --------------- SD CARD CFG ---------------*/
#define ENABLE_SD_CARD true ///< Enable SD card function
#define SD_PIN_CLK 39 ///< GPIO pin for SD card clock
#define SD_PIN_CMD 38 ///< GPIO pin for SD card command
#define SD_PIN_DATA0 40 ///< GPIO pin for SD card data 0
#define ENABLE_SD_CARD true ///< Enable SD card function
#define SD_PIN_CLK 39 ///< GPIO pin for SD card clock
#define SD_PIN_CMD 38 ///< GPIO pin for SD card command
#define SD_PIN_DATA0 40 ///< GPIO pin for SD card data 0
/* ---------- RESET CFG CONFIGURATION ----------*/
#define CFG_RESET_PIN 12 ///< GPIO 16 is for reset CFG to default
#define CFG_RESET_LED_PIN 4 ///< GPIO for indication of reset CFG
#define CFG_RESET_LED_LEVEL_ON HIGH ///< GPIO pin level for status LED ON
#define CFG_RESET_PIN 14 ///< GPIO 16 is for reset CFG to default
#define CFG_RESET_LED_PIN 2 ///< GPIO for indication of reset CFG
#define CFG_RESET_LED_LEVEL_ON HIGH ///< GPIO pin level for status LED ON
/* -------------- STATUS LED CFG ----------------*/
#define STATUS_LED_ENABLE true ///< enable/disable status LED
#define STATUS_LED_GPIO_NUM 33 ///< GPIO pin for status LED
#define STATUS_LED_OFF_PIN_LEVEL LOW ///< GPIO pin level for status LED ON
#define STATUS_LED_ENABLE true ///< enable/disable status LED
#define STATUS_LED_GPIO_NUM 2 ///< GPIO pin for status LED
#define STATUS_LED_OFF_PIN_LEVEL HIGH ///< GPIO pin level for status LED ON
/* -------------- DHT SENSOR CFG ----------------*/
#define DHT_SENSOR_ENABLE true ///< enable/disable DHT sensor
#define DHT_SENSOR_PIN 20 ///< GPIO pin for DHT sensor
#endif
/* EOF */

View File

@ -70,7 +70,9 @@
#define ENABLE_CAMERA_FLASH true ///< Enable camera flash function
#define CAMERA_FLASH_DIGITAL_CTRL true ///< Enable camera flash digital control
#define CAMERA_FLASH_PWM_CTRL false ///< Enable camera flash PWM control
#define CAMERA_FLASH_NEOPIXEL false ///< Enable camera flash NeoPixel control
#define FLASH_GPIO_NUM 48 ///< Flash control pin. This is pin for enable LCD backlight
#define FLASH_NEOPIXEL_LED_PIN -1 ///< External flash control pin. RGB LED NeoPixel
#define FLASH_OFF_STATUS LOW ///< Value for turn off flash
#define FLASH_ON_STATUS HIGH ///< Value for turn on flash
//#define FLASH_PWM_FREQ 2000 ///< frequency of pwm [240MHz / (100 prescale * pwm cycles)] = frequency
@ -93,5 +95,9 @@
#define STATUS_LED_GPIO_NUM 3 ///< GPIO pin for status LED
#define STATUS_LED_OFF_PIN_LEVEL HIGH ///< GPIO pin level for status LED ON
/* -------------- DHT SENSOR CFG ----------------*/
#define DHT_SENSOR_ENABLE true ///< enable/disable DHT sensor
#define DHT_SENSOR_PIN 46 ///< GPIO pin for DHT sensor
#endif // CAMERA_MODEL_ESP32_S3_EYE_2_2
/* EOF */

View File

@ -0,0 +1,103 @@
/**
@file module_ESP32-S3_Wroom_Freenove.h
@brief Definition of the ESP32-S3 Wroom FreeNove board
@author Miroslav Pivovarsky
Contact: miroslav.pivovarsky@gmail.com
Board configuration in the arduino IDE 2.3.2
Tools -> Board -> ESP32 Arduino -> ESP32S3 Dev Module
Tools -> USB CDC on BOOT -> Disabled
Tools -> CPU Frequency -> 240MHz (WiFi/BT)
Tools -> Core debug level -> None
Tools -> USB DFU on BOOT -> Disable
Tools -> Erase all Flash Before Sketch Upload -> Disable (first flash, new board = enable. otherwise = disable)
Tools -> Events Run On -> Core 0
Tools -> Flash Mode -> QIO 80MHz
Tools -> Flash Size -> 8MB
Tools -> Jtag Adapter -> Disable
Tools -> Arduino Runs On -> Core 0
Tools -> USB Firmware MSC On Boot -> Disable
Tools -> Partition scheme -> Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)
Tools -> PSRAM -> OPI PSRAM
Tools -> Upload Mode -> UART0 / Hardware CDC
Tools -> Upload Speed -> 921600
Tools -> USB Mode -> Hardware CDC and JTAG
Tools -> Zigbee mode -> Disable
https://freenove.com/fnk0085
@bug: no know bug
*/
#pragma once
#include "mcu_cfg.h"
#ifdef ESP32_S3_WROOM_FREENOVE
/* --------------- CAMERA CFG -------------------*/
#define PWDN_GPIO_NUM -1 ///< Power down control pin
#define RESET_GPIO_NUM -1 ///< Reset control pin
#define SIOD_GPIO_NUM 4 ///< SCCB: SI/O data pin
#define SIOC_GPIO_NUM 5 ///< SCCB: SI/O control pin
#define Y2_GPIO_NUM 11 ///< SCCB: Y2 pin
#define Y3_GPIO_NUM 9 ///< SCCB: Y3 pin
#define Y4_GPIO_NUM 8 ///< SCCB: Y4 pin
#define Y5_GPIO_NUM 10 ///< SCCB: Y5 pin
#define Y6_GPIO_NUM 12 ///< SCCB: Y6 pin
#define Y7_GPIO_NUM 18 ///< SCCB: Y7 pin
#define Y8_GPIO_NUM 17 ///< SCCB: Y8 pin
#define Y9_GPIO_NUM 16 ///< SCCB: Y9 pin
#define VSYNC_GPIO_NUM 6 ///< Vertical sync pin
#define HREF_GPIO_NUM 7 ///< Line sync pin
#define PCLK_GPIO_NUM 13 ///< Pixel clock pin
#define XCLK_GPIO_NUM 15 ///< External clock pin
/* ------------------ MCU CFG ------------------*/
#define BOARD_NAME F("ESP32-S3 WROOM Freenove") ///< Board name
#define ENABLE_BROWN_OUT_DETECTION false ///< Enable brown out detection
#define ENABLE_PSRAM true ///< Enable PSRAM
/* --------------- OTA UPDATE CFG --------------*/
#define OTA_UPDATE_FW_FILE PSTR("ESP32-S3-WROOM_FREENOVE.bin") ///< OTA update firmware file name
#define FW_STATUS_LED_PIN 2 ///< GPIO pin for status FW update LED
#define FW_STATUS_LED_LEVEL_ON LOW ///< GPIO pin level for status LED ON
/* --------------- FLASH LED CFG ---------------*/
#define ENABLE_CAMERA_FLASH true ///< Enable camera flash function
#define CAMERA_FLASH_DIGITAL_CTRL true ///< Enable camera flash digital control
#define CAMERA_FLASH_PWM_CTRL false ///< Enable camera flash PWM control
#define CAMERA_FLASH_NEOPIXEL true ///< Enable camera flash NeoPixel control
#define FLASH_GPIO_NUM 14 ///< Flash control pin
#define FLASH_NEOPIXEL_LED_PIN 48 ///< External flash control pin. RGB LED NeoPixel
#define FLASH_OFF_STATUS 0 ///< PWM intensity LED for OFF. 0-2^FLASH_PWM_RESOLUTION = 0-255
#define FLASH_ON_STATUS 205 ///< PWM intensity LED for ON. limitation to 80%. 2^FLASH_PWM_RESOLUTION * 0.8% = 204
#define FLASH_PWM_FREQ 2000 ///< frequency of pwm [240MHz / (100 prescale * pwm cycles)] = frequency
#define FLASH_PWM_CHANNEL 0 ///< channel 0
#define FLASH_PWM_RESOLUTION 8 ///< range 1-20bit. 8bit = 0-255 range
/* --------------- SD CARD CFG ---------------*/
#define ENABLE_SD_CARD true ///< Enable SD card function
#define SD_PIN_CLK 39 ///< GPIO pin for SD card clock
#define SD_PIN_CMD 38 ///< GPIO pin for SD card command
#define SD_PIN_DATA0 40 ///< GPIO pin for SD card data 0
/* ---------- RESET CFG CONFIGURATION ----------*/
#define CFG_RESET_PIN 21 ///< GPIO 12 is for reset CFG to default
#define CFG_RESET_LED_PIN 2 ///< GPIO for indication of reset CFG
#define CFG_RESET_LED_LEVEL_ON HIGH ///< GPIO pin level for status LED ON
/* -------------- STATUS LED CFG ----------------*/
#define STATUS_LED_ENABLE false ///< enable/disable status LED
#define STATUS_LED_GPIO_NUM 2 ///< GPIO pin for status LED
#define STATUS_LED_OFF_PIN_LEVEL LOW ///< GPIO pin level for status LED ON
/* -------------- DHT SENSOR CFG ----------------*/
#define DHT_SENSOR_ENABLE false ///< enable/disable DHT sensor
#define DHT_SENSOR_PIN 47 ///< GPIO pin for DHT sensor
#endif // AI_THINKER_ESP32_CAM
/* EOF */

View File

@ -58,7 +58,9 @@
#define ENABLE_CAMERA_FLASH true ///< Enable camera flash function
#define CAMERA_FLASH_DIGITAL_CTRL true ///< Enable camera flash digital control
#define CAMERA_FLASH_PWM_CTRL false ///< Enable camera flash PWM control
#define CAMERA_FLASH_NEOPIXEL false ///< Enable camera flash NeoPixel control
#define FLASH_GPIO_NUM 14 ///< Flash control pin
#define FLASH_NEOPIXEL_LED_PIN -1 ///< External flash control pin. RGB LED NeoPixel
#define FLASH_OFF_STATUS LOW ///< value for flash OFF
#define FLASH_ON_STATUS HIGH ///< value for flash ON
//#define FLASH_PWM_FREQ 2000 ///< frequency of pwm [240MHz / (100 prescale * pwm cycles)] = frequency
@ -81,5 +83,9 @@
#define STATUS_LED_GPIO_NUM 2 ///< GPIO pin for status LED
#define STATUS_LED_OFF_PIN_LEVEL HIGH ///< GPIO pin level for status LED ON
/* -------------- DHT SENSOR CFG ----------------*/
#define DHT_SENSOR_ENABLE true ///< enable/disable DHT sensor
#define DHT_SENSOR_PIN 46 ///< GPIO pin for DHT sensor
#endif // ESP32_WROVER_DEV
/* EOF */

View File

@ -69,6 +69,7 @@
#define ENABLE_CAMERA_FLASH false ///< Enable camera flash function
#define CAMERA_FLASH_DIGITAL_CTRL false ///< Enable camera flash digital control
#define CAMERA_FLASH_PWM_CTRL false ///< Enable camera flash PWM control
#define CAMERA_FLASH_NEOPIXEL false ///< Enable camera flash NeoPixel control
#define FLASH_GPIO_NUM -1 ///< Flash control pin
#define FLASH_OFF_STATUS 0 ///< PWM intensity LED for OFF. 0-2^FLASH_PWM_RESOLUTION = 0-255
#define FLASH_ON_STATUS 205 ///< PWM intensity LED for ON. limitation to 80%. 2^FLASH_PWM_RESOLUTION * 0.8% = 204

View File

@ -6,10 +6,32 @@
@author Miroslav Pivovarsky
Contact: miroslav.pivovarsky@gmail.com
https://www.seeedstudio.com/XIAO-ESP32S3-Sense-p-5639.html
https://wiki.seeedstudio.com/xiao_esp32s3_getting_started/
https://www.seeedstudio.com/XIAO-ESP32S3-Sense-p-5639.html
https://wiki.seeedstudio.com/xiao_esp32s3_getting_started/
https://github.com/limengdu/SeeedStudio-XIAO-ESP32S3-Sense-camera
https://github.com/Seeed-Studio/XIAO_Series
@bug: Currently SW don't work with this DEV board. WiFi and MicroSD is not working
Board configuration in the arduino IDE 2.3.2
Tools -> Board -> ESP32 Arduino -> XIAO_ESP32S3
Tools -> USB CDC on BOOT -> Enabled
Tools -> CPU Frequency -> 160MHz (WiFi)
Tools -> Core debug level -> None
Tools -> USB DFU on BOOT -> Disable
Tools -> Erase all Flash Before Sketch Upload -> Disable (first flash, new board = enable. otherwise = disable)
Tools -> Events Run On -> Core 1
Tools -> Flash Mode -> QIO 80MHz
Tools -> Flash Size -> 8MB
Tools -> Jtag Adapter -> Disable
Tools -> Arduino Runs On -> Core 1
Tools -> USB Firmware MSC On Boot -> Disable
Tools -> Partition scheme -> 3MB APP/1.5MB SPIFFS
Tools -> PSRAM -> OPI PSRAM
Tools -> Upload Mode -> UART0 / Hardware CDC
Tools -> Upload Speed -> 921600
Tools -> USB Mode -> Hardware CDC and JTAG
@bug:
*/
@ -43,7 +65,7 @@
#define ENABLE_PSRAM true ///< Enable PSRAM
/* --------------- OTA UPDATE CFG --------------*/
#define OTA_UPDATE_FW_FILE PSTR("ESP32S3_EYE22_PrusaConnectCam.ino.bin") ///< OTA update firmware file name
#define OTA_UPDATE_FW_FILE PSTR("XIAO_ESP32S3.bin") ///< OTA update firmware file name
#define FW_STATUS_LED_PIN 21 ///< GPIO pin for status FW update LED
#define FW_STATUS_LED_LEVEL_ON LOW ///< GPIO pin level for status LED ON
@ -51,7 +73,9 @@
#define ENABLE_CAMERA_FLASH true ///< Enable camera flash function
#define CAMERA_FLASH_DIGITAL_CTRL true ///< Enable camera flash digital control
#define CAMERA_FLASH_PWM_CTRL false ///< Enable camera flash PWM control
#define FLASH_GPIO_NUM 4 ///< Flash control pin. This is pin for enable LCD backlight
#define CAMERA_FLASH_NEOPIXEL false ///< Enable camera flash NeoPixel control
#define FLASH_GPIO_NUM 4 ///< Flash control pin.
#define FLASH_NEOPIXEL_LED_PIN -1 ///< External flash control pin. RGB LED NeoPixel
#define FLASH_OFF_STATUS LOW ///< value for flash OFF
#define FLASH_ON_STATUS HIGH ///< value for flash ON
//#define FLASH_PWM_FREQ 2000 ///< frequency of pwm [240MHz / (100 prescale * pwm cycles)] = frequency
@ -60,9 +84,9 @@
/* --------------- SD CARD CFG ---------------*/
#define ENABLE_SD_CARD true ///< Enable SD card function
#define SD_PIN_CLK 8 ///< GPIO pin for SD card clock
#define SD_PIN_CMD 10 ///< GPIO pin for SD card command
#define SD_PIN_DATA0 9 ///< GPIO pin for SD card data 0
#define SD_PIN_CLK 7 ///< GPIO pin for SD card clock
#define SD_PIN_CMD 9 ///< GPIO pin for SD card command
#define SD_PIN_DATA0 8 ///< GPIO pin for SD card data 0
/* ---------- RESET CFG CONFIGURATION ----------*/
#define CFG_RESET_PIN 2 ///< GPIO 1 is for reset CFG to default. This is button UP+`
@ -72,7 +96,11 @@
/* -------------- STATUS LED CFG ----------------*/
#define STATUS_LED_ENABLE true ///< enable/disable status LED
#define STATUS_LED_GPIO_NUM 21 ///< GPIO pin for status LED
#define STATUS_LED_OFF_PIN_LEVEL HIGH ///< GPIO pin level for status LED ON
#define STATUS_LED_OFF_PIN_LEVEL LOW ///< GPIO pin level for status LED ON
/* -------------- DHT SENSOR CFG ----------------*/
#define DHT_SENSOR_ENABLE true ///< enable/disable DHT sensor
#define DHT_SENSOR_PIN 1 ///< GPIO pin for DHT sensor
#endif // CAMERA_MODEL_XIAO_ESP32_S3_CAM
/* EOF */

View File

@ -14,6 +14,10 @@
#include "mcu_cfg.h"
#if ((AI_THINKER_ESP32_CAM + ESP32_WROVER_DEV + CAMERA_MODEL_ESP32_S3_DEV_CAM + CAMERA_MODEL_ESP32_S3_EYE_2_2 + CAMERA_MODEL_XIAO_ESP32_S3_CAM + CAMERA_MODEL_ESP32_S3_CAM + ESP32_S3_WROOM_FREENOVE) != 1)
#error "Exactly one camera model must be defined as true."
#endif
#if (true == AI_THINKER_ESP32_CAM)
#include "module_AI_Thinker_ESP32-CAM.h"
@ -30,7 +34,10 @@
#include "module_XIAO_ESP32-S3-cam.h"
#elif (true == CAMERA_MODEL_ESP32_S3_CAM)
#include "module_ESP32_S3_CAM.h"
#include "module_ESP32-S3-CAM.h"
#elif (true == ESP32_S3_WROOM_FREENOVE)
#include "module_ESP32-S3_Wroom_Freenove.h"
#else
#error "No module selected"

View File

@ -139,7 +139,15 @@ String lastTwoChars = command.substring(command.length() - 2);
} else if (command.startsWith("setlight") && command.endsWith(";")) {
cam->SetCameraFlashEnable(false);
cam->SetFlashStatus(!cam->GetFlashStatus());
log->AddEvent(LogLevel_Warning, "--> Console set LIGHT: " + String(cam->GetFlashStatus()));
log->AddEvent(LogLevel_Warning, "--> Console set LIGHT: " + String(cam->GetFlashStatus()));
} else if (command.startsWith("loglevel:") && command.endsWith(";")) {
uint8_t level = command.substring(9, command.length() -1).toInt();
log->AddEvent(LogLevel_Info, F("--> Console set log level: "), String(level));
if ((level >= LogLevel_Error) && (level <= LogLevel_Verbose)) {
config->SaveLogLevel((LogLevel_enum) level);
log->SetLogLevel((LogLevel_enum) level);
}
} else if (command.startsWith("mcureboot") && command.endsWith(";")) {
log->AddEvent(LogLevel_Warning, F("--> Reboot MCU!"));
@ -186,6 +194,7 @@ void SerialCfg::PrintAvailableCommands() {
Serial.println(F("photoquality:QUALITY; - set photo quality. 10-63 lower number means higher quality "));
Serial.println(F("setflash; - enable/disable LED flash"));
Serial.println(F("setlight; - enable/disable LED light"));
Serial.println(F("loglevel:LEVEL; - set log level. 0=Error, 1=Warning, 2=Info, 3=Verbose"));
Serial.println(F("mcureboot; - reboot MCU"));
Serial.println(F("commandslist; - print available commands"));
Serial.println(F("-----------------------------------"));

View File

@ -18,23 +18,23 @@
class Logs;
class sys_led {
private:
uint8_t pin; ///< pin number for system LED
uint32_t time; ///< speed blinking time system LED
uint32_t ledOnDuration; ///< duration of LED on
Logs *log; ///< pointer to log class
private:
uint8_t pin; ///< pin number for system LED
uint32_t time; ///< speed blinking time system LED
uint32_t ledOnDuration; ///< duration of LED on
Logs *log; ///< pointer to log class
public:
sys_led(uint8_t, uint32_t);
sys_led(uint8_t, uint32_t, Logs *);
~sys_led(){};
public:
sys_led(uint8_t, uint32_t);
sys_led(uint8_t, uint32_t, Logs *);
~sys_led(){};
void init();
void toggle();
void set(bool);
bool get();
void setTimer(uint32_t);
uint32_t getTimer();
void init();
void toggle();
void set(bool);
bool get();
void setTimer(uint32_t);
uint32_t getTimer();
};
extern sys_led system_led;

View File

@ -459,9 +459,6 @@ void System_TaskWifiManagement(void *pvParameters) {
/* wifi reconnect after signal lost */
SystemWifiMngt.WiFiReconnect();
SystemLog.AddEvent(LogLevel_Info, "Free RAM: " + String(ESP.getFreeHeap()) + " B" + ", Min: " + String(ESP.getMinFreeHeap()));
SystemLog.AddEvent(LogLevel_Info, "Free PSRAM: " + String(ESP.getFreePsram()) + " B" + ", Min: " + String(ESP.getMinFreePsram()));
SystemLog.AddEvent(LogLevel_Info, "Temperature: " + String(McuTemperature.TemperatureCelsius) + " *C");
SystemLog.AddEvent(LogLevel_Verbose, F("WiFiManagement task. Stack free size: "), String(uxTaskGetStackHighWaterMark(NULL)) + "B");
SystemLog.AddEvent(LogLevel_Verbose, F("WiFi status: "), String(WiFi.status()));
@ -615,30 +612,36 @@ void System_TaskSerialCfg(void *pvParameters) {
}
/**
* @brief Function for stream telemetry task
* @brief Function for system telemetry task
*
* @param void *pvParameters
* @return none
*/
void System_TaskStreamTelemetry(void *pvParameters) {
SystemLog.AddEvent(LogLevel_Info, F("StreamTelemetry task. core: "), String(xPortGetCoreID()));
void System_TaskSystemTelemetry(void *pvParameters) {
SystemLog.AddEvent(LogLevel_Info, F("SystemTelemetry task. core: "), String(xPortGetCoreID()));
TickType_t xLastWakeTime = xTaskGetTickCount();
while (1) {
esp_task_wdt_reset();
SystemLog.AddEvent(LogLevel_Verbose, F("StreamTelemetry task. Stack free size: "), String(uxTaskGetStackHighWaterMark(NULL)) + "B");
SystemLog.AddEvent(LogLevel_Verbose, F("SystemTelemetry task. Stack free size: "), String(uxTaskGetStackHighWaterMark(NULL)) + "B");
if (SystemCamera.GetStreamStatus()) {
char buf[80] = { '\0' };
sprintf(buf, "Stream, average data in %dsec. FPS: %.1f, Size: %uKB", (TASK_STREAM_TELEMETRY / SECOND_TO_MILISECOND), SystemCamera.StreamGetFrameAverageFps(), SystemCamera.StreamGetFrameAverageSize());
sprintf(buf, "Stream, average data in %dsec. FPS: %.1f, Size: %uKB", (TASK_SYSTEM_TELEMETRY / SECOND_TO_MILISECOND), SystemCamera.StreamGetFrameAverageFps(), SystemCamera.StreamGetFrameAverageSize());
SystemLog.AddEvent(LogLevel_Info, buf);
SystemCamera.StreamClearFrameData();
}
SystemLog.AddEvent(LogLevel_Info, "Free RAM: " + String(ESP.getFreeHeap()) + " B" + ", Min: " + String(ESP.getMinFreeHeap()));
SystemLog.AddEvent(LogLevel_Info, "Free PSRAM: " + String(ESP.getFreePsram()) + " B" + ", Min: " + String(ESP.getMinFreePsram()));
SystemLog.AddEvent(LogLevel_Info, "MCU Temperature: " + String(McuTemperature.TemperatureCelsius) + " *C");
ExternalTemperatureSensor.ReadSensorData();
/* reset wdg */
esp_task_wdt_reset();
/* next start task */
vTaskDelayUntil(&xLastWakeTime, TASK_STREAM_TELEMETRY / portTICK_PERIOD_MS);
vTaskDelayUntil(&xLastWakeTime, TASK_SYSTEM_TELEMETRY / portTICK_PERIOD_MS);
}
}

View File

@ -38,6 +38,7 @@
#include "connect.h"
#include "serial_cfg.h"
#include "sys_led.h"
#include "ExternalTemperatureSensor.h"
#define SYSTEM_MSG_UPDATE_DONE F("FW update successfully done! Please reboot the MCU.")
#define SYSTEM_MSG_UPDATE_FAIL F("FW update failed! Please reboot MCU, and try again.")
@ -66,7 +67,7 @@ void System_TaskMain(void *);
void System_TaskCaptureAndSendPhoto(void *);
void System_TaskSdCardCheck(void *);
void System_TaskSerialCfg(void *);
void System_TaskStreamTelemetry(void *);
void System_TaskSystemTelemetry(void *);
void System_TaskSysLed(void *);
void System_TaskWiFiWatchdog(void *);
void System_TaskSdCardRemove(void *);

View File

@ -20,7 +20,7 @@ TaskHandle_t Task_WiFiManagement;
TaskHandle_t Task_SystemMain;
TaskHandle_t Task_SdCardCheck;
TaskHandle_t Task_SerialCfg;
TaskHandle_t Task_StreamTelemetry;
TaskHandle_t Task_SystemTelemetry;
TaskHandle_t Task_SysLed;
TaskHandle_t Task_WiFiWatchdog;
//TaskHandle_t Task_SdCardFileRemove;

View File

@ -49,7 +49,7 @@ extern TaskHandle_t Task_WiFiManagement; ///< task handle for wifi m
extern TaskHandle_t Task_SystemMain; ///< task handle for system main
extern TaskHandle_t Task_SdCardCheck; ///< task handle for sd card check
extern TaskHandle_t Task_SerialCfg; ///< task handle for serial configuration
extern TaskHandle_t Task_StreamTelemetry; ///< task handle for stream telemetry
extern TaskHandle_t Task_SystemTelemetry; ///< task handle for system telemetry
extern TaskHandle_t Task_SysLed; ///< task handle for system led
extern TaskHandle_t Task_WiFiWatchdog; ///< task handle for wifi watchdog
//extern TaskHandle_t Task_SdCardFileRemove; ///< task handle for remove file from sd card

View File

@ -230,12 +230,24 @@ void WiFiMngt::WiFiStaConnect() {
if (config->CheckActifeWifiCfgFlag() == true) {
system_led.setTimer(STATUS_LED_STA_CONNECTING);
if (false == WiFiStaMultipleNetwork) {
#if (WIFI_DISABLE_UNENCRYPTED_STA_PASS_CHECK == true)
if (WifiPassword == "") {
WiFi.begin(WifiSsid);
log->AddEvent(LogLevel_Info, F("Connecting to STA SSID without password"));
} else {
WiFi.begin(WifiSsid, WifiPassword);
}
#else
WiFi.begin(WifiSsid, WifiPassword);
#endif
log->AddEvent(LogLevel_Info, F("Connecting to STA SSID"));
} else if (true == WiFiStaMultipleNetwork) {
WiFi.begin(WifiSsid, WifiPassword, 0, WiFiStaNetworkBssid);
log->AddEvent(LogLevel_Info, F("Connecting to STA BSSID"));
}
WiFi.setSleep(false);
WiFi.setAutoReconnect(true);
}
}
@ -303,8 +315,10 @@ uint8_t WiFiMngt::ScanWifiNetwork(String ssid) {
WifiScanJson = "";
/* make json with each found WI-FI networks */
if (n == 0) {
log->AddEvent(LogLevel_Info, F("No networks found!"));
if (n <= 0) {
log->AddEvent(LogLevel_Info, "No networks found! [" + String(n) + "]");
ret = 0;
} else {
log->AddEvent(LogLevel_Info, String(n) + " networks found");
log->AddEvent(LogLevel_Info, F("Nr | SSID | RSSI | CH | BSSID | Encryption"));
@ -344,7 +358,7 @@ uint8_t WiFiMngt::ScanWifiNetwork(String ssid) {
log->AddEvent(LogLevel_Verbose, WifiScanJson);
/* print status */
if (1 <= ret) {
if (ret >= 1) {
log->AddEvent(LogLevel_Info, "SSID: " + ssid + " found, " + String(ret) + "x");
if (1 < ret) {
memcpy(WiFiStaNetworkBssid, bssid, 6);
@ -353,8 +367,10 @@ uint8_t WiFiMngt::ScanWifiNetwork(String ssid) {
sprintf(mac, "%02X:%02X:%02X:%02X:%02X:%02X", WiFiStaNetworkBssid[0], WiFiStaNetworkBssid[1], WiFiStaNetworkBssid[2], WiFiStaNetworkBssid[3], WiFiStaNetworkBssid[4], WiFiStaNetworkBssid[5]);
log->AddEvent(LogLevel_Info, "WiFi roaming found! Connecting to " + String(mac) + " -> " + String(bestSignal) + "dBm, " + String(WiFiStaMultipleNetwork));
}
} else {
log->AddEvent(LogLevel_Info, "SSID: " + ssid + " not found");
ret = 0;
}
return ret;
@ -404,15 +420,19 @@ void WiFiMngt::WiFiWatchdog() {
/* when is enabled wifi configuration, and is not connected to wifi network, and is available at least one wifi network */
if ((true == config->CheckActifeWifiCfgFlag()) && (WL_CONNECTED != WiFi.status()) && (true == GetFirstConnection())) {
log->AddEvent(LogLevel_Warning, F("WiFi WDG. STA connection lost."));
log->AddEvent(LogLevel_Warning, "WiFi WDG. STA connection lost. " + String(StartStaWdg));
unsigned long currentMillis = millis();
log->AddEvent(LogLevel_Verbose, "Time: " + String(currentMillis - TaskWdg_previousMillis) + "/" + String(WIFI_STA_WDG_TIMEOUT));
if (false == StartStaWdg) {
if (ScanWifiNetwork(WifiSsid) >= 1) {
StartStaWdg = true;
TaskWdg_previousMillis = currentMillis;
log->AddEvent(LogLevel_Warning, F("WiFi STA connection lost. Start watchdog timer!"));
} else {
log->AddEvent(LogLevel_Warning, F("WiFi STA connection lost. No available network!"));
}
StartStaWdg = true;
TaskWdg_previousMillis = currentMillis;
}
if ((true == StartStaWdg) && (currentMillis - TaskWdg_previousMillis >= WIFI_STA_WDG_TIMEOUT)) {
@ -420,10 +440,12 @@ void WiFiMngt::WiFiWatchdog() {
/* restart MCU, or disconnect and connect to WiFi again ? From my point of view, and testing, restart MCU is better */
ESP.restart();
}
} else if (true == StartStaWdg) {
log->AddEvent(LogLevel_Info, F("WiFi STA connection OK. Stop watchdog timer!"));
log->AddEvent(LogLevel_Info, F("WiFi WDG. WiFi STA connection OK. Stop watchdog timer!"));
StartStaWdg = false;
TaskWdg_previousMillis = millis();
}
}
@ -803,6 +825,7 @@ void WiFiMngt::SetEnableServiceAp(bool i_data) {
*/
void WiFiMngt::ConnectToSta() {
config->SaveWifiCfgFlag(CFG_WIFI_SETTINGS_SAVED);
WiFiStaConnect();
}
/**

172
README.md
View File

@ -1,20 +1,22 @@
# PrusaConnect ESP32-CAM
This repository includes source code and firmware releases for the **ESP32-cam** module programmed in the **Arduino IDE**. Currently, several versions of boards built on **ESP32/ESP32S3** processors with a camera chip are supported. Below is the list supported boards. Additionally, for each supported board, there is a guide on how to upload the firmware, how to compile code for it, and a basic data informations/issues for the board.
This repository includes source code and firmware releases for the **ESP32-cam** module programmed in the **Arduino IDE**. Currently, several versions of boards built on **ESP32/ESP32S3** processors with a camera chip are supported. You can find a list of supported boards below. Additionally, for each supported board, there is a guide on how to upload the firmware, how to compile code for it, some basic information and a list of known issues for this particular board.
This project uses other libraries. It is necessary to install them in the Arduino IDE.
- App [Arduino IDE 2.3.2](https://www.arduino.cc/en/software)
- MCU support [arduino-ESP32 3.0.2](https://github.com/espressif/arduino-esp32)
This project uses other libraries. It is necessary to install them in the Arduino IDE:
- App [Arduino IDE 2.3.4](https://www.arduino.cc/en/software)
- MCU support [arduino-ESP32 3.1.0](https://github.com/espressif/arduino-esp32)
- ~~Library [ESPAsyncWebSrv 1.2.7](https://github.com/dvarrel/ESPAsyncWebSrv)~~ To version **1.0.3-rc1**
- ~~Library [AsyncTCP 1.1.4](https://github.com/dvarrel/AsyncTCP)~~ To version **1.0.3-rc1**
- Library [AsyncTCP 3.1.4](https://github.com/mathieucarbou/AsyncTCP)
- Library [ESPAsyncWebServer 3.0.3](https://github.com/mathieucarbou/ESPAsyncWebServer)
- Library [ArduinoJson 7.1.0](https://github.com/bblanchon/ArduinoJson)
- Library [AsyncTCP 3.3.1](https://github.com/mathieucarbou/AsyncTCP)
- Library [ESPAsyncWebServer 3.4.5](https://github.com/mathieucarbou/ESPAsyncWebServer)
- Library [ArduinoJson 7.3.0](https://github.com/bblanchon/ArduinoJson)
- Library [UniqueID 1.3.0](https://github.com/ricaun/ArduinoUniqueID)
- Library [DHTnew 0.5.2](https://github.com/RobTillaart/DHTNew)
What we need for functionality
What we need for functionality:
- Supported versions of boards built on **ESP32/ESP32-S3** processors with a camera [here](#supported_boards)
- How to flash binary files to ESP32-cam board from Linux/MAC/Windows [ here ](#flash_fw)
- How to flash using Chrome [here](#browser_flash)
- How to compile software in the Arduino IDE [here](#arduino_lib)
- How to connect camera board to Prusa Connect [here](#prusa_connect)
- Service AP [here](#service_ap)
@ -25,31 +27,49 @@ What we need for functionality
- WEB API [here](#rest)
- Video stream [here](#stream)
- Manual camera focus [here](#man_focus)
- External temperature sensor DHT22/DHT11 [here](#ext_temp)
- Potential issue [here](#issue)
<a name="supported_boards"></a>
## Supported boards
| Board name | Support | Stream | Micro SD | FLASH LED | FW update | Documentation |
|---------------------------|-------------|--------|----------|-----------|-----------|----------------------------------------------|
| Ai-Thinker ESP32-cam | Full | Yes | Yes | Board/Ext | Yes | [ here ](doc/AI_Thinker-ESP32-cam/README.md) |
| ESP32-S3-EYE 2.2 | Full | Yes | Yes | External | Yes | [ here ](doc/ESP32-S3-EYE-22/README.md) |
| Freenove ESP32-Wrover cam | Full | Yes | No | External | Yes | [ here ](doc/ESP32-Wrover-dev/README.md) |
| ESP32-S3-DEV-CAM | in Progress | | | External | | [ here ](doc/ESP32-S3-DEV-CAM/README.md) |
| Seeed Studio XIAO ESP32S3 | in Progress | | | External | | [ here ](doc/XIAO_ESP32S3/README.md) |
| ESP32-S3-CAM | in Progress | | | Board/Ext | | [ here ](doc/ESP32-S3-CAM/README.md) |
| Board name | Support | Stream | Micro SD | FLASH LED | FW update | DHT22/DHT11 | Documentation |
|---------------------------|-------------|--------|----------|-----------|-----------|-------------|---------------------------------------------------|
| Ai-Thinker ESP32-cam | Full | Yes | Yes | Board/Ext | Yes | Yes | [ here ](doc/AI_Thinker-ESP32-cam/README.md) |
| ESP32-S3-EYE 2.2 | Full | Yes | Yes | External | Yes | Yes | [ here ](doc/ESP32-S3-EYE-22/README.md) |
| Freenove ESP32-Wrover cam | Full | Yes | No | External | Yes | Yes | [ here ](doc/ESP32-Wrover-dev/README.md) |
| Freenove ESP32-S3-Wroom | Full | Yes | Yes | Board/Ext | Yes | Yes | [ here ](doc/Freenove%20ESP32-S3-Wroom/README.md) |
| ESP32-S3-DEV-CAM | in Progress | | | External | | | [ here ](doc/ESP32-S3-DEV-CAM/README.md) |
| Seeed Studio XIAO ESP32S3 | Full | Yes | Yes | External | Yes | Yes | [ here ](doc/XIAO_ESP32S3/README.md) |
| ESP32-S3-CAM | Full | Yes | Yes | Board/Ext | Yes | Yes | [ here ](doc/ESP32-S3-CAM/README.md) |
The compiled firmware for each supported board is published with every release.
<a name="flash_fw"></a>
## How to flash binary files to ESP32-cam board from Linux/MAC/Windows
Uploading a precompiled version of the firmware to the MCU is possible from either Linux or Windows OS. Since different boards use various processors and modules, it is not possible to create a single universal guide. Therefore, it is necessary to select the board you are using and then refer to the documentation on how to upload the firmware to it. Here is list with currently [supported boards](#supported_boards).
<a name="browser_flash"></a>
## How to flash using Chrome
It is also possible to flash firmware using ESP Tool on a WEB browser https://espressif.github.io/esptool-js/
**This option is currently not supported on the Ai Thinker ESP32-cam board version.**
Ensure that you set the correct baud rate from the documentation for the board you are using (921600). Select the serial port your board is connected to. You can then click "Add File" and select each .bin file for your board. Make sure that you input the **correct Flash Address** from the documentation from your board. For the initial flash, click "Erase Flash", and when that is complete, click "Program." See below for a screenshot of how to configure ESP Tool for the Freenove Wrover board.
<img src="doc/ESPToolConnect.jpg" width=50% height=50%>
<img src="doc/ESPTool.png" width=50% height=50%>
<img src="doc/ESPToolFinish.jpg" width=50% height=50%>
<a name="arduino_lib"></a>
## How to compile software in the Arduino IDE
The software can be compiled and uploaded to the MCU. Software compilation was done in Arduino IDE. To ensure proper functionality, it is necessary to install support for ESP32 boards into Arduino IDE, as well as several other libraries
The software can be compiled and uploaded to the MCU. Software compilation was done in Arduino IDE. To ensure proper functionality, it is necessary to install support for ESP32 boards into Arduino IDE, as well as several other libraries.
At the first step we need to install support for **ESP32 board**.
As a first step we need to install support for **ESP32 boards**.
**File** -> **Preferences** -> **Additional boards managers URLs**
@ -57,57 +77,66 @@ At the first step we need to install support for **ESP32 board**.
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
```
then go to **Tools** -> **Board** -> **Boards Manager...** and install module **ESP32** by **Espressif Systems**
then go to **Tools** -> **Board** -> **Boards Manager...** and install module **ESP32** by **Espressif Systems**.
The next step is to install the necessary libraries. Go to **Sketch** -> **Include Library** -> **Manage Libraries...** or you can use **Ctrl+Shift+I**. Then you can search for the necessary libraries and install them.
The next step is to install the necessary libraries. Go to **Sketch** -> **Include Library** -> **Manage Libraries...** or you can use **Ctrl+Shift+I**. Here you can search for the necessary libraries and install them.
For the installation of the **ESPAsyncWebServer** and **AsyncTCP** libraries, it is necessary to download the **ZIP** archive from the official **GIT** repository, and then import it using **Sketch** -> **Include Library** -> **Add .ZIP Library ...**
For the installation of the **ESPAsyncWebServer** and **AsyncTCP** libraries, it is necessary to download the **ZIP** archive from the official **GIT** repository, and then import it using **Sketch** -> **Include Library** -> **Add .ZIP Library ...**.
Then it is possible build and upload the firmware to the board. Each board requires a different Arduino IDE configuration. Therefore, it is necessary to select the board from the [supported boards](#supported_boards) and read the documentation on how to build and upload the firmware.
You should now be able to build the firmware and upload it to the board. Each board requires a different Arduino IDE configuration. Therefore, it is necessary to select the board from the [supported boards](#supported_boards) and read the documentation on how to build and upload the firmware.
In the file **mcu_cfg.h**, after line 16 is definitions that specify the version of the board for which the software will be compiled. It is necessary to enable the version of the board that will be used.
**For each specific board type, it's necessary** to update the file called **mcu_cfg.h**. Below **line 16** you can find several definitions that specify the version of the board for which the software will be compiled. It is necessary to enable the version of the board that will be used:
```c
#define AI_THINKER_ESP32_CAM false
#define ESP32_WROVER_DEV true
#define CAMERA_MODEL_ESP32_S3_DEV_CAM false
#define CAMERA_MODEL_ESP32_S3_EYE_2_2 false
#define CAMERA_MODEL_XIAO_ESP32_S3_CAM false
#define CAMERA_MODEL_ESP32_S3_CAM false
```
<a name="prusa_connect"></a>
## How to connect camera board to Prusa Connect
- Open up the **Prusa Connect** webpage [connect.prusa3D.com](https://connect.prusa3D.com)
- Log in
- Go to the **Prusa Connect** webpage [https://connect.prusa3D.com](https://connect.prusa3D.com).
- Log in.
- Select a printer you wish to use the camera for.
- Navigate to the **Camera** tab.
- Click **Add new other camera**
- Click **Add new other camera**.
- **A new camera will appear** in the list. Here, you can give the camera a name.
- This is the most important part: Copy the **TOKEN** for the given camera and save it for later use.
<img src="doc/connect_1.jpg" width=50% height=50%>
<img src="doc/connect_2.jpg" width=50% height=50%>
- Connect the Cam to the **USB Power supply**
- After a brief moment, the camera will start in a **Wi-Fi AP mode**. Essentially, it starts it's own Wi-Fi network. The network name (SSID) is **ESP32_camera_UID**, where **UID** is the first three numbers from the **MCU ID**.
- Connect the Cam to the **USB Power supply**.
- After a brief moment, the camera will start in a **Wi-Fi AP mode**. Essentially, it starts its own Wi-Fi network. The network name (SSID) is **ESP32_camera_UID**, where **UID** is the first three numbers from the **MCU ID**.
- Find the camera in the Wi-Fi list on your computer.
- Enter the default password: **12345678** and connect to it. After establishing a successful connection, your computer might complain about having "No Internet" on the given network. That is OK.
- Open up a new web browser.
- Open up the **192.168.0.1** IP Address as a webpage. Alternatively, you can also use the http://prusa-esp32cam.local hostname (mDNS) instead of the IP Address.
- Enter [http://192.168.0.1](http://192.168.0.1) as the URL. Alternatively, you can also try to use the http://prusa-esp32cam.local hostname (mDNS) instead of the IP address.
- The camera's configuration interface should appear.
- In the **Wi-Fi configuration tab** It's necessary to set the SSID of the WiFi network and the password of the WiFi network to which the camera should connect in order to be able to upload images to Prusa Connect. And click to **Save & Connect** button
- In the **Wi-Fi configuration tab** it's necessary to set the SSID of the WiFi network and the password of the WiFi network to which the camera should connect in order to be able to upload images to Prusa Connect. Make sure to click the **Save & Connect** button when you're done.
<img src="doc/connect_4.jpg" width=50% height=50%>
- In the **Camera configuration tab**, insert the **Token** into the marked field. Click **Save**. **This is the Prusa Connect camera token we have obtained in an earlier step.** Wait until the token has been save successfully.
- In the **Camera configuration tab**, insert the **Token** you have obtained earlier into the marked field. Click **Save**. Wait until the token has been saved successfully.
<img src="doc/connect_3.jpg" width=50% height=50%>
- Since we're in the camera configuration tab already, we can set up the image options:
In this same tab you should also configure a few image settings:
- Set up the **resolution**. This will improve the image quality significantly, as the resolution is set to the lowest possible by default.
- Set up the **Trigger interval** and click **Save**.
- Clicking **Refresh snapshot** will refresh the image you see on the page.
- We should now have completed setting up the camera.
While we are on the ESP camera's configuration page, let's take a quick look at the other options it offers.
- Camera configuration tab contain
While we are on the ESP camera's configuration page, let's take a quick look at the other options it offers:
- Camera configuration tab contains
- Camera cip settings
- Authentication token setting
- Camera flash settings
- Wi-Fi configuration tab contain
- Wi-Fi configuration tab contains
- Setting the wifi network to which the camera can connect
- The possibility of turning off the service AP
- Option to set static IP addresses for WiFi networks to which the camera connects
@ -117,7 +146,7 @@ While we are on the ESP camera's configuration page, let's take a quick look at
- For a manual firmware update, select the firmware file **ESP32_PrusaConnectCam.ino.bin** and click **Upload file & Update**. Afterwards, reboot the camera.
- Update from cloud. To check for firmware updates, select **Check Update from cloud**. If a newer version is available, click **Update from cloud**. Note that the camera has to be connected to the Internet, before using these functions.
- Setting **log level** and getting logs from the camera. To get the logs, it is necessary to have a micro SD card formatted to **FAT32** inserted in the camera!
- Check the status of uploading the image to Prusa Connect using the **PrusaConnect Status:** variable
- Check the status of uploading the image to Prusa Connect using the **PrusaConnect Status:** variable.
**Interesting improvements.** There is a protective film on the camera module. The protective film needs to be removed from the lens.
@ -130,38 +159,37 @@ The second problem is that the camera module is not usually attached to the micr
<a name="service_ap"></a>
## Service AP
After powering on and booting up the camera, it enters **AP mode**, which serves as a configuration mode for the camera. Essentially, it starts its own Wi-Fi network. The network name (SSID) is **ESP32_camera_UID**, where **UID** is the first three numbers from the **MCU ID**, serving as a unique identifier for the camera. The password for connecting to the AP is **12345678**. The camera's IP address is **192.168.0.1**. To configure the camera via **AP mode**, you need to connect to this IP address using a web browser: **http://192.168.0.1**. Alternatively, you can also use the **http://prusa-esp32cam.local** hostname (**mDNS**) instead of the IP Address.
After powering on and booting up the camera, it enters **AP mode**, which serves as a configuration mode for the camera. Essentially, it starts its own Wi-Fi network. The network name (SSID) is **ESP32_camera_UID**, where **UID** is the first three numbers from the **MCU ID**, serving as a unique identifier for the camera. The password for connecting to the AP is **12345678**. The camera's IP address is **192.168.0.1**. To configure the camera via **AP mode**, you need to connect to this IP address using a web browser: **http://192.168.0.1**. Alternatively, you can also use the **http://prusa-esp32cam.local** hostname (**mDNS**) instead of the IP address.
After establishing a successful connection, your computer might display a "**No Internet**" warning for the given network. **This is normal**.
If you have set up a Wi-Fi network name (SSID) and password in the camera for it to connect to, then upon powering on, the camera will automatically connect to the configured Wi-Fi network and simultaneously activate AP mode for **5 minutes**. AP mode is always enabled after powering on and booting up the camera for **5 minutes**. The service Wi-Fi AP is **automatically deactivates** itself after **5 minutes** following each camera startup if no device is connected to the camera.
If you have set up a Wi-Fi network name (SSID) and password in the camera for it to connect to, then upon powering on, the camera will automatically connect to the configured Wi-Fi network and simultaneously activate AP mode for **5 minutes**. AP mode is always enabled after powering on and booting up the camera for **5 minutes**. The service Wi-Fi AP **automatically deactivates** itself after **5 minutes** following each camera startup if no device is connected to the camera.
Service AP is for for the first camera configuration. If the camera is connected to a WiFi network, it is possible to configure it from the local network.
Service AP is for the first camera configuration. If the camera is connected to a WiFi network, it is possible to configure it from the local network.
<a name="factory_cfg"></a>
## How to reset configuration to factory settings
Each version of the [supported board](#supported_boards) uses a different pin for camera reset. Therefore, it is necessary to refer to the documentation for the specific board to determine which pin is used for reset camera configuration to factory configuration.
Each version of the [supported boards](#supported_boards) uses a different pin for camera reset. Therefore, it is necessary to refer to the documentation of the specific board to determine which pin is used to reset the camera configuration to factory defaults.
The procedure is always the same:
The procedure is the same for each board:
- Ground the pin for camera reset configuration.
- Connect the power supply.
- Wait for 10 seconds.
- An LED will start blinking (refer to the board's documentation).
- Disconnect the ground from the camera reset configuration pin.
- The LED will stop blinking.
- The camera configuration will be restored to factory settings.
- The camera configuration will be reset to factory defaults.
<a name="status_led"></a>
## Status LED
On the board, there is a status LED that provides a visual indicator of the module's current status
through blinking at defined intervals. Each [supported board](#supported_boards) has the STATUS LED located in a different place. It is necessary to refer to the documentation to locate the STATUS LED on the board.
On the board, there is a status LED that provides a visual indicator of the module's current status through blinking at defined intervals. Each [supported board](#supported_boards) has the STATUS LED located in a different place. It is necessary to refer to the documentation to locate the STATUS LED on the board.
Upon module activation, the LED illuminates. After processor initialization, the LED exhibits different blinking intervals based on the current mode of the module
Upon module activation, the LED illuminates. After processor initialization, the LED exhibits different blinking intervals based on the current mode of the module:
- **Service AP Mode only:** The LED blinks every **400 ms**, indicating the module's availability in service AP mode.
- **Connecting to WiFi AP:** While connecting to a WiFi Access Point, the LED blinks at intervals of **800 ms**.
- **Connected to WiFi Network:** Upon successful connection to a WiFi network, the LED blinks at intervals of **4000 ms**, signaling a stable connection.
- **Connecting to WiFi AP:** While connecting to a WiFi Access Point, the LED blinks at an interval of **800 ms**.
- **Connected to WiFi Network:** Upon successful connection to a WiFi network, the LED blinks at an interval of **4000 ms**, signaling a stable connection.
- **Problematic State:** If an issue or error occurs, the LED accelerates its blinking to every **100 ms**.
The approximate boot time of the device is 15-20 seconds.
@ -169,14 +197,14 @@ The approximate boot time of the device is 15-20 seconds.
<a name="logs"></a>
## Debug logs
It is possible to save debug logs to a microSD card, but the card must be formatted to FAT32. Currently, the maximum tested capacity for a microSD card is 16GB. If a microSD card is inserted into the camera, it is necessary to reboot the camera. When a microSD card is inserted into the camera before boot, logging to the microSD card is automatically enabled. If no microSD card is inserted, the saving of debug logs to the microSD card is automatically disabled. Enabling the saving of debug logs to a microSD card is only possible during camera boot, so it is necessary to restart the camera after inserting the microSD card. Debug logs are saved as plain text in the file Syslog.log
It is possible to save debug logs to a microSD card, but the card must be formatted to FAT32. Currently, the maximum tested capacity for a microSD card is 16GB. If a microSD card is inserted into the camera, it is necessary to reboot the camera. When a microSD card is inserted into the camera before boot, logging to the microSD card is automatically enabled. If no microSD card is inserted, logging to the microSD card is automatically disabled. Enabling the saving of debug logs to a microSD card is only possible during camera boot, so it is necessary to restart the camera after inserting the microSD card. Debug logs are saved as plain text in the file `SysLog.log`.
<a name="serial_cfg"></a>
## Serial console configuration
Currently, it is possible to set the basic camera configuration using the serial console. Baud speed for communication with MCU is **115200 8N1**
It is possible to set the basic camera configuration using the serial console. Serial port settings for communication with the MCU need to be set to **115200 8N1**.
Commands for configuration have simple syntax
Commands for configuration have a simple syntax:
| command | separator | variable | termination | line terminator |
|--------------|-----------|-----------|-------------|--------------------------|
@ -192,15 +220,16 @@ Currently, available commands are listed in the table below:
| mcureboot | Rebooting the MCU |
| commandslist | Listing currently supported commands via serial console |
| getwifimode | Print current WiFi mode. STA/AP/AP+STA |
| getwifistastatus | Print WiFi STA status. Connected/Disconnected/Connecting.... |
| getwifistastatus | Print WiFi STA status. Connected/Disconnected/Connecting... |
| getwifistaip | Print IP address for WiFi STA |
| getserviceapssid | Print service AP SSID name |
| setauthtoken | Set authentication token for Prusa Connect |
| otaupdate | Start OTA update process |
| resolution | Set photo resolution |
| photoquality | Set photo quality |
| setflash | enable/disable LED flash |
| setlight | enable/disable LED light |
| setflash | Enable/disable LED flash |
| setlight | Enable/disable LED light |
| loglevel | Set log level. 0=Error, 1=Warning, 2=Info, 3=Verbose |
The standard command sequence for camera basic settings is
@ -213,7 +242,7 @@ The standard command sequence for camera basic settings is
<a name="rest"></a>
## WEB API
The camera have a WEB API, allowing several operations to be performed through the web interface.
The camera offers a web API, allowing several operations to be performed through the web interface:
| Command | Description |
|---------------------------|--------------------------------------------------|
@ -226,16 +255,18 @@ The camera have a WEB API, allowing several operations to be performed through t
| http://IP/action_reboot | Reboot MCU |
| http://IP/get_logs | Get logs from micro SD card |
| http://IP/saved-photo.jpg | Get last captured photo |
| http://IP/get_temp | Get temperature from external sensor |
| http://IP/get_hum | Get humidity from external sensor |
<a name="stream"></a>
## Video stream
The video stream is available on the WEB page **http://IP/stream.mjpg**
The video stream is available at **http://IP/stream.mjpg**.
<a name="man_focus"></a>
## Manual camera focus
Usually, the camera module is properly focused. However, the camera module can be manually focused. There are several types of lenses for camera modules. I have created several [Tools](https://www.printables.com/cs/model/877739-esp32-cam-ov2640-focus-adjustment-wrench) for manually focusing the camera module.
Usually, the camera module is properly focused. However, the camera module can be manually focused. There are several types of lenses for camera modules. I have created several [tools](https://www.printables.com/cs/model/877739-esp32-cam-ov2640-focus-adjustment-wrench) for manually focusing the camera module.
<img src="doc/focus_2.jpg" width=40% height=40%>
@ -243,8 +274,33 @@ First, it is necessary to hold the camera with a holder and then put the wrench
**WARNING! Manual focusing can permanently damage the camera module!**
<a name="ext_temp"></a>
## External temperature sensor
The software supports an external temperature sensor **DHT22** or **DHT11**. The sensor needs to be connected according to the manual for the specific version of the board. The temperature and humidity are automatically read every 30 seconds once the sensor has been enabled.
<img src="doc/Sensori-DHT11-e-DHT22.jpg" width=40% height=40%>
Information about sensors:
| | DHT11 | DHT22 |
|-------------------|--------------|------------------|
| Operating voltage | 3-5V | 3-5V |
| Max current | 2.5 mA | 2.5mA |
| Temperature range | 0-50°C ± 2°C | -40-80°C ± 0.5°C |
| Humidity range | 20-80% / 5% | 0-100% / 2-5% |
| Sampling rate | 1Hz | 0.5Hz |
It is necessary to use the **module**, **not the sensor**! The module with the sensor has a **4.7kOhm** resistor soldered onto the PCB, which is necessary for the **one-wire bus** to operate properly. If you use the sensor, it is necessary to connect a 4.7kOhm resistor to the one-wire bus as shown in the schematic below. **The module must be powered with 3.3V VCC, otherwise it may damage the camera board**.
Here is a typical schematic for the DHT22 or DHT11 sensor:
<img src="doc/DHT22-Schematic.png" width=40% height=40%>
<a name="issue"></a>
## Potential issue
## Troubleshooting
- A potential issue may arise with connecting to the service AP. If the connection fails and an authentication error occurs, it is necessary to clear the FLASH memory of the processor, and FLASH FW again. This can be done either through the Arduino IDE or using official software.
- After the initial firmware upload to the new camera, there may be an issue when connecting to the IP address, where the camera prompts for a username and password to access the web page. Even when entering the username "admin" and the password "admin", the login still doesn't work. In such cases, it's necessary to reset the camera configuration to factory settings. The procedure is outlined in the readme file [here](#factory_cfg)
- After the initial firmware upload to a new camera, there may be an issue when connecting to the IP address, where the camera prompts for a username and password to access the web page. Even when entering the username "admin" and the password "admin", the login still doesn't work. In such cases, it's necessary to reset the camera configuration to factory settings. The procedure is outlined in the readme file [here](#factory_cfg).
- If you are getting a 400 return code from Prusa Connect, then you need to create another camera in Prusa Connect and enter a new token into the ESP32 camera.
- If you are getting a 404 return code from Prusa Connect, it may indicate that the printer is powered off. The printer must be powered on in order for images to be uploaded.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

View File

@ -12,12 +12,13 @@ What we need for functionality
- Issue with FLASH LED on the main board [here](#led_issue)
- External WiFi antenna [here](#ext_wifi)
- Power supply [here](#power_supply)
- External temperature sensor DHT22/DHT11 [here](#ext_sens)
- Potential issue [here](#issue)
<a name="esp32"></a>
## ESP32-CAM AI-thinker board
Basic informations:
Basic information:
- Low cost version
- FLASH LED on the board
- Option connecting external FLASH LED
@ -31,7 +32,7 @@ It's a few dollars board with **ESP32** MCU and Camera. It's necessary to buy a
<img src="esp32-cam.jpg" width=30% height=30%>
In the following picture, we can see the **ESP32-CAM** board and the programator for the board.
In the following picture, we can see the **ESP32-CAM** board and the programmer for the board.
<img src="esp32_and_prog.jpg" width=30% height=30%>
@ -116,7 +117,7 @@ And command for FLASH FW is here, where **/dev/ttya0** is your serial interface
./esptool -p /dev/ttya0 -b 460800 --before default_reset --after hard_reset --chip esp32 write_flash --erase-all --flash_mode dio --flash_size 4MB --flash_freq 80m 0x1000 ESP32_PrusaConnectCam.ino.bootloader.bin 0x8000 ESP32_PrusaConnectCam.ino.partitions.bin 0x10000 ESP32_PrusaConnectCam.ino.bin
```
This command contains the parameter **--eras-all**, which erases the entire flash in the MCU. So, for just updating the firmware, it is necessary to remove the parameter **--eras-all**; otherwise, the MCU configuration will also be deleted. The basic command list can be found [here](https://docs.espressif.com/projects/esptool/en/latest/esp32s3/esptool/basic-commands.html)
This command contains the parameter **--erase-all**, which erases the entire flash in the MCU. So, for just updating the firmware, it is necessary to remove the parameter **--erase-all**; otherwise, the MCU configuration will also be deleted. The basic command list can be found [here](https://docs.espressif.com/projects/esptool/en/latest/esp32s3/esptool/basic-commands.html)
Here is the command for updating the firmware in the MCU without erasing the MCU configuration
@ -128,7 +129,7 @@ Launching the esptool application may be different in different operating system
#### Windows
Driver for CH340 USB to UART convert for Windows is for example [here](https://www.wch-ic.com/search?q=CH340&t=downloads) . An older version of the driver is for example [here](https://blog.laskakit.cz/wp-content/uploads/2020/03/CH341SER.zip)
Driver for CH340 USB to UART convert for Windows is for example [here](https://www.wch-ic.com/search?q=CH340&t=downloads) . An older version of the driver is for example [here](https://blog.laskakit.cz/wp-content/uploads/2020/03/CH341SER.zip). SW for FW flash (Flash Download Tools) is [here](https://www.espressif.com/en/support/download/other-tools)
<img src="how to flash chip select.jpg" width=25% height=25%>
@ -233,6 +234,19 @@ The standard ESP32-CAM board utilizes an internal antenna on the PCB. However, t
The device requires a 5V power supply, with a maximum current consumption of 2A. Power is supplied via a micro USB connector when using the original programmer.
<a name="ext_sens"></a>
## External temperature sensor DHT22/DHT11
Below you will find the wiring diagram for the DHT22 or DHT11 sensor.
| Camera board | DHT22/DHT11 |
|--------------|-------------|
| 3.3V | VCC |
| GND | GND |
| IO13 | Data |
<img src="ESP32-cam dht22_bb.png" width=40% height=40%>
<a name="issue"></a>
## Potential issue with this board

Binary file not shown.

BIN
doc/Capture11.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
doc/DHT22-Schematic.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

View File

@ -0,0 +1,157 @@
#include "esp_camera.h"
#include <WiFi.h>
//
// WARNING!!! PSRAM IC required for UXGA resolution and high JPEG quality
// Ensure ESP32 Wrover Module or other board with PSRAM is selected
// Partial images will be transmitted if image exceeds buffer size
//
// You must select partition scheme from the board menu that has at least 3MB APP space.
// Face Recognition is DISABLED for ESP32 and ESP32-S2, because it takes up from 15
// seconds to process single frame. Face Detection is ENABLED if PSRAM is enabled as well
// ===================
// Select camera model
// ===================
//#define CAMERA_MODEL_WROVER_KIT // Has PSRAM
//#define CAMERA_MODEL_ESP_EYE // Has PSRAM
#define CAMERA_MODEL_ESP32S3_EYE // Has PSRAM
//#define CAMERA_MODEL_M5STACK_PSRAM // Has PSRAM
//#define CAMERA_MODEL_M5STACK_V2_PSRAM // M5Camera version B Has PSRAM
//#define CAMERA_MODEL_M5STACK_WIDE // Has PSRAM
//#define CAMERA_MODEL_M5STACK_ESP32CAM // No PSRAM
//#define CAMERA_MODEL_M5STACK_UNITCAM // No PSRAM
//#define CAMERA_MODEL_AI_THINKER // Has PSRAM
//#define CAMERA_MODEL_TTGO_T_JOURNAL // No PSRAM
//#define CAMERA_MODEL_XIAO_ESP32S3 // Has PSRAM
// ** Espressif Internal Boards **
//#define CAMERA_MODEL_ESP32_CAM_BOARD
//#define CAMERA_MODEL_ESP32S2_CAM_BOARD
//#define CAMERA_MODEL_ESP32S3_CAM_LCD
//#define CAMERA_MODEL_DFRobot_FireBeetle2_ESP32S3 // Has PSRAM
//#define CAMERA_MODEL_DFRobot_Romeo_ESP32S3 // Has PSRAM
#include "camera_pins.h"
// ===========================
// Enter your WiFi credentials
// ===========================
const char* ssid = "sparkleiot";
const char* password = "12345678";
void startCameraServer();
void setupLedFlash(int pin);
void setup() {
Serial.begin(115200);
Serial.setDebugOutput(true);
Serial.println();
camera_config_t config;
config.ledc_channel = LEDC_CHANNEL_0;
config.ledc_timer = LEDC_TIMER_0;
config.pin_d0 = Y2_GPIO_NUM;
config.pin_d1 = Y3_GPIO_NUM;
config.pin_d2 = Y4_GPIO_NUM;
config.pin_d3 = Y5_GPIO_NUM;
config.pin_d4 = Y6_GPIO_NUM;
config.pin_d5 = Y7_GPIO_NUM;
config.pin_d6 = Y8_GPIO_NUM;
config.pin_d7 = Y9_GPIO_NUM;
config.pin_xclk = XCLK_GPIO_NUM;
config.pin_pclk = PCLK_GPIO_NUM;
config.pin_vsync = VSYNC_GPIO_NUM;
config.pin_href = HREF_GPIO_NUM;
config.pin_sccb_sda = SIOD_GPIO_NUM;
config.pin_sccb_scl = SIOC_GPIO_NUM;
config.pin_pwdn = PWDN_GPIO_NUM;
config.pin_reset = RESET_GPIO_NUM;
config.xclk_freq_hz = 20000000;
config.frame_size = FRAMESIZE_QVGA;
//config.pixel_format = PIXFORMAT_JPEG; // for streaming
config.pixel_format = PIXFORMAT_RGB565; // for face detection/recognition
config.grab_mode = CAMERA_GRAB_WHEN_EMPTY;
config.fb_location = CAMERA_FB_IN_PSRAM;
config.jpeg_quality = 12;
config.fb_count = 1;
// if PSRAM IC present, init with UXGA resolution and higher JPEG quality
// for larger pre-allocated frame buffer.
if(config.pixel_format == PIXFORMAT_JPEG){
if(psramFound()){
config.jpeg_quality = 10;
config.fb_count = 2;
config.grab_mode = CAMERA_GRAB_LATEST;
} else {
// Limit the frame size when PSRAM is not available
config.frame_size = FRAMESIZE_SVGA;
config.fb_location = CAMERA_FB_IN_DRAM;
}
} else {
// Best option for face detection/recognition
config.frame_size = FRAMESIZE_QVGA;
#if CONFIG_IDF_TARGET_ESP32S3
config.fb_count = 2;
#endif
}
#if defined(CAMERA_MODEL_ESP_EYE)
pinMode(13, INPUT_PULLUP);
pinMode(14, INPUT_PULLUP);
#endif
// camera init
esp_err_t err = esp_camera_init(&config);
if (err != ESP_OK) {
Serial.printf("Camera init failed with error 0x%x", err);
return;
}
sensor_t * s = esp_camera_sensor_get();
// initial sensors are flipped vertically and colors are a bit saturated
if (s->id.PID == OV3660_PID) {
s->set_vflip(s, 1); // flip it back
s->set_brightness(s, 1); // up the brightness just a bit
s->set_saturation(s, -2); // lower the saturation
}
// drop down frame size for higher initial frame rate
if(config.pixel_format == PIXFORMAT_JPEG){
s->set_framesize(s, FRAMESIZE_QVGA);
}
#if defined(CAMERA_MODEL_M5STACK_WIDE) || defined(CAMERA_MODEL_M5STACK_ESP32CAM)
s->set_vflip(s, 1);
s->set_hmirror(s, 1);
#endif
#if defined(CAMERA_MODEL_ESP32S3_EYE)
s->set_vflip(s, 1);
#endif
// Setup LED FLash if LED pin is defined in camera_pins.h
#if defined(LED_GPIO_NUM)
setupLedFlash(LED_GPIO_NUM);
#endif
Serial.println("The device needs to be linked to a 2.4G router........");
Serial.println("SSSID:sparkleiot");
Serial.println("Password:12345678");
WiFi.begin(ssid, password);
WiFi.setSleep(false);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
startCameraServer();
Serial.print("Camera Ready! Use 'http://");
Serial.print(WiFi.localIP());
Serial.println("' to connect");
}
void loop() {
// Do nothing. Everything is done in another task by the web server
delay(10000);
}

View File

@ -0,0 +1,318 @@
#if defined(CAMERA_MODEL_WROVER_KIT)
#define PWDN_GPIO_NUM -1
#define RESET_GPIO_NUM -1
#define XCLK_GPIO_NUM 21
#define SIOD_GPIO_NUM 26
#define SIOC_GPIO_NUM 27
#define Y9_GPIO_NUM 35
#define Y8_GPIO_NUM 34
#define Y7_GPIO_NUM 39
#define Y6_GPIO_NUM 36
#define Y5_GPIO_NUM 19
#define Y4_GPIO_NUM 18
#define Y3_GPIO_NUM 5
#define Y2_GPIO_NUM 4
#define VSYNC_GPIO_NUM 25
#define HREF_GPIO_NUM 23
#define PCLK_GPIO_NUM 22
#elif defined(CAMERA_MODEL_ESP_EYE)
#define PWDN_GPIO_NUM 32
#define RESET_GPIO_NUM -1
#define XCLK_GPIO_NUM 0
#define SIOD_GPIO_NUM 26
#define SIOC_GPIO_NUM 27
#define Y9_GPIO_NUM 35
#define Y8_GPIO_NUM 34
#define Y7_GPIO_NUM 39
#define Y6_GPIO_NUM 36
#define Y5_GPIO_NUM 21
#define Y4_GPIO_NUM 19
#define Y3_GPIO_NUM 18
#define Y2_GPIO_NUM 5
#define VSYNC_GPIO_NUM 25
#define HREF_GPIO_NUM 23
#define PCLK_GPIO_NUM 22
// 4 for flash led or 33 for normal led
#define LED_GPIO_NUM 4
#elif defined(CAMERA_MODEL_M5STACK_PSRAM)
#define PWDN_GPIO_NUM -1
#define RESET_GPIO_NUM 15
#define XCLK_GPIO_NUM 27
#define SIOD_GPIO_NUM 25
#define SIOC_GPIO_NUM 23
#define Y9_GPIO_NUM 19
#define Y8_GPIO_NUM 36
#define Y7_GPIO_NUM 18
#define Y6_GPIO_NUM 39
#define Y5_GPIO_NUM 5
#define Y4_GPIO_NUM 34
#define Y3_GPIO_NUM 35
#define Y2_GPIO_NUM 32
#define VSYNC_GPIO_NUM 22
#define HREF_GPIO_NUM 26
#define PCLK_GPIO_NUM 21
#elif defined(CAMERA_MODEL_M5STACK_V2_PSRAM)
#define PWDN_GPIO_NUM -1
#define RESET_GPIO_NUM 15
#define XCLK_GPIO_NUM 27
#define SIOD_GPIO_NUM 22
#define SIOC_GPIO_NUM 23
#define Y9_GPIO_NUM 19
#define Y8_GPIO_NUM 36
#define Y7_GPIO_NUM 18
#define Y6_GPIO_NUM 39
#define Y5_GPIO_NUM 5
#define Y4_GPIO_NUM 34
#define Y3_GPIO_NUM 35
#define Y2_GPIO_NUM 32
#define VSYNC_GPIO_NUM 25
#define HREF_GPIO_NUM 26
#define PCLK_GPIO_NUM 21
#elif defined(CAMERA_MODEL_M5STACK_WIDE)
#define PWDN_GPIO_NUM -1
#define RESET_GPIO_NUM 15
#define XCLK_GPIO_NUM 27
#define SIOD_GPIO_NUM 22
#define SIOC_GPIO_NUM 23
#define Y9_GPIO_NUM 19
#define Y8_GPIO_NUM 36
#define Y7_GPIO_NUM 18
#define Y6_GPIO_NUM 39
#define Y5_GPIO_NUM 5
#define Y4_GPIO_NUM 34
#define Y3_GPIO_NUM 35
#define Y2_GPIO_NUM 32
#define VSYNC_GPIO_NUM 25
#define HREF_GPIO_NUM 26
#define PCLK_GPIO_NUM 21
#define LED_GPIO_NUM 2
#elif defined(CAMERA_MODEL_M5STACK_ESP32CAM)
#define PWDN_GPIO_NUM -1
#define RESET_GPIO_NUM 15
#define XCLK_GPIO_NUM 27
#define SIOD_GPIO_NUM 25
#define SIOC_GPIO_NUM 23
#define Y9_GPIO_NUM 19
#define Y8_GPIO_NUM 36
#define Y7_GPIO_NUM 18
#define Y6_GPIO_NUM 39
#define Y5_GPIO_NUM 5
#define Y4_GPIO_NUM 34
#define Y3_GPIO_NUM 35
#define Y2_GPIO_NUM 17
#define VSYNC_GPIO_NUM 22
#define HREF_GPIO_NUM 26
#define PCLK_GPIO_NUM 21
#elif defined(CAMERA_MODEL_M5STACK_UNITCAM)
#define PWDN_GPIO_NUM -1
#define RESET_GPIO_NUM 15
#define XCLK_GPIO_NUM 27
#define SIOD_GPIO_NUM 25
#define SIOC_GPIO_NUM 23
#define Y9_GPIO_NUM 19
#define Y8_GPIO_NUM 36
#define Y7_GPIO_NUM 18
#define Y6_GPIO_NUM 39
#define Y5_GPIO_NUM 5
#define Y4_GPIO_NUM 34
#define Y3_GPIO_NUM 35
#define Y2_GPIO_NUM 32
#define VSYNC_GPIO_NUM 22
#define HREF_GPIO_NUM 26
#define PCLK_GPIO_NUM 21
#elif defined(CAMERA_MODEL_AI_THINKER)
#define PWDN_GPIO_NUM 32
#define RESET_GPIO_NUM -1
#define XCLK_GPIO_NUM 0
#define SIOD_GPIO_NUM 26
#define SIOC_GPIO_NUM 27
#define Y9_GPIO_NUM 35
#define Y8_GPIO_NUM 34
#define Y7_GPIO_NUM 39
#define Y6_GPIO_NUM 36
#define Y5_GPIO_NUM 21
#define Y4_GPIO_NUM 19
#define Y3_GPIO_NUM 18
#define Y2_GPIO_NUM 5
#define VSYNC_GPIO_NUM 25
#define HREF_GPIO_NUM 23
#define PCLK_GPIO_NUM 22
// 4 for flash led or 33 for normal led
#define LED_GPIO_NUM 4
#elif defined(CAMERA_MODEL_TTGO_T_JOURNAL)
#define PWDN_GPIO_NUM 0
#define RESET_GPIO_NUM 15
#define XCLK_GPIO_NUM 27
#define SIOD_GPIO_NUM 25
#define SIOC_GPIO_NUM 23
#define Y9_GPIO_NUM 19
#define Y8_GPIO_NUM 36
#define Y7_GPIO_NUM 18
#define Y6_GPIO_NUM 39
#define Y5_GPIO_NUM 5
#define Y4_GPIO_NUM 34
#define Y3_GPIO_NUM 35
#define Y2_GPIO_NUM 17
#define VSYNC_GPIO_NUM 22
#define HREF_GPIO_NUM 26
#define PCLK_GPIO_NUM 21
#elif defined(CAMERA_MODEL_XIAO_ESP32S3)
#define PWDN_GPIO_NUM -1
#define RESET_GPIO_NUM -1
#define XCLK_GPIO_NUM 10
#define SIOD_GPIO_NUM 40
#define SIOC_GPIO_NUM 39
#define Y9_GPIO_NUM 48
#define Y8_GPIO_NUM 11
#define Y7_GPIO_NUM 12
#define Y6_GPIO_NUM 14
#define Y5_GPIO_NUM 16
#define Y4_GPIO_NUM 18
#define Y3_GPIO_NUM 17
#define Y2_GPIO_NUM 15
#define VSYNC_GPIO_NUM 38
#define HREF_GPIO_NUM 47
#define PCLK_GPIO_NUM 13
#elif defined(CAMERA_MODEL_ESP32_CAM_BOARD)
// The 18 pin header on the board has Y5 and Y3 swapped
#define USE_BOARD_HEADER 0
#define PWDN_GPIO_NUM 32
#define RESET_GPIO_NUM 33
#define XCLK_GPIO_NUM 4
#define SIOD_GPIO_NUM 18
#define SIOC_GPIO_NUM 23
#define Y9_GPIO_NUM 36
#define Y8_GPIO_NUM 19
#define Y7_GPIO_NUM 21
#define Y6_GPIO_NUM 39
#if USE_BOARD_HEADER
#define Y5_GPIO_NUM 13
#else
#define Y5_GPIO_NUM 35
#endif
#define Y4_GPIO_NUM 14
#if USE_BOARD_HEADER
#define Y3_GPIO_NUM 35
#else
#define Y3_GPIO_NUM 13
#endif
#define Y2_GPIO_NUM 34
#define VSYNC_GPIO_NUM 5
#define HREF_GPIO_NUM 27
#define PCLK_GPIO_NUM 25
#elif defined(CAMERA_MODEL_ESP32S3_CAM_LCD)
#define PWDN_GPIO_NUM -1
#define RESET_GPIO_NUM -1
#define XCLK_GPIO_NUM 40
#define SIOD_GPIO_NUM 17
#define SIOC_GPIO_NUM 18
#define Y9_GPIO_NUM 39
#define Y8_GPIO_NUM 41
#define Y7_GPIO_NUM 42
#define Y6_GPIO_NUM 12
#define Y5_GPIO_NUM 3
#define Y4_GPIO_NUM 14
#define Y3_GPIO_NUM 47
#define Y2_GPIO_NUM 13
#define VSYNC_GPIO_NUM 21
#define HREF_GPIO_NUM 38
#define PCLK_GPIO_NUM 11
#elif defined(CAMERA_MODEL_ESP32S2_CAM_BOARD)
// The 18 pin header on the board has Y5 and Y3 swapped
#define USE_BOARD_HEADER 0
#define PWDN_GPIO_NUM 1
#define RESET_GPIO_NUM 2
#define XCLK_GPIO_NUM 42
#define SIOD_GPIO_NUM 41
#define SIOC_GPIO_NUM 18
#define Y9_GPIO_NUM 16
#define Y8_GPIO_NUM 39
#define Y7_GPIO_NUM 40
#define Y6_GPIO_NUM 15
#if USE_BOARD_HEADER
#define Y5_GPIO_NUM 12
#else
#define Y5_GPIO_NUM 13
#endif
#define Y4_GPIO_NUM 5
#if USE_BOARD_HEADER
#define Y3_GPIO_NUM 13
#else
#define Y3_GPIO_NUM 12
#endif
#define Y2_GPIO_NUM 14
#define VSYNC_GPIO_NUM 38
#define HREF_GPIO_NUM 4
#define PCLK_GPIO_NUM 3
#elif defined(CAMERA_MODEL_ESP32S3_EYE)
#define PWDN_GPIO_NUM -1
#define RESET_GPIO_NUM -1
#define XCLK_GPIO_NUM 15
#define SIOD_GPIO_NUM 4
#define SIOC_GPIO_NUM 5
#define Y2_GPIO_NUM 11
#define Y3_GPIO_NUM 9
#define Y4_GPIO_NUM 8
#define Y5_GPIO_NUM 10
#define Y6_GPIO_NUM 12
#define Y7_GPIO_NUM 18
#define Y8_GPIO_NUM 17
#define Y9_GPIO_NUM 16
#define VSYNC_GPIO_NUM 6
#define HREF_GPIO_NUM 7
#define PCLK_GPIO_NUM 13
#elif defined(CAMERA_MODEL_DFRobot_FireBeetle2_ESP32S3) || defined(CAMERA_MODEL_DFRobot_Romeo_ESP32S3)
#define PWDN_GPIO_NUM -1
#define RESET_GPIO_NUM -1
#define XCLK_GPIO_NUM 45
#define SIOD_GPIO_NUM 1
#define SIOC_GPIO_NUM 2
#define Y9_GPIO_NUM 48
#define Y8_GPIO_NUM 46
#define Y7_GPIO_NUM 8
#define Y6_GPIO_NUM 7
#define Y5_GPIO_NUM 4
#define Y4_GPIO_NUM 41
#define Y3_GPIO_NUM 40
#define Y2_GPIO_NUM 39
#define VSYNC_GPIO_NUM 6
#define HREF_GPIO_NUM 42
#define PCLK_GPIO_NUM 5
#else
#error "Camera model not selected"
#endif

View File

@ -0,0 +1,5 @@
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x5000,
otadata, data, ota, 0xe000, 0x2000,
app0, app, ota_0, 0x10000, 0x3d0000,
fr, data, , 0x3e0000, 0x20000,
1 # Name Type SubType Offset Size Flags
2 nvs data nvs 0x9000 0x5000
3 otadata data ota 0xe000 0x2000
4 app0 app ota_0 0x10000 0x3d0000
5 fr data 0x3e0000 0x20000

View File

@ -0,0 +1,157 @@
#include "esp_camera.h"
#include <WiFi.h>
//
// WARNING!!! PSRAM IC required for UXGA resolution and high JPEG quality
// Ensure ESP32 Wrover Module or other board with PSRAM is selected
// Partial images will be transmitted if image exceeds buffer size
//
// You must select partition scheme from the board menu that has at least 3MB APP space.
// Face Recognition is DISABLED for ESP32 and ESP32-S2, because it takes up from 15
// seconds to process single frame. Face Detection is ENABLED if PSRAM is enabled as well
// ===================
// Select camera model
// ===================
//#define CAMERA_MODEL_WROVER_KIT // Has PSRAM
//#define CAMERA_MODEL_ESP_EYE // Has PSRAM
//define CAMERA_MODEL_ESP32S3_EYE // Has PSRAM
//#define CAMERA_MODEL_M5STACK_PSRAM // Has PSRAM
//#define CAMERA_MODEL_M5STACK_V2_PSRAM // M5Camera version B Has PSRAM
//#define CAMERA_MODEL_M5STACK_WIDE // Has PSRAM
//#define CAMERA_MODEL_M5STACK_ESP32CAM // No PSRAM
//#define CAMERA_MODEL_M5STACK_UNITCAM // No PSRAM
#define CAMERA_MODEL_AI_THINKER // Has PSRAM
//#define CAMERA_MODEL_TTGO_T_JOURNAL // No PSRAM
//#define CAMERA_MODEL_XIAO_ESP32S3 // Has PSRAM
// ** Espressif Internal Boards **
//#define CAMERA_MODEL_ESP32_CAM_BOARD
//#define CAMERA_MODEL_ESP32S2_CAM_BOARD
//#define CAMERA_MODEL_ESP32S3_CAM_LCD
//#define CAMERA_MODEL_DFRobot_FireBeetle2_ESP32S3 // Has PSRAM
//#define CAMERA_MODEL_DFRobot_Romeo_ESP32S3 // Has PSRAM
#include "camera_pins.h"
// ===========================
// Enter your WiFi credentials
// ===========================
const char* ssid = "sparkleiot";
const char* password = "12345678";
void startCameraServer();
void setupLedFlash(int pin);
void setup() {
Serial.begin(115200);
Serial.setDebugOutput(true);
Serial.println();
camera_config_t config;
config.ledc_channel = LEDC_CHANNEL_0;
config.ledc_timer = LEDC_TIMER_0;
config.pin_d0 = Y2_GPIO_NUM;
config.pin_d1 = Y3_GPIO_NUM;
config.pin_d2 = Y4_GPIO_NUM;
config.pin_d3 = Y5_GPIO_NUM;
config.pin_d4 = Y6_GPIO_NUM;
config.pin_d5 = Y7_GPIO_NUM;
config.pin_d6 = Y8_GPIO_NUM;
config.pin_d7 = Y9_GPIO_NUM;
config.pin_xclk = XCLK_GPIO_NUM;
config.pin_pclk = PCLK_GPIO_NUM;
config.pin_vsync = VSYNC_GPIO_NUM;
config.pin_href = HREF_GPIO_NUM;
config.pin_sccb_sda = SIOD_GPIO_NUM;
config.pin_sccb_scl = SIOC_GPIO_NUM;
config.pin_pwdn = PWDN_GPIO_NUM;
config.pin_reset = RESET_GPIO_NUM;
config.xclk_freq_hz = 20000000;
config.frame_size = FRAMESIZE_QVGA;
//config.pixel_format = PIXFORMAT_JPEG; // for streaming
config.pixel_format = PIXFORMAT_RGB565; // for face detection/recognition
config.grab_mode = CAMERA_GRAB_WHEN_EMPTY;
config.fb_location = CAMERA_FB_IN_PSRAM;
config.jpeg_quality = 12;
config.fb_count = 1;
// if PSRAM IC present, init with UXGA resolution and higher JPEG quality
// for larger pre-allocated frame buffer.
if(config.pixel_format == PIXFORMAT_JPEG){
if(psramFound()){
config.jpeg_quality = 10;
config.fb_count = 2;
config.grab_mode = CAMERA_GRAB_LATEST;
} else {
// Limit the frame size when PSRAM is not available
config.frame_size = FRAMESIZE_SVGA;
config.fb_location = CAMERA_FB_IN_DRAM;
}
} else {
// Best option for face detection/recognition
config.frame_size = FRAMESIZE_QVGA;
#if CONFIG_IDF_TARGET_ESP32S3
config.fb_count = 2;
#endif
}
#if defined(CAMERA_MODEL_ESP_EYE)
pinMode(13, INPUT_PULLUP);
pinMode(14, INPUT_PULLUP);
#endif
// camera init
esp_err_t err = esp_camera_init(&config);
if (err != ESP_OK) {
Serial.printf("Camera init failed with error 0x%x", err);
return;
}
sensor_t * s = esp_camera_sensor_get();
// initial sensors are flipped vertically and colors are a bit saturated
if (s->id.PID == OV3660_PID) {
s->set_vflip(s, 1); // flip it back
s->set_brightness(s, 1); // up the brightness just a bit
s->set_saturation(s, -2); // lower the saturation
}
// drop down frame size for higher initial frame rate
if(config.pixel_format == PIXFORMAT_JPEG){
s->set_framesize(s, FRAMESIZE_QVGA);
}
#if defined(CAMERA_MODEL_M5STACK_WIDE) || defined(CAMERA_MODEL_M5STACK_ESP32CAM)
s->set_vflip(s, 1);
s->set_hmirror(s, 1);
#endif
#if defined(CAMERA_MODEL_ESP32S3_EYE)
s->set_vflip(s, 1);
#endif
// Setup LED FLash if LED pin is defined in camera_pins.h
#if defined(LED_GPIO_NUM)
setupLedFlash(LED_GPIO_NUM);
#endif
Serial.println("The device needs to be linked to a 2.4G router........");
Serial.println("SSSID:sparkleiot");
Serial.println("Password:12345678");
WiFi.begin(ssid, password);
WiFi.setSleep(false);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
startCameraServer();
Serial.print("Camera Ready! Use 'http://");
Serial.print(WiFi.localIP());
Serial.println("' to connect");
}
void loop() {
// Do nothing. Everything is done in another task by the web server
delay(10000);
}

View File

@ -0,0 +1,318 @@
#if defined(CAMERA_MODEL_WROVER_KIT)
#define PWDN_GPIO_NUM -1
#define RESET_GPIO_NUM -1
#define XCLK_GPIO_NUM 21
#define SIOD_GPIO_NUM 26
#define SIOC_GPIO_NUM 27
#define Y9_GPIO_NUM 35
#define Y8_GPIO_NUM 34
#define Y7_GPIO_NUM 39
#define Y6_GPIO_NUM 36
#define Y5_GPIO_NUM 19
#define Y4_GPIO_NUM 18
#define Y3_GPIO_NUM 5
#define Y2_GPIO_NUM 4
#define VSYNC_GPIO_NUM 25
#define HREF_GPIO_NUM 23
#define PCLK_GPIO_NUM 22
#elif defined(CAMERA_MODEL_ESP_EYE)
#define PWDN_GPIO_NUM 32
#define RESET_GPIO_NUM -1
#define XCLK_GPIO_NUM 0
#define SIOD_GPIO_NUM 26
#define SIOC_GPIO_NUM 27
#define Y9_GPIO_NUM 35
#define Y8_GPIO_NUM 34
#define Y7_GPIO_NUM 39
#define Y6_GPIO_NUM 36
#define Y5_GPIO_NUM 21
#define Y4_GPIO_NUM 19
#define Y3_GPIO_NUM 18
#define Y2_GPIO_NUM 5
#define VSYNC_GPIO_NUM 25
#define HREF_GPIO_NUM 23
#define PCLK_GPIO_NUM 22
// 4 for flash led or 33 for normal led
#define LED_GPIO_NUM 4
#elif defined(CAMERA_MODEL_M5STACK_PSRAM)
#define PWDN_GPIO_NUM -1
#define RESET_GPIO_NUM 15
#define XCLK_GPIO_NUM 27
#define SIOD_GPIO_NUM 25
#define SIOC_GPIO_NUM 23
#define Y9_GPIO_NUM 19
#define Y8_GPIO_NUM 36
#define Y7_GPIO_NUM 18
#define Y6_GPIO_NUM 39
#define Y5_GPIO_NUM 5
#define Y4_GPIO_NUM 34
#define Y3_GPIO_NUM 35
#define Y2_GPIO_NUM 32
#define VSYNC_GPIO_NUM 22
#define HREF_GPIO_NUM 26
#define PCLK_GPIO_NUM 21
#elif defined(CAMERA_MODEL_M5STACK_V2_PSRAM)
#define PWDN_GPIO_NUM -1
#define RESET_GPIO_NUM 15
#define XCLK_GPIO_NUM 27
#define SIOD_GPIO_NUM 22
#define SIOC_GPIO_NUM 23
#define Y9_GPIO_NUM 19
#define Y8_GPIO_NUM 36
#define Y7_GPIO_NUM 18
#define Y6_GPIO_NUM 39
#define Y5_GPIO_NUM 5
#define Y4_GPIO_NUM 34
#define Y3_GPIO_NUM 35
#define Y2_GPIO_NUM 32
#define VSYNC_GPIO_NUM 25
#define HREF_GPIO_NUM 26
#define PCLK_GPIO_NUM 21
#elif defined(CAMERA_MODEL_M5STACK_WIDE)
#define PWDN_GPIO_NUM -1
#define RESET_GPIO_NUM 15
#define XCLK_GPIO_NUM 27
#define SIOD_GPIO_NUM 22
#define SIOC_GPIO_NUM 23
#define Y9_GPIO_NUM 19
#define Y8_GPIO_NUM 36
#define Y7_GPIO_NUM 18
#define Y6_GPIO_NUM 39
#define Y5_GPIO_NUM 5
#define Y4_GPIO_NUM 34
#define Y3_GPIO_NUM 35
#define Y2_GPIO_NUM 32
#define VSYNC_GPIO_NUM 25
#define HREF_GPIO_NUM 26
#define PCLK_GPIO_NUM 21
#define LED_GPIO_NUM 2
#elif defined(CAMERA_MODEL_M5STACK_ESP32CAM)
#define PWDN_GPIO_NUM -1
#define RESET_GPIO_NUM 15
#define XCLK_GPIO_NUM 27
#define SIOD_GPIO_NUM 25
#define SIOC_GPIO_NUM 23
#define Y9_GPIO_NUM 19
#define Y8_GPIO_NUM 36
#define Y7_GPIO_NUM 18
#define Y6_GPIO_NUM 39
#define Y5_GPIO_NUM 5
#define Y4_GPIO_NUM 34
#define Y3_GPIO_NUM 35
#define Y2_GPIO_NUM 17
#define VSYNC_GPIO_NUM 22
#define HREF_GPIO_NUM 26
#define PCLK_GPIO_NUM 21
#elif defined(CAMERA_MODEL_M5STACK_UNITCAM)
#define PWDN_GPIO_NUM -1
#define RESET_GPIO_NUM 15
#define XCLK_GPIO_NUM 27
#define SIOD_GPIO_NUM 25
#define SIOC_GPIO_NUM 23
#define Y9_GPIO_NUM 19
#define Y8_GPIO_NUM 36
#define Y7_GPIO_NUM 18
#define Y6_GPIO_NUM 39
#define Y5_GPIO_NUM 5
#define Y4_GPIO_NUM 34
#define Y3_GPIO_NUM 35
#define Y2_GPIO_NUM 32
#define VSYNC_GPIO_NUM 22
#define HREF_GPIO_NUM 26
#define PCLK_GPIO_NUM 21
#elif defined(CAMERA_MODEL_AI_THINKER)
#define PWDN_GPIO_NUM 32
#define RESET_GPIO_NUM -1
#define XCLK_GPIO_NUM 0
#define SIOD_GPIO_NUM 26
#define SIOC_GPIO_NUM 27
#define Y9_GPIO_NUM 35
#define Y8_GPIO_NUM 34
#define Y7_GPIO_NUM 39
#define Y6_GPIO_NUM 36
#define Y5_GPIO_NUM 21
#define Y4_GPIO_NUM 19
#define Y3_GPIO_NUM 18
#define Y2_GPIO_NUM 5
#define VSYNC_GPIO_NUM 25
#define HREF_GPIO_NUM 23
#define PCLK_GPIO_NUM 22
// 4 for flash led or 33 for normal led
#define LED_GPIO_NUM 4
#elif defined(CAMERA_MODEL_TTGO_T_JOURNAL)
#define PWDN_GPIO_NUM 0
#define RESET_GPIO_NUM 15
#define XCLK_GPIO_NUM 27
#define SIOD_GPIO_NUM 25
#define SIOC_GPIO_NUM 23
#define Y9_GPIO_NUM 19
#define Y8_GPIO_NUM 36
#define Y7_GPIO_NUM 18
#define Y6_GPIO_NUM 39
#define Y5_GPIO_NUM 5
#define Y4_GPIO_NUM 34
#define Y3_GPIO_NUM 35
#define Y2_GPIO_NUM 17
#define VSYNC_GPIO_NUM 22
#define HREF_GPIO_NUM 26
#define PCLK_GPIO_NUM 21
#elif defined(CAMERA_MODEL_XIAO_ESP32S3)
#define PWDN_GPIO_NUM -1
#define RESET_GPIO_NUM -1
#define XCLK_GPIO_NUM 10
#define SIOD_GPIO_NUM 40
#define SIOC_GPIO_NUM 39
#define Y9_GPIO_NUM 48
#define Y8_GPIO_NUM 11
#define Y7_GPIO_NUM 12
#define Y6_GPIO_NUM 14
#define Y5_GPIO_NUM 16
#define Y4_GPIO_NUM 18
#define Y3_GPIO_NUM 17
#define Y2_GPIO_NUM 15
#define VSYNC_GPIO_NUM 38
#define HREF_GPIO_NUM 47
#define PCLK_GPIO_NUM 13
#elif defined(CAMERA_MODEL_ESP32_CAM_BOARD)
// The 18 pin header on the board has Y5 and Y3 swapped
#define USE_BOARD_HEADER 0
#define PWDN_GPIO_NUM 32
#define RESET_GPIO_NUM 33
#define XCLK_GPIO_NUM 4
#define SIOD_GPIO_NUM 18
#define SIOC_GPIO_NUM 23
#define Y9_GPIO_NUM 36
#define Y8_GPIO_NUM 19
#define Y7_GPIO_NUM 21
#define Y6_GPIO_NUM 39
#if USE_BOARD_HEADER
#define Y5_GPIO_NUM 13
#else
#define Y5_GPIO_NUM 35
#endif
#define Y4_GPIO_NUM 14
#if USE_BOARD_HEADER
#define Y3_GPIO_NUM 35
#else
#define Y3_GPIO_NUM 13
#endif
#define Y2_GPIO_NUM 34
#define VSYNC_GPIO_NUM 5
#define HREF_GPIO_NUM 27
#define PCLK_GPIO_NUM 25
#elif defined(CAMERA_MODEL_ESP32S3_CAM_LCD)
#define PWDN_GPIO_NUM -1
#define RESET_GPIO_NUM -1
#define XCLK_GPIO_NUM 40
#define SIOD_GPIO_NUM 17
#define SIOC_GPIO_NUM 18
#define Y9_GPIO_NUM 39
#define Y8_GPIO_NUM 41
#define Y7_GPIO_NUM 42
#define Y6_GPIO_NUM 12
#define Y5_GPIO_NUM 3
#define Y4_GPIO_NUM 14
#define Y3_GPIO_NUM 47
#define Y2_GPIO_NUM 13
#define VSYNC_GPIO_NUM 21
#define HREF_GPIO_NUM 38
#define PCLK_GPIO_NUM 11
#elif defined(CAMERA_MODEL_ESP32S2_CAM_BOARD)
// The 18 pin header on the board has Y5 and Y3 swapped
#define USE_BOARD_HEADER 0
#define PWDN_GPIO_NUM 1
#define RESET_GPIO_NUM 2
#define XCLK_GPIO_NUM 42
#define SIOD_GPIO_NUM 41
#define SIOC_GPIO_NUM 18
#define Y9_GPIO_NUM 16
#define Y8_GPIO_NUM 39
#define Y7_GPIO_NUM 40
#define Y6_GPIO_NUM 15
#if USE_BOARD_HEADER
#define Y5_GPIO_NUM 12
#else
#define Y5_GPIO_NUM 13
#endif
#define Y4_GPIO_NUM 5
#if USE_BOARD_HEADER
#define Y3_GPIO_NUM 13
#else
#define Y3_GPIO_NUM 12
#endif
#define Y2_GPIO_NUM 14
#define VSYNC_GPIO_NUM 38
#define HREF_GPIO_NUM 4
#define PCLK_GPIO_NUM 3
#elif defined(CAMERA_MODEL_ESP32S3_EYE)
#define PWDN_GPIO_NUM -1
#define RESET_GPIO_NUM -1
#define XCLK_GPIO_NUM 15
#define SIOD_GPIO_NUM 4
#define SIOC_GPIO_NUM 5
#define Y2_GPIO_NUM 11
#define Y3_GPIO_NUM 9
#define Y4_GPIO_NUM 8
#define Y5_GPIO_NUM 10
#define Y6_GPIO_NUM 12
#define Y7_GPIO_NUM 18
#define Y8_GPIO_NUM 17
#define Y9_GPIO_NUM 16
#define VSYNC_GPIO_NUM 6
#define HREF_GPIO_NUM 7
#define PCLK_GPIO_NUM 13
#elif defined(CAMERA_MODEL_DFRobot_FireBeetle2_ESP32S3) || defined(CAMERA_MODEL_DFRobot_Romeo_ESP32S3)
#define PWDN_GPIO_NUM -1
#define RESET_GPIO_NUM -1
#define XCLK_GPIO_NUM 45
#define SIOD_GPIO_NUM 1
#define SIOC_GPIO_NUM 2
#define Y9_GPIO_NUM 48
#define Y8_GPIO_NUM 46
#define Y7_GPIO_NUM 8
#define Y6_GPIO_NUM 7
#define Y5_GPIO_NUM 4
#define Y4_GPIO_NUM 41
#define Y3_GPIO_NUM 40
#define Y2_GPIO_NUM 39
#define VSYNC_GPIO_NUM 6
#define HREF_GPIO_NUM 42
#define PCLK_GPIO_NUM 5
#else
#error "Camera model not selected"
#endif

View File

@ -0,0 +1,5 @@
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x5000,
otadata, data, ota, 0xe000, 0x2000,
app0, app, ota_0, 0x10000, 0x3d0000,
fr, data, , 0x3e0000, 0x20000,
1 # Name Type SubType Offset Size Flags
2 nvs data nvs 0x9000 0x5000
3 otadata data ota 0xe000 0x2000
4 app0 app ota_0 0x10000 0x3d0000
5 fr data 0x3e0000 0x20000

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

View File

@ -1,5 +1,200 @@
# ESP32-S3-CAM
In progress
What we need for functionality
- ESP32-S3-CAM board with OV2640 camera module [ here ](#esp32)
- Supported camera modules [here](#cam_modules)
- Module board version [here](#different_mcu)
- How to flash binary files to board from Linux/MAC/Windows [ here ](#flash_fw)
- How to compile software in the Arduino IDE [ here ](#arduino_cfg)
- How to reset the configuration to factory settings [here](#factory_cfg)
- Status LED [ here ](#status_led)
- Schematic main board is [here](#schematic)
- External FLASH LED [here](#led_issue)
- Power supply [here](#power_supply)
- External temperature sensor DHT22/DHT11 [here](#ext_sens)
- Potential issue [here](#issue)
<img src="S2a5f9d4b3dd34ff5911a27bccf34fdeci.webp" width=50% height=50%>
<a name="esp32"></a>
## ESP32-S3-CAM
Basic information:
- Onboard RGB LED (most likely ws2812b)
- Option connecting external FLASH LED
- Micro SD card slot
- Internal or External WiFi antenna
- 16MB FLASH and 8MB external PSRAM
- 520 KB SRAM
- Excellent WiFi signal
- There is no official documentation for this module.
- Additional HW must be purchased for programming
This is a module with an ESP32-S3 processor. It is a dimensional copy of the ESP32-CAM board by AiThinker. The board has the same dimensions but features a more powerful ESP32-S3 processor and an RGB LED for illumination. The LED for illumination is likely of the WS2812B type. There is no official documentation or circuit diagram available for this board. The camera module consists of two boards: the main board with the WiFi MCU, camera, micro SD card slot, and LED for illumination, and a second board used for programming that has a micro USB connector. Board pineout it's not same as on the AiThinker ESP32-CAM.
<img src="board2.png" width=30% height=30%>
<a name="cam_modules"></a>
## Supported camera modules
It's necessary to use a camera version **OV2640**. If using a different camera, modification of the camera's pinout can be needed, or some camera settings may not work correctly. We recommend to use a camera module with a viewing angle of 120° or 160°.
These are currently known or tested camera modules:
| Camera chip | FOV | Resolution | Tested | Works | Description |
|-------------|------|------------|--------|-------|------------------------------------------|
| OV2640 | 66° | 2MP | Yes | Yes | Recommended. Standard camera module |
| OV2640 | 120° | 2MP | Yes | Yes | Recommended |
| OV2640 | 160° | 2MP | Yes | Yes | Recommended |
<a name="flash_fw"></a>
## How to flash binary files to board from Linux/MAC/Windows
#### Partitions table for flashing FW
However, for uploading the firmware, it's important to use this configuration of addresses and files:
ZIP file with build binary files: **esp32-s3-cam.zip**
- address 0x0 - ESP32_PrusaConnectCam.ino.bootloader.bin
- address 0x8000 - ESP32_PrusaConnectCam.ino.partitions.bin
- address 0x10000 - ESP32_PrusaConnectCam.ino.bin
**It is important to download the correct binary files! Each type of camera has its own ZIP archive with files for uploading the firmware.**
#### Linux/MAC
You must use the console to upload the firmware on the MAC or Linux platform. First, ensure you have installed esptool for Python. You can find it on the manufacturer's website, ESPRESSIF, [here](https://docs.espressif.com/projects/esp-at/en/latest/esp32/Get_Started/Downloading_guide.html#linux-or-macos).
And command for FLASH FW is here, where **/dev/ttya0** is your serial interface for communication with the ESP32-cam board. This is the command for the first flash FW to MCU.
```
./esptool --chip esp32s3 -p /dev/ttya0 -b 921600 --before default_reset --after hard_reset write_flash --erase-all --flash_mode dio --flash_size 16MB --flash_freq 80m 0x0 ESP32_PrusaConnectCam.ino.bootloader.bin 0x8000 ESP32_PrusaConnectCam.ino.partitions.bin 0x10000 ESP32_PrusaConnectCam.ino.bin
```
This command contains the parameter **--erase-all**, which erases the entire flash in the MCU. So, for just updating the firmware, it is necessary to remove the parameter **--erase-all**; otherwise, the MCU configuration will also be deleted. The basic command list can be found [here](https://docs.espressif.com/projects/esptool/en/latest/esp32s3/esptool/basic-commands.html)
Here is the command for updating the firmware in the MCU without erasing the MCU configuration
```
./esptool --chip esp32s3 -p /dev/ttya0 -b 921600 --before default_reset --after hard_reset write_flash --flash_mode dio --flash_size 16MB --flash_freq 80m 0x0 ESP32_PrusaConnectCam.ino.bootloader.bin 0x8000 ESP32_PrusaConnectCam.ino.partitions.bin 0x10000 ESP32_PrusaConnectCam.ino.bin
```
Launching the esptool application may be different in different operating systems
#### Windows
The driver should be installed automatically by Windows. SW for FW flash (Flash Download Tools) is [here](https://www.espressif.com/en/support/download/other-tools)
In the first step, you need to open the application **flash download tool**, and select MCU version
<img src="chip_select.jpg" width=25% height=25%>
Then, select the communication port. It's necessary to erase the FLASH using the **ERASE** button before the first firmware flash.
<img src="fw_flash.jpg" width=30% height=30%>
<a name="arduino_cfg"></a>
## How to compile software in the Arduino IDE
Board configuration in the Arduino IDE 2.3.2
- Tools -> Board -> ESP32 Arduino -> ESP32S3 Dev Module
- Tools -> USB CDC on BOOT -> Disable
- Tools -> CPU Frequency -> 240MHz (WiFi/BT)
- Tools -> Core debug level -> None
- Tools -> USB DFU on BOOT -> Disable
- Tools -> Erase all Flash Before Sketch Upload -> Disable (first flash, new board = enable. otherwise = disable)
- Tools -> Events Run On -> Core 1
- Tools -> Flash Mode -> DIO 80MHz
- Tools -> Flash Size -> 16MB
- Tools -> Jtag Adapter -> Disable
- Tools -> Arduino Runs On -> Core 1
- Tools -> USB Firmware MSC On Boot -> Disable
- Tools -> Partition scheme -> Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)
- Tools -> PSRAM -> OPI PSRAM
- Tools -> Upload Mode -> UART0 / Hardware CDC
- Tools -> Upload Speed -> 921600
- Tools -> USB Mode -> Hardware CDC and JTAG
- Tools -> Zigbee mode -> Disable
When flashing the firmware to a new, empty ESP32-S3-CAM Sense device for the first time, it is necessary to use the 'Erase' function.
This can be found under **Tools** -> **Erase all Flash Before Sketch Upload** -> **Enable**.
After the initial firmware upload to the MCU, it's necessary to disable this option. If you do not disable this option, your camera configuration will continue to be erased from the flash memory after uploading new firmware from the Arduino IDE.
It is necessary to enable support for the correct board version in the file **mcu_cfg.h** after line 16.
<a name="factory_cfg"></a>
## How to reset configuration to factory settings
To reset the settings to factory defaults, follow these instructions:
<img src="sw_reset.png" width=30% height=30%>
- Connect PIN **GPIO14** to **ground**.
- **Plug in** the power supply.
- Wait for **10 seconds**.
- After 10 seconds, the **FLASH LED will start flashing**.
- **Disconnect** PIN **GPIO14** from **ground** (but don't disconnect the power supply).
- After disconnecting **GPIO14** from **ground**, the **FLASH LED** will **stop flashing**, and the MCU will **automatically reboot**.
- Now the MCU is in the factory settings.
<a name="status_led"></a>
## Status LED
On the board, there is a status LED that provides a visual indicator of the module's current status
through blinking at defined intervals.
<img src="status_led.png" width=25% height=25%>
Upon module activation, the LED illuminates. After processor initialization, the LED exhibits different blinking intervals based on the current mode of the module
- **Service AP Mode only:** The LED blinks every **400 ms**, indicating the module's availability in service AP mode.
- **Connecting to WiFi AP:** While connecting to a WiFi Access Point, the LED blinks at intervals of **800 ms**.
- **Connected to WiFi Network:** Upon successful connection to a WiFi network, the LED blinks at intervals of **4000 ms**, signaling a stable connection.
- **Problematic State:** If an issue or error occurs, the LED accelerates its blinking to every **100 ms**.
The approximate boot time of the device is 15-20 seconds.
<a name="schematic"></a>
## Schematic for ESP32-S3-CAM
For this board, I was unable to find any official documentation or pinout. The following pinout was determined from PCB analysis.
Pinout
<img src="pinout.drawio.png" width=50% height=50%>
<a name="led_issue"></a>
## FLASH LED
This board version have RGB **FLASH LED** on the board (most likely ws2812b). It is still possible to connect an external LED for illumination. The wiring is shown in the image below.
<img src="relay_flash_bb.png" width=30% height=30%>
For the external LED is in the SW used **GPIO pin 47**.
<img src="ext_led_pins.png" width=30% height=30%>
However, a 5mm LED can also be connected directly. **CAUTION**: The digital GPIO output from the ESP32-S3-CAM board has a current limitation of a **maximum of 40mA**! Therefore, it is recommended to switch the LED using a **transistor** rather than directly through the GPIO pin. Improper use of the GPIO pin can lead to permanent damage.
<a name="power_supply"></a>
## Power Supply
The device requires a 5V power supply, with a maximum current consumption of 2A. Power is supplied via a micro USB connector when using the original programmer.
<a name="ext_sens"></a>
## External temperature sensor DHT22/DHT11
Below you will find the wiring diagram for the DHT22 or DHT11 sensor.
| Camera board | DHT22/DHT11 |
|--------------|-------------|
| 3.3V | VCC |
| GND | GND |
| GPIO20 | Data |
<img src="ESP32-cam dht22_bb.png" width=40% height=40%>
<a name="issue"></a>
## Potential issue with this board
- Slow WEB page loading during first 1 minutes after MCU start

BIN
doc/ESP32-S3-CAM/board.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 538 KiB

BIN
doc/ESP32-S3-CAM/board2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 675 KiB

BIN
doc/ESP32-S3-CAM/board3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 297 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 524 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

116
doc/ESP32-S3-CAM/output.txt Normal file
View File

@ -0,0 +1,116 @@
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x1 (POWERON),boot:0x2a (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd0108,len:0x15c8
load:0x403b6000,len:0x8c8
load:0x403ba000,len:0x2c04
entry 0x403b61c4
I (25) boot: ESP-IDF v4.4-dev-2594-ga20df743f1-dirty 2nd stage bootloader
I (25) boot: compile time 16:57:21
I (25) boot: chip revision: 0
I (29) boot.esp32s3: SPI Speed : 80MHz
I (33) boot.esp32s3: SPI Mode : DIO
I (38) boot.esp32s3: SPI Flash Size : 2MB
I (43) boot: Enabling RNG early entropy source...
W (48) bootloader_random: RNG for ESP32-S3 not currently supported
I (55) boot: Partition Table:
I (59) boot: ## Label Usage Type ST Offset Length
I (66) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (73) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (81) boot: 2 factory factory app 00 00 00010000 00100000
I (88) boot: End of partition table
I (93) esp_image: segment 0: paddr=00010020 vaddr=3c020020 size=090e0h ( 37088) map
I (108) esp_image: segment 1: paddr=00019108 vaddr=3fc90dd0 size=0253ch ( 9532) load
I (111) esp_image: segment 2: paddr=0001b64c vaddr=40374000 size=049cch ( 18892) load
I (122) esp_image: segment 3: paddr=00020020 vaddr=42000020 size=1b660h (112224) map
I (147) esp_image: segment 4: paddr=0003b688 vaddr=403789cc size=08404h ( 33796) load
I (155) esp_image: segment 5: paddr=00043a94 vaddr=50000000 size=00010h ( 16) load
I (160) boot: Loaded app from partition at offset 0x10000
I (160) boot: Disabling RNG early entropy source...
W (164) bootloader_random: RNG for ESP32-S3 not currently supported
I (182) cpu_start: Pro cpu up.
I (182) cpu_start: Starting app cpu, entry point is 0x40375104
I (0) cpu_start: App cpu up.
I (196) cpu_start: Pro cpu start user code
I (196) cpu_start: cpu freq: 160000000
[0;32mI (199) cpu_start: Project name: led_strip
I (204) cpu_start: App version: 1
I (209) cpu_start: Compile time: Aug 17 2021 17:09:47
I (215) cpu_start: ELF file SHA256: bda59acbde3f7a0e...
I (221) cpu_start: ESP-IDF: v4.4-dev-2594-ga20df743f1-dirty
I (228) heap_init: Initializing. RAM available for dynamic allocation:
I (235) heap_init: At 3FC94220 len 0004BDE0 (303 KiB): D/IRAM
I (241) heap_init: At 3FCE0000 len 0000EE34 (59 KiB): STACK/DRAM
I (248) heap_init: At 3FCF0000 len 00008000 (32 KiB): DRAM
I (255) spi_flash: detected chip: generic
I (259) spi_flash: flash io: dio
W (263) spi_flash: Detected size(16384k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
I (277) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (308) example: LED Rainbow Chase Start
I (308) example: USB initialization
I (308) tusb_desc:
┌─────────────────────────────────┐
│ USB Device Descriptor Summary │
├───────────────────┬─────────────┤
│bDeviceClass │ 239 │
├───────────────────┼─────────────┤
│bDeviceSubClass │ 2 │
├───────────────────┼─────────────┤
│bDeviceProtocol │ 1 │
├───────────────────┼─────────────┤
│bMaxPacketSize0 │ 64 │
├───────────────────┼─────────────┤
│idVendor │ 0x303a │
├───────────────────┼─────────────┤
│idProduct │ 0x4001 │
├───────────────────┼─────────────┤
│bcdDevice │ 0x100 │
├───────────────────┼─────────────┤
│iManufacturer │ 0x1 │
├───────────────────┼─────────────┤
│iProduct │ 0x2 │
├───────────────────┼─────────────┤
│iSerialNumber │ 0x3 │
├───────────────────┼─────────────┤
│bNumConfigurations │ 0x1 │
└───────────────────┴─────────────┘
I (478) TinyUSB: TinyUSB Driver installed
I (488) example: USB initialization DONE
I (1388) example: log -> UART
example: print -> stdout
example: print -> stderr
I (2888) example: log -> UART
example: print -> stdout
example: print -> stderr
I (4388) example: log -> UART
example: print -> stdout
example: print -> stderr
I (5888) example: log -> UART
example: print -> stdout
example: print -> stderr
I (7388) example: log -> UART
example: print -> stdout
example: print -> stderr
I (8888) example: log -> UART
example: print -> stdout
example: print -> stderr
I (10388) example: log -> UART
example: print -> stdout
example: print -> stderr
I (11888) example: log -> UART
example: print -> stdout
example: print -> stderr
I (13388) example: log -> UART
example: print -> stdout
example: print -> stderr
I (14888) example: log -> UART
example: print -> stdout
example: print -> stderr
I (16388) example: log -> UART
example: print -> stdout
example: print -> stderr
I (17888) example: log -> UART
example: print -> stdout

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

BIN
doc/ESP32-S3-CAM/pinout.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 704 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 512 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 520 KiB

View File

@ -10,18 +10,21 @@ What we need for functionality
- Schematic main board is [here](#schematic)
- FLASH LED issue [here](#flash-led-issue)
- Power supply [here](#power_supply)
- External temperature sensor DHT22/DHT11 [here](#ext_sens)
- Potential issue [here](#issue)
<a name="esp32"></a>
## ESP32-S3-EYE 2.2
Basic informations:
Basic information:
- On the board missing LED for flash
- Option connecting external FLASH LED
- Micro SD card slot
- Internal WiFi antenna
- no additional HW is needed for programming
- 8MB FLASH and 8MB external PSRAM
- Excellent WiFi signal
- 1.27mm Pitch 2x5Pin Double Row Female Pin Header external LCD connector
This is a more expensive version with a more powerful ESP32-S3 processor. The board is sold with an OV2640 camera module. No additional hardware is required for programming. The ESP32-S3 processor is programmed via the processor's USB interface.
@ -68,7 +71,7 @@ And command for FLASH FW is here, where **/dev/ttya0** is your serial interface
./esptool --chip esp32s3 -p /dev/ttya0 -b 921600 --before default_reset --after hard_reset write_flash --erase-all --flash_mode dio --flash_size 8MB --flash_freq 80m 0x0 ESP32_PrusaConnectCam.ino.bootloader.bin 0x8000 ESP32_PrusaConnectCam.ino.partitions.bin 0x10000 ESP32_PrusaConnectCam.ino.bin
```
This command contains the parameter **--eras-all**, which erases the entire flash in the MCU. So, for just updating the firmware, it is necessary to remove the parameter **--eras-all**; otherwise, the MCU configuration will also be deleted. The basic command list can be found [here](https://docs.espressif.com/projects/esptool/en/latest/esp32s3/esptool/basic-commands.html)
This command contains the parameter **--erase-all**, which erases the entire flash in the MCU. So, for just updating the firmware, it is necessary to remove the parameter **--erase-all**; otherwise, the MCU configuration will also be deleted. The basic command list can be found [here](https://docs.espressif.com/projects/esptool/en/latest/esp32s3/esptool/basic-commands.html)
Here is the command for updating the firmware in the MCU without erasing the MCU configuration
@ -80,7 +83,7 @@ Launching the esptool application may be different in different operating system
#### Windows
The driver should be installed automatically by Windows
The driver should be installed automatically by Windows. SW for FW flash (Flash Download Tools) is [here](https://www.espressif.com/en/support/download/other-tools)
In the first step, you need to open the application **flash download tool**, and select MCU version
@ -179,6 +182,18 @@ The board does not have an LED that could serve as a camera flash. However, ther
The device requires a 5V power supply, with a maximum current consumption of 2A. Power is supplied via a micro USB connector when using the original programmer.
<a name="ext_sens"></a>
## External temperature sensor DHT22/DHT11
Below you will find the wiring diagram for the DHT22 or DHT11 sensor.
| Camera board | DHT22/DHT11 |
|--------------|-------------|
| 3.3V (red) | VCC |
| GND (blue) | GND |
| IO46 (green) | Data |
<img src="esp32-s3-eye-dht22.png" width=30% height=30%>
<a name="issue"></a>
## Potential issue with this board

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 KiB

View File

@ -11,12 +11,13 @@ What we need for functionality
- Board schematic [here](#schematic)
- External FLASH LED [here](#led_issue)
- Power supply [here](#power_supply)
- External temperature sensor DHT22/DHT11 [here](#ext_sens)
- Potential issue [here](#issue)
<a name="esp32"></a>
## Freenove ESP32-Wrover-CAM
Basic informations:
Basic information:
- On the board missing LED for flash
- Option connecting external FLASH LED
- Missing micro SD card slot
@ -24,6 +25,7 @@ Basic informations:
- no additional HW is needed for programming
- 4MB FLASH and 4MB external PSRAM
- 520 KB SRAM
- Excellent WiFi signal
This board version is built on the same processor, ESP32, as the AiThinker ESP32-CAM. However, a different module with the processor is used in this version. The board missing a LED for FLASH and a Micro SD card slot. The board has an internal WiFi antenna, which has better WiFi signal quality than the AiThinker ESP32-CAM board.
@ -88,7 +90,7 @@ And command for FLASH FW is here, where **/dev/ttya0** is your serial interface
./esptool -p /dev/ttya0 -b 460800 --before default_reset --after hard_reset --chip esp32 write_flash --erase-all --flash_mode dio --flash_size 4MB --flash_freq 80m 0x1000 ESP32_PrusaConnectCam.ino.bootloader.bin 0x8000 ESP32_PrusaConnectCam.ino.partitions.bin 0x10000 ESP32_PrusaConnectCam.ino.bin
```
This command contains the parameter **--eras-all**, which erases the entire flash in the MCU. So, for just updating the firmware, it is necessary to remove the parameter **--eras-all**; otherwise, the MCU configuration will also be deleted. The basic command list can be found [here](https://docs.espressif.com/projects/esptool/en/latest/esp32s3/esptool/basic-commands.html)
This command contains the parameter **--erase-all**, which erases the entire flash in the MCU. So, for just updating the firmware, it is necessary to remove the parameter **--erase-all**; otherwise, the MCU configuration will also be deleted. The basic command list can be found [here](https://docs.espressif.com/projects/esptool/en/latest/esp32s3/esptool/basic-commands.html)
Here is the command for updating the firmware in the MCU without erasing the MCU configuration
@ -100,7 +102,7 @@ Launching the esptool application may be different in different operating system
#### Windows
Driver for CH340 USB to UART convert for Windows is for example [here](https://www.wch-ic.com/search?q=CH340&t=downloads) . An older version of the driver is for example [here](https://blog.laskakit.cz/wp-content/uploads/2020/03/CH341SER.zip)
Driver for CH340 USB to UART convert for Windows is for example [here](https://www.wch-ic.com/search?q=CH340&t=downloads) . An older version of the driver is for example [here](https://blog.laskakit.cz/wp-content/uploads/2020/03/CH341SER.zip) . SW for FW flash (Flash Download Tools) is [here](https://www.espressif.com/en/support/download/other-tools)
<img src="how to flash chip select.jpg" width=25% height=25%>
@ -188,6 +190,19 @@ However, a 5mm LED can also be connected directly. **CAUTION**: The digital GPIO
The device requires a 5V power supply, with a maximum current consumption of 2A. Power is supplied via a micro USB connector when using the original programmer.
<a name="ext_sens"></a>
## External temperature sensor DHT22/DHT11
Below you will find the wiring diagram for the DHT22 or DHT11 sensor.
| Camera board | DHT22/DHT11 |
|--------------|-------------|
| 3.3V | VCC |
| GND | GND |
| IO13 | Data |
<img src="dht22_bb.png" width=40% height=40%>
<a name="issue"></a>
## Potential issue with this board
- This version does not have a slot for a Micro SD card, so it may be complicated to obtain logs from it.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

BIN
doc/ESPTool.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 KiB

BIN
doc/ESPToolConnect.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

BIN
doc/ESPToolFinish.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 KiB

BIN
doc/ESPToolPort.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 545 KiB

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More