Make data from IoT Arduino Cloud useable within another webpage ?

Hi there,

I'm totally new to arduino cloud.

I'd like to know if you had some links, pointers, stuff about how to use data from arduino clouds (basically variables) from another webpage for visualization purpose for instance.

For example, depending on temperature measurement, I'd like to change the color of my page background.

Any advices/links would be very appreciated.

Hi!

Welcome to this amazing world of the Arduino Cloud! :wave:

You have several ways to do what you describe. Any procedure is basically based on the idea of accessing remotely the data or pushing it from the cloud to any of your servers.

You can access your devices' data through the API and embed any call to the IoT Cloud in your web page. Here you have the documentation:

If you want to receive the information as soon as there is a data change instead of polling, you can use webhooks. Here you can find some guidance:

I hope this helps!

1 Like

David, thanks a lot :slight_smile:
We'll have some devices in the studio here, sensing the sound, the light level intensity in the street in Marseille, and displaying it on a kind of art way :slight_smile:

Will post asap.

Would you have a basic example of node-js running and retrieving a variable current value ? or as a time series ?

I'd suggest getting started with the examples in the github project.

Please, check this out:

1 Like

Hi there, I almost achieved to make it.
I can get all updates from a property from a node-js script running (within Max 8 framework)

The code is :

const { ArduinoIoTCloud } = require('arduino-iot-js');
const thingId = "XXXX"
const variableName = "XXXX"

const options = {
    clientId: "XXXX",
    clientSecret: "XXXX",
    onDisconnect: message => {
        console.error(message);
    }
}

ArduinoIoTCloud.connect(options)
  .then(() => {
    console.log("Connected to Arduino IoT Cloud broker");
    return ArduinoIoTCloud.onPropertyValue(thingId, variableName, showUpdates = value => console.log(value));
  })
  .then(() => console.log("Callback registered"))
  .catch(error => console.log(error));

Would you help me to get a time series ? for instance, I'd need the 1000 freshest values from that property from that thing.

I'm also struggling to get the updates from more than one property.
Should I do twice the same code ? I guess this is not efficient as we can put more than one callback no?

On the pure webpage side, I didn't achieve to do this.
I'd like to do the same and get back 1000 values, and use them in a webpage.
Still didn't achieve it.

Would you have an example or a link about this same concept but used within a web page?

I'd like to use data logged in the arduino cloud with a processing js code running within a client getting a web page

This is about data viz

Unfortunately, there is no specific web example.

What's exactly the issue/error you have when you embed the code in a webpage?

I still don't have an issue or an error.
One of the projet I need to make is a data visualization.
I'd basically want to use processing js published in a webpage, retrieve the n-last values of a timeseries, and make visuals with that.

MQTT could be interesting. Igoe posted this: MQTT Examples | mqtt-examples
But in that case, and AFAIK, I think I'd get only messages (values) posted on the fly. Not a timeseries historical.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.