Arduino Monitor

By on August 17, 2011
Pin It

We present the candidature of Mr. Daniele Denaro for the TiDiGino Contest. He presents us a recent application with the Arduino: the Arduino Monitor.

This is a monitor that displays on the PC analog and digital values ​​read from Arduino. In short, a sort of display and keypad for Arduino made ​​with a computer. The use of a program in Java makes the application easier than a program written in Processing language and also lighter than the use of the protocol Firmata. At the end of the presentation you will find the files for the application on your computer, the library for Arduino, three examples that show how to use the library.

Arduino Monitor has two components: the Arduino library (Monitor) and a Java program “ArduinoMonitor.jar” running on computer. Arduino library has to be located into Arduino Libraries directory, and the Java program anywhere.
The library supplies some simple command that people can use in a Arduino program to display analogical or digital value in a more convenient way than the character serial console. Likewise people can receive input (digital or analogical) in the program.
The goal is to have a simple, immediate and light link with Arduino. The protocol is just of 3 bytes per message, for best speed. This monitor is much more simple than a Processing program and more comfortable than a simple serial console. Compared to Firmata , this protocol is lighter (about ½ memory filled) and basic.
Useful to verify input value from pin or execute command on Arduino.

The other component is the Java program ArduinoMonitor.jar. You can simply start it clicking on.
But you need Java installed. It is a Windows version only because the included rxtxSerial.dll library.
This program open a windows with display and button or slides fields.
NB The serial port list is automatically refreshed. But sometimes it needs to be refreshed by hand ; that can be made using Close button.
Port selected and speed have been saved every closing application and reloaded at every start up.

 

COMMAND   MEANING PARAMETERS
 openM(baud-rate)  open communication baud-rate=Arduino serial possible values
 closeM()  close communication
 writeAna(value,destination)  displays a value to destination field (level bars) int value(0to1024), byte destination(0to5)
 writeDig(value,destination) switch on/off (value 1/0) the destination led int value(0to1), byte destination(2to13)
 plotFun(value,destination) plots function (identified by destination number 0to5) byte destination(0to5)
 plotReset(destination) stop plot ; if destination=6 cancel all plots byte destination(0to6)
 plotFunX(value) plots function X-Y : value X int value(0to1024)
 plotFunY(value) plots function X-Y : value Y int value(0to1024)
 readDig(source) returns 0/1 from button return byte(0to1), byte source(2to13)
 readPWM(source) returns value 0 to 255 from slide return byte(0to255), byte source(3,5,6,9,10,11)

 

Use

Define monitor library : es. Monitor m=Monitor() (outside setup e loop)
Open monitor : es. m.openM(9600) (in setup function)
Use monitor :es. m.writeAna(value,4)… etc

Example:

/*
 Analogical display value example.
 Read analogical value from pin 0 and display on bar 0 and plot.
 */
 #include  //Include library
 Monitor mon=Monitor(); //Initialize monitor library
 void setup()
 {
 mon.openM(9600); //Open serial communication at 9600 baud
 }
 void loop()
 {
 int value=analogRead(0); //Read analogical value at pin 0
 mon.writeAna(value,0); //Out value at barr 0
 mon.plotFun(value,0); //Plot,also, as function 0 (red)
 delay(100); //100 millisec of delay
 }

 

Download

 Download ZIP File  Monitor Library
Download ZIP File  PC program (JAR)
Download ZIP File  Examples

About Boris Landoni

Boris Landoni is the technical manager of Open-Electronics.org. Skilled in the GSM field, embraces the Open Source philosophy and its projects are available to the community.

2 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *