Arduino MKR1000 meets Python
With the release r2.0.7, Zerynth adds another board to its supported device list: Arduino MKR1000, a device specifically designed for IoT projects.
The MKR1000 is described as a powerful board that combines the functionality of an Arduino Zero (already supported by Zerynth) and the connectivity of a Wi-Fi Shield, with a Cryptochip for secure communication. The design also includes a Li-Po charging circuit that allows the Arduino MKR1000 to run on battery power or external 5V, charging the Li-Po battery while running on external power.
Now, programming the board in Python thanks to the Zerynth VM makes Arduino MKR1000 one of the best choices for the development of IoT battery-powered projects.
MKR1000 specifications
The Arduino MKR1000 is based on the Microchip ATSAMW25 SoC, which is part of the SmartConnect family of Microchip Wireless devices. In particular, the ATSAMW25 is composed of three main blocks:
- SAMD21 Cortex-M0+ 32bit low power ARM MCU
- WINC1500 low power 2.4GHz IEEE® 802.11 b/g/n Wi-Fi
- ECC508 Crypto Authentication
The main features of the board are:
- Board Power Supply (USB/VIN): 5V
- Supported Battery: Li-Po single cell, 3.7V, 700mAh minimum
- Operating Voltage: 3.3V
- Digital I/O Pins (DIO): 14
- Analog Input Pins (ADC): 7
- UARTs: 1
- SPIs: 1
- I2Cs: 1
- Flash Memory: 256 KB
- SRAM: 32 KB
- Clock Speed: 48 MHz
- Size (LxW mm): 61.5 x 25.0
Go to the dedicated page of the Zerynth Docs to get more info about this board.
Get started with Arduino MKR1000 and Python
Download and Install Zerynth Studio
First of all, of course, you have to download and install Zerynth Studio, our cross-platform IDE for embedded and IoT development. If you didn’t do it yet, download it here for free! Once you’ve installed it, open Zerynth Studio and create a Zerynth user account.
Connect and Virtualize the board
To recognize the device, Windows machines require drivers that can be downloaded from the official Arduino MKR100 page, while OSX and Linux machines will recognize the board automatically.
Once connected to a USB port, if drivers have been correctly installed, the Arduino MKR1000 board is recognized by the Zerynth Studio and listed in the Device Management Widget.
To register and virtualize the board, Arduino MKR1000 MUST be put in virtualization mode by double-clicking the RST button.
Then select “Arduino MKR1000 Virtualizable” on the Device Management Widget and register the device by clicking the “Z” button.
Put the board in virtualization mode by double-clicking the RST button and create a Zerynth Virtual Machine for the device by clicking the “Z” button for the second time. Now you can virtualize the device by clicking the “Z” button for the third time. You can find more info about the virtualization process in the relative doc.
Clone the “Blink” example and uplink it to the Arduino MKR1000
Now you can start to program your Arduino MKR1000 in Python!
Zerynth Studio includes a lot of examples that you can clone with just a few clicks.
Let’s start with the “Blink” example. You can find it in the “Examples Browser” panel or you can use the “Quick Search” feature, searching for “Blink”.
Let’s take a look at the code in the “main.py” file. The Python script is very easy:
Clicking the third button of the toolbar you can get the pin map of the device. As you can see from the figure, the onboard LED is connected to the pin D6. However, Zerynth abstracts the board layout allowing to use LED0, LED1, etc as led names. In this example, LED0 is used.
Once you have cloned the example, uplink the code to your board and reset the device by pressing the RST button when asked.
Done! Now you can see the LED of your MKR1000 turn ON and OFF thanks to a Python script running on the board!
Enabling IoT Security using Arduino MKR1000 and Zerynth
A plus of this board is its ability to access to a WiFi network through a wifi chip with SSL/TLS hardware support.
Zerynth helps you exploit this functionality in an easy and effective way: you just need to import the lib.microchip.winc1500 library in the Zerynth script!
(Of course, also root certificates must be loaded on the chip. See more here: Certificate Uploading.)
An example to simplify your job and let you get started with a few clicks is already available: just clone the “Secure HTTP” example as done for the “Blink” example and you’re almost done!
Below you can see the code. You have just to change “Network-Name” and “Wifi-Password” to match your actual network configuration and edit the lines related to the creation of the “SSL context”, as follows. Easy, isn’t it?
This simple script connects to https://www.howsmyssl.com/a/check and displays info about the SSL/TLS connection on the serial monitor, as you can see in the figure above. Take a look at the ssl module in the standard library to spot how to expand this example.
Enabling Power Saving for battery-powered IoT devices
One of the most important challenges of battery-powered IoT devices is how to maximize battery life.
To meet this specification, Zerynth has included the “Firmware Over-the-Air” feature within the Zerynth Virtual Machine, which also includes industrial-grade features like Power Saving and Hardware-driven Secured Firmware burned on the device at industrial volumes.
Share This Story, Choose Your Platform!
Follow Zerynth on
Latest Posts