Week 4 – Combining a Touch Sensor and a PIR Motion Sensor – Josh Milkins

We decided that the most logical and useful application of our two sensors was an intruder alarm.

The alarm consisted of a PIR sensor which was used to detect movement in a room, it also had a touch switch which could be used to reset the alarm once is had been tripped. When the alarm is tripped, LED’s flash and a buzzer is sounded to deter intruders from continuing.

This was the fritzing diagram which shows all of the components used;

fritzing combined

Photo Capture Alarm sys

And the code;
https://create.arduino.cc/editor/JoshMilkins/b436027f-09e5-47a4-9436-e3fb9e89c35f/preview?embed

The debouce used in the previous weeks code was also used in this one and this code also used clock cycles to flash the LED instead of;

digitalWrite(LED_BUILTIN, HIGH);
delay(1000);
digitalWrite(LED_BUILTIN, LOW);
delay(1000);

We used;

if (alarm){
unsigned long currentMillis = millis();
if(currentMillis – previousMillis > interval) {
previousMillis = currentMillis;
if (ledState == LOW)
ledState = HIGH;
else
ledState = LOW;

This allows us to put more parameters into the if statement like seeing whether the led is currently high or low.

The video shows that when i put my hand in front of the sensor it will trigger although we found the motion sensor has a very wide detectable angle of 170 degrees and so it was hard to find position that didn’t trigger it.

Advertisements

Week 3 – 4 Arduino Alarm System with Motion and Touch Sensors

Photo capture of the Arduino alarm system with motion and touch sensors.

PPhoto Capture

 

The Fritzing Diagram of the Alarm system with motion and touch sensors.

 

 

fritzing combined

The Video Capture of the working Arduino Alarm System with motion and touch sensors

 

The Arduino Code of the Alarm system with motion and touch sensors

 

Large Code combined

Week1- 2: Arduino Motion sensor

Author: Suleyman Akbulut

Using motion sensors and an Arduino you can trigger lights, fans, etc. This kind of sensor is known as the Passive Infrared Motion Detector or PIR. These sense the infrared radiation emitted by all objects above absolute zero. When something passes in front of a PIR sensor it detects the change in background temperature and then triggers an output voltage. This voltage can be read by an Arduino digital input and then the Arduino can act upon it.

The Motion sensor I used for this project is shown below;

sakbulut_motion_pic

Here is the circuit for my Arduino motion sensor project;

 

SAKBULUT_Circuit diagram_MOTION_SENSOR_bb

P.S. I used barometric pressure sensor on this diagram as there wasn’t a motion sensor on the menu to use.

The Arduino code for the project as follows;

This code activates an LED when you wave your hand over the motion sensor.
int motion_1 = 2;
int light_1 = 13;
void setup(){
pinMode (motion_1,INPUT);
pinMode (light_1, OUTPUT);
}
void loop (){
digitalWrite (light_1,LOW);
delay(1000); //this delay is to let the sensor settle down before taking a reading
int sensor_1 = digitalRead(motion_1);
if (sensor_1 == LOW){
digitalWrite(light_1,HIGH);
delay(500);
digitalWrite(light_1,LOW);
delay(500);
}
}

The photos of motion sensor project as follows;

SAKBULUT_Motion_sensor_photo1

SAKBULUT_Motion_sensor_photo2

SAKBULUT_Motion_sensor_photo3

References:
https://www.wired.com/2012/09/using-motion-detectors-with-an-arduino/
https://en.wikipedia.org/wiki/Motion_detector
https://learn.adafruit.com/pir-passive-infrared-proximity-motion-sensor?view=all
http://engineering.nyu.edu/gk12/amps-cbri/pdf/Intro%20to%20Sensors.pdf
https://www.researchgate.net/publication/303314563_AUTOMATIC_LIGHTING_AND_SECURITY_SYSTEM_DESIGN_USING_PIR_MOTION_SENSOR

Week 2 – Capacitive Touch Sensor – Josh Milkins

The sensor has two outputs, an analogue output that is dependent on how strongly a touch is detected, or a digital output that will go high if touch is detected above a threshold set by the modules potentiometer.

The example program below by hobbycomponents.com reads the status of both sensor outputs and outputs ‘TOUCH DETECTED’ to the serial port when the sensor detects it being touched.

https://create.arduino.cc/editor/JoshMilkins/c5e3cbc1-bde8-461f-91d6-a4b1b6cb50d0/preview?embed

I wired up the breadboard to work with the code with the digital output of the sensor going to pin 2 on the arduino and the analog output of the sensor going to pin A0 on the arduino

IMG_20180212_135924

This is the flowchart for the Sudo code;

serial monitor flowchart

 

And the fritzing breadboard layout;

Touch fritzing

Week 1 – Capacitive Touch Sensor – Josh Milkins

I have been given the capacitive touch sensor to research.

The PCB components consist of:

  • 2x 100kohm resistors
  • 2x 1kohm resistors
  • 1x 10kohm resistor
  • 1x 150ohm resistor
  • 1x KSP13 Darlington transistor
  • 1x LM393 Dual differential comparator
  • 2x LED’s
  • 1x 100k Potentiometer

Pinout:
1 Analogue out
2 GND
3 VCC (+5V)
4 Digital out

KY_036_Metal_touch_sensor_module

Above is a schematic of the PCB

 

When looking more in depth into the components I found the datasheets of the 2 main components;

The lm393 Dual differential comparator

The ksp13 Darlington transistor