FC41D is a standalone Wi-Fi 802.11b/g/n and Bluetooth 5.2 module with built-in resources for Wi-Fi and Bluetooth applications. It supports Wi-Fi AP and STA modes along with low-power Bluetooth.
This tutorial will show the steps and AT commands list needed to send data to Ubidots using FC41D Wi-Fi modules.
Note: Before starting, make sure you can send AT commands to the device and receive the response. To make a simple test, try sending the
AT+QVERSION command and verify the firmware version is successfully received as the response. e.g.:
An active Ubidots account.
A FC41D based device.
Wi-Fi network SSID and Password.
Understanding how to send data through our HTTP(S) data API.
Table of contents
1. Setup Wi-Fi connection
Before an HTTPS request can be done, the module must be connected to a Wi-Fi network. The following AT command achieves that and saves the credentials so the device connects automatically at start up.
<password> with corresponding values.
2. Setup HTTP(S) parameters
In order to keep your data safe and private, HTTPS will be used to send data to Ubidots and be a little bit safer; the device will verify that in effect it is connecting to Ubidots. To achieve that, the Ubidots root PEM certificate will be saved on the device's volatile storage. This can be done at a device start-up.
First, download the root certificate and save it into a know location, then send the file with the AT command:
CONNECT as a response, transfer the raw file. You should receive an
OK if the transfer succeeds. Then, send the following AT commands to configure HTTPS connection to Ubidots server:
Remember to wait for the
OK response after each command before sending the next.
3. Send data
Build the URL according to our data API. e.g:
Remember to replace
<device_label accordingly, then setup the URL for the request with the following AT command:
Add request headers replacing
<Ubidots token> with your token:
Build the data to send and calculate its length, then make the request:
Wait for the
CONNECT response and then send the request data. After receiving
OK you can get the server response with: