This documentation explains the steps taken in sending data to UCW platform using cellular-capable micro-controller (micro-controllers with SIM module). We used an example where we sent static data to our platform.
Table of Contents
1.0 Adafruit FONA 32u4 Overview
An overview of the Adafruit FONA 32u4 can be viewed for technical description of this micro-controller.
2.0 Diagram of DHT to FONA 32u4 radio connection
3.1 The GSM switch
Uncomment the appropriate switch in the UCW_Config.h file
3.2 The Config file
Edit the the config.h file by un-commenting the lines below and providing necessary information. The mobile carrier APN setting information, and token, for authentication, are required here
Include the config.h file mentioned in section 3.1 above and any library that might be needed. In this example, we do not need any additional library
3.4 deviceID and data-stream name
These variables are used to uniquely identify the FONA device and sensor data transmitted our platform. The DEVICE_ID is generated by the UCW platform and also serves as a form of authentication of the user.
3.5 connect, networkStatus, and printNetworkInfo methods
3.5.1 connect method
This method is called in the setup() section of the arduino code. It initialises the FONA module, ensures the SIM is connected to the network, and connects the device to the GPRS network of the mobile carrier. FONA 800 device type supports 2G cellular network. That means it supports GPRS, but not GPS. The GPS support was included in FONA 808. FONA 3G supports 3G networks.
3.5.2 networkStatus method
This checks the status of the attempted connection between the FONA and the cellular network. In this example, it is used in a loop to ensure the the device is connected to the network.
3.5.3 printNetworkInfo method
Relevant device and network information such as RSSI, firmware version, and SIM CCID are displayed on the serial monitor
3.6 The sys method
The sys method reconfirms that the FONA's GPS/GPRS connection is still valid. If connection is lost, it performs a reset by disabling and re-enabling the connection. This is the first method called in the loop() section of the arduino code.
3.7 The sendData method
This method takes three parameters: the device ID, datastream name, and payload . The device ID and datastream name are as earlier described in Section 3.4. The payload refers to the JSON containing the data to be sent to our server. The sendData method transfers the payload to our platform via cellular/GSM network
The full example can be found here.