Web server for Classic using Arduino DUE

Started by dgd, March 12, 2015, 01:00:24 AM

Previous topic - Next topic

Westbranch

speaking of low cost, have you seen the Texas Instruments Stellaris LMF3F120XL bare bones at ~$13.00 US.

Haven't read about it yet but lowest cost one I came across....
KID FW1811 560W >C&D 24V 900Ah AGM
CL150 29032 FW V.2126-NW2097-GP2133 175A E-Panel WBjr, 3Px4s 140W > 24V 900Ah AGM,
2 Cisco WRT54GL i/c DD-WRT Rtr, NetGr DS104Hub
Cotek ST1500 Inv  want a 24V  ROSIE Inverter
OmniCharge3024  Eu1/2/3000iGens
West Chilcotin 1680+W to come

paul alting

David wrote:
QuoteAFAIK, is that the DUE is really an embedded processor system /snip, whereas the Cubie is not designed as an embedded system but is more general computer /snip.
Others probably have different views  :D
Yes, and what is interesting, they are both using ARM cores.
The Arduino family of boards, in particular, the Arduino Mega and Arduino DUE, being more suited with extra resources, can be made to work quite well as simple web connected devices, say either as a HTTP server or client.

These boards start to suffer when the application gets more complex in terms of anything web based. For example, when you start to use the SD card to store HTML or javascript to be dished out to the client. The Ethernet interface uses SPI, as does the SD card, with there only being one SPI channel, there is then a fundamental inefficiency of performance. Also, as you know, the standard Arduino Ethernet can only accept four connections, which if your software becomes more complex can be used by one HTTP client requesting things like CSS, javascript, image or any other range of files called for. A second physical connection then becomes a problem, where it needs to wait, and may possibly time-out.

David wrote:
QuoteUnfortunately the Arduino IDE included C compiler just simply does not support any type of printf instruction.
Ok, I'm surprised by that. Most 'other IDE' setups still use the Arduino toolchain included in the Arduino IDE. I use Eclipse with the 'ArduinoEclipse' plugin developed by Jantje in Belgium. It's a pleasure to work with, with full syntax highlighting and hover over functions to see their requirements and much more. Since this plugin uses the Arduino IDE toolchain, which means the compiler I would think you should be able to use the printf functionality. For programs where I have used it, I have not included any other 'includes' or made any specific changes and the Eclipse setup uses no other resources to enable this. I'll be interested to see if you can.

Slightly off topic, I have setup my Eclipse on the Mac now so that I can both continue to develop Arduino based code as well as now the code for Quadlog, by setting up a GCC toolchian.
Now I can not only code Quadlog on the bigger screen vs my GNU/Linux laptop with piddly 15" screen, I can actually run the compiled application on OSX. I was surprised indeed.
I will start up a topic for it, where I can detail it more. :)

In terms of other boards, there is the new Quad core board form Cubie, but for me, that is too excessive for small systems like we are talking about.
There is also the Olimex range of boards as well as the new RPi which I think brings the RPi into the selection of boards that I would possibly now look to work with.
https://www.olimex.com/Products/OLinuXino/open-source-hardware
I looked at these before purchasing the Cubieboard II, but sent an email to them requesting some info, but I never heard back form them, so I went elsewhere. I would try again with them.
____
Paul
6 x 200W PV into home-brew 6 stage MOSFET charge controller : Microhydro 220Vac 3 phase IMAG
8 x 400Ah LiFeYPO4 Winston : Latronics LS2412 inverter
QuadlogSCADA control and monitoring system : Tasmania, Australia : http://paulalting.com

dgd

Quote from: Westbranch on March 25, 2015, 06:30:27 PM
speaking of low cost, have you seen the Texas Instruments Stellaris LMF3F120XL bare bones at ~$13.00 US.

Haven't read about it yet but lowest cost one I came across....

Element14 sell this but the eval kit is about US$140 and the bare bones will need lots of extra interface/memory cards.
Just too expensive for me for another 80mhz arm? cpu system
Cubie2 is much better value since it is a complete eval computer system

dgd
Classic 250, 150,  20 140w, 6 250w PVs, 2Kw turbine, MN ac Clipper, Epanel/MNdc, Trace SW3024E (1997), Century 1050Ah 24V FLA (1999). Arduino power monitoring and web server.  Off grid since 4/2000
West Auckland, New Zealand

Westbranch

KID FW1811 560W >C&D 24V 900Ah AGM
CL150 29032 FW V.2126-NW2097-GP2133 175A E-Panel WBjr, 3Px4s 140W > 24V 900Ah AGM,
2 Cisco WRT54GL i/c DD-WRT Rtr, NetGr DS104Hub
Cotek ST1500 Inv  want a 24V  ROSIE Inverter
OmniCharge3024  Eu1/2/3000iGens
West Chilcotin 1680+W to come

dgd

#19
Quote from: paul alting on March 25, 2015, 07:36:28 PM
... Yes, and what is interesting, they are both using ARM cores.
The Arduino family of boards, in particular, the Arduino Mega and Arduino DUE, being more suited with extra resources, can be made to work quite well as simple web connected devices, say either as a HTTP server or client.

The DUE certainly lacks the interfaces for high level data storage and the TCP limits could become a concern if the development moved towards a more featured system.
However, for the sort of simple blackbox system I had in mind the DUE looks almost ideally suited.

My goal was to create a black box that shows the running Classic's data and the battery SOC in one web page (at  least every 10 to 20 seconds) plus also parallel display same data for up to 4 Classics (this part looks to be already covered by the DUE with multiole serial ports and the sketch listed above) and perhaps integrate figures for an overall RE power generation picture.
An additional page or three to show a days running data with 5 to 30 minute data points
Other feature would be the downloading of a csv data file with 30 to 240 days of data for external processing/display etc. This would probably mean SD card storage of running data

The 4 tcp connection limitation, although not ideal, would be sufficient for me and one or two others to monitor a system and some_one_ else to use the MN Local App if they wanted to.

Also with the seeming plethora of resource, CPU, ram and flash plus countless IO pins the addition of several AUX type controls seems to be quite straighforward. I'm thinking at least two AUX outputs to relays, a couple of PWM outputs with at least one set up on the WasteNot basis for feeding a dump load such as water heating and those analogue inputs, using some for current measurement at various points in an RE system (they have 12bit accuracy, 4096 points, on a 3.3v input max).

Then I would leave all of the processing and analysis of data, graph management, proper web interfacing etc, to a more data processing orientated system such as the Cubie2.
Just some thoughts  :D

dgd
Classic 250, 150,  20 140w, 6 250w PVs, 2Kw turbine, MN ac Clipper, Epanel/MNdc, Trace SW3024E (1997), Century 1050Ah 24V FLA (1999). Arduino power monitoring and web server.  Off grid since 4/2000
West Auckland, New Zealand

paul alting

David wrote:
Quoteusing some for current measurement at various points in an RE system (they have 12bit accuracy, 4096 points, on a 3.3v input max).
Yes, another reason I am moving to the DUE from the Mega. I bough a few of the Alegro ACS758 50Amp uni-directional sensors from element14 which I will interface to the analog inputs. I'll operate the ACS758 at 5 volts for better performance, but reduce the output through resistor divider to suit the 3v3 input of the DUE.

QuoteThen I would leave all of the processing and analysis of data, graph management, proper web interfacing etc, to a more data processing orientated system such as the Cubie2
I'm hoping I can interest you in trying out Quadlog sometime then. It does these things and if you know how to program the Arduino DUE, I'd be sure you can easily understand the code for Quadlog as it is the same language, just different compiler. Not that you need to do anything with the code, but you would have it anyhow. I think you'll have more of a hoot setting it up, and it doesn't need any of that bloaty stuff like Apaché to run. It is small, simple and is designed with these specific things in mind.

David, you mentioned you had the thought of moving to an IDE that might prove to be more suited to your needs. If so, give me a shout, I would be happy to help you set it up if you need any helping hand.
I think if you are going to play more around with code, then I can only highly suggest trying something like Eclipse. I don't ever use the Arduino IDE, even for simple things, yet I started out my C programming with it for quite some time.

Anyhow, I find it exciting to hear your developments and to know there are others out there doing interesting things with renewable energy systems.
I know from looking at David's site he is in NZ, just across the big water from me, but Westbranch, where are you I wonder?
____
Paul
6 x 200W PV into home-brew 6 stage MOSFET charge controller : Microhydro 220Vac 3 phase IMAG
8 x 400Ah LiFeYPO4 Winston : Latronics LS2412 inverter
QuadlogSCADA control and monitoring system : Tasmania, Australia : http://paulalting.com

Westbranch

Paul, see additional details now in my sig line
KID FW1811 560W >C&D 24V 900Ah AGM
CL150 29032 FW V.2126-NW2097-GP2133 175A E-Panel WBjr, 3Px4s 140W > 24V 900Ah AGM,
2 Cisco WRT54GL i/c DD-WRT Rtr, NetGr DS104Hub
Cotek ST1500 Inv  want a 24V  ROSIE Inverter
OmniCharge3024  Eu1/2/3000iGens
West Chilcotin 1680+W to come

dgd

#22
The next stage is the not-so-simple web server.
The simple web server has used the loop() function in the sketch to read modbus registers from an rs232 connected Classic then using an in-code generated web page to display those register values. This process repeats using the main loop, the web page is completely redrawn as the web connection is closed then re-opened on each iteration of loop().
This has worked quite well for up to four rs232 connected Classics to one DUE board. Since most of the text identifying fields are static and only the data value fields change then the display has looked reasonably steady with only the occasional noticeable full screen refresh.
The flickering display issue due to full screen redraw would be more likely over a slow or congested connection/

