Archive | March, 2018

Digital Sampling S Meter for uBITX

25 Mar

I got some time to work on my digital S-meter/AGC concept. I’m running the Arduino ADC in continuous mode at 9600 conversions/sec. The converter works in the background and generates an interrupt when a new sample is available. This ADC samples the receive audio from the top of the volume control and performs a fast peak-detect function with controllable decay. This drives the S-meter display and also forms the basis for a feedforward AGC that will be implemented with a  D-A converter driving the volume control on a TDA7051A power amplifier chip.

In the process, I fixed the bias on the audio preamp stage to give about another 10dB of dynamic range. This will be very important with feedforward AGC, as everything up to the volume control always operates at wide open gain, so the audio preamp is the stage that overloads first.

I’m having some problems with the Arduino locking up since I implemented the interrupt-driven continuous fast A-D.  I might be asking too much of the Nano. I’ll be working on this; an 80 mHz STM32 board is waiting in the wings if that’s what it takes.


uBITX Taking Shape

18 Mar

I got a chance to do some work on the uBITX build over the weekend. I made a transition board out of perf-board. It makes the electrical interface and mechanical transition between the Raduino board and the TFT color touch-screen. You can see it below in the upper left corner  between the Raduino module and the control panel.

Also, I started to mount everything, including the speaker, into the cabinet. Yet to be mounted are the 3600 mA/hr Li-Ion battery pack I purchased and a buck-boost regulator board that will supply the radio with a solid 13V even when the battery runs down to 8V or 9V. A 3-position front panel rotary switch will select power modes OFF, ON from the battery or ON with external power-pack assist.  I pasted a black & white overlay to the front panel to get an idea what the final rig will look like.

I’ve been listening to 40M the whole day. The radio tunes very smoothly, and the tuning pointer on the slide-rule display gives a nice perspective for where you are in the band. However, the tuning rate of the 400 ppr encoder is too touchy for fine tuning and too slow for fast across-band excursions. I think I’m going to implement a default 1 hZ step-size  with acceleration to 10 hZ and 100 hZ as you spin the knob faster.

Getting the Encoder working with Interrupts

9 Mar

IThis is working nicely now, but it was a bit tricky.

When he designed the uBITx, Farhan decided not to use the Arduino pins dedicated for devices that can externally interrupt the micro controller (D2 & D3). Instead, he used inputs A0 and A1, which are general purpose analog/digital pins and then he polled the inputs in software to determine the encoder state. This works well enough for the primitive low-resolution encoder supplied with the uBITx, but it can’t keep up with higher resolution encoders that have more than 10x as many pulses per revolution of the shaft. This is compounded by the fact that the TFT color display I’m using ‘steals’ a lot of processor throughput every time it updates, causing missed states when the encoder is turned.



Fortunately, Farhan chose to use analog-capable pins, and with a little trickery, these can generate interrupts by using the Arduino’s built-in analog comparator, which can generate interrupts to detect state changes. To accomplish this, you have to set up the comparator to generate an interrupt on a specified edge of one of the encoder inputs and then immediately poll the other encoder input to compare state combinations. This is now working pretty well with no missed states or ‘stuttering’, no matter how fast you spin the encoder shaft.

This weekend, I’ll hopefully connect the new display and encoder to the uBITx, connect an antenna, and give it a whirl.


UPDATE: I had a lot of problems with the comparator bouncing on encoder transitions because it has no hysterisis. I rewired the Raduino bard to use the D2 and D3 lines for the encoder and A0 & A1 replacing what D2 and D3 were doing. This works much better.

uBITX Enhanced Tuning Encoder

6 Mar

I purchased one of these optical encoders on Ebay a while back for about $12. It gives 400 pulses per revolution and no contact bounce. It’s much too fast for the Arduino program as-written to keep up with, so I had to completely re-write the encoder code to use interrupts. It works a treat and no need for the annoying speed-up algorithm that makes the uBitx so hard to tune. With step size set to 50 hZ, you get a nice smooth 20 khZ per revolution of the knob.

I have a front panel drilled and cut to accept this and the TFT color touch display. I’ll be unveiling both in the cabinet along with the uBitx, possibly this weekend. It looks like the picture in my previous post.