I was recently asked to assist a friend who had built the Silicon Chip Automotive Ammeter project to help to resolve a problem with the instrument reading garbage after having operated correctly for some months. He was unaware of anything that might have contributed to the sudden failure.
He had tried to recalibrate the unit using the directions in the construction article. It did not behave as described, and he suspected a hardware fault.
I attempted to recalibrate it according to the instructions. I placed a shunt over the CAL0 pins and the unit displayed CAL, I removed the shunt and the unit displayed OL whereas the instructions stated it would show 0. When I disregarded this and placed the shunt over the 30A pins with a magnetic field applied to the sensor, it calibrated ok.
I then varied the operating voltage and noticed that I could induce garbage readings which continued even after cycling the power. The design appears to be susceptible to corruption of the calibration constants when operated on low voltage. I do not believe that the 16F84 has inherent brown out protection, and it does not seem that the circuit contains brown out protection - an unwise shortcut given that unreliable operation of the MCU could (and does) result in corruption of the EEPROM calibration constants.
I have modified the code so that when the shunt is applied to the CAL0 pins it not only stores the correct calibration value for the 0A case, but it also stores a sensible initial value for the other three constants so that the display will read 0 when the shunt is removed, and will be approximately calibrated as is the case with a newly programmed chip. (This is so that calibration behaves as per the construction notes.)
I also added a brown out device to pull the /MCLR pin low when Vcc is less than 4.2 - 4.5V. It is a pity that this little 3 pin device worth a couple of dollars wasn't integrated into the board design.
Silicon Chip missed the opportunity to educate readers of the extra care that needs to be taken when an MCU can corrupt critical parameters, ways of detecting it, ways of recovering from it, and ways of minimising the risk of occurrence. Imagine if the engine management system in your car was as unreliable as this project seems!
A zip containing the modified source code (including a large number of changes to the code to get it to compile under the current version of MPLAB) and the compiled hex code is available for download.
My friend reports that after the above mods, calibration was straightforward and that the unit has operated reliably for 6 months.
© Copyright: Owen Duffy 1995, 2021. All rights reserved. Disclaimer.