I want to measure the distance to an obstacle using an LED infrared emitter and an IR photodiode, but it is not working correctly.
I am using an Arduino microcontroller, and I purchased the sensor from Temu.
Link: https://www.temu.com/goods.html?_bg_fs=1&goods_id=601099533870597&sku_id=17592289886431&_x_sessn_id=yv1ec4mxm0&refer_page_name=bgt_order_detail&refer_page_id=10045_1716208253115_3s0h0vglu9&refer_page_sn=10045
The wiring is as shown in the photo.
The program is as follows.
enter image description here
int analog_Pin = A0;
void setup() {
// put your setup code here, to run once:
pinMode(PWM_Pin, INPUT);
Serial.begin(9600);
}
void loop() {
delayMicroseconds(500); //wait
Serial.println(analogRead());
}
We tried various resistance values,
I also tried different orientations on the receiver side, and since I bought multiple parts, I tried with those multiple pieces.
That’s about it.
Ultimately, I would like to be able to use these two LED IR emitters and IR receiver diodes to measure distances as close (30cm ~ 5cm) as possible.
This is a sentence translated using deepl.
くんみちまち is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.