Yet another Arduino Nano and si5351 Digital VFO/BFO

January 2017, summer holiday season down-under, afforded time to build something I’ve been wanting to build for several years, my first Digital VFO. I’ve built a kit Digital VFO with pre-soldered surface mount parts and burned-in firmware, but this was to be a scratch build with Arduino Nano, C code with modifications, and a Silicon Labs si5351 PLL clock generator on a breakout board. I used the wiring map and script from Tom AK2B (modified from one by SQ9NJE ) and uses Jason NT7S si5351 library. The script is simple, supporting a single push-button to cycle frequency increments, and dealing with encoder interrupts, contact debouncing, refreshing the LCD display, IF offset and VFO/BFO outputs.  Jason’s si5351 library hides the gutsy device interfacing, giving you a handful of common-sense functions to call… for example, set_frequency() takes as its argument the frequency in centi-hertz (1/100th of a hertz) and the ‘clock 0/1/2’ flag. It couldn’t be simpler. The Adafruit board contains the si5351 and a 25MHz clock (from local IoT supplier Core Electronics).  Here’s a video demonstration of the VFO’s features.

Tom’s script didn’t compile first time, as Jason’s library had changed since Tom posted his script. Jason had removed one parameter from the init() and set_frequency() methods to simplify things. In Tom’s script I removed the arguments (which were ‘0’ anyway). This was a remarkably simple build experience!  The key is the si5351… three clocks, 1-160MHz, all software controlled, in a tiny 10 pin MSOP package, and all for a few dollars.

One thing’s for sure, it will be hard going back to quartz.  [Postscript 12/2018: Quartz crystals are still favoured for good clean BFOs;  but I can’t see any reason other than nostalgia for building a free-running VFO these days].  

With the wide range of Arduino breakouts, all sorts of control and monitoring behaviours now become possible — GPS, SWR, power and temperature monitoring for power amplifier stages or linears, sequencing, switching, wifi, bluetooth, packet data links, to name a few.

Design notes

Once you have control of the VFO and BFO in software, controlling other things in a transceiver like band, memories or multiple VFOs, IF filter switching is all just a matter of a few more lines of code.  I came up with the following additional controls:

  • Step cycle (10, 100, 1k, 10kHz steps)
  • VFO cycle (A, B or C)
  • Band up/down (LF, MW, 160, 80, 60, 40, 30, 20, 17, 15, 12, 10)
  • Mode cycle (SSB, AM, CW)
  • Rx/Mute status (Rx, Tx)

Controlling mode and band switching relays

If you decide to implement control of mode and band switching in your homebrew radio’s Arduino controller, a mechanism is needed to pass binary or BCD values representing the active mode and band selections through to the individual control lines that energise the relays for each. The traditional way of doing this is to get the controller to output a BCD 3 or 4-bit nibble on its pins, and use a CMOS/TTL 1-of-8 (74LS138) or 1-of 16 (74LS154) decoder, with an inverting transistor relay driver stage which does the actual switching.  You can buy the CMOS version of the venerable 74LS154 1-of-16 IC in surface mount on an Arduino style break-out board to minimise space.

A more contemporary way of achieving the same thing is to use a 1-of-16 decoder driven by I2C. Something like this break-out expander. Or this IO expander.  This is preferable because you don’t need to tie up lots of your Nano pins to synthesise a BCD nibble, instead, you pass the selected value to the expander/decoder device via I2C. I’ve not decided how to do this yet.

Supporting multiplexed pushbuttons

I came up with the need for pushbuttons to control the following features of a multiband radio:

  1.  freq step (100Hx, 1kHz, 10kHz)
  2. VFO cycle (VFO A, VFO B, VFO C)
  3. band up (40, 30, 20 etc)
  4. band down (20, 30, 40 etc)
  5. mode cycle (SSB, CW, AM)
  6. mute (RX, TX).

The Hitachi LCD display does not support serial I2C. That means 4 Arduino digital outputs are necessary to convert 4 bit data values to the display, plus 2 control lines. That does not leave enough digital and analogue pins for all the pushbuttons or  output lines.

A common way around this (without going to the added complexity of IO expander break-outs) is to multiplex a number of pushbuttons switching on a resistive voltage divider, on a single analog input. The script reads the pin and interprets a voltage range for each button. Here’s a circuit and tutorial. I built a rack of 6 momentary on switches (on a receiver front panel I prefer pushing down on a spring loaded switch over pushing in on a pushbutton). The values I got were quite predictable and narrow in range. In the mapping script I used wide number ranges to allow for DC supply variations or drift.

si5351 clock filtering

