Smart Proximity Alert System for Museum Artifacts

by 777764 in Circuits > Arduino

46 Views, 0 Favorites, 0 Comments

Smart Proximity Alert System for Museum Artifacts

IMG_6545.jpg


Follow along to create this innovative alert system to prevent individuals from getting too close to priceless museum artifacts!


This system utilizes sensors to monitor movement and measure proximity. When motion is detected, the product responds by illuminating LEDs, however when you get too close (less than 10 inches away), a countdown from 9 seconds would be activated, along with flashing LEDs, and an alarm sounded at the end that will stay on forever unless it is manually deactivated with the set up remote.

This easy-to-manage alert system will ensure that museum artifacts remain safe through the many visitors who wish to come. Although, this can be used for various other situations, whether you may be guarding your piggy bank, electronics, or anything else that would be of value for you!

This system originated from my constant experience of my brothers snooping around my room. Due to this, I thought I would create something that scared them off before they got any further, thus the idea was born. Of course, after brainstorming, I believed a better function would be a museum alarm, bringing it to where it is now. The code and wiring I learned from my class projects definitely helped in allowing this system to come alive.

Now, without further ado, have fun and happy circuiting!

**as a side note, if you would like to reference the basic model from a Tinkercad, please visit this link.**

Supplies

IMG_6196 (1).jpg
Your paragraph text.png
  1. Arduino IDE with USB Cable (1)
  2. 9V Battery (1)
  3. Battery Connector with Barrel Plug (1)
  4. Breadboard (1)
  5. Male/Female wires (7)
  6. Necessary wires
  7. Red LEDs (4)
  8. Resistors
  9. 100 ohm resistor (1)
  10. 220 ohm resistor (4)
  11. 330 ohm resistor (2)
  12. PIR sensor (1)
  13. Ultrasonic distance sensor (1)
  14. 7 segment display (1)
  15. IR receiver (1)
  16. Active buzzer (1)

**Visit the links to purchase the components if you don't already have them (some come in packs).**

Wiring the LEDs

Capture.jpg
IMG_6199.jpg

To commence this project, we will start with the hardware.

  1. We will first turn the breadboard horizontally and add 4 black wires going to the ground rail, each with a gap of 3 rows, as shown in the photo above to the left.
  2. Then, we will connect the cathode of each LED to the same row as the ground wire. The LEDs should have a gap of 2 rows between each other.
  3. Once this is done, we will take the 220 ohm resistors and connect one end to the same row as the anodes of each LED and the other end in the row with nothing else connected.


Tips and things to remember:

  1. Ensure the wires are cut neatly so there is no looping or exposed metal.
  2. Make sure the correct side of the LED is attached to the ground wire. To check if it is the cathode, hold the LED up to a light and look inside. The larger metal portion belongs to the cathode wire. Another way to check is to look for the flat spot around the rim. This is also the side where the cathode is found.
  3. The rows on the breadboard are those labeled by numbers, and the columns are those labeled by letters.
  4. Remember, anything in the same row from columns F through J or A through E, is connected to each other.

Wiring the Buzzer

IMG_6200.jpg
IMG_6201.jpg
  1. Place the buzzer in the top half of the breadboard as shown in the above image.
  2. After this, connect a black wire from the negative end of the buzzer (should be in the same row) to the top ground rail and a 100 ohm resistor from the positive end of the buzzer (also should be in the same row) to another row.


Tips and things to remember:

  1. Make sure the buzzer is placed low enough so there is enough space to connect the resistor and wire.
  2. Remember, anything in the same row from columns F through J or A through E, is connected to each other.
  3. Double check if the buzzer is an active buzzer, as if it is passive the code will not work. To check, look underneath the buzzer, if it has a black resin backing, it is active, whereas if it has a drive board, it is passive.

Wiring the Seven Segment Display

