12v DC Fan wiring h...
Clear all

[Solved] 12v DC Fan wiring help

New Member
Joined: 2 weeks ago
Posts: 1
Topic starter  

Firstly, thank you Kyle for all of your hard work and detailed explanations on the Automated Hyrdroponics project.  I've followed your guide almost to the letter and am very appreciative of your work.  

Secondly, I have built an enclosure for my hydroponics system and wish to add 2 12v DC 3-wire fans (1 intake, 1 exhaust) to the enclosure.  I understand I can use a GPIO on the  Raspberry pi4's to control the fan speed and switch these fans on/off based on environmental factors (too high heat, too low, etc.).  Where I'm stuck is that I am not knowledgeable about the electrical needs to wire the fans correctly and I believe I need to be concerned about the 12v passing back to the raspberry pi4 and that I should use some combination of transistors and resistors for this setup.  

My question is simply if someone could point me in the right direction to learn about what is needed to wire these fans up to the pi and have them controlled via Mycodo using PWM, or if someone knows of a schematic I could follow -- I would be very thankful.  


additional details:

1. Fans I have available are 2 each of https://smile.amazon.com/gp/product/B0837XYW9M/ref=ppx_yo_dt_b_asin_title_o05_s00?ie=UTF8&psc=1 or https://www.amazon.com/dp/B002YFSHPY/ref=cm_sw_su_dp.  

2. I am using a raspberry pi4

3. The DC power supply is 12v, 2A output: https://www.amazon.com/100-240V-Supply-Adapter-Switching-5-52-1mm/dp/B013HJI0Q6/ref=sr_1_10?dchild=1&keywords=cs-1202000&qid=1613350098&sr=8-10

4. I have barrel connectors and was planning to splice the +/- ends to a barrel connector.   

Kyle Gabriel
Member Admin
Joined: 6 years ago
Posts: 570
Posted by: @rockytfox

what is needed to wire these fans up to the pi and have them controlled via Mycodo using PWM

Here is a good tutorial for wiring your fan for PWM control. In Mycodo you would use the GPIO PWM Output to generate the signal.


Mycodo Developer