In this lesson we show to finalize the graph we just made.

First of all with the “getData()” function, get all your data e put into one/or more variables, than add one/or more parameters for every day of the week you putted in:

	int[][] datas = getData();	 	// calls a user created function tha gets all the data from source
	int[] d= datas [0];
	yAx2.add(new Entry(d[0],0)); 		// it requires a new Entry, Entry requires a numeric value, and for 2th argument an Integer index
	yAx2.add(new Entry(d[1],1));
	yAx2.add(new Entry(d[2],2));
	yAx2.add(new Entry(d[3],3));
	yAx2.add(new Entry(d[4],4));
	yAx2.add(new Entry(d[5],5));
	yAx2.add(new Entry(d[6],6));

Than activate the zoom and scroll, you can even set move limits for its Axis and other stuff.

	lc.setVisibleXRangeMaximum(65f);					//Sets the max visible field on the x Axis
        lc.setVisibleYRangeMaximum(50, YAxis.AxisDependency.LEFT);		//Sets the max visible field on the y Axis
        lc.setTouchEnabled(true);						//Activates the touch Control
        lc.setDragEnabled(true);						//Enables dragging
        lc.getAxisLeft().setAxisMinValue(0);					//Set minimum axis Zoom level
        lc.getAxisLeft().setAxisMaxValue(50);					//Set maximum axis Zoom level
        lc.setScaleMinima(0, 1);						//Set the graph total scale, from min to max

And… we have so easely made our graph!


In this example we are going to show you how to create a Graph with Android studio on our PlTouch devices. To make the graph, we need to use an external library called MpAndroidChart, that you can find here, otherwise without downloading it, you can include into the grade build file in the next stage.

This Article divides into 3 posts, Initiation, Data Setup, Finalization.

Fist of all, open one of your projects or create a new one, keeping in mind that you can put the graph itself on a specific Activity or you can directly call it under Main Activity.

If you want to import the Library by downloading it, and you don’t know how to import it in Android Studio, here’s a tutorial that fits your need, otherwise,

just follow the build gradle procedure:

Go to your file and paste in the following lines of code, be aware to put those outside application.

