Open Cres09 opened 1 year ago
Make sure you have the included libraries that the top of the MLX90640 page shows (Naturally you can change your esphome device name though):
esphome:
name: "espatom-ir2"
libraries:
- SPI
- Wire
- adafruit/Adafruit BusIO @ 1.9.6
You'll also want to go to the main ESPHome page, and clean the build files for your device if you've been playing around with other things previously, by tapping on the 3-dot menu, and choosing "Clean build files":
Let us know how you go :)
Thank you very much for your response. It is not working, now it says the following:
src/esphome/components/camera_mlx90640/camera_mlx90640.h:7:10: fatal error: esphome/components/text_sensor/text_sensor.h: No such file or directory
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated. *** [/data/espatom-thermalcamera/.pioenvs/espatom-thermalcamera/src/esphome/components/camera_mlx90640/camera_mlx90640.cpp.o] Error 1 ========================== [FAILED] Took 7.68 seconds ==========================` logs_thermal-camera_run.txt
What was it you've changed? Did you include those libraries, or clean your build files?
sorry. Yes I clean de build files and included de libraries. Here are the code: "esphome: name: "espatom-thermalcamera" libraries:
esp32: board: esp32dev framework: type: arduino
logger:
api: encryption: key:
ota: password:
wifi: ssid: !secret wifi_ssid password: !secret wifi_password
ap: ssid: "Thermal-Camera Fallback Hotspot" password:
captive_portal:
external_components:
sensor: camera_mlx90640: id: thermal_cam update_interval: 5s sda: 26 # I2C SDA PIN scl: 32 # I2C SCL PIN frequency: 400000 # I2C Clock Frequency address: 0x33 # MLX90640 Address mintemp: 15 # Minimal temperature for color mapping maxtemp: 40 # Maximal temperature for color mapping refresh_rate: 0x04 # 0x05 For 16Hz or 0x04 for 8Hz min_temperature: name: "MLX90640 Min temp" max_temperature: name: "MLX90640 Max temp" mean_temperature: name: "MLX90640 Mean temp" median_temperature: name: "MLX90640 Median temperature"
web_server: port: 80"
Try 3x backticks ( ` ) for "code".
My apologies, I had misunderstood and thought you were using the MLX90614. You were right with only requiring:
esphome:
name: "espatom-thermalcamera"
libraries:
- FS
- Wire
- SPIFFS
Looks like there may be an issue with inclusion of text_sensor.h, I'll get onto that now.
This works for me:
esphome:
name: espatom-mlx90640
friendly_name: espatom-mlx90640
includes:
libraries:
- Wire
- FS
- SPIFFS
external_components:
- source:
type: local
path: components
components: [camera_mlx90640]
esp32:
board: m5stack-core-esp32
framework:
type: arduino
logger:
api:
encryption:
key:
ota:
password:
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
ap:
ssid: Espatom-Mlx90640
password: Tz7rmsB41aMv
captive_portal:
text_sensor:
sensor:
camera_mlx90640:
id: thermal_cam
update_interval: 5s
sda: 26 # I2C SDA PIN
scl: 32 # I2C SCL PIN
frequency: 400000 # I2C Clock Frequency
address: 0x33 # MLX90640 Address
mintemp: 24 # Minimal temperature for color mapping
maxtemp: 35 # Maximal temperature for color mapping
refresh_rate: 0x05 # For 16Hz or 0x04 for 8Hz
filter_level: 10.0 # Level in degree of the filter. If there a difference above the level, the pixel is approximated by the average of the next two pixels
min_temperature:
name: "MLX90640 Min temp"
max_temperature:
name: "MLX90640 Max temp"
mean_temperature:
name: "MLX90640 Mean temp"
median_temperature:
name: "MLX90640 Median temperature"
#sensors:
web_server:
port: 80
Using m5stack atom lite and m5stack mlx90640 version 1. It won't work for version 2.
Could you try that @Cres09 ? Just grabbing the components/camera_mlx90640 folder and putting it into your ~/config/esphome/components directory, and then instead of using the online external components try:
external_components:
- source:
type: local
path: components
components: [camera_mlx90640]
I have just done a test I compiled a new ESP Atom device and it worked and compiled. I have attached the yaml I used and the components I put in the \config\esphome\components folder.
My method is to create a device in esphome but not connect to the physical esp32 just create the file so it is named nicely. Then I edit the yaml in that file with the below config. Then I install using manual install and download the file instead of trying to flash. Then go to https://web.esphome.io/ and do a manual install uploading the file there. I find this way it doesn't fuck out.
esphome:
name: espatom-mlx90640-2
friendly_name: espatom-mlx90640-2
includes:
libraries:
- Wire
- FS
- SPIFFS
external_components:
- source:
type: local
path: components
components: [camera_mlx90640]
esp32:
board: esp32-s3-devkitc-1
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "your key"
ota:
password: "your pw"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Espatom-Mlx90640-2"
password: "uYOjolJyOZSj"
captive_portal:
text_sensor:
sensor:
camera_mlx90640:
id: thermal_cam
update_interval: 5s
sda: 2 # I2C SDA PIN
scl: 1 # I2C SCL PIN
frequency: 400000 # I2C Clock Frequency
address: 0x33 # MLX90640 Address
mintemp: 24 # Minimal temperature for color mapping
maxtemp: 35 # Maximal temperature for color mapping
refresh_rate: 0x05 # For 16Hz or 0x04 for 8Hz
filter_level: 10.0 # Level in degree of the filter. If there a difference above the level, the pixel is approximated by the average of the next two pixels
min_temperature:
name: "MLX90640 Min temp 2"
max_temperature:
name: "MLX90640 Max temp 2"
mean_temperature:
name: "MLX90640 Mean temp 2"
median_temperature:
name: "MLX90640 Median temperature 2"
#sensors:
web_server:
port: 80
I have just done a test I compiled a new ESP Atom device and it worked and compiled. I have attached the yaml I used and the components I put in the \config\esphome\components folder.
My method is to create a device in esphome but don't actually add one so you get the nice name. Then edit the device with the yaml and install and dont actually install to the device just download manually. Then go to https://web.esphome.io/ and do a manual install uploading the file there. I find this way it doesn't fuck out.
esphome:
name: espatom-mlx90640-2
friendly_name: espatom-mlx90640-2
includes:
libraries:
- Wire
- FS
- SPIFFS
external_components:
- source:
type: local
path: components
components: [camera_mlx90640]
esp32:
board: esp32-s3-devkitc-1
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "your key"
ota:
password: "your pw"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Espatom-Mlx90640-2"
password: "uYOjolJyOZSj"
captive_portal:
text_sensor:
sensor:
camera_mlx90640:
id: thermal_cam
update_interval: 5s
sda: 2 # I2C SDA PIN
scl: 1 # I2C SCL PIN
frequency: 400000 # I2C Clock Frequency
address: 0x33 # MLX90640 Address
mintemp: 24 # Minimal temperature for color mapping
maxtemp: 35 # Maximal temperature for color mapping
refresh_rate: 0x05 # For 16Hz or 0x04 for 8Hz
filter_level: 10.0 # Level in degree of the filter. If there a difference above the level, the pixel is approximated by the average of the next two pixels
min_temperature:
name: "MLX90640 Min temp 2"
max_temperature:
name: "MLX90640 Max temp 2"
mean_temperature:
name: "MLX90640 Mean temp 2"
median_temperature:
name: "MLX90640 Median temperature 2"
#sensors:
web_server:
port: 80
Obviously change the pins and the board type. I find if I have the wrong board type it won't work sometimes.
I finally was able to compile and upload the sketch to my board. What I was missing was to add "text_sensor:" when added it, it worked properly.
Now I'm facing an other problem. At first starts giving parameters but with an error saying "[E][MLX90640:126]: Parameter extraction failed", then stops working and say "[E][Wire.cpp:499] requestFrom(): i2cWriteReadNonStop returned Error -1"
The code:
name: "espatom-thermalcamera"
includes:
libraries:
- Wire
- FS
- SPIFFS
external_components:
- source:
type: local
path: components
components: [camera_mlx90640]
esp32:
board: esp32doit-devkit-v1
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key:
ota:
password:
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Thermal-Camera Fallback Hotspot"
password:
captive_portal:
text_sensor:
sensor:
camera_mlx90640:
id: thermal_cam
update_interval: 5s
sda: 21 # I2C SDA PIN
scl: 22 # I2C SCL PIN
frequency: 400000 # I2C Clock Frequency
address: 0x33 # MLX90640 Address
mintemp: 15 # Minimal temperature for color mapping
maxtemp: 40 # Maximal temperature for color mapping
refresh_rate: 0x04 # 0x05 For 16Hz or 0x04 for 8Hz
filter_level: 10.0
min_temperature:
name: "MLX90640 Min temp"
max_temperature:
name: "MLX90640 Max temp"
mean_temperature:
name: "MLX90640 Mean temp"
median_temperature:
name: "MLX90640 Median temperature"
web_server:
port: 8080
Logs:
[D][sensor:110]: 'MLX90640 Min temp': Sending state 40.00000 °C with 2 decimals of accuracy
[D][sensor:110]: 'MLX90640 Max temp': Sending state 171.64307 °C with 2 decimals of accuracy
[D][sensor:110]: 'MLX90640 Mean temp': Sending state 155.59184 °C with 2 decimals of accuracy
[D][sensor:110]: 'MLX90640 Median temperature': Sending state 154.83989 °C with 2 decimals of accuracy
[ 10791][E][Wire.cpp:499] requestFrom(): i2cWriteReadNonStop returned Error 263
[ 10792][E][Wire.cpp:499] requestFrom(): i2cWriteReadNonStop returned Error 263
[ 10795][E][Wire.cpp:499] requestFrom(): i2cWriteReadNonStop returned Error 263
[ 10803][E][Wire.cpp:499] requestFrom(): i2cWriteReadNonStop returned Error 263
[I][MLX90640:274]: Min temperature : 23.71 C
[I][MLX90640:275]: Max temperature : 30.91 C
[I][MLX90640:276]: Mean temperature : 28.77 C
[I][MLX90640:277]: Median temperature : 29.31 C
[D][sensor:110]: 'MLX90640 Min temp': Sending state 23.71209 °C with 2 decimals of accuracy
[D][sensor:110]: 'MLX90640 Max temp': Sending state 30.91162 °C with 2 decimals of accuracy
[D][sensor:110]: 'MLX90640 Mean temp': Sending state 28.76557 °C with 2 decimals of accuracy
[D][sensor:110]: 'MLX90640 Median temperature': Sending state 29.30715 °C with 2 decimals of accuracy
[E][MLX90640:271]: MLX READING VALUE ERRORS
[I][MLX90640:274]: Min temperature : 23.92 C
[I][MLX90640:275]: Max temperature : 39.09 C
[I][MLX90640:276]: Mean temperature : nan C
[I][MLX90640:277]: Median temperature : 29.27 C
[D][sensor:110]: 'MLX90640 Min temp': Sending state 23.92449 °C with 2 decimals of accuracy
[D][sensor:110]: 'MLX90640 Max temp': Sending state 39.08709 °C with 2 decimals of accuracy
[D][sensor:110]: 'MLX90640 Mean temp': Sending state nan °C with 2 decimals of accuracy
[D][sensor:110]: 'MLX90640 Median temperature': Sending state 29.26779 °C with 2 decimals of accuracy
[ 25766][E][Wire.cpp:499] requestFrom(): i2cWriteReadNonStop returned Error 263
[ 25796][E][Wire.cpp:499] requestFrom(): i2cWriteReadNonStop returned Error 263
[ 25828][E][Wire.cpp:499] requestFrom(): i2cWriteReadNonStop returned Error 263
[E][MLX90640:271]: MLX READING VALUE ERRORS
[ 30702][E][Wire.cpp:499] requestFrom(): i2cWriteReadNonStop returned Error 263
[ 30703][E][Wire.cpp:499] requestFrom(): i2cWriteReadNonStop returned Error 263
[logs (1).txt](https://github.com/Chill-Division/M5Stack-ESPHome/files/11360954/logs.1.txt)
Looking at this @Cres09 , I see you have:
sda: 21 # I2C SDA PIN
scl: 22 # I2C SCL PIN
But none of the M5Stack devices I'm familiar with use those on the Grove pins, so can you clarify what your ESP device is?
Hellow,
First of all sorry for my bad english.
I'm trying to make work de Thermal Camera Unit (MLX90640). when I hit compile in esphome on home assistant the log says the following:
My configuration:
esp32: board: esp32dev framework: type: arduino
Enable logging logger:
Enable Home Assistant API api: encryption: key:
ota: password:
wifi: ssid: !secret wifi_ssid password: !secret wifi_password
Enable fallback hotspot (captive portal) in case wifi connection fails ap: ssid: "Thermal-Camera Fallback Hotspot" password:
captive_portal:
external_components:
sensor: camera_mlx90640: id: thermal_cam update_interval: 5s sda: 26 # I2C SDA PIN scl: 32 # I2C SCL PIN frequency: 400000 # I2C Clock Frequency address: 0x33 # MLX90640 Address mintemp: 15 # Minimal temperature for color mapping maxtemp: 40 # Maximal temperature for color mapping refresh_rate: 0x04 # 0x05 For 16Hz or 0x04 for 8Hz min_temperature: name: "MLX90640 Min temp" max_temperature: name: "MLX90640 Max temp" mean_temperature: name: "MLX90640 Mean temp" median_temperature: name: "MLX90640 Median temperature"
web_server: port: 80`
I suppose i'm making some kind of mistake but i have been not abble to debug it, i'll apreciate some help. logs_thermal-camera_compile (1).txt