ProDino MKR Versions
Examples

ProDino MKR Versions examples suggest you how to use your board.

ProDino MKR Versions Tutorials...

How to start with examples


Following next steps

  • 1
    If you don't install a board and examples, see here...
  • 2
    In Arduino IDE select File>Examples>ProDino_MKRZero>(example name)
  • 3
    Click over the button "Verify"
  • 4
    Press the button "Upload"

RS485 Echo (RS485Echo)


It works on: all devices

Prerequisites: you should connect a RS485 device on your RS485 board connector.

In this example a board works as repeater. If you sent data, the board collect it and send it back to RS485 device. For this example we connect our USB RS485 Isolated Converter V3 to the board and use Hercules SETUP utility for a test software.

ProDino MKR Zero Examples RS485Echo Debug information

Debug information

ProDino MKR Zero Examples RS485Echo Terminal

Test terminal

RS485 Relay (RS485Relay)


It works on: all devices

Prerequisites: you should connect a RS485 device on your RS485 board connector.

Here you can manage relay on the board through RS485 protocol. Get or set it status. With this functionality you can simple to scale your project if you needed more relays for example. We created a simple protocol:

  • FFR - Get relays status
  • FFR0000 - Set all relays to Off
  • FFR0101 - Set relay 1 and 3 to On
  • Caret Right
    FFR1111 - Set all relays to On
  • Caret Right
    FFRx1xx - Set only relay 2 to On, other relays keep it status
ProDino MKR Zero Examples RS485 Relay Terminal

RS485 Input (RS485Input)


It works on: all devices

Prerequisites: you should connect a RS485 device on your RS485 board connector.

We can get statuses from isolated inputs through RS485 protocol. To the manage this we created a simple protocol:

  • FFI - Get Input status
ProDino MKR Zero Examples RS485 Input Terminal

Web Relay (WebRelay)


It works on: ProDino MKR Zero Ethernet and ProDino MKR GSM Ethernet devices

If you want to change relay status through web interface this example is for yours. Follow next steps:

ProDino MKR Zero Examples Web change relay status 0000

All relays are Off

ProDino MKR Zero Examples Web change relay status 1010

Relays 2 and 4 are On

Web Input (WebInput)


It works on: ProDino MKR Zero Ethernet and ProDino MKR GSM Ethernet devices

Here you can see a board isolated input statuses showed in Web page. Follow next steps:

ProDino MKR Zero Examples Web gets relay status 0000

All inputs are Off

ProDino MKR Zero Examples Web Input 1010

Inputs 1 and 3 are On

TCP Relay (TCPRelay)


It works on: ProDino MKR Zero Ethernet and ProDino MKR GSM Ethernet devices

You can manage relay on the board through TCP protocol. Get or set it status. With this functionality you can simple to scale your project if you needed more relays for example. We created a simple protocol:

  • FFR - Get relays status
  • FFR0000 - Set all relays to Off
  • FFR0101 - Set relay 1 and 3 to On
  • Caret Right
    FFR1111 - Set all relays to On
  • Caret Right
    FFRx1xx - Set only relay 2 to On, other relays keep it status
ProDino MKR Zero Examples TCP Relay Terminal

TCP Reads Isolated Inputs (TCPInput)


It works on: ProDino MKR Zero Ethernet and ProDino MKR GSM Ethernet devices

We can get statuses from isolated inputs through TCP protocol. To the manage this we created a simple protocol:

  • FFI - Get Input status
ProDino MKR Zero Examples TCP Isolated Inputs Terminal

UDP Relay (UDPRelay)


It works on: ProDino MKR Zero Ethernet and ProDino MKR GSM Ethernet devices

Here you can manage relay on the board through UDP protocol. Get or set it status. With this functionality you can simple to scale your project if you needed more relays for example. We created a simple protocol:

  • FFR - Get relays status
  • FFR0000 - Set all relays to Off
  • FFR0101 - Set relay 1 and 3 to On
  • Caret Right
    FFR1111 - Set all relays to On
  • Caret Right
    FFRx1xx - Set only relay 2 to On, other relays keep it status