IMG_6203 (1).jpg
IMG_6204.jpg
  1. Place the seven segment display 5 rows away from the rightmost LED, as shown in the above image. It's bottom pins should be in the bottom half of the breadboard, and the top pins should evidently be in the top.
  2. Connect a 330 ohm resistor from the third pin (which is a common anode) on both the top and bottom of the seven segment display (should be in the same row). The other end of both resistors should connect to the top and bottom positive rails.


Tips and things to remember:

  1. Remember, anything in the same row from columns F through J or A through E, is connected to each other.

Wiring the Seven Segment Display With the Arduino

IMG_6206.jpg
IMG_6207.jpg

This is where the wires can start to get a bit messy, due to the sheer amount of them.

  1. To start, we can first connect the top half of the seven segment display with the Arduino.
  2. With neat yellow wires connect:
  3. The first pin of the seven segment display to the 13th pin of the Arduino.
  4. The second pin of the seven segment display to the 12th pin of the Arduino.
  5. The fourth pin of the seven segment display to the 10th pin of the Arduino.
  6. The fifth pin of the seven segment display to the 9th pin of the Arduino.
  7. Next, we can connect the bottom half of the seven segment display with the Arduino.
  8. With neat yellow wires connect:
  9. The first pin of the seven segment display to the A0 pin of the Arduino.
  10. The second pin of the seven segment display to the A1 pin of the Arduino.
  11. The fourth pin of the seven segment display to the A2 pin of the Arduino.


Tips and things to remember:

  1. It is crucial that all wires are not cut too long as with so many connections, the breadboard will start looking very messy.
  2. Ensure there is minimal exposed wire.
  3. Double check that all wires are going to the correct pins on the Arduino.
  4. If you would like a clearer visual representation of the wiring, visit my Tinkercad linked in the introduction.
  5. Remember, anything in the same row from columns F through J or A through E, is connected to each other.

Wiring the IR Receiver

IMG_6209.jpg
IMG_6210.jpg
  1. Place the IR receiver three rows away from the seven segment display as shown in the image above.
  2. Connect the middle pin of the IR receiver to the top ground rail with a black wire and the rightmost pin of the receiver to the top power rail with a red wire.


Tips and things to remember:

  1. Make sure the red and black wires from the IR receiver to the power/ ground rails are underneath all the yellow wires.
  2. When I was wiring this, I didn't realize that I should have done this step before the previous step. However, I made it work by threading the wire underneath the yellow ones.
  3. If this is too difficult, you can also switch step 5 to be before step 4.
  4. Remember, anything in the same row from columns F through J or A through E, is connected to each other.

Wiring the LEDs With the Arduino

IMG_6212 (1).jpg
IMG_6214.jpg
  1. In this step, we will start by giving power and ground to the rails by connecting the 5V pin to the top power rail, and the ground pin to the top ground rail, as shown in the image above to the left.
  2. Now, we will connect the LEDs to the Arduino. This is where the wires can may become even messier, as there are now more connections to the Arduino.
  3. Each end of the 220 ohm resistors we left unconnected in step 1 will now be connected to the Arduino.
  4. With neat yellow wires connect:
  5. The first resistor to the 5th pin of the Arduino.
  6. The second resistor to the 6th pin of the Arduino.
  7. The fourth resistor to the 7th pin of the Arduino.
  8. The fifth resistor to the 8th pin of the Arduino.


Tips and things to remember:

  1. It is crucial that all wires are not cut too long as with so many connections, the breadboard will start looking very messy.
  2. Ensure there is minimal exposed wire.
  3. Double check that all wires are going to the correct pins on the Arduino.
  4. If you would like a clearer visual representation of the wiring, visit my Tinkercad linked in the introduction.
  5. Remember, anything in the same row from columns F through J or A through E, is connected to each other.


Wiring the Buzzer With the Arduino

IMG_6216 (1).jpg
  1. Now, we will connect the Buzzer to the Arduino. This is where the wires can may become even messier, as there are now more connections to the Arduino.
  2. The end of the 100 ohm resistor we left unconnected in step 2 will now be connected to the Arduino.
  3. With a neat yellow wire connect the resistor to the 11th pin of the Arduino.