So the next update is necessary to allow several additional features
The in-page selection of alternate web pages to display historical data/analysis reports etc.. and the automatic updating of only the data fields in the main display page.
For this the web pages will be stored on an SD card and loaded by the WEB server as needed. In-webpage buttons will select moving between web pages.
This will require web page keepalive, meaning that the sketch will remain inside the while-connected loop of the sketch. This leads to a problem in that without exiting to the main loop() that the code reading the modbus registers will not be executed until the connection closes.
The reading of modbus registers will have to occur inside the while-connected loop as part of the displayed data fields only update process.
Outside the connection loop the main loop will also continue to read modbus registers  when there is not an active tcp connection.

The first stored web page, index.html contains an AJAX function that will read modbus registers and update the page display fields.
Testing this code now also with the addition of analogue meter displays for various data.
This is using HTML5 canvas in javascript

Example sketch and web pages for SD card posted soon..


dgd

Classic 250, 150,  20 140w, 6 250w PVs, 2Kw turbine, MN ac Clipper, Epanel/MNdc, Trace SW3024E (1997), Century 1050Ah 24V FLA (1999). Arduino power monitoring and web server.  Off grid since 4/2000
West Auckland, New Zealand

dgd

#23
An interesting part of this web server development has been (for me anyway) the possibility of getting some nice analogue meter displays included in the web pages. Especially the main page that displays updated  modbus registers.
The web page index.html stored on SD card and loaded by the DUE sketch to serve to a connecting web browser is listed below. The apparent gibberish at the start is the meter generating code, it is canv-gauge (by Mykhailo Stadnyk and can be downloaded from Mikhus at github)
I have included it 'as-is' in case anyone wants to download the html file and execute it with a web  browser. This will show the meter display but obviously no live updating as it cannot get an XML file from my DUE.
WIth firefox and W8 the meter window can be moved and enlarged/decreased, minimized etc - just like any normal window
An example that shows the WBjr amps register obtained by serial modbus from my Classic and using AJAX function in the html code to get this data from the Arduino DUE is also shown below.
In my live version of this the meter updates every second although the modbus register reading has difficulty keeping up with this.

I have also created two displays using multiple meters (similar to Local App) and a Battery monitor using WBjr data. More of these later when I get them looking better  :)

dgd


<!DOCTYPE html>
<html>
    <head>
        <title>Arduino Ajax Dial</title>
        <script>
