How to setup an MKR1000 and publish an event or location to Wia.
Things used in this project
Story
Setup Your Environment
- Install the Arduino IDE (Integrated development environment). This is where You can download it for Mac OS X, Windows and Linux here.
Detailed instructions can be found below:
New to the Arduino IDE?
If you are completely unfamiliar with the Arduino IDE, watch this video here to give you a better understanding of how it works.
In the Arduino IDE:
- Go to menu:
Tools > Board > Boards Manager
- Search for
Arduino SAMD
. When found, clickInstall
Select board and port
In the Arduino IDE:
- Select the Arduino/Genuino MKR1000 board type by going to
Tools > Board
- Select the port that displays
Arduino/Genuino MKR1000
If no name is displayed, you can find the port with 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)
Install the required libraries
To complete the tutorial, additional libraries of functionality are required, these can be installed through the Arduino IDE in the following way:
In the Arduino IDE:
- Go to
Sketch > Include Libraries > Manage Libraries
In the search bar, Search for the below libraries. When found, click on the library. A button will appear in the bottom right of the box that will allow you to install the library.
- WiFI101
- ArduinoHttpClient
- ArduinoJson
Create a new Sketch
In the Arduino IDE:
- Click on
File > New
to create a new Sketch
- Copy and paste the publishEvent.ino or publishLocation.ino from the example code
- Add the ssid and password of your WiFI
- Add the
device_secret_key
with your device secret key from the Wia Dashboard (the one that begins withd_sk
).
In your Arduino IDE:
- Go to
Sketch > Upload
to send it to your MKR 1000
Now go to your device in the Wia dashboard and you should see the data appearing in the debugger.