ProDino MKR Zero Examples UDP Relay Terminal

UDP Reads Isolated Inputs (UDPInput)


It works on: ProDino MKR Zero Ethernet and ProDino MKR GSM Ethernet devices

We can get statuses from isolated inputs through UDP protocol. To the manage this we created a simple protocol:

  • FFI - Get Input status
ProDino MKR Zero Examples UDP Isolated Inputs Terminal

WEB RS485 (WebRS485)


It works on: ProDino MKR Zero Ethernet and ProDino MKR GSM Ethernet devices

Prerequisites: you should connect a RS485 device on your RS485 board connector.

In this example you can communicate through RS485 via Web interface. Enter a command press transmit and see the result.

ProDinoMKRZeroExamp WebRS485 Entered data

Enter data

ProDinoMKRZeroExamp WebRS485 Received data

It is the result

WEB DHT (WebDHT)


It works on: ProDino MKR Zero Ethernet and ProDino MKR GSM Ethernet devices

Prerequisites:

  • install DHT library
  • Connect (one or two) DHT22 sensor to GROVE connector. Use pins:
    • first sensor GROVE_D0, Vcc+, Gnd(-);
    • second sensor GROVE_D1, Vcc+, Gnd(-).

Here you can see how to read temperature and humidity with DHT sensor and show them in Web page. In our example we use two sensors but and only one is enough.

ProDino MKR Zero Examples Web DHT sensor measure

Working with Blynk (BlynkOne)


It works on: ProDino MKR Zero Ethernet and ProDino MKR GSM Ethernet devices

It's an example shows how to you can use your device with BlynkBlynk is designed for the Internet of Things. It can control hardware remotely, it can display sensor data, it can store data, visualise it and do many other cool things. It include mobile application and a hardware device. Through them you can manage every connected device everywhere in the world.

PrerequisitesBefore start this an example you need to install

  • 1
    Install mobile application, see here: https://www.blynk.cc/getting-started/ 
  • 2
    Blynk library: Sketch -> Include libraryMenage Libraries... find Blynk and click Install
  • 3
    DHT library: Sketch -> Include libraryMenage Libraries... find DHT by Adafruit and click Install
  • 4
    Connect DHT22 sensor to GROVE connector. Use pins:
     - first sensor EXT_GROVE_D0, Vcc+, Gnd(-)

1. Download

 your a mobile application from http://www.blynk.cc/

2. You should register in Blynk

3. Create a new project

ProDino MKR Zero Examples Bynk One create new project

4. Adding the project name

ProDino MKR Zero Examples Bynk One project settings

5. Copy your project token

Press Create button and Blynk system send your application authorisation token on your email.

It should fill in the example code on a row:

char AUTH_TOKEN[] = "123456789012345678901234567890123";

6. Showing the widgets

PRODINo WiFi Examples Blynk

7. Adding four Button with fallows names: Relay 1, Relay 2, Relay 3 and Relay 4. Set button Mode to Switch as shown below

PRODINo WiFi Examples Blynk relay
PRODINo WiFi Examples Blynk relay
PRODINo WiFi Examples Blynk relay
PRODINo WiFi Examples Blynk relay

8. Add four LED widgets with names: In 1, In 2, In 3 and In 4

PRODINo WiFi Examples Blynk inputs
PRODINo WiFi Examples Blynk inputs
PRODINo WiFi Examples Blynk inputs
PRODINo WiFi Examples Blynk inputs

9. Adding two Value display widgets for the Temperature (set input Min from -40 and Max to 80) and the Humidity (set input Min from 0 and Max to 100).

PRODINo WiFi Examples Blynk temperature
PRODINo WiFi Examples Blynk Humidity

10. This is the application 

ProDino MKR Zero Examples Bynk One project finished

11. After you start the device, on your mobile device you see:

ProDino MKR Zero Examples Bynk One project started

Blynk via GSM (BlynkGSMTiny)


It works on: ProDino MKR Zero GSM and ProDino MKR GSM Ethernet devices

The example demonstrates how to works with Blynk through GSM connection. This example is similar the example above.