The si5351 clock outputs are square waves. There is some discussion in the forums about the harmonic content of the waveform and the need for low pass filtering.  The answer is, it depends on what you are doing with the VFO signal. In the dual conversion multiband receiver I have in mind, all 3 mixers are SBL-1s. I asked the Yahoo QRP-TECH crowd what they thought of the need to low-pass filter a square wave when used to drive an SBL-1 Double Balanced Mixer. There wasn’t any consensus, but two themes emerged:

  • square waves are rich in harmonics and these should be cleaned up, and
  • a DBM is a switching device in which the diodes saturate when driven with correct oscillator signal level, so squareness of the waveform doesn’t matter much.

I decided that low pass filtering was desirable, and plan to add a 5 element Chebychev LPF and a broad-band 2N3904 amplifier stage on at least the VFO clock.

Arduino Nano pin plan

Here’s a plan for how I used the Nano’s IO pins (it assumes an HD7044 LCD and old-fashioned TTL band and mode decoding and switching):

D0 – NC
D1 – NC
D2 – rotary encoder up
D3 – rotary encoder down
D4 – // mode output (lsb) (TBC)
D5 – LCD Register Select
D6 – LCD Enable/Clock
D7 – LCD D4
D8 – LCD D5
D9 – LCD D6
D10 – LCD D7
D11 – // mode output (msb) (TBC)
D12 – // band output (lsb) (TBC)
D13 – // (internal LED) –
A0 – // Multiplexed buttons — VFO cycle, Step cycle, band up, band down, Mode cycle, mute)
A1 – // band output . (TBC)
A2 – // band output . (TBC)
A3 – // band output (msb) (TBC)
A4 – si5351 SDA
A5 – si5351 SCL

Metering

Experimenters are using Arduino analog inputs with simple external circuitry to implement the following meters in transceiver projects:

  • Voltmeter: a volt meter is valuable for monitoring battery voltage and health from a portable QRP rig. A voltmeter is one of the easiest additions — simply create a voltage divider with two resistors across the supply rail so that the peak supply voltage is a bit less than 5 volts (measures close to 1024 on the pin using AnalogRead()) and scale the resulting value in software.
  • S-meter: a simple one transistor circuit can sample and rectify IF or audio signal and bring it into the 0-5 volt range for another analogue pin.
  • RF-meter: sample and rectify the PA output via a tiny capacitor (a few pF); the Arduino can use the same display space for S-meter on receive and RF on transmit.
  • SWR: a simple directional coupler can supply both forward and reflected indicative voltages, which can be displayed concurrently or alternately.

Useful notes on Arduino Nano

While researching the Nano I found the following useful facts:

  1. D0 and D1 are used in the serial interface between the Arduino and the PC. The same channel is used by the system’s serial monitor Serial:: which allows a script to trace to the attached screen or other serial device.  Seems best to not use these pins.
  2. D13 controls an on-board LED through an appropriate resistor to ground. As the Nano boots, D13 is made an output (all the other i/o lines come out of a reset as inputs). And the system software, before it executes whatever you’ve put in setup(); will briefly take D13 high before returning it to low. For this reason this pin should be used for input only, to avoid relays clattering during the first seconds after power up.
  3. Arduino analogue I/Os can be used as digital ones.  To set A0 as output and high you use:

 pinMode(A0, OUTPUT);
digitalWrite(A0, HIGH);

Postscripts

August 2017: I made up a second Arduino Nano and si5351 VFO/BFO/Controller for another homebrew rig, with some improvements.  The post describing the VFO is here.   A video of the new rig (receiver only at this stage) is here.

March 2018: Have built four or five Arduino Nano/si5351 VFO/Controllers now.  A post describing my latest Nano/si5351 controlled QRP rig is here.

September 2018: Here’s a post on a compact G6LBQ BiTx using an Arduino/si5351 VFO and BFO.     

November 2018: Here’s the github repo with my code.  It works on a HFSignals (VU2ESE) Raduino module.  If you use it, remember to execute the Initialiser script once (to set up EEPROM).  Further details in the readme and main file header.  

December 2018: And another Arduino/si5351 compact VFO/BFO/Controller and CW Keyer, first stage of a compact multiband SSB/CW transceiver.   

Tagged , , , ,

