Hello, has anyone managed to get the VL53L1X working as a people counter?
Thanks
Hello, has anyone managed to get the VL53L1X working as a people counter?
Thanks
I haven’t gotten any hardware and I’m quite a novice at this stuff anyway, but this is promising:
https://community.st.com/s/question/0D50X0000A7VWoMSQW/is-vl53l1x-people-counting-source-code-available
Someone in this thread did it with a wemos D1 mini.
Not sure if this can be dropped into ESP Home, but someone who knows what they’re looking at would likely be able to adapt it.
IMO the implementation is faulty. I just connectd a sensor to an ESP32 Wroover using the default I2C pins which is working with all other I2C devices tested.
After configuring THIS sensor component I see the same result as jcbbas - a rapid endless loop blocking all other components like WIFI. I will check cabling but no matter how wrong cabling was (if it is) it should not hinder ESP32 to start.
Sorry but for me such component (I2C or VL53) is unacceptable and was not tested. It looks I will endup in writing custom drivers for almost every implementation by myself …
… wondering WHO has ever tested/accepted this component before ?
The other I2C device drivers (PCF8574,INA219,…) not able to communicate are well behaving.
while (reg(0x83).get() == 0x00)
yield();
Well done
I am testing a VL53L0x sensor which works well on a nodemcu. I would like to use two in automation. Counting people and controlling the light, but I don’t know how to start. Does anyone have experience with this sensor and code for ESP home?
I’ve got a VL5310x working on a Wemos D1 mini. It’s currently cohabiting with a bh1750 and a BME280 on the same i2c bus.
I compiled on the dev version of ESPHome.
Note that they each have their own address.
Thank you for your reply Peter. I do believe the implementation works if the device is attached and responding correctly but if it fails for any reason (address, cablelength, pullups) i guess the endless loop starts.
I would be interested what happens if you configure an address different from 0x29 ?
I am currently looking at the code to derive a custom driver - maybe i find the problem.
the setup function does not care about a failing communication:
void VL53L0XSensor::setup() {
#if (1)
uint8_t v;
if (!read_byte(0x89, &v)) {
this->mark_failed();
return;
}
reg(0x89) = v | 0x01;
#else
reg(0x89) |= 0x01;
#endif
…
Best regards, Tom
edit:
But as I need the sensor further away of the ESP32 controller I will attach the vl53l0x sensor to a STM8 (simulating 4-20mA with PWM) and attach this as 4-20mA sensor so i can run virtually any length two (maybe three) wire cable.
Do you have experience with this: what is the maximum length of the cable to the sensor that works reliably? Without STM8.
Hi Pepe !
So far i have only used i2c onboard but i think the maximum distance you can reach is mostly dependent on the clock rate (of course also environment, cable type, busvoltage, …). But you can use P82B96T as range extenders (~60ct / piece on Aliexpress) to achieve high bandwidth at long distances. I am also considering this as Plan B but don’t forget the supply voltage drop for the distant parts so maybe regulate the power there as 3.3V won’t reach very far.
IMO 1 to 2 meters won’t be a problem @400kHz anything further may require lowering bandwidth.
Thank you for the information. So far, I am testing only one sensor according to the ESP home documentation at 50000Hz. Just on the cutting board and it works well.
The length of my cable (UTP cat5e) will not exceed 1.5 m.
I’m waiting for more sensors to arrive and I want to try to count the people and control the light.
Yes I also like theses sensors and am impressed by speed and range (up to 160cm). Using multiple sensors you will have to modify the address of the sensors - hard to believe this will work with this driver and you will have to connect the individual X-shut pins i think.
Oh people counter sounds nice - so you lay a CAT-5 cable around the door frame and add a couple of sensors in the ring ? I have seen the STM video but can’t remember that they mentioned where and how many sensors they placed. You won’t have a problem with cable length !
I want to measure the level of a surge tank to find out if level raises slowly or rapidly (when people use the pool ) so it is kind of a people counter too ;-). But the water surface is not discriminated reliably so i will have to put something on the surface or let the sensor swim and measure from there.
Keen on the result of your project !
I have jsut been thinking about your issue with multiple sensors connected.
You could of course use IO expander/s (MCP23017, PCF8574 or the like) to drive the individual X-shut pins of your sensors but maybe you could also delay the X-shut signal with increased delays for each subsequent sensor. So after driving the X-Shut pin the address of the first chip would be changed. Then deactivate X-shut and with the next cycle the next chip would get it’s address (the first one would ignore it’s old 0x29 address) … if no device responses to 0x29 you are done and can use each of them with it’s individual address until the next power down.
This could help reduce cabling efforts as you would only need one additional wire and you can still switch them all off if you need to.
Just an idea …
Thank you for the ideas. I thought I would use 2 sensors with ESP32. It has 2x I2C. Will the same addresses not matter or am I wrong? Next to the passage to the kitchen, I have a plasterboard wall 30 cm wide and on the other side the side of the cabinet at a distance of 110 cm.
I would place the sensors on the wall 20cm apart.
Then I will have to come up with a configuration.
Nyní mám pohybové senzory, které fungují dobře, ale musíte být doma sami.
Another question: how do sensors degrade during long-term use?
Your project is interesting. I would definitely like to see him.
Hello, I have been following this discussion since today and I would really love to somehow make a sensor that can detect the presence of people in a room. I’m not a programmer at all, but I started a GitHub repository today with an implementation of Tom Igoe’s code in a custom component for ESPHome. It is all stil very beta and untested. I might possibly work a bit more on it next week. But anyway, for the one’s interested it is out there.
Thank you very much for helping.
I’ll definitely be watching, but I have VL53L0X sensors.
I have to use 2x. The code for the VL53L1X sensor may not be usable.
I found AliExpress VL53L1X. If the configuration will work, I will order the sensors.
Well if you only require 2 sensors you can use a second Wire/I²C instance and the “i2c_id” in the configuration of the sensor components. I thought you needed a couple of sensors (maybe to ‘see’ a difference between persons and pets) in which case you needed other solutions.
I think the difference to the VL53L1X is not very big in terms of communication. For my project the L1X would be the better choice as you can “focus” the receiver to only the center and thereby reduce the viewing angle. If there is no driver in ESPHOME for the L1X it can easily be done.
I don’t know the address of the L1X but if it is not 0x29 (or 0x52 if original STM) you can mix L0X and L1X and use them together on one I2C …