Home

Awesome

#Windows Virtual Shields for Arduino (Universal Windows App)

This project lets your Arduino sketch control your Windows 10 device (phone). The only code you write is to an Arduino sketch.

This repository is a Universal Windows Application which exposes sensors and capabilities to a Windows Virtual Shields for Arduino library.

Windows Virtual Shields for Arduino is an open-source library primarily for the Arduino UNO which communicates with this open-source Windows Universal Application running on all Windows 10 devices, primarily focusing on Windows Phones. The library exposes the Phones's sensors and capabilities to the an Arduino Wiring Sketch. The following sensors and capabilities can be used from Arduino Wiring:

Sensors:

Capabilities:

##Within your Arduino Wiring Sketch, you can enable the following scenarios:

##Getting Started : Hardware

###What you need

  1. Arduino Uno or compatible device.
  2. Bluetooth module: SparkFun BlueSMiRF Silver (https://www.sparkfun.com/products/12577) and 4 wires to connect.
  3. Windows 10 phone (Lumia 520, Lumia 635)

###Set up your Arduino using the Windows Virtual Shields for Arduino library

  1. Prepare the Bluetooth module if necessary (the Bluetooth module may need to have headers soldered onto it).

  2. Except for one difference below, connect the Bluetooth module to the Arduino per your wiring diagram (BlueSMiRF wiring diagram).

    DIFFERENCE: Use pins 0 and 1 instead of 2 and 3:
    The Bluetooth TX should connect to pin 0 (Arduino RX).
    The Bluetooth RX should connect to pin 1 (Arduino TX).

###Set up your Windows 10 phone

  1. Windows 8 users can get the "Windows Insider" application from the app store. This allows the user to opt into receiving Windows 10 Technical Previews as updates.
  2. Pair the Bluetooth device in the Bluetooth settings.
    BlueSMiRF default pin code is 1234.
    NOTE: The red blinking light on the BlueSMiRF continues to blink red after a successful pairing. This is expected. It only turns green after a connecting with the application.
    When pairing you should see a device name like "RNBT-76BC" the last four characters are the last four characters of the MAC address printed on the sticker of the module.

##Getting Started : Software

###What you need

  1. Arduino IDE 1.6 or better.
  2. ArduinoJson library.
  3. This repository.
  4. Visual Studio 2015 to sideload UWA (phone app) onto developer unlocked phone.

###Set up your Arduino IDE using the Windows Virtual Shields for Arduino library

  1. Download and install the Arduino IDE.

###Set up ArduinoJson library using the Windows Virtual Shields for Arduino library

  1. From the ArduinoJson repository, branch the reporsitory or download the zip.
  2. Place the whole repository into your libraries folder (i.e. Documents\Arduino\libraries\ArduinoJson).

###Set up this repository. using the Windows Virtual Shields for Arduino library

  1. Branch this repository or download the zip.
  2. Copy the Arduino/libraries/VirtualShield folder from your repository to your Arduino library (i.e. Documents\Arduino\libraries\VirtualShield).

###Set up your Visual Studio 2015

  1. Get the Windows 10 Technical Preview tools, including Visual Studio 2015 from dev.windows.com.
  2. Load the Shield.sln from this repository (<repository>/Shield/Shield.sln).
  3. Ensure your phone is developer-unlocked run the Windows Phone Developer Registration tool installed with the tools.
  4. Deploy to your device.
  5. Run the Virtual Shields for Arduino application.
  6. In the app settings, find your previously paired Bluetooth device and Connect.

###Test your setup

  1. From the Arduino IDE, go to the menu item File->Examples->Virtual Shields->Hello Blinky. This should load the Hello Blinky example.
  2. Before downloading, temporarily remove the Bluetooth TX and RX wires from the Arduino. (There is only one serial port shared between the USB and Bluetooth. The Bluetooth interferes with the download).
  3. Download the sketch.
  4. Replace the Bluetooth TX and RX wires into the Arduino pins. (Bluetooth TX to Arduino RX and Bluetooth RX to Arduino TX).
  5. Press the Reset button on the Arduino to restart the sketch.
  6. (You should see a message on your phone and be able to interact).

##Troubleshooting:

      shield.begin();      // for default 115200 baud rate
      shield.begin(57600); // for 57600 baud rate

##Arduino Wiring Sketch : Hello World example


    #include <ArduinoJson.h>

    #include <VirtualShield.h>
    #include <Text.h>

    VirtualShield shield;        // identify the shield
    Text screen = Text(shield);  // connect the screen

    void setup()
    {
	    shield.begin();              // begin communication

	    screen.clear();              // clear the screen
	    screen.print("Hello Windows Virtual Shields for Arduino");	 
    }

    void loop()
    {
    }