A Forum run by Enthusiasts of MidNite Solar

The Open Source software/hardware corner => The Cubie Board => Topic started by: dgd on March 05, 2015, 01:42:27 AM

Title: Just for cubie
Post by: dgd on March 05, 2015, 01:42:27 AM
 MN, Thanks for this new forum area.
Having just taken delivery of my Cubie2, ordered just after reading the info posted by zoneblue, I am already very enthused with its design and plethora of interfaces.

Great to have some decent dual core CPU grunt, plenty of ram and flash.
This small board is several steps up from the Arduino Due which I'm currently developing as a black box, coordinating data gathered from arduino uno, one connected to each classic.

Looking forward to making a well featured web server system for Classic, multiple Classics.
Already very nice graphs in the code from ZB so hoping to leverage from this to get a decent graphical web reporting system as well as an almost real time performance reporter for classics.

Title: Re: Just for cubie
Post by: zoneblue on March 06, 2015, 12:58:24 PM
There might be other things now, but I think that cubian is still the thing.

check out: http://cubian.org/

Theres now a headless version, which is cool. Frees up the graphics ram. Another 400M or so!

And my rambling write about installing it:

Thinking about ordering a dual core too, to play with, seeing as cubie1 is kinda busy. I wonder if it would be a decent enough 24/7 samba server?
Title: Re: Just for cubie
Post by: TomW on March 06, 2015, 01:22:16 PM
DGD, Zoneblue;

Could you guys give me some specifics on what boards you are using? Where you get them [USA here}. Kit or bare Cubie? 

Seems to be several versions and a large variation on what you get. I have trouble understanding some of the Chinese>> English via Google Translate descriptions I see.

Any info appreciated.


Title: Re: Just for cubie
Post by: dgd on March 06, 2015, 05:20:44 PM
I bought the cubie2 for usd60 from the ebay ad that ZB posted in blackbox.
It came from HongKong, post free, and took just 11 days from ordering.
Also bought locally a decent micro SD card, an 8gb SanDisk Ultra for $23
Took near a day to download to my w8 laptop the  SD card linux distribution, I chose
Cb-a20-Ubuntu-desktop-card-v105.img.gz.  It's 990 mb
Now just getting it on to the SD card.
There is lots good info and examples of Cubie GPIO usage and i2c Comms between arduino and cubie
So I don't see it taking too long to get These talking and moving classic data to the cubie.

Title: Re: Just for cubie
Post by: paul alting on March 19, 2015, 07:39:18 AM
Hello folks,

Just registered and first post, even though I've had a few threads open for quite some time in my long list of FireFox tabs.
When coming back to see what was new, I right away noticed the new section for Cubiboard and hence registered.

The reason for my coming here is to gauge some interest in a project I have been working on for a while now, with which I am using a Cubieboard II (A20 Dual Core).

From a lot of my research I have seen that there appears to be a growing population of people wanting to be able have a system whereby they can monitor and control their renewable energy systems.
I have my own renewable system that I live from and so, I am my own first test case, and thought, 'how would it be to develop something better and adaptable?'

Being an avid Arduino developer as well, I set my sights to developing a system that can do more than what a lonely Arduino can do.

So, what I am currently developing is a complete SCADA solution, and with using Modbus as its main communications protocol.
This SCADA software is built from the ground up but using well proven libraries.

The software is able to communicate Modbus by any means, whether that be by any of the serial standards using Modbus RTU, RS-232, RS-485, AsyncTTL, USB, and Ethernet using Modbus TCP.
It has an inbuilt HTTP server that allows connections from say a web browser and has an APi that allows for scanned data to be sent over HTTP, live and historical to name a few.
Like most large SCADA systems, all the configuration data, such as tags are stored in a database, the one I use is SqLite3.
All tags can be scaled from raw data to engineering values, so, if you have a Modbus register of 16 bits, you can have that data represented how ever you wish by setting the a number of attributes for each tag. Each tag has a bunch of settable attributes.

Libraries used are libmodbus, libmicrohttpd and sqlite as a shared library.

For my development gear,
I develop in Ubuntu in Eclipse on a Intel 64 bit Dell D830 Latitude, which I can run and test the software.
My current running machine is a dedicated Dell D420 Latitude installed with Debian text mode only. This is my live system.
Then my in progress test system is the Cubieboard II with Cubian headless mode.
The Mac with OSX is left out of this and only for developing code for Arduino AVR/SAM.

So, the software in its current form can be compiled and operated on Intel 32/64 bits as well as ARM, such as Cubieboard.
I do have a chap here in Australia who is about to set it up on a new model RPi 2, so I'll be interested to (hoping) see how that goes.

The reason I came to the Midnight forums is because I have a chap in the states (where most of you are I guess) who is one of my first test sites and has a Midnight Classic 150, actually, two of them.
While he has the Cubieboard II which I setup remotely from here in Australia, talking Modbus to his Arduino solar hot water control system, we are nearly at the stage to get this system talking to his Classics.
Next he wishes to connect this system to his two Magnum inverters which are not modbus, but their own specific serial protocol.

So, with all this, I would like to know if any of you chaps are interested in this, and would you be interested in being part of the development or testing with Midnight controllers?
I hope this is an ok place to post this message.

For my own system, small as it is, I am lucky to have a small microhydro setup that supplies a lot of my power needs.
But at the moment, I am going through a complete system upgrade, and have LiFeYPO4 cells on the floor here to replace the existing lead acid.

I'm fairly keen to see this new system of mine here with lots of monitoring, especially since my background is engineering up industrial control systems.

I'll stop here, but please ask away any questions, I keen to hear what other might think.
You can find me also on the Arduino forum as Rockwallaby :)
Title: Re: Just for cubie
Post by: dgd on March 19, 2015, 08:12:16 AM
Hi Paul and welcome to the Midnite forum
There are a few SCADA solutions already available but it's good to hear you are doing some development as well.
Are you open sourcing your Arduino and cubie software and If so from where can it be downloaded?

The data acquisition part from midnite controllers using tcp/modbus and modbus RTU via rs232 and  RS485 is already available in this forum. From various arduinos and cubie1 and 2.

The system control part, certainly for midnite Classic, is also well developed, both from Midnite and its LocalApp program but also using modus tcp and RTU.
Fortunately none of this stuff is rocket science and is reasonably easy to understand and code. Just getting up to date modbus register info is probably the most onerous task.
And with the plethora of different RE system designs and manufacturers the thought of one all encompassing SCADA package is somewhat thought provoking and may have difficulty in not becoming just too complex.

The black box project in this forum is not An example of top down development of a SCADA type system (at least I think not) but it rather concentrating on data acquisition only from midnite Classic then reporting/presenting that data in interesting text and graph formats.


Title: Re: Just for cubie
Post by: paul alting on March 21, 2015, 08:28:57 PM
Thanks dgd,
Yes, the software will be open sourced, as I am keen to see how it might evolve with a greater community.
My plan is to use it in my own projects where I can derive some income from it, but this really comes down to my time in the engineering of any project.

To operate the system you need two parts, the first is the main application program which operates on GNU/Linux.
It operates in a terminal session so it can run on headless systems, which is how I use it.
It does have basic screen data using ncurses library.

I run it in tmux, so it can continue to operate when I make connections via SSH to remote systems.

The second part I have worked on is the actual web app.
This is a framework I have developed that is based on 'twitter bootstrap' for GUI niceness and 'backbone.js' for code nicesness.
I use a few other libraries for doing the graphical work.
For charting, I use highcharts.
For gauges I presently make use of the steetseries gauges, which are code heavy, but elegantly nice.

I am currently setting up the repos on GitHub, and will let you know when I get it up there.
The documents are an ongoing work.
There's a section of code I'm presently re-doing to do with the history, regarding pulling out of SQLite3 DB, the HTTP requested history for requested data tags.
I need to test and verify my code for Modbus multiblocks, where you can define discrete register blocks or packets per device.