Prerequisites: Before start this an example you need to install

  • 1
    Install mobile application, see here: https://www.blynk.cc/getting-started/ 
  • 2
    Blynk library: Sketch -> Include libraryMenage Libraries... find Blynk and click Install
  • 3
    DHT library: Sketch -> Include libraryMenage Libraries... find DHT by Adafruit and click Install
  • 4
    TinyGSM library: Sketch -> Include libraryMenage Libraries... find TinyGSM and click Install
  • 5
    Connect DHT22 sensor to GROVE connector. Use pins:
     - first sensor EXT_GROVE_D0, Vcc+, Gnd(-)

1. Download

Your mobile application from http://www.blynk.cc/

2. You should register in Blynk

3. Create a new project

ProDino MKR Zero Examples Bynk One create new project

4. Adding the project name

ProDino MKR Zero Examples Bynk One project settings

5. Copy your project token


Press Create button and the Blynk system sends your application authorisation token on your email.
It should fill in the example code on a row:

char AUTH_TOKEN[] = "123456789012345678901234567890123";

Next lines include information about your GSM GPRS connection. Fill them carefully.
const char PINNUMBER[] = ""; // If your SIM card has protection with PIN number you can add it here. If it hasn't stay empty.
const char GPRS_APN[] = "xxxx"; // It is your GSM provider GPRS Access Point Name. Example: wap-gprs.my-provoder.com
const char GPRS_LOGIN[] = "xxxx"; // Login to this GPRS network.
const char GPRS_PASSWORD[] = "xxxx"; // Password to this GPRS network.

6. How to add widgets - see example above

MQTT Simple (MqttSimple)


It works on:

  • ProDino MKR Zero Ethernet
  • ProDino MKR GSM Ethernet

Prerequisites:

Before start this example you need to install (Sketch\Include library\Menage Libraries... find ... and click Install):

  • Simple DHT by Winlin
  • PubSubClient by Nick O'Leary

Connect DHT22 sensor(s) to GROVE connector. Only one we use in this example.

  • sensor GROVE_D0, Vcc+, Gnd(-);

You should have account in https://www.cloudmqtt.com/ or https://www.cloudamqp.com/ or other MQTT server (your RaspberryPI for example) 

It is so easy to manage your device form computer, tablet, mobile phone and other device with MQTT. it this example we show haw to switch relays, read temperature and humidity and check inputs.
For manage device in this example through mobile device we use MQTT Dash from Google Play. You can use any application for it.

After you get your credential from MQTT server, you should fill them in the code: server, port, user-name, password. 

ProDinoMKRZero MQTT server settings

Below you can see how the application look like:

MQTT Dash ProDino MKR Zero Dashboard 1
MQTT Dash ProDino MKR Zero Dashboard 2

In our video you can see how it works (switch subtitles to On and show every steps what do):

Steps to create the application:

Relays

Relay 1 - Type: Switch/button; Name: Relay 1; Topic (sub): kmp/prodinomkrzero/relay/1; Enable publishing (checked), Topic (pub): kmp/prodinomkrzero/relay/1/set; Update metric on publish... (unchecked); On: on; Off: off; Add pictures what you want.

Relay 2 - Type: Switch/button; Name: Relay 2; Topic (sub): kmp/prodinomkrzero/relay/2; Enable publishing (checked), Topic (pub): kmp/prodinomkrzero/relay/2/set; Update metric on publish... (unchecked); On: on; Off: off; Add pictures what you want.

Relay 3 - Type: Switch/button; Name: Relay 3; Topic (sub): kmp/prodinomkrzero/relay/3; Enable publishing (checked), Topic (pub): kmp/prodinomkrzero/relay/3/set; Update metric on publish... (unchecked); On: on; Off: off; Add pictures what you want.

Relay 4 - Type: Switch/button; Name: Relay 4; Topic (sub): kmp/prodinomkrzero/relay/4; Enable publishing (checked), Topic (pub): kmp/prodinomkrzero/relay/4/set; Update metric on publish... (unchecked); On: on; Off: off; Add pictures what you want.

