Slimme huisautomatisering & beveiligingssysteem bouwen met 1Sheeld
Onderdelen en benodigdheden
- Arduino UNO (1x)
- 1Sheeld-board (1x)
- Relaismodule 4-kanaals (bijv. YW Robot) (1x)
- Buzzer (2x)
- Temperatuursensor LM35DZ (1x)
- Dupont-kabels (1 set)
- PIR-bewegingsensor (1x)
- Magnetische deurschakelaar (2x)
- LCD-scherm 16x2 (Adafruit standaard, wit op blauw) (1x)
Benodigde tools
- Lasersnijder (voor behuizing)
Over dit project
Dit project combineert huisautomatisering en beveiliging in één systeem, bestuurbaar via je smartphone met de 1Sheeld-app. De 1Sheeld zet je smartphone om in meer dan 40 verschillende Arduino-shields, zodat je geen aparte sensoren hoeft te kopen.
Hoe het werkt
- Spraakbesturing: Zeg "Jarvis" gevolgd door commando's als "keuken aan", "slaapkamer uit", "wat tijd is het", "goedemorgen"
- SMS-besturing: Stuur "on" of "off" via SMS om alle lampen te schakelen
- Beveiliging: Activeer met "security on". Bij openen van deur/raam (magnetische contacten) gaat de alarmbuzzer af en ontvang je een e-mail
- Temperatuurmonitoring: Bij >35°C activeert buzzer en e-mailwaarschuwing
- Feedback: LCD-scherm toont status, 1Sheeld spreekt bevestigingen uit via Text-to-Speech
Belangrijke opmerkingen
- Altijd "Jarvis" zeggen vóór een spraakcommando
- 1Sheeld reageert met spraakbevestiging ("yes sir", "ok sir")
- Beveiliging in/uit: "security on" / "security off"
1Sheeld-app instellen
- Installeer de 1Sheeld-app op je smartphone
- Koppel via Bluetooth (standaard pincode: 1234)
- Selecteer de benodigde shields: SMS, Voice Recognition, Text To Speech, Clock, Email
Hardware-aansluiting
- Relaismodule (lampen): A1=Hal, A2=Slaapkamer, A3=Badkamer, A4=Keuken (actief laag)
- Magnetische contacten: Pin 8 (hal), Pin 9 (keuken/balcon) – INPUT_PULLUP
- Buzzers: Pin 10 (temperatuur), Pin A5 (inbraakalarm)
- Temperatuursensor LM35DZ: VCC→5V, GND→GND, OUT→A0
- LCD: Pins 2,3,4,5,6,7 (RS, E, D4-D7)
- UART-schakelaar op 1Sheeld: Zet op "Uploading mode" tijdens uploaden, daarna terug op "Operating mode"
Code
Installeer de OneSheeld-bibliotheek via de Arduino Library Manager.
#define CUSTOM_SETTINGS
#define INCLUDE_VOICE_RECOGNIZER_SHIELD
#define INCLUDE_TEXT_TO_SPEECH_SHIELD
#define INCLUDE_CLOCK_SHIELD
#define INCLUDE_SMS_SHIELD
#define INCLUDE_EMAIL_SHIELD
#include <LiquidCrystal.h>
#include <OneSheeld.h>
// Pin definities
#define receptionLamp A1
#define bedRoomLamp A2
#define pathRoomLamp A3
#define balaconyLamp A4
#define magneticReception 8
#define magneticBalacony 9
#define buzzer1 A5 // Inbraakalarm
#define buzzer2 10 // Temperatuuralarm
LiquidCrystal lcd(2,3,4,5,6,7);
// Spraakcommando's
const char mainCommand[] = "jarvis";
const char receptionCommandOn[] = "reception on";
const char receptionCommandOff[] = "reception off";
const char bedRoomCommandOn[] = "bedroom on";
const char bedRoomCommandOff[] = "bedroom off";
const char pathRoomCommandOn[] = "bathroom on";
const char pathRoomCommandOff[] = "bathroom off";
const char balaconyCommandOn[] = "kitchen on";
const char balaconyCommandOff[] = "kitchen off";
const char whatsUp[] = "good morning";
const char timeCommand[] = "what time is it";
const char securityModeOn[] = "security on";
const char securityModeOff[] = "security off";
const char lightsOn[] = "on";
const char lightsOff[] = "off";
// SMS commando's
const char lightsOnSMS[] = "on";
const char lightsOffSMS[] = "off";
byte smile[] = {
B00000, B01001, B01001, B00000,
B00000, B10001, B01110, B00000
};
int hours, minutes;
String strh, strm, noon;
char h[4], m[4];
bool security = false;
int state = 0;
void setup() {
noTone(buzzer1); noTone(buzzer2);
// Alle lampen uit (relais actief laag)
digitalWrite(receptionLamp, HIGH);
digitalWrite(bedRoomLamp, HIGH);
digitalWrite(pathRoomLamp, HIGH);
digitalWrite(balaconyLamp, HIGH);
pinMode(receptionLamp, OUTPUT);
pinMode(bedRoomLamp, OUTPUT);
pinMode(pathRoomLamp, OUTPUT);
pinMode(balaconyLamp, OUTPUT);
pinMode(buzzer1, OUTPUT);
pinMode(buzzer2, OUTPUT);
pinMode(magneticReception, INPUT_PULLUP);
pinMode(magneticBalacony, INPUT_PULLUP);
lcd.begin(16,2);
lcd.createChar(0, smile);
OneSheeld.begin();
// Welkomstscherm
lcd.print("Welcome To The");
delay(4000);
lcd.clear();
lcd.print("Smart Home");
lcd.setCursor(0,1);
lcd.print("Automation And");
delay(4000);
lcd.clear();
lcd.print("Security System");
delay(4000);
lcd.clear();
lcd.print("CALIBRATING....");
delay(10000);
if(!VoiceRecognition.isNewCommandReceived()) {
lcd.clear();
lcd.setCursor(1,0);
lcd.print("We Are Here To");
lcd.setCursor(4,1);
lcd.print("HELP You");
}
security = false;
}
void loop() {
Clock.queryDateAndTime();
SMS.setOnSmsReceive(&MyFunction);
minutes = Clock.getMinutes();
hours = Clock.getHours();
// 24u naar 12u formaat
if(hours > 12) { hours -= 12; noon = "PM"; }
else { noon = "AM"; }
strh = String(hours); strh.toCharArray(h,4);
strm = String(minutes); strm.toCharArray(m,4);
VoiceRecognition.start();
OneSheeld.delay(8000);
if(VoiceRecognition.isNewCommandReceived()) {
// Wake word "Jarvis"
if(!strcmp(mainCommand, VoiceRecognition.getLastCommand())) {
TextToSpeech.say("yes sir");
lcd.clear(); lcd.setCursor(8,0); lcd.write(byte(0));
state = 1;
}
// Lampen besturen na wake word
if(state == 1) {
handleVoiceCommands();
}
}
// Beveiligingssysteem
int magRec = digitalRead(magneticReception);
int magBal = digitalRead(magneticBalacony);
if(security) {
if(magRec == HIGH || magBal == HIGH) {
tone(buzzer1, 1500);
Email.send("jouw@email.com", "Beveiliging", "Iemand is binnengekomen!");
OneSheeld.delay(3500);
} else {
noTone(buzzer1);
}
} else {
noTone(buzzer1);
}
// Temperatuurmonitoring (uitgecommentarieerd in origineel)
/*
int voltage = analogRead(A0) * 1100 / 1024;
int degree = voltage / 10;
if(degree >= 35) {
tone(buzzer2, 1500);
Email.send("jouw@email.com", "Beveiliging", "Temperatuur te hoog!");
OneSheeld.delay(5000);
} else {
noTone(buzzer2);
}
*/
}
void handleVoiceCommands() {
String cmd = VoiceRecognition.getLastCommand();
if(!strcmp(receptionCommandOn, cmd)) { setLamp(receptionLamp, LOW, "ok sir lamp in the reception is on", "The Hall Lamp Is", "ON"); }
else if(!strcmp(receptionCommandOff, cmd)) { setLamp(receptionLamp, HIGH, "ok sir lamp in the reception is off", "The Hall Lamp Is", "OFF"); }
else if(!strcmp(bedRoomCommandOn, cmd)) { setLamp(bedRoomLamp, LOW, "ok sir lamp in the bedroom is on", "The Bedroom", "lamp Is: ON"); }
else if(!strcmp(bedRoomCommandOff, cmd)) { setLamp(bedRoomLamp, HIGH, "ok sir lamp in the bedroom is off", "The Bedroom", "lamp Is: OFF"); }
else if(!strcmp(pathRoomCommandOn, cmd)) { setLamp(pathRoomLamp, LOW, "ok sir lamp in the bathroom is on", "The Bathroom", "lamp Is: ON"); }
else if(!strcmp(pathRoomCommandOff, cmd)) { setLamp(pathRoomLamp, HIGH, "ok sir lamp in the bathroom is off", "The Bathroom", "lamp Is: OFF"); }
else if(!strcmp(balaconyCommandOn, cmd)) { setLamp(balaconyLamp, LOW, "ok sir lamp in the kitchen is on", "The Kitchen", "Lamp Is: ON"); }
else if(!strcmp(balaconyCommandOff, cmd)) { setLamp(balaconyLamp, HIGH, "ok sir lamp in the kitchen is off", "The Kitchen", "Lamp Is: OFF"); }
else if(!strcmp(whatsUp, cmd)) {
lcd.clear(); lcd.print("Good Morning :)"); lcd.setCursor(0,1); lcd.print("Its A Good Day");
TextToSpeech.say("good morning sir"); OneSheeld.delay(1500);
TextToSpeech.say("time in cairo is"); OneSheeld.delay(1500);
TextToSpeech.say(h); OneSheeld.delay(1000);
TextToSpeech.say(m); OneSheeld.delay(1000);
TextToSpeech.say(noon); state = 0;
}
else if(!strcmp(timeCommand, cmd)) {
lcd.clear(); lcd.print("Time In Cairo Is"); lcd.setCursor(0,1); lcd.print(h); lcd.print(":"); lcd.print(m); lcd.print(" "); lcd.print(noon);
TextToSpeech.say("time in cairo is"); OneSheeld.delay(1500);
TextToSpeech.say(h); OneSheeld.delay(1000);
TextToSpeech.say(m); OneSheeld.delay(1000);
TextToSpeech.say(noon); state = 0;
}
else if(!strcmp(securityModeOn, cmd)) {
lcd.clear(); lcd.print("Ok,Sir Feel Safe"); lcd.setCursor(0,1); lcd.print("Security Mode");
TextToSpeech.say("security system was triggered"); security = true; state = 0;
}
else if(!strcmp(securityModeOff, cmd)) {
lcd.clear(); lcd.print("Ok,Sir Security"); lcd.setCursor(0,1); lcd.print("is OFF");
TextToSpeech.say("security system was turned off"); security = false; state = 0;
}
}
void setLamp(int pin, int val, const char* speech, const char* lcd1, const char* lcd2) {
TextToSpeech.say(speech); OneSheeld.delay(2500);
digitalWrite(pin, val);
lcd.clear(); lcd.print(lcd1); lcd.setCursor(0,1); lcd.print(lcd2);
state = 0;
}
void MyFunction(char* phoneNumber, char* messageBody) {
if(!strcmp(lightsOnSMS, messageBody)) {
digitalWrite(receptionLamp, LOW); delay(500);
digitalWrite(pathRoomLamp, LOW); delay(500);
digitalWrite(bedRoomLamp, LOW); delay(500);
digitalWrite(balaconyLamp, LOW); delay(500);
TextToSpeech.say("all lights was turned on");
lcd.clear(); lcd.print("All Lights is ON");
Email.send("jouw@email.com", "Systeem", "Alle lampen AAN"); OneSheeld.delay(3500);
}
else if(!strcmp(lightsOffSMS, messageBody)) {
digitalWrite(receptionLamp, HIGH); delay(500);
digitalWrite(pathRoomLamp, HIGH); delay(500);
digitalWrite(bedRoomLamp, HIGH); delay(500);
digitalWrite(balaconyLamp, HIGH); delay(500);
TextToSpeech.say("all lights was turned off");
lcd.clear(); lcd.print("All Lights Is OFF");
Email.send("jouw@email.com", "Systeem", "Alle lampen UIT"); OneSheeld.delay(3500);
}
}
CAD-bestand voor behuizing
drawing_lasser_cutting_lvvsN9X9Xg.dwg – voor lasersnijder
Schema's
Zie afbeeldingen in de originele projectpagina voor gedetailleerde aansluitschema's.
Productieproces
- Een 433 MHz Slimme Huiscounter Bouwen met Sensorflare en Raspberry Pi
- Raspberry Pi Thuisbeveiligingssysteem: PIR-bewegingsdetectie + Camera E-mailwaarschuwingen
- Betrouwbaar Arduino RFID Aanwezigheidssysteem Aangedreven door Python
- Universele Android-afstandsbediening bouwen met Arduino, 1Sheeld en IR-besturing
- Bouw een Slimme IoT Pot met ESP8266, Arduino & Ultrasonische Sensor – Real-time Monitoring
- Realtime afstandsmeting met Arduino Sonar & Processing visualisatie
- Bouw een Slimme Arduino-gestuurde Robotarm: Eenvoudige DIY Handleiding
- Slimme luchtzuiverer met Arduino Yun, Sharp Plasmacluster en AWS IoT
- Naadloze Smartphone-besturing van Huisverlichting met 1Sheeld
- Silicon Labs onthult geavanceerde Wireless Gecko‑oplossingen voor slimme huizen & gebouwautomatisering op Embedded World 2019
- Hoe slimme huistechnologie het alledaagse leven transformeert