Is proximity sensing possible with ESP32?

User avatar
luisonoff
Posts: 40
Joined: Fri Feb 09, 2018 12:20 pm

Is proximity sensing possible with ESP32?

Postby luisonoff » Wed Feb 21, 2018 3:32 pm

Hello,
I see that the ESP32 has some capacitive touch functions, being demonstrated by the capacitive touch kit from espressif.
Is it possible to sense proximity as well? Up to 10-15 cm?

If not, would it be possible using the hall effect sensor of the ESP32?
If not, anyone has any suggestion on how to achieve this? I am trying to detect when a hand is near my device, in order to shutdown touch panel and many other things when there is no hand (no user) nearby.

Thank you!

User avatar
luisonoff
Posts: 40
Joined: Fri Feb 09, 2018 12:20 pm

Re: Is proximity sensing possible with ESP32?

Postby luisonoff » Fri Feb 23, 2018 11:33 am

Any help from anyone?

User avatar
loboris
Posts: 514
Joined: Wed Dec 21, 2016 7:40 pm

Re: Is proximity sensing possible with ESP32?

Postby loboris » Fri Feb 23, 2018 1:57 pm

Hall sensor sensitivity is too low for usage as proximity sensor.

There are many I2C proximity sensors (like APDS-9930/APDS-9960) which you can use.

User avatar
luisonoff
Posts: 40
Joined: Fri Feb 09, 2018 12:20 pm

Re: Is proximity sensing possible with ESP32?

Postby luisonoff » Mon Feb 26, 2018 10:41 am

Thank you loboris.
I did not know about those sensors, I may use one of them for ambient light sensing.
But their power consumption is too high for proximity detection in my case, powering the proximity led takes from 25 to 100 mA, depending on desired range.

EDIT:proximity led is ON during very short pulses, so power consumption is not so high, still around 2x-3x of the Cypress capacitive, but I am interested now and will study it better, and maybe add it as a second proximity sensor. I also found similar led proximity ICs from Vishay: VCNL4010 and VCNL4200, among others.

That's why I am looking at Cypress capacitive proximity solutions, like CY3280-MBR3, which only consume 100-300 uA depending on sampling rate.

Does anyone know if the capacitive features of ESP32 could be used for proximity? (in order to use them instead of Cypress IC)
Or does anyone know any other capacitive solution IC apart from Cypress?
Thanks!

User avatar
Vader_Mester
Posts: 300
Joined: Tue Dec 05, 2017 8:28 pm
Location: Hungary
Contact:

Re: Is proximity sensing possible with ESP32?

Postby Vader_Mester » Mon Feb 26, 2018 11:51 am

Well... power consumption varry between sensors, they are not too high.
Also, it depends on the way you use these sensors.
Most of them can measure constantly in configured periods, and tresholds, and assert an INT line if they detect something (most power hungry).

Or... include the measurement cycle in your main loop on the ESP, or in certain time intervals, so it will do the measurement only in that cycle, and in every other time, the sensor is inactive, consuming near to nothing.

BTW, the VCNL4100 and VCNL4200 are waaaaaaaaay to big, and you should only use them if you sense something a meter away (VCNL4100 can detect 1m distance, VCNL4200 is for 1,5m distance).

Most sensors are OK for you, they are small, and are designed for 200mm distance, they have low power consumption. These are the sensors, you can find in your smartphone, which will disable touch and display backlight if you put it over your ears... so they are somewhat low in power consumption (beacause they are used in smartphone) :)

