Getting Started With Windows Remote Arduino PDF
Getting Started With Windows Remote Arduino PDF
com
[Link]
Copyright
free ebooks ==> [Link]
Table of Contents
Copyright
Preface
1. Preparing Development Environment
1.1 Arduino
1.1.1 Arduino Uno
1.1.2 Arduino Leonardo
1.1.3 Arduino Mega 2560
1.1.4 Arduino Due
1.2 Electronics Components
1.2.1 Arduino Starter Kit
1.2.2 Fritzing
1.2.3 Cooking-Hacks: Arduino Starter Kit
1.2.4 Arduino Sidekick Basic kit v2
1.2.5 Grove - Starter Kit for Arduino
1.2.6 DFRobot - Arduino Kit for Beginner v3
1.3 Windows 10 and Visual Studio 2015
1.4 Windows Remote Arduino
1.5 Arduino Software
1.6 Testing
2. Windows Remote Arduino for Windows 10
2.1 Setting Up Arduino on Windows 10
2.1.1 Arduino Hardware Driver on Windows 10
2.1.2 Simple Testing
2.2 Arduino and Windows Remote Arduino (WRA)
2.2.1 Configuring Arduino Board
2.2.2 Compiling Windows Remote Arduino
2.3 Windows Remote Arduino with USB
2.3.1 Wiring
2.3.2 Creating A Project
[Link]
2.3.3 Adding Reference Files for Windows Remote Arduino
free ebooks ==> [Link]
2.3.4 Configuring Windows Remote Arduino (WRA) on Project
2.3.5 Writing Program
2.3.6 Testing
2.4 Windows Remote Arduino with Bluetooth
3. Digital I/O
3.1 Getting Started
3.2 Wiring
3.3 Creating and Configuring a Project
3.4 Writing a Program
3.5 Testing
4. Analog I/O
4.1 Getting Started
4.2 Demo Analog Output: RGB LED
4.2.1 Arduino Analog output (PWM)
4.2.2 Wiring
4.2.3 Writing Program
4.2.4 Testing
4.3 Demo Analog Input: Working with Potentiometer
4.3.1 Wiring
4.3.2 Writing Program
4.3.3 Testing
5. Working with I2C
5.1 Getting Started
5.2 Writing Program
5.3 Testing
6. Servo Motor
6.1 Servo Motor
6.2 Wiring
6.3 Writing A Program
6.4 Testing
free ebooks ==> [Link]
Source Code
Contact
[Link]
Preface
free ebooks ==> [Link]
This book was written to help anyone want to get started with Arduino and Windows Remote Arduino. It describes
the basic elements of the integration of Arduino and Windows Remote Arduino.
Agus Kurniawan
Depok, June 2015
free ebooks ==> [Link]
1. Preparing Development Environment
[Link]
1.1 Arduino
free ebooks ==> [Link]
Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use
hardware and software. This board uses Atmel microcontroller series. There are many
Arduino hardware models that you can use. Further information about Arduino products,
you can visit on website [Link] .
You must one Arduino hardware to follow practices in this book. I recommend to obtain
one of the following Arduino hardware:
Arduino Uno
Arduino Leonardo
Arduino Mega 2560
Arduino Due
You can buy this product on your local electronic store. You also can order it by online.
Find it on [Link] The following is the list of Arduino store you
can buy
Because Arduino is an open-source hardware, people can build it. It’s called Arduino
compatible. Generally it’s sold in low prices.
[Link]
[Link] .
free ebooks ==> [Link]
1.2.2 Fritzing
Store website: [Link] .
You can buy Fritzing Starter Kit with Arduino UNO or Fritzing Starter Kit with Arduino
Mega.
[Link]
free ebooks ==> [Link]
[Link]
free ebooks ==> [Link]
1.2.5 Grove - Starter Kit for Arduino
Another option, you can buy this kit on
Seeedstudio, [Link]
[Link] .
[Link]
1.3 Windows 10 and Visual Studio 2015
free ebooks ==> [Link]
To develop app with Windows Remote Arduino, we use Visual Studio 2015 and Windows
10. Please install them for our development environment.
free ebooks ==> [Link]
1.4 Windows Remote Arduino
Windows Remote Arduino is an open-source Windows Runtime Component library which
allows Makers to control an Arduino through a Bluetooth or USB connection! It is
intended for Windows Runtime (WinRT) Developers who want to harness the power of
Arduino hardware using the Windows Runtime Languages. This library can be download
on [Link]
We will deploy and test program based Windows Remote Arduino on the next chapter.
[Link]
1.5 Arduino Software
free ebooks ==> [Link]
To develop application based on Arduino board, we need Arduino software. You can
obtain it on [Link] . Download Arduino IDE for Windows
platform.
Execute that setup file. Select all items on installation.
At the middle of installation process, you get security confirmation. Please click Install
button to install Arduino driver.
After completed installation, you can run Arduino at the first. You may get security
confirmation. Please give a permission by clicking Allow access button.
free ebooks ==> [Link]
[Link]
free ebooks ==> [Link]
free ebooks ==> [Link]
1.6 Testing
For testing, I used Arduino Uno R3 on Windows 10.
[Link]
2. Windows Remote Arduino for Windows 10
free ebooks ==> [Link]
This chapter explains how to work with Arduino and Windows 10 for getting started.
free ebooks ==> [Link]
2.1 Setting Up Arduino on Windows 10
After you installed Arduino software, you can plugin Arduino board into computer via
USB.
Then you run Arduino software. In general it will detect Arduino hardware include
Arduino type and model.
[Link]
free ebooks ==> [Link]
However, if you get a problem about Arduino hardware driver, you update that driver.
You can update this device driver by navigating hardware driver on the driver folder of
Arduino software installation folder.
free ebooks ==> [Link]
2.1.2 Simple Testing
Now you’re ready to get started. For illustration, I use the sample code from Arduino,
Blink. You can visit on [Link] for configuration.
For this scenario, we use attached LED which is connected on Digital 13. Open Arduino
IDE.
On Arduino software, Click File -> Examples -> [Link] -> Blink.
[Link]
free ebooks ==> [Link]
Now try to connect your Arduino into computer. Select Arduino Uno for board target. You
can select it by clicking menu Tools -> Board : Arduino Uno.
[Link]
free ebooks ==> [Link]
Furthermore, you must select Arduino port. Select menu Tools -> Port -> (your Arduino
port which already connected).
Now you can compile and upload this program into Arduino board.
[Link]
2.2 Arduino and Windows Remote Arduino (WRA)
free ebooks ==> [Link]
To communicate between Arduino and computer/tablet/embedded board based Windows
10, we can use Windows Remote Arduino. There are two types of connectivity for
Windows Remote Arduino:
I will explain them on the next section. Now we must configure Arduino board and
computer to establish a connection.
[Link]
free ebooks ==> [Link]
By default, Firmata on Arduino uses a baud rate 57600. You can change it according to
your serial port (USB) or Bluetooth, for instance, 115200. After that, please compile and
upload this program into Arduino board.
[Link]
2.3 Windows Remote Arduino with USB
free ebooks ==> [Link]
In this section, we build a blinking LED program via USB using Windows Universal app.
The USB usage is applied as a bridge to remote Arduino board.
Our scenario needs the following items:
Three LEDs
USB cable
Jumper cables
Wiring
Creating a project
Adding reference files for Windows Remote Arduino
Configuring Windows Remote Arduino on project
Writing program
Testing
Let’s start!
2.3.1 Wiring
Connect three LEDs on Digital 12, 11, 10. Other LED pins are be connected to GND.
Now you connect Arduino board to Computer via USB cable.
free ebooks ==> [Link]
[Link]
free
If done, click OK button. ebooks ==> [Link]
Then, we add our compiled files from Windows Remote Arduino (read section 2.2.2).
Add the following files (depend on your target: ARM, x64, x86):
[Link]
[Link]
[Link]
free ebooks ==> [Link]
[Link]
free ebooks ==> [Link]
You also need to configure [Link] file to enable Serial port capability.
Open [Link] file and add the following script on <Capabilities>
</Capabilities> tag.
<DeviceCapability Name="serialcommunication">
<Device Id="any">
<Function Type="name:serialPort"/>
</Device>
</DeviceCapability>
[Link]
free ebooks ==> [Link]
</Grid>
</Page>
[Link]
free ebooks ==> [Link]
[Link] += Connection_ConnectionEstablish
[Link](57600, SerialConfig.SERIAL_8N1);
[Link] = "Connected";
free ebooks ==> [Link]
}
You can see parameters on UsbSerial(). These values can be obtained from SerialPort
(USB) property which Arduino board is connected. For instance, My Arduino is
connected to COM3. You can open COM property from Device Manager.
[Link]
private void HandleUnchecked(object sender, RoutedEventArgs e)
{
free ebooks ==> [Link]
CheckBox cb = sender as CheckBox;
if ([Link] == "chkLed1")
{
[Link](LED1, [Link]);
}
if ([Link] == "chkLed2")
{
[Link](LED2, [Link]);
}
if ([Link] == "chkLed3")
{
[Link](LED3, [Link]);
}
}
We also declare TurnOffLeds() to turn off LEDs. This is connected to button clicked
event.
private void TurnOffLeds(object sender, RoutedEventArgs e)
{
[Link] = false;
[Link] = false;
[Link] = false;
}
[Link] += MainPage_Unloaded;
InitWRA();
}
2.3.6 Testing
Run this program. If success, you can see our program UI. Try to do checked on
CheckBoxs. Then, you should see lighting LED.
free ebooks ==> [Link]
[Link]
2.4 Windows Remote Arduino with Bluetooth
free ebooks ==> [Link]
WRA also support using Bluetooth to remote Arduino. You can use Bluetooth module
from SparkFun Bluetooth Mate Silver, [Link] .
Don’t forget to modify Firmata code on Arduino about baud rate.
Just connect your Bluetooth module on Tx and Rx from Arduino. Then, pair Bluetooth
module on Arduino to Bluetooth PC. Add Bluetooth capability on [Link]
file.
<DeviceCapability Name="[Link]">
<Device Id="any">
<Function Type="name:serialPort"/>
</Device>
</DeviceCapability>
On instantiate stage, you just construct connection object with BluetoothSerial() with
passing Bluetooth name.
connection = new BluetoothSerial("MyBluetooth");
[Link] += Connection_ConnectionFailed;
arduino = new RemoteDevice(connection);
[Link] += Connection_ConnectionEstablish
[Link](115200, 0);
Just it!
Now you can program as usual with RemoteDevice object.
[Link]
3. Digital I/O
free ebooks ==> [Link]
In this chapter I’m going to explain how to remote Arduino Digital I/O using WRA.
free ebooks ==> [Link]
3.1 Getting Started
In this chapter, we learn how to access Arduino digital I/O via Windows Remote Arduino.
Our scenario is to use a pushbutton and LED. If pushbutton is pressed, LED will lighting.
You can find a pushbutton on the following online store:
Sparkfun, [Link]
Adafruit, [Link]
eBay, [Link]
In this scenario, I use USB as bridge to Arduino. You can replace it by Bluetooth.
Let’s start!.
[Link]
3.2 Wiring
free ebooks ==> [Link]
Connect LED to Digital 12 on Arduino and pushbutton to Digital 11. The following is a
sample of wiring.
free ebooks ==> [Link]
3.3 Creating and Configuring a Project
Create a new project, called DigitalIoDemo. Follow instructions to create and configure
the project as explained on section 2.3.2, 2.3.3 and 2.3.4.
[Link]
3.4 Writing a Program
free ebooks ==> [Link]
We modify [Link]. Add the following namespace.
using [Link];
using [Link];
[Link] += Connection_ConnectionEstablish
[Link](57600, SerialConfig.SERIAL_8N1);
[Link](LED, [Link]);
[Link](PUSHBUTTON, [Link]);
[Link] += Arduino_DigitalPinUpdatedEvent;
InitWRA();
}
[Link]
3.5 Testing
free ebooks ==> [Link]
Now you can compile and run this program. For testing, try to press pushbutton. You
should see a lighting LED.
free ebooks ==> [Link]
4. Analog I/O
This chapter explains how to work with Arduino Analog I/O via WRA.
[Link]
4.1 Getting Started
free ebooks ==> [Link]
Arduino board provides Analog I/O which can be connected to sensor or actuator devices.
In this chapter, we try to access Arduino Analog I/O using Windows Remote Arduino.
There are two scenarios for our cases:
All scenarios use USB for connectivity between Arduino and PC.
Let’s start.
free ebooks ==> [Link]
4.2 Demo Analog Output: RGB LED
In this scenario we build a Windows Universal application to control RGB LED color
using Arduino Analog output (PWM). RGB LED has 4 pins that you can see it on Figure
below.
Note:
Pin 1: Red
[Link]
Pin 2: Common pin
Pin 3: Green free ebooks ==> [Link]
Pin 4: Blue
For Arduino Uno R3, you can see PWM pins as below.
free ebooks ==> [Link]
4.2.2 Wiring
For our testing, we configure the following PWM pins.
Arduino Mega 2560:
[Link]
free ebooks ==> [Link]
[Link] += Connection_ConnectionEstablish
[Link](57600, SerialConfig.SERIAL_8N1);
}
private void SetColor(ushort red, ushort green, ushort blue)
{
[Link](RED, red);
[Link](GREEN, green);
[Link](BLUE, blue);
}
A timer is used to running our RGB LED which consists of 6 color demo by calling
ColorDemo().
private void Connection_ConnectionEstablished()
{
[Link]("Connected");
[Link](RED, [Link]);
[Link](GREEN, [Link]);
[Link](BLUE, [Link]);
index = 1;
timer = new DispatcherTimer();
[Link] = [Link](500);
[Link] += Timer_Tick;
[Link]();
[Link]
private void Timer_Tick(object sender, object e)
{
free ebooks ==> [Link]
ColorDemo(index);
index++;
if (index > 6)
index = 1;
InitWRA();
}
private void MainPage_Unloaded(object sender, RoutedEventArgs e)
{
[Link]();
}
4.2.4 Testing
Compile and run the program. You should see several color on RGB LED.
The following is a sample demo on RGB LED.
free ebooks ==> [Link]
[Link]
4.3 Demo Analog Input: Working with Potentiometer
free ebooks ==> [Link]
In this section, we learn how to read analog input on Arduino board. For illustration, I use
Potentiometer as analog input source. Our scenario is to read analog value from
Potentiometer. Then, display it on app UI.
Let’s start!.
4.3.1 Wiring
To understand Potentiometer, you see its scheme in Figure below.
You can connect VCC to Arduino board VCC 5V. Vout to Arduino board Analog input
A0. In addition, GND to Arduino board GND. The following is hardware implementation.
I use slide potentiometer.
free ebooks ==> [Link]
</Grid>
</Page>
[Link]
using [Link];
using [Link];
free ebooks ==> [Link]
using [Link];
[Link] += Connection_ConnectionEstablished;
[Link](57600, SerialConfig.SERIAL_8N1);
}
private async void UpdateData(ushort value)
{
await [Link](Windows.
() =>
{
[Link] = [Link](value);
});
}
4.3.3 Testing
Compile and run this program. If success, you can see analog value on UI.
[Link]
5. Working with I2C
free ebooks ==> [Link]
In this chapter we learn how to work with I2C using Windows Remote Arduino.
free ebooks ==> [Link]
5.1 Getting Started
The I2C (Inter-Integrated Circuit) bus was designed by Philips in the early ’80s to allow
easy communication between components which reside on the same circuit board. TWI
stands for Two Wire Interface and for most marts this bus is identical to I²C. The name
TWI was introduced by Atmel and other companies to avoid conflicts with trademark
issues related to I²C.
I2C bus consists of two wires, SDA (Serial Data Line) and SCL (Serial Clock Line).
Arduino Uno has I2C/TWI on Analog A4 (SDA) and Analog A5 (SCL).
For testing, I used PCF8591 AD/DA Converter module with sensor and actuator devices.
You can find it on the following online store:
Amazon, [Link]
Conversion/dp/B00BXX4UWC/
eBay, [Link]
Dealextreme, [Link]
analog-converter-module-w-dupont-cable-deep-blue-336384
Aliexpress, [Link]
In addition, you can find this device on your local electronics store/online store.
[Link]
This module has mini form model too, for instance, you can find it on Amazon,
free ebooks ==> [Link]
[Link]
Development/dp/B00KM6X2OI/ .
This module use PCF8591 IC and you can read the datasheet on the following URLs.
[Link]
[Link]
[Link]
5.2 Writing Program
free ebooks ==> [Link]
Firstly, create a new project, called I2CDemo. Follow instructions to create and configure
the project as explained on section 2.3.2, 2.3.3 and 2.3.4.
The first step is to develop app UI on [Link]. We add six TextBlock to display
Analog values. The following is complete code for [Link] file.
<Page
x:Class="[Link]"
xmlns="[Link]
xmlns:x="[Link]
xmlns:local="using:I2CDemo"
xmlns:d="[Link]
xmlns:mc="[Link]
mc:Ignorable="d">
</Grid>
</Page>
The next step is to modify [Link] file. Firstly, we add our namespace.
free ebooks ==> [Link]
using [Link];
using [Link];
using [Link];
using [Link];
Declare some variables. PCF8591 uses I2C address on 0x90. To get Thermistor value, we
send a command 0x40. Photo-voltaic value can be acquired by sending a command 0x41.
The last, Potentiometer, can be acquired using 0x43 command.
private UsbSerial connection;
private RemoteDevice arduino;
private const byte NUM_DIGITAL_PINS = 14; // Arduino Uno
private const byte SDA = 4;
private const byte SCL = 5;
private const byte PCF8591 = (0x90 >> 1); // Device address
private const byte PCF8591_ADC_CH0 = 0x40; // thermistor
private const byte PCF8591_ADC_CH1 = 0x41; // photo-voltaic cell
private const byte PCF8591_ADC_CH2 = 0x42;
private const byte PCF8591_ADC_CH3 = 0x43; // potentiometer
private int index = 0;
private Queue<int> i2cReading = new Queue<int>();
[Link] += Connection_ConnectionEstablish
[Link](57600, SerialConfig.SERIAL_8N1);
[Link]
[Link] += Timer_Tick;
[Link]();
free ebooks ==> [Link]
}
On Tick event from Timer object, we read analog values from PCF8591. Then, we define
UpdateData() to update app UI.
private void Timer_Tick(object sender, object e)
{
switch (index)
{
case 0:
[Link](index);
[Link]("PCF8591_ADC_CH0"
ReadADC(PCF8591_ADC_CH0);
break;
case 1:
[Link](index);
[Link]("PCF8591_ADC_CH1"
ReadADC(PCF8591_ADC_CH1);
break;
case 2:
[Link](index);
[Link]("PCF8591_ADC_CH2"
ReadADC(PCF8591_ADC_CH2);
break;
}
index++;
if (index > 2)
index = 0;
InitWRA();
}
[Link]
5.3 Testing
free ebooks ==> [Link]
Now you can compile and run the program.
If success, you can see sensor values via I2C on app UI. The following is a sample output.
free ebooks ==> [Link]
6. Servo Motor
This chapter explains how to work with servo motor connected to Arduino board using
Windows Remote Arduino. We explore how to access PWM (Pulse Width Modulation)
Arduino.
[Link]
6.1 Servo Motor
free ebooks ==> [Link]
Servo motor provides a shaft movement 360 degree. We can control this movement based
on its degree. In this scenario, you can use any DC motor (servo) that will be connected to
Arduino. I used a mini servo from Arduino Sidekick Basic kit.
The following is a picture of my mini servo motor.
The next step we are going to build a Windows Universal with Arduino and servo motor.
free ebooks ==> [Link]
6.2 Wiring
To build hardware implementation, you can connect servo motor to Arduino by following
configuration:
[Link]
6.3 Writing A Program
free ebooks ==> [Link]
Firstly, create a new project, called ServoMotor. Follow instructions to create and
configure the project as explained on section 2.3.2, 2.3.3 and 2.3.4.
The first step is to develop app UI on [Link]. We add two TextBlock to display
servo motor angle. The following is complete code for [Link] file.
<Page
x:Class="[Link]"
xmlns="[Link]
xmlns:x="[Link]
xmlns:local="using:ServoMotor"
xmlns:d="[Link]
xmlns:mc="[Link]
mc:Ignorable="d">
</Grid>
</Page>
The next step is to modify [Link] file. Firstly, we add our namespace.
using [Link];
using [Link];
using [Link];
using [Link];
free ebooks ==> [Link]
Declare some variables. Servo motor uses PWM Digital 10. We also define a list of angle:
0, 30, 60, 90, 120, 150 and 180.
private UsbSerial connection;
private RemoteDevice arduino;
private const byte SERVO = 10;
private byte[] angles = new byte[] { 0, 30, 60, 90, 120, 150, 180
private int direction;
private bool fwd;
private DispatcherTimer timer;
[Link] += Connection_ConnectionEstablish
[Link](57600, SerialConfig.SERIAL_8N1);
On Tick event from Timer object, we read change servo motor angle. Then, we define
UpdateData() to update app UI.
private void Timer_Tick(object sender, object e)
{
[Link]("Dir " + [Link]() +
UpdateData(angles[direction]);
[Link](SERVO, angles[direction]);
if(fwd)
[Link]
direction++;
else
free ebooks ==>
direction--;
[Link]
if (direction > 6)
{
fwd = false;
direction = 6;
}
else
if (direction < 0)
{
fwd = true;
direction = 0;
}
}
InitWRA();
}
private void MainPage_Unloaded(object sender, RoutedEventArgs e)
{
[Link]();
[Link]();
}
[Link]
Source Code
free ebooks ==> [Link]
[Link]









