Adding an “S” meter function
Don Cantrell, ND6T
Aside from dressing up the display (taking up room is more like it) there is little use for a signal strength indicator (“S” meter) unless it is accurate. Admittedly this implementation is not accurate, merely a nod to the notion. That said, it does work as well as a few “store-bought” rigs that I have used. Since it is simple and easy, I will pass it on for what it's worth.
Just three components, none critical. I ran a lead from the “hot” side of the volume control through a diode to an available analog port on the Nano® and paralleled a 0.1uF capacitor with a 4.7 Megohm resistor from that port to ground. The diode can be a silicon switching diode like a 1N914 or 1N4148 but a germanium like a 1N32 will work better for the lower strength levels.
The reason for the inaccuracy is primarily due to lack of the usual AGC circuitry. Normally one just measures the AGC voltage and scales it to suit. This mod is simply using the detected audio and then using a short-period peak hold circuit to feed the micro-controller.
The code is poorly done at this point but it met my low expectations. It currently resides in lines90 through 94 in Version 1.0 of the BITX40_VFO.ino sketch. Please feel free to change it and pass it along.