My goal for this project was to combine an analog and digital interaction using Arduino. My original concept was to use a digital and analog input to create a digital output in the form of an LED pin lighting. I wanted to make the turning of a potentiometer knob and motion sensed by a PIR trigger an LED to light up. My idea was that it could mimic the arming of an alarm. Turn the knob to arm the alarm and the motion sensor will trigger an alert. If the knob isn't turned, the motion sensor won't trigger.
However, I realized once I tested my PIR that it was too sensitive and it was constantly sensing motion even without a visible source of motion. My classmate suggested that it may have been sensing the overhead lighting. I abandoned the PIR sensor and just went with the potentiometer triggering the LED.
Step 1: Setup the Circuit
Connect the power to 5V on the bread board. Then connect the Ground position on the bread board to GND.
Step 2: Connect the Potentiometer
The potentiometer has three prongs: power, output, and ground (see diagram).
Connect male-female wire to each prong. Connect the power prong to the power on the bread board and connect the ground to the ground on the bread board. Connect the output to A1 in the analog.
Step 3: Connect the LED Pin
Insert the LED pin onto the breadboard. Connect the anode to the digital 4 on the Arduino. Connect the cathode to the ground row on the breadboard.
Step 4: Connect the PIR
When I connected the PIR and read the serial line, I saw that it was rapidly switching between 0 and 1 even when there was no motion around it (see the video below). I tried covering it completely and it still wasn't registering the motion so I decided to scrap the PIR input.
The link to the code can be found on Github. Special Thanks to Chris Stuart for helping me code this one from scratch.