var data_val = 0;
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};
if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)
if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('t W=v(f){W.2t.3T(A);A.B={Z:2u,19:1q,1h:1q,1J:U,1b:D,K:0,V:[\'0\',\'20\',\'40\',\'2A\',\'2B\',\'D\'],2r:10,2C:M,1E:U,2q:{2D:3,2E:2},2H:M,1c:{2j:10,2m:3y,2O:\'3v\'},J:{2P:\'#4h\',V:\'#31\',2r:\'#3k\',1J:\'#37\',1E:\'#37\',3e:\'#31\',1t:{2s:\'1e(3Y, 3d, 3d, 1)\',3c:\'1e(1Y, 5I, 5E, .9)\'}},1o:[{1n:20,1D:2A,1F:\'#3j\'},{1n:2A,1D:2B,1F:\'#36\'},{1n:2B,1D:D,1F:\'#5n\'}]};t g=0,1p=A,N=0,1S=0,1G=U;A.5d=v(a){N=f.1c?g:a;t b=(f.1b-f.K)/D;1S=a>f.1b?1S=f.1b+b:a<f.K?f.K-b:a;g=a;f.1c?3l():A.1g();C A};A.3m=v(a){N=g=a;A.1g();C A};A.4T=v(){g=N=1S=A.B.K;A.1g();C A};A.4R=v(){C g};A.13=v(){};v 2k(a,b){Q(t i 4P b){z(1H b[i]=="1W"&&!(4O.4y.2V.4p(b[i])===\'[1W 4n]\')&&i!=\'Z\'){z(1H a[i]!="1W"){a[i]={}}2k(a[i],b[i])}O{a[i]=b[i]}}};2k(A.B,f);A.B.K=1R(A.B.K);A.B.1b=1R(A.B.1b);f=A.B;N=g=f.K;z(!f.Z){4m 4j("4g 4d 4b 46 44 41 3Z 3W W 1W!");}t j=f.Z.5K?f.Z:2R.5v(f.Z),q=j.3u(\'2d\'),1i,1y,1A,14,17,u,1d;v 2M(){j.19=f.19;j.1h=f.1h;1i=j.4s(M);1d=1i.3u(\'2d\');1y=j.19;1A=j.1h;14=1y/2;17=1A/2;u=14<17?14:17;1i.2J=U;1d.3P(14,17);1d.G();q.3P(14,17);q.G()};2M();A.4Z=v(a){2k(A.B,a);2M();A.1g();C A};t k={4q:v(p){C p},4e:v(p){C E.1L(p,2)},4c:v(p){C E.1L(p,5)},3v:v(p){C 1-E.1O(E.5C(p))},5k:v(p){C 1-(v(p){Q(t a=0,b=1;1;a+=b,b/=2){z(p>=(7-4*a)/11){C-E.1L((11-6*a-11*p)/4,2)+E.1L(b,2)}}})(1-p)},4S:v(p){C 1-(v(p){t x=1.5;C E.1L(2,10*(p-1))*E.1T(20*E.1a*x/3*p)})(1-p)}};t l=2u;v 3S(d){t e=2v 3R;l=2x(v(){t a=2v 3R-e,1M=a/d.2m;z(1M>1){1M=1}t b=1H d.2g=="v"?d.2g:k[d.2g];t c=b(1M);d.3Q(c);z(1M==1){2b(l)}},d.2j||10)};v 3l(){l&&2b(l);t b=(1S-N),1n=N,29=f.1c;3S({2j:29.2j,2m:29.2m,2g:29.2O,3Q:v(a){N=1R(1n)+b*a;1p.1g()}})};q.5l="3O";A.1g=v(){z(!1i.2J){1d.3M(-14,-17,1y,1A);1d.G();t a=q;q=1d;3L();3K();3I();3H();3F();3D();3z();1i.2J=M;q=a;5G a}q.3M(-14,-17,1y,1A);q.G();q.4a(1i,-14,-17,1y,1A);z(!W.28){t b=2x(v(){z(!W.28){C}2b(b);2K();2L();z(!1G){1p.13&&1p.13();1G=M}},10)}O{2K();2L();z(!1G){1p.13&&1p.13();1G=M}}C A};v S(a){C a*E.1a/4J};v 1l(a,b,c){t d=q.4Y(0,0,0,c);d.1V(0,a);d.1V(1,b);C d};v 3L(){t a=u/D*5g,3x=u-a,2a=u/D*5q,5u=u-2a,1f=u/D*5z,5A=u-1f;3t=u/D*5F;q.G();z(f.2H){q.2o=3x;q.2n=\'1e(0, 0, 0, 0.5)\'}q.P();q.16(0,0,a,0,E.1a*2,M);q.L=1l(\'#42\',\'#43\',a);q.T();q.R();q.P();q.16(0,0,2a,0,E.1a*2,M);q.L=1l(\'#49\',\'#36\',2a);q.T();q.P();q.16(0,0,1f,0,E.1a*2,M);q.L=1l(\'#3j\',\'#3s\',1f);q.T();q.P();q.16(0,0,3t,0,E.1a*2,M);q.L=f.J.2P;q.T();q.G()};v 3H(){t r=u/D*2T;q.2e=2;q.2U=f.J.V;q.G();Q(t i=0;i<f.V.H;++i){t a=45+i*(1U/(f.V.H-1));q.1z(S(a));q.P();q.1K(0,r);q.F(0,r-u/D*15);q.1X();q.R();q.G()}z(f.2C){q.1z(S(2X));q.P();q.16(0,0,r,S(45),S(4N),U);q.1X();q.R();q.G()}};v 3I(){t r=u/D*2T;q.2e=1;q.2U=f.J.2r;q.G();t b=f.2r*(f.V.H-1);Q(t i=0;i<b;++i){t a=45+i*(1U/b);q.1z(S(a));q.P();q.1K(0,r);q.F(0,r-u/D*7.5);q.1X();q.R();q.G()}};v 3F(){t r=u/D*55;Q(t i=0;i<f.V.H;++i){t a=45+i*(1U/(f.V.H-1)),p=1w(r,S(a));q.1x=20*(u/1q)+"2i 2Y";q.L=f.J.3e;q.2e=0;q.2h="2f";q.27(f.V[i],p.x,p.y+3)}};v 3D(){z(!f.1J){C}q.G();q.1x=24*(u/1q)+"2i 2Y";q.L=f.J.1J;q.2h="2f";q.27(f.1J,0,-u/4.25);q.R()};v 3z(){z(!f.1E){C}q.G();q.1x=22*(u/1q)+"2i 2Y";q.L=f.J.1E;q.2h="2f";q.27(f.1E,0,u/3.25);q.R()};v 32(a){t b=f.2q.2E,34=f.2q.2D;a=1R(a);t n=(a<0);a=E.35(a);z(b>0){a=a.5t(b).2V().1j(\'.\');Q(t i=0,s=34-a[0].H;i<s;++i){a[0]=\'0\'+a[0]}a=(n?\'-\':\'\')+a[0]+\'.\'+a[1]}O{a=E.3O(a).2V();Q(t i=0,s=34-a.H;i<s;++i){a=\'0\'+a}a=(n?\'-\':\'\')+a}C a};v 1w(r,a){t x=0,y=r,1O=E.1O(a),1T=E.1T(a),X=x*1T-y*1O,Y=x*1O+y*1T;C{x:X,y:Y}};v 3K(){q.G();t a=u/D*2T;t b=a-u/D*15;Q(t i=0,s=f.1o.H;i<s;i++){t c=f.1o[i],39=(f.1b-f.K)/1U,1P=S(45+(c.1n-f.K)/39),1N=S(45+(c.1D-f.K)/39);q.P();q.1z(S(2X));q.16(0,0,a,1P,1N,U);q.R();q.G();t d=1w(b,1P),3a=1w(a,1P);q.1K(d.x,d.y);q.F(3a.x,3a.y);t e=1w(a,1N),3b=1w(b,1N);q.F(e.x,e.y);q.F(3b.x,3b.y);q.F(d.x,d.y);q.1C();q.L=c.1F;q.T();q.P();q.1z(S(2X));q.16(0,0,b,1P-0.2,1N+0.2,U);q.R();q.1C();q.L=f.J.2P;q.T();q.G()}};v 2L(){t a=u/D*12,1f=u/D*8,1u=u/D*3X,1r=u/D*20,2l=u/D*4,1B=u/D*2,38=v(){q.3f=2;q.3g=2;q.2o=10;q.2n=\'1e(5L, 3h, 3h, 0.45)\'};38();q.G();z(N<0){N=E.35(f.K-N)}O z(f.K>0){N-=f.K}O{N=E.35(f.K)+N}q.1z(S(45+N/((f.1b-f.K)/1U)));q.P();q.1K(-1B,-1r);q.F(-2l,0);q.F(-1,1u);q.F(1,1u);q.F(2l,0);q.F(1B,-1r);q.1C();q.L=1l(f.J.1t.2s,f.J.1t.3c,1u-1r);q.T();q.P();q.F(-0.5,1u);q.F(-1,1u);q.F(-2l,0);q.F(-1B,-1r);q.F(1B/2-2,-1r);q.1C();q.L=\'1e(1Y, 1Y, 1Y, 0.2)\';q.T();q.R();38();q.P();q.16(0,0,a,0,E.1a*2,M);q.L=1l(\'#3s\',\'#36\',a);q.T();q.R();q.P();q.16(0,0,1f,0,E.1a*2,M);q.L=1l("#47","#48",1f);q.T()};v 3i(x,y,w,h,r){q.P();q.1K(x+r,y);q.F(x+w-r,y);q.23(x+w,y,x+w,y+r);q.F(x+w,y+h-r);q.23(x+w,y+h,x+w-r,y+h);q.F(x+r,y+h);q.23(x,y+h,x,y+h-r);q.F(x,y+r);q.23(x,y,x+r,y);q.1C()};v 2K(){q.G();q.1x=40*(u/1q)+"2i 30";t a=32(g),2Z=q.4f(\'-\'+32(0)).19,y=u-u/D*33,x=0,2W=0.12*u;q.G();3i(-2Z/2-0.21*u,y-2W-0.4i*u,2Z+0.3n*u,2W+0.4k*u,0.21*u);t b=q.4l(x,y-0.12*u-0.21*u+(0.12*u+0.3o*u)/2,u/10,x,y-0.12*u-0.21*u+(0.12*u+0.3o*u)/2,u/5);b.1V(0,"#37");b.1V(1,"#3k");q.2U=b;q.2e=0.3n*u;q.1X();q.2o=0.3p*u;q.2n=\'1e(0, 0, 0, 1)\';q.L="#4o";q.T();q.R();q.3f=0.3q*u;q.3g=0.3q*u;q.2o=0.3p*u;q.2n=\'1e(0, 0, 0, 0.3)\';q.L="#31";q.2h="2f";q.27(a,-x,y);q.R()}};W.28=U;(v(){t d=2R,h=d.3r(\'4r\')[0],2S=4t.4u.4v().4w(\'4x\')!=-1,2Q=\'4z://4A-4B.4C/4D/4E/4F-7-4G.\'+(2S?\'4H\':\'4I\'),1I="@1x-4K {"+"1x-4L: \'30\';"+"4M: 2Q(\'"+2Q+"\');"+"}",1s,r=d.3w(\'1v\');r.2N=\'1I/4Q\';z(2S){h.2p(r);1s=r.2I;1s.3A=1I}O{4U{r.2p(d.4V(1I))}4W(e){r.3A=1I}h.2p(r);1s=r.2I?r.2I:(r.4X||d.3B[d.3B.H-1])}t b=2x(v(){z(!d.3C){C}2b(b);t a=d.3w(\'50\');a.1v.51=\'30\';a.1v.52=\'53\';a.1v.1h=a.1v.19=0;a.1v.54=\'56\';a.57=\'.\';d.3C.2p(a);58(v(){W.28=M;a.59.5a(a)},3y)},1)})();W.2t=[];W.2t.5b=v(a){z(1H(a)==\'5c\'){Q(t i=0,s=A.H;i<s;i++){z(A[i].B.Z.18(\'5e\')==a){C A[i]}}}O z(1H(a)==\'5f\'){C A[a]}O{C 2u}};v 3E(a){z(2G.3G){2G.3G(\'5h\',a,U)}O{2G.5i(\'5j\',a)}}3E(v(){v 2F(a){t b=a[0];Q(t i=1,s=a.H;i<s;i++){b+=a[i].1Z(0,1).5m()+a[i].1Z(1,a[i].H-1)}C b};v 3J(a){C a.5o(/^\\s+|\\s+$/g,\'\')};t c=2R.3r(\'5p\');Q(t i=0,s=c.H;i<s;i++){z(c[i].18(\'1k-2N\')==\'5r-5s\'){t d=c[i],B={},1m,w=2c(d.18(\'19\')),h=2c(d.18(\'1h\'));B.Z=d;z(w){B.19=w}z(h){B.1h=h}Q(t e=0,1s=d.3N.H;e<1s;e++){1m=d.3N.5w(e).5x;z(1m!=\'1k-2N\'&&1m.1Z(0,5)==\'1k-\'){t f=1m.1Z(5,1m.H-5).5y().1j(\'-\'),I=d.18(1m);z(!I){2z}5B(f[0]){2y\'J\':{z(f[1]){z(!B.J){B.J={}}z(f[1]==\'1t\'){t k=I.1j(/\\s+/);z(k[0]&&k[1]){B.J.1t={2s:k[0],3c:k[1]}}O{B.J.1t=I}}O{f.5D();B.J[2F(f)]=I}}26}2y\'1o\':{z(!B.1o){B.1o=[]}2w=I.1j(\',\');Q(t j=0,l=2w.H;j<l;j++){t m=3J(2w[j]).1j(/\\s+/),1Q={};z(m[0]&&m[0]!=\'\'){1Q.1n=m[0]}z(m[1]&&m[1]!=\'\'){1Q.1D=m[1]}z(m[2]&&m[2]!=\'\'){1Q.1F=m[2]}B.1o.3T(1Q)}26}2y\'1c\':{z(f[1]){z(!B.1c){B.1c={}}z(f[1]==\'2O\'&&/^\\s*v\\s*\\(/.5H(I)){I=3U(\'(\'+I+\')\')}B.1c[f[1]]=I}26}5J:{t n=2F(f);z(n==\'13\'){2z}z(n==\'V\'){I=I.1j(/\\s+/)}O z(n==\'2C\'||n==\'2H\'){I=I==\'M\'?M:U}O z(n==\'2q\'){t o=I.1j(\'.\');z(o.H==2){I={2D:2c(o[0]),2E:2c(o[1])}}O{2z}}B[n]=I;26}}}}t g=2v W(B);z(d.18(\'1k-3V\')){g.3m(1R(d.18(\'1k-3V\')))}z(d.18(\'1k-13\')){g.13=v(){3U(A.B.Z.18(\'1k-13\'))}}g.1g()}}});',62,358,'||||||||||||||||||||||||||ctx|||var|max|function||||if|this|config|return|100|Math|lineTo|save|length|attrValue|colors|minValue|fillStyle|true|fromValue|else|beginPath|for|restore|radians|fill|false|majorTicks|Gauge|||renderTo||||onready|CX||arc|CY|getAttribute|width|PI|maxValue|animation|cctx|rgba|r2|draw|height|cache|split|data|lgrad|prop|from|highlights|self|200|rOut|ss|needle|rIn|style|rpoint|font|CW|rotate|CH|pad2|closePath|to|units|color|imready|typeof|text|title|moveTo|pow|progress|ea|sin|sa|hlCfg|parseFloat|toValue|cos|270|addColorStop|object|stroke|255|substr||025||quadraticCurveTo|||break|fillText|initialized|cfg|r1|clearInterval|parseInt||lineWidth|center|delta|textAlign|px|delay|applyRecursive|pad1|duration|shadowColor|shadowBlur|appendChild|valueFormat|minorTicks|start|Collection|null|new|hls|setInterval|case|continue|60|80|strokeTicks|int|dec|toCamelCase|window|glow|styleSheet|i8d|drawValueBox|drawNeedle|baseInit|type|fn|plate|url|document|ie|81|strokeStyle|toString|th|90|Arial|tw|Led|444|padValue||cint|abs|ccc|888|shad|vd|pe|pe1|end|128|numbers|shadowOffsetX|shadowOffsetY|143|roundRect|eee|666|animate|setRawValue|05|045|012|004|getElementsByTagName|f0f0f0|r3|getContext|cycle|createElement|d0|250|drawUnits|cssText|styleSheets|body|drawTitle|domReady|drawNumbers|addEventListener|drawMajorTicks|drawMinorTicks|trim|drawHighlights|drawPlate|clearRect|attributes|round|translate|step|Date|_animate|push|eval|value|the|77|240|creating||when|ddd|aaa|specified||not|e8e8e8|f5f5f5|fafafa|drawImage|was|quint|element|quad|measureText|Canvas|fff|04|Error|07|createRadialGradient|throw|Array|babab2|call|linear|head|cloneNode|navigator|userAgent|toLocaleLowerCase|indexOf|msie|prototype|http|smart|ip|net|styles|fonts|digital|mono|eot|ttf|180|face|family|src|315|Object|in|css|getValue|elastic|clear|try|createTextNode|catch|sheet|createLinearGradient|updateConfig|div|fontFamily|position|absolute|overflow||hidden|innerHTML|setTimeout|parentNode|removeChild|get|string|setValue|id|number|93|DOMContentLoaded|attachEvent|onload|bounce|lineCap|toUpperCase|999|replace|canvas|91|canv|gauge|toFixed|d1|getElementById|item|nodeName|toLowerCase|88|d2|switch|acos|shift|122|85|delete|test|160|default|tagName|188'.split('|'),0,{}))
function GetArduinomodbus()
{
nocache = "&nocache=" + Math.random() * 1000000;
var request = new XMLHttpRequest();
request.onreadystatechange = function()
{
if (this.readyState == 4) {
if (this.status == 200) {
if (this.responseXML != null) {
document.getElementById("CLregs").innerHTML =
this.responseXML.getElementsByTagName('wbjr_amps')[0].childNodes[0].nodeValue;
data_val = this.responseXML.getElementsByTagName('wbjr_amps')[0].childNodes[0].nodeValue;
}
}
}
}
request.open("GET", "ajax_inputs" + nocache, true);
request.send(null);
setTimeout('GetArduinomodbus()', 200);

}
</script>
    </head>
    <body onload="GetArduinomodbus()">
    <h3>ClassicS C150 #879</h3>
    <p>    WBjr Amps<span id="CLreg">...</span></p>
   
    <canvas id="WBjrA_gauge" width="400" height="400"
               data-type="canv-gauge"
               data-title="Battery"
               data-major-ticks="-150 -100 -50 0 +50 +100 +150"
               data-minor-ticks="5"           
               data-units="Amps"
               data-value-format="3.1"
               data-max-value="+150"
               data-min-value="-150"
               data-highlights="-150 -100 #EEE"
               data-onready="setInterval( function ()
                            { Gauge.Collection.get('WBjrA_gauge').setValue(data_val);},1000);">
    </canvas>
    </body>
