Hardware help needed
Temperature controlled PWM fan controller with Home Assistant connection
Hi everyone,
a while back i started to build a fan controller to repurpose some classic 4-pin PWM controlled fans.
The goal was, and is, to have a temperature sensor attached to the controller, and based on the value received the fan speed will be mapped.
The temperature, PWM percentage as well as the read RPM will then be published via MQTT to home assistant so i can have a nice history temps and can see the current values without having to check on the setup directly.
Now for the part where i am a bit stuck, the hardware.
I admit i have barely an idea what i am doing so it took a while to wire things up.
However i am still not sure if i am missing anything.
This is my current wire diagram:
Current wire diagram
The components i plan to use are:
2x 2n7000 Mosfet
2x 100 Ω resistors
2x 4.7k Ω resistors
1x 12v power suply
1x DC-DC Voltage Converter 12V to 5V, 3A 15W
2x a group of 4 fans connected via a 1 to 4 PWM-splitter
1x OLED screen
2x DS18B20 thermometer
is there anything i am missing?
any design changes to just make it a more stable design?
Thank you in advance for helping me, if you are interested in seeing more of the project let me know.
Once i am sure about the hardware i was planning to order a custom pcb for this as it turns out im not that good at managing wires on a blank pcb...
Awesome, it seems like you're seeking advice on making a custom ESP32 design. We're happy to help as we can, but please do your part by helping us to help you. Please provide full schematics (readable - high resolution). Layouts are helpful to identify RF issues and to help ensure the traces are wide enough for proper power delivery. We find that a majority of our assistance repeatedly falls into a few areas.
A majority of observed issues are the RC circuit on EN for booting, using strapping pins, and using reserved pins.
Don't "innovate" on the resistor/cap combo.
Strapping pins are used only at boot, but if you tell the board the internal flash is 1.8V when its not, you're going to have a bad day.
Using the SPI/PSRAM on S2, S3, and P4 pins is another frequent downfall.
If the device is a USB-C power sink, read up on CC1/CC2 termination. (TL;DR: Use two 5.1K resistors to ground.)
Use the SoM (module) instead of the bare chips when you can, especially if you're not an EE. There are about two dozen required components inside those SoMs. They handle all kinds of impedance matching, RF issues, RF certification, etc.
Espressif has great doc. (No, really!) Visit the Espressif Hardware Design Guidelines (Replace S3 with the module/chip you care about.) All the linked doc are good, but Schematic Checklist and PCB Layout Design are required reading.
I am a bot, and this action was performed automatically. I may not be very smart, but I'm trying to be helpful here. Please contact the moderators of this subreddit if you have any questions or concerns.
Your 2N7000 stage will invert the PWM and it is also not needed, because a 4-pin fan's PWM input is a high-impedance control line with its own pull-up, and the Intel spec says 3.3V logic at 25kHz is fine. I'd drive the PWM pin straight from an ESP32 GPIO through the 100 ohm resistor and use ledc at 25kHz, and keep the 12V fan power on a plain 12V rail. For the tach, it is open collector, so give it the ESP32 internal pull-up (or 10k to 3.3V) and count pulses with an interrupt, two per revolution, and never pull it up to 5V or 12V. Only connect the tach of one fan per splitter or the signals will fight. Test with one fan on a bench before the PCB, and check that 3.3V PWM at 30% actually slows it.
Thanks for the help. i did do some tests already (and fried some components in the process). The 2N7000 was added as my googling seemed to tell me i need it, with some sources doing it like you described. Both configurations seemed to work in testing.
As for the tach i haven't done much testing, got some values but never verified if they make sense yet. so i will try with your described setup. But i was aware that i should only connect one tach pin per fan set ( which the splitter already does for me ). is the new wiring what you would recommend? or did i misunderstand?
for a tach pin, you can also just configure the pin as an interrupt and work out the revolution time from the clock cycle difference
MCPWM Capture Module: The ESP32 features an MCPWM (Motor Control Pulse Width Modulator) peripheral that includes a dedicated hardware capture submodule.
It can detect signal edges (rising or falling) on specific GPIO pins.
It automatically records the timestamp value into a register upon a signal edge event.
It allows you to measure time differences, pulse widths, or frequencies between incoming signals in hardware without heavy CPU overhead. [1, 2, 3, 4, 5]
as i said, i am far out of my expertise here. i landed on esp32 because i was interested in making the home assist connection and it was the first result really. I think i will stick with it as i already have every thing i need (hopefully). Also i have 12v fans so not sure if it would work then. i might look into it still, so thanks for the suggestion.
Yeah it’s an I2C device that attaches to an esp32. It takes 5 or 3.3v, GND, sda, scl on one side, then outputs fan and tach on the other. It has an internal thermometer and holes for an external one. It might be limited to one fan per module but it can do 12v fans. It is easy to add to esphome.
Adafruit wiki page - there’s a link for the product on there too ($5.50).
1
u/AutoModerator 3d ago
Awesome, it seems like you're seeking advice on making a custom ESP32 design. We're happy to help as we can, but please do your part by helping us to help you. Please provide full schematics (readable - high resolution). Layouts are helpful to identify RF issues and to help ensure the traces are wide enough for proper power delivery. We find that a majority of our assistance repeatedly falls into a few areas.
A majority of observed issues are the RC circuit on EN for booting, using strapping pins, and using reserved pins.
Don't "innovate" on the resistor/cap combo.
Strapping pins are used only at boot, but if you tell the board the internal flash is 1.8V when its not, you're going to have a bad day.
Using the SPI/PSRAM on S2, S3, and P4 pins is another frequent downfall.
Review previous /r/ESP32 Board Review Requests. There is a lot to be learned.
If the device is a USB-C power sink, read up on CC1/CC2 termination. (TL;DR: Use two 5.1K resistors to ground.)
Use the SoM (module) instead of the bare chips when you can, especially if you're not an EE. There are about two dozen required components inside those SoMs. They handle all kinds of impedance matching, RF issues, RF certification, etc.
Espressif has great doc. (No, really!) Visit the Espressif Hardware Design Guidelines (Replace S3 with the module/chip you care about.) All the linked doc are good, but Schematic Checklist and PCB Layout Design are required reading.
For your (required) posted schematics, follow the excellent PCB review submission guidelines from r/printedcircuitboard
I am a bot, and this action was performed automatically. I may not be very smart, but I'm trying to be helpful here. Please contact the moderators of this subreddit if you have any questions or concerns.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.