What is Sigfox Connected Target?
At Sigfox, we (well... few of us) keep on playing with nerfs. So we had the idea of making a connected target that will send a message on Slack (instant messaging tool) every time the target has been hit. This project will demonstrate each step to make the connected target and how to integrate it with Slack. Feel free to integrate it with other services and share how you did it!
We will be using The AirBoard with a SigBee shield to send the results through Sigfox network. The advantage of The AirBoard is that it is very small and has battery integrated.
Who am I?
My name is Louis Moreau, I'm an intern at Sigfox. My mission is to create prototypes and PoC using Sigfox network. I want these projects to be fun and instructive. I want to show you how easy is it to develop the first steps of your ideas. I will try to make this tutorial as complete as I can. Do not hesitate to ask me for more details if needed : Github or Twitter
Step 1: Understand Sigfox
What is Sigfox?
Sigfox is a connectivity solution dedicated to the Internet of Things. The operated network is currently operating in +15 countries, on every continent. Focused on tiny messages (up to 12 bytes) & low energy consumption, it currently powers 7 million devices. Various Sigfox-compatible technical solutions are available, from different silicon vendors. This project uses The AirBoard and a SigBee shield (see below)
Step 2: Hardware Requirements
Step 3: Hardware Connections
This part is going to be very easy.
Just plug the positive wire into the 3.3V pin and the negative wire into the A4 pin on the AirBoard.
Step 4: Arduino
- Install Arduino IDE
- Get the Arduino library from API for ARM modules
- Copy/Past the armapi folder under Arduino/libraries
- You can also download the AirBoard libraries and copy/past it under Arduino/libraries folder if we want to send specific data from the board such as the battery etc...
- Download source code
Run the code
- Choose the Arduino Fio board
- Upload this program to The AirBoard via the BLE-LINK/XBee shield
- replace the BLE-LINK/XBee shield by the SIGFOX shield
- connect to the SIGFOX backend: http://backend.sigfox.com
Basic understanding of Arduino programming
Before starting each program, we start with two "base" functions: void setup() and void loop().
- void setup() is executed in first. It is used to initialise the card.
- void loop() is executed infinitely (as long as power is provided)
See more on arduino.cc
Now, let's have a deeper look into our code:
At first, we include the libraries needed and define the Pins and the Global variables.
Then comes the setup function to initiate the board and check if the SigBee module is present.
We set the green led and the sigfoxOK variable to true on if the shield is present and set the red led on if not.
In the loop function, we read the analogue value of the piezo sensor. When this value is equal to 1023 (meaning the maximum or HIGH) we set the blue led high for 200 milliseconds and then call the sendMessage function.
When the analogue value is HIGH, it means the connected target has been hit. The piezo sensor measures the vibration. When a dart hit the target, it provides enough vibrations to set the analogue value to HIGH (or 1023).
In the sendMessage function, we make the blue led blink while the card is sending the data. We check that the value sent has the same length as the message. If so, we switch the green led or the red one depending on the success.
Step 5: Make the Target
This step is completely up to you.
I decided to make the target using some carton lunch box but you can use whatever support you want.
Step 6: Connecting the Results to Slack
First, go to the Sigfox Backend to activate your board: http://backend.sigfox.com/activate
Choose the AirBoard and your country
Fill the information asked
Go to "Devices" and choose your device by clicking on the ID
Go to "Messages" on the left menu to check that your message has been received by Sigfox
Now we will use Zapier to link Slack with the Sigfox backend.
Go to https://zapier.com/ create an account and choose Slack and WebHooks by Zapier
Click on make a Zap and follow the pictures
In between, you will need to create a callback in the Sigfox Backend. In order to do that, go to "Device Type", click on your device type and in the left menu, you will see an item called "callbacks". Click now on new on the upper right corner and fill the information as shown in the picture. Make sure to replace the URL with the URL provided by Zapier WebHook.
Step 7: Enjoy!!
Now everything is set up and you can shoot the connected target!!
Feel free to modify, adapt, share and let me know what you did with the project.
Thank you for reading this tutorial. I hope you will have some productive time with it ;)