Arduino interfacing with Java/JSP on Linux

Hello, after several time googeling the web, I could not find any answer to my questions !!!

In fact, I would like (as test purpose for the moment) have a linux box based on a VIA Artigo pico http://www.via.com.tw/en/products/embedded/artigo/index.jsp. On that box, I run apache and Tomcat (Java container) and publish web pages. On the USB, I connect an ARDUINO board with a sketch on it.

What I would like is to have some JSP on the VIA box so that a user can change values and check values to/from the ARDUINO board.

Is it possible, does anyone has done that before ?

Many thanks for help.

the arduino usb port is actually a serial port.. when plugged into your VIA via(ha!) the USB port, its device identification is dev/ttys0 (s1, s2.. etc, pending your device config)

(I'm also assuming you're running a stable *nix kernel compiled with stable USB/Serial drivers).. you need to code your client side serial i/o in C and wrap it up using JNI.. then you can invoke your JNI layer via your JSP pages (if you fancy doing it that way) or wrap your JNI layer with a nice, good looking interface

VIA_Hardware->FW->Kernel->OS->Shell->JVM->Tomcat->JSP::Your_Custom_Arduino_Comm_API->JNI->Lowlvl_C_Serial_IO->USB_PORT(ttys0)->Arduino

Hello, after several time googeling the web, I could not find any answer to my questions !!!

In fact, I would like (as test purpose for the moment) have a linux box based on a VIA Artigo pico http://www.via.com.tw/en/products/embedded/artigo/index.jsp. On that box, I run apache and Tomcat (Java container) and publish web pages. On the USB, I connect an ARDUINO board with a sketch on it.

What I would like is to have some JSP on the VIA box so that a user can change values and check values to/from the ARDUINO board.

Is it possible, does anyone has done that before ?

Many thanks for help.

Many thanks, just a few more questions :

I am running 2.6.22 linux kernel ( a light one, recompiled without a lot of unnecessary bits). This works perfect in a network standpoint (Apache/Tomcat).

I have installed the arduini soft and driver and I can see the Arduino board. Is that driver enough our shall I use another one ?

In fact, once I have the USB/Serial driver installed, can't I use the java.io API to send command directly to the /dev/TTYsx interface instead of the JNI + Low level C driver ? (A bit like the serial monitor of the arduino software does).

In this case, I can send value to the arduino board from my JSP pages and I need to update the arduino sketch to send all the needed values to the Linux driver.

Many thanks

absolutely, yes. if you're satisfied with the features and performance of the java.io library, then it should work fine... let me know how it goes, im curious...

Many thanks, just a few more questions :

I am running 2.6.22 linux kernel ( a light one, recompiled without a lot of unnecessary bits). This works perfect in a network standpoint (Apache/Tomcat).

I have installed the arduini soft and driver and I can see the Arduino board. Is that driver enough our shall I use another one ?

In fact, once I have the USB/Serial driver installed, can't I use the java.io API to send command directly to the /dev/TTYsx interface instead of the JNI + Low level C driver ? (A bit like the serial monitor of the arduino software does).

In this case, I can send value to the arduino board from my JSP pages and I need to update the arduino sketch to send all the needed values to the Linux driver.

Many thanks

I have been working on Java based communications to microcontrollers for a while. I have an alpha -- but working -- version that runs on XP and should run on linux. You would have to do a little work to make it work which would involve some knowledge of Java. It should be fairly easy to create custon applications for the arduino, right now I am focused on the BitWacker ( and I do not have an arduino ) If you are interested take a look at: http://www.opencircuits.com/BitWacker_Java_Communications

I guess the jUSB API will work well for you on Linux : http://jusb.sourceforge.net

I could not try it because I'm on a mac. :frowning: However I'm interested in the java.io method. How is it going for you ? I will give it a try too and post some updates here.

Finally, I'm using a proxy server as mentioned here : Arduino Playground - SerialNet

You can easily connect to it using a Socket in Java. :smiley: Off course it would be slower to use a proxy, but it's ok for testing and ok for me because I plan to communicate with flash eventually.

Hi Guli,

I have been on je jusb website but apparently, this is to send just USB command for native USB devices. Arduino fake its serial interface behind an USB connection but apparently, you need serial comms and a local driver. I have not find any docs on the USB comms straight to the arduino, there are only serial commands.

Maybe could someone help ?

Otherwise, the proxy is a very good solution but in regards of my hardware a VERY slow solution. (I also have derby and glassfish running on it :frowning: