PWM detection + Timer circuit (looking for advice) - Page 1
Forum section: electronics / projects

author: Necate
author_rank: Newbie
timestamp: May 31, 2021, 12:59:23 pm
content: Hello everybody!I am trying to design a circuit that activates when a specific point during my PCs booting process is reached.When my PC is starting, the fan control PWM is at 100%, then it is lowered to what is specified in BIOS (temperature dependant). About 10 seconds after the PWM is lowered is when I need the high signal. (see attached picture)For the delay I am planning to use a Timer-IC (I have a ICM 7555 lying around), but I am struggling on how to detect the PWM change. I thought about trying to detect the falling edge, when the PWM changes, but I am not sure if that is viable/easy to do.Final note: I am a mechanical engineer, who sucks at electronics :|But that is precisely why I am avoiding microcontrollers here and make circuits myself if I can. I want to learn and improve.Thanks in advance to everybody who is trying to help!

author: Zero999
author_rank: Super Contributor
timestamp: May 31, 2021, 01:53:23 pm
content: What are you trying to do? It sounds like an application for a simple microcontroller.

author: DrG
author_rank: Super Contributor
timestamp: May 31, 2021, 02:39:21 pm
content: I would correctly identify and verify the pins on your fan cable (lots of info on line). Then I would buy / make an appropriate cable splitter (e.g.,https://www.amazon.com/Cable-Matters-2-Pack-2-Fan-Splitter/dp/B01DV1Z0Z4). Single end to MB, One split goes to fan other goes to your circuit.That gives you PWM signal and GND to neatly tap for your circuit. The first falling edge on the PWM pin is a trigger (assuming no initial chatter).Then I would use a microYou could even use the tach signal from the fan and you could play around with delays easily. An 8 pin pic could do this easily. If you wanted simpler programming a little picaxe is a micro that uses something like BASIC and has lots of support.But, they do need to be programmed....what is your circuit doing?

author: mrkev
author_rank: Regular Contributor
timestamp: May 31, 2021, 05:56:30 pm
content: Maybe a simple low-pass and a window comparator?

author: Zero999
author_rank: Super Contributor
timestamp: May 31, 2021, 09:37:15 pm
content: Quote from: DrG on May 31, 2021, 02:39:21 pmI would go for the PIC12F508, with good old assembly myself, but that's only because I have lots of them lying around and I've only ever used assembly to program a micro before. I'm sure there are cheaper, modern parts and would recommend a newcomer learn C, rather than assembly or BASIC, but that's just me. There's nothing wrong with BASIC. I learned it myself, but I think it made picking up C harder for me.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: June 01, 2021, 09:44:19 am
content: If you want to do it with analog stuff, then simplification is your friend.How much variation is there in your boot cycle?And how accurate timing do you need?Is it viable to just time the total time from power-on?Or use the computer itself for the timing.Start some kind of script that does whatever it is you want it to do.PC's have I2C busses you can hack into, or use an USB to serial dongle to interact with the outside world.

author: DrG
author_rank: Super Contributor
timestamp: June 01, 2021, 03:13:21 pm
content: Quote from: Doctorandus_P on June 01, 2021, 09:44:19 amI have heard of this...e.g., using unused vga port...have you (or anyone else) actually done it and found it to be practical?https://www.instructables.com/Worlds-Cheapest-I2C-I-Squared-C-Adapter/https://hackaday.com/2014/06/18/i2c-from-your-vga-port/

author: DrG
author_rank: Super Contributor
timestamp: June 01, 2021, 03:26:15 pm
content: Quote from: Zero999 on May 31, 2021, 09:37:15 pmYeah, I think any PIC12 would work fine...or a PIC10 (I have a few of those hanging around) as well as pretty much any 8 pin pic. I hear you on using asm, with the death of mpasm and the birth of as and my resistance to learning it, I would probably go to C.I don't know if the OP comes back and explains more details about what he is doing, but it sounds like:configure an output and an input GPIOwait for a stable PWM fan pin signal (empirically determined and assumed to be 100%)read input from fan PWM until low (first change from 100% to something lower)delay for 10 secondsset output signal high (to signal to your circuit)The OP said he sucks at electronics, I can relate to thatbut feel like I suck less at programming.

author: phil from seattle
author_rank: Super Contributor
timestamp: June 01, 2021, 04:20:35 pm
content: You don't say what you want to do when the 10 seconds has elapsed. That might change the answers quite a bit. But for now I will just go with you want a CMOS/TTL output signal - line raised to 5V, for example.While the proposed PIC solutions are fine, based on your "Mech E" descriptor, they are probably a stretch for you.I think the cheapest and easiest is an Arduino Nano ($3-5) - no programmer hardware needed other than a USB cable. Detecting when the PWM drops to, say, 50% isn't hard. You need to measure the pulse width and when it gets less than a certain length (i.e. time) you wait 10 seconds and output your signal. Plenty of internet examples of measuring pulses and delay of 10 seconds is pretty simple.

author: Necate
author_rank: Newbie
timestamp: June 01, 2021, 07:06:38 pm
content: Thanks for all your answers!- I want to use an analog solution (even though a pic might be easier).- The output will likely switch a relay, but I have to do some testing before I can say that with certainty.- I really like the idea of using a low pass, but still have to measure the duty cycle of the fan PWM.- And currently I am waiting for parts to proceedWill post more, when I have more info/made progress. (Planning to include my final working circuit when it's done, if people are interested.)

author: ucanel
author_rank: Regular Contributor
timestamp: June 01, 2021, 09:24:18 pm
content: After pc power up cyclewhat will happen if fan pwm goes full and down again?Would it be count again to generate second signal?If it works i did not think it throughly:take the pwm signal with a diode,feed it to a capacitor,so you converted the pwm signal to the Voltagethen compare it with using an opampand you generated your signal.

author: Necate
author_rank: Newbie
timestamp: June 28, 2021, 01:55:21 pm
content: So sorry for not giving an update for so long.I dug in whenever I had time and came up with something that almost works (see attached picture).Changes/Info:- The required signal changed to signal peaks on the rising and falling edge of the original signal.- These peaks were used to power a reedswitch, simulating a button press.- Since I had to switch also on the falling edge, I used an inverter I had lying around in combination with a P-Channel mosfet and a second Reedswitch. So a seperate little switch for both edges.- On a Restart, the PWM starts with constant 5V signal, but the 555 needs to be unpowered. Therefore a low-pass and P-Channel mosfet are used to unpower it in that case.Problem:- The switches are not triggered perfectly (sometimes switching twice or not long enough).- My poor little breadboard was bursting over with wires. So it is hard to say if the circuit is actually at fault or shitty connections :|- Everything was put together with stuff I had around and some components were certainly not the ideal choiceAlso the problem I wanted to solve got fixed by something completely different, so while it was a nice exercise I can't put more time into it to work out the last kinks, sadly. Hopefully somebody looking for a similar solution will find this useful.Thanks again to everyone who took the time to write an answer, I really enjoyed to tinker with electronics once again!