• 24h (Graphical) Logging and Loud Beeping (and some history...)

    Timo Birnschein01/18/2021 at 17:02 0 comments

    It was a great weekend for testing high capacity marine batteries. We took the boat out to the Bay and spent the night at Paradise Cove in the northern part of the Bay around San Francisco. For January, it was fantastically warm and calm, a truly great short vacation!

    I built this battery monitor to understand the state of each of the battery since we experienced a total battery failure in one of the worst conditions: About 18 months ago, we were at anchor around Angel Island. It was at a cove that wasn't particularly protected. It was labor day or similar and pretty much everyone with a boat was out on the Bay doing boat things. Idiots as well. We encountered a (luckily) rare species of idiot: The take your high displacement boat, run it at full throttle close to other boats and don't care of they almost capsize because of their wake- kind of idiot. Due to the rather undesirable conditions combined with the strong currents in that particular cove, I decided to leave the ignition on and the chart plotter with depth sounder running. For some reason, I expected this stuff to run off of the big 500Ah house bank.

    But it didn't.

    So after 4h at this anchorage we had enough and decided it was time to leave to some place nicer - with less reckless people around. 

    I start engine one. CLICK. nothing. CLICK. nothing. hmmm.

    I start engine two. CLICK. nothing. oh! CLICK. nothing. This is bad!

    Mind you, earlier that day, a wire on my generator had come loose that I hadn't identified at that point. That loose wire prevented me to keep my generator running because (I think it was) the oil pressure sensor cable has a bad crimp. That meant, I had three engines down with no prior warning, no starter cable to wire in the house bank and no way to to recharge my starter batteries due to the then still broken generator! I was aware that one starter battery was weak and end of life but I didn't think it would get this bad this quickly! But bad things always pile up when you least expect them!

    When the waves started reaching unacceptable levels, violent enough to pull our anchor out of the mud to start dragging, we decided to call BoatUS to tow us out of there or - better - bring starter cables to give us a boost!

    Long story short, they came, gave us a boost, we had all engines running again and left back home. We had two more days to spare but due to the lack of reliable 12V power electronics, we cautiously decided to ditch our vacation and drive back home for repairs. It was not without disappointment.

    This experience made one thing very clear, we needed a reliable battery monitor that gives us a long term overview of the battery state of each of the packs.

    Since we took the boat out this weekend, it was a perfect opportunity to test the usefulness of my new DIY solution. I am very happy to report, it works really well! To my very big surprise, these small TFT displays work GREAT in direct sunlight! They look decent during the night but they really shine in daylight. Not sure if they have some sort of transflective properties but as long as you don't have the direct reflection of the sun straight on the display, the colors pop and it's really easy to read!

    A couple things I did since my last post:

    1. Get the buzzer to work when any battery goes below 12V (normal for starting big engines but not normal under light loads)
    2. Calibrate each channel using my trusty multimeter by getting the real voltage with the DMM of each channel, and dividing it by the current value displayed on my battery monitor to get a correction factor. I then added each of the correction factors to the code and so far, each channel is reporting really good voltages.
    3. Make the status bar at the bottom work to show good vs bad batteries
    4. Make the run-length of the graph at the bottom configurable at compile time to allow 1h, 3h, 6h, 12h, and 24h logging. I also clipped the graph to roughly 15V and 11V and added a red line to show where the graph is currently redrawing.

    This then looks really good!...

    Read more »

  • [...] Picking it back up and finishing the hardware!

    Timo Birnschein01/16/2021 at 05:33 0 comments

    After more than one year, I finally revisited this project to finish it and install it on my boat. I admit, every time I saw this unfinished and somewhat too simple of a project it was a burden on my mind. First of all, this seemingly simple system has the ability to safe my life when shit hits the fan undesired events occur in unstructured environments, and second, it can be extremely valuable to evaluate the health of my battery and charging system.

    After all, I have a 500Ah house bank, two bad ass AGM starter batteries for my two 8 liter Diesel engines and one normal acid based starter battery for my 8Kw generator. You really don't want to loose or damage them if not absolutely unavoidable.

    So to get back into it, I decided to start designing an enclosure in Solidworks. An interesting task if it's not entirely clear what the dimensions of the PCB are. Luckily, KICAD offers a STEP export which allowed my to get all the important dimensions straight from the PCB layout tool.

    The rest was a matter of making things fit to the PCB design. It's not my most beautiful PCB but it's functional and reasonably accessible. I'm definitely still learning this, as some of the connectors are ill-placed and required some creative soldering to make work. That's especially true for the most important connector: The batteries.

    After designing and printing the enclosure I was very happy to see that everything fit together nicely without modifications.

    I also finally soldered the RF module to the PCB giving me some future expandability once I get bored and actually install RF24Network on my Board Computer.

    Inside are two major components, one rather loud piezo beeper in case a battery runs into an under-voltage situation and a a power converter to convert unregulated 12V into regulated 5V. I was naive and used a cheap step-up converter only to realize that it spits out its input voltage. I'm VERY glad I checked before I soldered everything together. To be clear, this doesn't work. Just posting this picture for completion:

    Instead, I searched my trusty parts bin and found an unused 7805 and matching capacitors. This will provide 5V to the module even in bad conditions:

    I installed the beeper in a pocket designed for it. Usually, I use hot glue or screws to fix this stuff in place but something drove me to use CA glue instead. That was a terrible idea! So far without consequences but keep in mind that the adhesion of hot glue can be very easily neutralized using a drop of isopropanol! That's not at all the case with CA glue. Removing these components for whatever reason will be a pain.

    After everything was put together, I finally realized that none of my strategies for connecting the actual batteries to this monitoring module won't work. I therefore had to resolve to the worst possible method I could think of and use ... pin-headers on both sides.

    In order to make them more robust, I use my trusty hot glue to fix wires and pins on place (on cheap pin headers, the actual pins tend to fall out when pulled).

    On the front of the module, I designed a cut-out to allow for the Arduino micro USB cable to be connected for programming. Eventually, I'll design a snap on cover for this.

    Let's talk about kinematics for a second to explain why I made the module mount rotatable:

    When you mount something to a tilted pole and then swing that something around to change the viewing angle, your module will be tilted. That doesn't look good at all. To avoid this, I designed a 15 degree rotation into the rear mounting structure. This allows me to keep the module horizontal despite it's rotation around two axis!

    Let's talk software:

    To me, the initial version of this battery monitor looked pretty awful. The Adafruit pixel font didn't look like a product of 2020. I mean. Granted. The tiny screen doesn't permit a modern look but at least I can try to get the best possible results.

    During one of my favorite...

    Read more »

  • Making the PCB

    Timo Birnschein10/23/2019 at 02:13 0 comments

    Usually, when I have a board design, I don't waste much time milling and assembling it.

    This time, though, it became pretty clear that I was a tiny bit rusty when it comes to milling on my CNC machine as I do maybe two boards a year and usually I switch around what software I use - at least parts of the tool chain.

    As I learned my steps again, I created a lengthy tutorial about all the different steps I need to take to make this work which can be found here.

    So after the CNC milling and the following cleanup was done, I was reasonably happy with the result. It wasn't perfect to a number of reasons and lessons learned like: drill the holes after milling the second layer so that auto leveling can actually work!

    So while the top side turned out amazing, the bottom side had a bit of an offset and the bed leveling didn't work at all. I had this issue before where all my traces were milled out way too deep but I forgot why that was an issue and what the potential solution was. So I did it again. Result: Adding data to the tutorial to make it easier for myself next time around!

    I also had a routing error on my board as the TFT display I was using was different from the last TFT I bought off of ebay. They might all look kinda the same, but these 1.8" displays are pretty much all ever so slightly different and need voltage divider or just some resistors or they need a software pixel offset... or not.. and so on. Luckily, this one was very easy to fix. Added some resistors to ground to create a voltage divider for the SPI signals.

    In addition to sensing and displaying 5 different voltages from 12V batteries, I also wanted to add the possibility to wirelessly send the data to other modules on the boat using the extremely cheap NRF24L01 communication module one can by on ebay for about 90 cents a pop. This piece is a work in progress, though, and has not been tested at all, yet.

    The end result is supposed to look kinda like this but in a nice 3D printed case and connected to actual boat batteries. As soon as I do that, I also have to calibrate the inputs. It wasn't enough to measure all the different resistors because my multimeter doesn't seem precise enough. I will have to calibrate the individual inputs and provide calibration values in the code to correct the measurements to be accurate. For example, a 4.2V fully charged LiPo shows up at 4.05V. That's a lot of deviation!

  • Schematics and Board Design

    Timo Birnschein10/20/2019 at 23:24 0 comments

    Since I cannot possibly put a bread board to permanent use in a marine environment, I created the schematics of the breadboard in KiCAD. The whole thing is rather simple.

    And here the board:

    For the display I am using, it is necessary to divide the voltage of the IO lines down to roughly 3.3V. I use 1K and 2.2k resistors for this.

    For measuring a total of 0V - 18V, I use 4.7k and 22k resistors as voltage dividers.

  • Bread Board Prototyping

    Timo Birnschein10/20/2019 at 23:04 0 comments

    I have become a big fan of bread board prototyping. In my youth, my dad always build his own breadboards so I knew was creating boards with a bunch of wires was good for. However, he used solder shoes and pins for his boards which meant soldering every single part regardless, even though non-permanently.

    Nowadays, I use what everyone else uses which are these white, cheap breadboards you plug your wires in directly.

    I have one board that I constantly reuse and extend if necessary. This board has a 1.8" TFT screen attached which is great for displaying things in realtime instead of sending the data to a PC. Faster and easier. Plus, it only needs four pins for SPI.

    This is basically, the entire battery monitor. A bunch of wires and resistors. The protection circuitry is within the AVR. That's FAR from ideal and I do not recommend this to anyone. However, for my project this is good enough and easy.

    Hidden in here is an Arduino Nano clone that I program directly using the Arduino IDE.

    This version of the breadboard does not have a wireless communication connection to anything. However, I want this system to communicate with other devices on my boat so I planned for an NRF24L01 to be added to the PCB board.