PhatFil
Posts: 618
Joined: Thu Apr 13, 2017 3:55 pm

Re: Raspberry(3b+)-PCA9685-12V Fans

Mon Sep 10, 2018 6:06 am

whenever i need a roadmap for a project like this i bung the keyword 'arduino' into the search engine if i dont immediately find what i am looking for. After all if it can be done someone has done it with an arduino and written a book about it.

I did the same for this question and it turns out its a common task for an arduino uno and achievable with setting the timer registers.
https://forum.arduino.cc/index.php?topic=415167.0

a slave arduino or barebones chip even could resolve the issue perhaps?

Brandon92
Posts: 539
Joined: Wed Jul 25, 2018 9:29 pm
Location: Netherlands

Re: Raspberry(3b+)-PCA9685-12V Fans

Mon Sep 10, 2018 6:27 am

Well, I think if the code and hardware are good. The Rpi is more than capable to drive the fan correctly.

Ch3fk0ch
Posts: 58
Joined: Tue Apr 05, 2016 8:34 pm

Re: Raspberry(3b+)-PCA9685-12V Fans

Mon Sep 10, 2018 4:24 pm

Hi, i used Node-Red for it.

Brandon92
Posts: 539
Joined: Wed Jul 25, 2018 9:29 pm
Location: Netherlands

Re: Raspberry(3b+)-PCA9685-12V Fans

Mon Sep 10, 2018 5:50 pm

Ch3fk0ch wrote:
Mon Sep 10, 2018 4:24 pm
Hi, i used Node-Red for it.
Well, this doesn't provide me any information to solve you issue.
So, what is frequentie of you PWM signal, ect.

Ch3fk0ch
Posts: 58
Joined: Tue Apr 05, 2016 8:34 pm

Re: Raspberry(3b+)-PCA9685-12V Fans

Mon Sep 10, 2018 6:34 pm

A lot ^^
100Hz, 1000Hz, 10kHz, 22kHz, 25kHz etc.
Maybe its cause of the software PWM, i will test the Hardware PWM pin when i am back home tomorrow.

Brandon92
Posts: 539
Joined: Wed Jul 25, 2018 9:29 pm
Location: Netherlands

Re: Raspberry(3b+)-PCA9685-12V Fans

Tue Sep 11, 2018 6:42 pm

Do you have perhaps other transistor to test with? Or did you try to lower the base transistor?

Ch3fk0ch
Posts: 58
Joined: Tue Apr 05, 2016 8:34 pm

Re: Raspberry(3b+)-PCA9685-12V Fans

Wed Sep 19, 2018 7:37 pm

Hi,
sorry i was a few days away.
I just have these bc238 transistors.
What u mean with "Or did you try to lower the base transistor"?

Greetings.

Brandon92
Posts: 539
Joined: Wed Jul 25, 2018 9:29 pm
Location: Netherlands

Re: Raspberry(3b+)-PCA9685-12V Fans

Wed Sep 19, 2018 8:54 pm

Hello,
No problem.

For now, forget about the base resistor. By the way, that is the 1k resistor in you green line and it is necessary.

As you tested it before, if you connect the pwm pin of the fan to the gound. The fan stops spinning. Now we are going to test if you can get the same result with a transistor. For this test you only need to hook it up as the picture below. This should turn of the fan. And when you connect it to the ground, the fan should spin at max speed.

If this is working, we can look at why it doesn't work with the Rpi. And if it doens't work, we need to change something in the hardware :-)
Attachments
4pinfancontrol_test1.png
4pinfancontrol_test1.png (144.93 KiB) Viewed 829 times

Ch3fk0ch
Posts: 58
Joined: Tue Apr 05, 2016 8:34 pm

Re: Raspberry(3b+)-PCA9685-12V Fans

Mon Sep 24, 2018 3:22 pm

Hi,
a lot to do these days sorry^^

Ok i testet it as shown in your Pic.
The Fan is off.
And when i connect the green line to the Ground the Fan goes Full Speed.

