This is going to be an update and expansion of range for a test device I built and posted on the forum two years ago.


Battle of the Batteries - E*** vs D*** vs Bargain


The device that I built for that blog was designed to monitor a battery voltage that was under constant current load from a non-programmable electronic load and compare it to a target voltage that was selected by me. It was my purpose to time how long it took for the battery voltage to decay below the set target voltage. Since this process could take many hours I wanted an automated device that would let me walk away and return the next day to see the final results. For this first device I designed it using a comparator and support components which supplied power to an analog electric clock as long as the battery voltage was above the target voltage and then stopped the clock when the battery voltage finally dropped below the target. While this test adapter worked as planned it had several limitations and inconveniences.


I have been thinking for some time to revisit this project and to make the following improvements:


1. Use a digital clock timer that can be reset to 00:00:00 without having to manually move the clock hands.


2. Improve the accuracy of the timing to +/- 5 seconds.


3. Have an integral internal power supply to power the unit and produce the Target Voltage selection. ( The original required the use of an external bench supply to power the unit.)


4. Expand the range of Monitored (previously called Battery) Voltage that can be tested from 12 volts to 30 volts.


5. Expand the concept of the unit to include super capacitors and other processes where an initial energy source is consumed by a load over time.


This has been an idea knocking around in my head for some time but the recent posting of the DIY test equipment on the forum has made me put the idea back on the real bench.


This first blog will explain the progress I have made on finding an appropriate digital clock and some of the unusual modifications that I had to make to it. Please look with a critical eye at my solution as I am hoping those of you with more experience will warn me if I am making a mistake with this approach.


Here is my present best candidate for digital clock timer for the Process Duration Timer:




This is a $3.63 Chinese clock kit. The first thing that I liked about it was that it starts at 00:00:00 when power is first applied and then it begins to time immediately. As I built the kit I intentionally modified it with a mind to building it into the final enclosure. I left the LED display raised and made sure all the other components sat below the level of the faces of the digits. I left the memory battery off, as the fact that it will reset to 00:00:00 each time it is powered down if a asset for this application.


* First real problem is how to conserve the time on the clock when the transition of the monitored voltage from above to below the target voltage occurs. Keep in mind that the experiments that this unit will be timing may take many hours and I will not likely be there to look at the clock when the voltage transitions. It may be many more hours before I actually return and want to check the time. The clock system is built around an Atmel AT89C2051 Micro Processor and I have no access to its program nor do I have the skill to modify it if I did. My solution will have to be external and involve stopping the clock without loosing its current time register. I tried using the input switch on the unit to do this but all that it was programmed to do was reset the hours and minutes.


After some experimentation I discovered that if I disabled the oscillator clock to the AT89C2051 it stopped timing. I did this by pulling one side of the crystal to ground. (Question  - Is there any reason why this is not appropriate). When the microprocessor has its clock stopped a side effect of the stop is that I am also left with the current output to the LEDs which is usually a single bright digit on the display. I experimented with leaving the system in this state of suspended animation for 40 minutes and when I opened the grounded leg of the crystal the clock resumed at the exact time that it had when it was suspended.


The next step was to add a small 5 volt DPDT relay to the underside of the board. One of my concerns was that the additional capacitance of the relay structure that I was adding, to be able to pull the crystal lead to ground, might cause problems. I placed the relay close to the crystal and ground to minimize any capacitance. By now a good survey of the almost unreadable schematic supplied with the clock kit had given me a way to suppress the display of any digits while the clock is in suspended animation. There are six transistors on the unit that control whether a digit displays or not. These transistors all have a common emitter connect to the power supply. I used the second section of the DPDT relay to switch this power feed off to the transistors. In this way the energizing of the 5 volt relay puts the clock into suspended animation and blanks all the digits at the same time. I also used the other touch contact of this pole to light a red LED that I mounted in the place of the memory battery. After cutting some traces and adding a 470 ohm resistor for the LED the back of the circuit board looked like this.




You can see that I have also added a flyback diode to the relay to minimize a voltage spike when the relay is de-energized. The next step is to test the prototype of the timer to see if it does the things that I want it to do. First of all I want it to start off counting when power is applied at 00:00:00. Secondly I want to be able to put the timer into suspended animation for an indefinite period of time. The suspension will stop the clock pulse of the AT89C2051 and suppress the lighting of the digits in the display. To tell me that the clock is in suspended animation the red LED in the lower right corner should light. Here is a video of the proof of concept test.



I continue to be concerned about my use of the clock crystal for the AT89C2051 to produce the desired suspended animation. If anyone has any input or experience with this, your insights would be appreciated.


My next topics for this series of blogs leading up to building a working Process Duration Timer will concern themselves with a suitable power supply to drive the clock, the Arduino that will provide logic control of the unit, and a source for setting the target voltage. Also the integration of the Arduino and the programming thereof. I will also be including a scaling circuit so that the ADC of the Arduino is allowed to use its resolution to the best advantage regardless whether we are testing a device in the 30 volt area or the 1.5 volt area. We will also have to plan for instrumentation so that we can see the test voltage as well as the target voltage. I am sure that more ideas will come as I begin to build and test the individual components. This is probably the first project that I have decided to blog about as I design it rather than wait for a finished project. You just may get a chance to see me flounder and fail and have to be helped to the finish line.