SystemLink Forum

cancel
Showing results for 
Search instead for 
Did you mean: 

Connecting Arduino and Systemlink Cloud

Solved!
Go to solution

Hello, I'm new to working with SLC and I was wondering whether there's any way to send data between a wifi connected Arduino (MKR Wifi 1010) and Systemlink Cloud or a webVI hosted on SLC.  It doesn't matter whether the data is sent using tags, file uploads, or anything else, I just need a way to get the information onto something that can be read by Cloud services or webVIs so I can display it on a dashboard.  I only need to send a few numbers, not a large amount of data, but I need it to be continuously updating.  I'd love if the Arduino could send the data to SLC on its own without needing to connect to another computer, because I need the data to be sent all the time and it would be great if I didn't have to leave a computer running.  Is there any way to do this, or can SLC only connect remotely like this to other national instruments services? 

 

I understand that this may seem more like an Arduino question than a SLC question, but my main source of confusion is over whether a third party like an Arduino is able to send data to SLC or not, and how exactly a connection to SLC like this can be set up, since most tutorials for interacting with SLC appear to focus on how a human can interact with it rather than a program.  Thank you in advance for any help!

0 Kudos
Message 1 of 4
(2,420 Views)
Solution
Accepted by topic author Veets
my main source of confusion is over whether a third party [...] is able to send data to SLC or not

SystemLink Cloud uses a HTTP API for communication and the documentation is available in the HTTP API Reference topic. If you have the ability to make HTTPS requests over the internet you can likely communicate with the SystemLink Cloud APIs. NI makes LabVIEW, Python, and .NET clients available that call into the HTTP API that you could reference as examples.


Milan
Message 2 of 4
(2,367 Views)
Solution
Accepted by topic author Veets

Was curious so for fun I made an example of updating a SystemLink Cloud tag using the Arduino WIFI support. As a hobby I have the Arduino MKR Vidor 4000 and was able to get it to update a tag on SystemLink Cloud.

 

I started with the Arduino WiFi Web Client Repeating example and made some tweaks:

  • Use connectSSL and port 443 so that the requests go over HTTPS
  • Modified the server address to be api.systemlinkcloud.com
  • Implemented the PUT /v2/tags/{workspace}/{path}/values/current HTTP method as shown on api.systemlinkcloud.com

I will say that developing and debugging the Arduino WIFI support was pretty tough. I think it would be a better experience to use the LabVIEW RaspberryPI support and the LabVIEW SystemLink Client APIs for this kind of application.

 

If you do try and use the attached example you need to do a few steps first: create a tag of type double, find the workspace of the tag, and create a SystemLink Cloud API Key that can write to the tag.

Create a tag of type double

  1. Goto https://www.systemlinkcloud.com/data/tags and press the CREATE button
  2. Create a tag of type Double and give it a name, for example, my-arduino-tag
    MilanR_0-1688666396242.png
  3. After choosing a name and setting the type as Double, press CREATE to finish making the tag

Find the workspace of the tag

  1. Make sure you are currently logged in to SystemLink Cloud by visiting https://www.systemlinkcloud.com/data/tags and making sure you can see your tags.
  2. Visit the tag api endpoint for your tag name to find the workspace info at https://www.systemlinkcloud.com/nitag/v2/tags/<YOUR_TAG_NAME>, for example, for the tag name my-arduino-tag you would visit https://www.systemlinkcloud.com/nitag/v2/tags/my-arduino-tag and see a response similar to the following:
    MilanR_1-1688666915861.png
  3. Save the workspace to use in the arduino example.

Create a SystemLink Cloud API Key

Follow the Creating an API Key help topic and save the api key to use in the arduino example.

Run the attached example

  1. I'd strongly recommend you get the Arduino WiFi Web Client Repeating example working first. I had to work through a bunch of issues but it might be because the Arduino MKR VIDOR 4000 that I was using is an older, poorly supported product.
  2. Download the attached example and follow the TODO comments to make some updates:
    • Update the arduino_secrets.h to specify your SECRET_SSIDSECRET_PASS, and SECRET_SYSTEMLINK_CLOUD_API_KEY.
    • Update the tagPath to use the tag name you chose above.
    • Update the tagWorkspace string to use the workspace you found above.
  3. Run the example and best of luck! (debugging was not very fun for me).

 


Milan
Message 3 of 4
(2,338 Views)

Oh my goodness, this is fantastic, it should be perfect for what I'm doing!  Thank you so, so much for your help!!

0 Kudos
Message 4 of 4
(2,311 Views)