Debouncing a Rotary Encoder

N5IB reports, “ALPS, a maker of rotary encoders, recommends 10K pullup to Vcc, then 10K in series with 0.01 uF to ground. The internal pullup in the ATMega is loosely specified – somewhere in the tens of K, max 50K.

Jim Sheldon W0EB responded with, “This settled the really cheap and modified (to take the detents out) encoder on the test set right down. Tuning is extremely smooth and I don’t notice ANY digits showing up and then backing up again as it did before.

“I can highly recommend adding a 10K external pullup to both the encoder A and B inputs as well as an additional 10K in series with .1uF capacitor to ground on both the A and B inputs to the Raduino card.

“It was a nice surprise addition and I won’t leave them out again.”

Hans G0UPL responds, “Debouncing and pullups are also possible in the firmware. This is the method I use in the QRP Labs kits like QCX http://qrp-labs.com/qcx – look at the schematic: no pull-ups, no RC-debounce. Saves 6 components (4 resistors, 2 capacitors). It’s not important in a one-off build or modification but in a kit where you are trying to optimise cost, every resistor helps! The firmware method also gives you more control over how you do your debounce. I prefer the state-machine approach to rotary encoder handling, it implicitly debounces without involving any time constants.”

Reference

Guide to Arduino Coding

The best book around for learning how to program your Raduino was written by one of the BITX20 regular contributors Jack Purdum W8TEE.   It is entitled “Beginning C for Arduino”  and can be found on Amazon.

Jack says, “Make sure you get the 2nd edition…it’s a better book and has a chapter on C++ so you can “understand” most library code.”

KF2510 connectors on the uBITx

The connector type used on the main board of the µBITx and the Raduino are of type KF2510.  These were developed by MOLEX and are of the polarised and locking type with 0.1″ spacing between pins.  They are commonly available  everywhere.  In the US they are available from Tayda and Mouser.  In Australia and New Zealand they are stocked by Jaycar.  If you have time for delivery they can be obtained cheaply on AliExpress and Ebay websites, including in sets in a plastic storage box.

The KF2510 comes with both straight pins (for connectors to a board) and with 90 degree pins.  The 16 pin connector between the Raduino and the main circuit board uses the 90 degree type on the Raduino end, and straight female socket on the main board.

Connecting wires to the female connectors is straight forward.  Line up a section of wire (stripped back by around 1/4″) and use needle nose pliers to crimp the bottom-most crimp section first, and then the top one.   Most of us apply a dab or solder between the crimps to secure the wire firmly to the female pin.

The female pins just push in, but must be oriented correctly in order to be held firmly in the socket.  If they come straight out you are putting them in backwards.  The female pins are easily removed by pressing on the back of the metal pin with a flat-head screwdriver by reaching through the little window  and at the same time pulling on the wire.   Rather than curling up your spare wire connectors, it is better to pull them out of their socket for storage  in the junk box.  They can be reinserted when you want to use the connection again later.

reference

Maximum Safe Input Voltage

Paul K0ZYV asks, “What is the maximum safe input voltage to µBITx?”

Paul has lithium ion batteries that provide up to 4.2 volt when fully charged, and he hoped to put four in a pack which could max out at 16.8 volts providing about 2300 maH to power the µBITx.

The consensus seems to be around 15v is the maximum voltage that should be applied to the µBITx.

The reason is that the audio amplifier absolute voltage limit is 15V. All the other components can handle the 15V voltage.  This assumes of course that the 5V regulator on the raduino has a heatsink and better still has a series resistor to limit power dissipation.

Regulating the voltage when using Lithium Ion Batteries

VE7WQ uses a $1.45 Boost Buck DC adjustable step up down Converter XL6009 Module with a 4 cell 18650 Li-ion Rechargeable Battery pack.  This has the following characteristics:

Wide input voltage 5V ~ 32V;
Wide Output Voltage 1.25V ~ 35V
Built- 4A MOSFET switches, efficiency up to 94%.

Reference

Faulty TX/RX relay

Glenn  VK3PE suggests, “For anybody trying to get their uBITX to work in Tx mode.  Mine was working then started to become intermittent. I would key the Mic PTT switch and the display shows it’s in Tx mode, but with no power out.

“Tracing signals etc, I found that the K1 changeover relay was not switching 12V to the Tx section. I could hear the relay ‘operate’ but it didn’t actually switch.    I replaced the relay and all is fine.”

Reference

 

Reclaiming Pins on the Raduino

Don Cantrell ND6T has reclaimed two relatively unused pins on the Raduino for reuse.  Check out the details here or on his website.

When the μBITX was manufactured as a “semi-kit” the Raduino control module was designed to simply plug into the main transceiver circuit board. This made wiring easier and also permitted close and controlled connection for the high-frequency synthesizer outputs. Much more reliable than extra cabling and shorter runs, too. The downside is that more of the input/output pins from the Nano micro controller are dedicated to native functions of the radio, and only two are available for additional modifications by the user.

