DIY 2ch PWM Fan Controller (PIC)The device is capable of controlling two independent PWM FAN output channels either in manual or auto mode. The sensors are TCN75A type, or anything else with similar I2C data format and initializing scheme. The code is compatible with 0.91in, SSD1306, 128x32px OLED displays.
/?action=dlattach;attach=2623671;image)
Specifications:
Input Voltage: 12VDC ±5%
Current consumption: cca 20mA, plus fans
Outputs: max 300mA/ch
Temperature range: 0-99.9°C,
Measurement resolution: 0.1°C
Setting base unit: 1.0°C
Beside the mandatory min/max temperature points, you can set an additional one in between, with its related PWM values. The graph max. steepness is moderately restricted by code, though you can override it in the .hex file.
Officially a PWM fan can behave three distinctive ways when the received PWM value is below 30%. Sometimes a hard swith-off is not achievable, unless its 12V power rail is severed. That is why that extra NPN/P-ch combo is implemented.
/?action=dlattach;attach=2623675;image)
We tried to use ordinary, radioshack components with extended leniency in terms of given values, therefore it can be used for clean-up our jelly bean comp. containers as well.
Only two elements are somewhat critical. C40 (and C50) are on the open collector TACH output line of the fan, therefore take the suggested 10nF as a max. value. Actually, less than 2.2nF is pretty adequate for most cases.
The other is the output FET. Double check its max gate-source voltage value and power dissipation when you substitute them.
Our implementation of PWM topology in a small scale deviates from the white paper at one point. The TACH pull-up resistor should be on 12V, but we rather tied it to the 5V rail, as it is a bit more safe. (Never run into any problem doing so.)
Sharing the I2C bus between display and temperature sensors is bringing a couple of paradoxical issues. First and foremost, the OLED modul has its own pull-up resistors tied to inner 3V3. To achieve seamless operation beyond the lab bench, the TCN75As got their own 3V3 VREG to avoid the otherwise mandatory level shifters. The uC port has set to SMBUS mode, therefore it is able to handle 'reduced logic levels' perfectly fine. The other issue is with bus speed. For smooth, lag-free appearance, it is preferable to clock it with 400kHz, though the temp.sensors would be happy with much less. The increased self heating effect is not a big deal in our case, but as a potential RF emitter with its elongated wire harness would be benefited with a much slower clock.
Just for fun, we carried out a hasty ’RF immunity compliance test’ with a hand held radio transmitter, setting 5W output power @ 434MHz. With distance more than 15cm between the wires and the transmitter antenna, the I2C communiation went without any hiccup. At about half a watt, we had to wind the cable around the antenna to be able to corrupt the data (ribbon cable lengths was 20cm + 100cm).
All passives are 0603in size, unless noted otherwise. The VREGs are legacy types, their thermal pads are on 0V, so the ground plane is utilized as heatsink. Before you are planning to supply anything else from their power rails, please take into considerations their curbed capabilities.
The programming header is a 1.27mm pitch pinheader from Preci-dip (850-10-050-10-001101 ). Its mating receptacle is not necessarily populated on the PCB, just simple inserting the pinheader into the bare footprint will do the job (tested thousand times). For our average purpose, it takes up the least amount of real estate around the uC…
The PCB artwork contains no features with extra charges. It is a humble, 2ly, 6/6mil design with 0.4/0.85mm VIAs, nothing beyond the basic capabilities in Asia.
/?action=dlattach;attach=2623679;image)
Top layer designators for assembly. The D21 Error-LED is on the opposite side, not shown here.
(The bottom layer is almost exclusively a 0V reference plane)
Mechanical considerations:
The four mounting holes at the corners are for M2 fasteners (D2.3mm). The PCB should be standard 1.6mm (62mil) to avoid flexing when buttons are pressed.
The reduced overall size of the device allows to built it onto many small-ish enclosures.
Tactiles intended to use as they are, without added caps/buttons, providing the frontplate thickness is around 1.5-2.0mm. Tactile actuator stem diameter is usually around 3.5mm, and comes with 9.5/13/17mm length (B) measured from the PCB, as most common.
/?action=dlattach;attach=2623683;image)
Suggested mechanical stack-up
/?action=dlattach;attach=2623687;image)
PCB-related mech. dimensions
Misc:
If you press all three buttons at once during power up, two additional service menu items can be reached. The first one determines the default display orientation (0° or 180°), with 4 additional corner grapic element, serving as helpers to measure back the display useful area for precise front plate cutout position. (Time to time manufacturers change it a bit.)
The other one is swapping the up/down tactiles function.
As the display utilizes OLED technology (and because of its origin and price), it can wear out quickly. Hence using the display timeout feature in the menu is advisable.
Error handling:
If either Temp.Sens unit ceased to provide data, the other one will take the lead and sources data for both PWM control algorithm. In case of both TCNs are unoperational, the device goes back to manual mode.
If the display loose its conection, the uC tries to reinitialize it. Till then, the 'hidden' D21 LED is flashing. (Additional PTH pads are provided for wiring if you wish to mount it on the front plate.)
During normal operation, try not to disconnect neither display nor sensors.
Those who are concerned about nearby electrostatic discharge or direct hit via the tactiles (because of certain mounting technique in mechanical implementation), use the shielded version of 6x6mm FSM series switches, the footprint accomodates that fifth grounding/shielding terminal too. (Especially when decide to use the shortest, 0.7mm stem length version (A) with added metal buttons!)
TempSense PCB:
MSOP package and 0603 passives are chosen for small overall size. 0402 are a bit too finicky to solder by hand in a streamlined fashion. To save space further, setting its address is confined to 0x000 or 0x001.
The flooded bottom layer together with the sole M3 mounting hole are isolated from the active circuit area. (Creepage distance is only about 1.2mm w/o washer.) They provide better heat transfer and a more rapid response.
BOM:
The values of passives are subject to change at your wish (way beyond their average 5-20% tolerance) without paying the penalty.
A few exceptions are:
• R23/24/25 which tame the max current through the clamping diodes of the uC inputs
• R41/51, as with reduced values will increase the burden on VR1 when the given chanel is ON
• substituting the D1 Si diode with schottky, please be aware that some device has ridiculously high reverse current
• and the aforementioned C40/50
There are certain modifiable areas in the EEPROM where we can slightly alter the overall behavior. Since they are not subject to change during everyday use, we thought it is better to save space not placing them into the user menu structure.
(This content is under Creative Common licence.)
Gerber and BOM download:
Link