LeafViz

App: LeafViz

Published: March 2017

Most Recent Update: November 2017

1024x500fg

LeafViz was created to visualize Leaf Spy data. Leaf Spy comes in three flavors, Lite, regular, and Pro. Lite does not log data to files, so you’ll need one of the other two to make use of this application.

Leaf Spy creates several types of logged data. LeafViz works with the TripChrgLog and the TripLog data. TripLog data can be historically reviewed, or use LeafViz in “Live” mode to monitor critical data as it becomes available. The App has tabs to select the desired data display type. “Viewer” is the visualization display.

TabHeader_2017-11-18-16-07-11

Data can be displayed using the phone/tablet which also runs Leaf Spy, or can be viewed on a different display using a browser, such as a laptop or car display (if equipped). LeafViz has an internal web server used to serve up displays. To access, select the Server tab in the App to find the URL address:port. There is also a File browser/upload/download capability that can be enabled on that Server tab (Allow ‘…/Server’ access, example address is http://10.10.10.102:5555/Server).

ServerTab_2017-11-18-16-02-19

The TripChrgLog and TripLog tabs are similarly constructed. At the top is a large “GO [type]” button to launch the viewer with the most recent data (“Now.csv”). This makes it easy to hit while in a car.

Screenshot_2017-11-18-16-07-11

Also available are any older sets of data which have been logged over time (for TripChrgLog, by Quarter and Year, for TripLog, by Week of Month and Year). Simply tap a file to launch the viewer with that set. When using an external browser, it will display the last selected set. After selecting a new set, just refresh the browser display to review the new selection.

LeafViz takes the csv file data from Leaf Spy, breaks down older data into the aforementioned time period sets, except the recent data is made available in “Now.csv”. Also, if you have older data archived, you can ‘re-load’ it by uploading it into the Leaf Spy data folder. Navigate to the Leaf Spy data log folder (example below), click Choose File, select your archived csv on your laptop/PC, click Press to upload. After it completes, change LeafViz to the associated Tab and it will process the data as described, making it available to review.

BrowserServer

Due to this design, you no longer need to transfer Leaf Spy data via Dropbox, nor separately manage the quantity of data that can be amassed. Leaf Spy does let you timestamp the filename, but then you have to manually aggregate data across that breakdown. LeafViz is designed to provide visualizations and a solution to manage the data.

LeafViz has a Maint(enance) tab. The first time you launch the App, after a few seconds it will take you to that tab, it will display the contents of the Leaf Spy data log folder (/ext/LEAF_BT_CAN/LOG_FILES or similar), and you can tell LeafViz which named csv file to use for TripChrgLog and TripLog. LeafViz will remember those selections from that point on. The tab also has a Backup and Restore functionality. Backup will separately zip up the TripChrgLog (TCL/Year/Quarter.csv) and TripLog (TL/Year/Month/Week.csv) files into TCL.zip and TL.zip. To make an off-phone backup, use the laptop browser to ‘View’ the file and it will store it to your laptop for safe keeping. You can delete excess data at any time using your phone’s File Manager. “Restore” simply unzips the TCL.zip and TL.zip file back in place.

Screenshot_2017-11-18-16-33-40

Now, on to the data visualization displays. First, TripChrgLog.

  • TripChrgLog contains day to day charge event and trip information, including battery health, pack voltage, and trip details. Some of the charts use color to indicate condition.
    • Pack Amp Hours over time, Health (Hx) over time
    • Hx vs Amp Hours, Wh/mi over time
    • L1/L2 Events, DCQC Events
    • Starting and Ending Volts
    • Daily Total miles, Missing miles (not recorded with Leaf Spy)
    • Per Trip segment: Miles, Time, Average Speed

2017-11-18 15_32_36-Trip Charge Log

2017-11-18 15_37_28-Trip Charge Log

2017-11-18 15_39_38-Trip Charge Log

2017-11-18 15_40_48-Trip Charge Log

2017-11-18 15_41_53-Trip Charge Log

2017-11-18 15_43_00-Trip Charge Log

On the phone/tablet, the App’s Viewer can be two-finger zoomed to show the desired single or set of charts that you wish to monitor during a drive. You can also adjust that display while reviewing TripChrgLog and TripLog data as needed to make it readable. If not driving, just use a laptop browser at any scaling and with a mouse or touchscreen to not just view them but to interact with them. Turn on the “Brush” feature to let you select a subset of data on a chart and see how the other charts respond. You can also adjust the “Dot Size” larger to make it easier to see at a distance in a car, or smaller to better separate points of data. The ‘date’ related displays are not functioning as of yet. There is a “Show Page Table” checkbox that will show the data (full or selected) in a table.

DotBrush

Next, the TripLog data displays. There are quite a  few, and they are broken down into (presently) six slides.

TripLogSlides1

  • TripLog contains per-trip data primarily on the traction battery pack, including individual cell-pair data and temperature. There is also data on tire, ambient, and motor temp. The specific displays and slide location may change as the application is refined.
    • Main
    • Cell Pairs, Advanced
    • Cell Pairs, Basic
    • Pack Data
    • Pack VxA
    • Tires

“Main” has 14 charts. Gids, a Cell-Pair chart, Hx, SOH. Motor, Pack and Ambient Temps. Max and Min V by Amps and over Time. 12V battery Volts and Amps over time, and pack KW draw over time.

Gids and the Cell-Pair difference chart labelled (Cell Pair Diff * KW) by Min V top the display. While Gids is straightforward for a LEAF owner that uses Leaf Spy — it’s how many ‘units’ of Battery capacity are left — the other display requires a bit of explanation. Leaf Spy calculates a Cell Pair difference value. It is usually helpful in knowing that the cell pairs are relatively close in voltage. This ‘diff(erence)’ is how much they are not the same, from best to worst (highest to lowest). Unfortunately they are not all sampled at the exact same time, so things like acceleration of the car (high throttle input) can induce large swings in the value. LeafViz attempts to identify and eliminate swings in the data. This chart uses the filtered data, and plots it against the Minimum Voltage Cell-Pair, but scaled by the KW-draw on the battery pack. When samples are far off the the right, that is during events like peak acceleration. But when they drop down lower and turn from green to orange or red, then one or more cells may be dropping down to an undesirable point.

2017-11-18 17_45_14-Main

If you turn on Brushing and select those points, you can see when they occurred during the trip and where they relate to Gids, for example. At a higher Gid level there’s no issue, but if Gids is very low you might be risking a turtle/shutdown if a cell drops too low.

GidsCDKWbrushed

Not all of the charts will be shown and described here as many are straight-forward. The above sample was shown to illustrate the visualization chart brushing/selection capability. Below is a bitmap that shows the lowest cell-pair voltage at each point along the trip, along with the Pack Amp draw below it, and to the right, the 12V voltage and the DC-to-DC charging rate below it. The latter could benefit from some smoothing/filtering.

12VandPack

 

TripLog slides also have a “Set” selector that TripChrgLog does not.

Sets

By default TripLog shows the most recent Set (here, 10 of 10). The data in TripLog’s “Now.csv” file is limited to the past week or so. Although many trips are separated by half a day or more (each is a separate set), some trips are “segments” of what could be called an “errand trip”, where you make several stops. These, when they are within an hour of each other, are grouped into one “set”. In the Gids chart below, 3 segments of a 2-stop errand trip are visible.

GidsErrands

The “Sets” selector has an “All” selection. If you choose that, then all sets in the selected data are combined into the display. That can expose trends or other situations. Below are the Gids and 12V Amps charts, showing the past week or so of data. In the Gids you can see that two of the trips dropped down below the 33% point where a LEAF stops reporting changes in Hx.

GidsAll

In the 12V Amps chart, you can see that sometimes the solar panel equipped LEAF SL doesn’t need much of a charge in the afternoon (or in the morning if freshly charged), but at other times needed more extensive charging. To see a particular profile, select the corresponding set (1-10 from left to right).

12Aall

In this set of Tire pressure difference charts, you can see there is a slow leak in one of a set, while the other set is sufficiently balanced. Time to get it fixed or at least replenish. The outliers are caused by initial sample differences when the LEAF first starts moving, it takes time to update all 4 tires in the system.

TireAirLoss


First Use

As briefly mentioned earlier, when LeafViz first starts up it will transition after a few seconds to the Maint tab to allow selection of the required TripChrgLog.csv and TripLog.csv files. First, briefly the Viewer page is displayed with the contents of the ‘home page’, which is also displayed when a laptop browser is first connected. Normally when LeafViz starts, it will show the last displayed page. This allows orientation changes and switching between apps without losing the desired choice. On the TripChrgLog, TripLog, and /Server browser pages the “Root” link refers to this initial page.

Screenshot_2017-11-18-18-40-24

 The application menu has two choices. One, choosing a background color preference for the App web browser. And the other allows Resetting to the Install Contents – after an App upgrade, this is required to update to any html/slide/chart changes. On phones without a ‘menu’ key, fling the page up to reach this menu.

Internal Web Server

LeafViz contains a WebServer, which by default only serves up content from LeafViz. When the server is running, the IP address and port# is displayed at the top of the screen (Server tab). LeafViz has the capability to let other devices on the same network access the server. Then type [displayed ipaddr]:5555 into the web browser on any networked device. The page displayed on the laptop browser will be the same as on the LeafViz application on your phone/phablet/tablet. The advantage is a larger display screen for reviewing the data, and availability of a mouse for finer-grained selections (if brushing). IE10 or newer, Chrome, etc all work with the display. IE9 and lower does not.

browserdisplay

There is a server option to allow access to browse/upload/download *any* files on the external drive for the device running LeafViz. To enable, just check the “Allow ‘…/Server’ access, then type [displayed ipaddr]:5555/Server into the browser on the other network device. If you have multiple devices that have LeafSpy+LeafViz, you can set the “Greeting” displayed to differentiate.

On the “/Server” pages, click on a folder name to change folders (and “../” to navigate up a folder level), on a file to download/view, or scroll to the bottom to upload a file to the current folder. Presently there is an Append functionality that allows adding onto a file; it is primarily for development purposes and is not a simple append.

In the bitmap below, you’ll see there is a mix of timestamped files and a non-timestamped file. LeafViz prefers the latter.

browserserver

Network Monitor

App: Network Monitor

Published: September 2015

Some network monitoring utilities, when implemented as a Web service, can only test external Web addressed servers. Others implemented as Apps may only test the local network. Some have logging, some do not have log filters. Some have charts. Some limit to a short period (such as 24 hours), some go longer. Some give no choices to the sampling period; others give a few or more choices, but some have a large minimum (5’s or 10’s of minutes, some a half hour). Some have reporting delays. Some are manually triggered and run a short time.

This Network Monitor runs on your Android device, and uses any available network interface. You can use a domain address, or an IP address. It has small and large sampling periods.

TabletV8p

No squinting at charts or numbers to see what the current status is. A large colored panel is green or red; if red it lists the failing test(s).

It shows and logs the response times for Pings and/or Http GETs (in ms).

PhoneV8_1024

It has histogram charts; these and the text logs can be filtered to just failures, or just successful tests, so you can quickly see what the aggregate data looks like. The log has daily indicators, at midnight.

It can be manually triggered, or repeatedly run. The screen can be locked on, and auto-dim if desired; a progress popup can optionally be displayed during each test iteration. The text font size can be adjusted to better fit each device.

MultipleIPs

Sites with multiple servers are supported by tracking data per IP address.

The Network Monitor app is Actually Free over at Underground.

See the entry over at B4X.

Almond+ Light Controller App+Widget

App+Widget: Almond+ App+Widget + Notification Drawer!

Published: February 2015

Those who backed the Almond+ by Securifi on Kickstarter, or subsequently purchased it at Amazon (Securifi Almond+ : (3 Minute Setup) Long Range Touchscreen Wireless AC Router / Range Extender + Home Automation Hub), have wished for a Widget to control their devices. Almond+ App+Widget is the first such Widget on the market, specializing in adjustable level lamps.

cookieshot

This Widget allows

  • Selection of 1 Lamp, or a group of lamps at a location, or All Lamps
  • Immediate setting of the selected lamp(s) to one of 6 illumination levels (0, barely on, 25%, 50%, 75% and full on)
  • Click the 12Lab A+ icon to open the App as necessary

Update: And now you can control lamps from the Notification Drawer. When in the Drawer, it operates just like the Widget on the launcher desktop. Launch the App to ‘install’ the Notification. Use the App ‘Settings’ menu to change notification options. Choose whether to use an On Going or dismissible. Choose what priority level is used. Even choose the layout to display (not all layouts will display well on all devices).

The App provides for

  • Changing the Almond+ IP address
  • Login (initial setup)
  • Selecting one or more Lamps
  • Adjusting the lamp(s) to any illumination level from 0% (off) to 100% (full on)

The App at this time is more functional than beautiful, as a functioning Widget was needed post-haste. It is just for controlling lamps, without having to wade through many other devices.

 

Please update to at least firmware level R070 on your Almond+.

Update: as of March 1 a new portrait layout is available

portraitshot

B4A-Bridge-Relay by 12Lab

App: B4A-Bridge-RelayB4A-Bridge-Relay-Free

Published: January 2014

Having 3 or more devices (or even 2!) on which to test an application in development is presently cumbersome from the B4A IDE (as of 3.2). I realized that a few changes to B4A-Bridge would save many iterations through the IDE. In a private communication with the principal, Erel Uziel, Anywhere Software approved derivative works based upon Anywhere Software posted source on the B4A/B4PPC forums. With B4A-Bridge-Relay, deploying an app to more than one device takes essentially no more time than it does with just one.

sample

The existing B4A-Bridge (2.10) was refactored to separate the Service framework from the B4A-Service functionality, a new Class added for downstream connections, and packet counting was added to the apk deployment transfer, so progress can be monitored as necessary. You get confirmation that the transfer to the -Relay started, then you can turn your attention elsewhere. If you find yourself in a ‘poor’ WiFi environment, this will also save you some guessing. The ‘H’eartbeat indicator will also assist with this situation, and the colored status text makes it easy to tell at a glance. If you use B4A-Bridge-Relay on all client devices, you can observe the transfer to each device.

B4A-Bridge-Relay also displays additional Server information as compared to the standard B4A-Bridge. In WiFi mode, the port used is displayed after the IP address. In Bluetooth mode, the MAC Address and the Name are displayed. These identifiers are helpful in certain situations.

Use:

Short Press of the “Skip Clients” button will tell the Service to not use the application client list, Long Press will allow view/delete of clients from the application’s client list. “Use Clients” functionality is maintained; Short Press tells the Service to use the application’s client list, Long Press allows adding a new client to the application’s client list. Changes to the application client list are immediately applied to the Service list; however, after entering any desired clients, press F2 in the B4A IDE to force all clients to ‘connect’.

When adding a client address, you can now use a range or the ‘*’ wildcard in the last segment. 192.168.2.4-8 will auto-populate clients .4,.5,.6,.7,.8. The end of the range can be left off, in which case it defaults to -254. If the wildcard is used, such as 192.168.2.* , then .2,.3,…,.253,.254 is auto-populated. If some of those IP addresses in the range do not actually have a real associated target device, that is fine; B4A-Bridge-Relay will just skip over them if the IDE-initiated connection attempt fails. Entering the device’s address as a client will be ignored, as will any duplicate client addresses; this also functions as a cancel operation.

The Status area shows the first few connected clients in the  client list. To see the full list, long-press on Skip Clients, scroll through it as needed, then cancel when finished.

Note:

At least some older phones (example, HTC WildFire running Android 2.3.5) may hang a port open; this can be identified by use of port 6906 when the WiFi service is started. The application displays “My IP: A.B.C.D:port” when Start-Wifi is pressed. Port is usually 6789, except when it isn’t available, and then it uses port 6906. Currently it is not possible to set the port for a client in the Relay application, it always uses the default of 6789.  Since the original B4A-Bridge is registered as a different application in Android, you may have one of them running holding the port open, and if its Service is running, the Relay (or the IDE) will connect to it on port 6789. Fix is to clear the in-use/hung port by either stopping the offending application/service, or rebooting the phone.

Updates:

2014/09/12 v2.10.10: “-Free” updated with improved layout.

2014/07/27 v2.10.9: “-Free” updated with changed “Wake Lock” behavior; The lock is no longer released when the Activity is paused. Use the Exit button to release the lock and exit the application. This is to fix a Compile/Run deployment issue, the android may go to sleep when B4a-Bridge-Relay-Free is paused to switch to installation. If this is found acceptable by users it will be added to the paid version.

2014/06/29 v2.10.8: Added -Free version so there is no direct cost to try -Relay out.

2014/06/28 v2.10.7: Added “Wake Lock”, keep the device from sleeping, while UI is up.

2014/02/13 v2.10.6: Added Tablet friendly layout, connection ‘H’eartbeat indicator and colored status.

2014/02/10 v2.10.4-5: Enhancement; Bug Fixes. In some modes, such as Portrait, the Phone keyboard is used, to make it easier to enter addresses. Keyboard is now auto-displayed when adding a client. IP entry has validation. When IP address range and wildcard was added (v2.10.3), the ability to enter a standard IP address was broken. This is now fixed. 2.10.4 did not accept IP address segments with value of 0. Fixed.

2014/01/28 v2.10.3 Update: Added a new feature where a range or wildcard can be used in the last IP address segment when adding client(s). See above for more details on how this is entered.

2014/01/11 v2.10.2 Update: Testing of the BT server mode uncovered a bug that was preventing the BT mode from starting; instead it would start the Wifi mode. Issue has been corrected. An enhancement is also in this release: Server ID (identification) displayed continues to show the Wifi IP address for Wifi mode (displayed as IP:Port), but now displays the BT MAC and Name for BT mode.

2014/01/08 v2.10.1 Update: “Clear Clients” button in v2.10 not only removed the client list from the Service, it was also unintentionally clearing the application’s backing list of clients. The intention is to have the application maintain a list of clients, irregardless of whether the Service was actively using the list. Issue is corrected; the button is now relabeled as “Skip Clients”. Also, “Start-Wifi” was not starting the Service on the correct port, until “Stop” was pressed and “Start-Wifi” pressed again. Corrected.

2014/01/04 v2.10 Initial release: is based upon B4A-Bridge v2.10. Added Apk transfer packet counting/display. Added downstream clients. Wifi mode has been tested, Bluetooth functionality not changed. This version is made available to support multiple WiFi connected client devices.

Apk transfer ‘progress’ code addition is available at: http://www.basic4ppc.com/android/forum/threads/b4a-bridge-source-code.8153/page-2#post-212716. See page-1 post 18-20 for details on 2.09, 2.10.

Release Note is at: http://www.basic4ppc.com/android/forum/threads/b4a-bridge-relay-by-12lab-download-apk-from-b4a-ide-to-multiple-device-targets.36440/

SLIDcES

JS: SLIDcES

SLIDcES is in a prototype phase. What is it? There’s a reason for a lowercase ‘c’ in there; this is a ‘slide’- like presentation package that uses DC.js internally. Thus, DC within SLIDES, or SLIDcES.

Here is an example created to visualize some auto leases offered in the Summer of 2014. Compare this to reading through paragraphs or even tables of data. Click on the image to see the sample and see how visualization can help with leasing comparisons.

See how DC.js can help with lease terms evaluation
See how DC.js can help with lease terms evaluation

So what is DC.js? Dimensional Charting roughly speaking is D3 + Crossfilter. Follow the links for more information about each library.

1. D3 is a js library that provides  capability to manipulate documents based on data, allowing visualizations that can come alive through the use of basic web technology (HTML, SVG and CSS) supported by modern browsers. The full name is Document Driven Data, or D3 for short.

+ 1. Crossfilter, also a js library, enables exploring large multivariate datasets in the browser.

= 2. DC: Dimensional Charting, while not an acronym for D3+Crossfilter, is exactly that: a simplified javascript software capability for data visualization and analysis in a browser, significantly reducing the learning curve to create a responsive interface to your data. It has performance tweaks such as caching built in, for fast response.

There are many public examples of the DC technology, one such is at Dancing Data* using coffee shop data. The D3 Gallery is full of charts that demonstrate a wide range of visualizations that could be created. Although DC.js presently has a limited subset implemented, it does meet basic charting requirements, and more.

Click on over to SLIDcES and start by trying out the Auto Leases sample, using real** data from July 2014. Check the Show Table checkbox in the upper left corner of the page in order to view the table of all or filtered data. Isn’t this a better way to compare lease offers, than reading through a table, many paragraphs, or multiple articles/websites of offers?

What does SLIDcES offer over DC.js? DC.js requires “web” coding – javascript, html, and css in order to create a working “visualization” page. SLIDcES allows you to select/choose your content without requiring coding. Pick your file or web URL, select data to display and choose the chart(s), and tailor the display to meet your visualization needs. Documentation on the Editor has not yet been created, although the editor is available in the example set. Check back here soon for a tutorial on creating a slide.

SLIDcES has a small footprint, a few hundred Kbytes. The files can be loaded from a CDN, or hosted locally, even within an Android App. The Google Play store has a sample app that loads the files from www.the12Lab.com – https://play.google.com/store/apps/details?id=com.the12Lab.wvd.SLIDcES

Note* The Dancing Data example does take quite some time to load, YMMV.

Note** ‘real’ here includes any errors in the original data, and any that may have been introduced creating this sample.