</html>




Classic 250, 150,  20 140w, 6 250w PVs, 2Kw turbine, MN ac Clipper, Epanel/MNdc, Trace SW3024E (1997), Century 1050Ah 24V FLA (1999). Arduino power monitoring and web server.  Off grid since 4/2000
West Auckland, New Zealand

dgd

#24
If anyone does try running the web page in the previous posting and can edit the html file then its a neat experiment to alter some of those meter configuartion fields near the bottom of the file.
The meter range of +-150 amps is easiest to alter but major and minor ticks are good too  plus the +/- dont have to be the same ranges, also the ticks can be on a log type scale instead of linear. The meter size and possible highlight ranges can be shaded too.
In creating a battery voltage meter, in my case for a 24v battery, the meter range does not have to start at zero. I chose the range 22v to 32v so that 27v
was at centre top of the scale and I also added some red and green range shading, very pale colours.
Example shown below  :)
The second pic shows my first cut of a battery monitor analogue meters, this display needs further display boxes showing remote and battery temps, Total Ah capacity and remaining capacity and charge efficiency plus anything else i cn think of, these values are probably not worth metering

dgd
Classic 250, 150,  20 140w, 6 250w PVs, 2Kw turbine, MN ac Clipper, Epanel/MNdc, Trace SW3024E (1997), Century 1050Ah 24V FLA (1999). Arduino power monitoring and web server.  Off grid since 4/2000
West Auckland, New Zealand

