Setting up the Hardware

To begin, the necessary hardware components must be assembled. This includes the PWM signal generator module, Arduino board, jumper wires, and Visuino program wire. The schematic provided should be followed to ensure proper connections are made. After the hardware is set up, the Visuino program must be downloaded and installed. Once the program is running, select the board type, in this case an Arduino Uno.

Sending Commands via Serial Monitor

The first step in controlling the PWM signal generator module is to send commands via the serial monitor. To do this, a software serial port component must be added and connected to the Arduino serial pin out. The software serial one pin in should be connected to the Arduino board serial pin and the software serial one pin out should be connected to the Arduino board serial pin. Additionally, the pin Erics should be connected to the Arduino board digital pin 2 and the pintix should be connected to the Arduino board digital pin 3. After the project is uploaded, click on the serial tab, select the port, and click connect.

Setting the Frequency

To set the frequency, the command F must be sent followed by the desired frequency. For example, to set the frequency to 100 Hertz, the command F100 must be sent. If the command is understood by the module, a response of down or fail will be received. To set the frequency to 1 kilohertz, the command F1000 must be sent.

Changing the Duty Cycle

The duty cycle of the PWM signal generator module can be changed by sending the command D followed by the desired duty cycle. For example, to set the duty cycle to 50%, the command D50 must be sent. If the command is understood by the module, a response of down or fail will be received.

Sending Commands from Arduino

The commands can also be sent directly from the Arduino board. To do this, the Arduino board must be connected to the PWM signal generator module and the commands must be written in the Arduino code. The commands must be written in the setup() function and the frequency and duty cycle must be changed randomly every second. The commands for setting the frequency and duty cycle are the same as those sent through the serial monitor.

By following the steps outlined above, the PWM signal generator module can be controlled using Arduino and Visuino. This allows for the frequency and duty cycle to be changed randomly every second, allowing for a variety of applications.

So we are going to use the int to string component.

Connecting the Arduino

To connect the Arduino to the PWM Signal Generator Module, we need to use the TX and RX pins, and connect them to the Arduino’s TX and RX pins. We also need to connect the ground pin of the module to the ground pin of the Arduino.

Programming the Arduino

We can now program the Arduino to control the PWM Signal Generator Module. We need to use the Visuino software to program the Arduino. First, we need to add the Arduino board to the Visuino project. We can then add two Clock Generator components, one with a frequency of 0.5 Hz and the other with a frequency of 1 Hz. We also need to add two Random Integer Generator components, one with a minimum of 1 and a maximum of 100, and the other with a minimum of 10 and a maximum of 99. We can then add an Int to String component to convert the integer values to text.

Sending Commands to the Module

We can now send commands to the module. To set the frequency, we need to send the command F followed by the frequency in kilohertz. For example, to set the frequency to 10 kilohertz, we need to send the command F 10.0. To set the duty cycle, we need to send the command D followed by the duty cycle in percentage. For example, to set the duty cycle to 50%, we need to send the command D 0,50. We can also send the command READ to read the current frequency and duty cycle.

Testing the Project

To test the project, we can connect the output of the PWM Signal Generator Module to an oscilloscope and observe the output. We can then use the Visuino project to change the frequency and duty cycle and observe the changes on the oscilloscope.

Using Arduino & Visuino to Control PWM Signal Generator Module

Controlling a PWM signal generator module with Arduino and Visuino is a simple process. To begin, we must use an Integer to Text component to convert our values into text format. We then add two Formatted Text components to the left side, which will receive the value from the Integer to Text component.

Converting Values to Commands

The next step is to convert the value to a command. To do this, we write “F%0” in the text element, where “0” represents the value from the Text Element 1. For example, if the value is 10, the final value will be “F10”. The same approach is used for the Duty Cycle, where we write “D00” in the Text Element. If the value is 15, the final output will be “D015”.

Adding Software Serial Port Component

We then add a Software Serial Port component to the project. Once all the components are connected, we can observe how the frequency and duty cycle changes every second.

Controlling a PWM signal generator module with Arduino and Visuino is a straightforward process. By following the steps outlined above, users can easily adjust the frequency and duty cycle of the module.

Share.
Exit mobile version