Open lecrams opened 1 year ago
issue solved
issue solved
can past the code for the yaml file? i'm getting similar issue as well. thanks!
this specific issue was solved but the yaml for the camera part is still not working. Seems that that the PMU is not init correctlly
PMU is AXP2101 -> Camera: ALDO1/ALDO2/ALDO4 in this example they show how to adjust the three voltages. with https://github.com/Xinyuan-LilyGO/LilyGo-Cam-ESP32S3/tree/master/lib/XPowersLib
I guess a new ESPhome component for AXP2101 is mandatory as first step.
This still seems an issue with v2023.5.5.
Hi, I managed to make it work by using the following YAML
esphome:
name: prova
friendly_name: prova
libraries:
- XPowersLib=https://github.com/lewisxhe/XPowersLib.git
includes:
- AXP2101_component.h
platformio_options:
build_flags: "-DBOARD_HAS_PSRAM -UARDUINO_USB_CDC_ON_BOOT"
custom_component:
- lambda: |-
auto axp2101 = new AXP2101Component();
return {axp2101};
components:
- id: axp2101
esp32:
board: esp32s3box
framework:
type: arduino
I had to create the file "AXP2101_component.h" in the /config/esphome folder with this content:
#include "esphome.h"
#define XPOWERS_CHIP_AXP2101
#include "XPowersLib.h"
#define I2C_SDA (7)
#define I2C_SCL (6)
class AXP2101Component : public Component {
public:
void setup() override {
// This will be called once to set up the component
// think of it as the setup() call in Arduino
ESP_LOGD("custom", "Custom component setup");
if (!PMU.begin(Wire, AXP2101_SLAVE_ADDRESS, I2C_SDA, I2C_SCL)) {
Serial.println("Failed to initialize power.....");
while (1) {
delay(5000);
}
}
//Set the working voltage of the camera, please do not modify the parameters
PMU.setALDO1Voltage(1800); // CAM DVDD 1500~1800
PMU.enableALDO1();
PMU.setALDO2Voltage(2800); // CAM DVDD 2500~2800
PMU.enableALDO2();
PMU.setALDO4Voltage(3000); // CAM AVDD 2800~3000
PMU.enableALDO4();
// TS Pin detection must be disable, otherwise it cannot be charged
PMU.disableTSPinMeasure();
}
private:
XPowersPMU PMU;
};
I assume that this code comes as addition to the 'normal' esp32 yaml like the vsync and datapin definitions?
Here's my config with only the password scrubbed. This enables both camera and screen and PIR. It seems like everything is working and no artifacts on the camera:
AXP2101_component.h:
#include "esphome.h"
#define XPOWERS_CHIP_AXP2101
#include "XPowersLib.h"
#ifdef I2C_SDA
#undef I2C_SDA
#endif
#ifdef I2C_SCL
#undef I2C_SCL
#endif
#define I2C_SDA (7)
#define I2C_SCL (6)
class AXP2101Component : public Component {
public:
void setup() override {
// This will be called once to set up the component
// think of it as the setup() call in Arduino
ESP_LOGD("custom", "Custom component setup");
if (!PMU.begin(Wire, AXP2101_SLAVE_ADDRESS, I2C_SDA, I2C_SCL)) {
Serial.println("Failed to initialize power.....");
while (1) {
delay(5000);
}
}
// Set VSY off voltage as 2600mV , Adjustment range 2600mV ~ 3300mV
PMU.setSysPowerDownVoltage(2600);
//Turn off not use power channel
PMU.disableDC2();
PMU.disableDC3();
PMU.disableDC4();
PMU.disableDC5();
PMU.disableALDO1();
PMU.disableALDO2();
PMU.disableALDO3();
PMU.disableALDO4();
PMU.disableBLDO1();
PMU.disableBLDO2();
PMU.disableCPUSLDO();
PMU.disableDLDO1();
PMU.disableDLDO2();
// Board 5 Pin socket 3.3V power output control
PMU.setDC3Voltage(3100); //Extern 3100~ 3400V
PMU.enableDC3();
// Camera working voltage, please do not change
PMU.setALDO1Voltage(1500); // CAM DVDD
PMU.enableALDO1();
// Camera working voltage, please do not change
PMU.setALDO2Voltage(3000); // CAM DVDD
PMU.enableALDO2();
// Camera working voltage, please do not change
PMU.setALDO4Voltage(3000); // CAM AVDD
PMU.enableALDO4();
// Pyroelectric sensor working voltage, please do not change
PMU.setALDO3Voltage(3300); // PIR VDD
PMU.enableALDO3();
// Microphone working voltage, please do not change
PMU.setBLDO1Voltage(3300); // MIC VDD
PMU.enableBLDO1();
PMU.clearIrqStatus();
PMU.enableVbusVoltageMeasure();
PMU.enableBattVoltageMeasure();
PMU.enableSystemVoltageMeasure();
PMU.disableTemperatureMeasure();
// TS Pin detection must be disable, otherwise it cannot be charged
PMU.disableTSPinMeasure();
// Disable all interrupts
PMU.disableIRQ(XPOWERS_AXP2101_ALL_IRQ);
// Clear all interrupt flags
PMU.clearIrqStatus();
// Enable the required interrupt function
PMU.enableIRQ(
XPOWERS_AXP2101_BAT_INSERT_IRQ | XPOWERS_AXP2101_BAT_REMOVE_IRQ | //BATTERY
XPOWERS_AXP2101_VBUS_INSERT_IRQ | XPOWERS_AXP2101_VBUS_REMOVE_IRQ | //VBUS
XPOWERS_AXP2101_PKEY_SHORT_IRQ | XPOWERS_AXP2101_PKEY_LONG_IRQ | //POWER KEY
XPOWERS_AXP2101_BAT_CHG_DONE_IRQ | XPOWERS_AXP2101_BAT_CHG_START_IRQ //CHARGE
// XPOWERS_PKEY_NEGATIVE_IRQ | XPOWERS_PKEY_POSITIVE_IRQ | //POWER KEY
);
// TS Pin detection must be disable, otherwise it cannot be charged
PMU.disableTSPinMeasure();
// Set the precharge charging current
PMU.setPrechargeCurr(XPOWERS_AXP2101_PRECHARGE_50MA);
// Set constant current charge current limit
PMU.setChargerConstantCurr(XPOWERS_AXP2101_CHG_CUR_300MA);
// Set stop charging termination current
PMU.setChargerTerminationCurr(XPOWERS_AXP2101_CHG_ITERM_25MA);
// Set charge cut-off voltage
PMU.setChargeTargetVoltage(XPOWERS_AXP2101_CHG_VOL_4V1);
// Set the time of pressing the button to turn off
PMU.setPowerKeyPressOffTime(XPOWERS_POWEROFF_4S);
}
private:
XPowersPMU PMU;
};
esphome yaml:
esphome:
name: camera-2
platformio_options:
build_flags: "-DBOARD_HAS_PSRAM -UARDUINO_USB_CDC_ON_BOOT"
upload_speed: 921600
monitor_speed: 115200
friendly_name: "Camera 2"
libraries:
- XPowersLib=https://github.com/lewisxhe/XPowersLib.git
- "Wire"
includes:
- AXP2101_component.h
custom_component:
- lambda: |-
auto axp2101 = new AXP2101Component();
return {axp2101};
components:
- id: axp2101
esp32:
board: esp32s3box
framework:
type: arduino
# Enable Home Assistant API
api:
encryption:
key: "XXX" # Replace with your API encryption key
ota:
password: "XXX" # Replace with your OTA password
wifi:
ssid: !secret wifi_ssid # Replace with your Wi-Fi SSID stored in secrets.yaml
password: !secret wifi_password # Replace with your Wi-Fi password stored in secrets.yaml
# Enable fallback hotspot (captive portal) in case Wi-Fi connection fails
ap:
ssid: "Esp32-S3 Fallback Hotspot"
password: "XXX" # Replace with your fallback hotspot password
binary_sensor:
- platform: gpio
pin: GPIO17
name: "ttgocam2 PIR"
device_class: motion
sensor:
- platform: wifi_signal
name: "ttgocam2 WiFi Signal"
update_interval: 60s
time:
- platform: homeassistant
id: homeassistant_time
font:
- file: "nanum.ttf"
id: tnr1
size: 17
web_server:
version: 2
i2c:
sda: GPIO07
scl: GPIO06
frequency: 200kHz
esp32_camera:
name: camera-2
external_clock:
pin: GPIO38
frequency: 20MHz
i2c_pins:
sda: GPIO05
scl: GPIO04
data_pins: [GPIO14, GPIO47, GPIO48, GPIO21, GPIO13, GPIO11, GPIO10, GPIO09]
vsync_pin: GPIO8
href_pin: GPIO18
pixel_clock_pin: GPIO12
vertical_flip: false
horizontal_mirror: false
resolution: 1024x768
esp32_camera_web_server:
- port: 8080
mode: stream
- port: 8081
mode: snapshot
display:
- platform: ssd1306_i2c
update_interval: 2s
model: "SSD1306 128x64"
address: 0x3C
rotation: 180
lambda: |-
// Display current date and time
it.strftime(64, 0, id(tnr1), TextAlign::TOP_CENTER, "%m-%d-%Y", id(homeassistant_time).now());
it.strftime(64, 44, id(tnr1), TextAlign::BASELINE_CENTER, "%I:%M:%S%p", id(homeassistant_time).now());
Sorry for my late reaction. When I try to build the above code I get this error:
Any Idea what can be wrong? Can this be a version mismatch of the framework? What version are you using?
@lecrams I would also review versioning and perhaps clean build. I'm using ESPHome v2023.5.5.
INFO ESPHome 2023.5.5
INFO Reading configuration /config/esp32-s3.yaml...
INFO Generating C++ source...
INFO Compiling app...
Processing camera-2 (board: esp32s3box; framework: arduino; platform: platformio/espressif32@5.3.0)
--------------------------------------------------------------------------------
HARDWARE: ESP32S3 240MHz, 320KB RAM, 16MB Flash
- toolchain-riscv32-esp @ 8.4.0+2021r2-patch5
- toolchain-xtensa-esp32s3 @ 8.4.0+2021r2-patch5
Dependency Graph
|-- AsyncTCP-esphome @ 1.2.2
|-- XPowersLib @ 0.1.7+sha.bf6098b
|-- Wire @ 2.0.0
|-- WiFi @ 2.0.0
|-- FS @ 2.0.0
|-- Update @ 2.0.0
|-- ESPAsyncWebServer-esphome @ 2.1.0
| |-- AsyncTCP-esphome @ 1.2.2
|-- ESPmDNS @ 2.0.0
|-- noise-c @ 0.1.4
| |-- libsodium @ 1.10018.1
|-- ArduinoJson @ 6.18.5
Having exactly the same versions except for |-- noise-c @ 0.1.4 | |-- libsodium @ 1.10018.1
But this has nothing todo imo with the errors. Did also a clean build but exactly the same result.
@lecrams Try to comment out the esp32_camera
and esp32_camera_web_server
see if it builds then. Then debug from there.
commenting out the esp32_camera section in the yaml solves the issue obvious since the esp32_camera.cpp is not included in the build
It can now be compiled without any errors. I was using a local faulty esp32_camera component. I can run the FW however it is not stable. If I only power the board through the USB-c port It reset every know and then. In the loggings I also see that the camera module is not always found at restet
If I connect the serial port on the USB-C everything seems to be okay.
Any idea what can cause this behaviour?
Also disabling the logger creates a stable version but disadvantage, no loggings even not for debug logging 'INFO'
It can now be compiled without any errors. I was using a local faulty esp32_camera component. I can run the FW however it is not stable. If I only power the board through the USB-c port It reset every know and then. In the loggings I also see that the camera module is not always found at restet
If I connect the serial port on the USB-C everything seems to be okay.
Any idea what can cause this behaviour?
Can you share your yaml file? What version of ESPhome do you use
Here is my YAML
esphome: name: esp-lily-cam platformio_options: build_flags: "-DBOARD_HAS_PSRAM -UARDUINO_USB_CDC_ON_BOOT" upload_speed: 921600 monitor_speed: 115200 friendly_name: "Camera 2" libraries:
custom_component:
esp32: board: esp32s3box framework: type: arduino
wifi: manual_ip:
static_ip: 192.168.178.xx
# Set this to the IP address of the router. Often ends with .1
gateway: 192.168.178.1
# The subnet of the network. 255.255.255.0 works for most home networks.
subnet: 255.255.255.0
networks:
ssid: "XXXX" password: ""
ap: ssid: "Esp Cam Fallback Hotspot" password: "YyzRO7QXiUpO"
captive_portal:
external_components:
source: my_components components: [esp32_camera, decibel_meter, audio_source, i2s_audio_source, i2s_audio_sink, sound_generator]
source: github://mrhatman/esphome@dev components: [ audio_source, decibel_meter, i2s_audio_source, i2s_audio_sink, sound_generator ]
use all components from a local folder
source: type: local path: my_components
api: reboot_timeout: 0s
ota:
web_server: version: 2
esp32_camera_web_server:
time:
font:
file: 'fonts/slkscr.ttf' id: font1 size: 8
file: 'fonts/BebasNeue-Regular.ttf' id: font2 size: 30
file: 'fonts/Arial.ttf' id: font3 size: 14
i2c: sda: GPIO7 scl: GPIO6 frequency: 200kHz scan: True
display:
platform: ssd1306_i2c model: "SSD1306 128x64" address: 0x3C external_vcc: False lambda: |- // Print "My Smart Home" in top center. it.printf(64, 0, id(font1), TextAlign::TOP_CENTER, "My Smart Home");
// Print time in HH:MM format it.strftime(0, 30, id(font2), TextAlign::BASELINE_LEFT, "%H:%M", id(esptime).now());
// Print inside temperature (from homeassistant sensor) if (id(inside_temperature).has_state()) { it.printf(127, 10, id(font3), TextAlign::TOP_RIGHT , "%.1f°", id(inside_temperature).state); }
// Print outside temperature (from homeassistant sensor) if (id(outside_temperature).has_state()) { it.printf(127, 40, id(font3), TextAlign::BASELINE_RIGHT , "%.1f°", id(outside_temperature).state); }
esp32_camera: name: LilyCam external_clock: pin: GPIO38 frequency: 20MHz i2c_pins: sda: GPIO5 scl: GPIO4 data_pins: [GPIO14, GPIO47, GPIO48, GPIO21, GPIO13, GPIO11, GPIO10, GPIO9] vsync_pin: GPIO8 href_pin: GPIO18 pixel_clock_pin: GPIO12 vertical_flip: false horizontal_mirror: false resolution: 1024x768
audio_source:
binary_sensor:
platform: status name: "ESP LilyCam status"
platform: gpio pin: GPIO17 name: "PIR Sensor" device_class: motion
sensor:
platform: wifi_signal name: "ESP LilyCam WiFi Signal Sensor" update_interval: 20s
platform: uptime name: "LilyCam Uptime"
platform: homeassistant id: inside_temperature entity_id: sensor.bme280_temperature internal: true
platform: homeassistant id: outside_temperature entity_id: sensor.temperature internal: true
text_sensor:
switch:
Thanks for the config, i added the axp2101 and now it works. What type of microphone is used in the Lilicam? Does it work in ESPhome? (it would be handy if it can be used as a voice assistant in HA)
If I understand your yaml correctly u use a external component. i addad the external component but get the following log message: [20:44:48][D][sensor:094]: 'decibels': Sending state -inf with 0 decimals of accuracy
It is an I2S microphone. Check the schematic for details : https://github.com/Xinyuan-LilyGO/LilyGo-Cam-ESP32S3/blob/master/schematic/T-Camera-S3-V1.6.pdf
When powered by usb, but not connected to serial, i.e. 5V on the usb port, then I still get a watchdog reset error. This can be ignore by adding esp_task_wdt_init(30, false);
to the setup. However it seems there is a problem with the camera as the logs then show:
[W][component:204]: Component esp32_camera took a long time for an operation (0.40 s).
This is using the configs from above- the only difference being the power source and not being connected to a usb serial connection.
did anyone manage to power it from the 5 pin? 5v or 3.3v?
It is an I2S microphone. Check the schematic for details : https://github.com/Xinyuan-LilyGO/LilyGo-Cam-ESP32S3/blob/master/schematic/T-Camera-S3-V1.6.pdf
Hello, sorry for digging this up, but can you please share those components you are using in your YAML. I am trying to make the microphone work but I am getting the same as @martijnbuts : [sensor:094]: 'decibels': Sending state -inf with 0 decimals of accuracy
Thanks in advance!
can't recall where I got them but here is a link to my Gdrive where I stored it. https://drive.google.com/file/d/1SVJS7dZHQ15pYIGGPqyrXlh7gkrgI3Vl/view?usp=drive_link
Thanks!
În lun., 6 nov. 2023 la 10:08, Marcel Stumpel @.***> a scris:
can't recall where I got them but here is a link to my Gdrive where I stored it.
https://drive.google.com/file/d/1SVJS7dZHQ15pYIGGPqyrXlh7gkrgI3Vl/view?usp=drive_link
— Reply to this email directly, view it on GitHub https://github.com/esphome/issues/issues/4168#issuecomment-1794274139, or unsubscribe https://github.com/notifications/unsubscribe-auth/A4KWAGETCYJLC4FFD4LAVTLYDCLH3AVCNFSM6AAAAAAU4XJPZGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOJUGI3TIMJTHE . You are receiving this because you commented.Message ID: @.***>
The problem
When I add the CAM32 component to my board yaml (see below) I get into a bootloop. Loggings can be found below. Using the SSD1306 display which is also on the board without the camera definition has no problems
Which version of ESPHome has the issue?
2022.12.8
What type of installation are you using?
Home Assistant Add-on
Which version of Home Assistant has the issue?
2023.2.3
What platform are you using?
ESP32
Board
LilyGo T-camera-S3 with ESP32-S3 WROOM-1 module
Component causing the issue
ESP32_CAM
Example YAML snippet
Anything in the logs that might be useful for us?
Additional information
No response