<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>timer-sense-light &#8211; 编码无悔 /  Intent &amp; Focused</title>
	<atom:link href="https://www.codelast.com/tag/timer-sense-light/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.codelast.com</link>
	<description>最优化之路</description>
	<lastBuildDate>Mon, 27 Apr 2020 18:01:38 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>[原创] 树莓派项目实践——可用 web 控制的人体感应小夜灯</title>
		<link>https://www.codelast.com/%e5%8e%9f%e5%88%9b-%e6%a0%91%e8%8e%93%e6%b4%be%e9%a1%b9%e7%9b%ae%e5%ae%9e%e8%b7%b5-%e5%8f%af%e7%94%a8-web-%e6%8e%a7%e5%88%b6%e7%9a%84%e4%ba%ba%e4%bd%93%e6%84%9f%e5%ba%94%e5%b0%8f/</link>
					<comments>https://www.codelast.com/%e5%8e%9f%e5%88%9b-%e6%a0%91%e8%8e%93%e6%b4%be%e9%a1%b9%e7%9b%ae%e5%ae%9e%e8%b7%b5-%e5%8f%af%e7%94%a8-web-%e6%8e%a7%e5%88%b6%e7%9a%84%e4%ba%ba%e4%bd%93%e6%84%9f%e5%ba%94%e5%b0%8f/#comments</comments>
		
		<dc:creator><![CDATA[learnhard]]></dc:creator>
		<pubDate>Tue, 14 Jun 2016 06:55:44 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Raspberry Pi/树莓派]]></category>
		<category><![CDATA[原创]]></category>
		<category><![CDATA[Raspberry Pi]]></category>
		<category><![CDATA[timer-sense-light]]></category>
		<category><![CDATA[web控制]]></category>
		<category><![CDATA[人体感应]]></category>
		<category><![CDATA[小夜灯]]></category>
		<category><![CDATA[树莓派]]></category>
		<guid isPermaLink="false">http://www.codelast.com/?p=8853</guid>

					<description><![CDATA[<p></p>
<div>
	A time-controllable human sense light based on Raspberry Pi, which has a web UI to control it.</div>
<div>
	一个基于树莓派的、(开关)时间可控的人体感应灯，可以通过一个web UI界面开灯、关灯，以及设置成自动模式（在感应到人接近的时候自动点亮灯），并且可以设置自动模式的工作时间段。<br />
	这个设备已经放在我家里稳定地运行了很久了，很实用。<br />
	&#160;</div>
<p>源代码在<a href="https://github.com/codelast/raspberry-pi/tree/master/gpio/timer-sense-light" target="_blank" rel="noopener noreferrer"><span style="background-color:#ffa07a;">Github上</span></a>，极客学院上有我录制的<a href="http://www.jikexueyuan.com/course/2791.html" target="_blank" rel="noopener noreferrer"><span style="background-color:#ffa07a;">教程</span></a>。<br />
<span id="more-8853"></span><br />
<img decoding="async" alt="" src="https://raw.githubusercontent.com/codelast/raspberry-pi/master/gpio/timer-sense-light/demo/finished_product_1.jpg" /></p>
<p><img decoding="async" alt="" src="https://raw.githubusercontent.com/codelast/raspberry-pi/master/gpio/timer-sense-light/demo/finished_product_2.jpg" style="width: 600px; height: 457px;" /></p>
<p><img decoding="async" alt="" src="https://raw.githubusercontent.com/codelast/raspberry-pi/master/gpio/timer-sense-light/demo/semi_finished_product.jpg" /><br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="http://www.codelast.com/" target="_blank" rel="noopener noreferrer"><span style="color: rgb(255, 255, 255);">http://www.codelast.com/</span></a><br />
The Web UI(control panel of the system):<br />
<img decoding="async" alt="" src="https://raw.githubusercontent.com/codelast/raspberry-pi/master/gpio/timer-sense-light/demo/web_ui_1.png" style="width: 680px; height: 290px;" /></p>
<p>I only tested this system on Raspberry Pi Model B+(Revision 1.2) &#38; Model B(Revision 2), but it should work on other models of RPi too, except that the hardware wiring should be some difference, and the code should need no modification.&#8230; <a href="https://www.codelast.com/%e5%8e%9f%e5%88%9b-%e6%a0%91%e8%8e%93%e6%b4%be%e9%a1%b9%e7%9b%ae%e5%ae%9e%e8%b7%b5-%e5%8f%af%e7%94%a8-web-%e6%8e%a7%e5%88%b6%e7%9a%84%e4%ba%ba%e4%bd%93%e6%84%9f%e5%ba%94%e5%b0%8f/" class="read-more">Read More </a></p>]]></description>
										<content:encoded><![CDATA[<p></p>
<div>
	A time-controllable human sense light based on Raspberry Pi, which has a web UI to control it.</div>
<div>
	一个基于树莓派的、(开关)时间可控的人体感应灯，可以通过一个web UI界面开灯、关灯，以及设置成自动模式（在感应到人接近的时候自动点亮灯），并且可以设置自动模式的工作时间段。<br />
	这个设备已经放在我家里稳定地运行了很久了，很实用。<br />
	&nbsp;</div>
<p>源代码在<a href="https://github.com/codelast/raspberry-pi/tree/master/gpio/timer-sense-light" target="_blank" rel="noopener noreferrer"><span style="background-color:#ffa07a;">Github上</span></a>，极客学院上有我录制的<a href="http://www.jikexueyuan.com/course/2791.html" target="_blank" rel="noopener noreferrer"><span style="background-color:#ffa07a;">教程</span></a>。<br />
<span id="more-8853"></span><br />
<img decoding="async" alt="" src="https://raw.githubusercontent.com/codelast/raspberry-pi/master/gpio/timer-sense-light/demo/finished_product_1.jpg" /></p>
<p><img decoding="async" alt="" src="https://raw.githubusercontent.com/codelast/raspberry-pi/master/gpio/timer-sense-light/demo/finished_product_2.jpg" style="width: 600px; height: 457px;" /></p>
<p><img decoding="async" alt="" src="https://raw.githubusercontent.com/codelast/raspberry-pi/master/gpio/timer-sense-light/demo/semi_finished_product.jpg" /><br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="http://www.codelast.com/" target="_blank" rel="noopener noreferrer"><span style="color: rgb(255, 255, 255);">http://www.codelast.com/</span></a><br />
The Web UI(control panel of the system):<br />
<img decoding="async" alt="" src="https://raw.githubusercontent.com/codelast/raspberry-pi/master/gpio/timer-sense-light/demo/web_ui_1.png" style="width: 680px; height: 290px;" /></p>
<p>I only tested this system on Raspberry Pi Model B+(Revision 1.2) &amp; Model B(Revision 2), but it should work on other models of RPi too, except that the hardware wiring should be some difference, and the code should need no modification.<br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="http://www.codelast.com/" target="_blank" rel="noopener noreferrer"><span style="color: rgb(255, 255, 255);">http://www.codelast.com/</span></a></p>
<h3>
	Environment:</h3>
<blockquote>
<div>
		Raspberry Pi model: B+/B</div>
<div>
		OS: Arch Linux ARM</div>
</blockquote>
<div>
	You can use this project to build a human sense light, in short, when a person gets close to the light, the pyroelectric module connected to Raspberry Pi will detect the human movement &amp; ouput a high level to one of the GPIO port on RPi, then the program runs on RPi will light up some LEDs connected to it. Also, you can set the time range of day, only in those time range the LEDs can be lighten up, and in other time range the LEDs will be turned off.</p>
<h3>
		Usage instruction</h3>
<h4>
		Dependencies installation</h4>
<p>	Before compiling this project, you should have some software packages installed on your Arch Linux ARM(besides the basic development tools such as gcc, etc.):</p>
<ul>
<li>
			WiringPi(a GPIO access library for Raspberry Pi)</li>
</ul>
<div>
		git clone git://git.drogon.net/wiringPi &amp;&amp; cd wiringPi &amp;&amp; ./build<br />
		&nbsp;</div>
<ul>
<li>
			glog(Google logging module)</li>
</ul>
<div>
		pacman -S google-glog</div>
<div>
		&nbsp;</div>
<ul>
<li>
			libconfig(C/C++ Configuration File Library)</li>
</ul>
<div>
		pacman -S libconfig</div>
<div>
		&nbsp;</div>
<ul>
<li>
			gtest(Google&#39;s C++ test framework) - to run the unit tests in this project</li>
</ul>
<div>
		pacman -S gtest</div>
<p>	<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="http://www.codelast.com/" target="_blank" rel="noopener noreferrer"><span style="color: rgb(255, 255, 255);">http://www.codelast.com/</span></a></p>
<h4>
		build the hardware system</h4>
<div>
		Buy essencial electronic components and build the hardware system according to the circuit diagrams.</div>
<div>
		&nbsp;</div>
<h4>
		build the binary program</h4>
<blockquote>
<div>
			make &amp;&amp; make install</div>
</blockquote>
<h4>
		modify the configuraion files according to your needs</h4>
<blockquote>
<div>
			vim deploy/conf/main.conf</div>
<div>
			vim deploy/conf/time-range.txt</div>
</blockquote>
<h4>
		start the backend program</h4>
<blockquote>
<div>
			cd deploy/bin</div>
<div>
			./run-timer-sense-light.sh</div>
</blockquote>
<div>
		use any web browser to visit the web UI to set parameters(assume that your RPi&#39;s IP address is 192.168.16.108)</div>
<blockquote>
<div>
			http://192.168.16.108</div>
</blockquote>
<div>
		<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="http://www.codelast.com/" target="_blank" rel="noopener noreferrer"><span style="color: rgb(255, 255, 255);">http://www.codelast.com/</span></a></div>
<h3>
		Hardware model</h3>
<div>
		You should prepare some specific hardware components for this project, including:</div>
<div>
		A pyroelectric module(HC-SR501):</div>
<p>	<img decoding="async" alt="" src="https://raw.githubusercontent.com/codelast/raspberry-pi/master/gpio/timer-sense-light/demo/pyroelectric_module_2.png" /><br />
	Some LEDs:<br />
	<img decoding="async" alt="" src="https://raw.githubusercontent.com/codelast/raspberry-pi/master/gpio/timer-sense-light/demo/led.jpg" /><br />
	<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="http://www.codelast.com/" target="_blank" rel="noopener noreferrer"><span style="color: rgb(255, 255, 255);">http://www.codelast.com/</span></a></p>
<h4>
		How to know your Raspberry Pi revision</h4>
<div>
		&nbsp;</div>
<div>
		Install WiringPi, then execute command &quot;gpio -v&quot; to get RPi&#39;s revision, the output info looks like:</div>
<blockquote>
<div>
			gpio version: 2.25</div>
<div>
			Copyright (c) 2012-2015 Gordon Henderson</div>
<div>
			This is free software with ABSOLUTELY NO WARRANTY.</div>
<div>
			For details type: gpio -warranty</div>
<div>
			&nbsp;</div>
<div>
			Raspberry Pi Details:</div>
<div>
			&nbsp; Type: Model B+, Revision: 1.2, Memory: 512MB, Maker: Sony</div>
</blockquote>
<div>
		<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="http://www.codelast.com/" target="_blank" rel="noopener noreferrer"><span style="color: rgb(255, 255, 255);">http://www.codelast.com/</span></a></div>
<h4>
		Future work</h4>
<div>
		Add machine-learning ability to the system, to let it auto-adjust the time range according to history human movement data.</p>
<p>		<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
		<span style="color: rgb(255, 0, 0);">➤➤</span>&nbsp;版权声明&nbsp;<span style="color: rgb(255, 0, 0);">➤➤</span>&nbsp;<br />
		转载需注明出处：<u><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><em><span style="color: rgb(0, 0, 255);"><strong style="font-size: 16px;"><span style="font-family: arial, helvetica, sans-serif;">codelast.com</span></strong></span></em></a></u>&nbsp;<br />
		感谢关注我的微信公众号（微信扫一扫）：</p>
<p style="border: 0px; font-size: 13px; margin: 0px 0px 9px; outline: 0px; padding: 0px; color: rgb(77, 77, 77);">
			<img decoding="async" alt="wechat qrcode of codelast" src="https://www.codelast.com/codelast_wechat_qr_code.jpg" style="width: 200px; height: 200px;" /></p>
</p></div>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.codelast.com/%e5%8e%9f%e5%88%9b-%e6%a0%91%e8%8e%93%e6%b4%be%e9%a1%b9%e7%9b%ae%e5%ae%9e%e8%b7%b5-%e5%8f%af%e7%94%a8-web-%e6%8e%a7%e5%88%b6%e7%9a%84%e4%ba%ba%e4%bd%93%e6%84%9f%e5%ba%94%e5%b0%8f/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
	</channel>
</rss>