One of those pins is already used as the key input for the CW mode. That left just one pin, an analog capable one, to be used for such purposes as monitoring supply voltage, an S meter, an RF power meter, or VSWR indicator.

The two available “spare” pins are the only two that do not have an internal “pull-up voltage” option available on the Nano processor. These pins are designated A6, and A7. In the initial design the A6 pin is used as a CW key input and so requires an external resistor to the +5 volt supply in order to detect key closures. That detection requires an Analog to Digital Conversion (A/D conversion) and consequent decoding and processing of the resultant measurement in order to determine each key closure.

It worked, but was highly prone to error, especially if key, cable, and connectors had anything but excellent low resistant contacts and connections. I found myself regularly burnishing key contacts and having to solder across every press-fit junction in both key plug and jack. Add to that the added shielding and bypassing of the key line and there still remained an annoying glitch or two at high speed. Ah! Opportunity!

Digital pins D0 and D1 are used for serial communication. D0 is labeled “RX0” on the board, D1 is labeled “TX1”. If you were to use an RS-232 arrangement, these would be the pins that you would have to use. When you use the serial monitor (like my pocket generator uses) then these are the two pins used. Even when you program the Nano, the on-board USB controller circuit uses those pins. However…

When you are not using a serial communication function, these two pins are “up for grabs”!

Don ND6T opted to use D1 for a key input. As long as I don’t have a key plugged in and  pressed, the program loads nicely into the Nano and no one is the wiser. Since this pin has pull-up voltage capability, I don’t need an external resistor. Without A/D conversion the key is sampled in microsecond intervals. Since it uses TTL logic levels (0 and +5 volts) it is not prone to poor resistance connections, bypass, or shielding problems. Works like a charm.

Additionally, these two pins have their own little LED indicator lights on board the Nano. When one of the pins is taken to a low state (close to ground potential) the corresponding LED lights. Those nifty little indicators are usually hidden since the Nano is placed between its circuit board mounting and the display, but if you position yourself just right then you can see it light up. Nice little trouble-shooting extra!

Use the attached photo to locate the two pins on the back side of the board. The end pin is D1 and the next one is D2. Yes, they are out of order with the remainder of the pin numbers in that row. Cut a two pin section of right angle .1” spaced header block. Use alpha cyanoacrylate (Krazy Glue®) to mount the body of the plastic block to the printed circuit board, with the pins snugged up next to those two on the circuit board (D0 and D1). Then solder the new connector to those pins. That makes it convenient and easy to connect to your key jack or whatever else you want to sense or control.

The remaining digital pin is a good one to use for an added Function switch. Don uses it as a convenient access to a menu for changing sideband modes, switching VFOs, activating RIT, or adjusting my IF band pass.

That leaves two analog inputs. Hmmm!

Reference

Adding an RF Gain control

Don Cantrell ND6T has posted details of how to add a simple RF Gain Control mod to the uBITx on his website.

Almost any potentiometer, from 1 Kilohm to 5 Kilohm, can be used to add an RF Gain control.  This will make a nice addition to the transceiver. If you have an audio taper pot (logarithmic pot), that’s even better.

Locate the trace (assisted by the photo above). Use a knife ( e.g. X-acto number 5 ) to carefully scrape the coating from the trace and to cut a small 1mm (or so) separation where the connector header will go.  Cut off a section of two pins from some .1” right-angle header stock and use pliers to form the short pins to contact the newly bared copper trace while the plastic portion of the block was flat against the printed circuit board.

Carefully tin the trace where the header pins will connect to it. A bit of alpha cyanoacrylate gel glue will help fix the block in place in a few seconds. Then solder the pins to the board. This makes a very convenient access point, one that can be easily disconnected just as you would the other plugs that connect this board. If you don’t want to use it, just place a standard shorting plug on it and you are back to normal operation. Want to add an AGC circuit? This would be a place to plug it in.

Use small shielded coaxial cable to connect the control to the board. I use common RG-174 type. Tie the shields together at the control end only, not the plug end.

Use a 2-conductor section of female .1” spaced header stock for the plug. I strip the shield on each of the cables back about half an inch at the plug end and bare about an eighth of an inch of center conductor. I slip an inch length of heat shrink tubing over that end of the two cables and slide it back out of the way for the moment. I then solder the bared center conductors to the plug pins, test them, and then cover the plug and cable end with the heat shrink. I apply heat to shrink the tubing, making a nice form-fitting cover and strain relief.

About 26 dB of control is achieved with this arrangement.

 

Evening up power output across bands

There has been discussion recently about how to even up the power output of the uBITx across bands.   Maximum output (in excess of 10w PEP) is achieved on 80m, while output on 10m can be as low as 1w PEP.

Method 1:  Preset replaced by Pot on Front/Back Panel

John  G0UCP says “Drive to the finals is controlled by the preset RV1. This could be replaced by a variable pot, perhaps located on the back panel.  However, I think it was Farhan who pointed out a long time ago that the only problem with this is the temptation to keep turning it up! “
[NB:   as RF is carried on RV1, so if you are locating a replacement potentiometer some distance away from it’s location on the main board, it would be advisable to use coax to/from the board to the potentiometer.]
Reference