If you like to see a simple example, which is my current system (keep in mind simple), then visit myweb site and then scroll down to the orange button labeled 'HydroSolar'.
Site is paulalting.com (http://paulalting.com)

That will take you to the web app.
The web app is what is called a 'Single Page Application', where the complete web app is brought into your web browser in one instance.
It is all run in javascript, which then pulls up HTML page templates, which I cache internally in objects.
It makes loading a little slower, but after that, it is super fast.
My idea behind it all, is to act more like a native HMI/SCADA application. (I have done a lot of work in the past on things like CitectSCADA and Wonderware an PLC integration and so forth).
Title: Re: Just for cubie
Post by: xsnrg on March 22, 2015, 12:38:00 AM
Paul, I just walked through your website.  Very nicely done.
Title: Re: Just for cubie
Post by: Westbranch on March 22, 2015, 12:59:35 AM
Paul, ditto on a visit to your site.  You really did  mean slow to load, but fast after that.
Thanks for posting.
Title: Re: Just for cubie
Post by: paul alting on March 22, 2015, 01:08:57 AM
Thank you for your kind words xsnrg and just now Westbranch,

Yes, the steelseries.js for gauges is far too large, but I use it as I like it, but have thoughts about making another of my own libraries to do much the same.
Also, once your browser has cached things like bootstrap.js and backbone.js, underscore.js and steelseries.js, you should find it quicker the following times.
Your browser cache will already have things like jquery, js and a few others.

As I say on my main site, there is still a lot to be done yet, and I was hoping to be closer to completion at the end of last year.
It will be coming up to almost 12 months since I started the project, and I'm itching to make better progress.

I'm slowed up at the moment as I'm doing a new system install here at my little cabin in northern Tasmania with Winston LiFeYPO4 400Ahr cells.
I formed group of 4 of us to upgrade from lead acid to the Winston cells, and we bought all the 40 cells the supplier in Western Australia, EV-Works had in stock.
If you are at all interested in following the progress of these four systems, myself, my neighbour and my brother in law, and one other, then I have a thread on Energey Matters forum, at https://forums.energymatters.com.au/solar-wind-gear/topic6202.html (https://forums.energymatters.com.au/solar-wind-gear/topic6202.html)

The idea with Quadlog is that you can make what ever web app interface you wish, using your prefered set of tools.
I started with backbone.js as a framework that utterly confused me for a long time, but have it more under control and understood now.
Again, my preference is for a web app that is a single page application, rather than a system where each HTML page goes back to the server to get more and then still have the underlying AJAX calls.

At this point in time, even though I a couple of test sites, the QuadlogSCADA is still at least one month away before this latest release will be available I think.
It shouldn't take me so long, but with so many things to do, I know it will take this at least.

At some point, I will like to make some very easy step by step documentation that details the working sof QuadlogSCADA, the concepts, the configuration, and also the web app side.
I have made a start with the documentation , and as you can guess, it will evolve into something substantial I hope.
With all my development, I ususally document my processes in a step by step approach so I can coem back to it if I need or it can form part of key sections of the main documentation.

QuadlogSCADA is my full time job :)

Please excuse spelling errors, I'm not sure if the spell check button on the post form works, it doesn't appear to work for me. OSX 10.8 latest FireFox.
Title: Re: Just for cubie
Post by: Westbranch on March 22, 2015, 01:41:56 PM
Please excuse spelling errors, I'm not sure if the spell check button on the post form works, it doesn't appear to work for me. OSX 10.8 latest FireFox.

It must be something in your OS as it works for me on XP, W7 starter and W7 Home Premium...

Title: Re: Just for cubie
Post by: paul alting on March 22, 2015, 03:44:37 PM
I don't believe it will be OS related, it will be relataed to either the web browser or web server.
When I select spell check, it opens up a new popup window, staying blank, with no content being displayed.

Let me try this post, maybe I need to wait a little longer before killing the tab or window.
Nope, again, just opens a new popup window with nothing in it, even after 30 seconds.
The url is 'http://midnitesolar.com/Forum/index.php?action=spellcheck'

I just tried Google Chrome, same thing.
I tried both quick reply and normal reply, with no difference, just a blank open popup window.

I just now checked to see if any issues exist for this or if it is being experienced by others.
Yes, it appears it has been for SMF 2.0.x, and it appears to be a server problem, http://www.simplemachines.org/community/index.php?topic=528492.0 (http://www.simplemachines.org/community/index.php?topic=528492.0)

