Server fan controller and watchdog project - Page 1
Forum section: electronics / projects

author: McMonster
author_rank: Frequent Contributor
timestamp: February 28, 2012, 10:36:46 pm
content: I'm looking for some advice on a project. It is a simple fan controller with 1-wire temperature sensors for my home server machine with some watchdog functionality to power the machine back on after power failure or when it crashes. The main blocks are MCU with 3 V battery backup, serial interface with MAX232 for server OS monitoring and control of the fans, 4 logic-level mosfet fan drivers, a 1-wire bus, motherboard connector and main power from standard ATX power supply connector.What bothers me is mostly the power supply. Here I've used a Schottky (with lowest Vf I could find) diode-OR circuit for 3 V battery and 5 V line from ATX, but it has some drawbacks, mostly with interfacing to other circuitry that's not powered through the same diode (I only want and need MCU to be backed up) and hence working on a bit higher voltage. I put resistors and let AVR's embedded clamping diodes do the rest in places where it matters (1-wire bus and serial RX signal, TX input high level is well inside MAX232's specs) just to be on the safe side. Will it work as I expect?Among less important things are resistor values and fan and molex connectors pin orientation, those are always giving me a headache.PS. Strange electrolytic capacitor symbols are the effect of a bug in KiCAD SVG export function, they look fine everywhere else. There's also OSHW logo that's supposed to be larger and in a different place. Any KiCAD devs here?PS2. I have two free I/O and one ADC pin left, any interesting ideas for those?

author: Unknown
author_rank: Unknown
timestamp: February 28, 2012, 10:57:23 pm
content: http://geoffg.net/fancontroller.html

author: McMonster
author_rank: Frequent Contributor
timestamp: February 28, 2012, 11:16:12 pm
content: Quote from: Uncle Vernon on February 28, 2012, 10:57:23 pmThanks, I wasn't looking for any existing devices like this, I just wanted to design something myself.

author: Unknown
author_rank: Unknown
timestamp: February 28, 2012, 11:42:01 pm
content: Quote from: McMonster on February 28, 2012, 11:16:12 pmUnless you wish to reinvent the wheel for reinventions sake, couldn't you perhaps find some good ideas from other proven designs?

author: McMonster
author_rank: Frequent Contributor
timestamp: February 29, 2012, 12:04:09 am
content: I do electronics for fun and I wanted to design something from scratch for both practise and practical use, so reinventing the wheel is acceptable for me. It's surely overengineered, but if it's likely to work, then I'll be happy with that.

author: gxti
author_rank: Frequent Contributor
timestamp: February 29, 2012, 01:12:48 am
content: Overengineering is the best kind of engineering. Maybe I'm biased, because I made a fan controller, too...Are you PWMing the fan outputs? Because if you are, and you're switching the ground leg of the fan, the tachometer output will be garbage. But just switching on and off (slowly of course) will work fine, as long as you don't read the tach while it is off. You also may want to add a RC filter to the tach line to kill the noise. 3.3K/1n worked well for that purpose in my testing.Your battery domain looks fine. A schottky diode drop isn't going to make a difference, but if you're paranoid you could use another diode to feed all the other parts except the fans so that the voltage is equal. Speaking of fan voltage, why not use 12V? Most fans expect 12V, and you'll get better results with a 12V silent fan than by undervolting a faster fan.

author: TerminalJack505
author_rank: Super Contributor
timestamp: February 29, 2012, 01:30:44 am
content: I don't see any glaring problems.I wouldn't use PWM for fan speed control but that's just a personal preference.I'd feel a little better if there was more than just 10uF of bypass capacitance on Vcc.So far as having issues with Vcc being a diode's drop above MCU_POWER, I'm like you--I don't know if that will be an issue or not. If you're really paranoid about it then you can use an OR-ing controller IC like the LTC4412. It uses MOSFETs instead of diodes so there's practically no difference between the two voltages.The first attached circuit is a snippet from one of my projects.You could do something similar. You wouldn't have the power jack or regulator obviously. Your Vcc would then be VREG in my schematic. Your MCU_POWER would be my Vcc. So you'd have something like the second attachment. (I haven't figured out how to put images in-line.)IC4B and IC5A look like they are backwards but that's how they need to be wired-up since the OR-ing controller IC relies on those parasitic diodes so that it can be powered. IC4A isn't strictly necessary and you may not need it for your application.Edit: Whoops. Somehow my two attachments got out of order.

author: Unknown
author_rank: Unknown
timestamp: February 29, 2012, 01:42:16 am
content: Quote from: gxti on February 29, 2012, 01:12:48 amOverengineering can hardly be considered engineering at all! perhaps you meant Overdesigning.

author: McMonster
author_rank: Frequent Contributor
timestamp: February 29, 2012, 01:44:33 am
content: Thank you for suggestions. It was my error, that should be 12 V for fans. This OR-ing IC looks nice, but it's 6$, so I'll keep the diodes.

