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.
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
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
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.