dgd

#25
Testing has went quite well with this better web server for Classic.
The meter displays all move nicely and the AJAX updating of just the meter pointers and numbers in other fieds seems quite smoothe. My biggest concern is the horrible timing delays that modbus RTU imposes on serial connections.
It has me wondering how closely to the modbus specs the timing in the Classic actually is.
I'm leaning more towards using an arduino nano or uno connected to each classic to deal with modus and then, as my original plan was, use a wire i2c data bus to collect active data from each Classic.

Can't quite decide if making a local app lookalike for the meter dashboard is a good idea. Data that moves real slow like Energy and SOC seem rather wasteful of an analogue meter
Should be ready quite soon to post the web server code and the web pages.
I'm not sure if anyone will bother with this web server but it looks like it will run on an Arduino UNO so perhaps a well detailed explanation of setting up the hardware and where to load software to get it all together could be a good idea.
Anyone interested or any suggestions?

I was also looking for a jpg or gif of the stylised 1920s woman with slanted brimmed hat, I seem to remember it was on packing boxes for some Midnite products but I cannot find it on the MN web site

Dgd
Classic 250, 150,  20 140w, 6 250w PVs, 2Kw turbine, MN ac Clipper, Epanel/MNdc, Trace SW3024E (1997), Century 1050Ah 24V FLA (1999). Arduino power monitoring and web server.  Off grid since 4/2000
West Auckland, New Zealand