Science stuff: The way capacitive touch works, is that the metal plate which is the sensor in most cases just connects to a GPIO pin, and since the circuit is not closed (metal plate hanging in the air), there is no current flow, and nothing happens.
If you put your fingers on it, your fingers (since it's conductive), and the metal plate will act as a capacitor. Capacitors like to charge up if voltage is applied, so this starts drawing current from the GPIO pin to charge it up (your body acts as a good capacitor - regardless of your body weights of course :P ).
This small current that is drawn, is what gets measured by the ESP32 and gets interpreted as a touch.
Capacitor halfs need to be relatively close to each other to work, and also need some insulation (thin plastic, or solder mask on a PCB). (a parallel homogen electrical field must be present between the 2 halves, if charged). The capacitance of a capacitor decreases by the squared of distance of the 2 halfs (considering the area of the 2 halves are constant), so the further away you move, the less likely your finger or body will act upon the sensor.
Rule of thumb: The further away your detected object, (depending on the dielectric constant of the insulator), the bigger the metal sensing plate must be.
You need a very big sensor, to make it work for large distances... (in theory, 10s of cemntimeters) which is far from practical.

Regards,
Vader [BEN]

Code: Select all

task_t coffeeTask()
{
	while(atWork){
		if(!xStreamBufferIsEmpty(mug)){
			coffeeDrink(mug);
		} else {
			xTaskCreate(sBrew, "brew", 9000, &mug, 1, NULL);
			xSemaphoreTake(sCoffeeRdy, portMAX_DELAY);
		}
	}
	vTaskDelete(NULL);
}

User avatar
luisonoff
Posts: 40
Joined: Fri Feb 09, 2018 12:20 pm

Re: Is proximity sensing possible with ESP32?

Postby luisonoff » Mon Feb 26, 2018 12:10 pm

Thank you Vader for your detailed answer.

I am interested in the first use case you mentioned, sensor changes an interrupt pin in order to wake up the rest of the system. My product is a 6 inch touch screen, and my intention is to have everything powered off (ESP32 deep sleep) until the sensor detects a hand approaching, then it wakes up ESP32 which turns on touch panel and starts interaction with user.

So, 90% of the time this sensor is the only thing powered on, so consumption is very important in my case.

I agree that VCNL4100 and VCNL4200 are way too big. I am considering using VCNL4010 or APDS-9930, as alternatives or companions to my capacitive proximity sensor.

Right now I am testing the Cypress CY3280-MBR3 capacitive solution, and it seems to work incredibly well. Fully practical in my opinion, take a look at it if interested. It just needs a loop trace of around 5x5 cm, and it is capable of detecting my hand at 10cm distance at 10 Hz sample rate, consuming just 150 uA@3.3V total power. My intention is to put this trace loop on a pcb behind my screen. I have done some testing and it seems to work fine, but I am now designing this PCB in order to test it correctly.

I have not found yet a led based proximity solution that can give me this low power consumption at 10Hz, but I will test those chips mentioned above, because I also need to measure ambient light, and they do both.

Anyway, my initial question is still on the air: could I use capactive features of the ESP32 to do something similar to what the Cypress solution does? In order to reduce part count.
Or does anybody know of capacitive based proximity alternatives to Cypress? (just to compare and choose)

User avatar
Vader_Mester
Posts: 300
Joined: Tue Dec 05, 2017 8:28 pm
Location: Hungary
Contact:

Re: Is proximity sensing possible with ESP32?

Postby Vader_Mester » Mon Feb 26, 2018 1:01 pm

Veeery interesting.

Funny, that I mentioned VCNL4100 and VCNL4200, which I said are too big, but, my intentions with these sensors was the same as yours.
I wanted to use these for my smart wall switch, so the screen wakes up, if a person is standing in front of it.

For you the cypress solution should be better I guess, because the proximity sensors has a narrow field of view, so you might need a few of them to detect a hand, considering that the size of your display is bigger than a persons hand.
Also, it will need some kind of window or lense to cover them, to avoid dust, and earier cleaning, the Cypress solution however does not need any of this.

For the INT pin method: It's a "meh" method, which means that your sensor has some treshold configuration options, so it's very hardware bound, but very common.
The ULP coprocessor in the ESP can perform I2C check on the sensors, if needed, so your ESP32 will sleep while the ULP is periodically checking the sensor for activity.

Code: Select all

task_t coffeeTask()
{
	while(atWork){
		if(!xStreamBufferIsEmpty(mug)){
			coffeeDrink(mug);
		} else {
			xTaskCreate(sBrew, "brew", 9000, &mug, 1, NULL);
			xSemaphoreTake(sCoffeeRdy, portMAX_DELAY);
		}
	}
	vTaskDelete(NULL);
}

charlesaralmeida
Posts: 1
Joined: Wed Mar 17, 2021 9:26 pm

Re: Is proximity sensing possible with ESP32?

Postby charlesaralmeida » Wed Mar 17, 2021 10:15 pm

Just to add another option for you to lookup: HC-SR04 (ultrasonic distance sensor).

It's incredibly precise. Ambient light and color are not a problem since it "reads" sound.

Working Current: 15mA
Working Frequency: 40Hz
Range: 2cm ~ 4m
Measuring Angle: 15 degrees

It doesn't match your power requirements, but comparing the prices maybe it's worth to give it a try.

Who is online

Users browsing this forum: Baidu [Spider] and 110 guests