Use an u-blox C027 cellular IoT Starter Kit, to connect to the IBM Internet of Things Foundation and visualize the data in real time. Customize it using ARM®mbed™ and Node-RED.
Requirements
Before you start you will need
- An u-blox C027 IoT Starter Kit (https://developer.mbed.org/platforms/u-blox-C027/) containing the following modules:
- A GSM/2G (SARA-G350), UMTS/3G (LISA-U200) or CDMA (LISA-C200) modem
- A GPS/GNSS (MAX-7Q or MAX-M8Q) receiver
- Optionally an ARM®mbed™ application shield (https://developer.mbed.org/components/mbed-Application-Shield/)
Containing the following sensors:- Temperature Sensor (LM75B)
- Accelerometer (MMA7660)
- Potentiometer
- Joystick
- A data plan from network operator (SIM card needs to be inserted on the back side of the C027)
- A USB cable and power supply.
- (https://developer.mbed.org).
Outcome
At the end of this tutorial you'll have your u-blox cellular IoT Starter Kit connected to IBM's Internet of Things (IoT) Foundation ready for you to register the device, begin a free trial and start creating cool IoT apps in IBM Bluemix.
Target Audience
Device developers, software developers or anyone who is interested in the Internet of Things (IoT) who wants to see how quick and easy it is to connect a cellular device that shares its location to IBM's IoT foundation.
Prepare
- Connect the cellular and GPS/GNSS antennas as shown in the quickstart quide fo the kit.
-
Plug your starter kit and the application shield together.
-
Insert the SIM card from your cellular network operator into the device.
-
Power the device using a power supply.
-
Connect to your computer using a USB cable, using the connect connector on the board
-
The microcontroller appears as a drive on your computer named mbed.
Type in a caption
Program
- Login to the arm mbed compiler and import the following this example:
http://developer.mbed.org/teams/ublox/code/IBMIoTClientCellularExample/ - Select the appropriate target platform (u-blox C027) in the upper right corner of the compiler.
- (optional) In somecases you need to add your SIMPIN and network operators APN settings by editing defines on line the file main.cpp
//! Set your secret SIM pin here (e.g. "1234"). Check your SIM manual. # define SIMPIN NULL /*! The APN of your network operator SIM, sometimes it is "internet" check your contract with the network operator. You can also try to look-up your settings in google: https://www.google.de/search?q=APN+list */ # define APN NULL //! Set the user name for your APN, or NULL if not needed # define USERNAME NULL //! Set the password for your APN, or NULL if not needed # define PASSWORD NULL
- Compile the example. At the end of the compile process a file will be downloaded from the browser which should be saved on the microcontroller drive.
- Press the RESET_FB button on the device to start the application
Visualize
When you plug in your microcontroller, the connection light will initially glow yellow, while the connection is established, then turn green when the connection had been made.
View the data from your device, go to https://quickstart.internetofthings.ibmcloud.com/#/ and simply enter the device ID (IMEI/MEID of the modem) and select to visualize your data. Use the IMEI/MEID printed on the modem as the device ID. If you have a mbed application shield mounted you can use your cursor to see your devices ID on the display.
Know where your device is
The device is sening its exact location to the Cloud. The location is determined by the onboard GPS/GNSS receiver. Make sure that the GPS/GNSS antenna of is placed with good visibility to the sky. The green LED next to MAX module will start flashing when the position is available.
Whenever the position of the device changes an json event is sent to the cloud.
iot-2/evt/gps/fmt/json
The event has the following payload format were xx.xxx will be replaced with the true location:
{
"d" :
{
"lat": "xx.xxxxxxx",
"long": "xxx.xxxxxxx"
}
}
Use Alternative Hardware
Alternatively you can run this recipe also on different hardware using the cellular and positining shield from Embedded Artist (http://www.embeddedartists.com/products/acc/cell_pos_shield.php) and possibly the ARM®mbed™ Starter Kit (https://developer.ibm.com/remix/tutorials/arm-mbed-iot-starter-kit/). Thanks to mbed this recipe runs on all STM Nucleo boards, most Freescale and NXP arduino compatible development boards.
There are only a few changes needed to above recipe.
- Select the correct target platform during the compile process
- Plug the SIM card into the cellular and positioning shield.
Debug
The C027 also has a virtual serial port console that can be used to capture diagnostics output from the device using Teraterm / Putty.
Modem::init
Modem::devStatus
Device: LISA-U200
Power Save: Disabled
SIM: Ready
CCID: xxxxxxxxxxxxxxxxxxxx
IMEI: xxxxxxxxxxxxxxxx
IMSI: xxxxxxxxxxxxxxxx
Manufacturer: u-blox
Model: LISA-U200
Version: 22.40
Modem::register
Modem::netStatus
CSD Registration: Home
PSD Registration: Home
Access Technology: 3G
Signal Strength: -61 dBm
Bit Error Rate: 49
Operator: Xxxxxxxx
Location Area Code: xxxx
Cell ID: xxxxxxxx
Phone Number: xxxxxxxxxxxx
Modem::join
Modem:IP xxx.xxx.xxx.xxx
LOG: int main() L#442 IBM Quickstart: https://quickstart.internetofthings.ibmcloud.com/#/device/xxxxxxxxxxxxxxx/sensor/
...
In addition you can enable further modem debug messages in case you like to dig-in further. This is done by setting the debug level after the object is created in main function.
MDMSerial mdm;
mdm.setDebug(3); // enable this for debugging issues
Comments
Please log in or sign up to comment.