Go Down

Topic: speed control of ceiling fan using digital Potentiometer  (Read 4937 times) previous topic - next topic


Reverse engineer the circuitry with a DMM?

You are fortunate enough to have a fan that has it terminal connections labeled and a capacitor pack with a circuit diagram on its side.

That way you would have a reference to connecting  relays to your remote system.

Ok my thinking is that the gray wire going directly to the reverse switch eventually makes it's way to primary coil
Reverse swirtch ? ? ? ? ? ?
Primary Coil? ? ? ? ?

Now I am having some problems with the purple, brown, gray wires going to switch.  And how to include them in my electronic relay.

Just get the DMM out and start checking.

Tom..... :)
Everything runs on smoke, let the smoke out, it stops running....


primary winding sorry -- I believe there are two primary and secondary.  Correct me if I am wrong :)

Yes the fan has a reverse switch, which after some study it indicates to me that the pink and yellow wires are going to the primary winding +/- or however each end is marked.  The reverse switch just changes the polarity of the wires.  Which I have learned I can do with two solid state switches (so i will have a reverse button).

My question wasn't which wire was which capacitor that is on the side of the caps pack.  My question was how to exactly wire the switches so the intended action happens when I activate each switch.

It was kind of a math problem with colors and on/off states.  I will show you what I came up with and you can tell me if you think it's right. (download image I can't get this one big enough to see)

Ok here is my thinking..

All switches off power flows from house directly to gray from caps pack without any capacitors.  This should power the motor with the 4.5uf red wire from caps pack that is not switched but always connected (low).

Switch 1 and 2 on 3 off power now flows from house to purple to gray from caps pack this should include the 5uf capacitor giving us 9.5uf total and a higher speed (medium).

All switches on power now goes from house to purple to brown to gray from caps pack includes all caps and should have 15.5 uf an a higher speed (high).

I wanted to do it with 2 switches and I don't like connecting the gray in two places but I couldn't figure out a better way to do it. (I am guessing you guys have a better way??? or not :) )

I only have 2 switches right now so I may not be able to set the whole thing up (I have more switches coming tomorrow)

I also want to add that these switches are just for prototyping and the final product with be switched with solid state zero crossing optocoupler/triac 3162M's to make it all nice and safe and UL approved


I attached picture of switches if it's easier to read that way


Can I suggest you do your diagram in pen/pencil and paper and post a picture of it.
Include the Caps pack not just wire names, the pack has a diagram on it, and the motor windings and where the mains power is attached.

Is that diagram the original wiring or your idea of what you need it to be?
We need to see how the original circuit was configured.

Tom.. :)
Everything runs on smoke, let the smoke out, it stops running....


there is a picture of the caps pack and the mechanical switch on post #28 that is why I assumed the wire names would be sufficient.

I have tried to get a schematic of the mechanical switch to no avail.  As you can see from the picture of the mechanical switch.

Position one - Gray wire from caps pack.
Position two - Brown wire from caps pack 6uh
Position three - Purple wire from caps pack 5uh
Position L - Black wire from house electric.

After much study regarding this type of setup I concluded that the mechanical switch is connecting the L (black from house) to Gray (one of them) from caps pack.

So my position one connects black to gray without any switched capacitor (however as I have stated before there is a red 4.5uh cap from the caps pack that goes directly (no switch) to the motor)

My position two I swapped what the mechanical switch had I went with adding purple 5uh wire (cap) in the circuit.

My position three adds the final brown 6uh wire (cap) in to the circuit.

I am doing this by setting up my switches (3 of them) as I indicated above so when the proper combination of on/off is set I am duplicating my interpretation of what the switch was doing.

For my first attempt I am going to leave the reverse switch as is and in the system.  I will attach a picture of it.  It is a 6 place switch top set of two and bottom set of two are mirror images.  (pink on left yellow on right --- pink on right yellow on left) the middle two are the other gray wire from caps pack and a white neutral.  It is my opinion that this switch reverses the polarity of the pink and yellow wires to achieve the ability to change direction of the motor.  (which I will do with two switches later in the project)

I cannot get into the motor to see for sure what is going on, however, I believe from my research that I am correct in how the mechanical switch was operating.

I hope that helps



Not sure what the procedure is (new thread or bring this one back to life), I had to put this little project on the shelf while I worked on something else that needed to be done quickly as possible.

I'm back ready to finish this one now.  I have the MOC3162M zero crossing optocoupler.  However I do not have any experience with these so my first attempt will be done with 3 relays of a 4 relay module.

The fan I was using before was getting in the way and since they are very cheap I threw it out and I have a different fan.  However the guts are close to the same just some different color wires from the caps pack.

Now the entire idea of this project is to replace the mechanical pull chain switch with an electronic switch I can control with a mobile phone.  

