-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redesigned algorithm for VPP measurement #54
Comments
I'm following this with great interest., .. |
I would be very grateful if you could test the suggested code change. |
I'll look into it closely, at the time i can get my hands in a 4131.. While waiting, did try another approach with a a handmade DAC R2R , and it worked, |
So I built an afterburner and started by checking Vpp voltages. The voltage readings were a bit inaccurate: A Vpp of 16.50 Volt (multimeter) resulted in an reported voltage of 16.08 Volts. I observed the following:
If you then multiply (not divide, too computation intensive!) the 14-times summed ADC value with ADC_MUL_VAL, you end up with the proper value in E-2 V. Note that by using these defines, calculation is transparent and the values are easy to change. And you have only 1 multiplication instead of various multiply/divide operations. The VarVppMeasureVpp() now looks like:
|
I propose a simplified form of voltage measurement in the Afterburner.
This affects the varVppMeasureVpp() function in aftb_vpp.h and some definitions.
The mathematical basics:
ADC = return value of analogRead()
Vin = voltage at the analog input
res = resolution - 2^10 = 1024 (10 bit resolution)
Vpp = programming voltage VPP
Vref = reference voltage of the A/D converter at pin AREF
Based on the basic formula
After converting formula (1) we get
Vin results from the voltage divider R5/R6
Switched to Vpp
Vin substituted by (2):
If you calculate with floating point, you can measure the Vref of your specific afterburner with a good multimeter and specify it precisely, e.g.
This also applies to the resistors R5 and R6, which can be measured beforehand.
I put the definitions of the parameters in a separate header file aftb_adcparms.h, which is included in aftb_vpp.h.
This makes it easy to adapt to your own hardware without having to spend a long time searching between the lines of code.
The varVppMeasureVpp() function has been completely rewritten.
Measuring using this method provides a significantly better agreement between the displayed VPP values compared to a multimeter.
The difference between the Arduino measurement and the multimeter was a maximum of 0.02V (Arduino NANO, Vref = internal 1.1V, R5 = 20k, R6 = 1.3k).
The text was updated successfully, but these errors were encountered: