139741 Arduino Infrared Obstacle Avoidance Detection Photoelectric Sensor: Difference between revisions

From air
Jump to navigation Jump to search
No edit summary
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[Image:547132375_615.jpg|400px|thumb|right|E18-D50NK]]


[http://www.dealextreme.com/p/139741 Arduino Infrared Obstacle Avoidance Detection Photoelectric Sensor]
[http://www.dealextreme.com/p/139741 Arduino Infrared Obstacle Avoidance Detection Photoelectric Sensor]


Line 13: Line 16:
* Wiring:
* Wiring:
** red (DC 4.5~5V power high level)
** red (DC 4.5~5V power high level)
** yellow (microcontroller)
** yellow (microcontroller) yellow is signal (with 10KOhm to the +)
** green (GND 0V power low level)
** green (GND 0V power low level)








see also [http://www.dealextreme.com/p/obstacle-avoidance-ir-robotic-sensor-yellow-black-dc-5v-148556?item=22 Obstacle Avoidance IR Robotic Sensor for Arduino - Yellow + Black (DC 5V)]
see also [http://www.dealextreme.com/p/obstacle-avoidance-ir-robotic-sensor-yellow-black-dc-5v-148556?item=22 Obstacle Avoidance IR Robotic Sensor for Arduino - Yellow + Black (DC 5V)]


==Arduino sketch==
<pre>
/*
Code sample for 139741 Arduino Infrared Obstacle Avoidance Detection Photoelectric Sensor
Output current: 100mA
Working voltage: DC 5V
Current consumption: DC < 25mA
Response time: < 2ms
Sensing angle: Less than 15 degree
Detecting range: 3~80 cm
Working temperature: -25~55'C
Wiring:
red (DC 4.5~5V power high level)
yellow (Pin A0 microcontroller)
green (GND 0V power low level)

This code is in the public domain.
*/

const int analogInPin = A0; // Analog input pin that the sensor is attached to

int sensorValue = 0; // value read from the pot

void setup() {
// initialize serial communications at 9600 bps:
Serial.begin(9600);
}

void loop() {
// read the analog in value:
sensorValue = analogRead(analogInPin);

// print the results to the serial monitor:
Serial.print("sensor = " );
Serial.print(sensorValue);
Serial.print("\t distance = ");
Serial.println(map(sensorValue, 0, 1023, 3, 80));

// wait 2 milliseconds before the next loop
// for the analog-to-digital converter to settle
// after the last reading:
delay(2);
}

</pre>

Latest revision as of 22:33, 15 January 2015

E18-D50NK


Arduino Infrared Obstacle Avoidance Detection Photoelectric Sensor

Transmitter and receiver photoelectric sensor set; Voltage: DC 5V, current: 100mA, detection range: 3~80cm (adjustable); with potentiometer and output indicator light on the back


  • Output current: 100mA
  • Working voltage: DC 5V
  • Current consumption: DC < 25mA
  • Response time: < 2ms
  • Sensing angle: Less than 15 degree
  • Detecting range: 3~80 cm
  • Working temperature: -25~55'C
  • Wiring:
    • red (DC 4.5~5V power high level)
    • yellow (microcontroller) yellow is signal (with 10KOhm to the +)
    • green (GND 0V power low level)



see also Obstacle Avoidance IR Robotic Sensor for Arduino - Yellow + Black (DC 5V)


Arduino sketch

/*
 Code sample for 139741 Arduino Infrared Obstacle Avoidance Detection Photoelectric Sensor
 
 
    Output current: 100mA
    Working voltage: DC 5V
    Current consumption: DC < 25mA
    Response time: < 2ms
    Sensing angle: Less than 15 degree
    Detecting range: 3~80 cm
    Working temperature: -25~55'C
    Wiring:
        red (DC 4.5~5V power high level)
        yellow (Pin A0 microcontroller)
        green (GND 0V power low level) 

 This code is in the public domain.
 
 */

const int analogInPin = A0;  // Analog input pin that the sensor is attached to

int sensorValue = 0;        // value read from the pot

void setup() {
  // initialize serial communications at 9600 bps:
  Serial.begin(9600); 
}

void loop() {
  // read the analog in value:
  sensorValue = analogRead(analogInPin);            

  // print the results to the serial monitor:
  Serial.print("sensor = " );                       
  Serial.print(sensorValue);      
  Serial.print("\t distance  = ");      
  Serial.println(map(sensorValue, 0, 1023, 3, 80));   

  // wait 2 milliseconds before the next loop
  // for the analog-to-digital converter to settle
  // after the last reading:
  delay(2);                     
}