56 thoughts on “Yet another Arduino Nano and si5351 Digital VFO/BFO

  1. VK3IL says:

    Paul,
    You’re turning to the dark side! Welcome to the world of digital electronics! There are a number of VFO kits out there now too using this synthesizer. I used one in upgrading my KN-Q7A rig (see http://vk3il.net/projects/kn-q7a-mods/ ). You can do an awful lot with microprocessors in rig control and still use analog for the signal chain. Now you just need to get into designing surface mount PCBs and start using the microprocessors directly 🙂 Even though it costs money to have PCBs produced commercially, it’s pretty cheap these days from China.

    73

    David
    VK3IL

    Like

    • Paul Taylor says:

      Thanks David. Its pretty good here on the dark side of digital electronics! I can see a steady trajectory in my projects from 1970s radio craft. I can see the day when i do design one off PCBs with surface mount components, mainly to reduce size for portable rigs. Thanks for your Likes and comments David! 73 de vk3hn.

      Like

  2. […] the success of My First DDS VFO, complete with Arduino script programming, I found myself interested in mimicking more of the […]

    Like

  3. Ardy says:

    Congratulations Paul, si5351 have more clean output and low distortion than DDS ad9850 / 51. 2nd output can using for local oscilator.
    Nice project Paul. 73 de yc2lev

    Like

  4. […] the success of My First DDS VFO, complete with Arduino script programming, I found myself interested in mimicking more of the […]

    Like

  5. […] in February 2017 I scratch-built my first Arduino and si5351 VFO. Here’s my second one.  It is a generic Nano/si5351 module wired up to Farhan’s […]

    Like

  6. […] apart from soldering the SMA connectors) it is just 30mm wide and can used with an Arduino to make VFO with 3 programmable sine wave outputs. Current cost is less than £5 on ebay plus the […]

    Like

  7. Michael says:

    Hello Paul. I am just starting to replicate your VFO in the above article (As the basis for another project later). Do you have the exact code still for this exact configuration please? I have downloaded the code dated VK3HN, 20 June 2017, but it cannot find Rotary.h and pcf8574.h which is not needed in this version. I’m looking forward to getting this going. Many thanks…, Michael ZL3AX

    Like

    • Paul Taylor says:

      Hi Michael, sorry for the delayed reply, WordPress alerts have dropped off.

      The code is for the Progressive Receiver, not yet posted as it’s not working to my satisfaction. Look at Progressive_VFO.ino on my github page in the vk3hn_si5351_VFO_controller repository. I haven’t flashed this particular controller for probably 9 months but it should still work. You may need to adjust it a bit, and of course, it probably has bugs! Let me know if you need anything interpreted. Regards Paul VK3HN.

      Like

      • Anonymous says:

        Thanks Paul. Things have already moved on a bit and have found some code and got the VFO working. Now the project begins, and the code will evolve here. I am still interested in code that gets the best quality from the Si5351 and am working on this. Thanks Paul. M. (Zl3AZ, J87AB, G0GPX)

        Like

      • Paul Taylor says:

        Sounds good Paul, there’s lots of code and help around. Good luck with your project. Thanks for commenting.

        Like

  8. UR5SDL says:

    your cod is not work !!!
    hi has error her PCF_BPF.write

    E:\Arduino\Arduino_si5351_VFO_Controller_Keyer-master\Arduino_si5351_VFO_Controller_Keyer-master\SP_VFO_Controller_Keyer\SP_VFO_Controller_Keyer.ino: In function ‘void set_filters(uint32_t)’:

    SP_VFO_Controller_Keyer:1011:41: error: ‘class PCF8574’ has no member named ‘write’

    Like

    • Paul Taylor says:

      The PCF8574 library that people are using has changed its write() signature. Change all write() to digitalWrite(). Look in the class header if that doesn’t work. There are a number of other things you will need to do to get the script to execute correctly. Most of the comments are in the code headers and readme. If you get stuck just ask. Good luck.

      Like

  9. Adrian says:

    Hello Paul
    I came across your website whilst researching the internet for possible solutions for a replacement VFO for my G6LBQ transceiver (and other projects). I like what you have done!

    I have downloaded your code (Arduino_si5351_VFO_Controller_Keyer-master) & fixed the errors as per your comments about changing write() to digitalWrite() and the code now verifies..I am a beginner in writing code so please forgive me if I ask daft questions and I don’t understand some things about how this all works, could you advise ? Specifically:

    1. Where is the initialiser script used ?
    2. Can you confirm that you use the Raduino circuit for the Arduino_si5351_VFO_Controller_Keyer-master ?

    And something you may have noticed…I built a G6LBQ transceiver using the original designed VFO. The VFO uses the same Silicon Labs chip as in the Raduino and others. However the original G6LBQ VFO has display tracking errors. At 1MHz its approx 100Hz off frequency,at 28MHz its approx 7 KHz off frequency and so on. My basic analysis has revealed that there is a mathematical function somewhere in the code that results in this error. I suspect its because the IF frequency I used ended in an odd number and the code doesn’t take this into account.

    I would appreciate your help & thoughts.
    (I have some spare un populated G6LBQ boards if you are interested ?)

    73

    Adrian M1LCR

    Liked by 1 person

    • Paul Taylor says:

      Hi Adrian,
      Thanks for commenting and good to meet another G6LBQ Bits builder. First the answers:

      1. Initializer script is at https://github.com/prt459/Arduino_si5351_VFO_Controller_Keyer/blob/master/SP_VFO_Initialiser.ino
      Compile it, make sure your Arduino console is set to 9600, and execute it once. Change any default frequencies etc to suit your rig. These are one-time values as the VFO is frequently persisted in EEPROM.

      2. The circuit is as per Raduino. However, I use my own multiplexed buttons for both front panel and keyer memory pushbuttons. These are wired in the standard way, each one earths a different point in a resistor series, resulting in a distinct reading on the Arduino analogue input. You will need to fiddle around with these, see the notes in the repo.

      I never built Andy’s original VFO and never took the time to study his code, so I cannot comment. The displayed frequency is just a derivative of a float or long sum or difference calculation so there is always room for error. I recommend you do a standard si5351 calibration first to get your PLL clock compensation right, the NT7S lib has a script in examples to make this easy.

      You may need some more answers to get my code to work for you, I didn’t tidy it up for wide adoption. Just ask here.

      73 Paul VK3HN.

      Like

      • Adrian Rees says:

        Hi Paul
        I have been working on the code, at this time just to get it to compile and upload to the Nano. I have rectified the write() to digitalWrite() issue and have now run ito the following:
        conflicting declaration ‘typedef struct VFOset_type VFOset_type’
        When compiling the SP_VFO_initialiser sketch.
        I am using a Win 7PC and the Arduino IDE v 1.8.10
        Could you explain how you compile the sketches ? Seperately or all together ?
        Sorry but I don’t have a lot of experience in software…!
        Thanks
        Adrian

        Like

      • Paul Taylor says:

        Hi Adrian, thanks for trying my code. The struct that appears to be giving trouble is the same in both scripts. Do you get the same error with the main script?

        Like

      • Adrian Rees says:

        Hi Paul
        Thanks for the reply.

        When I try to compile the main script the process stops with the above error, and in the SP_VFO_Initialiser tabbed page. The seems to occur on line16 of that .ino and that line states:

        } VFOset_type;

        I have selected the shack sloth definition, #define SS_EI9GQ //, as that particular variant is closest to what I have in mind. Does that help ?

        If I can get the code to compile, I can then hack it around to get to what I need.

        Adrian

        Like

      • Paul Taylor says:

        Send me the exact compiler error text.

        Like

      • Adrian Rees says:

        Hi Paul
        Can you send me an email to my email address and I’ll send you the whole file. Its a bit big to post here….
        My email address is ###############
        Adrian

        Like

  10. win says:

    hi Paul
    from github: prt459 Update SP_VFO_Controller, try to compile, and found:

    SP_VFO_Initialiser:16:3: error: conflicting declaration ‘typedef struct VFOset_type VFOset_type’

    } VFOset_type;

    ^

    D:\WIN TITIP\SSB\si5351 prt459\Arduino_si5351_VFO_Controller_Keyer-master\SP_VFO_Controller_Keyer\SP_VFO_Controller_Keyer.ino:556:3: note: previous declaration as ‘typedef struct VFOset_type VFOset_type’

    } VFOset_type;

    ^

    SP_VFO_Initialiser:18:28: error: conflicting declaration ‘VFOset_type VFOSet [10]’

    VFOset_type VFOSet[NBR_VFOS]; // array of band parameter sets

    ^

    D:\WIN TITIP\SSB\si5351 prt459\Arduino_si5351_VFO_Controller_Keyer-master\SP_VFO_Controller_Keyer\SP_VFO_Controller_Keyer.ino:558:13: note: previous declaration as ‘VFOset_type VFOSet [4]’

    VFOset_type VFOSet[NBR_VFOS]; // array of band parameter sets

    ^

    SP_VFO_Initialiser:19:6: error: redefinition of ‘byte v’

    byte v; // index into VFOSet array (representing the current VFO)

    ^

    D:\WIN TITIP\SSB\si5351 prt459\Arduino_si5351_VFO_Controller_Keyer-master\SP_VFO_Controller_Keyer\SP_VFO_Controller_Keyer.ino:559:6: note: ‘byte v’ previously declared here

    byte v; // index into VFOSet array (representing the current VFO)

    ^

    D:\WIN TITIP\SSB\si5351 prt459\Arduino_si5351_VFO_Controller_Keyer-master\SP_VFO_Controller_Keyer\SP_VFO_Initialiser.ino: In function ‘void setup()’:

    SP_VFO_Initialiser:24:6: error: redefinition of ‘void setup()’

    void setup(){

    ^

    D:\WIN TITIP\SSB\si5351 prt459\Arduino_si5351_VFO_Controller_Keyer-master\SP_VFO_Controller_Keyer\SP_VFO_Controller_Keyer.ino:1908:6: note: ‘void setup()’ previously defined here

    void setup()

    ^

    D:\WIN TITIP\SSB\si5351 prt459\Arduino_si5351_VFO_Controller_Keyer-master\SP_VFO_Controller_Keyer\SP_VFO_Initialiser.ino: In function ‘void loop()’:

    SP_VFO_Initialiser:81:6: error: redefinition of ‘void loop()’

    void loop()

    ^

    D:\WIN TITIP\SSB\si5351 prt459\Arduino_si5351_VFO_Controller_Keyer-master\SP_VFO_Controller_Keyer\SP_VFO_Controller_Keyer.ino:2346:6: note: ‘void loop()’ previously defined here

    void loop()

    ^

    Multiple libraries were found for “si5351.h”
    Used: C:\Users\elektro\Documents\Arduino\libraries\si5351
    Not used: C:\Users\elektro\Documents\Arduino\libraries\Si5351Arduino-master
    Not used: C:\Users\elektro\Documents\Arduino\libraries\Etherkit_Si5351-2.1.4
    exit status 1
    conflicting declaration ‘typedef struct VFOset_type VFOset_type’

    thanks

    Like

  11. win says:

    thanks for ypur reply. IDE Arduino 1.8.9

    Like

  12. Adrian says:

    Hi Paul. I have IDE Version 1.8.13 and all compile fine with that version. Strangely enough the RTCLIb is giving me a few headaches though. I set the time, but when I re-boot the power the clock restarts at the time it was set originally…..weird. Thanks for great code though!

    Like

  13. Anonymous says:

    code error ………..

    ‘typedef struct VFOset_type VFOset_type’

    Like

  14. Dan Minciu says:

    HI! Paul…
    It’s a long time I’m not writing to you…
    Meanwhile I do a little conversion of the code to comply with C++ standards(separate declarations and definitions in .h/.cpp files, testing and testing and …), learning usage of VisualSourceCode & Platformio wich (IMHO) has a better editor/highlighting than ArduinoIDE…
    But… It’s time to ask some things about analog part of “my rig”…well …my future rig:
    I saw two type of quartz: a small one, with height about 3-4mm and a tall one with height about 12-13mm. Wich one do you recommend for a ladder IF filter?
    Another quiestion is about value of IF: I can buy cristals with 5.00MHz and 9.216MHz. Wich one do you recommend. I saw at SP7 you use 5,12MHz for IF…
    In the end… if you consider that this place is not appropriate for this kind of talks, can you indicate an e-mail address where we can “chat”? Mine is minciu.dan -at- gmail.com

    Like

    • Paul Taylor says:

      Hello Dan,
      Happy that you are coding, and settling into your preferred IDE. It is OK to run discussions on this blog, it makes our conversation public so others may like to follow along or add their thoughts.

      I’ve used the HC49 crystals (tall, leaded), miniature flat (5mm high, leaded) and the same size but with surface mount pads in various homebrew crystal filters, and have found no noticeable difference. Most of the kit radios now use the miniature form, leaded or SMT. Minikits has a 9MHz crystal filter kit with matched miniature SMT crystals, in SSB, AM and CW bandwidths. If you haven’t seen it yet, Nick M0NTV has a good video on making these filters, and there are lots of others.

      On choosing a good frequency for an IF, I’ve used 4, 4.915, 8, 9, and 12MHz, all with good results. In SP7 I used a Hamfest PCB SSB IF board, with a (Collins maybe?) 5.12MHz crystal filter. It is an unusual IF but the filter was a good one, and if you use a synthesized BFO the IF doesn’t matter much.

      4.915MHz is widely chosen by many leading radio designers. The crystals are widely available and I can only assume that this frequency has proven to be free of in band spurs. If I was buying crystals rather than using ones on hand, I would choose this frequency.

      One thing to be aware of. Crystals are harder to pull at lower frequencies. If you choose a crystal BFO, you may have to work a bit harder to pull your BFO crystal either side of your filter’s centre frequency. A dual-crystal super-VXO will help here. If you are going to use a digital BFO, such as a si5351 PLL, no issue!

      Good luck and keep me up to date with your project progress. Paul VK3HN.

      Liked by 1 person

      • Dan Minciu says:

        Hi Paul!…
        Thank you for the reply. Sooo quick… 🙂
        Indeed I saw the filter in SP7, but … it’s prohibited for me(you know… my lady doesn’t comply with my…passion).
        But… Show must go on. So today I will order the crystals, 4,915MHz will be the chosen ones… VFO, BFO will be of coarse, digital, from SI5351.
        And yes, these days I will finish the communication between Arduino and … Arduino(first one provide automation on TRx and second one Morse decoding and… I/O multiplexers…yes, I replace in my concept PCF8574 with D4-D13 from second arduino…)

        Like

      • Paul Taylor says:

        A good plan for your next steps Dan, keep me informed.

        Like

      • Dan Minciu says:

        Hi Paul!
        If I may ask a question(a newbie silly question):
        Today I become the happy owner of several 18650 cells…

        For a /P battery pack, used for SP7 you make 4 or 3 cells in series?
        I can do a 3 cells in series with 6 elements in parallel wich can give me a huge 12Ah at 3xlaptop battery size.
        This can be arranged on top of my rig’s case, increasing it’s height with 15-20mm…
        If it will be necessary to make 4 cells in series, I’ll try to get another 4 cells to put in parallel…
        73!…Dan

        Like

      • Paul Taylor says:

        Hi again,
        look at the charged voltage of 3 and 4 18650 cells, 11.1 volts and 16 volts. See https://blog.ampow.com/lipo-voltage-chart/

        I’ve used both. 4S is a good way of getting a bit more power out of an IRF510 FET PA, but it doesn’t make as much difference with the RD16HHF1 PAs. Running your receiver at 16 volts also significantly increases the audio power amplifier gain. Make sure these devices,are on a heatsink.
        Recently I’ve used three BS170s in parallel in CW rigs, as is done by most QRP CW only rigs these days. These will get very hot on a 16v supply, and may fail.
        If you choose 4S, I would include 12v regulators on most of the modules to stabilise them, particularly high gain stages like IF amps.
        I run SP7 on a 4S pack.
        Don’t forget the balance harness to allow a balanced charge, and don’t short anything!!!
        73 Paul VK3HN

        Like

      • Dan Minciu says:

        Hi Paul,
        Of coarse, I will use an stabiliser at 12V, my concern is about that 4-8W wasted on a linear stabiliser… that’s why I’m thinkig to use only 3S… But 3 cells goes down at 8V when cells must be stopped(3×2,7V from datasheet…) ths is a big difference…even 9V it seems big for me… how operate IF, RF stages at so much variation?
        Ided I’ll use an BMS to assist charging/discharging my battery. I already have 3S BMS from… China. If it’s mandatory I’ll move to 4S with all that’s necessary(BMS, 230/19V PSU, 24 cells in battery)

        Like

      • Paul Taylor says:

        Dan,
        You can avoid the 3S low voltage problem just by having two 3S packs and a little inline battery voltage monitor. When the first 3S pack starts to sag, swap in the fresh one. I think that 10 volts is about the lowest I would want to drop to on my homebrew receivers, below that, IF and audio gains drop too far.

        Like

  15. Dan Minciu says:

    Hi, Paul…
    It’s been a long time since I didn’t show you my rig’s “evolution”…if you can access FaceBook, I post some pic’s of it. This is the address:

    https://www.facebook.com/media/set/?vanity=DanVintageAudio&set=a.2051360845041648

    So, at that moment, the digital VFO/BFO with Ardu & SI5351 is functional, also the Morse decoder+LPF/BPF selector via second Arduino, communication via I2C between them….
    I’m working on saving the received/decoded message from second Ardu into first because only first one write on display.
    About the analogic side of my TRx, i’m waiting for MC1496 and SA612 then I’ll proceed to FI +mixers.
    Audio side of it is done: TDA2003 for speaker amplifier, TL082 for microphone amplifier.

    Like

    • Paul Taylor says:

      That looks really good Dan! Well done, a fine job. Did you have to make much changes to my display function to use your LCD I2C backpack? I hope the analog parts of your rig come together easily. Certainly having the VFO on any band you choose and the BFOs done makes building a superhet a lot easier. Keep going, and keep sharing your progress, 73 Paul VK3HN.

      Liked by 1 person

      • Dan Minciu says:

        No… I just..
        #define I2C_LCD_ADAPTER 0x25 //27 default I2C address of the LCD display

        //#define UNIVERSAL_VFO_CONTROLLER // Universal VFO Controller (22/9/2021)
        #define UNIVERSAL_VFO_CONTROLLER_DANM

        then i do…

        // common #define’s that precede other declarations
        #ifndef UNIVERSAL_VFO_CONTROLLER_DANM
        #define LCD_RS 8 // Register Select is LCD pin 4
        #define LCD_E 9 // Enable/clock LCD pin 6
        #define LCD_D4 10 // LCD D4
        #define LCD_D5 11 // LCD D5
        #define LCD_D6 12 // LCD D6
        #define LCD_D7 13 // LCD D7
        #endif

        and in the trx definition block I do …
        #ifdef UNIVERSAL_VFO_CONTROLLER_DANM // Universal VFO Controller 23/9/2021
        #define ENCODER_MECHANICAL
        #define BFO_ENABLED
        #define BFO_TUNE_LO 5100000ULL // lowest BFO frequency
        #define BFO_TUNE_HI 5130000ULL // highest BFO frequency

        volatile uint32_t USB = 5120000ULL; // the reference BFO freq for USB, may be tuned, put in EEPROM once
        volatile uint32_t LSB = 5116000ULL; // the reference BFO freq for LSB, may be tuned, put in EEPROM once
        #define DISPLAY_LCD
        #define LCD_16X2
        #define lcd_columns 16
        int lcd_rows = 2;
        #include “LiquidCrystal_I2C.h”
        LiquidCrystal_I2C lcd(I2C_LCD_ADAPTER,lcd_columns,lcd_rows); //sometimes the adress at I2C_LCD_ADAPTER is not 0x3f. Change to 0x27 if it doesn’t work.
        #define NBR_VFOS 10 // number of selectable VFOs
        #define CW_KEYER // include the CW keyer code
        #define CW_DECODER // uses CW Decoder (MORSE to ASCII decoder)
        #define CLICKS_PER_STEP 4 // this number depends on your rotary encoder
        // #define CO_DC_SUPPLY A7 // this pin controls a high side DC switch to enable the carrier oscillator when keyed
        #endif
        As you can see, I add one more variable, to keep track of CW decoder…
        and it’s useful another one wich knows if the second arduino do the LPF/BPF command lines. Well the actual software is on my home PC, I am at work and the copy here is a little obsolete…
        If you consider, I can send you my current version of software… after my job let me free… that means after 18:00 EET.

        Like

  16. Dan Minciu says:

    Well… I forgot to say that I try and did a small conversion to C++ standards, wich means create a file .h containing all definitions and a file .cpp with declarations and the setup() and loop() functions.
    The library LiquidCrystal_I2C is from google, I don’t remember exact address but it’s esy to find.
    About the editor, I cancelled usage of ArduinoIDE because of his primitive and ugly editor and moved to VisualSourceCode and PlatformIO… It’s more closer to 2022…As design, options, tools…
    73! Dan

    Like

    • Paul Taylor says:

      Ok on your use of a better IDE. Have you thought if a faster, better microcontroller, say a RPi Pico, or the ESP8266 family? I’m not interested in WiFi access, however, a faster MCU and lots of memory could be advantageous. A dual thread MCU could run the controller and your CW decoder concurrently. And that’s before we even think about basic SDRs like the uSDX!

      Like

      • Dan Minciu says:

        Yes, I try using ESP8266 wich is faster(160MHz clock), but at that time I was stuck in lacking analog pins, I try to use another PCF8574 to make digital pins for all buttons(rear, front, keyer, encoder push…) but is a little tricky reading from pcf…
        So I abandoned the idea and return to Ardu, just to see my receiver ready ASAP, because in april will be another exam where I hope I get my callsign and become full radio amateur…

        After that my intention is to move all functions to RPi… it’s a better approach, RPi having an operating system(linux…) and capabilities of multithreading, multitasking. There are two of my colleagues at work wich are better C++/C# programmers who will help me in this quest.. 🙂
        But as I said before, small steps…
        There are a lot of things to remember, to learn even in the RF/IF area…since ’90 I moved to software development and all the knowledge in electronics goes in a corner of my memory…
        Speaking of RPi and SDR… all I canfind on internet is about controlling industrial TRx via tem included ports. Nothing about controlling basic functions. That’ s why I said it will be a lot to learn…

        Like

      • Paul Taylor says:

        Dan,
        thanks for your detailed reply, very interesting. We homebrew radio builders are somewhat stuck in Arduino land. They have been brilliant servants as controllers but Nano and Uno are hopelessly out of date now. I am not sure why we have not made more progress with faster and better MCUs. For myself, I prefer to spend my building time on radio hardware, not software. At least not the next generation of software, yet.
        I have considered replacing Arduino with ESP8266, Blue Pill, RPi Pico and others, but familiarity and proven libraries keep me on the old hardware.
        I am interested in a baseband SDR architecture with a conventional direct conversion mixing front end into IQ channels for software back end. Like Farhan’s digital Bitx project. For me, RPi 4 is too big and power hungry, I can’t run that SBC on batteries. RPi Pico has enough compute speed and a 12 bit 500kSps A2D. Surely we can do something worth trying with this.
        Good luck with your excellent project and your upcoming exam. Let me know your callsign when you get it!
        73 Paul VK3HN.

        Like

  17. Adrian says:

    Hi Paul
    Just returning to my long running project using your VFO.
    I am using an optical encoder with a 20×4 display, the EI9GQ option in the script.
    All compiles & uploads great, with no issues. Even the clock is now working for me.

    However the Optical encoder does not work…

    I compile & upload the initialiser script, then compile & upload the main script.
    I have checked the circuit on a number of occasions and that is all correct. I have swapped out another Nano and tested the optical encoder with an oscilloscope. All good.

    The annoying thing is, I have had it all working in the past !!

    I seem to recall that all of circuitry had to be present in order for the encoder to work, is that correct? IE all the buttons, a 4.7K resistor etc. The optical encoder is connected to Digital 2 & 3 on the nano ? Do you happen to have a circuit diagram of your EI9GQ VFO ? That would be helpful.

    Thanks
    73

    Like

    • Paul Taylor says:

      Hi Adrian, good to hear from you. No, the encoder and various pushbuttons, keyer etc all work independently. So it was working, but now it isn’t? I’ll have a think about that and comment tomorrow. One initial thought is that the encoder is locked in transmit mode. So if your rig comes up sensing the PTT as low then the dial will not work. But you would know that, because the display says ‘Tx ‘ instead of ‘Rx’ on the 2nd line. More soon. PT.

      Liked by 1 person

      • Adrian says:

        Hi Paul
        The PTT sense works fine, in as much as it switches the display from RX to TX & back again. When in TX mode the S meter stops flickering so I assume that is correct.
        Its really strange. I have rebuilt the whole VFO again on a bread board, and again no VFO.

        I am going to test the Optical encoder with a separate UNO I have as well as with my scope (again). I’ll also try a mechanical encoder as this may also help identify something if it isn’t working..

        My Project is a HF TX/RX with 9MHz IF covering HF using the Hybrid Cascode IF Amplifier by Wes Hayward (W7ZOI) and Jeff Damm (WA7MLH) from the December 2007 edition of QST. Separate TX & RX chain

        Thanks for your prompt reply.

        Like

      • Paul Taylor says:

        Adrian, if you have another optical encoder or a mechanical one, swap it in and try it. More questions:
        – did you use my schematic? (You must have, to use my script)
        – what encoder are you using?
        – do you have 10k pull ups on the encoder data lines?

        Like

      • Adrian says:

        Hi Paul
        I don’t have another optical encoder, however with another Arduino script used just to test it, it works great. I’ll try a mechanical encoder today, as well as the 10K pull ups. Can you point me to your schematic please, I cannot seem to find it, and have based my assembly on the Raduino, which your script says you target…I assume you mean it it is the same electronic circuit ?

        Thanks Paul, I appreciate your help.

        BR

        Like

      • Paul Taylor says:

        Adrian, yes, all my digital VFOs are wired to the Raduino schematic. My schematic is here:

        Click to access ssdrap203-page3.pdf

        Or here:

        Click to access sp8-page3.pdf

        Or here:

        Click to access sp9-p3.pdf

        None of these schematics show 10k pull ups and I am fairly sure (without checking the code) that I apply innternal input pull ups on D2 and D3. But something tells me that when I was playing with my Universal VFO Controller one of the fellow alpha testers had to add resistor pullups:

        Click to access vk3hn_universal_vfo_controller_v1.1-1.pdf

        It’s all a bit of honest clean fun, right?

        73 Paul VK3HN.

        Like

      • Adrian says:

        Success !
        Adding the 10K pull ups worked.
        The encoder I am using is a LPD3806-400BM-G5-24C so a not a 360 rotator. It works great with the 10K’s.
        I’ll send you some photo’s of the new radio….
        Thanks very much for the tip.

        Like

      • Paul Taylor says:

        Good news Adrian, I will add them to my schematics, should have done that a while back. It sure looks like the same one as I use. I have been buying mine from Minikits, but they are freely available from the usual platforms.

        https://www.minikits.com.au/components/electromechanical/rotary-encoders/ENC-360-6

        Please do email me some project pics, I will add them to my gallery. Email available on QRZ.com once you login.

        More soon. Paul.

        Like

Leave a comment