paul alting

Hi David,
I'm reading with interest your developments and progress with each new post.
I like what you are doing, but the gauges are too plain and bland for my liking.

A few years back, I came across this gauge and and then after more research found the steelseries, which I really do like .
Then went and coded up some of my own bar gauges based on the steelseries code with statistical elements, which I was using on my site for a while.
I'm thinking of designing up some new gauges in the coming months that will be more modern and lightweight.

While gauges that look like real gauges look lovely, I am starting to ponder the effectiveness of them now.
The steelseries gauges are drawn using HTML5 canvas commands and there is a fair amount of code in the library.

You could use these gauges to jass up your web page.

I went looking for the image you mention, I think you will like this one.

____
Paul
6 x 200W PV into home-brew 6 stage MOSFET charge controller : Microhydro 220Vac 3 phase IMAG
8 x 400Ah LiFeYPO4 Winston : Latronics LS2412 inverter
QuadlogSCADA control and monitoring system : Tasmania, Australia : http://paulalting.com

dgd

#27
Paul,
I had looked at the GFX Steel meters and Swing libs and there is a good range of meter design possibilities. One reason I liked cnv-gauge was its simplicity and i rather liked the clean/crispness of the meters even though with various shading/glowing/colour attribute they can get more visually exciting.
However GFX Steel is in a different league  circular bargraphs. for example, look real neat.
WIth HTML5 canvas and css I did seriously consider making an exact visual replica of the MN Local App program, in time I may actually try this but I'm not sure it would serve any purpose as I could not resist making lots of changes - I still cringe at the thought of the App's voltmeter with main ticks at 14, 18.75, 23.5, 28.25 and 33 for a 24volt battery system and then the tick labels just about overwrite each other in the 'about 90degrees' range area of the meter.
But you touch on an interesting point, whether analogue meter displays are really of much practical use. No doubt there is a gee-whizz factor with them  and initially look very impressive but IMHO the novelty soon wears off.
My personal preference now is just a nice plain (ish) set of numbers with the more important ones in  bigger font and more eye catching colours. Really an RE system with charge controller all shakes down to, in order of importance, Battery Voltage, Battery Current, Charger watts, Charger current and Charger input voltage, Battery SOC. All the rest are just noise but there could be times if certain limits are exceeded then they flash up in the main display - such as the various temps.
As for historical reports, nice but would anyone serious study them if it wasn't for debugging the charger? I don't need to hnow from a graph that when the clouds are about then the battery gets less charge.

I will persevere with the simple gauges in my Arduino web server but when I get more serious about this and start web development on the Cubie2 then
skins for display formats is where I want to proceed to.

I will post code here and display examples of my better text/numbers only web page, css is just too much fun  :)

dgd

ps thanks for that image, i was wanting it as a faded background image for my main web page but I probably need to be careful about copyright
Classic 250, 150,  20 140w, 6 250w PVs, 2Kw turbine, MN ac Clipper, Epanel/MNdc, Trace SW3024E (1997), Century 1050Ah 24V FLA (1999). Arduino power monitoring and web server.  Off grid since 4/2000
West Auckland, New Zealand

Westbranch

Quoteps thanks for that image, i was wanting it as a faded background image for my main web page but I probably need to be careful about copyright

Ask boB...

IMHO if it is displayed as above, with the MN brand in lower right, I would see it as FREE advertising...
KID FW1811 560W >C&D 24V 900Ah AGM
CL150 29032 FW V.2126-NW2097-GP2133 175A E-Panel WBjr, 3Px4s 140W > 24V 900Ah AGM,
2 Cisco WRT54GL i/c DD-WRT Rtr, NetGr DS104Hub
Cotek ST1500 Inv  want a 24V  ROSIE Inverter
OmniCharge3024  Eu1/2/3000iGens
West Chilcotin 1680+W to come

dgd

Quote from: paul alting on March 26, 2015, 03:54:07 AM
David wrote:
Quoteusing some for current measurement at various points in an RE system (they have 12bit accuracy, 4096 points, on a 3.3v input max).
Yes, another reason I am moving to the DUE from the Mega. I bough a few of the Alegro ACS758 50Amp uni-directional sensors from element14 which I will interface to the analog inputs. I'll operate the ACS758 at 5 volts for better performance, but reduce the output through resistor divider to suit the 3v3 input of the DUE.
Paul,
How did you progress with these current sensors? I would be interested in using these for various solar panel arrays' current measurement and possibly
in my Clipper and DC load (water heater) for current measurement

dgd
Classic 250, 150,  20 140w, 6 250w PVs, 2Kw turbine, MN ac Clipper, Epanel/MNdc, Trace SW3024E (1997), Century 1050Ah 24V FLA (1999). Arduino power monitoring and web server.  Off grid since 4/2000
West Auckland, New Zealand