FiPy NB-iOT

Publish an Event to Wia with FiPy over NB-iOT

enter image description here

In this tutorial , we will be using a FiPy to send data and publish an event over NB-IoT to the Wia Platform

Before we start , there is a few steps we must follow as preparation for what's to come . These steps involve upgrading and updating all firmware for all parts of your python boards and chips to communicate with each other accordingly

  • Pysense / Pytrack / Expansion Board - follow this tutorial here

  • FiPy - follow this tutorial here

    Note: Ensure the SD Card you use is formatted as FAT32 instead of FAT like indicated in below tutorial

  • Modem - follow this tutorial here

Now that all your hardware components are in check and ready , lets move onto and prepare the software components

Setup Your Development Environment

We'll be using Visual Studio Code as our development environment. You can download the latest version from here.

Once you've got it setup, install the Pymakr plugin as indicated in this tutorial to get it setup.

​​

Connect to the Board​

Via USB

You can do so either via the USB port on the Expansion Board, Pysense or Pytrack boards (more on that here).

undefined

Get Device Name

Once you've got it connected to your computer, get the name of your device using one of the following steps:

Linux and Mac OS X

  • ​Download and install the FTDI drivers from here. Select the appropriate version for your operating system and architecture.
  • Open a terminal window and run the command ls /dev/tty*
  • Look for a device with the name that begins with /dev/tty e.g. /dev/tty.usbmodemPy343431 on MAC or/dev/ttyUSB0/dev/ttyACM0 on Linux.

For Linux, you may need to run the two commands below. Once you've completed that, reboot your computer. This will add permissions that will allow you to upload a sketch to the board.​

sudo usermod -a -G tty ${USER} sudo usermod -a -G dialout ${USER}

Windows

  • ​Download and install the FTDI drivers from here. Select the appropriate version for your operating system and architecture.
  • Open the Windows start menu and search for Device Manager
  • The COM port for the Pycom device will be listed as USB Serial Device or something similar
  • Keep note of the COM port (e.g. COM4)

Pytrack and Pysense will work out of the box for Windows 8/10/+, Mac OS as well as Linux. If using Windows 7, drivers to support the boards will need to be installed. You can find them here

​Setup Your Project

  • Create a new folder on your computer (eg. Wia_Publish_Event_FiPy) and open it with VSCode
  • In this folder, create two new files
Bash
Copy
  • Open these files in the code editor (eg. VSCode)

Publish An Event

  • Copy and paste the code below into the boot.py file. View here on GitHub.
Python
Copy
  • Copy and paste the code below into the main.py file. View here on GitHub.
Python
Copy

Replace the following values of the following variables:

  • ​INSERT_DEVICE_KEY with your device secret key. You can find this in your Device Configuration page (see screenshot below).
  • INSERT_BAND_NUMBER with the band number given by your operator.
  • INSERT_APN_HERE with the APN given by your operator

undefined

Your folder structure should now look like this:

Wia_Publish_Event_FiPy (Folder)

- boot.py

- main.py

enter image description here

Click Upload in the Pymakr plugin at the bottom of your window in VSCode and send the code to your Pycom board.

enter image description here

Now go to your device in the Wia dashboard and you should see the data appearing in the debugger.

enter image description here

enter image description here

Congratulations and Well Done on completing the tutorial, hope you enjoyed it. B)

Here's another tutorial you can do using your TFT screen module -

Get the beer of the day to display on your TFT screen

If you are more into building and making your own electronic devices and hooking them up to the cloud, why not out some of these tutorials -

Coffee Counter with TFT Screen and Button

Slack Toggle Presence with Wia Button Module and Dot One

or build something from our hackster projects

Wia Hackster Projects

Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard