Sunday, November 30, 2014

Best laid plans...

I know I was being overly optimistic, but sometimes everything just works out the way you had hoped.  Sadly, this was not one of those times.

I got to the house ready to get to work - my NUC with all the bluetooth doohickey configured, a simple shell script to pipe the serial output to a rotated text file while I figure out how to store the data for the long term, the HC-06 serial bluetooth dongle, and the electronics project box that contains all the little miscellaneous wires and parts.

Getting the NUC up and running was the easy part, luring me into a false sense of achievement even though there's nothing special about it.

Wee!  Computer is up and running
Then pretty much everything started going wrong.  There were two major issues that I was worried about.  First was the range of the bluetooth wireless network.  The HC-06 bluetooth module is a Bluetooth Class 2 device, with typical range of about 10 meters.  I was hoping to put the server near where the satellite internet modem, wireless router, and the mobile microcell was located, and putting them all on an uninterruptible power supply to protect them from invariable power surges and brown-outs common to off-grid homes.  This would place the bluetooth devices just a little over 11 meters apart with a wall in-between.

Second possible issue was the power consumption of the HC-06 bluetooth module.  The datasheet shows average pairing current of about 25mA, with spikes up to 40mA.  However, once paired, the current consumption should stay at around 8mA.  The Trimetric 2025 down-converts the 48V available at the battery down to 5V using linear regulators, so the current available at the 5V rail is fairly limited.  Bogart engineering folks said there should be at least 5mA available at the 5V rail, and that the display uses another 15~20mA or so.  I was hoping that by turning the display off and by putting a little capacitor to take the load, I'd be able to get the HC-06 module to at least pair after which I'd be able to turn the display back on and use the Battery Monitor while recording the data.

For both the issues, unfortunately, I was proven overly optimistic.

Range testing the Bluetooth Module
On the range side, the effective range I was able to get out of the module and the NUC's bluetooth antenna was about 8 meters.  But no big deal, NUC is connected using Wifi, so I can always put it somewhere closer...

Unhappy Trimetric
But on the power side, I wasn't even close!  Even with the display turned off, plugging in the HC-06 module into the Trimetric collapsed the 5V rail, causing the display to glitch wildly and resetting the microcontroller.  Even when I tried to get the HC-06 paired first, I was not able to maintain the Bluetooth connection with the Trimetric's display turned on.

Crap.

The wall where the battery monitor is mounted is behind the counters, and there's a heavy one-piece granite countertop making it very difficult to access the area.  There's no other connection in the box other than the wires coming from the battery box, no easy way to get the data out or power in.  And I really didn't want to look for yet another 48V to 5V converter which may also skew the voltage readings in the battery monitor.

I went down to the subfloor to see if there was any hope from underneath.

Sealed tight
Everything seems to be sealed pretty tight.  And I didn't realize it until my friend Phil pointed out, but in the top center, above the black pipes, there's a giant spider just hanging out.  Nope nope nope.  I was starting to lose hope when Phil chimed in again - there in fact is pre-existing wiring going into the battery monitor!  The wiring from the battery box to the battery monitor some sort of shielded 6 conductor cable, of which 4 conductors are used.  That means there's 2 wires available for me!

I see the light!
The battery monitor only transmits at 2400bps, but at 5V TTL signaling instead of RS-232.  If it was RS-232, we should be good to 60m, but given that I don't know how long the cabling is, I need to figure out if it makes more sense to try to get power in rather than to get the serial signal out.  I also need to figure out where the end-point of this cabling is...  but I'd imagine it should be somewhere within an easy reach of a wall-wart!

This means that I probably need to go back to ESP8266 for sending the data back to the computer.  Wifi should have more than enough range to, and now that power's no concern, Wifi's back on the table!  I'm leaning towards having the ESP8266 simply sending out UDP packets with the serial data to a hardcoded address, but we'll see what's easiest to implement.  Hmm, I wonder if there's enough memory to fit a Lua VM in the ESP8266!

No comments:

Post a Comment