Pages: [1]   Go Down
Author Topic: JArduino  (Read 2716 times)
0 Members and 1 Guest are viewing this topic.
Oslo
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi

I'm part of a team that are working towards enabling the Arduino board to be driven by high level languages running on a computer.
We have focused on Java and have created JArduino. The JArduino code runs on the computer and comunicates with a Arduino board,
so you can controll all the pins as you normally can with c++.

Why use JArduino you say?
Well, JArduino enables you to write java applications that can easily communicate with your arduino board.
JArduino gives a good hardware abstraction and don't allow you to write/read from unexisting pins (unlike the native Arduino language)
It's easier to learn for people already familiar with Java.
and many more good arguments smiley-wink

The Jarduino package also comes with a grapichal program which allows you to click on a pin and send a digital write to it, and it will be visualized on screen AND it will perform a digital write on a connected Arduino board.
This means that you can test you Arduino setup before you code it (and maybe have to do some debugging).
From this program it is also possible to define a program flow and compile it into both JArduino code and native Arduino code.

If you want to try it out you can find the repository here: https://github.com/ffleurey/JArduino
And a wiki page with (hopefully) everything you need to know https://github.com/ffleurey/JArduino/wiki
A two minute tutorial to get started https://github.com/ffleurey/JArduino/wiki/2-Minute-Tutorial

I hope you can make use of this library and spread the word. smiley-grin

Happy coding
Tha Jarduino Team
« Last Edit: July 01, 2011, 08:38:40 am by dosjos » Logged

Jan Ole

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 170
Posts: 12465
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


Sounds interesting, can you post a few screenshots and some sample code to see why it is so easy?
It is not clear to me how it communicates with the arduino, serial, I2C, Ethernet ? Must I load a special sketch on the Arduino? What are the limits?

I know I can find the answers by clicking the links;  but to seduce people using Jarduino you must provide "some whipped cream upon the chocalate cake" to make it irresistable. Now it seems a bit like the next programming language to me. smiley-wink

Rob
PS, my first thought was that jarduino was some french version of the Arduino for gardens [jardin] todo waterproof soil measurements, temperature, humidity, sunlight, etc. smiley

Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Oslo
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Whipped cream to go smiley-wink

The Arduino can comunicate with the computer in several ways. Right now we have support for Serial, xBee and bluethoot.
To get started you load a special scetch to your Arduino board. This scetch will now handle all communication with the computer and you can tell  your board to do almoast anything.
For exampel to do some LED blinking you can write this program:
Code:
import org.sintef.jarduino.DigitalPin;
import org.sintef.jarduino.DigitalState;
import org.sintef.jarduino.JArduino;
import org.sintef.jarduino.PinMode;
import org.sintef.jarduino.comm.Serial4JArduino;
/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
This example code is in the public domain.
 */

public class Blink extends JArduino {

    public Blink(String port) {
        super(port);
    }

    @Override
    protected void setup() {
        // initialize the digital pin as an output.
        // Pin 13 has an LED connected on most Arduino boards:
        pinMode(DigitalPin.PIN_13, PinMode.OUTPUT);
    }

    @Override
    protected void loop() {
        // set the LED on
        digitalWrite(DigitalPin.PIN_13, DigitalState.HIGH);
        delay(1000); // wait for a second
        // set the LED off
        digitalWrite(DigitalPin.PIN_13, DigitalState.LOW);
        delay(1000); // wait for a second
    }

    public static void main(String[] args) {
        String serialPort;
        if (args.length == 1) {
            serialPort = args[0];
        } else {
            serialPort = Serial4JArduino.selectSerialPort();//Serial chooser interface
        }
        JArduino arduino = new Blink(serialPort);
        arduino.runArduinoProcess();
    }
}

This is absolutely more code then what you must write in the native Arduino language. BUT, the advantage is that now everything that you can get input from in java can manipulate your Arduino board.

The main limit in using JArduino is that the Arduino board have to be able to communicate with a computer, or else the Arduino board wouldn't know  what to do smiley-wink

Some screenshoots follow
You can click on a pin and then select what you want to do on that pin. Different pins have different attributes, e.g. AnalogPin, DigitalPin, InterruptPin etc.


On the left side you get a program flow as you select action to perform, you can also add controll sequenses in this flow.
These controll sequences requires that you have don at least one analogRead or digitalRead


Here you can see all the options you can do on DigitalPin_3 which is also a PWMPin and a interruptPin.
On the right side you can do writes to, and reads from the EEPROM memory.


There is also possible to generate code, both for JArduino and for Arduino:



