Arduino Forum

Forum 2005-2010 (read only) => Software => Interfacing => Topic started by: Francois X. LEYTENS on Mar 20, 2008, 05:04 pm

Title: Arduino interfacing with Java/JSP on Linux
Post by: Francois X. LEYTENS on Mar 20, 2008, 05:04 pm
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.
Title: Re: Arduino interfacing with Java/JSP on Linux
Post by: kingsgambit on Mar 21, 2008, 07:04 am
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



Quote
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.

Title: Re: Arduino interfacing with Java/JSP on Linux
Post by: Francois X. LEYTENS on Mar 21, 2008, 09:45 am
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

Title: Re: Arduino interfacing with Java/JSP on Linux
Post by: kingsgambit on Mar 22, 2008, 04:39 am
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...

Quote
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


Title: Re: Arduino interfacing with Java/JSP on Linux
Post by: russ_hensel on Mar 22, 2008, 09:12 pm
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
Title: Re: Arduino interfacing with Java/JSP on Linux
Post by: Guli on Apr 05, 2008, 07:01 pm
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.  :( 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.
Title: Re: Arduino interfacing with Java/JSP on Linux
Post by: Guli on Apr 06, 2008, 12:02 am
Finally, I'm using a proxy server as mentioned here : http://www.arduino.cc/playground/Interfacing/SerialNet

You can easily connect to it using a Socket in Java. :D 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.
Title: Re: Arduino interfacing with Java/JSP on Linux
Post by: Francois X. LEYTENS on Apr 16, 2008, 02:02 pm
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 :-(