MKR1000 Windows Remote Arduino with Firmata WiFi

MKR1000 Windows Remote Arduino

This MKR1000 Windows Remote Arduino with Firmata WiFi guide lays out how I got my new MKR1000 working with Windows Remote Arduino. This guide will walk through:

  1. Setting up the latest Firmata Version with the WiFi support
  2. Verifying with the Windows Remote Arduino Experience App
  3. Controlling MKR1000 with Universal Windows App


After going through this guide you should be able to do this:

MKR1000 Windows Remote Arduino
MKR1000 Windows Remote Arduino
Setting up latest Firmata with WiFi Support

As of this writing, the Firmata library version 2.5.2 has the WiFi transport support created by Jesse Frush.

There are two ways to get this latest version on to your Arduino IDE.

a) Arduino Library Manager:

If you have already installed the latest version of the Arduino Environment, you can navigate to Sketch > Include Library > Manage Libraries and search for “Firmata” .. If you see the 2.5.0 version like this in the below screen shot you need to upgrade it.

Firmata 2.5
Firmata 2.5

Select the library and see if you get the “Update” button. If you don’t get the update button, it means the library definitions are not yet in sync with the Arduino IDE. So you might have to install it manually by following option b) below.

b) Manual update using the “Add Zip Library…”

The latest version of the Firmata library is available in the following github location. Anything at 2.5.2 or above should get you going.

https://github.com/firmata/arduino/releases

Depending on your Arduino IDE Version choose the appropriate firmata zip folder. In my case my Arduino IDE version is 1.6.7.  So I downloaded the Arduino-1.6.x-Firmata-2.5.2.zip file. Always check for latest.

You need to first remove existing Firmata library before you update it with the new version. You should find the Firmata library in the following folder on windows.

C:\Users\yourusername\Documents\Arduino\libraries

If you don’t find it in the above folder, check the following folder also

C:\Program Files (x86)\Arduino\libraries\

Delete  that Firmata folder.

Now you can go to Sketch>Include Library> Add Zip Library  and choose the downloaded “Arduino-1.6.x-Firmata-2.5.2” zip file.

Now if you go back to the Sketch > Include Library > Manage Libraries and search for Firmata you should see the version 2.5.2 installed.

Firmata 2.5.2
Firmata 2.5.2

You are now all set with the latest Firmata library that has wifi support.

In addition, you might find an additional Firmata library under C:\Program Files (x86)\Arduino\libraries\

Now before you fire up the next steps, you might want to get the following two libraries also updated to their latest versions.  a) WiFi101 and b)RTCZero.  If you cannot do it through Manage Libraries, you can always do it manually. Locations of the latest releases are :

https://github.com/arduino-libraries/WiFi101/releases

https://github.com/arduino-libraries/RTCZero/releases

Updating the WiFi Config for MKR1000

1. On the Arduino IDE load the StandardFirmataWiFi sketch from File>Examples>Firmata

2. Switch to the wifiConfig.h tab. This contains all the wifi configuration needed for the different shields. By default the config is enabled for Arduino WiFi Shield. To enable it for MKR1000, you need to comment this line with a “//” in front of it

#define ARDUINO_WIFI_SHIELD

and uncomment the following line by removing the “//”

//#define WIFI_101

Move down and make sure to update the ssid , comment or uncomment either WPA or WEP section based on your WiFi Network and wpa_passphrase or wep_key accordingly. There is also a WIFI_NO_SECURITY option if your WiFi doesn’t require any password.

3. As far as the IP Address and the Port configuration is  concerned, the default IP is obtained through DHCP and the default port is 3030. You can change these configurations if you want. If you don’t change, then you need to know the IP address that your MKR1000 will be assigned. For that you can run the sketch with the debug flag on so that you can open the Serial monitor and see the WiFi status of your MKR1000.

Uncomment the following line on the top section in the StandardFirmataWiFi file:

//#define SERIAL_DEBUG

You should now be able to compile and upload the sketch to MKR1000. After successful upload you should see something like this in the serial monitor depending on your config:

MKR1000 Firmata Wifi connection
MKR1000 Firmata Wifi connection

 

 

 

Now that you have the successfull WiFi connection from your MKR1000 and the StandardFirmataWifi is listening on IP Address and default port (3030) you are ready to fire up the WRA app and verify.

Verifying with the Windows Remote Arduino Experience App

1. On your Windows 10 machine, if you have already installed Windows Remote Arduino Experience App you can go to next step. Otherwise install it from the Microsoft store.

2. On the Lets connect an Arduino screen, choose connection type as “Network”, type in the IP address from the MKR1000 and the port as 3030 and connect.

Windows Remote Arduino Network Serial Connection
Windows Remote Arduino Network Serial Connection

 

If everything is good and there is no firewall restrictions, the Windows Remote Arduino Experience App should take you to the next screen.