Tell me if you want more cream for our delicious cake;)
PS, some guys on the team are french.... but I don't think they are much into gardening. smiley-wink
Logged

Jan Ole

'round the world...
Offline Offline
Faraday Member
**
Karma: 41
Posts: 3112
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hmmm... I see where this is going... basically you'll use the Arduino as a "dumb" remote IO.
Sounds nice. Even better if you encapsulate all the comm protocols from the user and all he has to do is say "I'm using bluetooth today" or serial.

It's a nice idea, although it won't bring people into electronics, and it may be cheaper to get similar, less powerful devices that you can connect and use the serial port (XBee) for doing just the same.

If I might suggest something new, try incorporating sensor interfaces for this with I2C and SPI stuff. Also, if you put all possibilities of code inside, you'll run out of memory in the Arduino, but if you create your Java software in a way that'll create the Arduino program from scratch based on what you included in the Java you'd get more flexibility.

Example:

Your Arduino has an LDR on the analog Pin, a DS1620 on the I2C bus and a MCP23017 (the IO expander from Microchip) on SPI. So, you create your Java program and include the DS1620 object, MCP object, etc, etc... then when you compile the Java program and run it for the first time, the firmware for the Arduino would be created to include all the interface functions that you'll need to interface those chips.

In the end, if the project takes off and more and more chips and interface possibilities are added, this way of creating firmware as needed will allow you to run with lower memory Arduinos (or if you're interested, custom boards).

It's just a thought.
Logged

Eu não sou o teu criado. Se respondo no fórum é para ajudar todos mediante a minha disponibilidade e disposição. Responder por mensagem pessoal iria contra o propósito do fórum e por isso evito-o.
Se realmente pretendes que eu te ajude por mensagem pessoal, então podemos chegar a um acordo e contrato onde me pagas pela ajuda que eu fornecer e poderás então definir os termos de confidencialidade do meu serviço. De forma contrária toda e qualquer ajuda que eu der tem de ser visível a todos os participantes do fórum (será boa ideia, veres o significado da palavra fórum).
Nota também que eu não me responsabilizo por parvoíces escritas neste espaço pelo que se vais seguir algo dito por mim, entende que o farás por tua conta e risco.

Dito isto, mensagens pessoais só se forem pessoais, ou seja, se já interagimos de alguma forma no passado ou se me pretendes convidar para uma churrascada com cerveja (paga por ti, obviamente).

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 549
Posts: 46113
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I'm part of a team that are working towards enabling the Arduino board to be programmed using high level languages.
This "implementation" is a long ways from this stated goal.

Programmed using, and driven by a PC using, are two completely different things.
Logged

Oslo
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@bubulindo
The communication layer is already encapsulated and the connected units shows up as a com port in runtime.

Hopefully this project will encourage people without much electronics knowlegde to start using Arduino.

Your suggestion is a good one, we  have planed to do this to some extent. First we will try to add basic components and after that we can look into adding support for SPI and I2C modules.

We are greatefull for your feedback and don't hessitate to contact us if you have other thoughts or ideas.

Cheers
The JArduino Team
Logged

Jan Ole

Oslo
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


Programmed using, and driven by a PC using, are two completely different things.

You are indeed right, I will correct that.
Thank you for your feedback
Logged

Jan Ole

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 170
Posts: 12465
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

you see Jan, people like whipped cream smiley-wink
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

'round the world...
Offline Offline
Faraday Member
**
Karma: 41
Posts: 3112
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

you see Jan, people like whipped cream smiley-wink

I do avoid it, as I'm on a diet. smiley-razz

At first I was quite skeptical as I didn't see higher level languages than C++ to be used on Arduino... but the idea of having the possibility of turning the Arduino into a "dumb" remote IO is nice and useful for some.
Logged

Eu não sou o teu criado. Se respondo no fórum é para ajudar todos mediante a minha disponibilidade e disposição. Responder por mensagem pessoal iria contra o propósito do fórum e por isso evito-o.
Se realmente pretendes que eu te ajude por mensagem pessoal, então podemos chegar a um acordo e contrato onde me pagas pela ajuda que eu fornecer e poderás então definir os termos de confidencialidade do meu serviço. De forma contrária toda e qualquer ajuda que eu der tem de ser visível a todos os participantes do fórum (será boa ideia, veres o significado da palavra fórum).
Nota também que eu não me responsabilizo por parvoíces escritas neste espaço pelo que se vais seguir algo dito por mim, entende que o farás por tua conta e risco.

Dito isto, mensagens pessoais só se forem pessoais, ou seja, se já interagimos de alguma forma no passado ou se me pretendes convidar para uma churrascada com cerveja (paga por ti, obviamente).

Centurion RSA
Offline Offline
Full Member
***
Karma: 0
Posts: 166
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Nice, is this what you call "plug and play" Arduino?
I can see may applications for this kind of work.
Logged

Rather people think you to be a fool than you open your mouth and confirm it.

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 331
Posts: 16523
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Hopefully this project will encourage people without much electronics knowlegde to start using Arduino.

Not to be picky, but doesn't your project seemed aimed to help people on the software side rather then on the electronics side of using a arduino? The electronic side would focus on issues like how to power your projects, the why and when for pull-ups and pull-downs, current limiting on digital output pins, when and how to do that. Getting started with an arduino does have two very separate hurdles for newcomers, learning the software and learning basic electronics principals and practices, and I don't often see very much overlap opportunities between these two subjects.

So does your project cover any electronics topics as related to an Arduino?

Lefty
Logged

Oslo
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi retrolefty

As you say there is two sides to this, the programming and the electronics part, and these two things are quite different indeed.
Like you state, our project does i deed aim at the software side of the Arduino platform. But as a teacher assisten in a Arduino (Design) course at the University of Oslo I have experienced first hand that the programming often was the main challenge to get things to work.

These were design student with little or non programing experience, and to tell them that the Arduino was programmed in C++, and not in Java as some of them knew, was quite a dealbreaker (even though the difference is barely noticable). So, allowing them to program in Java was a great advantage. Remember that the Arduino board is made for
Quote
artists, designers, hobbyists, and anyone interested in creating interactive objects or environments.
and not nessecary for codemonkeys.

Also, when one can understand the code and get the code to work, there is so much easyer to start to understand what the electric components do and to get a interest in the electronics part. So by making the programming easier we hope that people will jump over to the electronics part of the Arduino world as well.

To marius.
In deed plug and play, atleast after you have uploaded the comunication scetch.
We also see a lot of possibilities for this kind of Arduino integration. Check out the sample archieve for some ideas.

Cheers
The JArduino Team
Logged

Jan Ole

'round the world...
Offline Offline
Faraday Member
**
Karma: 41
Posts: 3112
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

But as a teacher assisten in a Arduino (Design) course at the University of Oslo I have experienced first hand that the programming often was the main challenge to get things to work.

These were design student with little or non programing experience, and to tell them that the Arduino was programmed in C++, and not in Java as some of them knew, was quite a dealbreaker (even though the difference is barely noticable). So, allowing them to program in Java was a great advantage. Remember that the Arduino board is made for
Quote
artists, designers, hobbyists, and anyone interested in creating interactive objects or environments.
and not nessecary for codemonkeys.

Things have sure changed in Universities... isn't the point of going to University to learn how to make such things as the Arduino instead of using it? Why would an artist know Java? And wouldn't he see that it is pretty much the same thing as C++, especially in such a low power device as the Arduino?
Logged

Eu não sou o teu criado. Se respondo no fórum é para ajudar todos mediante a minha disponibilidade e disposição. Responder por mensagem pessoal iria contra o propósito do fórum e por isso evito-o.
Se realmente pretendes que eu te ajude por mensagem pessoal, então podemos chegar a um acordo e contrato onde me pagas pela ajuda que eu fornecer e poderás então definir os termos de confidencialidade do meu serviço. De forma contrária toda e qualquer ajuda que eu der tem de ser visível a todos os participantes do fórum (será boa ideia, veres o significado da palavra fórum).
Nota também que eu não me responsabilizo por parvoíces escritas neste espaço pelo que se vais seguir algo dito por mim, entende que o farás por tua conta e risco.

Dito isto, mensagens pessoais só se forem pessoais, ou seja, se já interagimos de alguma forma no passado ou se me pretendes convidar para uma churrascada com cerveja (paga por ti, obviamente).

Oslo
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Things have sure changed in Universities... isn't the point of going to University to learn how to make such things as the Arduino instead of using it? Why would an artist know Java? And wouldn't he see that it is pretty much the same thing as C++, especially in such a low power device as the Arduino?

Some people learn how to make art instalations, and they need to learn to use the Arduino, not to make it.
Different people have different needs you know.

Some artist know Java because they use it to program their art, not all artists paint you know.

They defenetly saw that C++ was quite the same as Java, and if we didn't tell them, they wouldn't notice for a while.

But by using JArduino you can't for example map to a non existing pin, or write unlegal values to the port. And this is something that helps non-experienced programmers a gread deal.

Cheers
The Jarduino Tema
Logged

Jan Ole

Pages: [1]   Go Up
Jump to: