<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Door Opener]]></title><description><![CDATA[<p dir="auto">This is a simple-one-afternoot project that I made to be able to open the office door.</p>
<p dir="auto">Our office door is locked by a presence control (with fingerprint reader, keypad and NFC cards) which is connected to a cloud server and API service. So, to open the door I need two curl calls to that server (one for login and another for opening the door).</p>
<p dir="auto"><img src="/assets/uploads/files/1514989577788-boton1-resized.jpg" alt="0_1514989447520_Boton1.JPG" class="img-responsive img-markdown" /></p>
<p dir="auto">I love using Omega2 over other projects because has 3 mainly things: has easy built-in wifi, is linux and is cheaper than other things like arduino. Also it's footprint is quite small.</p>
<p dir="auto"><img src="/assets/uploads/files/1514989979543-6668df6d-df7a-4acf-8f65-b14f67c8cfe2-image.png" alt="0_1514989849280_6668df6d-df7a-4acf-8f65-b14f67c8cfe2-image.png" class="img-responsive img-markdown" /></p>
<p dir="auto">For the button, I searched over some sites looking for a big button with small footprint but was a futile search. I ended for a chinese repurposed button. This one had a speaker and said 'Yes' when pushed'.</p>
<p dir="auto"><img src="/assets/uploads/files/1514989688812-boton2-resized.jpg" alt="0_1514989558431_Boton2.JPG" class="img-responsive img-markdown" /></p>
<p dir="auto">I tore it down to fit inside the Omega2 main board, a small DC-DC step down 5v to 3.3v and a micro-usb connector for power. Also I put a small red led to show opening status. I reused the momentary switch soldering a pull-down resistors. Switch is on GPIO 17 and LED on GPIO 11.</p>
<p dir="auto">Once everything is fit together comes time for a small code. I have 2 scripts. This one is a loop to read the gpio button:</p>
<pre><code>#!/bin/sh

# Boton (Input)
fast-gpio set-input 17 &gt; /dev/null 2&gt;&amp;1

# LED (Output)
fast-gpio set-output 11 &gt; /dev/null 2&gt;&amp;1
fast-gpio set 11 0 &gt; /dev/null 2&gt;&amp;1

# Bogus GPIO?
gpioctl dirout-low 16 &gt; /dev/null 2&gt;&amp;1

while [ 1 ]; do

        # Get button status
        STATUS=`fast-gpio read 17|awk '{print $4}'`

        if [ $STATUS -eq 1 ]; then
                fast-gpio set 11 1  &gt; /dev/null 2&gt;&amp;1 
                # LED is light meanwhile the script 'open.sh' is being executed
                /root/open.sh
                fast-gpio set 11 0 &gt; /dev/null 2&gt;&amp;1
        fi

        # Some sleep
        sleep 0.05
done
</code></pre>
<p dir="auto">The other one has the 2 curl sentences:</p>
<pre><code>#!/bin/sh
# Do login and save the cookie
curl -i -c cookie_door \
-H "Accept: application/json" \
-H "Content-Type:application/json" \
-X POST --data '{"name": "someUser","password": "somePassword","user_id": "700"}' "https://api.biostar2.com/v1/login" &gt; /dev/null 2&gt;&amp;1

# Use the cookie to open the door (index 1)
curl -i -b cookie_door \
-H "Accept: application/json" \
-H "Content-Type:application/json" \
-X POST --data '{"door_id": "1"}' "https://api.biostar2.com/v1/doors/1/open" &gt; /dev/null 2&gt;&amp;1
</code></pre>
<p dir="auto">As a side comment about the 'bogus GPIO', I don't get quite how works the GPIO in Omega2. Seems that GPIO 17 and 16 are somehow linked? I had to put 16 on dirout-low so 17 could work great.</p>
<p dir="auto">Also I had to install GNU/sleep that accepts times &lt;1s. This way doesn't use too much CPU without having to sleep 1s that could cause missing push to the push button.</p>
<p dir="auto">In the end the project is highly usable for almost everything as is a simple network enabled IoT button. Changing the '<a href="http://open.sh" rel="nofollow">open.sh</a>' script can make this project to use in a infinity uses.</p>
]]></description><link>http://community.onion.io/topic/2613/door-opener</link><generator>RSS for Node</generator><lastBuildDate>Wed, 13 May 2026 07:50:59 GMT</lastBuildDate><atom:link href="http://community.onion.io/topic/2613.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 03 Jan 2018 14:46:53 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Door Opener on Wed, 03 Jan 2018 14:46:53 GMT]]></title><description><![CDATA[<p dir="auto">This is a simple-one-afternoot project that I made to be able to open the office door.</p>
<p dir="auto">Our office door is locked by a presence control (with fingerprint reader, keypad and NFC cards) which is connected to a cloud server and API service. So, to open the door I need two curl calls to that server (one for login and another for opening the door).</p>
<p dir="auto"><img src="/assets/uploads/files/1514989577788-boton1-resized.jpg" alt="0_1514989447520_Boton1.JPG" class="img-responsive img-markdown" /></p>
<p dir="auto">I love using Omega2 over other projects because has 3 mainly things: has easy built-in wifi, is linux and is cheaper than other things like arduino. Also it's footprint is quite small.</p>
<p dir="auto"><img src="/assets/uploads/files/1514989979543-6668df6d-df7a-4acf-8f65-b14f67c8cfe2-image.png" alt="0_1514989849280_6668df6d-df7a-4acf-8f65-b14f67c8cfe2-image.png" class="img-responsive img-markdown" /></p>
<p dir="auto">For the button, I searched over some sites looking for a big button with small footprint but was a futile search. I ended for a chinese repurposed button. This one had a speaker and said 'Yes' when pushed'.</p>
<p dir="auto"><img src="/assets/uploads/files/1514989688812-boton2-resized.jpg" alt="0_1514989558431_Boton2.JPG" class="img-responsive img-markdown" /></p>
<p dir="auto">I tore it down to fit inside the Omega2 main board, a small DC-DC step down 5v to 3.3v and a micro-usb connector for power. Also I put a small red led to show opening status. I reused the momentary switch soldering a pull-down resistors. Switch is on GPIO 17 and LED on GPIO 11.</p>
<p dir="auto">Once everything is fit together comes time for a small code. I have 2 scripts. This one is a loop to read the gpio button:</p>
<pre><code>#!/bin/sh

