Other projects

SCADA on Lemaker Guitar

10 1297
horty  
At the turn of the year LeMaker held a campaign to increase the visibility of its new LeMaker Guitar platform. The idea of the campaign was to invite developers to submit an idea which would be voted on by the general public and the developers of the most popular 20 ideas would be given a LeMaker Guitar to facilitate the development. My idea was to port and industrial strength SCADA system to the Guitar platform to produce a low-cost system that could be applied to many applications such as home automation, small industrial control, automation of utility networks, and other price sensitive applications.

I was fortunate enough to receive enough votes to be awarded the Guitar and last week the board arrived from LeMaker as promised. The main content of my development was to evaluate a couple of operating systems, decide upon a development environment and port the code making any modifications necessary to make it run 100% on the Guitar.

So the first task was to decide on the operating system. LeMaker offers two standard operating systems that were suitable for me. One was Debian Jessie the other was Ubuntu Mate. Android was never a consideration for me because my software had never been ported to that OS and the amount of effort to get it running on Android was too great in the timescale allowed.

The Guitar offers two ways to install the operating system the first is on a microSD and the second is on eMMC memory on the main Guitar board. To do the OS evaluation I decided that installing the operating system on two identical 8GB microSD’s would be most appropriate and so I downloaded the images from the LeMaker site. Both OS’s have their pros and cons.

Boot

Debian Jessie takes a long time to boot seems to get stuck half way through the boot process for over a minute before resuming. After booting the screen resolution is pretty much unusable and there are no utilities to make the necessary adjustment.

Ubuntu Mate boots far faster with no hang-ups. As with Debian Jessie, after booting the screen resolution is pretty much unusable and there are no utilities to make the necessary adjustment

Screen Resolution


Fortunately there are a couple of patched boot files on the web providing new “uImage” and “kernel.dtb” files that gives full HD. Google for “LeMaker Guitar-Full 1080p Resolution Kernel.zip”. If you want anything other than full HD looks like you are in for some work!!

Look and Feel

Debian Jessie and Ubuntu both provide a clean modern look but both have different problems. With Debian Jessie there is a most annoying visual effect on trying to move windows around the screen, particularly Windows that are large and have a lot of content. The cursor changes to a hand to drag the actual window by its title bar but the redrawing of the window is so slow that it cannot keep up with the hand thus even when the hand stops the window keeps moving around the screen; this makes for a particularly bad “feel”- this is not a trivial issue, I was particularly frustrated by this.

On Ubuntu Mate this problem is not apparent, once grabbed the window no matter how large nor no matter how much content easily keeps up with the cursor movement however on Ubuntu Mate there is another annoying problem in that the cursor flickers badly when moved and disappears sometimes, for example when you are hovering over a window boundary. This is a well-known bug in Debian-based distributions but it is particularly bad on this version of Ubuntu Mate. As with the window dragging problem on Debian this is particularly annoying and it makes some applications, for example “Dia” almost unusable.

Ethernet


Both OSs support the on-board Wi-Fi module out of the box. Debian Jessie is a little more complicated to set up but it’s definitely not rocket science. Ubuntu Mate finds Wi-Fi straightaway and all you have to do is point to the desired network and enter the password. On Debian Jessie the performance of the Wi-Fi is actually significantly better than Ubuntu mate given exactly the same hardware and infrastructure.

Repositories


The repositories for either Debian Jessie or Ubuntu Mate provided most of the additional applications and libraries I needed. On Ubuntu Mate code::blocks is actually installed by default. On Debian Jessie code::blocks is not available from the standard repository however codelite is. Codelite doesn’t work as well with Cmake as code::blocks but it’s still very usable.

Operating system choice

Given the issues described above neither operating system is perfect so it’s a matter of choosing the least worst of the two. Given the long delay in booting and the most annoying window dragging effect on Debian Jessie I decided to go with Ubuntu Mate and hope that with a bit of trawling the web I could find a solution to the cursor disappearing and flickering issue.

Having decided on the operating system I now decided to install it on the eMMC and see if there was any performance improvement. I should say at this point I was using top end microSD’s to do the initial assessment (the ones I actually chose were the SanDisk Ultra Extreme Pro series with a 95 Mb/sec transfer rate). After installing Ubuntu mate on the eMMC the performance was slightly better, but the improvement was not as significant as I had hoped and expected; probably because it was already pretty good when running off the microSD cards.

Development environment

As stated above Ubuntu Mate comes with code::blocks already installed. I did try Eclipse on both OS’s but discarded that mainly because of the time it took to load, I also had a look at Anjuta but since it is not supported by Cmake decided I would stick with the standard code::blocks IDE

