Go Down

Topic: Silverlight, Firmata and Arduino (Read 3905 times) previous topic - next topic

Andrew Craigie

Hi all,

I thought I'd share this project I put together recently as part of a Masters Degree course in Networked Multimedia

Silverlight <> Firmata <> Arduino  http://yuleblinker.com/silverlight_arduino/

The website gives an introduction to the use of Arduino, Firmata, a serial proxy and Silverlight.




A C# class has been created that takes care of the Firmata protocol within the Silverlight applicaiton. The complete project code can be downloaded from the website.

Details are given of how to create reusable interface controls for use within Silverlight applications. A couple of examples of the controls are in the images below:





A simple Silverlight application is provided that brings all the elements together and demonstrates how you can directly install an 'out-of-browser' Silverlight application.



All the code is completely open source and you are free to download it, use it and change it in any way.

Put together FirmataVB - http://www.acraigie.com/programming/firmatavb/default.html

carpenterbee

A simple way to create the file to unsandbox your project/program would be nice.
After quite a few hours with Visual Studio, I finally gave up.  Looks like it would
be a neat demo of the UNO's capabilities if I get it working.
Walt
North Carolina

Andrew Craigie

Hi carpenterbee,

To run the completed application you click the Install button on the Arduino Firmata Tester Silverlight application on this page: http://yuleblinker.com/silverlight_arduino/installation.html . You install it directly from the web page. 'Installing' it means creating a local copy of the application that will run with elevated trust on your own computer - this is what Out-of_Browser means. An applicaiton running within the browser is 'sandboxed' and unable to communicate with local devices due to security restrictions.

You will be prompted with an install window, simply click the install button. The application will then usually place a shortcut on your desktop. If you have installed and configured Serial Proxy correctly, chosen the correct ports and set the correct baud rate then you'll be good to go.

I'm not too sure what you mean by... "A simple way to create the file to unsandbox your project/program would be nice.". Could you give a little more detail and I'll try to help out.

When working with the project in Visual Studio the option to 'Enable running application out of the browser' is found in the Project Properties page. Project > AndrewCraigie Properties...  You will also find an Out-of-Browser Settings... button here too.

Hope this helps.

Andrew.
Put together FirmataVB - http://www.acraigie.com/programming/firmatavb/default.html

carpenterbee


Hi carpenterbee,





I'm not too sure what you mean by... "A simple way to create the file to unsandbox your project/program would be nice.". Could you give a little more detail and I'll try to help out.

When working with the project in Visual Studio the option to 'Enable running application out of the browser' is found in the Project Properties page. Project > AndrewCraigie Properties...  You will also find an Out-of-Browser Settings... button here too.

Hope this helps.

Andrew.


Your online tutorial was excellent Andrew.  Thanks for posting it. You should do well with your grades on that. I would not have even attempted installing your project without that resource. I'm unable to locate a project to change properties. I've installed the serial socket redirector and suspect it's working fine. I've downloaded your Uno test program. When I run the program it brings up the main screen with the Uno photo, but will not function.  I've got the right port number, and localhost is the correct address for my machine. I've edited the port settings so they match on the serial socket redirector.  The program connects but fails to do anything else. So I'm pretty sure it's the resource sandboxing that stands in my way.


I downloaded MS Visual Studio just to unsandbox the program.  There is no menu selection that is anything like your example. Even though I've downloaded your test program, VS doesn't see it, so I can't change the properties.  Maybe I've got to download your source and build the project myself to have this option??  I hope not as dealing with a new MS product is  not my idea of fun.  :) I've whiled away over 8 hours on VS and filled up 9 gigs of my hard drive with it!  LOL

Later;
Walt
Walt
North Carolina

Andrew Craigie

Hi Walt,
When you say "I downloaded MS Visual Studio just to unsandbox the program", I'm a little usure what it is you're trying to do? On my site I use the term 'Sandbox' to refer to a Silverlight application that is running in the browser window. There are security restrictions in place that restrict a browser-based application from accessing local resources on your computer e.g. serial ports. To 'unsandbox' a Silverlight applicaiton means to have it run locally on your computer - not on a web page. A Silverlight application running Out-of-Browser can be granted 'elevated trust' enabling it to access certain local resources on your computer. In the case of the Arduino Firmata Tester that is access to the local 'port' provided by a serial proxy application (what I believe you are referring to by 'serial redirector').

To run a Silverlight application Out-of-Browser, to 'unsandbox' it, you do not need MS Visual Studio. You simply 'install' the application from the web page where you found it. The Arduino Firmata Tester look like this:


And it can be found here: http://yuleblinker.com/silverlight_arduino/installation.html

To use the Arduino Firmata Tester from the site you do not need MS Visual Studio. You need to install it from the page and have a 'serial proxy' application configured and running on your computer. And, by the way, you also need to upload the StandardFirmata sketch onto your Arduino board (I'm assuming you've done that!  :))

I have provided all the code that was used to create the Arduino Firmata Tester Silverlight application in the form of a Visual Studio project folder. This is the 'raw' code and assests. It is available as zipped download from the Links page: http://yuleblinker.com/silverlight_arduino/links.html. It is this project that you can open in Visual Studio. When I mentioned above that you can change the Properties for the project it is when you have it open in MS Visual Studio. You only need to open this project in Visual Studio to investigate how it was created or to change or amend it.

When you say 'the program connects but fails to do anything else', what do you mean? For it to do something you will need to have something connected to your Arduino board - LEDs, buttons, potentiometers etc. When you connect the application try clicking the Firmware, Capabilities and Pin Values buttons. Each of these should at least trigger a response from the board if it is indeed connected and running Firmata.

Cheers,

Andrew
Put together FirmataVB - http://www.acraigie.com/programming/firmatavb/default.html

carpenterbee

#5
Sep 11, 2012, 07:22 pm Last Edit: Sep 11, 2012, 07:24 pm by carpenterbee Reason: 1
Yup, Andrew I tried to read firmware capability etc.  None of this worked.

Edit.  Yes, I installed the standard firmata sketch that comes with Arduino IDE.  I think without that the test program would complain.  :)
Walt
North Carolina

hengis

Hi Andrew Read your stuff with great interest.  i have been trying to get Firmata to work without success  I was hoping to monitor arduino pins as my sketch was running but this does not seem to be possible as the firmata sketch must be loaded onto the arduino thus deleting my sketch.  Is my understanding correct?  If it is possible to monitor pins as my programme is running how do I do it?

carpenterbee

@hengis I believe you would have to write a custom app in Silverlight to work with your sketch.
Walt
North Carolina

Contor

hi,
does the Test work with Arduino Mega 2560?


Hello I hope understand me, do not translate into English and google.
Well I followed the tutorial step and it works perfect.
But what I can not do is open visual studio 2010 with the project to make some modifications, like changing the image of the arduino board and other things.
Not as opening the code in VSE gives me error. thanks

Go Up