# Boton (Input)
fast-gpio set-input 17 &gt; /dev/null 2&gt;&amp;1

# LED (Output)
fast-gpio set-output 11 &gt; /dev/null 2&gt;&amp;1
fast-gpio set 11 0 &gt; /dev/null 2&gt;&amp;1

# Bogus GPIO?
gpioctl dirout-low 16 &gt; /dev/null 2&gt;&amp;1

while [ 1 ]; do

        # Get button status
        STATUS=`fast-gpio read 17|awk '{print $4}'`

        if [ $STATUS -eq 1 ]; then
                fast-gpio set 11 1  &gt; /dev/null 2&gt;&amp;1 
                # LED is light meanwhile the script 'open.sh' is being executed
                /root/open.sh
                fast-gpio set 11 0 &gt; /dev/null 2&gt;&amp;1
        fi

        # Some sleep
        sleep 0.05
done
</code></pre>
<p dir="auto">The other one has the 2 curl sentences:</p>
<pre><code>#!/bin/sh
# Do login and save the cookie
curl -i -c cookie_door \
-H "Accept: application/json" \
-H "Content-Type:application/json" \
-X POST --data '{"name": "someUser","password": "somePassword","user_id": "700"}' "https://api.biostar2.com/v1/login" &gt; /dev/null 2&gt;&amp;1

# Use the cookie to open the door (index 1)
curl -i -b cookie_door \
-H "Accept: application/json" \
-H "Content-Type:application/json" \
-X POST --data '{"door_id": "1"}' "https://api.biostar2.com/v1/doors/1/open" &gt; /dev/null 2&gt;&amp;1
</code></pre>
<p dir="auto">As a side comment about the 'bogus GPIO', I don't get quite how works the GPIO in Omega2. Seems that GPIO 17 and 16 are somehow linked? I had to put 16 on dirout-low so 17 could work great.</p>
<p dir="auto">Also I had to install GNU/sleep that accepts times &lt;1s. This way doesn't use too much CPU without having to sleep 1s that could cause missing push to the push button.</p>
<p dir="auto">In the end the project is highly usable for almost everything as is a simple network enabled IoT button. Changing the '<a href="http://open.sh" rel="nofollow">open.sh</a>' script can make this project to use in a infinity uses.</p>
]]></description><link>http://community.onion.io/post/15558</link><guid isPermaLink="true">http://community.onion.io/post/15558</guid><dc:creator><![CDATA[Carlos Sancho]]></dc:creator><pubDate>Wed, 03 Jan 2018 14:46:53 GMT</pubDate></item></channel></rss>