Overunity.com Archives is Temporarily on Read Mode Only!



Free Energy will change the World - Free Energy will stop Climate Change - Free Energy will give us hope
and we will not surrender until free energy will be enabled all over the world, to power planes, cars, ships and trains.
Free energy will help the poor to become independent of needing expensive fuels.
So all in all Free energy will bring far more peace to the world than any other invention has already brought to the world.
Those beautiful words were written by Stefan Hartmann/Owner/Admin at overunity.com
Unfortunately now, Stefan Hartmann is very ill and He needs our help
Stefan wanted that I have all these massive data to get it back online
even being as ill as Stefan is, he transferred all databases and folders
that without his help, this Forum Archives would have never been published here
so, please, as the Webmaster and Creator of this Forum, I am asking that you help him
by making a donation on the Paypal Button above
Thanks to ALL for your help!!


Arduino experience, someone?

Started by antimony, September 13, 2020, 12:37:45 AM

Previous topic - Next topic

0 Members and 5 Guests are viewing this topic.

antimony

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.

EMJunkie




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

onepower

antimony

QuoteI 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

EMJunkie








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

onepower

EMJ
QuoteOnepowers 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