Porting the SCADA software

I found out some time ago that it is always better to compile the software on the actual target board. This ensures that all of the correct libraries etc. are available. So the first step was to generate the code::blocks project using Cmake and then build the system. Actually I built the system using the “make” command in the terminal after generating the C make/code blocks project. The whole system, (upwards of 1000 ‘C” files generating some 220 binaries) compiled in around about two or three minutes without a single error.

Running the SCADA system

The SCADA system starts up exactly as it should and 99% of the functions work as expected. The only issue I have is using a standard RS 232 port to communicate using the Modbus RTU protocol, this is not a software is but is more likely to be a setup issue with the UART. This is an ongoing issue for me but as soon as it is fixed I can continue with the development of the SCADA system particularly the man machine interface.

Conclusion

While the operating systems available are not perfect they do function reliably and provide an adequate level of performance. I have to say I personally prefer you Ubuntu Mate to Debian Jessie but that’s purely subjective. In the future maybe it is worth looking at something like Arch LINUX but that is the subject of another report.

The performance of the SCADA system on the LeMaker Guitar is excellent and the board should provide an extremely good platform for system deployments. In the past I have worked with the LeMaker Banana Pro and while the Banana Pro is slightly slower than the Guitar I have no worries that it will fit in harsh environments since it generates virtually no heat. The Guitars’ environmental credentials are yet to be established but since, while running, there is virtually no CPU load I’m confident it can be applied to most applications both small and large

The biggest advantage with the Guitar is the ability to design one’s own baseboard which is the reason I was interested in it in the first place. The fact it has on board eMMC is also a big plus.

For the price this is one impressive piece of kit and when the issues with the operating system and Modbus are sorted out it will make an excellent platform for this product.

So now the system is running on the Banana Pro, and the Guitar and I can’t wait to see how the software runs on the LeMaker HighKey

Final notes

This project was estimated to have taken up to 8 weeks, and in fact is now complete in less than two weeks. As a final communication I will produce a video on YouTube (probably next weekend) hopefully showing the issues I’ve described above and also giving an impression of the performance you can expect

I indicated when entering this campaign that this is not an open source project however I did offer to give away 100 free licences to people interested in doing development or looking at the product from educational purposes. If you’re interested please contact me at keefsk@gmail.com. In the meantime you can look at the current state of the software here <https://www.youtube.com/watch?v=SkcBzkr_Z34>
Tido  
Hi,

You have written an interesting article, thank you. While reading it, this came into my mind:

Boot
Debian Jessie takes a long time to boot seems to get stuck half way through ...

Ubuntu Mate boots far faster with no hang-ups. As with Debian Jessie, after booting the screen resolution is pretty much unusable and there are no utilities to make the necessary adjustment

I guess you meant Lemuntu, based on Debian.

The changes for the Lemuntu v1601 do now belong to all Linux images:
> Update the display framework (HDMI as master device and LCD as slave device by default)
> Added the HDMI-CEC driver
> Added the EDID analytic function on uboot
> Fixed the problem that waiting to start without a network connection

SDcard speed
It does not only depend on the card.

Looking forward to your YouTube review, I don't know this SW by now.

Hello and good luck for your project.

You may have a look on the Guitar's console to see why "Debian" is so slow to start.

"With Debian Jessie there is a most annoying visual effect on trying to move windows around the screen, particularly Windows that are large and have a lot of content."

It's probably because the graphical acceleration is not enabled. As far I remember, there is an entry for that in LeMaker's Wiki.

If you're looking really for a "industrial level solution", you may also move all logs directory to a ram FS or on a physical disk : by default, they are in the same device than root, and doing such thing on an SD card will kill it sooner or later (industrial solution is supposed to work for years).

About the OS, frankly speaking, I would never doing anything "professional" with Ubuntu or one of its flavors. Because I had lot of bad experiences with buggy, half finished, or simply crappy software put by canonical (and Lunbuntu I tested with the Guitar or the BananaPro are not exception ).
So or you stabilize your OS ... and never upgrade or update it (otherwise, Canonical's update may kill your solution), or you switch for more decent OS.
Personally, all my systems running Gentoo but I'm sure strait Debian or Arch are stable as well.

Bye

horty  
Tido replied at Jan 31, 2016 14:38
Hi,

You have written an interesting article, thank you. While reading it, this came into my mind:

Hi You are correct - I meant Lemuntu which I believe is base on Debian Jessie. I thought I had the latest version, but obviously not I'll download the latest iamge and try again. Thanks

horty  
destroyedlolo replied at Jan 31, 2016 16:47
Hello and good luck for your project.

You may have a look on the Guitar's console to see why "Debia ...

HI Destroyedlolo

Thanks for the comments and the kind remarks. I assumed the problem wasgraphical acceleration and trawled the web for a while, looking for comments butnever found any. I’ll look again.

I am aware of the problem with this kind of memory with limited read writes andultimately will harden the solution fit for purpose.

Regarding the comments on the distro I am somewhat with youon this but everyone has their own favourites. One friend of mine swears byCentOS. Another suggests I use Arch. Actually I am considering releasing thesoftware running under Microware OS-9 which allows the whole system to run inRAM. I am talking to RTSI the company that own this OS and they are close to releasingVersion 6. From what I know the ARM 7 version was tested on the LeMaker BananaPro.



Hum, yes, I know this OS I worked at school : it was on 68010 based SBC and I liked the way it is resources conservative and efficient ... perhaps even better than the AmigaOS of my beloved Amigas

I wasn't aware it was still alive and ported to ARM. Very nice OS indeed.

horty  
destroyedlolo replied at Feb 01, 2016 14:47
Hum, yes, I know this OS I worked at school : it was on 68010 based SBC and I liked the way it is re ...

Hi Destroyedlolo

I don't want to push the Microware OS-9 thing too much since I have no association with Microware llp and this thread is essentially related to SCADA on the LeMaker Guitar, however the two are pretty much related.

My personal view is that Microware OS-9 is the perfect operating system for an ARM 7 based embedded controller. Some time ago I published a video on YouTube showing Microware OS-9 Ver 5 on the Vortex (DM&P) MX 3350 embedded computer and it absolutely flies; bootup time in just over 1 sec. I am expecting even better performance on the LeMaker Banana Pro and hopefully the LeMaker Guitar. Also the new pricing model from RTSI should make it affordable even to the hobbyist.

The biggest problem with Microware OS-9 is that as you suggested it drifted in the wilderness for a while and never had a decent MMI developed, however for my development I don't really need this since the SCADA system can work as a headless system and deliver data to mobile devices that would act as the MMI.

When Version 6 is released I will get a copy and do another YouTube video showing it running on the Banana Pro; according to RTSI something like 90% of my old code should just recompile since it was written in Ultra C

Regards Keith

horty  
By way of an update on the actual project, and in direct response to the comments I received particularly from Tido I downloaded the latest version of Lemuntu, and as Tido intimated the latest version cleared up most of the problems I mentioned; specifically:

* The pause during start-up is completely gone now and the system boots fairly rapidly for LINUX.

* On system boot the screen resolution was just what I needed i.e. 1920×1080 so there were no boot files to patch

* the problem with redrawing Windows has also disappeared and when dragging a window it faithfully follows the cursor no matter how big the window or how much content. The effect is slightly jerky but this is only compared to a high-end Mac mini i7 that I have. I didn't even install the graphic accelerator as recommended by Destroyedlolo

The only other issue remaining is the fact that the cursor flickers and it sometimes disappears if you move it really slowly. As mentioned previously this is not really a problem for Lemaker but more a legacy problem that has dogged Debian systems for quite a while.

So the conclusion is that Lemuntu is now the preferred OS of choice on the LeMaker Guitar and when I get some time at the weekend this is the operating system I will use as the basis of the video I will produce. This also means of course that Codelite is the IDE I will use.

I wish I had waited a couple of days to start the development since it would have gone exactly like clockwork - on the other hand I would have had nothing to report

This is a pretty awesome board for the money!!

After booting the screen resolution is pretty much unusable and there are no utilities to make the necessary adjustment.


Because we get a new display structure code in the v1601 version OS image, but the Android in the emmc is the old one. So after you receive the Guitar, you'd better update the emmc and sd card image both to v1601 version, then the display should work.

horty  
Tony is correct v1601 version of the OS image fixed most of the problems please use this image. The only outstanding problem was that of the disappearing / flickering cursor (particularly apparent in apps like "Dia").  This is not necessarily a LeMaker problem it is a feature (bug) that has dogged Debian based Linux for some time; trawling the web you can find many different solutions to this problem but I fixed this quite simply (but inelegantly) by disabling the default cursor theme:

* open a terminal and type “sudo pcmanfm"
* enter the root password
* in pcmanfm navigate to “file system -> usr -> share -> icons -> Adwaita"
* in that folder you will see a “cursors” folder
* rename it to something like cursors.original,cursors.bak,cursors.org, etc. or some other mane of your choosing
* quit pcmanfm
* reboot

you will get a different cursor set not to everybody’s liking but the cursor problem is gone even in “Dia”

There's probably a better fix out there but this was OK for me

You have to log in before you can reply Login | Sign Up

Points Rules