Language: 
To browser these website, it's necessary to store cookies on your computer.
The cookies contain no personal information, they are required for program control.
  the storage of cookies while browsing this website, on Login and Register.

GDPR and DSGVO law

Storing Cookies (See : http://ec.europa.eu/ipg/basics/legal/cookies/index_en.htm ) help us to bring you our services at overunity.com . If you use this website and our services you declare yourself okay with using cookies .More Infos here:
https://overunity.com/5553/privacy-policy/
If you do not agree with storing cookies, please LEAVE this website now. From the 25th of May 2018, every existing user has to accept the GDPR agreement at first login. If a user is unwilling to accept the GDPR, he should email us and request to erase his account. Many thanks for your understanding.
Amazon Warehouse Deals ! Now even more Deep Discounts ! Check out these great prices on slightly used or just opened once only items.I always buy my gadgets via these great Warehouse deals ! Highly recommended ! Many thanks for supporting OverUnity.com this way.

User Menu

Tesla Paper

Free Energy Book

Get paid

Donations

Please Donate for the Forum.
Many thanks.
Regards, Stefan.(Admin)

A-Ads

Powerbox

Smartbox

3D Solar

3D Solar Panels

DC2DC converter

Micro JouleThief

FireMatch

FireMatch

CCKnife

CCKnife

CCTool

CCTool

Magpi Magazine

Magpi Magazine Free Rasberry Pi Magazine

Battery Recondition

Battery Recondition

Arduino

Ultracaps

YT Subscribe

Gravity Machines

Tesla-Ebook

Magnet Secrets

Lindemann Video

Navigation

Products

Products

WaterMotor kit

Statistics


  • *Total Posts: 523432
  • *Total Topics: 15585
  • *Online Today: 44
  • *Most Online: 103
(December 19, 2006, 11:27:19 PM)
  • *Users: 2
  • *Guests: 6
  • *Total: 8

Author Topic: Arduino experience, someone?  (Read 1727 times)

Offline antimony

  • Sr. Member
  • ****
  • Posts: 265
Arduino experience, someone?
« on: September 13, 2020, 06:37:45 AM »
Hi guys. I hope that someone could help me with some insight in Arduino programming.

I am trying to make a Arduino VFO with the Si5351s and a Arduino Nano and i have ran into some trouble, so i just wanted to ask if someone have experience working with Arduino, and/or have made one of these Variable Frequency Oscillators ever?

Thanks in advance.

Ps. OU forum really should have an microcontroller section of the forum.

Thanks again.

Free Energy | searching for free energy and discussing free energy

Arduino experience, someone?
« on: September 13, 2020, 06:37:45 AM »

Offline EMJunkie

  • Hero Member
  • *****
  • Posts: 3316
Re: Arduino experience, someone?
« Reply #1 on: September 13, 2020, 08:26:01 AM »



Hey Antimony,

I have a section dedicated for Microcontrollers and some pretty fancy projects for PWM: http://www.aboveunity.com/cat/microcontrollers/

What exactly are you after, your post is not really specific enough to give a dedicated answer. If PWM is what your'e looking for, then this code here may be of some use: http://www.aboveunity.com/thread/microcontroller-pwm-cheap-and-easy-start-to-getting-something-working/

What Frequency's are you looking at? Precision at High Frequency's may be a problem is all!

Best wishes, stay safe and well in these dire times,
   Chris Sykes

Offline onepower

  • Hero Member
  • *****
  • Posts: 553
Re: Arduino experience, someone?
« Reply #2 on: September 13, 2020, 09:30:40 PM »
antimony

Quote
I am trying to make a Arduino VFO with the Si5351s and a Arduino Nano and i have ran into some trouble, so i just wanted to ask if someone have experience working with Arduino, and/or have made one of these Variable Frequency Oscillators ever?

The pwm is set at something like 418 Hz so my quick and dirty method is to set up a dual delay. For example...

int output = 13; // output connected to digital pin 13
int t = 0;//timing variable
void setup()
{
  pinMode(output, OUTPUT); // sets the digital pin as output
}

void loop()
{
  digitalWrite(output, HIGH);   // output on
  delay(1000);                  // 1000 = 1 second, 1 = 1 millisecond, this is the pulse width or base frequency
  digitalWrite(output, LOW);    // output off
 
t = (t + 1);//counts the loops
If (t > 500){
delay(1000);//this is the second delay function turning off the base frequency for 1 second
t = 0;// resets t to zero and starts counting to 500 again
}     // counts the loops or pulses to 500 then delays 1 second, this is the delay between the base timing pulses,......delay.....delay

}//repeat loop


If we wanted to vary the frequency over time we can use a variable like "t" counting the loops to vary the base frequency up or down using "if" statements. If you want more variables they must be declared using "int (variable) = 0; before the loop as shown above.
So we take our output control and add a variable to modify the delay between pulses changing the base frequency.


digitalWrite(output, HIGH);   // output on
  delay(t);                  // "t" is now the pulse width or base frequency starting at zero and adding 1 to the delay on each loop
  digitalWrite(output, LOW);    // output off

"t" changes in this line, "t = (t + 1);//counts the loops" and you can add any math to make it do what you want. You must also declare a starting point for "t" in the initial setup. So you say something like "int t = 200;" instead of zero and it counts from 200 to 500 then you reset t to 200 instead of zero after its done counting. There are easier and faster ways to do this however I like simple programming so we can see and understand how the logic plays out.

Regards

Free Energy | searching for free energy and discussing free energy

Re: Arduino experience, someone?
« Reply #2 on: September 13, 2020, 09:30:40 PM »
Sponsored links:




Offline EMJunkie

  • Hero Member
  • *****
  • Posts: 3316
Re: Arduino experience, someone?
« Reply #3 on: September 13, 2020, 10:18:53 PM »







Onepowers method will work, but beware, it can be very in-accurate having milliseconds in inaccuracies! If you want accuracy of the Frequency and Duty Cycle, using a System Timer, and the more bits (8, 10, 12, 16, 32 or what ever) the more accurate and better resolution, the better.

Best wishes, stay safe and well in these dire times,
   Chris Sykes

Offline onepower

  • Hero Member
  • *****
  • Posts: 553
Re: Arduino experience, someone?
« Reply #4 on: September 14, 2020, 04:54:39 PM »
EMJ
Quote
Onepowers method will work, but beware, it can be very in-accurate having milliseconds in inaccuracies! If you want accuracy of the Frequency and Duty Cycle, using a System Timer, and the more bits (8, 10, 12, 16, 32 or what ever) the more accurate and better resolution, the better.

Yes it is a little sketchy and dependent on how fast the code runs or loop time. I was using it to generate time function/signals my signal generator couldn't handle. Arduino's like the nano are also cheap when working around high voltage which could smoke our equipment. Hell, at $5 a pop the nano is not much more expensive than a good Mosfet.

Working on RF linked datalogging voltage/current sensors recently using the 433 Mhz FS1000A TX/RX. I picked up 2 TX/RX modules for $6 on ebay a year or so ago and they got some range, out past 100 meters. Built something cool right out of a sci-fi movie, I built a 16" spike I can just stick in the ground anywhere I want. It has 4 hacked IR motion sensing shields on the top end pointing N,S,E,W and an RF TX which transmits the direction and direction of motion of any IR signature to my RX. Kind of like a small, portable IR radar spike to detect motion like in the "predator" movies, lol.

Thought I would use it for camping to set up a motion sensing perimeter around my campsite or on the acreage for uninvited visitors. What the Arduino offers is much more than what most people do with it. We need to start thinking "embedded intelligence" in all our projects as if the device could think for itself and make intelligent choices.

For example, a few years ago I drilled a couple of my own DIY water wells and wanted a pump level controller for my horse waterer in my pasture. So I built an Arduino capacitance based level controller using a SSR to control the pump. Easy enough, however I also added an LED trouble light to tell me if the pump was activated but the water level was not rising or maintaining it's level. It also controls the water heater in winter using a thermistor circuit tied to the trouble light and the capacitance probe monitors the water TDS for water quality. So rather than drop $150 on a simple relay/float based pump control I spent $40 and built a state of the art horse waterer. It works like a damn and it's been running for over 5 years with no problems to date.

So we should understand the Arduino is not a toy as many think and can make our lives much easier because we are only limited by our imagination. I have been embedding intelligence in everything around me for years and it's pretty cool stuff.

Regards


Free Energy | searching for free energy and discussing free energy

Re: Arduino experience, someone?
« Reply #4 on: September 14, 2020, 04:54:39 PM »
Sponsored links:




Offline antimony

  • Sr. Member
  • ****
  • Posts: 265
Re: Arduino experience, someone?
« Reply #5 on: September 15, 2020, 01:44:01 PM »
Thanks for taking your time to reply to my post, onepowet and Chris. I am a (early) member of AU, but i havent been there for a long time.
I am not going to make a PWM controller unit at the moment, but i am trying to get myself firmiliar with radio "homebrewing".
I am making a Variable Frequency Oscillator, like these for example:
https://www.google.com/amp/s/aa7ee.wordpress.com/2018/05/11/yup-its-another-si5351-vfo/amp/

http://www.n6qw.com/Arduino_Nano_Si5351.html

I was reading Eric Dollards book on his "Crystal Radio Initiative" and the basic idea of the book reminded me of Dr Stifflers SEC's, and that got me interested in radio, and wanted to learn more, and what better way to learn then to make it yourself.

Have you guys any experience with this sort of thing?

I need to combine three (3) different "sketches" into one, or modify an existing one, but with a display like mine (OLED) instead of LCD.


Offline onepower

  • Hero Member
  • *****
  • Posts: 553
Re: Arduino experience, someone?
« Reply #6 on: September 15, 2020, 05:19:35 PM »
Antimony
Quote
I was reading Eric Dollards book on his "Crystal Radio Initiative" and the basic idea of the book reminded me of Dr Stifflers SEC's, and that got me interested in radio, and wanted to learn more, and what better way to learn then to make it yourself.

Have you guys any experience with this sort of thing?

I have built many crystal radio's and I have the first version of Dr Stifflers SEC on a shelf above my bench. I had a few conversations with Dr Stiffler regarding open circuit topology and switching, he was a good man.

I also like experimenting with this kind stuff because it's cheap and easy with a steep learning curve. When I was young, before I got into all this FE stuff I noticed my crystal radio's would become supercharged when a thunder storm was approaching. Later I learned it was because the Earth/ground potential normally at 100v/m can increase by a thousand times. Here is Feynman's description of what happens during a thunderstorm...

https://www.feynmanlectures.caltech.edu/II_09.html#:~:text=The%20distribution%20of%20electrical%20charges%20in%20a%20mature%20thunderstorm%20cell.&text=The%20charge%20at%20the%20bottom,ground%20in%20a%20clear%20atmosphere.

If you can describe what you want to do and post some code we could probably help out.

Regards

Free Energy | searching for free energy and discussing free energy

Re: Arduino experience, someone?
« Reply #6 on: September 15, 2020, 05:19:35 PM »
Sponsored links:




Offline onepower

  • Hero Member
  • *****
  • Posts: 553
Re: Arduino experience, someone?
« Reply #7 on: September 16, 2020, 01:13:23 AM »
bump in the night


Offline cheors

  • Jr. Member
  • **
  • Posts: 87
Re: Arduino experience, someone?
« Reply #8 on: September 16, 2020, 11:15:52 PM »
You should use the PWM function to get a stable frequency :

For 418 Hz :

/* * Create  29/07/2016 (CHEORS)
 * Processor: ATmega328P
 * Compiler:  Arduino AVR

timer1 est un 16 bits
 */
 
void setup()
{
 pinMode(9, OUTPUT);
 pinMode(10, OUTPUT);
 
//16 bits timer
  TCCR1A = _BV(COM1A1) | _BV(COM1B0)| _BV(COM1B1) ; // Sorties complĂ©mentaires sur D9 et D10
  TCCR1B = _BV(CS10) | _BV(WGM13); //PWM, Phase and Frequency Correct, prescaler = 1

  ICR1 = 19139; // choix de la frĂ©quence (2 < ICR1 < 65535, 16 bits)
}// Periode = 0,125 x ICR1 en microseconds (exemple F =418 Hz)
     
void loop()
{
 OCR1A = ICR1 / 2; // Duty cycle D9 (1 <OCR1A < ICR1 - 1)
 OCR1B = OCR1A; // Duty cycle  D10 (1 <OCR1B < ICR1 - 1)
// Here you can change the frequency with ICR1 and the duty cycle with OCR1A , OCR1B
}

Free Energy | searching for free energy and discussing free energy

Re: Arduino experience, someone?
« Reply #8 on: September 16, 2020, 11:15:52 PM »
3D Solar Panels

Offline onepower

  • Hero Member
  • *****
  • Posts: 553
Re: Arduino experience, someone?
« Reply #9 on: September 16, 2020, 11:43:49 PM »
cheors
Quote
You should use the PWM function to get a stable frequency :

PWM does not work well when generating or receiving radio frequencies other than PWM data because a radio signal is generally a sine wave not PWM. 

Note the PWM signal below, does that look anything like a sine wave?. So while a PWM signal could vary with time and invert periodically to produce a pseudo-sine wave it's just a very poor way of doing things. Antimony mentioned the better option which is to used a dedicated RF chip to manage AM/FM signal processing and modulation.

Regards

Offline EMJunkie

  • Hero Member
  • *****
  • Posts: 3316
Re: Arduino experience, someone?
« Reply #10 on: September 17, 2020, 12:03:20 AM »
cheors
Quote
You should use the PWM function to get a stable frequency :

PWM does not work well when generating or receiving radio frequencies other than PWM data because a radio signal is generally a sine wave not PWM. 

Note the PWM signal below, does that look anything like a sine wave?. So while a PWM signal could vary with time and invert periodically to produce a pseudo-sine wave it's just a very poor way of doing things. Antimony mentioned the better option which is to used a dedicated RF chip to manage AM/FM signal processing and modulation.

Regards







onepower is completely wrong!

Digital Radio Signals are the NORM today! See attached image.

onepower is very clearly very far behind on technology! Beware of his advice as it is not true and not correct!

This is terrible information please research what people say and cross reference all information!

Best wishes, stay safe and well in these dire times,
   Chris Sykes

Free Energy | searching for free energy and discussing free energy

Re: Arduino experience, someone?
« Reply #10 on: September 17, 2020, 12:03:20 AM »
3D Solar Panels

Offline onepower

  • Hero Member
  • *****
  • Posts: 553
Re: Arduino experience, someone?
« Reply #11 on: September 17, 2020, 01:58:45 AM »
Chris
Quote
onepower is completely wrong!
Digital Radio Signals are the NORM today! See attached image.
onepower is very clearly very far behind on technology! Beware of his advice as it is not true and not correct!
This is terrible information please research what people say and cross reference all information!

Oh dear, I'm not even sure how to respond to that, lol.

First the only literature I could find on all digital radio technology was science research papers from 2018-2019 so yes I may be a year behind cutting edge technology, not the first time. To date the only practical PWM sine wave generators I knew of were used in low frequency 60 Hz power inverter technology. However to my knowledge all digital radio's still use an analog signal generator as the carrier regardless of whether the modulation is AM, FM or Digital.

Second digital radio's still use an analog sine wave as the carrier signal and the digital part simply means sending binary code(one's and zero's) or numbers to represent the information just like a computer does not PWM. Digital; "expressed as series of the digits 0 and 1, typically represented by values of a physical quantity such as voltage or magnetic polarization." So digital doesn't mean PWM it means binary information (1 and 0). Hell, I was building this stuff yesterday using an two Arduino Uno's to send/receive digital information and my analog 433MHz TX/RX as the interface between them.

Do you always need to be such a drama queen Chris?, I mean really?. You seem like a smart guy then you pull this shit and come off sounding like a complete loser, your better than this in my opinion.

To ramble a bit, I actually thought of a Pulse Width Modulated pseudo-sine wave carrier signal years ago however the problem is bandwidth and time. It works like this, if my digital carrier is frequency X and I use a digital modulation of Y then obviously the resolution in bits per second of Y cannot be greater than X. Basically there is only so much information we can cram into a finite period of time. Thus the binary on/off nature of the carrier X starts eating into our allowable time for our binary information Y which is our limitation. Simply put, the PWM would have to be oscillating in the mid to upper GigaHertz range to make it a practical proposition which gets expensive and it's generally unstable.

Look at your router frequency of 2.4 GHz or the relatively new 5 GHz which apparently uses a 39 GHz oscillator... 39 billion cycles per second with a wavelength of 7.6 mm. Now imagine you want to generate a stable digital carrier frequency which needs to be magnitudes larger into let's say the low end like 100 GHz or 3 mm. You see were almost out of the RF band and into the microwave/infrared band of the EM spectrum. At which point the whole nature of the technology would need to change and were just not there yet.

Regards







Offline antimony

  • Sr. Member
  • ****
  • Posts: 265
Re: Arduino experience, someone?
« Reply #12 on: September 17, 2020, 11:45:14 AM »
I am really thankful for you guys taking your time to post in my thread, trying to help me out.

I have such a limited free time to do this stuff, but i always try to pay it forward all the help or consultation i have gotten from OU and all the other electronics forums i have been and am a part of when i can to help others, so i am really grateful.

I found this code yesterday when i was cruising google and this is probably the closest to what i need that i have found.
Here is the link.
http://www.n6qw.com/LCD_to_OLED.txt

And here is the code:

/*
  07/2017 From N6QW
 This sketch is being used with a new transceiver build using a 4.9152 MHz HB Filter and a 1/2 OLED display.
 The rig is called the Mini-Rig and is a 5 watt SSB Transceiver. Because of the use of the  TUF-1 set drive level to 8 MA
 
 It will operate with the 1" OLED or the 1/2" OLED with no code changes.
 
 Modified 7/2018 to operate with the dual VFO code
 Modified to have two VFO's, Tune Function and CW ID

 This is an upgrade to the Junk Box Rig
 NOTE TO Builders -- you have to have the Rotary Files and the Si5351 File snad the Tone.h in the same folder as the sketch
 These are included files -- so just loading the skecth in to an IDE will not make this play
 
 
 */
 
    #include <SPI.h>
    #include <Wire.h>
    #include "si5351.h"
    #include "Rotary.h"
    #include <Adafruit_GFX.h>
    #include <Adafruit_SSD1306.h>
    #define OLED_RESET 4
    Adafruit_SSD1306 display(OLED_RESET);
    #include "Tone.h"
    #define TONE_PIN 6
    #define NOTE_B5  988
   
    #define ENCODER_B    2                     // Encoder pin A
    #define ENCODER_A    3                    // Encoder pin B
    #define ENCODER_BTN  A3
   
    Si5351 si5351;
    long int frq;

    int_fast32_t rx = 10378500L; // Starting frequency of VFO operating frequency plus offset which is selectable IF = 3.180 MHz
    int_fast32_t rx2= 0L; // variable to hold the updated frequency
    int_fast32_t increment = 100; // starting VFO update increment in HZ.
    int_fast32_t bfo = 3178500L; // default offset sideband inversion thus USB
    int_fast32_t rx1 = 10378500L;
    int_fast32_t rx3 = 10378500L;
    int_fast32_t vfoA = 1;
    int_fast32_t vfoB = 1;
    int_fast32_t old_vfoA = 1;
    int_fast32_t old_vfoB = 1;

    int RunOnce = 1;
   
    String hertz = "1"; //initial tune step rate.
    byte ones,tens,hundreds,thousands,tenthousands,hundredthousands,millions ;  //Placeholders
   
   
    Rotary r = Rotary(2,3); // sets the pins the rotary encoder uses.  Must be interrupt pins.
   
    int i = 0;
    int z = 0;
    const int TX = 4;  //USE VFO A only on transmit
    const int VS = 5;
    const int SW = A1;  // Toggle Switch USB/LSB
    const int SW1 = A2; // provides the TUNE fucntion
    const int VFO = A0;
   

   const int tonepin = 6;
   int buttonstate = 0;
   
   int buttonState = 0;
   int lastButtonState = 0;
   int lastbuttonstate = 0;
   
  void setup()   {
   
    display.clearDisplay();  // clears the screen and buffer
   
 
     
     PCICR |= (1 << PCIE2);
     PCMSK2 |= (1 << PCINT18) | (1 << PCINT19);
     sei();
   
   
    display.setRotation(2);
   // display.begin(0x3C);
   display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
    delay(20);
   
 
   
 
      // Connect to a button that goes to GND on push to set the 4 step rates
     
     
   
     
     pinMode(SW1, INPUT);  // Tune function
     digitalWrite(SW1, HIGH);
     pinMode(SW,INPUT);// USB/LSB Select
     digitalWrite(SW,HIGH);
     pinMode(4, INPUT); digitalWrite(4, HIGH);
     pinMode(5, INPUT); digitalWrite(5, HIGH);
     pinMode(7, OUTPUT); digitalWrite(7, LOW);
     pinMode(A0, INPUT);
     pinMode(A3,INPUT); digitalWrite(A3,HIGH);
   
     
     #if defined(__MK20DX128__) || defined(__MK20DX256__)
     tft.setBitrate(24000000);
     #endif
     
     
     
      si5351.init(SI5351_CRYSTAL_LOAD_8PF);
      si5351.set_correction(100);
     
      si5351.set_pll(SI5351_PLL_FIXED, SI5351_PLLA);
     
     //si5351.set_freq(rx , SI5351_PLL_FIXED, SI5351_CLK0);

     
      si5351.set_freq(bfo, 0, SI5351_CLK2);
     
      si5351.drive_strength(SI5351_CLK0,SI5351_DRIVE_8MA); // Higher Drive since it is a TUF-1 DBM
      si5351.drive_strength(SI5351_CLK2,SI5351_DRIVE_8MA);
   
   
   
 
}
 
  void setincrement(){
 
    if (increment == 10){increment = 100;  hertz = "1";}
         
    else if (increment == 100){increment = 1000; hertz="2";}
    else if (increment == 1000){increment = 10000; hertz="3"; }
  else if (increment == 10000){increment = 100000; hertz="4";}
   // else if (increment == 100000){increment = 1000000; hertz="  1M";}
    else{increment = 10; hertz = "  0";}; 

         
         
         
     delay(150); // Adjust this delay to speed up/slow down the button menu scroll speed.
             display.setTextSize(2);
             display.setTextColor(WHITE);
             display.setCursor(105,50);
             display.println(hertz);   
}
 
  void showFreq(){
     
     
   
 
      millions = int(((rx)-bfo)/1000000);
      hundredthousands = ((((rx)-bfo )/100000)%10);
      tenthousands = ((((rx)-bfo )/10000)%10);
      thousands = ((((rx)-bfo )/1000)%10);
      hundreds = ((((rx)-bfo )/100)%10);
      tens = ((((rx)-bfo )/10)%10);
      ones = ((((rx)-bfo )/1)%10);
     

 
     
       

          delay(25);
       
             
  } 

       

 

     


   

   
 
 
  ISR(PCINT2_vect) {
  unsigned char result = r.process();
 
    if (result) {
     if (result == DIR_CW){rx=rx-(1*increment);}
     else {rx = rx+(1*increment);};       
      if (rx >=50000000L){rx=rx2;}; //This sets the upper LO range 50 MHz
      if (rx <=5000000L){rx=rx2;};  // This sets the lower LO range 5 MHz
     
      }
  }

 
 
  void loop() {


       SplashScreen();
       RunOnce = 0;
           
        checkMode();
        CheckSB();
        CheckDisplay();
        CheckVS();
        CheckTX();
     
       
         
        lastButtonState = buttonState;
        lastbuttonstate = buttonstate;
       
       
      showFreq();
       
 
     
     
     
     
 
   
        display.display();
         
        if (rx != rx2){
       
           showFreq();
           
           si5351.set_freq(rx  , SI5351_PLL_FIXED, SI5351_CLK0);
           rx2=rx ;
           
       
       
       
         
         
           }
 

 buttonstate = digitalRead(A3);
         if(buttonstate != lastbuttonstate){
         if(buttonstate == LOW) {
           
       
          setincrement();
         
         }
         }


             
             
       
     
  }
         
       
   
   
     
     

  //**********************************************************
    void checkMode(){
        buttonState = digitalRead(SW1); // creates a 10 second tuning pulse trani 50% duty cycle and makes TUNE appear on the screen
       if(buttonState != lastButtonState){
        if(buttonState == LOW){
         
         
         
     
          useVFOA();
        display.setTextColor(WHITE);
        display.setTextSize(2);
        display.setCursor(10,35);   //We are dsiplaying the received Freq
               
         display.println(rx1 - bfo);
         display.setCursor(1,50); 
         display.print("TUNE");
        display.display();
        delay(12);
        for(int i = 0; i < 100; i++) {
         tone(6, NOTE_B5);
         delay(50);
         noTone(6);
         delay(50);
         
         }
        delay(100);   // de N6QW in CW

           dash();   //D
           dot();
           dot();
           delay(300); //E
           dot();

           delay(400);

           dash();    //N
           dot();
           delay(300);
           dash();   //6
           dot();
           dot();
           dot();
           dot();
           delay(300);
           dash();  //Q
           dash();
           dot();
           dash();
           delay(300);
           dot();     //W
           dash();
           dash();
           delay(300);
        }
       else{
         
        display.setTextSize(2);    // This prints a Black TUNE over the RED TUNE and makes it disappear from the scereen
         display.setTextColor(BLACK);
         display.setCursor(1, 50);
         display.print("TUNE");
   
         noTone(6);
   
       }
         
     
         delay(50);
   
    }
   
   
     
   

 
 
   


 
  }

//*********************Check Sideband ************************************
     
       
     void CheckSB(){
     
          // *** S Meter code smaple the audio output and uses a log function
         
       
       
     
     if(digitalRead(SW)){  //********If SW is true do the following.
       bfo = 3181500L;  //Sideband inversion with the LO above the operating frequency
       si5351.set_freq( bfo, 0, SI5351_CLK2);{
       
     
       display.setTextSize(2);  // lets you toggle bewteen USB and LSB without having a screen overwrite
       display.setTextColor(BLACK);
       display.setCursor(92,50); 
       display.println("LSB");
       
       display.setTextSize(2);
       display.setTextColor(WHITE);
       display.setCursor(92,50); 
       display.println("USB");}
     
     }
      else{                //**********if not, do this.
         
         
         
         
          bfo = 3178500L; // Keep in mind the LO is above the operating frequency so sideband inversion
          si5351.set_freq( bfo, 0, SI5351_CLK2);
       
          display.setTextSize(2);   // lets you toggle bewteen USB and LSB without having a screen overwrite
           display.setTextColor(BLACK);
           display.setCursor(92,50); 
          display.println("USB");
         
          display.setTextSize(2);
          display.setTextColor(WHITE);
          display.setCursor(92,50); 
          display.println("LSB");
      }
         
      }     
     
   //*************************** Splash Screen ********************

void SplashScreen() {
    if (RunOnce == 1) {
 
 
    display.setTextColor(WHITE);
 
    display.setCursor(25, 0);
    display.setTextSize(3);
    display.println("N6QW");
    display.setTextSize(2);
 
    display.println(" AKA Pete");
   
        display.display();
    display.clearDisplay();
    delay(400);
   
    display.setTextColor(WHITE);
    display.setTextSize(2);
    display.setCursor(5,30);
    display.println("Ham Genius");
    display.display();
    delay(500);
    RunOnce = 0;

   
   
     
    }
   display.clearDisplay();
  }
   

  // ********************** Check Display ***************************


  void CheckDisplay(){

          display.setTextSize(2);
          display.setTextColor(WHITE);
          display.setCursor(2,1);
          display.println("A");
          display.setCursor(2,18);
          display.println("B");
         display.setCursor(1,50);
          display.println("N6QW");
           
         
  }
 
//*************************************** VFO A or B ****************


void CheckVS(){  //thus a toggle switch controls writing which VFO indirectly

        digitalRead(5);
        if(digitalRead(5) == HIGH){
            digitalWrite(A0, HIGH);
            useVFOA();
             z = 1;
            }
           else {
           digitalWrite(A0, LOW);
           useVFOB();
            z = 2;
            }
   
       }

 // *************************************VFO A*******************

       void useVFOA(){   // Has logic so you can have the correct display in concert with USB/LSB

         
           CheckFreq1();
           
   
          digitalRead(A0) == HIGH;

          display.setTextSize(2);

     
             rx = rx1;

             

            display.setTextColor(WHITE);
            display.setCursor(25,1);
            display.print(rx1-bfo);
       
         
            rx1 == vfoA;
            vfoA = rx1;
            old_vfoA = vfoA;
            showFreq();
            si5351.set_freq(vfoA , SI5351_PLL_FIXED, SI5351_CLK0);
   
         }
         
 
     
     
    // ******************************** VFO B *****************************
  void useVFOB(){
       
                         
            CheckFreq2();
           
            digitalRead(A0) == LOW;
           
            display.setTextSize(2);
         
            rx = rx3;
           

            display.setTextColor(WHITE);
            display.setCursor(25,18);
            display.print(rx3-bfo);
           

           
               

         
           
            rx3 == vfoB;
            vfoB = rx3;
            old_vfoB = vfoB;
            si5351.set_freq(vfoB , SI5351_PLL_FIXED, SI5351_CLK0);

         
           
  }
 

//*************

/*    //Not Needed
void CheckFreq(){


                if (rx != rx2){ 

               
                showFreq();
               
             
           
            si5351.set_freq(rx  , SI5351_PLL_FIXED, SI5351_CLK0);
            Serial.println(rx);
            //si5351.set_freq(bfo  , SI5351_PLL_FIXED, SI5351_CLK2);
               rx2 = rx;
         
   

   
       }


    }

*/


   
 //************************* Frequency Change 1 *************************


  void CheckFreq1(){

       
         
          if( rx != rx2){   // This is the key to memory

       
            si5351.set_freq(rx1  , SI5351_PLL_FIXED, SI5351_CLK0);
            Serial.println(rx1);
            si5351.set_freq(bfo  , SI5351_PLL_FIXED, SI5351_CLK2);
            rx1 = rx;
           
         showFreq();

           }     
 
  }
//************************* Check Frequency 2 *******************************

void CheckFreq2(){


           
              if( rx != rx2){
             
           
            si5351.set_freq(rx3  , SI5351_PLL_FIXED, SI5351_CLK0);
           
            si5351.set_freq(bfo  , SI5351_PLL_FIXED, SI5351_CLK2);
            rx3 = rx;

         showFreq();

 }
}

// *************************** Check for Transmit *************************


// ***************************************Check for TRansmit ******************************************
/* This has proven to be a nasty problem for me as I have not been able to implement this in software. Try as I might
 *  the software does not follow what I want to do. I have total functionality with two separate VFO's --my failure is how
 *  to transmit on one while receiving on the other. Finally I hit on a simple hardware solution. Pin A0 is either set high or
 *  low depedning on whether Pin 5 is grounded via a switch. So lets add some hardware in that loop like a NC relay. So here is
 *  how it would work.
 *  1) In the receiove mode by engaging Pin 5 high or low with an external switch we have a choice of VFO A or VFO B
 *  2) Let us say we want to make VFO A the Receive and Transmit VFO and VFO B Receive only
 *  3) When the PTT Switch ground Pin 4 it also causes a NC relay to open. So if you were receiving on VFO B the break in the circuit
 *     would cause the controlling VFO to be VFO A whihc means you would be transmitting on VFO A.
 *  4) If you purposefully open the VFO A/B sweitch then you would receive and transmit entirely on VFO A.
 *  5) Adding yet another switch in the loop in the line feeding the juice (or ground) to the NC relay Then you would receive and transmit only on VFO B
 *  6) Normal Opeartion would entail opening the A/B select swithc so that you would pick the transmit frequency on VFO A. Then closing the switch you would
 *     have VFO A fixed for transmit and tune around on VFO B. Opening the switch then tuning and transmitting is on VFO A
 */
 void CheckTX() { //Green Dot comes on to PTT Also selects which VFO A is used for tranmit
         
       digitalRead(4);

         if(digitalRead(4) == LOW){
               
                display.setCursor(10,35);   //We are dsiplayin the received Freq
                display.setTextSize(2);
                display.setTextColor(WHITE);
                display.println(rx1 - bfo);

            /*    display.setCursor(52,50);   //We are dsiplayin the received Freq
                display.setTextSize(2);
                display.setTextColor(WHITE);
                display.println("T=A"); */

                display.fillCircle(108, 40, 4, WHITE);

           
               
             
                   useVFOA();
                 
                  digitalWrite(7, HIGH);
                 
         }
 }

//**** Generating CW *********

 void dash(){

       tone(6, NOTE_B5);
        delay(300);
        noTone(6);
        delay(100);
 }

void dot(){

      tone(6, NOTE_B5);
      delay(100);
      noTone(6);
      delay(100);
}


Offline onepower

  • Hero Member
  • *****
  • Posts: 553
Re: Arduino experience, someone?
« Reply #13 on: September 17, 2020, 06:38:47 PM »
Antimony
Yikes, that is a lot of code for a fairly simple VFO, lol.

 
Quote
This has proven to be a nasty problem for me as I have not been able to implement this in software. Try as I might
 *  the software does not follow what I want to do. I have total functionality with two separate VFO's --my failure is how
 *  to transmit on one while receiving on the other. Finally I hit on a simple hardware solution. Pin A0 is either set high or
 *  low depedning on whether Pin 5 is grounded via a switch. So lets add some hardware in that loop like a NC relay.

If you want to switch between TX/RX frequencies or channels you could use a multiplexing chip. I used to use them all the time in the not so good old days when I had to build my own micro computers using logic gate gate chips. Which is why I love Arduino's, $5 boom, we have a fast reliable computer to do stuff.

Here is a start...https://www.instructables.com/id/Multiplexing-with-Arduino-and-the-74HC595/

You want to watch the rise/fall transition times, 500ns for the 74HC595, which could become a problem in high bandwidth applications. You will be fine and MUX/deMUX is a good solution when we have a limited number of input/output channels. I would prefer to use a small footprint microcomputer and multiplex rather than use a larger board like the Mega.

As well, instead of using time consuming serial string functions it can be done physically with a MUX chip basically converting all the parallel data into serial data or vice versa. That's how we used to do it, lol.

Regards


Offline partzman

  • Sr. Member
  • ****
  • Posts: 320
Re: Arduino experience, someone?
« Reply #14 on: September 17, 2020, 07:51:02 PM »
Actually, today the most sophisticated method of generating wideband RF waveforms is via DDS or Direct Digital Synthesis.  Simply put, it involves a digital lookup table in whatever resolution is required that drives a DAC to produce whatever waveform is required.  This then requires a simple change in clock frequency to change the overall output frequency.  Most all if not all function/arbitrary generators in use today use DDS.  The current technology of high frequency DAC's limits the output signal to about 1v rms or less in most cases.  This is then amplified by a linear RF amp to reach the  levels seen today in the popular generators used on the bench.

If an when high speed DAC's (whether integrated or discrete) in the neighborhood of 2-4MHz are available that will supply 50v rms or so output are available, I will be able to demonstrate infinite OU at any basic power level with my MEI or Magneto Electric Induction circuits.  This is possible only with the direct switched mosfet output of the DAC because the mosfets will be able to operate in a reverse conduction mode that allows the negative energy or current to be fed back to the supply.  This can't be done with linear amplification.

My youngest son uses DDS in his line of synthesizer products that he markets to the music industry but these operate obviously in the audio range and are much more manageable at higher voltage levels.

Regards,
Pm

 

OneLink