How to create a 5 Volt PWM signal

Context: I need to create a PWM signal to control a fan’s speed. The fan is a 230 Volt fan, so the PWM is only a control signal. The PWM signal should be between 5 and 10 Volt and between 5 and 10 KHz. The duty cycle determines the fan’s speed.

I have a small circuit that will create a 5V PWM signal from the 3.3 Volt signal from one of the Argon I/O pins. But I need a 5V power soirce for that. The Argon will preferably be connected to a USB cable. That means that there is 5V avalable, but I am not sure if I can connect to it when the power is provided tghrough the USB port, would VUSB work?

Alternatively, I could probably strip the USB cable and connect the VCC and GND to the VUSB and GND pins, but I would prefer to just use the USB cable.

Yes, if you are powering by USB, the VUSB pin will be a 5V output and you can use it to power other things at 5V.

I would connect that a P-channel MOSFET and the gate to a GPIO. Just be careful on Gen 3 devices (Argon, Boron, Xenon) to not apply 5V to any GPIO pins directly, as they are not 5V tolerant.

1 Like

Hi, thanks for the confirmation an the tip regarding the Mosfet. I’ll look into that