<?xml version="1.0" encoding="UTF-8"?>

<rss version="2.0"
 xmlns:blogChannel="http://backend.userland.com/blogChannelModule"
>

<channel>
<title><![CDATA[Dobrica Pavlinušić's random unstructured stuff: PIR]]></title>
<link>https://saturn.ffzg.hr/rot13/index.cgi?pir</link>
<description></description>
<pubDate>Sat, 16 Jan 2021 11:13:43 -0000</pubDate>
<webMaster>root@saturn.ffzg.hr</webMaster>
<generator>Socialtext Workspace v2.19.0.2</generator>

<item>
<title><![CDATA[PIR]]></title>
<link>https://saturn.ffzg.hr/rot13/index.cgi?pir</link>
<description><![CDATA[<div>Creator: Dobrica Pavlinušić</div><hr/><div>Tags: motion sensor</div><hr/><div class="wiki">
<span class="nlw_phrase"><img alt="pir-pinout.jpg" src="https://saturn.ffzg.hr/rot13/index.cgi/pir-pinout.jpg?action=attachments_download;page_name=pir;id=20150427101012-0-25685" /><!-- wiki: {image: pir-=pinout.jpg} --></span><br /><br /><h1 id="biss001_module">BISS001 module</h1>
<p>
BISS001 - Micro Power PIR Motion Detector IC</p>
<ul>
<li>Input voltage: 3-5 V</li>
<li>Hi: 0.7*Vdd = 0.7 * 5 V = 3.5 V</li>
<li>Lo: 0.3*Vdd = 0.3 * 5 V = 1.5 V</li>
</ul>
<h1 id="hc_sr501_module">HC-SR501 module</h1>
<p>
Technical data of the HC-SR501 Motion and Sensor Modules:</p>
<pre>
Input voltage: 4.5 V - 20 V
Digital output when motion is detected: 3.3 V (high)
Digital output with no movement on the HC-SR501: 0 V (low)
Working temperature in the environment: -15 � C to 70 � C
Delay Time 0.5 to 200 seconds
Angle of coverage: 100 �
Reach 5m - 7m
Size of the HC-SR501 motion:

Sensor Lens diameter: 23mm
Length: 24.03mm
Width: 32.34mm
Height (with lens): 24.66mm
Center screw hole spacing: 28 mm
Screw hole diameter: 2mm (M2)
</pre>
<br /><h1 id="collect_pir_data_using_linux_gpio_and_send_it_to_mqtt">Collect pir data using Linux gpio and send it to mqtt</h1>
<p>
both pots are all the way to the left (if jumper is on the left toword edge of board) to make minimal timeout</p>
<span class="nlw_phrase"><a href="https://saturn.ffzg.hr/rot13/index.cgi/pir.sh?action=attachments_download;page_name=pir;id=20210104132339-0-17608">pir.sh</a><!-- wiki: {file: pir.sh} --></span><br /><br /><h2 id="gpio_utils">gpio-utils</h2>
<p>
gpio-utils exists on Raspberry Pi</p>
<pre>
#!/bin/sh -e

led=/sys/devices/platform/rpi_control_board/leds/d1/brightness

# pir sensor connceted to 5V, GPIO12, GND
sudo stdbuf -oL -eL gpio-event-mon -n gpiochip0 -o 12 -r -f | while read gpio event time dir edge ; do
	case $dir in
		rising)
			echo -n &quot;^&quot;
			echo 1 &gt; $led
			;;
		falling)
			echo -n &quot;_&quot;
			echo 0 &gt; $led
			;;
		*)
			echo -n &quot;?&quot;
			;;
	esac
done
</pre>
<br /><h2 id="gpiod">gpiod</h2>
<p>
alternative version using gpiod package available on sunxi</p>
<pre>
#!/bin/sh -e

led=/sys/class/leds/orangepi:red:status/brightness

# pir sensor connceted to 5V, PA6, GND
sudo stdbuf -oL -eL gpiomon 0 6 | while read event dir edge time ; do
	echo &quot;# $dir&quot;
	case $dir in
		RISING)
			echo -n &quot;^&quot;
			echo 1 &gt; $led
			;;
		FALLING)
			echo -n &quot;_&quot;
			echo 0 &gt; $led
			;;
		*)
			echo -n &quot;?&quot;
			;;
	esac
done
</pre>
</div>
<hr/><div>Attachments: pir-pinout.jpg, pir.sh</div>]]></description>
<author>Dobrica Pavlinu&#x161;i&#x107;</author>
<category>motion sensor</category>
<guid isPermaLink="true">https://saturn.ffzg.hr/rot13/index.cgi?pir</guid>
<pubDate>Sat, 16 Jan 2021 11:13:43 -0000</pubDate>
</item>
</channel>
</rss>