Distance sensor recommendation

I would like to mechanic instrument using distance sensor.
when thr preformer move is hand infront of a distance sensor it should control the speed of a DC motor. the more close the hand to the sensor the fastest the DC motor will rotate.

What distance motor is recommended for this? I have found those two options: HC-SR04 and E18-D80NK Infrared Photoelectric
Is one of those is good for the above? if not - any other recommendation?

Thanks

Edit:
I probably should stress out the max distance needed is probably no more the 1 meter

HCSR04 calculates presence in front to it. It also calculates the distance of the nearest obstacle. But it cannot detect body movement. Infrared sensors can detect presence only. You cannot calculate distance from those. For distance calculation, you must use HCSR04. For hand /body movement detection you must use PIR motion sensor.

Is PIR movement sensors output continuous data? Because this is the type of data I needed in order to control the speed of a motor.

What about this GP2Y0A21 sensor ?

So this sensor is good for moving the hand in-front of it and getting continuous data?

HCSR04 and GP2Y0A21 both can detect if someone/something is present in front of them. But none of them can detect hand movement. These sensors cannot detect if the thing ahead of them is moving or standing still. PIR motion sensors detect movement. depending on movement, their output changes. No movement=0V, Movement=5V. So, if you connect the PIR output to the Arduino, you can always detect if there is a movement. However, PIR will detect all kinds of movements. It will not be able to differentiate between a hand movement and movement of other parts of the body.

If you want to detect hand movement accurately, the best way is to set up a machine learning model using Raspberry Pi+Raspberry pi camera or something similar.

The sensor itself not needed to detect specific the movment of a hand. In this application I will use the hand to change the motor speed. Is this something not possible with one of those sensors?

So it output digital signal - either Low or High. I need continuous data for changing motor speed

These work pretty good.

how far away from the sensor is the hand?
Pololu do a range of TOF (time of Flight Sensors) which are easy to interface to Arduino micros and support libraries are available

1 Like

between 0 cm (blocking the sensor) to no more then 1 Meter

I would look at some of the time of flight sensor from ST. Adafruit has a bunch on nice breakout boards with I2C libraries for all of them in Arduino.

1 Like

what about this one?

one must use the i2c pins or I could get continuos data from sensor using analog pin?

Those sensors must use the arduino I2C pins? if I want to have more then 1 TOF sensor? how can I connect it to my arduino?

I have used pairs of VL53L1X (and other) TOF modules to detect distance of two objects
the VL53L1X has a command to change the default I2C address

VL53L1X_ERROR VL53L1X_SetI2CAddress(uint16_t dev, uint8_t new_address)
{
	VL53L1X_ERROR status = 0;
 	status = VL53L1_WrByte(dev, VL53L1_I2C_SLAVE__DEVICE_ADDRESS, new_address >> 1);
	return status;
}

to change an address any other VL53L1X modules which have the same address must not be enabled - use the XSHUT pin to switch them off
note: the module does not remember the new address when when power is removed

otherwise use an I2C multiplexor

1 Like

what about this or that pololu sensors?

what is the difference btween the above two sensors and TOF sensor?

You have gooogle and chatGPT now, for these kind of questions..

1 Like

You can use what's called an I2C multiplexer. This device sits in between your arduino and the sensors. Then when you want to read from a particular "port" you first command your multiplexer to connect to that port and then execute your i2c readings. This is ideal if you're going to be doing the same function on each port, like reading the distance in 4 TOF sensors. You would just change which port you're connected to and then run the same command for each sensor.

Or some TOF sensors have an XSHUT pin that can be pulled low to shut the sensor down. You can then set the address of the sensor via software. In brief, if you want 4 sensors, you start up and pull XSHUT low for sensors 2-4 and set the I2C address for sensor1. Then you pull XSHUT high for Sensor2 and set the i2C address for sensor 2 and so on and so on.

Thanks butI think I will try first distance sensor that uses the Analog pin of the arduino like this one. Seems much easier

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.