Project tutorial
Acendendo uma lâmpada com sensor de presença

Acendendo uma lâmpada com sensor de presença © Apache-2.0

Como acender uma lâmpada com um sensor de presença

  • 239 views
  • 0 comments
  • 0 respects

Components and supplies

Necessary tools and machines

Arduino
Fritzing

Apps and online services

About this project

  • sensor PIR
  • Ajustes de sensibilidade do sensor PIR

Code

Código do sensor PIRArduino
int pinorele = 2; //Pino ligado ao rele
int pinopir = 7; //Pino ligado ao sensor PIR
int acionamento; //Variavel para guardar valor do sensor
 
void setup()
{
pinMode(pinorele, OUTPUT); //Define pino rele como saida
pinMode(pinopir, INPUT); //Define pino sensor como entrada
Serial.begin(9600);
}
 
void loop()
{
acionamento = digitalRead(pinopir); //Le o valor do sensor PIR
 
if (acionamento == LOW) //Sem movimento, mantem rele desligado
{
digitalWrite(pinorele, LOW);
Serial.println("Parado");
}
else //Caso seja detectado um movimento, aciona o rele
{
digitalWrite(pinorele, HIGH);
Serial.println("Movimento !!!");
}
}

Schematics

Esquema de ligações
Sensor pir mnqsdmfxtb

Comments

Similar projects you might like

Temperature Sensor To control Servo Motor

by Jasleen

  • 7,815 views
  • 2 comments
  • 10 respects

Color Sensor Prototype: Detect Color Name from Objects

Project tutorial by moretticb

  • 3,027 views
  • 4 comments
  • 23 respects

Arduino Temperature - Humidity - Rain Sensor

Project showcase by Rick_Findus

  • 9,021 views
  • 6 comments
  • 17 respects

Portable Arduino Temp/Humidity Sensor with LCD

Project tutorial by ThothLoki

  • 153,410 views
  • 115 comments
  • 186 respects

DHT11 Temperature/Humidity Sensor

Project tutorial by Zachary Haslam

  • 13,137 views
  • 1 comment
  • 30 respects

Complete Digital Clock Including Alarm and Motion Sensor

Project tutorial by LAGSILVA

  • 12,677 views
  • 11 comments
  • 50 respects
Add projectSign up / Login