In august 2014 i read about an interesting Indiegogo crowdfounding campaign named "Flic the wireless smart button". I said "i must have it".
After several months, yesterday, Flic has been delivered to me.
What is Flic ?
It's a wireless smart button that can perform various functions. Connected via bluetooth to your smarphone, it can do some actions pressing a single click, a double click or hold mode. Once you press it, the smartphone receive the information then, Flic app, will perform a programmable action. For more info visit: www.flic.io
Waiting for a full Raspberry Pi support, i've made this project that allow Pi to listen push notification when Flic is pressed .
The project is aimed to understand how it works, so Raspberry Pi is programmed to turn on different leds and play buzzer sound for each kind of Flic pressing modality. All this wirelessly just with Flic, smarphone and Raspberry Pi (and internet connection, obviously).
This is just a test, useful for more complex projects.
Watch video on Youtube:
Step 1: What You Need
- Flic wireless smart button flic.io
- Raspberry Pi B http://www.gearbest.com/development-boards/pp_198980.html
- GrovePi+ http://www.gearbest.com/raspberry-pi/pp_217827.html
- Grove leds (blue, red and green) http://www.gearbest.com/kits/pp_234926.html
- Grove buzzer http://www.gearbest.com/sensors/pp_238714.html
- n.4 Grove cables
- 5V PS
- Iphone 5 ios 8.4 (or Android phone)
- LAN connection (or WIFI dongle)
- Flic APP for Iphone (or Android)
Latest Dexter Industries Raspbian Image
IOS 8.4 for Iphone
Step 2: Let's Start - Smartphone and Flic Pairing, App Configuration.
For first you have to pair Flic button to the smartphone with Flic app. Then, always in the app, for each kind of click create a Perform IFTTT recipe. Assuming that you have an IFTTT account, smartphone app needs to be authenticated, so write your user and password then add.
Step 3: IFTTT Web Service Configuration
You have now create IFTTT recipes to perform actions for each kind of button pressing status. Create three recipes or copy the three i've made (Log recipe ref.n.30515215, 30515034, 30502977). Each recipe get click information from Flic smatphone app, then send it to Pushbullet.
Step 4: Pushbullet Web Service
Create a Pushbullet account.
Go into setting page and get your Access Token. You'll need it later.
Step 5: Hardware Settings
This project really needs 5 minutes to be completed using GrovePi+, Grove leds and buzzer.
After connected GrovePi+ to your Raspberry Pi, insert leds and buzzer at the following ports:
Grove led blue = port D2
Grove led red = port D4
Grove led green = port D3
Grove buzzer = port D8
Step 6: The Code
piflic.py Python script has been created using Pushbullet API. Inside the script you have only to substitute INSERT HERE with access token obtained from Pushbullet site settings page (see STEP 3).
Copy the script into your /home/Pi directory, then run using:
sudo python piflic.py
The script works as follow:
Pushbullet API launch a request to its server
Script verify, in the Pushbullet answer, if there are one of the three Flic button conditions: click, double_click or hold.
Pushbullet API delete push notification stored on server
If script find "click" into Pushbullet answer Raspberry turn on, then off, red led. If it's "double_click" turn on, then off, blue led. If it's "hold" turn on, then off, the green led. If it doesn't find one of these three strings, system does nothing. Three different buzzer sounds are played for each button click condition. All this inside a WHILE infinite loop.
At this point you can substitute leds turning on/off command with others. For example you can program Flic button to reboot your Raspberry. Inside the script substitute one of the leds command with:
Step 7: The End
.....waiting for Flic Raspbian support.