repositories {
 maven { url '' }

dependencies {
 compile fileTree(include: ['*.jar'], dir: 'libs')
 androidTestCompile('', {
 exclude group: '', module: 'support-annotations'
 compile 'com.github.PhilJay:MPAndroidChart:v2.2.4'
 compile ''
 compile ''
 compile ''
 testCompile 'junit:junit:4.12'


Fine, now the libray that will allow you to make the graph, has included into the project!
In the next post we are going to see how to initiate every Component correctly, stay tuned.


First thing, we need to put the graph into the layou.xml file, to do this, search in the layout designer the lineChart tag, and put it in, or just type it by hand into the xml file.

At this point we need to declare some variables, that will allow us to communicate with other inner elements of Plugin/Library:

    LineChart lc; 				//lineChart Main Component
    ArrayList<String> xAx2;			//xAxis titles Array
    ArrayList<Entry> yAx2;			//yAx entry Array (Values associated with an index)
    ArrayList<ILineDataSet> dss;		//multidimensional Array containing the whole DataSet
    LineDataSet lds;			//the DataSet Component

Than we are going to Initiate every component, in your Activity on the onCreate method:

    lc = (LineChart) findViewById(;		//xml layout Id Reference
    dss = new ArrayList<>();				//Initiate the DataSet Component as an empty Array
    xAx2 = new ArrayList<>();				//Initiate xAxis titles as an empty Array
    yAx2 = new ArrayList<>();				//Initiate yAxis values as an empty Array

After that, we need need to put our data unto the graph, to do this, first of all, we decide how to save the datas that are going to be put to the graph.
- WITH TEXT FILES Go to Tutorial

After created our Data Save System, and after instatiation, and after you have check some statement on your code, create a function to load the saved data, and in this example
we call that function “getData()”

Add to the ArrayList every day of the week, this data are going to be put to the graph like titles.

        xAx2.add("LUNEDI");		//It only adds a string parameter to the xAxis of the Graph as a Title

In the next post we are going to see how put some values to the graph, and complete the configuration, stay tuned.

Add a custom Library, on Android Studio

In this example we are going to show you, how to import a Custom Library on Android Studio.

First of all, open one of you projects or create a new one.

Click on the DropDown menu that you find on the left-top corner of the screen, under the File Menu, scroll options until you find the word Project and click it.

Copy your Library with a Jar format in the Lib folder, that you can find at ProjectName/App/Lib

If you have .so files associated to the Library, you have to copy those under the JniLib folder, if it doesn’t exist you have to create it, precisely on the path ProjectName/App/Src/Main


Select the Librart that you just imported on the Lib folder by left clicking and click on “Add as Library!”


so the import, has just been completed.

Arduino Relay Shield for Home and Industrial Automation: The BMini

Arduino Relay Shield is an key element when you need to give actions to your projects. The BMini is the perfect match for that.

The BMini is an Arduino relay shield featured in the BieMme Store a couple of month ago. I think it is a great product and I’m very excited to tell you more about it.

Basically, it is a Relay Shield for Mini 05, Ethernet and UNO boards, specifically designed for home and industrial automation. You upload your sketch in the Arduino board, plug it in the BMini… that’s it!

Arduino Bmini shield pinout

Continue reading

Delayed timer at Insertion – ANDROID TIMER

In the industrial World, and in domotics one of the needs that you can find, is how to generate an Event after sometime Interval that you fixed .
In this simple blog we want show you, in a few simple rows of code, a Timer delayed in this insertion using Android Timers and in detail, Executors.

We are using in this case out pLtouch 101g, so you can make your idea real.
Suppose we want to activate a Relè exit after some time T from the presence of a digital input.

All that we need is a method name ScheduledExecutorService; please read this Executors tutorial

int TimeValue = 5; / 5 second of delay for active output
if (pManager.digitalRead(0) == DigitalValues.HIGH) { // if input is HIGH
ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(5);

ScheduledFuture scheduledFuture = scheduledExecutorService.schedule(new Callable() {
	public Object call() throws Exception {
	     pManager.digitalWrite(1,DigitalValues.HIGH); //delay Time TimeValue and active output
	     return "Called!";
	TimeValue,TimeUnit.SECONDS); // TimeValue is time of delay - TimeUnit.SECONDS is time scale Second

	} else{
	   pManager.digitalWrite(1,DigitalValues.LOW); // if input is LOW then switch off output


In our case using the pLtouch 101g we are using the library for the acquisition of digital inputs, e when something present on input the Timer counts 5 seconds(TimeValue)
after that i activates the first Relè exit
When the Input stops coming, i set the Output to zero

Performance tests in case of rs485 failure

In my home automation project with Arduino and Android I always paid special attention to communication failures. These might happens for many reasons and the system has to deal with them.

In particular, in the following video I was interested to show you some test I made in order to assess whether the information presented by the touchscreen panel will be displayed whenever available.

The red led indicates that the Arduino is processing a modbus request. As you can see, it stops blinking when the bus 485 is interrupted and immediately after the connection has been restored, it restart to work. Indeed, take look at the bulb icons in the monitor. When the bus is restored, the bulb status will be updated.

The description of the project and the source code are also available. Take a look!

As usual, comments are well appreciated! :)

New Arm Cortex A8 MCU touch screen

Arm powered logoIn this post, I’d like to share with you a video preview of the latest development board (Single Board Computer) with Android OS that I’m working on. It has a capacitive 7″ touch screen. Compared to the MCU ARM used in a previous home automation project, this SBC is shipped with an ARM Cortex A8 MCU at 1 GHz and with no doubt it is very powerful and fast.

In addition to Android (up to ver 4), it supports WinCE and Ubuntu. It has 512MB DDR2 on board SDRAM, 4GB of iNand flash memory, Ethernet, serial ports (3x Rs232, Rs485, uart, i2c, spi) and 4x USB Hosts, HDMI and TV OUT, 2x SD, G-sensor, GPS and GPRS interfaces and many more. For those of you interested to use this ARM Cortex in industrial automation, I designed a native Android library that manage the rs485 modbus protocol.

Take a look at the complete technical specifications. I’m working to share the Android projects I used for smart homes and industrial automation. If you find it interesting and you think that it could be a valid solution to your needs, please consider to buy it :)

As usual, comments are welcome!

Android App and Modbus RTU

We made a small and simple application for our well Ltouch panels to allow users to configure and subsequently communicate with all Modbus RTU devices.

Biemme Config, will be installed as standard on all our touch, so make it easier to configure the Modbus RTU devices.

In a few simple steps we can write and read using the Modbus RTU functions 03 and 16.

We prepare communication; We connect via a three-wire cable on Modbus device and Ltouch.

The Modbus RS485 port is positioned in the side of a connector DB9 and uses these pins:

  • 2 – A
  • 3 – B
  • 5 – GND

Set the speed of communications (thanks to our Libreria the app supports speeds up to 115200) and the timeout.

The Function 03:

Node Id: corresponds to the slave to read.

Start Register : corresponds to the first register for the Modbus read

Number Registers: Corresponds how many registers I want to read

Once configured these three fields we can, using the three buttons, perform the read request.

Single reading: Ltouch will perform a read-only and represents the values read on the screen.

Continuous cycle reading: Ltouch will perform the readings at intervals of a second in a cyclic mode. The values will be shown on screen.


With this feature we can write the integer values:

Node ID: It corresponds to the address of the slave in which I am going to write

Start Register: It is the first register in which I am going to write

Number Registers: It represents the number of consecutive registers in which I will write the value.

Value: It represents the value that will write.

To close the application just press over the Biemme logo