Method 2:  Mike Preamp with Mic Gain Control (works on SSB only)

Jerry Gaffke says “Alternately, build a new mike preamp with audio gain control, though that solution will not affect CW power level.”
ReferencE

Method 3:  Relays to different driver pots by band group

Bill Schmidt K9HZ has relays driven by the TX-A, TX-B and TX-C control lines that connect with 4 different multi-turn pots to set drive level by band grouping (80m/60m, 40m/30m, 20m/15m, 12m/10m.   Details of this straight forward solution can be found here.

Reference
Method 4: Vary the Power Supply Voltage to the finals
Marco – KG5PRT suggests,  “It’s kind of crude, but you could power the entire radio with 24v. Use a 12v regulator for the receiver and a LM350 for a variable regulator to the PA. You could set it up to be variable for only a few volts change to vary the output. You alternately could use a 12 v source and the LM350 to vary the voltage to the PA. Again, you could design something that would vary by a few watts.  Running from 24v lets you get the higher output but allows you to turn things down, as needed “
A number of alternative means of lowering voltage were suggested by list members.
Reference
Method 5:   Attenuator method with PIN diodes

Karl Heinz – K5KHK introduced another suggestion, “There is an HP application note about PIN diode attenuators.   The device used in this particular configuration reached it’s end of life, and may be hard to get soon. There are alternatives:

https://www.nxp.com/docs/en/data-sheet/BAP70Q.pdf

The data sheet has a chart that shows insertion loss based on frequency and control voltage.

Jerry KE7ER refers constructors to old threads that are well worth reading that touch on pin diode attenuators, mostly in regard to AGC for the receiver.    https://groups.io/g/BITX20/topic/5945215

Here’s another old thread:
https://groups.io/g/BITX20/topic/5913954

Method 6:   Use a digital attenuator

Carl, K0MWC  ran across this web page  where  a 6-bit, 50 ohm, 1-4000 MHz digital RF attenuator chip from Peregrine Semiconductor is used to vary RF attenuation from 0dB to 31.5dB in 0.5dB steps via an SPI serial interface.   The newer PE4312 chip (the replacement for the obsolete PE4306 used in the design above) goes for less than $5 in small quantities (less than 100 units).

Carl observes, “The PE4312 datasheet has a maximum allowed input RF power that is much lower for HF frequencies, going from roughly 11.5db @ 1MHz to about 23.5dB @ 50MHz (see Figure 4).  The PE4312 also allows control via a parallel interface for those that would rather control it that way, perhaps using an I2C digital I/O expander chip to control the attenuation rather than using SPI to save pins on the Raduino.”

Reference

An alternative to using the PE4312 could be to use the HMC470 module (pre-built) ex China for around US$13.    Mike ZL1AXG suggests that when inserted between the pre-driver stage and the bandpass filter the attenuator could be activated on both TX and RX under the control of the Raduino.  It would require 5 i/o lines. 

On TX: the digital attenuator would control drive level to the pre-driver stage, allowing RF output for both Phone and CW on all bands to be near uniform.  Phone and CW output could be controlled for on each band to within 1dB.

On RX it would be able to be used as:

an RF gain control (selectable in the menu and using the encoder to control 32 steps from 0dB to 31dB of attenuation)  AND

as part of an AGC circuit to reduce gain for strong signals.

An S-meter sensor  taken off the input to the volume control could be captured on the A7 analogue line and software could be used to display S level and control the attenuator to reduce gain on stronger signals. The setting of the RF gain control would adjust the “floor” of the S-meter.    Some work would need to be done in calibrating an S meter for typical uBITx sensor readings with the floor varying between s1 (no attenuation) and s6 (maximum attenuation) according to the (virtual) RF gain control setting.  If you want a larger AGC range, you could use two attenuators in series, to give 62dB of AGC (at a cost of 10 digital lines).

Using an i2c display would release 6 digital I/O ports, or an i2c port expander could be used to get the additional I/O lines required.

There are many options to choose from, but Mike likes the ultra-inexpensive CD74H4067 16 channel analogue/digital multiplexer module (US$0.50 or thereabouts on AliExpress). This takes 4 digital i/o ports and a single analogue port, but switching between these multiplexed ports can be done very quickly by turning on/off the four digital ports used to select 1 of 16 ports. Just read or write via the analogue port.

Even after grabbing an analogue port and 5 digital lines for the attenuator from the multiplexer, you are left with 9 digital or analogue I/O ports for future use in the µBTIX.   Analogue out is another bonus feature of this module.

REFERENCE
EDITOR’S NOTES
Because the RV1 drive level control (in the uBITx circuit) is in the RF line, it is not recommended to use a DAC variable potentiometer, as this is likely to get RF back into the raduino.    PIN diode attenuators should work, and could be used with a DAC I2C chip or similar.   However, a digital attentuator is an easier arrangement.