Beagle Bone Black Setup to run Project Blackbox

Started by crunnells, August 06, 2014, 06:42:08 PM

Previous topic - Next topic

crunnells

I've finally got my BBB rev B (running Debian) up and running, altho it's taken a bit of working. I'm still fiddling with getting Apache to work (instead of the built-in Bonescript/Cloud9 services that override Apache) but I've been taking fairly good notes... I'll share those here for future reference for anyone who is as unfamiliar as I am with Unix, who want to run the blackbox project to monitor their Classic(s). Once I'm done, I'll post up either a link to my blog or a writeup. Should be soon!

Westbranch

Crunnells, it sounds like progress, as usual, is painfully slow on the (b)leeding edge.  I read a bit about the BBB, but other than more inputs and outputs IIRC , what is the improvement over the BB?
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

crunnells

As far as I know, the BBB is just an upgraded BeagleBone; more ram (plus DDR3 instead of DDR2), faster processor, etc. Not sure you can even buy a regular BB retail anymore, but I got my BBB from someone on these forums for a good price so I figured it was worth a shot.

I haven't really messed around with linux terminals since 2001 or so, and I've forgotten nearly everything. I can't for the life of my figure out why Apache won't work, even tho it's installed, configured, and running... Nothing will load when I try to view the IP in my browser. This whole thing is frustrating; I'm a web designer not a Linux guru. Bleh.

zoneblue

Your networking is all solid? Before going further, i do recomend something lite-er for these embedd boards, lighttp or nginx.

With apache, configuration is everything. if you installed it with apt-get you should get a working install. if not:
there are several forks/versions check youve got the right one, ie compatible with php-cli/cgi
check port 80 is open
check that the document root is set up right, permissions right on said same
check whats happening witrh virtual hosts, something might have set those up.

when in doubt  purge remove and start again clean slate, Then make small changes one at a time !

6x300W CSUN, ground mount, CL150Lite, 2V/400AhToyo AGM,  Outback VFX3024E, Steca Solarix PL1100
http://www.zoneblue.org/cms/page.php?view=off-grid-solar

crunnells

Turns out Apache2 is already installed and configured to use port 8080 because port 80 was being used by the node.js server. Once I figured it out and changed it, it worked fine.

Now I'm just digging into the blackbox code... Had a problem with one section of the install (adding a new view doesn't work) but adding a field into the DB manually got me around it for now. Logging is working! I'll keep you posted when I start making headway.

zoneblue

Keep a sharp eye out for dropped modbus calls. Keen to see if that last firmware helped. Theyll show up in the db as rows full of zeros. I will do another commit in the weekend, just so you have my trunk up to date... such as it is.!

Among other things it fixes the reverse WBJr current sign, few added datapoints, and some things for daemon mode.
6x300W CSUN, ground mount, CL150Lite, 2V/400AhToyo AGM,  Outback VFX3024E, Steca Solarix PL1100
http://www.zoneblue.org/cms/page.php?view=off-grid-solar

crunnells

So far so good I haven't noticed any blank spaces in the log (polling once a minute). I'm curious to see how often it can be polled reliably (via AJAX) for a more responsive monitor.

zoneblue

If you go that route my advice is to use the daemon newmodbusd. It polls once per second, and maintains a register cache. The just now commited trunk contains some code for this, minimal, just a file you can use with ajax to get realtime data. But to be honest the daemon is a lot more complicated to setup. Not sure how to get around that. This is because if you write to the sd card every second you will kill it.

However if you are getting no dropped calls that is a really really good sign. The last time i tried it it would drop one or two a day for about a week then the ethernet stack would lock up, If this does not occur it means that the work they did on the network stack last firmware paid off, and thats all round good news.
6x300W CSUN, ground mount, CL150Lite, 2V/400AhToyo AGM,  Outback VFX3024E, Steca Solarix PL1100
http://www.zoneblue.org/cms/page.php?view=off-grid-solar

crunnells

It would take some work... But what if you polled once a second (or whatever) but didn't save the values until a minute. Ideally, you only want to see the up-to-the-second data when you're actually looking at the site (so AJAX makes sense), but you don't need that kind of granularity in the logs. Average it out once a minute and save a line to the log? That way we're keeping SD card writes to a minimum.

Something to consider.

zoneblue

Yeah thats how it works, exactly. Still does one db entry per minute.

And theres a daily cronjob which archives the 1s data in bz2 format. All the 1s data lives on a ramdisk.
6x300W CSUN, ground mount, CL150Lite, 2V/400AhToyo AGM,  Outback VFX3024E, Steca Solarix PL1100
http://www.zoneblue.org/cms/page.php?view=off-grid-solar

crunnells

