Orienteering Wristwatch

by projetLong-bracelet in Circuits > Gadgets

501 Views, 2 Favorites, 0 Comments

Orienteering Wristwatch

maquette.jpg

Orienteering wristwatch can be like other connected watch. But not at all !

Have you ever did an orienteering ? I could already see you raging with anger against the map in your hands. But it’s not its fault ! Moreover, you have to keep the sheet to stamp at each crossing point. Do not lose it or you will lose the race… But from now, you don’t have to be worried ! New century, new technology ! The wristwatch has the RFID technology and the same goes for the crossing points. You just have to read the RFID tag of the crossing point with your wristwatch and it’s done ! Furthermore, if you are in danger or need help, you can activate the SOS mode and your GPS coordinated will be sent to a race representative. What is more, its can give you the temperature and the humidity. So let’s make it !

Quick Overview

actoboard.png
bluemix.png
boutons.jpg
node-red.png
sigfox.png
STMicroelectronics.png

Quick overview of what you will learn in this Instructables.

In this tutorial, you will learn how to make an orienteering wristwatch. This equipment provides a touch of technology in orienteering and it's easy to use. On your watch, you can choose three modes thanks to buttons :

- the weather mode

When you are in this mode, the sensor in the watch will acquire the temperature and the humidity. Afterwards, it will display them on the LCD screen.

- the RFID mode

When you have find a crossing point in the race, you have to prove it. Usually, you make a hallmark on your sheet. With this watch, you just have to be in the RFID mode and to place the wristwatch near to the crossing point, also equipped with the RFID technology. It will set the tag from red to green on your map race.

- the SOS mode

If you are in danger or need help, you just have to activate the SOS. The GPS in your device will return your coordinated and will be send by email to a race staff.

To carry out this watch, follow this tutorial begining with the tools essentials to the realization.

Tools and Materials

nucleo.jpg
rfid.jpg
accelerometre.jpg
boussole.jpg
ecran_LD.jpg
boutons.jpg
gps.jpg
dht22.jpg
fils.jpg

Here, it's a detailed list of materials and softwares you will need.

1. The components

Firstly, the components to use :
- microcontroller Nucleo

- RFID module

- accelerometer

- compass

- LCD screen

- buttons

- GPS

- temperature and humidity sensor

- wires connection

2. The softwares

To develop, you can use the following online softwares. It's just required to sign up and for free.

- mbed

It is a development platform which has a large range of librairies. You just have to import them and use.

- Actoboard

It's a dashboard where you can display data in real time.

- Bluemix

This IBM's platform offers many tools for programmation. You can store data, create a web or a mobile application for example and use different language like python, ruby, nodejs and so on.

Now, we have all the necessaries tools to create the orienteering watch.

Programming

dht22_connexion.PNG

Now, it's time to start the programming of each component.

You can see all the connections between the components at the step 5 .

Let's start with the Nucleo-L432KC.


1. Nucleo

It's a microcontroller with 32-pin packages and it's compatible with mbed. The programs will be deploy into the microcontroller and the components will be connected with it.

It's supply with an USB VBUS and an external source.

It supplies the others components with 3.3V.

2. Sigfox module

The modem TD1208 gives you the possibility to use the IoT Sigfox technology easier and to sent the data directly on the Internet. The data will be available into the dashboard of Actoboard and can be forwarded to any URL through this platform. You have to know that there is a limit of 140 messages per day.


3. Temperature and humidity

The DHT22 communicates with the microcontroller via a serial port. You can see how to connect it in the image. It's supply with 3.3V.

Here is the program for this sensor.

-------------------------------------------------------------

#include "mbed.h"

#include "DHT.h"

DHT sensor(D7, DHT11);

Serial pc(A7, NC); // tx, rx

float temp,Humidity;

int main() {

/////////// variable DHT11 ///////////////////////////
int err;

while(1) {

////////////////////////// acquisition du capteur de température //////////////////////////

err = sensor.readData();
if (err==0){

temp=sensor.ReadTemperature(CELCIUS);

Humidity=sensor.ReadHumidity();

}

wait(3);

}

}

-------------------------------------------------------------

4. RFID tag

The module allows the reading of RFID cards or badges and can detects until a distance of 7 centimeters wireless. It communicates with the RX serial port of the microcontroller. It's supply with 3.3V.

Here is the program of the module.

-------------------------------------------------------------

#include "mbed.h"

Serial pc(A7, NC); // tx, rx
Serial rfid(NC, D4); //tx, rx

