Build your own bike tracker with TTN

TTN_GPS_Bike_tracker.001

How it works, in a simple overview.

Keeping track of a moving and easily stolen object, like a bikecylcle can be an challenge. Of course you can try to remember where you parked your bike and then go back to the place. But what if it is stolen? It would be helpful to attach a little device to your bike that sends its position to a webservice and then on to your mobile phone.

Currently most systemsmost systems either log the data on file or use a GSM sim card and data tarif to send the location information to a server. Usually such a sim card has a monthly bill.

But what if we use the Long Range Wireless Network provided in Freiburg by The Things Network Freiburg Community. The network already covers large parts of town and is expanding. And how can we use this application without programming. I can’t programm and so writing code and maybe a server application is out of the question for me.

IMG_1794

See it on your telegramm channel!

But there are several good webservices that can helpd: IFTTT with a telegram channel integration.

What do we need?

  • Zane Systems: ztube, which was supplied kindly by Zoltan
  • zTracker Configuration Tool
  • a TTN Account, Application and acess to the console
  • decoder function
  • webhook
  • an IFTT Applet that pushes the data to a telegramm channel
  • telegramm account

For hardware we used the zTube from Zane Systems, its currently about 70 € but I had bought a previous version of the tracker before and so he send me a zTube and zTrack Midi by Express TNT, which we got on Friday at the same day the hackaton started.

How to set up

When I got the zTube I went to the TTN Console and put in the data. Meaning I set up a new application, klicked on „add device“. You can add the DEVICE EUI which is printed on the label of the zTube and set it up from there. As a configuration I set it to „ABP“ not OTA and disabled Frame Counter Checks. The rest of the configuration I left as it was. I’m not even sure if I had to disable frame counters.

You can configure both with the zTrack Configuration Tool. As a configuration we entered the following data:

image (1)image (2)Then in the console you have to enter a decoder function. As a base we used function developed by TTN Berlin and provided here: Or you use what we did (download and copy paste to your application).

console

Sometimes the zTube does not find a gps fix, then this data is empty. If it does it looks like this in the function:

Untitled 2

I’m not yet sure what is the optimal configuration for the zTube, as I don’t want to overuse the bandwith but also get good tracking results.

Now for the IFTT integration: Install IFTT on the phone. It seems to be much easier to do all the stuff on the phone and not on the website. Get an acoount and so on. Then go to the browser and google „IFTT webhooks“, then open the webhooks page in the iftt app. press on the „Documentation“: is show your key. Copy the key into notes.

IMG_1813

Click on documentation.

IMG_1815 copy

You will then be lead to a website again with your key. Copy the key to notes or send it to you by email. You will need it to enter later.

IMG_1816 copy

Now on your PC again. Go to the TTN Console, open your Application and go to „Integrations“, click on the „add integration“, choose IFTT Maker.

Untitled 2

Here you enter the key you got from IFTT. Give the event a name, which doesn’t matter, but it shouldn’t be to long as you have to enter it again in the IFTT App Webhooks later. Now definde Value1, Value 2 and Value 3. Just copy the names of the variables from the „Field“ section.

Now the data is on the way from the TTN Console to  IFTT. What we need next is to push it to a telegramm channel!

Go to the IFTT App on your phone. Press on „My Applets“ in the right bottom corner, then on the big + on the top to create a new applet.

IMG_1817

In the search field enter „webhooks“.

IMG_1818

Press „webhooks“ and then you get a new page with choose trigger, press the only button.

img_1819.png

In the Integration in the TTN Console you gave the Event a name. Enter the name of the event. As you remember I named mine „position“ and entered exactly the same name here.

IMG_1820

Now you get to clic on the „that“ on the next page:

img_1821.png

Then search for telegram on the next interface:

IMG_1822

Then select „send message“ as what the service should do.

IMG_1823

The key is to define a cool and useful message text. Especially for getting a direct link to google maps and see where the bike is.

IMG_1824

The trick is to write a link like this: See on google maps: https://www.google.com/maps/search/?api=1&query={{Value2}},{{Value3}}

You should turn the preview to disable.

It might be helpful to mute the channel, as you will get a message whenever the zTube sensor detects motion. Meaning especially when you ride you get a lot of messages.

Remarks

This was implemented similar to the Feinstaub.channel Guido Burger showed me how to set up. This was made during the Freiburg Smart City Hackaton in 2018.

My team also built a cool integration with Azure:

fmb3

Thanks to my team at the Hackaton, Zoltan Erdani from Zane Systems for the hardware, our team, the people who organized the hackaton, Guido for showing me how it works, …

Advertisements

Schlagwörter: , , , , , , , , , , , , , , , ,

3 Antworten to “Build your own bike tracker with TTN”

  1. sbamueller Says:

    Update from using it:
    Set the GPS Time to 300 or 200 seconds, that gives the sensor more time to find a GPS fix and you get better data.

  2. Gerhard Peter Says:

    🙂

  3. zu Besuch bei der VAG | Sebastian Müllers Blog Says:

    […] Fahrradtracker: Projekt TTN Freiburg / Berlin. Für das es den Ersten Preis beim Hackaton gab. Die Idee ist es Fahrräder für wenig Geld mit TTN zu tracken. […]

Kommentar verfassen

Trage deine Daten unten ein oder klicke ein Icon um dich einzuloggen:

WordPress.com-Logo

Du kommentierst mit Deinem WordPress.com-Konto. Abmelden /  Ändern )

Google+ Foto

Du kommentierst mit Deinem Google+-Konto. Abmelden /  Ändern )

Twitter-Bild

Du kommentierst mit Deinem Twitter-Konto. Abmelden /  Ändern )

Facebook-Foto

Du kommentierst mit Deinem Facebook-Konto. Abmelden /  Ändern )

w

Verbinde mit %s


%d Bloggern gefällt das: