In the last tutorial, we looked at sending downlinks to your device from your TTN account. We shall now configure Datacake to send downlinks from your Datacake account.
Login to your Datacake account at https://app.datacake.de and select your device.
Then select the ‘Configuration’ tab.
On newer versions of Datacake, you will also have to click the 'Product and Hardware' link in the left-hand menu.
You will then see this pop-up window.
In this Dialog you need to select your network server and fill in the four textboxes with Information that you find on the TheThingsStack Console.
Firstly, select the network server: ‘The Things Stack V3’.
Now for the four textboxes:
1) TTS Device ID
This is the ID of your Device in your TTN Application. Login to your TTN account https://eu1.cloud.thethings.network/console/applications and select your device. If you open this in a separate tab, you can paste from one application to the other.
2) TTI Server URL
This is the web address of your Things account that you have just opened. If you are with The Things Network in Europe, then your URL is:
eu1.cloud.thethings.network
If you are outside Europe, look at the web address of your Things account and change the ‘eu1’ part of the address to what it says in your address.
If you have a paid for account with The Things Industries, then your URL will be:
datacake.eu1.cloud.thethings.industries
Again, change the ‘eu1’ part of the address if you are not in Europe.
3) TTI App ID
This is the ID of your application in your Things account. It is the lower case, no spaces version of whatever you have called your application. Click on ‘Application overview’, the ‘Application ID’ appears under the name of your application.
In this case, ‘board-6’. Copy this into your Datacake application.
You should then see this pop-up.
The new API key is at the foot of the pop-up. If you can’t see it, scroll down. Then click the ‘copy’ icon and paste the key into your Datacake application. When done, go back to the TTN tab and click the blue ‘I have copied the key’ button.
If you need to use the API key again, you will have to delete this key and create a new one.
Now click the blue ‘Update’ button on the Datacake tab to complete the configuration. You should then see something like this:
If you do, then your downlinks have been successfully configured.
Your downlink settings should automatically be saved. Click ‘Save’ if you are not sure.
Next, try and send a downlink.
As before, we are going to send two downlinks, one to turn the Arduino’s onboard LED on, and one to turn it off again.
If you see a message ‘Downlinks have not been configured’, it is because the settings were not saved from the configuration page. If so, go back, add the settings again, then click ‘Update’, and then ‘Save’ on the configuration page.
Click ‘Add Downlink’. You should see this pop-up window.
For our purposes, we are only interested in the fields named ‘Name’ and ‘Payload Encoder’. In the name field, type a descriptive name for your downlink. I would suggest keeping this to one word, or at least, use no spaces. This could save confusion later on.
‘Payload Encoder’ is a JavaScript snippet. Content placed in the square brackets [] will be sent to your device in the downlink. It is expecting some hexadecimal code. In our example, we want to send the number 1 to turn the onboard LED on, and the number 0 to turn the system off.
In order to turn on the LED, I gave the downlink the name ‘LED-ON’, and the downloaded hexadecimal value of ‘0x01’, which is the number 1 in decimal.
Click the blue ‘Send downlink’ button that you have just created to turn the LED off. You can check the ‘Debug’ tab to see that the link has been sent. This time you should see ‘Sent payload: 00’.
And the onboard LED should be turned off.
Setting your Arduino free – untether your device:
Next: Battery power - connecting and charging the Li Po battery Click here for the next steps.