top of page

E - Evening: Final interaction

  • Writer: Alex V
    Alex V
  • Jul 8, 2019
  • 2 min read

With the evening letter we wanted to bring the feeling of the night time in Enschede, to achieve that there is a distance sensor that detects if someone is close to the installation and brights the leds depending on how far are they.


The distance sensor is a Sharp GP2Y0A02, features a range from 20 cm to 150 cm.

Technical details

Operating voltage: 4.5 V to 5.5 V

Average current consumption: 33 mA

Distance measuring range: 20 cm to 150 cm

Output type: analog voltage

Output voltage differential over distance range: 2.05 V (typical)

Update period: 38 ± 10 ms

Size: 44.5 mm × 18.9 mm × 21.6 mm

Weight: 5 g


The relationship between the sensor’s output voltage and the inverse of the measured distance is approximately linear over the sensor’s usable range. The sensor documentation contains a plot of analog output voltage as a function of the inverse of distance to a reflective object. I use an arduino library (SharpIR.h) that does a plot to convert the sensor output voltage to an approximate distance by constructing a best-fit line that relates the inverse of the output voltage (V) to distance (cm).


For the LEDs our sponsor leds4life gave us some LED modules


Technical details

Ledmodule: 1W Type led: 2835 Leds/module: 3pcs Power per module: 1W Voltage: 12V Stralingshoek: 160 graden IP: IP65 58X12 mm 80 lumen


Wiring

Arduino code


/*SHARP GP2Y0A21YK0F IR sensor with Arduino and SharpIR library code. More info: https://www.makerguides.com */

//Include the library

#include <SharpIR.h>

//Define model and input pin

#define IRPin A0

#define model 20150


//Setup the sensor object

SharpIR IR_Sensor_1(IRPin, model);

const int ledPin = 9;

int fadeValue2 ;


void setup()

{

//Begin serial communication at a baud rate of 9600

Serial.begin(9600);

}

void loop()

{

delay(100); // Delay to smooth the brightness change

int distance_cm = IR_Sensor_1.distance(); // this returns the distance to the object you're measuring

int distance_cm2;


if (distance_cm < 150) // If Distance is less than 150 cm then do the following:


{ // Maps the LED brightness proportional to the distance


distance_cm2 = 150 + distance_cm;


fadeValue2 = map(distance_cm2 , 0, 40, 0, 254);


analogWrite(ledPin, fadeValue2); // Writes the fadeValue to pin 9

}

else

{

analogWrite(ledPin, 0); //If distance is larger than 150cm then switch off


}


}

Recent Posts

See All
S - Shopping: Final interaction

For the S we wanted a unique customizable interaction, like when you dress and choose every part to our outfit, we wanted to bring that...

 
 
 

Comments


Please Note

© 2023 by I Made It!. Proudly created with wix.com

  • Black Facebook Icon
  • Black YouTube Icon

Thanks for submitting!

Join our mailing list
bottom of page