Tips and things to remember:

  1. It is crucial that all wires are not cut too long as with so many connections, the breadboard will start looking very messy.
  2. Ensure there is minimal exposed wire.
  3. Double check that all wires are going to the correct pins on the Arduino.
  4. If you would like a clearer visual representation of the wiring, visit my Tinkercad linked in the introduction.
  5. Remember, anything in the same row from columns F through J or A through E, is connected to each other.

Wiring the Distance Sensor and PIR Sensor

IMG_6218.jpg
IMG_6545.jpg
Capture (1).jpg

Now, we will connect the Distance and PIR Sensor to the Arduino.

Wiring the distance sensor:

  1. Connect 4 male/female wires to the distance sensor pins. If you look carefully, you will see that each pin is labelled. Make sure you use a red wire for the VCC pin, and a black wire for the ground pin, to ensure neatness.
  2. The black wire (ground) should be connected to the top ground rail of the breadboard, whereas the red wire (power) should be connected to the top power rail of the breadboard.
  3. The wires connected to the two other pins (trig and echo) should be connected to the Arduino directly. The trig wire should be connected to the 3rd pin, and the echo wire should be connected to the 4th pin.

Wiring the PIR sensor:

  1. Connect 3 male/female wires to the PIR sensor pins. Unfortunately, the pins on this sensor are not labeled, but turn the sensor the other way around, you will see the PIR chip (black rectangular chip with small metal legs). The pin to the left of the chip is the ground pin, beside that is the output pin, and the one on the leftmost side is power.
  2. Make sure you use a red wire for the power pin, and a black wire for the ground pin, to ensure neatness.
  3. The black wire (ground) should be connected to the top ground rail of the breadboard, whereas the red wire (power) should be connected to the top power rail of the breadboard.
  4. The output wire should be connected to the Arduino directly to the 2nd pin.

***In this step we also need to add a black ground wire from the top ground rail from the breadboard to the bottom, as shown in the image with both sensors attached. Doing this ensures there is a ground charge in both ground rails.***

Tips and things to remember:

  1. Double check that all wires are going to the correct pins on the Arduino.
  2. If you would like a clearer visual representation of the wiring, visit my Tinkercad linked in the introduction.
  3. Ensure that the male/female connections are properly connected to either the sensor pins or the Arduino.

Reviewing How the Hardware Works

Capture.PNG

As mentioned above, this project uses two sensors to determine distance and movement, triggering the other components to start up as coded.

Overview of the hardware connections:

  1. The schematic above clearly shows all connections from the hardware, but to explain, power and ground is brought to the power rails, which means anything else in those rails will be connected to ground and 5V of power.
  2. The PIR sensor, distance sensor, seven segment displays, and the IR receiver are all connected to power and ground.
  3. The LEDs and the buzzer are connected to ground.
  4. There is also a connection from the top ground rail to the bottom one as this way both are receiving a ground current, which allows for the components attached to the bottom ground rail to also receive a ground current.
  5. The Arduino pins are connected to the LEDs and the buzzer through resistors to ensure the voltage does not burn out the components, limiting the current that is passed through. Although, in certain scenarios, if the voltage source is equal to the voltage drop of the component, a resistor is not required.
  6. Each component is connected to the Arduino in some way, as that pin is now assigned to that specific component. This permits the utilization of these pins in the code, declaring them as inputs, outputs, and using them to perform functions.

Creating the Code

Initial Steps:

  1. Make sure you have the Arduino IDE software downloaded on your computer. Visit this link to do so.
  2. After this, download the Arduino-IRremote-master.zip file.
  3. Copy the entire extracted folder into your Arduino--> Libraries folder.
  4. Download the irReceiverDemo.ino file and place it inside your Arduino folder.
  5. Visit the attached file below to view the code. Copy this code into a new sketch in your Arduino IDE software, and once it is ready, attach the USB cable from the Arduino to your device and select that port on the software.
  6. You can now upload this code onto the Arduino!