(Is it possilbe that i need a 5V PWM Signal? when i look at this :
https://noctua.at/media/wysiwyg/faqs/no ... fans_1.png)

Greetings

Brandon92
Posts: 539
Joined: Wed Jul 25, 2018 9:29 pm
Location: Netherlands

Re: Raspberry(3b+)-PCA9685-12V Fans

Mon Sep 24, 2018 4:28 pm

I don't think you need 5v to control the transistor. Because, you tested it on 3.3V and you can turn it on and off. And I amuse you also used the 1k resistor.

So, the problem seems to be with the output of your Rpi or with your code. You could also use the same approce as before.
What I mean with that is, that you program the pin to be low for a x one second ( or whatever) and then the same amount for on. This will have the same behavioral as what you did manual with the green wire.

Ch3fk0ch
Posts: 58
Joined: Tue Apr 05, 2016 8:34 pm

Re: Raspberry(3b+)-PCA9685-12V Fans

Mon Sep 24, 2018 4:40 pm

Ok,
i use NodeRed.

So i can switch it on and off (just that 0 is on and 1 or 100 with pwm is off)

Brandon92
Posts: 539
Joined: Wed Jul 25, 2018 9:29 pm
Location: Netherlands

Re: Raspberry(3b+)-PCA9685-12V Fans

Mon Sep 24, 2018 4:52 pm

I meant more like this. And in this case the led is your transistor.
By the way, I personal don't have experience with node-red.

Ch3fk0ch
Posts: 58
Joined: Tue Apr 05, 2016 8:34 pm

Re: Raspberry(3b+)-PCA9685-12V Fans

Mon Sep 24, 2018 4:56 pm

Ok u mean connect the fan directly to the Pi without the Transistor?

Brandon92
Posts: 539
Joined: Wed Jul 25, 2018 9:29 pm
Location: Netherlands

Re: Raspberry(3b+)-PCA9685-12V Fans

Mon Sep 24, 2018 5:04 pm

Ch3fk0ch wrote:
Mon Sep 24, 2018 4:56 pm
Ok u mean connect the fan directly to the Pi without the Transistor?
No, that will end up in tears.

Use this one:
Image

Ch3fk0ch
Posts: 58
Joined: Tue Apr 05, 2016 8:34 pm

Re: Raspberry(3b+)-PCA9685-12V Fans

Mon Sep 24, 2018 5:07 pm

I did this.
Thats what i mean in the Post before.

I can turn the Fan on and off with the Raspberry.

____________________________________________________
I testet it also with a Arduino (without the transistor) connected to the Raspberry.
The PWM Range of this is 0-255, Fan start at 167 with 2000rpm and has full speed 255 with 3000rpm

Fan range is from 800-3000rpm, i dont check it......

Brandon92
Posts: 539
Joined: Wed Jul 25, 2018 9:29 pm
Location: Netherlands

Re: Raspberry(3b+)-PCA9685-12V Fans

Mon Sep 24, 2018 7:36 pm

Okay, good to hear that you can turn on and of the fan by the Rpi. Now you have correcly connect it, it should work with a PWM signal.
As a slide reminder. It is possible that the pwm signal is "inverted". This means that when the Rpi gives a 100% duty cycle, your fan is of. And when the Rpi gives a duty cycle of 0%, the fan is fully on.

Also there is a certain duty-cycle range, that you can use. As stated in the standard of the fan.

Ch3fk0ch
Posts: 58
Joined: Tue Apr 05, 2016 8:34 pm

Re: Raspberry(3b+)-PCA9685-12V Fans

Tue Sep 25, 2018 9:56 am

So,
it works a bit.

With the Raspberry i can control the PWM from 0-1800rpm than it goes directly to 3000rpm.
With the Arduino from 2000-3000rpm.

I ordered an oscilloscope and check the pwm from the Motherboard and the pwm of the Raspberry.

Brandon92
Posts: 539
Joined: Wed Jul 25, 2018 9:29 pm
Location: Netherlands

Re: Raspberry(3b+)-PCA9685-12V Fans

Tue Sep 25, 2018 6:04 pm

Okay, we getting somewhere.

What frequency did you run the PWM signal on. The Rpi and the arduino.
And does the fan reacted when you use a arduino with a transistor?

Ch3fk0ch
Posts: 58
Joined: Tue Apr 05, 2016 8:34 pm

Re: Raspberry(3b+)-PCA9685-12V Fans

Tue Sep 25, 2018 7:08 pm

Hi,
i tested different PWM frequencies on both.
But it not change the controlrange.

Like 100,500,1000,5000,10000,15000,20000 and a few in the range between 21k-28kHz.
As described in the document on the first page 25kHz is the best.

I not tested the Arduino with the Transistor but i will do this evening.

Brandon92
Posts: 539
Joined: Wed Jul 25, 2018 9:29 pm
Location: Netherlands

Re: Raspberry(3b+)-PCA9685-12V Fans

Tue Sep 25, 2018 7:36 pm

Okay, could you change the 1k resistor for a one with the value 470. Or if you don't have it, place two 1k parallel. This gives the transistor more base current and this is maybe what it needs.

But, I'm wondering what is showed on the scope later on :geek:

Can you also place a picture of your setup, maybe I see something suspicious.

Ch3fk0ch
Posts: 58
Joined: Tue Apr 05, 2016 8:34 pm

Re: Raspberry(3b+)-PCA9685-12V Fans

Tue Sep 25, 2018 8:29 pm

So,
Ardruino with the Transistor gives the same result as without.

Raspberry with a 470ohm resistor still the same just the rpm is not staple (goes up and down).
IMG_4561.JPG
IMG_4561.JPG (246.83 KiB) Viewed 718 times

Ch3fk0ch
Posts: 58
Joined: Tue Apr 05, 2016 8:34 pm

Re: Raspberry(3b+)-PCA9685-12V Fans

Wed Sep 26, 2018 2:39 pm

Ok....
I have not really an idear how this thing works BUT:
At the Raspberry with Set 25kHz at GPIO 16 at 50%pwm:
(I put the black Cabel on GND and the Red on the Gipo)
https://imgur.com/9BCLork
https://imgur.com/Mu2p42z

Arduino Same Settings:
https://imgur.com/e4tqN87
https://imgur.com/7lNKdte

Pc:
I dont know how to messure this cause the Fan need to be connected.
Can i add this between the PC and the Fan?

So, the frequency that i set in raspberry and Arduino ar not shown at the ozi.
Maybe i am to stupid for that or its something else.
Last edited by Ch3fk0ch on Wed Sep 26, 2018 8:52 pm, edited 1 time in total.

Brandon92
Posts: 539
Joined: Wed Jul 25, 2018 9:29 pm
Location: Netherlands

Re: Raspberry(3b+)-PCA9685-12V Fans

Wed Sep 26, 2018 8:42 pm

Unfortunately you images are very small. And I can't make anything out of it. Except that is see some PWM signal.

Some interesting videos about how to use a oscilloscope: If it is a normal scope. Connect the ground wire to the ground of this circuit, see image below. So, place the wire to the emitter of the transistor. And place the other one to the collector of the transistor. And this is the signal that we want to see. And do this for the Rpi and for the arduino. Then we can see what the problem is.
Brandon92 wrote:
Ch3fk0ch wrote:
Mon Sep 24, 2018 4:56 pm
Ok u mean connect the fan directly to the Pi without the Transistor?
No, that will end up in tears.

Use this one:
Image
Ch3fk0ch wrote: So, the frequency that i set in raspberry and Arduino ar not shown at the ozi.
Maybe i am to stupid for that or its something else.
What do you mean with that, and I also don't know what for kind of scope you are using. So, if the option exist. You can read it in the manual, I assume.

Ch3fk0ch
Posts: 58
Joined: Tue Apr 05, 2016 8:34 pm

Re: Raspberry(3b+)-PCA9685-12V Fans

Wed Sep 26, 2018 8:56 pm

I edited the pic's should now be bigger.

I bought a cheamp one from Amazon^^
Its a SainSmart Mini Digital Oszilloskop DS212-2.

And this should be the orginal from the Motherboard:
Unbenannt.png
Unbenannt.png (146.04 KiB) Viewed 666 times

Ch3fk0ch
Posts: 58
Joined: Tue Apr 05, 2016 8:34 pm

Re: Raspberry(3b+)-PCA9685-12V Fans

Wed Sep 26, 2018 9:14 pm

So the frequency is still wrong from Pi and arduino

Return to “Beginners”