I got my Ardunio
I got my Arduino uno board last week, purchased from online snapdeal store, the interest thing is now windows supports arduino .
The Windows Remote Arduino help you to control arduino from windows 10 Universal Windows Platform ( UWP) and windows 8.1 universal applications,
that means you can control arduino from windows pc or Windows Phone using either USB or Bluetooth.
Check the following link for more information.https://ms-iot.github.io/content/en-US/win10/SetupPCWRA.htm
come lets play with hardware
My first experience with Arduino
I have successfully completed the “Blink” sample with Windows Remote Arduino library.Parts Required to do this experiment:
Hardware
|
Software
|
|
|
Load the StandardFirmata to the arduino:
Before jump into arduino remote setup, please check this link to know more details about Arduino.The Windows Remote Arduino uses the standard frimata to communicate with Ardunio, the standard firmata is a protocol to make communication between microcontroller and Software.
! We need to load the standard firmata into the ardunio to establish the communication between arduino and software.
you can find the StandardFirmata sketch in Ardunino IDE itself.
Connect the ardunio board into the computer using USB cable, select the device and com port in IDE and upload the Standard firmata sketch in to the Arduino.
Now the standard firmata is uploaded into the microcontroller, the program continuously get running when you power up the Arduino board, next we will setup the software's.
Make the Windows application to control Ardunio:
Install visual studio 2015 in windows 10 OS and create a new UWP application in IDE and add the following projects into the application as reference.Already the great details given in the Windows Remote Arduino site, please refer the steps to create a UWP application and corresponding library to make communication with Arduino.
also setup the device capability in your application.
! With proper enabling of USB and Bluetooth capabilities you can communicate with Arduino smoothly
Note:
Windows 10 Supports both USB and Bluetooth
Windows 8.1 currently supports only Bluetooth
Adding the logic into the project to control Arduino:
Set up the circuit as given the below image.I used USB to make communication with Arduino board and PC, use the below code in your project.
[C#] using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.InteropServices.WindowsRuntime; using Windows.Foundation; using Windows.Foundation.Collections; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls.Primitives; using Windows.UI.Xaml.Data; using Windows.UI.Xaml.Input; using Windows.UI.Xaml.Media; using Windows.UI.Xaml.Navigation; using Microsoft.Maker.Serial; using Microsoft.Maker.RemoteWiring; namespace RemoteBlinky { /// <summary> /// An empty page that can be used on its own or navigated to within a Frame. /// </summary> public sealed partial class MainPage : Page { UsbSerial usb; RemoteDevice arduino; public MainPage() { this.InitializeComponent(); /* * I've written my Arduino device VID and PID as a parameter to the BluetoothSerial constructor. You should change this to your * device VID and PID if using USB. You can also use the UsbSerial.listAvailableDevicesAsync() function to list * available devices, but that is not covered in this sample. */ usb = new UsbSerial("VID_2341", "PID_0043"); //I've written in my device D directly arduino = new RemoteDevice(usb); usb.ConnectionEstablished += OnConnectionEstablished; //SerialConfig.8N1 is the default config for Arduino devices over USB usb.begin(57600, SerialConfig.SERIAL_8N1); } private void OnConnectionEstablished() { //enable the buttons on the UI thread! var action = Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, new Windows.UI.Core.DispatchedHandler(() => { OnButton.IsEnabled = true; OffButton.IsEnabled = true; })); } private void OnButton_Click(object sender, RoutedEventArgs e) { //turn the LED connected to pin 5 ON arduino.digitalWrite(13, PinState.HIGH); } private void OffButton_Click(object sender, RoutedEventArgs e) { //turn the LED connected to pin 5 OFF arduino.digitalWrite(13, PinState.LOW); } } } |
Note:
For my device I have set the baud rate to 57600 to work properly, set the baud rate according to your Arduino device.
In my next post I will show the bluetooth communication between arduino and Windows Remote Arduino.
by
Praveen
Comments
Post a Comment