In this example, we'll connect a device to the internet, access it via the IoT.Cafe website, make changes to its properties and update its project.
Here, we'll not discuss how a project is made and how it's uploaded to your device.
If you need information on that, you can check out
- Weblink example
- Meteo station example
Hardware you'll need:
ESP32 main board
Add Wi-Fi to the project
First, we need to give our device access to the internet.
Since we're using ESP32 as a main board which has integrated Wi-Fi, we just need to have an accessible wireless network in range and provide our device with this network's name and password.
It's like when you connect to a Wi-Fi with your phone and you need to enter the network name and password.
Do this by adding the Generic WiFi peripheral to the project and enter a WiFi name and password.
Now our device can access the internet!
Add Weblink to the project
Next, let's make our device able to interact with the internet by adding a Weblink peripheral.
The, set the Weblink peripheral's Web Feed and Web Relay values to 1 in order to enable them. Set its Feed Interval value to 60 - this will make the device send its readings once every 60 seconds.
We don't want too small an interval, so we wouldn't needlessly lose our web relay quota. In the same time, the larger the interval, the less data we collect and the less responsive the device is.
Now, upload the project to the device!
Once uploaded, the device will be internet-interactive and it should appear in the Devices page once it has sent some data.
Then we'll be able to see its readings and change its settings.
Access the device
The device shoule appear in the Devices page shortly after the project is uploaded.
When it does, you can select it and see the values of its properties.
You can change these values and by applying the changes, the device will be requested to update its properties with the new values.
Note, that it may take some time (up to Feed Interval seconds) for the device to get updated.
Note that you can also update the project, which is running on the device, or even upload a whole new project altogether.
To do that, in the device's page, below where its properties are, select a project and apply the update.
As with updating the properties, this is won't happen instantly.
In addition to using a Wi-Fi network to access the internet, your device can also access it via the GSM data network - much as your phone does.
To learn how to do this, check out the GSM example.