HC-SR505 Mini PIR Infrared Motion

HC-SR505 is an infrared module which detects the movement of a person or animal, at distances of up to 3m.

HC-SR505 Mini PIR Infrared Motion

HC-SR505 is an infrared module which detects the movement of a person or animal, at distances of up to 3m. When it detects movement the output pin will go high to 3V. If, after the detection the object is no longer there, it's output will go back low after about 8 to 10 seconds. It uses an infrared sensor to detect movement in front of the sensor with a beam width of about 100 degrees.


How the Sensor Works


The output pin is normally low and will go high when a person or an animal crosses the sensors beam. This beam is like a 100deg wide fan centered along the axis of the sensor looking out from the white dome.


Note: Once the sensor is triggered it will take about 8 to 10 seconds for it to reset once the beam is clear.



Sensor Pins


The pins of the sensor are shown below. Note this is the top view, you can check this by looking for the two yellow capacitors towards the bottom of this picture.




The best wire color is included so you get into the habit of using consistent wires for the ground and power supply as this will save you a lot of trouble in the future.


Connecting the Jumpers to the Sensor


First we will connect the jumpers to the sensor. Then we will connect it to the JackBord. The sensor needs 5V to work. It needs 3 female to female jumper wires to connect to the JackBord as shown in the picture below. The output of the sensor can be connected to any of the pins on ports A, B or C.



Parts Needed: You will need the following items:

  • The sensor

  • x3 female to female jumper wires, 10cm or more


Connection Steps:

Follow these steps to avoid damage to the JackBord or the sensor. The jumper wires are connected to the sensor as shown in the picture, note in our case we have used a red jumper for the 5V power, a purple one for the output and a green one for ground. Connect yours by following these steps:

  1. Turn off the JackBord.

  2. Connect a red female jumper to the rightmost pin of the sensor (note: this is with the sensor facing up as in the picture above).

  3. Connect a green or black jumper wire to the far left ground pin.

  4. Connect a jumper for the output to the center pin. In our case we used a purple jumper.

Check your sensor connections with the picture below. Here we have used a red wire for 5V, a purple one for the output and a green one for ground.



Connecting the Sensor to the JackBord


Now that we have the jumpers connected to the sensor we need to connect the other ends to the JackBord. These connections are listed in the table below.



Connection Steps:


We are going to connect the sensor to port Pin A1 on port A. We will also use port A's ground and 5V power line to keep things tidy. Follow these steps to connect the sensor to the JackBord:

  1. Turn off the JackBord

  2. Connect the green ground wire from the sensor to the ground pin on port A.

  3. Connect the red power wire from the sensor to the +5V pin on port A.

  4. Connect the purple output wire from the sensor to port pin A1 on the JackBord.

Once you have made the connections check them against the picture below and make sure they match.



Compare your connections with these pictures. Once you are sure they are ok carry on to the usage instructions below.



Using the Sensor with the JackBord


Turn on the JackBord and go to the dashboard. We can use the button press and release commands, with this sensor so we can get the JackBord to take certain actions in response to the state of the sensor. As stated above, when an object is detected the output will go high (3V) and once the object leaves the sensors view the output will go back to being low (0V).


Because this is the opposite of a buttons operation we need to use the button release command btr to deal with the detection event and the button press btp command to deal with the non detection event.


Example Commands:

The commands below setup the sensor on port A1 so that when an object is detected the USER LED on the front of the JackBord will be turned on, this is accomplished by the btr command. The USER LED will turn off once the object leaves the field and this is because of the btp command.

btr a1 l1 1 btp a1 l1 0