[ESP32]Lilygo TTGO T-Relay with PWM Fan Speed Control via Blynk IoT?

Hello. I’m relatively new to using Arduino and ESP32 and stuff. But I’m working on a project that I have a question about. See, I’m trying to make a tornado machine that I can remotely turn on and off and adjust different elements such as multiple sets of lights, fan speeds, a laser, the fogger…everything on it from my phone via Blynk IoT app. The heart of this project and its functionality is centered around this “LILYGO TTGO 4 channel ESP32 T-Relay” I got. as well as a smaller ESP32 WROOM-32 38 pin micro controller for via wireless the top section(updraft fan and its speed, and 6 led lights)
But right now I’m stuck trying to solidly figure this out will the 4 relays on the ESP32 T-relay be able to function as a PWM for a motor driver for 6 2-pin 30mm 12 DC PC fans? I cant seem to find any clear explanations if it’s possible. The manufacturer said all IO pins are PWM capable, but I saw one site online suggesting relays aren’t PWM capable.


For all practical purposes you can't do PWM on relays : no way you switching a relay on /off 10 times a sec leave alone kHz

Well ... it makes nice music ... and if your voltage is high enough you get a lightshow :slight_smile:

You have two topics on the same subject!
Delete one of them!

Hello. I’m relatively new to using Arduino and ESP32 and stuff. But I’m working on a project that I have a question about. See, I’m trying to make a tornado machine that I can remotely turn on and off and adjust different elements such as multiple sets of lights, fan speeds, a laser, the fogger…everything on it from my phone via Blynk IoT app. The heart of this project and its functionality is centered around this “LILYGO TTGO 4 channel ESP32 T-Relay” I got. as well as a smaller ESP32 WROOM-32 38 pin micro controller for via wireless the top section(updraft fan and its speed, and 6 led lights)
But right now I’m stuck trying to solidly figure this out will the 4 relays on the ESP32 T-relay be able to function as a PWM for a motor driver for 6 2-pin 30mm 12 DC PC fans? I cant seem to find any clear explanations if it’s possible. The manufacturer said all IO pins are PWM capable, but I saw one site online suggesting relays aren’t PWM capable.


That is correct. PWM is a digital way to simulate an analog voltage. A relay board is really a way to use a small signal (from WROOM-32, etc.) to turn on or off a large amount of current. Sending 0v turns the relay off and 5v turns it on. You could use the relay to then power a fan, but it would either be on or off. PWM gives you the variable speed that I think you are looking for.

Why not use the PWM output from the WROOM-32?

Exactly, pins are, but relays not. Except if your pwm frequency is really low, like few Hz.

You have two topics open on the same subject!
You should delete one of them.

Are you sure you can control speed using PWM with those fans?

Thanks. I might try and keep using the TTGO T Relay anyways, the manufacturer did say it has PWN
here’s the board’s full specs:

“ The optocouplers on the board allow for the GPIO signals from the MCU to trigger the relays.

Specifications:

  • MCU: ESP32-WROVER-B
  • SPI Flash: 4MB
  • PSRAM: 8MB
  • Bus Interfaces: UART, SPI, SDIO, I2C, I2S, CAN
  • Other Interfaces: USB-C, GPIO, ADC, DAC, PWM, Capacitive Touch Sensor, Pulse Counter, IR
  • USB Connectivity: USB Type-C via the supplied T-U2T adapter
  • Wireless: Wi-Fi 802.11b/g/n, Bluetooth BLE V4.2
  • MCU Operating Voltage: 3.0 - 3.6VDC
  • Power Consumption: 360 to 450mW
  • Power Supply Input Range: 12 - 24VDC
  • No. of Relay Channels: 4
  • Relay Type: HRS4H-S-DC5V
  • Relay Trigger Signal Pins:
    • K1 Relay: GPIO21
    • K2 Relay: GPIO19
    • K3 Relay: GPIO18
    • K4 Relay: GPIO05
  • Dimensions: 85 x 85 x 17.5mm (without ESP32 module)
    91 x 85 x 17.5mm (with ESP32 module)
  • Weight: 82g / 2.9 oz “
    I just gotta figure out exactly which GPIO pin does what? Specifically the PWN or if they all do, because how the support chat I was in, made it kind of unclear…

@twistex_iot ,

Your two or more topics on the same or similar subject have been merged.

Please do not duplicate your questions as doing so wastes the time and effort of the volunteers trying to help you as they are then answering the same thing in different places.

Please create one topic only for your question and choose the forum category carefully. If you have multiple questions about the same project then please ask your questions in the one topic as the answers to one question provide useful context for the others, and also you won’t have to keep explaining your project repeatedly.

Repeated duplicate posting could result in a temporary or permanent ban from the forum.

Could you take a few moments to Learn How To Use The Forum

It will help you get the best out of the forum in the future.

Thank you.

@twistex_iot ,

Are you looking to pay someone to help you?

No, sorry about that, I just got confused because I didn’t know which category and subcategory I should’ve picked. When I saw this sub category, all I saw was something about getting people to help you out with your project. I duplicated my post because I realized where I posted it in, and didn’t know how to delete. So I made a new one in a better suited category and sub category. Sorry for the confusion

1 Like

Don't try to control those relays at all with PWM pins as suggested by others

Instead use a motor driver like LN298N

To control 6 motors, you will require 6 channel motor driver and 6 GPIO pins, each PWM compatible (assuming you don't need to control direction of rotation since it is a fan).

Follow this for reference: ESP32 with DC Motor - Control Speed and Direction | Random Nerd Tutorials

I've moved it for you. Please, next time ask someone to move it if it's in the wrong place.

Ok. Thanks. But instead of powering 6 motors with 6 GPIO pins I’m planing on either powering 3 with 2 GPIO pins or all 6 with 1 using this converging circuit piece like this(depending if I want separate control over 2 groups of 3 or if I just want to be Able to control all 6 at once.)::arrow_heading_down:



GPIO pins have nothing to do with power, they are for controlling the fan speed.

You will need a separate power source for the motors. If a typical PC fan consumes 90mA, 6 of them would conusme 0.54A. With a backup of 5 hours, you will need to provide a 12v, 3AH power source atleast.

About the grouping, the motor drivers usually have very small sink current as compared to the source current of the ESP32, so that should not be an issue even when divided between 2 or 6 motors. Just that motors of the same group will be running at same speeds.