The K3NG Rotator Controller project is aimed towards Arduino Mega 2560 or similar hardware.
Standard ADC resolution on many of the Arduino boards is 10-bit, however the Arduino Due, Zero, and MKR family and Teensy 3.x family have 12-bit ADCs.
So if you’re running this hardware, why not make use of the extra ADC resolution with four easy steps;
1 – Change rotator_features.h
Add the following code around line #40:
// 12 bit ADC resolution for Teensy 3.x, Arduino Due Zero MKR families #define FEATURE_ADC_RESOLUTION12
Your rotator_features.h code should now look like this:
To revert back to standard 10-bit ADC resolution, comment out the line, ie;
// 12 bit ADC resolution for Teensy 3.x, Arduino Due Zero MKR families // #define FEATURE_ADC_RESOLUTION12
2 – Change k3ng_rotator_controller.ino
Modify the analogReadEnhanced() function, found at line #11745 (as of v2020.06.26.02).
unit8_t now becomes unit16_t
#ifdef FEATURE_ADC_RESOLUTION12 analogReadResolution(12); #endif
Your code should now look like this:
3 – Recompile and upload to your target MCU
4 – Recalibrate your analogue sensors
With a wider range, you will now need to re-calibrate your azimuth sensor at full CCW and full CW.
In the Yaesu world, use the O and F commands respectively.
Likewise, recalibrate your elevation sensor at full down and full up.
In the Yaesu world, use the O2 and F2 commands respectively.
If you perform a \D debug dump to the serial monitor, you will observe the increased ADC range of 12-bit resolution, being 4096 steps, 0 – 4095.
(Click on image to zoom up)
The K3NG rotator controller is an excellent project by Anthony Good K3NG.