I meant that AJAX would update the view every second (or whatever duration you're polling without overloading modbus) but it wouldn't log that data. I'm basically trying to turn this into a web-based Local app. AJAX is low priority right now tho, because I'll have to add some new methods to the code.

I've been trying to setup email alerts since I'm going on vacation for a week or so and wanted to make sure if our battery voltage drops while we're gone I can get an email alert and send someone to turn the generator on. So far it works, as far as emails going out... But they don't get to my inbox because of a general ISP block list for mail originating from my IP (well, all dynamic IPs in their subscriber block). Irritating, because I thought using SMTP authentication would get around that issue, but it doesn't seem to matter where the server is concerned. Seems like if I can send mail thru a client app on my computer, I should be able to do the same thru PHP, but I haven't found the solution yet. I'll have to dig more into it when I get back.

I figured maybe I'd just use the Twitter API (create an account for my blackbox, then send myself DMs with alerts), but I don't have time to research it and implement it before I leave in... 10 hours. Still need to pack!

Also been tweaking the layout a little bit. Trying to make it more skinnable moving forward. I'm using a black background right now, but I can't, for some reason, remove the white borders from the graphs. Even tho you've got it set to hide the borders in the code, and I'm specifying that they should also be black, they're still showing up as white. Another mystery for another day.

crunnells

Man, I'm not cut out for this linux stuff... My BBB locked up when I tried to restart so I could use a keyboard, and now it won't boot due to a kernel panic.

zoneblue

#12
Quote from: crunnells on August 11, 2014, 06:39:42 PM
I meant that AJAX would update the view every second (or whatever duration you're polling without overloading modbus) but it wouldn't log that data. I'm basically trying to turn this into a web-based Local app. AJAX is low priority right now tho, because I'll have to add some new methods to the code.

Well heres the deal. Ajax calls wont want to initiate a modbus connect. For one its too slow (sometimes), For two, imagine you have 3 or 4 or more clients all trying to connect at once. So you need one central binary that connects via modbus at 1s intervals and caches the results. Ajax calls then just query the cache. I added a method in the last commit called $module->read_redirect(). Thats what it does, but the thing is, to use it, you need newmodbusd, not newmodbus. For one, cron only goes as low as 60s. For two for short intervals like  1s you want to maintain an open modbus connection, not open read, close and repeat. Much more stable i found.

Quote
I've been trying to setup email alerts since I'm going on vacation for a week or so and wanted to make sure if our battery voltage drops while we're gone I can get an email alert and send someone to turn the generator on. So far it works, as far as emails going out... But they don't get to my inbox because of a general ISP block list for mail originating from my IP (well, all dynamic IPs in their subscriber block). Irritating, because I thought using SMTP authentication would get around that issue, but it doesn't seem to matter where the server is concerned. Seems like if I can send mail thru a client app on my computer, I should be able to do the same thru PHP, but I haven't found the solution yet. I'll have to dig more into it when I get back.

They do this to mimiise the damage from spambots/viruses. There are a few ways around it. One ask them nicely to open port 25 for you. ANy decent ISP here has when asked, but i doubt this will work for  giant like comcast or so. Solution two, use your isps smtp as a smart host. 3. use another port. 2525 is a common workaround, but youll need a smarthost someplace that can talk 2525.

QuoteI figured maybe I'd just use the Twitter API (create an account for my blackbox, then send myself DMs with alerts), but I don't have time to research it and implement it before I leave in... 10 hours. Still need to pack!

Also been tweaking the layout a little bit. Trying to make it more skinnable moving forward. I'm using a black background right now, but I can't, for some reason, remove the white borders from the graphs. Even tho you've got it set to hide the borders in the code, and I'm specifying that they should also be black, they're still showing up as white. Another mystery for another day.

Ill take a look at that. It was just my old graph lib i wrote years ago. js graph libs seem to the way forward there.

QuoteMan, I'm not cut out for this linux stuff... My BBB locked up when I tried to restart so I could use a keyboard, and now it won't boot due to a kernel panic.

Ah the joys of embedded baords and SD cards. Get yourself a TTL cable so you can get a serial console going. Then do your fs check. Debian and linux in general is a real pain the way it handles fschecks. The slightest disk problem and it flicks you to a shell. With no monitor thats a drag right.

First and foremost be super careful with the boards power. NEVER interupt it. My first SD card lasted about 18 months, the second one is still going now thta i use a ramdisk for the 1s traffic. Longer term id like to almost remove the database as its adding nothing. The data is write once and archive, and flatfiles are better for this, less SD card wear. In memory database may be another solution for daily traffic, then doing once of twice a day sd writes.  Finally i want to get it to a read only OS. That will allow you to depower the thing ungracefully to your hearts content. RPi has done some work on this for that same reason. Which we can use.

Another solution is a real drive, ssd on the sata port. Tons more robust than a SD will ever be.
6x300W CSUN, ground mount, CL150Lite, 2V/400AhToyo AGM,  Outback VFX3024E, Steca Solarix PL1100
http://www.zoneblue.org/cms/page.php?view=off-grid-solar