This module allows you to connect to the world of Internet through your Smartphone. It uses mobile data for connecting to the internet. This means that if you don’t have any wifi module like esp8266 but still, you can talk to the world. All you need is your Smartphone with a data connection, Dabble in your Smartphone and hardware with Bluetooth module and you are all ready to go!!. The module is currently under development and is able to process HTTP GET requests, however complete support for the HTTP request response will be added soon. Currently, you can perform activities like publishing data on IoT platforms like Thingspeak or any such platform that works on the HTTP protocol.
In this module, you can observe the request execution and response in real time. Request and response can also be copied by tapping on respective boxes.
The above image shows the process of updating your Thingspeak channels.
Arduino IDE Functions
To include the Inputs module in the Arduino program, you have to include the following header:
After defining the above mention headers, you have to include the dabble library:
Enabling Bluetooth Communication
To enable Bluetooth communication, you have to initialize serial communication using the following code:
For evive and Arduino Mega, Uno and Nano
Here Baud_Rate is the baud rate set for the Bluetooth module. With evive, you normally get 115200 baud rate modules.
In place of Bluetooth_Name enter name that you want to keep for Bluetooth of ESP32. Default name given in the library is “MyEsp32”.
Refreshing the data
To refresh the data that the device has got from the mobile app, you have to use the following line of code:
The following functions are available for the input module:
- sendGETRequest(URL) – pass the HTTP GET request URL as an argument in this function, it will be sent to Dabble and the processed response will be available in the response section in Dabble.
- updateThingspeakField(WRITE_KEY, Field number, Numeric Data) – This is a specific function that is meant to be used for updating the data of various fields present in your Thingspeak channel. You have to enter your write key obtained from API settings in your Thingspeak account, the field number that you want to update followed by the numeric value with which you want to update your field. There is a maximum of 8 data fields available in the Thingspeak channel.
- updateThingspeakField(WRITE_KEY, Field number, text Data) – This function is the same as above but it is for entering any text type data into the field.
- updateThingspeakChannel(WRITE_KEY, number of Fields, Numeric data1, Numeric data2, ….) – This function can be used when you want to publish data to multiple fields in one single update. For this enter your usual write key followed by the number of fields you want to update and then the numeric data for each field. Note: Make sure that you enter data in sequence this means, for example, you want to update field 1, field 2 and field3 then you should write the corresponding data. That is the data of the first field should be first, the second field should be second and third field should be third. You can skip any field as well. This means you can’t perform updates for field 1, field 2. and field 4 simultaneously, you have to enter the data of the field 3 as well. You cannot break the sequence.
- updateThingspeakChannel(WRITE_KEY, number of Fields, text data1, text data2, ….) – The function works the same as the above one but it is for updating fields simultaneously with text type of data. Here also the field data should be entered sequentially.
PictoBlox (Scratch) Blocks
The support for the Internet module will be added soon on PictoBlox.
Mega, Uno, and Nano
Examples for PictoBlox will be available soon.