Solved Fan Speed Control with Counter
-
Update:
So I have the variable fan speed working now. I had to reverse the output (duty cycle) using a LIN or CNDR block (0rpm=100%, 2000rpm=0%) Not ideal but it works. How it's wired is shown below.
Current test program
I still can't get the tachnometer working though. So any ideas or things people can see I've done wrong. I just don't even get a value to post process into RPM.
Cheers
Mike
-
@mikeyh
Hi Mike,
have you tried if the Monarco counter works if you connect some voltage directly to DIN1? What is the voltage at the tachometer output?
Cheers,
Jan -
@reitinge Hi Jan,
Can I use the 5v or 24v off the HAT for this? Or does it need to be off board?
I’ve seen the counter count. But it seemed to go up in strange numbers. And stopped at 14. It was an accumulative count of sorts.
4, 7, 14, then stopped. Altering speed did nothing to effect the numbers
Cheers
Mike
-
@mikeyh
According to this article, anything between 3.5 and 30V should be taken as logic 1. So it should be possible to use 5 and 24 V directly from the Monarco HAT for testing.Increasing the number also happened to me during testing. I think it might have something to do with the pull up resistor, but I'd better ask an electrical expert tomorrow and let you know.
Cheers,
Jan -
@reitinge Hi Jan,
I've just tried putting 24v directly onto Din1 and it counts up. So I'm thinking maybe could be the resistor, as you said.
Is the counter I'm using also the right thing for this? Measuring RPM from an optocoupler? As I'm after a speed not an accumulative count.
Cheers
Mike -
@mikeyh Hi Mike,
I don't know if this is the right way to measure speed. I'd rather say it's probably the only way to measure speed with just the Monarco HAT. You can use math blocks to calculate the number of ticks in a certain time (see image bellow). In the DELM block I set a delay of 1s and in the CNR block there is also a value of 1. So I get the number of ticks per second on the DIV output. Of course, you can choose another time period.Alternatively, you can use the DIF_ block directly (see doc here).
If you only need this information for observing, it will be ok. If you would like to control the rotation speed accordingly, you will need to filter the values and it will probably be a lot of work.
Cheers,
Jan -
@reitinge Hi Jan,
That seems to do something. I've added a MUL block to *60. Might need tuning or level tick changing. RPM seems to be 100-150 low compared to requested speed.
Are the counter resets required or are they just incase you want to reset the count?
This is only for monitoring by the way. The fan reduces speed when torque demand is to high. So it's nice to just track requested speed against actual speed.
Cheers
Mike
-
@mikeyh
Hi Mike,
it doesn't look bad. If you only want to monitor revolutions per minute, you can set a delay of 60 in the DELM block and delete the DIV and MUL blocks. I prepared a DIV block just for case you want a value in seconds.Counter reset is only for timely reset so that the value does not overflow. But the counters are 16-bit. So the value doesn't overflow for a while.
Cheers,
Jan -
@reitinge
Thanks Jan,I kept the DIV block in the end as using a 1sec delay gives faster response than waiting the whole minute to count.
Thanks for your help as always.
Cheers
Mike
-
@mikeyh You are welcome.
Cheers,
Jan