Temperature & humidity

Temperature - Type: Text; Name: Temperature; Topic (sub): kmp/prodinomkrzero/temperature/1; Postfix: C°

Humidity - Type: Text; Name: Humidity; Topic (sub): kmp/prodinomkrzero/humidity/1; Postfix: %

Inputs

Input 1 - Type: Switch/button; Name: Input 1; Topic (sub): kmp/prodinomkrzero/input/1; On: on; Off: off; Add pictures what you want.

Input 2 - Type: Switch/button; Name: Input 2; Topic (sub): kmp/prodinomkrzero/input/2; On: on; Off: off; Add pictures what you want.

Input 3 - Type: Switch/button; Name: Input 3; Topic (sub): kmp/prodinomkrzero/input/3; On: on; Off: off; Add pictures what you want.

Input 4 - Type: Switch/button; Name: Input 4; Topic (sub): kmp/prodinomkrzero/input/4; On: on; Off: off; Add pictures what you want.

Get all data

Get all data - Type: Switch/button; Name: Get all data; Topic (sub): kmp/prodinomkrzero/isready; Enable publishing (checked), Topic (pub): kmp/prodinomkrzero; Update metric on publish... (unchecked); On: OK; Add picture what you want.


MQTT Base (MqttBase)


It is same as MQTT Simple example but it has more topics for data processing.

Below we describe all topics:

Topics* (these topics we send to MQTT server):
kmp:[] - it is broadcast topic. This help us to find all connected devices to MQTT, the device publishes itself name and OK: kmp/prodinomkrzero:[OK]
kmp/prodinomkrzero:[] - the device publishes all data from device:
kmp/prodinomkrzero/isready:[OK]
kmp/prodinomkrzero/relay/1:[off] kmp/prodinomkrzero/relay/2:[off] kmp/prodinomkrzero/relay/3:[off] kmp/prodinomkrzero/relay/4:[off]
kmp/prodinomkrzero/input/1:[off] kmp/prodinomkrzero/input/2:[off] kmp/prodinomkrzero/input/3:[off] kmp/prodinomkrzero/input/4:[off]
kmp/prodinomkrzero/temperature/1[22.0] kmp/prodinomkrzero/humidity/1[50]
kmp/prodinomkrzero/isready[] - we can use this topic for check if device is on line the device publishes: kmp/prodinomkrzero/isready:[OK]
kmp/prodinomkrzero/relay:[] - the device publishes all data per relays payload could be "on" or "off":
kmp/prodinomkrzero/relay/1:[off] kmp/prodinomkrzero/relay/2:[off] kmp/prodinomkrzero/relay/3:[off] kmp/prodinomkrzero/relay/4:[off]
kmp/prodinomkrzero/relay/1:[] - the device publishes data per relay 1..4 payload could be "on" or "off":
kmp/prodinomkrzero/relay/1:[off]
kmp/prodinomkrzero/relay/1/set:[on] - we use this topic to set relay 1..4 status payload could be "on" or "off":
kmp/prodinomkrzero/relay/1:[on]
kmp/prodinomkrzero/input:[] - the device publishes all data per inputs payload could be "on" or "off":
kmp/prodinomkrzero/input/1:[off] kmp/prodinomkrzero/input/2:[off] kmp/prodinomkrzero/input/3:[off] kmp/prodinomkrzero/input/4:[off]
kmp/prodinomkrzero/input/1:[] - the device publishes data per input 1..4 payload could be "on" or "off":
kmp/prodinomkrzero/input/1:[off]
kmp/prodinomkrzero/temperature:[] - the device publishes data from first temperature sensor:
kmp/prodinomkrzero/temperature/1:[22.0]
kmp/prodinomkrzero/humidity:[] - the device publishes data from first humidity sensor:
kmp/prodinomkrzero/humidity/1:[50]
*Legend: every message includes topic (as string) and payload (as binary array).
By easy describe them we use following pattern: "topic:[payload]". If payload was empty we use [].
Bold topics are command topics, the device is subscribed for them. If it received some topic the device processed it and send result - topic and payload (topic with normal font).