Sigfox Connected Target for Nerfs

by luisomoreau in Circuits > Wireless

3143 Views, 25 Favorites, 0 Comments

Sigfox Connected Target for Nerfs

BE740.jpg
2016-06-06 10.35.43.jpg

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

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)

Hardware Requirements

2016-06-06 10.47.55.jpg
2016-06-06 10.43.35.jpg
2016-06-06 10.45.09.jpg
2016-06-06 10.45.22.jpg
2016-06-06 10.45.34.jpg
2016-06-06 10.45.53.jpg

In this tutorial, we will be using:

Hardware Connections

2016-06-06 10.46.43.jpg
2016-06-06 10.46.55.jpg

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.

Arduino

2016-06-06 10.42.48.jpg
2016-06-06 10.46.27.jpg
2016-06-06 10.46.09.jpg
2016-06-06 10.41.11.jpg
Capture du 2016-06-07 10-53-05.png

Installation

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

Code explanation

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.

Make the Target

2016-06-06 10.44.05.jpg
2016-06-06 10.44.22.jpg
2016-06-06 10.35.10.jpg

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.

Connecting the Results to Slack

Capture du 2016-06-07 12-39-32.png
Capture du 2016-06-07 16-27-16.png
Capture du 2016-06-07 16-28-10.png
Capture du 2016-06-07 16-29-16.png
Capture du 2016-06-07 16-29-53.png
Capture du 2016-06-07 16-35-01.png
Capture du 2016-06-07 16-30-03.png
Capture du 2016-06-07 16-30-11.png
Capture du 2016-06-07 16-30-22.png

Sigfox Backend

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

Zapier

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.

Enjoy!!

Sigfox Connected Target
2016-06-06 10.36.32.jpg
2016-06-06 10.47.50.jpg
2016-06-06 10.43.49.jpg

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 ;)

If you have any questions I will be glad to answer (Twitter or Github)