Build your own bike tracker with TTN

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.

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


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.


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.


In the search field enter „webhooks“.


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


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.


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


Then search for telegram on the next interface:


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


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.


The trick is to write a link like this: See on google maps:{{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.


This was implemented similar to the 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:


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, …

4 Gedanken zu „Build your own bike tracker with TTN“

  1. 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. Das wäre doch mal ein super Projekt für einen Workshop :-).. Wo dürfen wir uns anmelden ;-)..

Kommentare sind geschlossen.

Entdecke mehr von Sebastian Müllers Blog

Jetzt abonnieren, um weiterzulesen und auf das gesamte Archiv zuzugreifen.