Arduino Frequency Sweep Using Visual Programming

by RonFrtek in Circuits > Arduino

45 Views, 0 Favorites, 0 Comments

Arduino Frequency Sweep Using Visual Programming

Freq Sweep UNO

In this simple tutorial, we’ll learn how to create a frequency sweep using Arduino and Visuino. The frequency will smoothly sweep from 1Hz up to any desired frequency in 0.1Hz increments, all easily adjustable through visual programming.

Watch the Video!

What You Will Need

VisuinoAdvrtisementPortentaH7.jpg
FZEK4WBK3XGYAP0.LARGE.jpg
  • Arduino UNO or any other board
  • Visuino software: Download here
  • [Optional] Some oscilloscope or frequency meter to see the signal like this one


Start Visuino, and Select the Arduino UNO Board Type

2022-07-27_11-15-03.jpg
Visuino-Select-Board-UNO.jpg

The Visuino: https://www.visuino.eu also needs to be installed. Download Free version or register for a Free Trial.

Start Visuino as shown in the first picture Click on the "Tools" button on the Arduino component (Picture 1) in Visuino When the dialog appears, select "Arduino UNO" as shown on Picture 2

Step 4: in Visuino Add Components

2022-07-29_16-55-21.jpg
2022-04-25_12-48-32.jpg
2022-08-04_11-00-48.jpg
2022-08-04_11-00-30.jpg
2022-08-04_11-00-10.jpg
2022-08-04_10-59-40.jpg
2022-08-04_10-59-14.jpg
2022-08-04_10-58-45.jpg
2022-08-04_10-58-15.jpg
  1. Add "Clock Generator" component
  2. Add "Counter" component
  3. Add "Analog Value" component
  4. Add "Integer To Analog" component
  5. Add "Add Analog" component
  6. Add "Analog Multi Source" component
  7. Add "Compare Analog Value" component
  8. Add "Analog On/Off Switch" component
  9. Add "Pulse Generator" component

In Visuino Set Components

2022-08-04_11-03-18.jpg
2022-08-04_11-05-32.jpg
2022-08-04_11-14-19.jpg
2022-08-04_11-10-53.jpg
2022-08-04_11-11-24.jpg
  1. If you want increments to be faster or slower than every second select "ClockGenerator1" and change the frequency
  2. Set the Starting Frequency: Select "AnalogValue1" and in the properties window set "Value" in our case it is 1Hz
  3. Set the Frequency increments: Select "IntegerToAnalog1" and in the properties window set "Scale" in our case it is 0.01
  4. Set the End Frequency: Select "CompareValue1" and in the properties window set "Value" in our case it is 5Hz and set "Compare Type" to ctSmaller
  5. Select "PulseGenerator1" and in the properties window select "Frequency" and click on the pin Icon button and select "Float SinkPin"

In Visuino Connect Components

2022-08-04_11-16-15.jpg
  1. Connect "ClockGenerator1" pin [Out] to "Counter1" pin[In]
  2. Connect "Counter1" pin[Out] to "IntegerToAnalog1" pin[In]
  3. Connect "AnalogValue1" pin[Out] to "Add1" pin[0]
  4. Connect "IntegerToAnalog1" pin[Out] to "Add1" pin[1]
  5. Connect "Add1" pin [Out] to "AnalogMultiSource1" pin[In]
  6. Connect "AnalogMultiSource1" pin[0] to "AnalogSwitch1" pin [In]
  7. Connect "AnalogMultiSource1" pin[1] to "CompareValue1" pin [In]
  8. Connect "CompareValue1" pin[Out] to "AnalogSwitch1" pin [Enable]
  9. Connect "AnalogSwitch1" pin [Out] to "PulseGenerator1" pin[Frequency]
  10. Optional Connect "AnalogSwitch1" pin [Out] to "Arduino" Serial pin[In]
  11. Connect "PulseGenerator1" pin[Out] to "Arduino" digital pin[2]

Generate, Compile, and Upload the Code

F6S1BZ7KYVK6VFF.jpg

In Visuino, at the bottom click on the "Build" Tab, make sure the correct port is selected, then click on the "Compile/Build and Upload" button.

Play

If you power the Arduino module and connect a Frequency meter to the Arduino digital pin 2 you will be able to see the frequency increasing.

You will also be able to see frequency increasing in the serial monitor window.

Congratulations! You have completed your project with Visuino. Also attached is the Visuino project, that I created for this Instructable, you can download it and open it in Visuino: https://www.visuino.eu