author: TerminalJack505
author_rank: Super Contributor
timestamp: February 29, 2012, 01:46:24 am
content: Quote from: McMonster on February 29, 2012, 01:44:33 amYou should be able to get it cheaper but I'm sure you'll be fine as-is.

author: McMonster
author_rank: Frequent Contributor
timestamp: February 29, 2012, 02:13:44 am
content: Quote from: Uncle Vernon on February 29, 2012, 01:42:16 amI just had to start with something to get some practice. I won't learn much by looking at other people's designs without trying to do my own.

author: Unknown
author_rank: Unknown
timestamp: February 29, 2012, 02:23:57 am
content: Quote from: McMonster on February 29, 2012, 02:13:44 amYou'll learn even less by ignoring the work, both good and bad of others and devoting your time to reinvention.

author: TerminalJack505
author_rank: Super Contributor
timestamp: February 29, 2012, 02:53:32 am
content: Quote from: Uncle Vernon on February 29, 2012, 02:23:57 amPeople "reinvent" (a truly misused term) things to feel better about themselves. It helps them feel productive. It helps them apply what they have learned.99.99% of what anyone will ever do has already been done by someone else. If a person were to take your advice then they would producenothing.Never, never, never tell a so-called peer that what they are doing isn't worth doing simply because it has already been done. You ALWAYS encourage your peers.Always.

author: Unknown
author_rank: Unknown
timestamp: February 29, 2012, 03:19:01 am
content: Quote from: TerminalJack505 on February 29, 2012, 02:53:32 amSo it achieves nothing of consequence.QuoteApplied ignorance! There's a good one. Have you considered politics? There is always a vacancy there for that kind of skill set.QuoteMakes it kinda dumb to be doing it the hard way then, doesn't it?QuoteOn the contrary, the survivors of our species were those who learned from the success and failures of others and adapted accordingly. By your way of thinking every man should have a lion chase him just so they can determine for themselves that they may get eaten.QuoteI never never told anyone anything of the sort! Since your slow on the uptake what I suggested was that it would be advantageous to consider the merits of of how others have approached similar problems.QuoteQuite right. And about now I am encouraging you to pull your head in and stop demanding how I or anyone else should conduct themselves. If you are too stupid to comprehend the difference between suggestion, opinion and demand then you are unlikely to gain much from any sensible conversation.PS: If you must invent your own wheel, round would be a shape worthy of consideration.

author: TerminalJack505
author_rank: Super Contributor
timestamp: February 29, 2012, 04:10:26 am
content: Uncle Vernon, sorry if I came across as a crank. If you truly thought you were being helpful then I suppose I just misunderstood. I have a big pet peeve about people who actively discourage others.If you feel there is something wrong with the OP's schematic then, by all means, share it with us. I'm sure the OP would love to get all the advice he can before he actually builds his project.

author: TerminalJack505
author_rank: Super Contributor
timestamp: February 29, 2012, 08:26:45 am
content: One other thing, since those motors are inductive loads, don't forget to put flyback diodes across the terminals leading to your fan motors. (Terminals 1 & 2 of connectors K1, K2, K3 & K4.)

author: DrGeoff
author_rank: Frequent Contributor
timestamp: February 29, 2012, 10:15:19 am
content: I'd question the wisdom of having a server health monitor being monitored by the server whose health is being monitored. It should be completely independent. Why not add an ethernet port to it?

author: McMonster
author_rank: Frequent Contributor
timestamp: February 29, 2012, 12:03:25 pm
content: @Uncle VernonYou're right that I should check existing work on this topic and I didn't look for existing MCU fan controllers with temperature feedback as a whole device and I thank you for suggestions. I did learned something in the process though, like dealing with MOSFETs, power dissipation, motor PWM control and a bunch of different topics, so this wasn't reinventing just for reinvention's sake.Quote from: DrGeoff on February 29, 2012, 10:15:19 amThis device can in fact work independently, it has its own power source (since fans, serial and temp sensors only need to operate with a powered PC there's no point not to power them from the same source and have just the MCU on backup) and own logic for fan control. I can use serial port for the bootloader, tweaking some parameters (like implementing a PID in AVR and remotely changing it's parameters) if I want and it was simple to add it to the circuit. What I need from the PC side for watchdog functionality is just some way to indicate normal operation like a simple message to MCU and predefined intervals. When the PC fails to report on time, then reset it. Or I could even write some more advanced algorithm using current server load information or anything else an AVR could handle.

