How to Use PWM Signal Generator Module With Visuino

In this tutorial we will learn how to control a PWM Signal Generator Module XY-LPWM with Visuino by using the "XY-LPWM/VHM-800/HW-753 PWM Signal Generator Module" component in Visuino program.

Watch the Video!

Also checkout this tutorial: How to Control PWM Signal Generator Module With Arduino & Visuino


 

STEP 1
What You Will Need

What You Will Need

What You Will Need

What You Will Need

What You Will Need

What You Will Need

What You Will Need

What You Will Need

XY-LPWM or HW-753 PWM Signal Generator ModuleArduino UNO (or any other Arduino)Jumper wiresOptional 1X LED and 1K ohm resistor, BreadboardVisuino program: Download Visuino
STEP 2
About the PWM Module
Operating Voltage: 3.3 to 30 VoltsFrequency Range: 1 Hz to 150 kHz0-100% duty cycleFrequency Accuracy: Approximately 2% accuracy within each rangeSignal Load Capacity: Output current ranging from 5 to 30 mAOutput Amplitude: PWM amplitude matches the supply voltageOperating Temperature Range: -20 to +70 degrees CelsiusCommunication Standard: 9600 bps Data bits: 8
STEP 3
The Circuit
Connect Arduino pin [RX] to the PWM Module pin [TX]Connect Arduino pin [TX] to the PWM Module pin [RX]Connect Arduino pin [5V] to the PWM Module pin [VIN+]Connect Arduino pin [GND] to the PWM Module pin [VIN-]

When using LED:

Connect PWM Module pin [PWM] to 1K ohm resistorConnect 1K ohm resistor to LED positive pin [+]Connect PWM Module pin [GND] to LED negative pin [-]
STEP 4
Start Visuino, and Select the Arduino UNO Board Type

Start Visuino, and Select the Arduino UNO Board Type

Start Visuino, and Select the Arduino UNO Board Type

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 5
About the Visuino "PWM Signal Generator Module" Component

About the Visuino

About the Visuino

You can find the component in the Component Window if you type "PWM Signal Generator Module"

The component has a pin "Frequency" where you can connect any Analog pin and send the Frequency in Hz, example for the frequency of 10KHz you would need to set the value to 10000

 

Pin "Duty Cycle" will set the Duty Cycle on the output from 0 to 100%, to set it correctly you need to connect the Analog value to it from 0 to 1 where 0 is 0%, 0.3 is 30% or 1 is 100%

 

To get the current Frequency and Duty Cycle from the module you need to connect some clock signal to the pin [Clock], and the values will be sent on the output pins "Frequency" and "Duty Cycle".
STEP 6
About the Visuino About the Visuino You can find the component in the Component Window if you type "PWM Signal Generator Module" The component has a pin "Frequency" where you can connect any Analog pin and send the Frequency in Hz, example for the frequency of 10KHz you would need to set the value to 10000 Pin "Duty Cycle" will set the Duty Cycle on the output from 0 to 100%, to set it correctly you need to connect the Analog value to it from 0 to 1 where 0 is 0%, 0.3 is 30% or 1 is 100% To get the current Frequency and Duty Cycle from the module you need to connect some clock signal to the pin [Clock], and the values will be sent on the output pins "Frequency" and "Duty Cycle".

In Visuino Add & Set Components

In Visuino Add & Set Components

In Visuino Add & Set Components

In Visuino Add & Set Components

In Visuino Add & Set Components

In Visuino Add & Set Components

Add "PWM Signal Generator Module" componentAdd "Clock Generator" componentAdd "Random Analog Generator" componentSelect "RandomAnalogGenerator1" and in the properties window set "Max" to 150000 and "Min" to 1If you are going to connect the LED set "Max" to 5 so that you can see it blinking
STEP 7
In Visuino Connect Components
Connect "ClockGenerator1" pin [Out] to "ClockMultiSource1" pin [In]Connect "ClockMultiSource1" pin [0] to "RandomAnalogGenerator1" pin [Clock]Connect "ClockMultiSource1" pin [1] to "RandomAnalogGenerator2" pin [Clock]Connect "RandomAnalogGenerator1" pin [Out] to "Generator1" pin [Frequency]Connect "RandomAnalogGenerator2" pin [Out] to or to "Generator1" pin [Duty Cycle]Connect "Generator1" pin [Out] to Arduino Serial pin [In]
STEP 8
Generate, Compile, and Upload the Arduino Code

Before Uploading Disconnect RX pin on Arduino and connect it back after the Upload.

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.

STEP 9
Play

If you power the Arduino module the PWM it will start to change the Frequency and the Duty Cycle every second.

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

icon pwm-module-component.zip 1KB Download(0)
STEP 10
To Read the Values From the Module

To Read the Values From the Module

Connect "ClockGenerator1" pin [Out] to "Generator1" pin [Clock]Connect "Generator1" pin [Frequency] to Arduino Serial pin [In]Connect "Generator1" pin [Duty Cycle] to Arduino Serial pin [In]Connect "Generator1" pin [Out] to Arduino Serial pin [In]

 

Upload the project (Make sure do disconnect the Arduino RX pin when uploading) and Connect in the serial window to the Arduino board and you should see the current Frequency and the Duty Cycle. If you press the buttons on the module to change the Frequency the change will also be seen in the serial window.

icon pwm-module-component-read.zip 1KB Download(0)
License
All Rights
Reserved
licensBg
0