A blank screen... Assuming it is actually, a white, blank screen and not a screen that is mostly white with an error text...  Means that your php had a critical error
Check your forum root for an error.log file
Exactly what I have, but why does it work for you and not me, that makes no sense, unless the server php is having a problem with my location and that is tied back to regional location.
Title: Re: Just for cubie
Post by: Westbranch on March 22, 2015, 04:51:32 PM
Someone cut the cable from the mainland?? ::)  ;)  :-[
Title: Re: Just for cubie
Post by: Resthome on March 22, 2015, 07:23:25 PM
Spell Check doesn't work on iOS 8.2  from Safari or Chrome. Just opens up a new tab with blank white screen. So something broke when Ryan moved it to a new server.

Just checked Win7 and it's broke there with IE.
Title: Re: Just for cubie
Post by: paul alting on March 22, 2015, 09:13:10 PM
Westbranch wrote:
Someone cut the cable from the mainland??
I think so, have shovel in hand will dig in new cable.  :-\

Resthome wrote:
Spell Check doesn't work on iOS 8.2
Yes, I saw that, but I have OSX, not iOS.

Right, I did some more looking, and it does seem to be a problem with SMF for a number of different platforms, including Android.
I've been frustrated with my FireFox not having in application spell checking working.
I have all OS settings correct, and have FireFox preferences set for 'check my spelling as I type'.
I found I had no local dictionary installed, so, rather than installing crazy US spelling I found an Australian dictionary an installed that.

Now I see misspelled wrods unlderlined in red, which, for me, is a far better solution than any server based spelling checker.
I'm a happy chappy now, thanks for your input anyhow, and sorry to carry this off-topic.
On topic resume  :D
Title: Re: Just for cubie
Post by: dgd on April 22, 2015, 02:51:19 AM
I have had some time to play with my new Cubie 2 and it sure is a nice fast and well featured small computer system. Installed Linux, many development tools, Apache, several support libs and quite a few graphics support systems. Added a 120G SSD and expansion breakout board to get easier access to i2c bus.
And it has a real ethernet interface with featured stack (a major step up from the limited Arduino ethernet)
The gcc c++ compiler and vi editor (a proper unix editor!) just make c coding a pleasure and I have just about got my Arduino DUE web server for Classic with analogue gauges display completely ported to the Cubie with Linux.
More soon

Title: Re: Just for cubie
Post by: TomW on April 22, 2015, 10:51:09 AM
I  am really liking my CubieTruck. Lightyears ahead of the Raspberry PI! Rock solid and with the terabyte HD I added it has lots of storage. Still looking to get it to boot from a HD to avoid the  finite write limits on an microSD. Although I have read various theories on this, I am still concerned with the OS on the SD card.

Looking forward to your port of your gauges system to the Cubie.

Been fooling  around with the infrared port on mine. It seems it may be possible to get IR remote control of a system sorted once interactive communications is established.  ;D


Title: Re: Just for cubie
Post by: zoneblue on April 22, 2015, 05:48:48 PM
Yes for a little over 1W its a lot of computing in a small package. I bought a spare to play round with and also trying to get the SSD to boot. using this. http://cubieboard.ro/cubian-x-how-to-move-filesystem-to-hdd/
Title: Re: Just for cubie
Post by: dgd on April 22, 2015, 08:24:39 PM
Looking forward to your port of your gauges system to the Cubie.

Hopefully not too far away.
I see there are several options available starting Linux from the hdd interface, I have looked at some of the forum comments and I'm hoping the issues will be solved before I move web development to the Cubie

Title: Re: Just for cubie
Post by: dgd on April 23, 2015, 11:14:46 PM

Was just thinking about the analogue gauge display I am using and using it on the Cubie.
The index.htm file that is listed in the Arduino DUE thread contains all the javascript and html to display the gauges and svg info box for a Classic. The only thing needed is the XML file and the details of this are in the sketch I posted. (and of course you will need a web server such as Apache on the cubie)
With RossW's ethernet utility to extract Classic modbus registers it only needs these to update the XML file on a regular basis (aka every few seconds) and the js will insert the data in the web page.
I cant see why this would not work, I'm sort of concentrating on the modbus RTU extraction of registers as I dont enjoy crashing my Classics by using their ethernet interfaces (maybe thats fixed now?). Not sure if you can program this (I can't as I have  never used newmodbus) but I'm sure others here using newmodbus could probably assist if they have the time.

In meantime I am testing the idea of using a nano-Arduino for each Classic/KID to extract data and i2c that to the Cubie for AJAX to insert into gauge/panel/report graphs pages

Title: Re: Just for cubie
Post by: TomW on April 24, 2015, 08:43:12 AM

Been running newmodbus against 3 Classics for months now with no issues. Running from crond every minute and logging data from all 3 to a flat file.

I am spread pretty thin here because of our relocation, renovating one place and spiffing up the old place to sell so not doing much on these hobby projects like the Cubie and Classic logging / monitoring. With no system at the new place (yet) I won't be able to test against a Classic once we move which, hopefully will be in the next couple weeks. Pretty burnt out on this split occupancy stuff.

It sure is not boring  :o

Title: Re: Just for cubie
Post by: dgd on April 24, 2015, 06:19:52 PM

You must be very busy with all that work, I just hope you manage to get some relaxing time off as moving homes can be extremely stressful and not a lot of fun.

I have this optimistic view that I can get the Cubie2 up and running a real time display of Classic data and also manage data logging with some nice graph reporting - all via web pages. So maybe there will something for you to test when you get your RE system all operational again  :)