IoT cheap WiFi Button w/ LED

TOP meneame.net

This is a simple-one-afternoot project that I made to be able to open the office door.

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 with just a button I need two curl calls to the API service in that server (one for login and another for opening the door).

0_1514989447520_Boton1.JPG

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.

0_1514989849280_6668df6d-df7a-4acf-8f65-b14f67c8cfe2-image.png

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’.

0_1514989558431_Boton2.JPG

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.

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:

#!/bin/sh

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

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

# Bogus GPIO?
gpioctl dirout-low 16 > /dev/null 2>&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  > /dev/null 2>&1
                # LED is light meanwhile the script 'open.sh' is being executed
                /root/open.sh
                fast-gpio set 11 0 > /dev/null 2>&1
        fi

        # Some sleep
        sleep 0.05
done

The other one has the 2 curl sentences:

#!/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" > /dev/null 2>&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" > /dev/null 2>&1

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.

Also I had to install GNU/sleep that accepts times <1s. This way doesn’t use too much CPU without having to sleep 1s that could cause missing push to the push button.

In the end the project is highly usable for almost everything as is a simple network enabled IoT button. Changing the ‘open.sh‘ script can make this project to use in a infinity uses.

<< Volver

52 comments to “IoT cheap WiFi Button w/ LED”

  1. Comment by bill printing and mailing:

    bill printing and mailing…

    Procure the best invoice printing and mailing today on a best offer and gets your money flowing immediately!…

  2. Comment by caveman music americana festival:

    caveman music americana festival…

    Find here the top option for weston colorado americana music festival that are now in stock and reasonably priced you can get now!…

  3. Comment by reusable face masks:

    reusable face masks…

    Find a top promo products suppliers that is now available and on sale now only!…

  4. Comment by this contact form:

    this contact form…

    Get going right now with with hunting african elephants and in addition an awesome strategy to get started right now!…

  5. Comment by metal water bottles:

    metal water bottles…

    Get a top business gifts that is now available and with reasonably pricing now only!…

  6. Comment by hotel motel insurance companies:

    hotel motel insurance companies…

    Get going with highly amazing b&b insurance today on a best offer and creates efficiency for you immediately!…

  7. Comment by charlotte detailing:

    charlotte detailing…

    Profit from amazing car detailers charlotte nc currently taking on new clients and on sale now!…

  8. Comment by hotel motel insurance companies:

    hotel motel insurance companies…

    Locate top quality hotel insurance requirements immediately on a best offer and gets your business ROI immediately!…

  9. Comment by water bottles with logo:

    water bottles with logo…

    Hire the best branded products that’s now available and on sale now only!…

  10. Comment by custom printed face masks:

    custom printed face masks…

    Find the the top tote bags that is now available and on sale now only!…

  11. Comment by insurance for b&b:

    insurance for b…

    Procure highly amazing bed & breakfast insurance now on a best offer and gets your money flowing immediately!…

  12. Comment by promotional coffee mugs:

    promotional coffee mugs…

    Hire the the top badge holder currently now available and at reasonable prices now only!…

  13. Comment by embroidered shirts:

    embroidered shirts…

    Get a top logo printed face masks that’s now available in addition at good rates now only!…

  14. Comment by country music festival:

    country music festival…

    Find here the brightest available music festival colorado that are available plus reasonably priced you can get now!…

  15. Comment by Clicking Here:

    Clicking Here…

    Procure highly amazing bill mail service today on a best offer and creates efficiency for you immediately!…

  16. Comment by bow hunting in africa:

    bow hunting in africa…

    Get going right now with with when is the best time of year for an african safari? that is providing a fantastic ROI to get started right now!…

  17. Comment by knee pain doctor near me:

    knee pain doctor near me…

    Find a top diabetes wound care currently now available and with reasonably pricing now only!…

  18. Comment by insurance for lodges:

    insurance for lodges…

    Procure top quality bed & breakfast insurance immediately on a best offer and gets your business ROI immediately!…

  19. Comment by logo safety glasses:

    logo safety glasses…

    Get a top personalised engraved pens currently now available in addition at good rates now only!…

  20. Comment by ski lodge insurance:

    ski lodge insurance…

    Locate highly amazing insurance for lodges now on a best offer and gets your business ROI immediately!…

  21. Comment by promotional coffee mugs:

    promotional coffee mugs…

    Find the the top embroidered shirts currently now available and at reasonable prices now only!…

  22. Comment by promo products suppliers:

    promo products suppliers…

    Hire the the top logo safety glasses that is now available and on sale now only!…

  23. Comment by bed and breakfast insurance policy:

    bed and breakfast insurance policy…

    Get going with the best insurance for b&b today on a best offer and creates efficiency for you immediately!…

  24. Comment by labor day weekend:

    labor day weekend…

    Find the brightest new jazz music festival currently available and on sale you can get now!…

  25. Comment by engraved pens:

    engraved pens…

    Get the best wholesale promotional products that is now available in addition at good rates now only!…

  26. Comment by caveman live music festival:

    caveman live music festival…

    Find here the brightest new caveman weston colorado music festival that’s in stock plus reasonably priced you can get now!…

  27. Comment by americana music festival colorado 2022:

    americana music festival colorado 2022…

    See the brightest option for weston colorado music festival currently now in stock plus at the best price you can get now!…

  28. Comment by imprinted safety glasses:

    imprinted safety glasses…

    Hire a top custom logo design that is now available and at reasonable prices now only!…

  29. Comment by cape buffalo hunting:

    cape buffalo hunting…

    Get going right now with with what animals are in namibia africa? that’s providing a fantastic ROI to get started now!…

  30. Comment by orthopedic doctors omaha ne:

    orthopedic doctors omaha ne…

    Find the the top diabetes endocrinology that’s now available and at reasonable prices now only!…

  31. Comment by click:

    click…

    Locate top quality online invoicing services today on a best offer and creates efficiency for you immediately!…

  32. Comment by bed & breakfast insurance:

    bed & breakfast insurance…

    Locate the best motel insurance program immediately on a best offer and creates efficiency for you immediately!…

  33. Comment by see here:

    see here…

    Locate highly amazing bed and breakfast insurance companies now on a best offer and creates efficiency for you immediately!…

  34. Comment by printed water bottles:

    printed water bottles…

    Hire a top printed water bottles that’s now available and on sale now only!…

  35. Comment by badge holder:

    badge holder…

    Find the best logo safety glasses currently now available and on sale now only!…

  36. Comment by reusable face masks:

    reusable face masks…

    Find the the top customized water bottles that’s now available in addition on sale now only!…

  37. Comment by Source:

    Source…

    Start the year the right way with big game hunting in africa that’s ROI producing to get started today!…

  38. Comment by weston colorado live music americana festival:

    weston colorado live music americana festival…

    Get the top option for bluegrass music festival that’s available in addition at great prices you can get now!…

  39. Comment by promotional coffee mugs:

    promotional coffee mugs…

    Hire the best promotional products that’s now available and on sale now only!…

  40. Comment by safety kits:

    safety kits…

    Find a top promotional coffee mugs that’s now available in addition at good rates now only!…

  41. Comment by caveman live music americana festival:

    caveman live music americana festival…

    Get the brightest new weston colorado live music festival that’s in stock and at the best price you can get now!…

  42. Comment by see it here:

    see it here…

    See the greatest available caveman weston colorado music festival that are now in stock in addition at great prices you can get now!…

  43. Comment by badge reel holder:

    badge reel holder…

    Get the the top promotional items that is now available and at reasonable prices now only!…

  44. Comment by big five safari namibia:

    big five safari namibia…

    Get going right now with with What animals are legal to hunt in namibia? that’s ROI producing to get started right now!…

  45. Comment by orthopedic doctor for knee pain:

    orthopedic doctor for knee pain…

    Find the the top reverse diabetes that is now available in addition at reasonable prices now only!…

  46. Comment by event venue insurance:

    event venue insurance…

    Get going with top quality insurance for event venues now on a best offer and gets your money flowing immediately!…

  47. Comment by car detailers charlotte nc:

    car detailers charlotte nc…

    Get here amazing charlotte detailing currently taking on new clients in addition on sale now!…

  48. Comment by corporate gifts:

    corporate gifts…

    Find a top imprinted protective eyewear that’s now available in addition with reasonably pricing now only!…

  49. Comment by check my blog:

    check my blog…

    Start the year the right way with Bird Hunting in Namibia that is ROI producing to get started now!…

  50. Comment by customized water bottles:

    customized water bottles…

    Find the best custom lanyards that’s now available and at reasonable prices now only!…

  51. Comment by this website:

    this website…

    Get going with top quality bed and breakfast insurance companies today on a best offer and gets your business ROI immediately!…

  52. Comment by first aid kits:

    first aid kits…

    Hire the best water bottles with logo currently now available and at good rates now only!…

Comentalo

*
Contador