Close

Some software improvements

A project log for J1772 EV Simulator

An invaluable piece of test equipment for J1772 developers

nick-sayerNick Sayer 08/20/2021 at 20:220 Comments

One thing that can happen is that USB voltages can vary quite a bit. Given that we're scaling a 24 volt range into a 5 volt range for the ADC, even a half a volt difference in reference means a 10% error in the voltmeter readings.

We can calibrate the reference voltage by comparing it to the ATTiny's internal bandgap reference of 1.1v. Measure that with the ADC and you can indirectly measure the reference voltage. With that, we can scale the ADC readings against our measured reference voltage and make the voltmeter readings a bit more accurate.

Additionally, if we set one of the timers to free-run and trigger timer capture with the AC output, we can actually measure the duty cycle against the system clock with a very high (16 MHz) granularity. We can also count the number of times the AC output changed during the sampling period to perform the frequency counting, as before.

With these two improvements, plus the impedance buffer hardware change, the whole system has been pretty much perfected.

Discussions