author: LukeW
author_rank: Frequent Contributor
timestamp: March 02, 2012, 05:08:17 am
content: Personally I dislike any new electronic device designed today which uses an RS232 serial interface, unless it's specifically intended to interface to an existing old legacy hardware over an RS232 interface.For a basic interface to a PC I would strongly recommend using a USB interface, even if you're using an FT232 (or similar) USB virtual UART bridge chip (you don't have to change the whole microcontroller system to a different microcontroller with USB onboard).Even if your computer still has an RS232 port, using USB means that you can reproduce the same system for use on any other computer, or anybody else you give the design to can use it on their computers, without headaches on most computers that don't have RS232.Dallas OneWire temperature sensors (eg. DS18B20 or similar) are relatively expensive for a temperature sensor, they're approx. several dollars each usually. Unless you specifically need to have a multi-drop OneWire bus using multiple sensors bussed together with just a couple of wires I would recommend considering changing the temperature sensors to a "dumber" sensor device as this will mean significant reductions in BOM cost.I'm pretty sure (from vague memory) that there are some chips on the market (from Microchip for example) that are specifically designed for control and health monitoring of small DC brushless fans such as computer fans, they can automatically generate an interrupt output if the fan fails and they can do speed control without sacrificing speed monitoring, stuff like that IIRC.

author: McMonster
author_rank: Frequent Contributor
timestamp: March 02, 2012, 09:15:25 am
content: Quote from: LukeW on March 02, 2012, 05:08:17 amThis device is designed with a particular machine (or with particular segment of older PCs) in mind, that's why I used MAX232. FT232 is relatively expensive.QuoteIt's just 1.45$ for DS18B20 comparing to 1.16$ for LM35DZ in a local shop. But I originally used 1-wire sensors because I was short on free pins in early versions of this design, so replacing them will save me some flash and headache with matching a particular DS with a particular fan and that's what I'll do.QuoteSuch chips are usually not possible to get from local distributors and bigger ones, like Farnell don't really support hobbyists, they have a minimum order of 100$ for individuals here. Not to mention that the shipping rates to Poland can throw you off your chair.

author: SgtRock
author_rank: Unknown
timestamp: March 05, 2012, 03:25:56 am
content: Dear McMonster and Terminaljack505:To McMonster:--I found your post interesting and enlightening. I understand exactly what you are doing, in trying to design your own custom fan controller. If you design it yourself, it will work exactly as you want, and you will not have to conform your wishes to the features of a purchased device. This kind of determination, is part and parcel of Engineering I am sorry that you were discouraged and called stupid. Dave keeps trying to get more beginners to join, and, mores the pity, a couple of our members keep trying to get them to go away. I completely understood what you meant by "over-engineered", it is not like no one ever heard it before. It is a very common phrase. If everyone took some of the advice you were given, no child would ever build his own radio, or anything else.** rest of inflammatory post deleted by moderator **"He was born ignorant, and has been losing ground ever since."Fred Allen 1894 1956Best RegardsClear Ether

author: NiHaoMike
author_rank: Super Contributor
timestamp: March 07, 2012, 05:29:02 am
content: One of the main limitations of every variable speed "smart" fan I have seen is that they work after the fact - they react to the components heating up. I have a design for one that uses a predictive approach - it senses the power usage of the system and would rev up in advance when it detects an increase in power. My design happens to have a power measurement shunt for other purposes, but an accurate sensor is not necessary for good feedforward - sensing the DC voltage drop across a power supply inductor or piece of wire works well enough.I'm doing this because Intel's Turbo Boost (automatic overclocking) partly relies on the CPU being cool to stay in boost. A traditional feedback control would have a thermal delay, but sensing the power for doing predictive control is almost instantaneous. And that can add up to more time in boost and greater perceived performance. (Yes, I'm overengineering it since I could just run the fan at full speed all the time, but smart fans are standard nowadays and I would like to demonstrate one done right.)

author: McMonster
author_rank: Frequent Contributor
timestamp: March 07, 2012, 04:13:05 pm
content: Quote from: NiHaoMike on March 07, 2012, 05:29:02 amInteresting approach, haven't though of that. My general idea was to use a PID or other kind of advanced algorithm. I'll have to poke around with a multimeter and some shunt resistors (got some 5 W 0.1 Ohm for that) to see what contributes the most to power usage and how the power usage patterns look like in "production" conditions. Still got one ADC pin left and haven't started laying out the PCB so I might just put an opamp and a connector for shunt resistor and be able just to play around in software to get the best results. I don't expect sudden changes in CPU load with this machine though, but thank you for the idea.

author: SeanB
author_rank: Super Contributor
timestamp: March 07, 2012, 08:36:54 pm
content: If you want to sense the return current ( and are not too worried about accuracy or linearity) use a voltage divider of say 1k and 100R to sense the drop across the one ground lead to the PSU from the CPU power connector. Connect the bottom end of the resistor to the negative lead near the PSU, and read the common connection of the resistors. Use the end nearest the CPU to connect the monitor to the PC power rail. Will be a low voltage that drops as current increases, but is cheap and needs little in firmware. Will probably need calibration for each board if production unit, but you can just use power up value and go from there. Will be noisy, and the range will be only a few dozen counts from zero to full power draw, but cheap and quick, with minimal modification to the motherboard, other than needing to have a connection to both ends of one wire from the PSU.

author: NiHaoMike
author_rank: Super Contributor
timestamp: March 08, 2012, 02:01:30 am
content: You can apply a low pass filter (1Hz or less cutoff) to make the noise nearly zero. The fan cannot rev up or down that quickly so any faster is a waste unless you have another use for it. My design would be sampling at 15Hz or so (actually faster to use oversampling) since the real time power display needs 15 FPS or so to look realtime.