Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
Randall Chavez
Published © MIT

Silent Alarm for the deaf community

In todays world, the deaf community needs a home security system that will call the police if a door is breached.

BeginnerShowcase (no instructions)Over 1 day111
Silent Alarm for the deaf community

Things used in this project

Hardware components

Photon
Particle Photon
main part of the project.
×1
0.96" OLED 64x128 Display Module
ElectroPeak 0.96" OLED 64x128 Display Module
Displays status of sensor.
×1
SparkFun Atmospheric Sensor Breakout - BME280
SparkFun Atmospheric Sensor Breakout - BME280
Works along with encoder.
×1
SparkFun RedBot Sensor - Wheel Encoder
SparkFun RedBot Sensor - Wheel Encoder
Encoder that allows use of the button option to operate a function.
×1
NeoPixel Ring: WS2812 5050 RGB LED
Adafruit NeoPixel Ring: WS2812 5050 RGB LED
This ring allows use of many light codes when a certain phase of the project is taking place.
×1
Grove - PIR Motion Sensor
Seeed Studio Grove - PIR Motion Sensor
Sensor that detects movement 360%.
×1
Breadboard (generic)
Breadboard (generic)
This piece puts together all needed components to work together as directed by the photon 2 processor inputs or codes.
×1

Hand tools and fabrication machines

Wire Stripper & Cutter, 18-10 AWG / 0.75-4mm² Capacity Wires
Wire Stripper & Cutter, 18-10 AWG / 0.75-4mm² Capacity Wires
Needed to cut wire to correct length for breadboard.
Soldering iron (generic)
Soldering iron (generic)
To make circuts complete.
Solder Wire, Lead Free
Solder Wire, Lead Free
To connect two pieces to make a complete circut.
Mastech MS8217 Autorange Digital Multimeter
Digilent Mastech MS8217 Autorange Digital Multimeter
To check to make sure you are getting the correct power supply to any item on the project.
Laser cutter (generic)
Laser cutter (generic)
used to make items for this project, It was used to make the display box for my project.

Story

Read more

Schematics

Fritzing

Fritzing 2

Code

Alert for Deaf People

C/C++
/* 
 * Project Alert for deaf people
 * Author: Randall Chavez
 * Date: 03-04-2024
 * For comprehensive documentation and examples, please visit:
 * https://docs.particle.io/firmware/best-practices/firmware-template/
 */

// Include Particle Device OS APIs
#include "Particle.h" 
#include "IoTClassroom_CNM.h"
#include <Encoder.h>
#include "Adafruit_SSD1306.h"
#include "Adafruit_GFX.h"
#include <neopixel.h>
#include <colors.h>
int motionPin = D4;
const int PINA = D8;
const int PINB = D9;

int position;
int lastPosition;

Encoder myEncoder(PINA, PINB);
Adafruit_SSD1306 display(-1);


int bri=255;
int val;
int myhue=4;
//
void pixelFill(int start,int end,int color);// This is how to difine a function// 

SYSTEM_MODE(MANUAL);
bool buttonOnOff;
const int MYWEMO=3; 
Button wemoButton (D16);
SYSTEM_THREAD(ENABLED);
const int PIXELCOUNT = 20;
Adafruit_NeoPixel pixel ( PIXELCOUNT, SPI1, WS2812B) ;


void setup(){ 
  Serial.begin(9600); 
  waitFor(Serial.isConnected,10000);


  pinMode(motionPin, INPUT);
  WiFi.on();
  WiFi.clearCredentials();
  WiFi.setCredentials("IoTNetwork");
  
  WiFi.connect();
  while(WiFi.connecting()) {
    Serial.printf(".");
  }
  Serial.printf("\n\n");
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C); 
//setHue(myhue, false, HueRed, (255),255);
  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.clearDisplay();
  display.display();
 
  
  delay(5000);
pixel.begin();
 pixel.setBrightness (bri); 
 pixel.show();

 delay (2000);
}

void loop(){
  display.setCursor(0,0);
position = myEncoder.read ();
if (position != lastPosition)
{
Serial.printf("Encoder position: %i\n", position); 
lastPosition = position;
}



  val = digitalRead(motionPin);



if (val == HIGH){
  setHue(myhue, true, HueRed, (255),255);
  Serial.printf("motion detected --- val = %i\n", val);
  display.printf("Police Dispatched");
  display.display();
  display.clearDisplay();
  pixelFill(0,20,red);

}

else{ 
  setHue(myhue, false, HueRed, (255),255);       
  Serial. printf("no motion detected -- val = %i\n", val  );
  display.printf("All Clear");
  display.display();
  display.clearDisplay();
  pixelFill(0,20,blue);
  
  }
  
  if(wemoButton.isClicked()){
    buttonOnOff=!buttonOnOff;
  }
  if(buttonOnOff==true){
    Serial.printf("Turning on Wemo# %i\n",MYWEMO);
    wemoWrite(MYWEMO,HIGH);
  }
  else{
    wemoWrite(MYWEMO,LOW);
    Serial.printf("Turning off Wemo# %i\n",MYWEMO);

  }

}

void pixelFill(int start, int end, int pixColor){ 
  int i;
   for(i=start; i<end; i ++){
    pixel.setPixelColor (i, pixColor);
    pixel.show();
   }
   }



  

Credits

Randall Chavez
3 projects • 3 followers
Contact

Comments

Please log in or sign up to comment.