I attached some files, a word doc with the proposed switch set up, picture of the relay module, picture of the MOC3162M and a picture of the invoice for those (make sure I have the ones recommended earlier in this thread).

If anyone has any links to a project using the MOC3162M's that would be great so I can see how they work.


Quick question .....

I almost have the setup done, however testing this seems like it might be a bit tricky.  From what I understand without the load the caps setup will not work.  And without building a framework to hold this thing testing it with the fan blades on seems a bit tricky.  any one have a way of simulating the load (no fan blades)so I can tell if the switch is working.



Good Morning,

Double checking the switch set up and it seems my first crack at it may be incorrect.  I am hoping someone will actually answer this one.

I have included pictures of the caps pack and the original pull chain switch.

My understanding is that as you pull the chain the switch is connecting another capacitor to the system (not switching from capacitor to capacitor)  


1. Red (4.5 uF)  this does not go through the switch and is always connected

2. Purple (5 uF) this goes into the #2 slot on the mechanical switch

3. Yellow (5 uF) this goes into the #3 slot on the  mechanical switch

There are two Orange wires coming out of the left side of the caps pack.  One of them goes to

4. Orange () this goes into the #1 slot on the mechanical switch.

5. Orange ()  this does not go through the switch and is always connected

I have tried to get schematics of the mechanical switch to no avail.  I believe that the two orange are what I would call an (power in and power out) of the caps pack.

The mechanical switch has house Load (black) coming in so the main power is routed through the switch and in my opinion through a certain number of the capacitors depending on the setting and out through the other Orange out to the Motor


found this but the load and gray from this schematic are reversed on my fan


I am going to set my switch up using this diagram.

Low (Load and #3 9uF)
Med (Load, #2 and #3 14uF)
High(Load and #1 4uF)

I would love someone to explain to me why 9uF is Low and (14uF) is Med and (4 uf ) is High.

I am going to have to mount the fan on little home made fan stand so I will check back before testing to see if there are any observations or explainaitions


Ok this is a hand written schematic of how I will set up the three switches

I think the logic is correct please let me know



Well I guess I am just keeping a diary to myself......

Setup Complete

NodeMcu 1.0 12E
Synapses RF200P81
Sunfounder 4 Relay Module

NodeMcu connected to mqtt responding to commands from mobile phone connected to same mqtt. 

NodeMcu also connected serially to RF200P81 -- (in finished project nodeMcu will not be connected to this RF200p81 but to another one acting as bridge and communicating using RF for this chip and for entire system Led lights etc.)

Synapses GPIO 2, 5, 6 switching Sunfounder Relay as shown on drawing above.

I'll let you know


Not sure why no responses.....

for clarity sake the setup works perfectly low, med and high work as expected

Link to video showing results



This is exactly what I've been trying to figure out how to do! Did you ever end up getting it to work wirelessly?


Yes built a working prototype, but I got busy on another project.  The only problem with my setup is you have to put a new pcb in the fan (it works takes about 10 minutes)  but I found a device on the market that lets you control the speed by just plugging the fan into it and then plug that into the wall (no need to open up the fan).  I was close to prototyping that but like I said I got stuck working on something else.


Just registered.

I'm doing exactly the same as you, trying to switch fan speeds from a Raspberry. My fans (actually every fan I've had) uses capacitors for speeds, but maybe that's usual here in Spain and not so much in USA.

So, I've come to exactly the same schematics as you, one relay for each capacitor. It's running for about three months now.

I have one advice for you... relay contacts, over time, get stuck. I guess it's related to the capacitive/inductive load.

If I can get the photo attached, you'll see left to right: the two capacitors block, relay for fullspeed direct connection *, relay for medium speed, relay for low speed *, and a push switch to tell the raspberry to change the fan speed (usually it's in 'auto', meaning speed is determined by temperature and movement detection)

*=lower left cable disconnected bc relay is stuck

I've ordered a 4 way solid state relay, 16€, that will arrive on Monday. I hope the integrated zero cross detection and snubber circuit can solve the problem with contacts that stick.

Uhm... here I have 240v AC, maybe with 120v you don't have those problems.


Solid state relay received, and working as expected.


Solid state relay: https://www.amazon.es/gp/product/B01I3OUYWS/ref=oh_aui_detailpage_o01_s00?ie=UTF8&psc=1
16.99€ with Prime service overnight. Available on multiple sites for much less, but waiting more. As cheap as 3,92€ on aliexpress.

I'm posting this here because, as the OP, I didn't found useful info on Internet about this topic. Just advertisements about this being dangerous. Or, "buy a fan with a remote and...". The boring way.


Welcome to the forum.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Can you post your code so it may help others wanting to accomplish a similar project?

Thanks.. Tom.. :)
Everything runs on smoke, let the smoke out, it stops running....

Go Up