Elektor Lab Notes 22: Battery Monitoring, Car Sensors, and More
on

Saad Imtiaz (Senior Engineer, Elektor)
Lab Notes: Battery Monitoring System and Car Sensor Dashboard
Battery Monitoring System for Lead-Acid UPS Batteries
The Battery Monitoring System project for the lead-acid batteries connected to my UPS is nearing completion, and the final details will be featured in an upcoming edition of Elektor Magazine. To summarize, the system monitors critical parameters like current and voltage, providing real-time insights into battery performance. However, a key feature still in development is the calculation of the State of Health (SOH) of the batteries. This feature is crucial for any backup power system, as it helps predict the remaining usable life of the batteries and ensures optimal performance.
Adding the SOH feature will involve analyzing charge/discharge cycles, and temperature trends over time to provide a holistic view of the battery's condition. These insights are invaluable for preventive maintenance, enabling better lifecycle management of the batteries and avoiding sudden power outages. By integrating these capabilities, the system ensures your batteries remain reliable and efficient throughout their operational life.
Car Sensor Dashboard Project
On another front, I’ve been working on a custom car sensor dashboard. While the initial idea was to retrofit my 2001 Land Cruiser with a modern display for real-time vehicle diagnostics, I hit a technical roadblock. Despite extensive testing and research, I couldn’t extract sensor data from the truck due to protocol compatibility issues. Most vehicles from the early 2000s rely on manufacturer-specific protocols that don’t adhere strictly to OBD2 standards, and I wasn’t able to identify or decode the correct protocol to pull meaningful data from the Land Cruiser.
However, the project is still alive and kicking—just with a new test subject: my 2007 Honda Civic. This vehicle supports OBD2 communication over protocols like CAN-BUS, which allows me to fetch a plethora of sensor data. Parameters like fuel flow, instant mileage, coolant temperature, and airflow rate are not just interesting but also highly practical for analysis. For instance, by tracking fuel consumption during a trip, I can calculate average fuel efficiency and assess how my driving habits affect mileage. Spoiler alert: my data suggests I should ease up on the gas pedal—unless I’m trying to set another lap record to the grocery store!
The dashboard features a modern LCD display to present this data in an intuitive and stylish manner, making it a fun and useful addition for car enthusiasts and eco-conscious drivers alike.
Jean-François Simon (Engineer, Elektor)
Fans of spectrum analyzers will have to wait — my attempts to repair the R3132 are still a work in progress. Meanwhile, for a different project, I’m modifying a machine by inserting a microcontroller module between a push button and the actuator it controls. This will allow me to manage short and long presses. To simplify wiring and minimize modifications to the original harness, the Arduino module will be powered directly from the wire coming from the push button. To react to short button presses, the Arduino must be able to boot quickly. Here’s my setup to measure startup time on a Pro Mini clone on a breadboard. The code sends a 100ms pulse on pin 9 and I use a scope to measure boot time. In yellow, you can see the 5V power supply, and in blue, the pulse on the output pin:
The results are in: there’s a delay of 1.45 seconds between power-on and the start of the output pulse. I’m confident this can be improved. The next step is to program the microcontroller without using the bootloader. This involves selecting Sketch > Export Compiled Binary in the Arduino IDE and using an external programmer. I’m using an AVRISPmkII; the IDE version I’m working with is supposed to support it, but in practice, I encountered an error (likely a driver issue). I’ve spent hours battling AVRDUDE in the past… A better solution would be Microchip Studio, but I couldn’t resist testing AVRDUDESS, which was recently updated (September 2024, version 2.18):
Surprisingly, it worked on the first try, and my AVRISPmkII was recognized without issue. I selected the HEX file without the bootloader, and voilà! Here’s the new startup time measurement:
The Arduino now starts up in about 70ms. Not bad! That’s much more responsive. But wait — at 16 MHz, this still represents over 1 billion instructions! What’s happening? Time to dig deeper into the datasheet. Table 8.4 on page 27 provides the answer: there’s a 65 ms delay to ensure stable power supply and allow the quartz oscillator enough time to start and stabilize. The default fuses on the Pro Mini (0xFF, 0xDA, 0xFD) confirm this. Using the Fuse Calculator, we can see that we are in a situation corresponding to the last line of the table, with the CKSEL0, SUT0, and SUT1 bits set to 1. Microchip includes this option for a reason. If you choose to remove the delay, follow the documentation carefully and test thoroughly to ensure your microcontroller behaves as expected. For the fastest startup, CKSEL0 can be set to 1, SUT0 to 1, and SUT1 to 0, which is done in AVRDUDESS by setting the fuses to 0xDF, 0xDB, 0xFD. Here’s the result with the updated configuration:
Now we have an (almost) lightning-fast Arduino startup: 2.9 ms! According to the 6th line of Table 8.4, the startup delay still includes 16,000 oscillator cycles, or 1 ms. This suggests the built-in quartz oscillator itself took roughly 1.9 ms to start, consistent with Murata’s “around 2ms” indication. Have fun with your turbocharged Arduinos!
Brian Tristam Williams (Editor, Elektor)
I’ve started the new year with some new toys to try out. I’m busy categorizing them and making a list of which ones to do reviews and/or videos on first.
That’s quite a bit of choice there — let me know in the comments what you’d like to see first!
One of my goals in 2025 is to increase the number of videos I put out, but that means streamlining the workflow and upskilling on the video editing apps. The big choice now is to choose between learning more about Adobe Premiere Pro, or switching to DaVinci Resolve (as recommended by Jens), since Adobe has been getting less than favorable attention with regard to privacy lately.


Explore More Lab Notes and Electronics
Want to learn more about Arduino, test and measurement, microcontroller projects, or electronics in general? Check out all the educational videos and tap into the knowledge of experts on our Elektor YouTube channel and our Elektor Industry YouTube channel. Subscribe to Elektor's newsletter to receive a regular flow of expert tech knowledge and interesting perspectives.
Discussion (0 comments)