InterruptIn button_RFID(PA_9);

DigitalOut led(LED2);

void ReadRFID_CALLBACK();

int RFID=0;

int main()
{

// configuration du BTN RFID
button_RFID.mode(PullUp); button_RFID.fall(&ReadRFID_CALLBACK); // attach the address of the flip function to the rising edge

led = 0;

while(1)
{

RFID=0;

wait(3);

}

}

////////////////////////// acquisition RFID /////////////////////////////////////
void ReadRFID_CALLBACK() {

// configuration RFID

int i;

int RFID_read[15];

pc.printf("RFID_read1 : \r\n");

for(i=0;i<5;i++)

RFID_read[i]=rfid.getc();

for(i=0;i<5;i++)

RFID=RFID+RFID_read[i];

pc.printf("AT$SS=%x%x0000\r\n",SOSEtat,RFID);

wait(3);

}

-------------------------------------------------------------

5. SOS mode

The GPS module permits to acquire the position in real time. It communicates to the microcontroller with a serial RX port. It's supply with 3.3V.

Here is the program of the module.

-------------------------------------------------------------

#include "mbed.h"

#include "SerialGPS.h"

Serial pc(A7, NC); // tx, rx

InterruptIn button_SOS(PB_0);

void SOS_CALLBACK() ;

int SOSEtat;

int main()
{

// configuration du BTN SOS
button_SOS.mode(PullUp); button_SOS.fall(&SOS_CALLBACK); // attach the address of the flip function to the rising edge

led = 0;

while(1)
{

SOSEtat=0;

wait(3);
}

}

////////////////////////// acquisition GPS_SOS //////////////////////////////////
void SOS_CALLBACK() {

SOSEtat=1;

pc.printf("AT$SS=%x%x0000\r\n",SOSEtat,RFID);

}

-------------------------------------------------------------

Now, let's see how to collect data into Bluemix from Actoboard.

Connection Between Actoboard and Bluemix Apps

actoboard-config.png
create-app-Bluemix.PNG
create-app-Bluemix-information.PNG
app-create-Bluemix.PNG
bluemix-app.png

1. Sigfox to Actoboard

To receive data from the Sigfox module, you just have to create an account on Actoboard and log in. In the picture of the Actoboard parameters, you can see how to configure the dashboard in order to get data from the Sigfox module. Pay attention to register the right PAC and Sigfox modem number in the field of Actoboard. You can find this number on your Sigfox component.

In the field "Data format", you can choose to get the data in specific type of format. Here, we choose an unsigned integer on 8 to collect the SOS and RFID data.

To send the collected data to Internet, you have to specified your forwarding URL. In our case, we choose to send it to our application on Bluemix. So, we have created a web application with Bluemix and specify its URL in the field of Actoboard.

2. Actoboard to Bluemix

You have to create an account to use Bluemix. Note that your account has a limited free days.

Next, create a web application thanks to the application "Node-RED Starter". You can find it doing "Catalog" and typing Node-RED Starter in the search bar. Choose the name of your application, a host name, your domain and select "Create". You can use the parameters by default. Then, your application will start automatically. Once the start is done, click on "Display the application". It will redirect you to an another page. Click on "Go to your Node-RED flow editor". The programming on Node-RED is with labels which you have to connect it with the others labels by wires. You can try the labels-functions available on the left to understand how it works and to be used to it.

Finally, you can find how to create a web application with a map, tags and localization on the screenshot.

Moreover, you also have to develop shortly. Here is the program for the application :

-------------------------------------------------------------