Tips and things to remember:

  1. Make sure to check if everything is written correctly.
  2. If something is not working, always check if the component works by itself by isolating and testing it.
  3. For instance, if a sensor is not working, we can serial print the values of the sensor to see if it truly works. Visit this site to learn more about serial print.
  4. If you look through my code, you can see I have commented that for the hexadecimal code for the remote, you will need to test what hexadecimal code is acquainted with the button you want to use to 'reset' the project. This can be done through checking the serial monitor for hexadecimal codes. You would then change out my hex code for yours in the "if" statement for the IR receiver (located at the bottom of the loop function).

Downloads

Reviewing How the Code Works

I know this tutorial is getting slightly lengthy, so reading this portion is completely optional is it is only for those who would like to understand the code for this project better. If so, please read through this description of the key parts in the code, but if not, please skip ahead to the next step!

  1. The code for this system starts with variables that are allocated to various pins. Doing this allows for you to refer to that variable in the code instead of the pin number, making it clearer to understand. For instance, the variable “buzzer” is allocated to pin number 11, because in the physical wiring, that is the pin it is connected to.
  2. Following this, in void setup (the initial setup of the code), we declare each variable (component) as an input or an output, as well as initialize certain components as on or off.
  3. We then create nine functions for the countdown, each for one of the nine numbers found in the countdown. Each function declares a certain light on the seven segment display as on or off, creating numbers 9 through 0.
  4. The next function is a blinking LED function, which first sets all LEDs on (HIGH), and then turns them off (LOW) after a 500 millisecond delay.
  5. Then in the countdown, we call on each block of code we created for each countdown number, as explained above. This countdown also calls upon the blinking LEDs in between each number, causing them to blink every time the number switches.
  6. After this, we have a function that checks the distance with the distance sensor. The code for this works with the Trig pin sending the signal, and the Echo pin listening for the returning signal, which gives us the distance from an object to the sensor (in inches, for our code).
  7. The following block of code called, “showDistance,” calls upon the countdown if the object is less than 10 inches away from the sensor. Once the countdown is done, it is coded to start the buzzer at a frequency of 1KHz.
  8. The next function is to check motion through the motion sensor, which is not related to the distance. This is coded to read the PIR sensor, and if it is detected as high (motion detected), all LEDs will be turned on, else they will be off.
  9. The final function is the loop, in which we call upon three main blocks of code to repeat, the checkMotion, checkDistance, and showDistance. This permits the system to constantly be checking motion or distance with the sensors, and acting accordingly based on the result.
  10. At last, an IR receiver detects infrared signals from a remote and uses this signal to then decode the data.
  11. In terms of the code, we use the hexadecimal value of the buttons from the remote to attribute them to certain actions, which in my case are turning the system off.

Putting It Into a Prop

Untitled.jpg
IMG_6565.jpg

Above to the left is an example of a possible application I created of this system in the real world. To explain, it would serve as a label beside artworks to prevent people from getting to close, and to detect when there is motion by the artwork.

If you wish to put this system into a prop similar to the one shown above (but not identical), follow the below steps:

  1. Get a plastic box that is around the size of your circuit.
  2. Before putting the circuit inside, you can decorate this box if you wish.
  3. Based on where your components are, simply make cutouts on the top so that the two sensors are exposed, as shown in the image above to the right.
  4. Attach a barrel plug battery connector attached to a 9V battery to the Arduino and secure it within the box.
  5. I chose to make this within a clear plastic box, so it resembles an open concept alarm system.
  6. Once this is done, you are ready to use this detecting system wherever you wish!

----------------------------------------------------------------------------------------------------------------------------------

If you made it to the end of this Instructable, thank you for reading and listening to what I have to say! If you plan on making this project, I hope you have as much fun building and tinkering with it as I had designing and coding it.

Thank you!

-Agumjot Bedi