Introduction: Arduino Powered Infared Thing

About: I love making stuff, whether it's robots, music or electronics.
Hello, this is my first instructible. I will show you how to make an arduino powered analog sensor reader (I will be using an infared photodiode).

Step 1: Parts

You will need several things to make this:

1. Some sort of case or box

2. An Adafruit RGB LCD shield for arduino

3. An arduino uno

4. Any kind of LED you want

5. An infared photodiode from radioshack

6. A pack of female and male jumper wires

7. 9v battery holder for arduino

8. A computer

9. Duct tape

Step 2: Hookup the LCD

Grab a handful of the jumper wires and hook up these four pins to the coresponding pins on the arduino:

Analog 4

Analog 5

GND

+5v

Step 3: Hookup the Sensor and the LED

Plug the LED into pin 13 and GND of the arduino and the sensor into Analog 0 (A0) and ground using jumpers. Then tape the sensor to the side of the case/box so that it is sticking out.

Step 4: Putting Things Together

Put the arduino and the lcd shield inside the case/box. Duct tape the 9v holder to the side of the case and connect to arduino.

Step 5: Coding Time!

Were allmost done! Upload this code to your arduino:


#include
#include
#include

Adafruit_RGBLCDShield lcd = Adafruit_RGBLCDShield();

#define RED 0x1
#define YELLOW 0x3
#define GREEN 0x2
#define TEAL 0x6
#define BLUE 0x4
#define VIOLET 0x5
#define WHITE 0x7

int sensorPin = A0;
float sensorValue = 0;
float Voltage;
int led = 13;

void setup() {

Serial.begin(9600);
lcd.begin(16, 2);
lcd.print("Infared:");
pinMode(led, OUTPUT);
}

int LED() {

digitalWrite(led, HIGH);

delay(Voltage * 500);

digitalWrite(led, LOW);

}

uint8_t i=0;
void loop() {

sensorValue = analogRead(sensorPin);

LED();

lcd.setCursor(8, 0);

Voltage = sensorValue * (5.0 / 1023.0);

lcd.setBacklight(VIOLET);

lcd.print(Voltage);

delay(250);

}



Step 6: Test It Out

Flip the switch on the battery pack and look at the lcd and the led, the led should be blinking and the lcd should say something like Infared:0.28 now go out in the sun and look at it now, if you did everything correctly there should be a higher number on the lcd and the led should be blinking slower.