views:

730

answers:

2

Hello All,

I am working on a way to send commands to an Arduino board from a web site. The Arduino board is connected to the computer via a USB port (a COM port)

I have managed to connect and control the board using a VB.net program. I also wrote a vb.net class that can instantiate a COM connection and send and receive messages.

My next step is to basically create a program that will act as a proxy between my web server (iis 7 running on vista) and the Arduino board. When a user gets to my asp.net page, the page will then send a command to the proxy to open the COM connection. When the connection is open and ready then I can send commands to the proxy. In turn the proxy will send these commands to the board and listen for the responses it receives from the board. The proxy will then pass these messages back to the asp.net page.

I have several questions I hope the group can help me answer...

  1. Am I in the right direction with this approach? Are there easier or more efficient ways of doing this?

  2. The main issue I see occurring is that if a second user opens the web page and tries to open the COM port, there will be an error. Will this cause the first connection to fail? I guess I can first check if the port is already in use and give the second user a message. Any thoughts?

  3. Are there any other potential challenges I am missing or not seeing?

Any suggestions and/or ideas will be much appreciated! Thank you!

Andres

+1  A: 

Rather than storing the connecting object in the HttpSessionState, store it in the HttpApplicationState so that it is accessible to all users.

You'll need to be careful to synchronize access to the COM port to avoid the serial communication initiated by individual HTTP requests from getting mixed up and confusing the Arduino.

Matthew Murdoch
Thank you for yout reply. I think i figured it out. The thing is that i really don't want too many users to access this. It is intended to be an internal app that only one person needs to use. I've made the application require authentication. I will, however, plpay with the application state to see if this makes a difference. Thanks again!
Andres
A: 

Hi Andres..I am new to asp.net and i m basically trying to do the same thing as u.I wrote an windows application in C# that can communicate with the serial port.I thought i could just migrate my serial.cs class into a asp.net project and make things happen.Haha.....boy was i wrong...Could you please help/guide me in the right direction to make this application work.I been like a week and i still can get things right.Basically what my asp.net page should do is connect to the serial port,send data to arduino and receive data from it.I would really appreciate any help from you mate....Thanks in advance...

Duke