Security System Project

So I am new here, so i dont know if the subject is in this right topics area.

I am having a bit of problem with my Arduino project. My Arduino project involves in a Security System.
The components and supplies that im currently using are:

-1 Buzzer
-1 PIR Sensor
-1 4X4 Keypad
-Arduino Uno

Considering that this is for a school project, I haven’t learned Arduino with someone that knows it or had a source that would help with the coding and the installion on the Arduino.

I currently having a lot of problems with Arduino. I have found some code that I thought it would be useful, but apparently it has broken 2 Arduino… I decided to make myself some new code, and it started working very well, everything worked but without the 4x4 Keypad. When adding the keypad, it stop working for some reason and the sensor went crazy, the LED’s were always blinking and the buzzer was fired, making constant noise. The connections are all okay and it just keeps going…

The objective of this project was to make a small house, in which had different divisions, but the time was running out and now its just to finish the project and at least have something.

*** Im sending a picture of the schematics that is not mine, but its for only help if needed***

Im sending my code in this post, so anyone can help me figure how to connect the keypad and make it all work…

I have little time, and i would like to ask for help as quick as possible… I can respond at anytime, and if anyone would be able to help me, I would gladly aprecciate it!!

Thank you :slight_smile:

SecuritySystemCode.ino (1.24 KB)

esquema arduino.PNG

Hi Faneca,

Could you send an actual picture or overview of the system you made? You say the picture is a schematic that isn't yours. As far as i can see the schematic in the picture is correct but you may have made a mistake somewhere.

I had a look at your code and I am not sure what you are doing here .

  if (state == LOW) {
     Serial.println("Movimento detetado!");
     state = HIGH;
  else {
     digitalWrite(redLed, LOW);

  if (state == HIGH) {
     Serial.println ("Sem qualquer movimento");
     state = LOW;

This seems to only set the redled to low? Try to explain in english what you want it to do (so for example if the sensor is HIGH redLed is HIGH if the sensor is LOW redled is LOW)

Did you measure the output of the sensor with a multimeter? Maybe it is triggering all the time. Also what type of PIR sensor are you using? If you remove the keypad does the system work again? Hope that helps