letscontrolit / ESPEasy

Easy MultiSensor device based on ESP8266/ESP32
http://www.espeasy.com
Other
3.28k stars 2.22k forks source link

[FR] Add Sensirion SEN5x (IKEA VINDSTYRKA) #4794

Closed TD-er closed 6 months ago

TD-er commented 1 year ago

The latest Ikea VINDSTYRKA air quality sensor uses the Sensirion SEN5x. There are 3 types of this sensor:

Assuming the IKEA unit uses the SEN54, since photos only show values for PM, RH/T, VOC image

iz8mbw commented 1 year ago

@TD-er please replace "Senserion" with "Sensirion".

tonhuisman commented 1 year ago

This guy Oleksii has a sort of tear-down for the device (more like an unboxing 😉), that confirms the sensor is indeed a SEN54. There also is an official Sensirion Arduino library for the SEN5x (using I2C). Not sure if we can 'eaves-drop' on that, like is done with the Vindriktning plugin (that's using a more 'regular' serial interface). And maybe just implementing this in a more ESPEasy fashion, without introducing another 'standard' way of communication with I2C devices, is a better idea.

Edit: Here is the Sensirion SEN5x datasheet

TD-er commented 1 year ago

Yep, was thinking about the same approach. Problem is that we may need to 'sniff' to see if there is activity on the I2C bus.

TD-er commented 1 year ago

Ah apparently someone else came up with the same idea: https://github.com/oleksiikutuzov/IKEA-VINDSTYRKA/issues/1#issuecomment-1455082822

andibaciu commented 8 months ago

Hello, I am interested in IKEA Vindstyrka integration in ESPeasy and below is my research regarding it:

  1. here (https://github.com/just-oblivious/vindstyrka-docs) I found explanations about the communication between the IKEA controller and the SEN54 sensor
  2. in the attached XLS file, I tried to make my own assumptions about the MYSTERY WORD referred to in point 1 (there are explanations of how I assume the final temperature and humidity are calculated, which are also displayed on the Vinstyrka screen)
  3. I tried to develop a plugin for ESPEasy but I have some difficulties in activating an interrupt (interruption that doubles the SCL pin of the i2c communication in order to be able to see when the Vindstyrka controller ends the communication with the SEN54 sensor - in order not to disturb it communication, and to make the queries on i2c after this communication ends). If the communication between the Vindstyrka controller and SEN54 is not monitored, anomalies will appear in the display of the measured parameters on the Vinstyrka screen.

I hope to be able to activate the interrupt with your help and to be able to complete the plugin.

Note:

  1. The plugin is ONLY for the IKEA Vindstyrka controller (it is also not completed for SEN54 or SEN55 standalone)
  2. It is necessary that the name of the first task in ESPEasy of the "Air Quality - Sensirion" type be "IKEA_Vindstyrka" in case the definition of the second task is also desired to display the multiple parameters it can provide.

sen5x_logging_data.xlsx zip.zip

TD-er commented 8 months ago

I guess the Ikea firmware does try to read only on regular intervals, so maybe we can detect this and try to match its read interval, not to disturb those readings?

Another way can be to add a second I2C bus and try to emulate the device on this 2nd bus and thus act as some kind of man-in-the-middle and echo'ing the values while keeping the read results.

N.B. a 2nd bus is probably only limited to ESP32-like devices.

TD-er commented 8 months ago

Ah this emulation was also mentioned on the link you provided. Meaning this could be turned into 2 plugins:

tonhuisman commented 8 months ago

The SEN55 sensor is planned to be included soon, using the I2C bus.

andibaciu commented 8 months ago

Hello, from the research of the person who made the sniffing, it is clear that the query of the SEN54 sensor by the IKEA Vinstyrka controller is done at regular intervals of 1 sec. I like the idea of "man in the middle" but I would prefer that ESP8266 users can also benefit from this plugin (including myself). I hope I can solve the problems with the interrupt activation on the SCL monitoring pin. I don't know how to try to activate this interruption, so far everything has been unsuccessful.

TD-er commented 8 months ago

If someone wants to modify such a unit, then quite often new hardware has to be bought. So why buy any ESP8266 right now if the ESP32-C3 (as example) costs less money, is smaller and has much less power and antenna related issues compared to those "Wemos D1 mini" ESP8266 form factor boards you get when ordering now from Ali et. al. ?

andibaciu commented 8 months ago

The SEN55 sensor is planned to be included soon, using the I2C bus.

@tonhuisman is about standalone SEN5x or in this category is included IKEA Vindstyrka device ??? (because for IKEA device it's necessary to not affect original (main) communication).

TD-er commented 8 months ago

The pending implemented PR is not taking into account that there might be other concurrent I2C transfers.

It is quite hard to manage 2 masters on the same I2C bus. Maybe the IKEA firmware does allow to sometimes have no connection to the sensor? If so, then you could add some "analog switch" chip to switch connection from ESP to IKEA PCB? But I think the most stable and elegant solution would be to consider the IKEA PCB as a display.

andibaciu commented 8 months ago

i make some progress for this ESPeasy plugin (for ESP8266) All description and files could be find here: https://github.com/andibaciu/ESPeasy-plugin-for-IKEA-VINDSTYRKA Best regards!

TD-er commented 8 months ago

Why do you use P253? You can just request a plugin ID: https://github.com/letscontrolit/ESPEasy/issues/3839 And why not directly make a pull request?

andibaciu commented 8 months ago

Sorry, my mistake, i dont know about this request a plugin ID: https://github.com/letscontrolit/ESPEasy/issues/3839 (it's my first contribution for this project) and i post about this plugin only here. I already make a plugin request and after the owner give approval for this plugin and allocate a number i'll make all necessary changes.