Notice
Recent Posts
Recent Comments
Link
반응형
관리 메뉴

eng-life 님의 블로그

Arduino Uno: Infrared Sensor (8) 본문

ENGR

Arduino Uno: Infrared Sensor (8)

eng-life 2025. 6. 7. 06:22
반응형

 

Lets' a different type of sensor that will detect motion and use our 4 LEDs to tell us how close an object is to our sensor.

  • This is an Infrared Obstacle Avoidance Sensor Module (MH-Sensor Series, Flying-Fish)
  • Emits and detects IR similar to a RADAR

MH-Sensor, Flying Fish

MH-Sensor Series, Flying-Fish

  • Effective distance range: 2-30 cm
  • Detection distance knob potentiometer
  • 3.3V - 5V working voltage
  • 35º detection angle

Wiring 

  • Connect the 3 wires to the IR sensor as shown

  • Connect VCC from IR sensor to 5V on the Arduino
  • Connect GND from IR sensor to GND on the Arduino
  • Connect OUT from IR sensor to Digital Output 2 on the Arduino
  • Connect an LED (+lead) to Pint 13 and ( - lead) to GND on the Arduino

 

What do you have to change in the code?

Read the value on 2 and display a message on the LCD.


Use our 4 LEDs to tell us how close an object is to our sensor.

Connection

  • What do you have to change in the code?
  • New variables, print statements ad levels for LED since 3.2V is teh max value.
  • Selt levels for 30 cm , 32 cm, 35 cm, and 40 cm.
  • Like the Potentiometer, the IR device is just another analog sensor.

New variavle for IR sensor.

 

 Read the Value on A1.

Change the print statement

Use the following values for the IR sensor

Compile, Upload, and Test!

Verify LED Visual Display is working by comparing with Serial Monitor.

 

'ENGR' 카테고리의 다른 글

Arduino Uno: Liquid Crystal Display (7)  (4) 2025.06.04
Arduino Uno: Potentiometer (6)  (1) 2025.06.03
Arduino Uno: Analog vs. Digital (5)  (0) 2025.06.03
Arduino Uno: LED Visual Display (4)  (0) 2025.06.02
Arduino Uno: Blink an LED (3)  (3) 2025.06.02