3. In the next screen, make sure Pin 6 is set to Output and toggle the value to 5v. You should now see the MKR1000 LED turn on. You are now all set to rock the MKR1000 with Windows Remote Arduino.

MKR1000 on board LED is Pin #6
MKR1000 on board LED is Pin #6

 

MKR1000 Windows Remote Arduino with Universal Windows App

Now that MKR1000 is ready, you can whip a Universal Windows App and connect to MKR1000 using Windows Remote Arduino.

Earlier I wrote about connecting an Arduino Yun Serial Port over TCP and controlling it with Windows Remote Arduino. The same code can be utilized to do verify the connection to MKR1000.

Here is the walkthrough and Code for connecting to the Yun over WiFi through Universal Windows App . You can refer to it and make appropriate changes to replace the correct IP Address, PORT and LED pin number (2) and you should now be controlling the MKR1000.

Here is my updated code that connects to MKR1000 and turns the LED on.

 //Created by Mohan Palanisamy 
       public MainPage()
        {
            this.InitializeComponent();

            this.InitArduino(); //Init Arduino connection
        }

        Microsoft.Maker.RemoteWiring.RemoteDevice arduino;
        Microsoft.Maker.Serial.NetworkSerial netWorkSerial;

        public void InitArduino()
        {
            //Establish a network serial connection. change it to the right IP address and port
            netWorkSerial = new Microsoft.Maker.Serial.NetworkSerial(new Windows.Networking.HostName("192.168.1.233"), 3030);

            //Create Arduino Device
            arduino = new Microsoft.Maker.RemoteWiring.RemoteDevice(netWorkSerial);

            //Attach event handlers
            netWorkSerial.ConnectionEstablished += NetWorkSerial_ConnectionEstablished;
            netWorkSerial.ConnectionFailed += NetWorkSerial_ConnectionFailed;

            //Begin connection
            netWorkSerial.begin(115200, Microsoft.Maker.Serial.SerialConfig.SERIAL_8N1);
        }

        private void NetWorkSerial_ConnectionEstablished()
        {
            arduino.pinMode(6, Microsoft.Maker.RemoteWiring.PinMode.OUTPUT); //Set the pin to output
            
            //turn it to High. The RED LED on Arduino Yun should light up
            arduino.digitalWrite(6, Microsoft.Maker.RemoteWiring.PinState.HIGH); 
        }

        private void NetWorkSerial_ConnectionFailed(string message)
        {
            System.Diagnostics.Debug.WriteLine("Arduino Connection Failed: " + message);
        }

Hopefully this guide helped you to get you going with interfacing MKR1000 Windows Remote Arduino over WiFi. Leave a comment if you have any issues.

 

7 thoughts on “MKR1000 Windows Remote Arduino with Firmata WiFi”

  1. hello,
    i am trying to implement simple standard firmata wifi between arduino mkr 1000 and windows remote arduino, but when i am trying to connect from windows remote arduino experience it is giving an “error”

    connection attempt failed : a device connection was established, but the device failed handshaking procedures.
    verify that your device is configured with standard firmata.
    message: catastrophic failure
    pin configuration not received.

    while simple standard firmata is working fine on usb port .
    please help me regarding this issue.

    1. Hardik,
      I have exactly the same error. If you find a solution (as I will too) then please post the solution here.
      Thanks, Rob

    2. Did you get the following two libraries updated to latest as well ? a) WiFi101 and b)RTCZero..
      Either you can update through library manager or see links above in the post for download from github.

  2. Hi Mohan, I’ve successfully updated my arduino IDE (v 169) WiFi101 to v0.9.1 but just can’t update the RTCZero from 1.4.3 to 1.5.0. I’ve tried all three methods (library manager, importing zip file and manual) for updating the IDE library but it always says that the 1.4.3 version is installed.
    Any suggestions as to how to get around this problem short of un- and re-installing the IDE?
    Regards, Rob

    1. Hi Mohan, I reinstalled Arduino IDE, rebooted, setup new Firewall rules to allow TCP in/out on port 3030 but still have same problem. i.e. Errors as reported by Hardik above and I’m still only able to access RTCZero 1.4.3 (not 1.5). This is a real show-stopper so any advice or recommendation from you would be greatly appreciated. Thanks in advance.
      Rob

      output on my serial monitor is (not sure if it helps)…
      StandardFirmataWiFi will attempt a WiFi connection using the WiFi 101 library.
      Using static IP: 192.168.1.113
      Attempting to connect to WPA SSID: BentleyRS-House
      WiFi setup done
      SSID: BentleyRS-House
      IP Address: 192.168.1.113
      signal strength (RSSI): -51 dBm
      TCP connection established

  3. The issue is the newest version of WiFi101 0.9.1 is causing this issue. Install 0.9.0 and it should work fine

Leave a Reply

Your email address will not be published. Required fields are marked *