This website uses cookies to enhance your browsing experience, analyze our traffic, and optimize our advertising efficacy as described in Quectel Cookies Policy. We also share information about your use of our site with our carefully-selected advertising and analytics third-parties to achieve the purposes set out in our Cookies Policy. To see what cookies we serve and set your preferences, please click the Find Out More link. By continuing your visit on our website, you consent to our use of cookies in accordance with Quectel Cookies Policy. Find Out More
Accept

Taste the NB-IoT Flavor - Part 2

 
NB-IoT Data Transmission Using BC95-G Shields [Episode 2] - NB-IoT CLOUD Upload Howto
 
 
 

Next, I will show you how to upload sensor data to cloud using NB IoT UDP and JSON. Our friends from AllThingsTalk (Belgium located CLOUD solution provider) offer free CLOUD based NB IoT services - having very convenient and versatile UDP messaging API (w. JSON, CBOR and ABCL data packing). Really GREAT JOB!


In a nutshell, the xyz-mIoT shield Vbat and Vraw voltages are read and then uploaded to the AllThingsTalk cloud each 120secondes.


u-GSM BC95-G shield and Arduino NANO note: If you intend to run these examples using u-GSM BC95-G shield, the Vin / Vraw data can be sampled can from Arduino NANO A1 and A2 pins (readVoltages() function in code bellow). To do this, just add #define Vbat A1 and #define Vraw A2 somewhere in the begining of the Arduino code.


Native "NB IOT [UDP mode] itbrainpower.net class" is used, exactly as in step1. We've choose for UDP data uploading the JSON packing - see in buildJsonPayload() function - adapted for AllThinkTalk UDP data format.

 

Required time: 10-15 minutes [5-10 minutes if you already performed episode 1 of this demo].

 

Difficulty: beginner - intermediate.

 

Bill of materials: the very same as used for episode 1.
 

Step 1 Hardware 


Use the very same hardware as described in NB-IoT Data Transmission using BC95-G shields epidose1 - steps 1 and 2 If your previously run the NB-IoT UDP part 1 test, skip to next step.

 

Step 2 Software Download and Install & Software Settings


Follow the setup steps as described in NB-IoT Data Transmission using BC95-G shields episode1  - step 3 points a and b. If your previously run the NB-IoT UDP part 1 test, skip to next instruction.


c. Make a folder named "xyz_mIoT_NBIoT_Class_example_AllThingsTalk".

d. Copy the code here and paste it one new file and save the file as "xyz_mIoT_NBIoT_Class_example_AllThingsTalk.ino" in the folder created in previous step.
Alternate, you may start the "xyz_mIoT_NBIoT_Class_example_AllThingsTalk" example found in Arduino under "File/Examples/itbpNBIoTClass".


e. Update some settings in h files inside "itbpNBIoTClass":
- in "itbpGPRSIPdefinition.h" update the APN value, using the APN value of your NB IoT provider (In test was: "eggsn-test-3.connex.ro" for Vodafone Romania)
- in "itbpGPRSIPdefinition.h" update the NETWORKID with numeric network id code for your NB IoT provider ("22601" for Vodafone Romania, "20610" for Orange Belgium)
- in "itbpGPRSIPdefinition.h" update the LTE_BAND with numeric band code used for NB IoT service (20 - LTE band B20 for Vodafone Romania)
- in "itbpGPRSIPdefinition.h" update the SERVER_ADDRESS and SERVER_PORT with values “40.68.172.187” and “8891” - AllThingsTalk UDP server address and port
- in "itbpGSMdefinition.h" goto lines 60&61 and choose from declaration __ itbpModem__ xyzmIoT or __ itbpModem__ uGSM
- in "itbpGSMdefinition.h" goto lines 64&65 and select __Qmodule__ BC95G"

 

Step3 AllThingsTalk cloud [create new account, new device and associate new sensors]


a. Go to AllThingsTalk cloud and make a new account.


b. Select "DEVICES" section, then click on "NEW DEVICE" button.

 

Scroll down the interface and choose "Your own" device. Name the device as: " my amazing xyz-mIoT BC95-G NB-IoT shield" ;), then click the "CONNECT" button to save the new created cloud device.

 

c. Create xyz-mIoT shield Vbat and Vin sensors. Click on "CREATE ASSET" and write "Vbat" in "Name" field, then "Choose type" as "number". Confirm new declared sensor (click on "CREATE ASSET").

 Repeat the same guidlines to declare the "Vraw" as sensor.
 
d. Copy your new created device token and ID. Click on "SETTINGS" button (placed in top-right corner of the screen), click on "Authentication" option.
 

Copy the "Device ID" and "Device Tokens" values and keep them for next step 4 (use those values in the Arduino code as is show below).

 

Step4 Arduino [compile, upload and run the NB-IoT upload sensor data to cloud]


Open in Arduino[(arduino.cc v >= 1.8.5] the xyz_mIoT_NBIoT_Class_example_AllThingsTalk.ino project.


a. Use previously copied "Device ID" and "Device Token" values to setup the "DEVICE_ID" and "DEVICE_TOKEN" parameters in Arduino code.

 
Save the Arduino code. Now all are set for code compiling.

b. Select board [xyz-mIoT shield, or Arduino Nano when run the test with u-GSM shield] and the programming port [bellow, picture example for xyz-mIoT boards].
 

HINT [xyz-mIoT boards only]: In order to upload the code, you must press twice (fast) the xyz-mIoT shield RESET button [the board will switch into programming mode].

c. Compile and upload the code.


In order to visualize the debug output, use the Arduino Serial Monitor or other terminal by selecting the debug port with following settings: 57600bps, 8N, 1.
The xyz-mIoT shield Vbat and Vraw voltages are read and then uploaded to the AllThingsTalk cloud each 120secondes. Uploaded data can be seen in AllThingsCloud interface via "PINBOARD"...btw: create yours.

 

Stay abreast of our new products and services by checking Quectel website:  www.quectel.com regularly or contacting: info@quectel.com

 

About RDSS

 

R&D Software Solutions - Romanian embedded hardware and software solution provider - implements their original and innovative concepts and ideas into smart IoT platforms and solutions. Our Low Power LTE/LTE/3G/GSM modems design allows engineers to implement IoT solutions by facile integration with SBCs (single-board computers as Raspberry PI, BeagleBone Black, other..), Arduino shields and other micro-controllers. Deeply involved in innovation, R&D Software Solutions received in 2006 as acknowledgement for its innovative ideas, the ”GST SSC Bronze Award” between competitors like: IBM, Computer Associates, 17 European Universities and a batch of SME.

 

We are looking for distributors.

 

Universities and high schools may apply for permanent 40% discounts for all our IoT products. Write to us in order to join our educational program.

 

Orders can be done via https://itbrainpower.net/order or contact us via email: dragos@rdss.ro

 
 
 
 
 
Author: Dragos Iosub, R&D Software Solutions

https://itbrainpower.net | dragos@rdss.ro | +40745611611
Related news

Customer Service & Support

For any questions, please contact our sales, FAE and marketing team.

Contact Us