Experience a breakthrough in signal generation – our voltage-to-frequency solution transforms voltage inputs into finely tuned frequency signals, granting you unprecedented control over your waveform generation
A
A
Hardware Overview
How does it work?
V to Hz Click is based on the TC9400, a voltage-to-frequency and frequency-to-voltage converter from Microchip. It accepts voltage at its input and generates a pulse train, with a frequency linearly proportional to the input voltage. The pulse train is present on two output pins: the full frequency pin outputs signal with the pulse rate linear to the input voltage, while the half frequency pin outputs signal with the pulse rate equal to the half of the full frequency pin pulse rate. When V to Hz click is operated for the first time, it needs to be calibrated. The click is equipped with two variable resistors for gain and offset fine tuning. There are several steps that should be followed when calibrating. An input signal of 10mV should be applied to the input. The offset should be adjusted so that a 10Hz signal appears on the output. An input signal of 5V should be applied to the input. The gain should be adjusted so that 10kHz signal
appears on the output. V to Hz Click is equipped with the input voltage terminal (VOLT IN), which is used to connect the control voltage up to 5V. Besides having control voltage input on this terminal, it is possible to select the voltage generated by the MCU as the control voltage input, too. INPUT SEL switch can be set so that the PWM pin from the mikroBUS™ is used as the control voltage input. The PWM signal generated by the MCU is filtered out by the onboard low pass filter so that the control voltage remains constant. For this reason, PWM signal frequency from the MCU should be at least 40 kHz. The output terminal (FREQ OUT) is used to output the generated frequency. There are two outputs routed to this two-pole screw terminal: the first output is full frequency output (f), while the second output is the half of the generated frequency (f/2). The frequency output is also
routed to the INT pin of the mikroBUS™. To select between the half and the full frequency output routed to the INT pin, the FREQ SEL SMD jumper needs to be switched to the correct position. Both of the half frequency and the full frequency outputs are pulled HIGH (3.3V) with an onboard resistor, which means that the output generated signal amplitude will be 3.3V. To provide 12V for the TC9400, V to Hz click employs a boost converter, built around the MIC2606, a boost regulator from Microchip, which works at 2MHz. This IC provides 12V for supplying the TC9400 out of 5V routed from the mikroBUS™ socket. EN pin of the boost regulator is routed to the mikroBUS™ CS pin and it is used to enable power output from the boost regulator, effectively enabling the TC9400 itself. EN pin is pulled to a HIGH logic level (3.3V) by the onboard resistor.
Features overview
Development board
Nucleo 32 with STM32F031K6 MCU board provides an affordable and flexible platform for experimenting with STM32 microcontrollers in 32-pin packages. Featuring Arduino™ Nano connectivity, it allows easy expansion with specialized shields, while being mbed-enabled for seamless integration with online resources. The
board includes an on-board ST-LINK/V2-1 debugger/programmer, supporting USB reenumeration with three interfaces: Virtual Com port, mass storage, and debug port. It offers a flexible power supply through either USB VBUS or an external source. Additionally, it includes three LEDs (LD1 for USB communication, LD2 for power,
and LD3 as a user LED) and a reset push button. The STM32 Nucleo-32 board is supported by various Integrated Development Environments (IDEs) such as IAR™, Keil®, and GCC-based IDEs like AC6 SW4STM32, making it a versatile tool for developers.
Microcontroller Overview
MCU Card / MCU
Architecture
ARM Cortex-M0
MCU Memory (KB)
32
Silicon Vendor
STMicroelectronics
Pin count
32
RAM (Bytes)
4096
You complete me!
Accessories
Click Shield for Nucleo-32 is the perfect way to expand your development board's functionalities with STM32 Nucleo-32 pinout. The Click Shield for Nucleo-32 provides two mikroBUS™ sockets to add any functionality from our ever-growing range of Click boards™. We are fully stocked with everything, from sensors and WiFi transceivers to motor control and audio amplifiers. The Click Shield for Nucleo-32 is compatible with the STM32 Nucleo-32 board, providing an affordable and flexible way for users to try out new ideas and quickly create prototypes with any STM32 microcontrollers, choosing from the various combinations of performance, power consumption, and features. The STM32 Nucleo-32 boards do not require any separate probe as they integrate the ST-LINK/V2-1 debugger/programmer and come with the STM32 comprehensive software HAL library and various packaged software examples. This development platform provides users with an effortless and common way to combine the STM32 Nucleo-32 footprint compatible board with their favorite Click boards™ in their upcoming projects.
Used MCU Pins
mikroBUS™ mapper
Take a closer look
Schematic
Step by step
Project assembly
Track your results in real time
Application Output via Debug Mode
1. Once the code example is loaded, pressing the "DEBUG" button initiates the build process, programs it on the created setup, and enters Debug mode.
2. After the programming is completed, a header with buttons for various actions within the IDE becomes visible. Clicking the green "PLAY" button starts reading the results achieved with the Click board™. The achieved results are displayed in the Application Output tab.
Software Support
Library Description
This library contains API for V To Hz Click driver.
Key functions:
vtohz_set_duty_cycle
- Generic sets PWM duty cyclevtohz_pwm_stop
- Stop PWM modulevtohz_pwm_start
- Start PWM module.
Open Source
Code example
This example can be found in NECTO Studio. Feel free to download the code, or you can copy the code below.
/*!
* \file
* \brief VtoHz Click example
*
* # Description
* This application converts an analog voltage input signal into a pulse wave signal of a certain frequency.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes driver and enables the click board.
*
* ## Application Task
* Alternates between different output frequencies.
*
* ## Additional functions
* - set_output_frequency - Changing the output frequency by setting the PWM duty cycle to desired value.
*
* @note Output frequency may vary depending on the offset and gain potentiometers on board the click.
*
* \author MikroE Team
*
*/
// ------------------------------------------------------------------- INCLUDES
#include "board.h"
#include "log.h"
#include "vtohz.h"
// ------------------------------------------------------------------ VARIABLES
static vtohz_t vtohz;
static log_t logger;
static float duty_cycle = 0.5;
// ------------------------------------------------------- ADDITIONAL FUNCTIONS
uint16_t pwm_period;
static uint8_t set_output_frequency ( float frequency )
{
float duty_cycle;
if ( frequency > 10000 )
{
return -1;
}
duty_cycle = frequency;
duty_cycle /= 10000;
vtohz_set_duty_cycle( &vtohz, duty_cycle );
vtohz_pwm_start( &vtohz );
return 0;
}
// ------------------------------------------------------ APPLICATION FUNCTIONS
void application_init ( void )
{
log_cfg_t log_cfg;
vtohz_cfg_t cfg;
/**
* Logger initialization.
* Default baud rate: 115200
* Default log level: LOG_LEVEL_DEBUG
* @note If USB_UART_RX and USB_UART_TX
* are defined as HAL_PIN_NC, you will
* need to define them manually for log to work.
* See @b LOG_MAP_USB_UART macro definition for detailed explanation.
*/
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, "---- Application Init ----" );
// Click initialization.
vtohz_cfg_setup( &cfg );
VTOHZ_MAP_MIKROBUS( cfg, MIKROBUS_1 );
vtohz_init( &vtohz, &cfg );
vtohz_enable ( &vtohz );
}
void application_task ( void )
{
set_output_frequency( 1000 ); //1000 Hz output
log_printf( &logger, "Output frequency: \t 1000 Hz\r\n" );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
set_output_frequency( 2000 ); //2000 Hz output
log_printf( &logger, "Output frequency: \t 2000 Hz\r\n" );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
set_output_frequency( 5000 ); //5000 Hz output
log_printf( &logger, "Output frequency: \t 5000 Hz\r\n" );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
set_output_frequency( 10000 ); //10000 Hz output
log_printf( &logger, "Output frequency: \t 10000 Hz\r\n" );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
}
int main ( void )
{
/* Do not remove this line or clock might not be set correctly. */
#ifdef PREINIT_SUPPORTED
preinit();
#endif
application_init( );
for ( ; ; )
{
application_task( );
}
return 0;
}
// ------------------------------------------------------------------------ END