Using pwm input to control a relay

I am sorry in advance if this is not the correct forum for this subject. I am a beginner with arduino and I have a basic understanding of electronics but barely any information about programming. I am working on a project where I want to translate the output from the PWM pin on a computer cpu fan header and control 3 relays on different values of duty cycles.

To put it differently, I want to take the range of pwm output that goes to control a cpu fan and divide it into 3 relays which control the 'Low', 'Medium' and High ranges.

I understand if its not much to go with but I am willing to furnish any info that is necessary. Please help me out.

delve3844:
I am sorry in advance if this is not the correct forum for this subject. I am a beginner with arduino and I have a basic understanding of electronics but barely any information about programming. I am working on a project where I want to translate the output from the PWM pin on a computer cpu fan header and control 3 relays on different values of duty cycles.

To put it differently, I want to take the range of pwm output that goes to control a cpu fan and divide it into 3 relays which control the 'Low', 'Medium' and High ranges.

I understand if its not much to go with but I am willing to furnish any info that is necessary. Please help me out.

If you want someone to write code for you then you can hire someone in this forum:

Gigs and Collaborations

If you want help with coding then post your best attempt according to the forum guidelines and someone will be glad to help.

Read this before posting a programming question ...

If you send this


to a relay, what does your electronic experience tell you about how the relay will behave?

I assume OP wants to measure the duty cycle of a PWM input to the Arduino and translate ranges of duty cycles to determine which of 3 relays need to be energized.

Idahowalker:
If you send this


to a relay, what does your electronic experience tell you about how the relay will behave?

You need to read the OP post again....

He's wanting to take the PWM output from a PC, use it as an input to the Arduino, work out what speed the PWM is attempting to drive the fan at, use that to switch some outputs (which will be steady state unless the input PWM duty cycle changes) that drive relays.

First you need to work out how you are going to measure the incoming PWM duty cycle. There are a couple of ways..

  1. Measure the wave form by timing the high/low transitions
  2. Smooth the PWM waveform using a low pass filter (RC network) and measure the resuting voltage via an ADC input

pcbbc:
You need to read the OP post again....

He's wanting to take the PWM output from a PC, use it as an input to the Arduino, work out what speed the PWM is attempting to drive the fan at, use that to switch some outputs (which will be steady state unless the input PWM duty cycle changes) that drive relays.

First you need to work out how you are going to measure the incoming PWM duty cycle. There are a couple of ways..

  1. Measure the wave form by timing the high/low transitions
  2. Smooth the PWM waveform using a low pass filter (RC network) and measure the resuting voltage via an ADC input

OK. I don't really see any difference from what I stated other than you proposed ways to read the PWM. I thought you were implying the OP would route the PWM signal directly to relays, not a good idea.

If the PWM frequency is relatively low, then measuring the duty cycle should be easy for the Arduino.

ToddL1962:
OK. I don't really see any difference from what I stated other than you proposed ways to read the PWM. I thought you were implying the OP would route the PWM signal directly to relays, not a good idea.

Thank you for the info so far, I did some more research based on the replies and I will be using an interrupt based function to record the PWM values, then I will try to categorize them into three threshold zones corresponding to a defined relay.

Thank you for your response :slight_smile: