The objective is to control the start/stop of this fan from a remote switch, activated by presence of people in the room and/or passing through a door.
Note: I think that the underlying spec is "presence of people", but it is said as "people getting in/out", "door open/closed". If we have 2 persons getting in and 1 getting out, the 1 remaining will have the fan switched off in the latter case. But "presence" is difficult to detect because any sensor will flicker when people are moving, so needs much more logic. Let's go ahead with in/out+door that is manageable.
The fan is activated by a push button that has 1 rest position and 1 momentary closed. Somewhere inside there is a circuit "counting" the pulses, first on, second off, third on, and so on. We must replicate this behavior with the external sensor+switch.
- To check how the push button is connected inside the fan: I see a "ST" wire, so it will be shorted to GND or VCC, and read by some logic inside (let's call it a "micro"). To check with multimeter if it is ST+GND or ST+VCC (or in case it is snot ST which wire).
Now the external switch must replicate this. The internal push button will be removed and two wires connected and driven as needed. We need a pulse (duration the time you take to press the original button), but I think it is the rising (or falling) edge that is sensed: so, pulse GND-VCC-GND (or opposedly VCC-GD-VCC, as said, to check) of limited duration (a fraction of second, or so).
The IR switch will close when someone is passing and will last for some time, not clear how long, especially if someone stands in the door, moves slowly, etc. If the IR switch sends a pulse every time the fan will start and stop too frequently: I suggests a led or light to warn not to hang around at the door.
The IR switch will receive two wires, ST and VCC (or GND). When it activates it must last for T seconds, with T possibly in the range 0.1-1. What happens is that the IR switch could switch for less time if the person is walking fast (ti-tlick, gone). So we need to capture short pulses from the IR switch (e.g. walking/running 1-2 m/s, the barrier (10 cm) is traversed in less than 5-10 ms).
This is the job for an "monostable multivibrator" such as the 4047 device: you get pulse in non shorter than e.g. 1 ms, and you get an output pulse guaranteed for at least 1 s.
- we want monostable: so pin 4 (!ASTABLE) to VCC and pin 5 (ASTABLE) to GND
- R1 & C1 calculated for output pulse duration: tout=1/(8.8R1C1) so about R1=100kohm and C1=1uF (even R1=1Mohm and C1=100nF will work, so C1=C2 below)
- trigger is our input signal from IR switch, to dampen with an input RC low-pass filter; R2 and C2 can be assigned to make 0.5 ms time constant, so R2=4.99kohm and C2=100nF
- for termination of unused inputs see datasheet
Now you should find place inside the fan and you run 2 wires from the IR switch. If you can find a DIP IC 4047, you can glue it upside down on the PCB and the few needed components can be placed there as well. (no SMDs please :) )
Last minute note: a push button somewhere in parallel to the IR switch may be advisable to bring the fan in a known state, just in case something messed up.