[{"id":"91ccb9c7.8efd48","type":"http
in","z":"8096a5ba.e0fe68","name":"FromActoboard","url":"/data","method":"post","swaggerDoc":"","x":140,"y":186,"wires":[["38e448c7.072ab8","34fb8529.2e1d5a","26bc2f91.3c347","caa69104.3026e","9db68436.d77238"]]},{"id":"34fb8529.2e1d5a","type":"http response","z":"8096a5ba.e0fe68","name":"","x":488.9999694824219,"y":20,"wires":[]},{"id":"38e448c7.072ab8","type":"function","z":"8096a5ba.e0fe68","name":"","func":"var newMsg = { payload: msg.payload.slot_RFID };\nreturn newMsg;\n\n","outputs":1,"noerr":0,"x":494.9999237060547,"y":86,"wires":[["f51e3815.691c28"]]},{"id":"f51e3815.691c28","type":"debug","z":"8096a5ba.e0fe68","name":"","active":true,"console":"false","complete":"payload","x":691.9999847412109,"y":86,"wires":[]},{"id":"e26d8c7.2b6bf7","type":"worldmap","z":"8096a5ba.e0fe68","name":"Where am I? ","lat":"","lon":"","zoom":"","cluster":"","maxage":"","x":725.9999847412109,"y":718,"wires":[]},{"id":"11c37fb.f7fc68","type":"function","z":"8096a5ba.e0fe68","name":"TaggerMAp","func":"\n\nvar f_lat_Polytech = 48.84516;\nvar f_lon_Polytech = 2.35702;\n\nvar f_lat_Atrium = 48.84625;\nvar f_lon_Atrium = 2.35763;\n\nvar f_lat_Zamansky = 48.84686;\nvar f_lon_Zamansky = 2.35553;\n\nvar Polytech =[{\n layer:\"OSM\",\n name:\"Polytech\", \n lat:f_lat_Polytech, \n lon:f_lon_Polytech,\n icon:\" fa-check-circle\",\n iconColor:\"red\",\n zoom:16,\n extrainfo:\"Some extra information\"\n},\n\n{\n layer:\"OSM\",\n name:\"Atrium\", \n lat:f_lat_Atrium, \n lon:f_lon_Atrium,\n icon:\"fa-check-circle\",\n iconColor:\"red\",\n zoom:16,\n extrainfo:\"Some extra information\"\n},\n{\n layer:\"OSM\",\n name:\"Zamansky\", \n lat:f_lat_Zamansky , \n lon:f_lon_Zamansky,\n icon:\"fa-check-circle\",\n iconColor:\"red\",\n zoom:16,\n extrainfo:\"Some extra information\"\n}];\n\nvar msg3 = { payload: msg.payload };\nvar msg2 = { payload: msg.payload };\nvar msg1 = { payload: msg.payload };\n\nmsg3.payload = Polytech[0] ;\nmsg1.payload = Polytech[1] ;\nmsg2.payload = Polytech[2] ;\n\nmsg2.payload.command = {\n layer:\"OSM\", \n lat:f_lat_Polytech, \n lon:f_lon_Polytech,\n zoom:18\n};\n\nreturn [msg1, msg3, msg2];\n\n","outputs":"3","noerr":0,"x":308.9999694824219,"y":716.9999847412109,"wires":[["95771deb.85316"],["d331c200.60e2e"],["9bf690b6.11696"]]},{"id":"95771deb.85316","type":"delay","z":"8096a5ba.e0fe68","name":"","pauseType":"delay","timeout":"0","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":505.9999237060547,"y":670.9999847412109,"wires":[["e26d8c7.2b6bf7"]]},{"id":"d331c200.60e2e","type":"delay","z":"8096a5ba.e0fe68","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":513.9999542236328,"y":723.9999847412109,"wires":[["e26d8c7.2b6bf7"]]},{"id":"9bf690b6.11696","type":"delay","z":"8096a5ba.e0fe68","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":505.9999542236328,"y":772,"wires":[["e26d8c7.2b6bf7"]]},{"id":"79788398.052ddc","type":"worldmap","z":"8096a5ba.e0fe68","name":"Where am I? ","lat":"","lon":"","zoom":"","cluster":"","maxage":"","x":805.9999847412109,"y":406,"wires":[]},{"id":"26bc2f91.3c347","type":"function","z":"8096a5ba.e0fe68","name":"CompareRFID","func":"var newMsg = { payload: msg.payload };\n\n\nvar f_lat_Polytech = 48.84516;\nvar f_lon_Polytech = 2.35702;\n\nvar f_lat_Atrium = 48.84625;\nvar f_lon_Atrium = 2.35763;\n\nvar f_lat_Zamansky = 48.84686;\nvar f_lon_Zamansky = 2.35553;\n\nif (msg.payload.slot_RFID==62)\n newMsg.payload ={\n layer:\"OSM\",\n name:\"Polytech\", \n lat:f_lat_Polytech, \n lon:f_lon_Polytech,\n icon:\" fa-check-circle\",\n iconColor:\"green\",\n zoom:16,\n extrainfo:\"Some extra information\"\n };\n \nelse if(msg.payload.slot_RFID==8)\n newMsg.payload ={\n layer:\"OSM\",\n name:\"Atrium\", \n lat:f_lat_Atrium, \n lon:f_lon_Atrium,\n icon:\"fa-check-circle\",\n iconColor:\"green\",\n zoom:16,\n extrainfo:\"Some extra information\"\n };\nelse if(msg.payload.slot_RFID==1024)\n newMsg.payload={\n layer:\"OSM\",\n name:\"Zamansky\", \n lat:f_lat_Zamansky , \n lon:f_lon_Zamansky,\n icon:\"fa-check-circle\",\n iconColor:\"green\",\n zoom:16,\n extrainfo:\"Some extra information\"\n };\n\nreturn newMsg;","outputs":"1","noerr":0,"x":473.9999237060547,"y":369.9999694824219,"wires":[["79788398.052ddc","2bec9bd1.32b1a4"]]},{"id":"2bec9bd1.32b1a4","type":"debug","z":"8096a5ba.e0fe68","name":"","active":true,"console":"false","complete":"payload","x":794.8957366943359,"y":354.8888854980469,"wires":[]},{"id":"21785693.150bba","type":"ui_button","z":"8096a5ba.e0fe68","name":"","group":"a8bb1616.454da8","order":0,"width":0,"height":0,"label":"Check point","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":140.8298797607422,"y":821.2708740234375,"wires":[["11c37fb.f7fc68"]]},{"id":"6628ccbc.ce34f4","type":"inject","z":"8096a5ba.e0fe68","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":124.82640075683594,"y":723.9653015136719,"wires":[["11c37fb.f7fc68"]]},{"id":"caa69104.3026e","type":"function","z":"8096a5ba.e0fe68","name":"SOS ","func":"var newMsg = { payload: msg.payload.slot_SOS};\n\nif (msg.payload.slot_SOS>1 && msg.payload.slot_RFID==0)\n {\n newMsg = { payload: \"SOS: help !\"};\n return newMsg;\n }\n","outputs":1,"noerr":0,"x":458.89576721191406,"y":160.88888549804688,"wires":[["f9f97efc.8edcf","fcf5f6ac.dfc068"]]},{"id":"f9f97efc.8edcf","type":"debug","z":"8096a5ba.e0fe68","name":"","active":true,"console":"false","complete":"payload","x":692.8957977294922,"y":153.88888549804688,"wires":[]},{"id":"fcf5f6ac.dfc068","type":"ui_toast","z":"8096a5ba.e0fe68","position":"dialog","displayTime":"3","outputs":1,"ok":"OK","cancel":"","topic":"","name":"SOS_screen","x":693.8367767333984,"y":200,"wires":[[]]},{"id":"aa13f0c3.1de37","type":"twilio out","z":"8096a5ba.e0fe68","service":"_ext_","twilio":"f0d8326c.d915e","from":"","number":"0652790959","name":"","x":692.8957977294922,"y":242.88888549804688,"wires":[]},{"id":"505789a0.5e4b58","type":"e-mail","z":"8096a5ba.e0fe68","server":"smtp.gmail.com","port":"465","name":"fadi.ladhari@gmail.com","dname":"","x":732.8368072509766,"y":285.4305725097656,"wires":[]},{"id":"9db68436.d77238","type":"function","z":"8096a5ba.e0fe68","name":"Décodage_data","func":"","outputs":1,"noerr":0,"x":470.89576721191406,"y":459.88885498046875,"wires":[[]]},{"id":"a8bb1616.454da8","type":"ui_group","z":"","name":"Group 1","tab":"fea5a264.bc2dc","order":1,"disp":true,"width":"6"},{"id":"f0d8326c.d915e","type":"twilio-api","z":"","sid":"AC3ac23fd59a7363359ef35ec892284418","from":"0975186623","name":"send_SMS"},{"id":"fea5a264.bc2dc","type":"ui_tab","name":"Tab 1","icon":"dashboard","order":1}]

-------------------------------------------------------------

Your web application is done. But now, you have to connect Actoboard and Bluemix. Do you remember the creation of the Node-RED application ? You have chosen a name and a domain. And now, if you look your URL in the Node-RED application, you can see "https://.". That's how your URL is created. Copy this URL and paste it in the "Fowarding URL" field in Actoboard.

Now, start your application. You can see a map and three red tags. When you use your RFID card, it will recognize it and the associate tag on the map will be change on green.

Remember, if you don't use your application, stop it. Otherwise, it will generate an invoice of consumption.

Now, let's see the final mockup.

The Final Circuit

fritzing.PNG

You have programmed your components, you have done your web application. Now, finalize your PCB with Fritzing. You can see the final circuit on the image.

Congratulations for your orienteering wristwatch !