Show Posts
Pages: [1]
1  Using Arduino / Programming Questions / Re: Adjusting PWM frequency on Leonardo on: October 08, 2012, 01:29:33 am
Thanks for the info pylon, I understand this a lot better now smiley

I have switched to using pin 9 so as not to affect the Arduino timekeeping. I can confirm the pins 9 and 10 on the Leonardo behave same as the Uno with regarding timer / pwm frequency settings, that is:

Pins 9 and 10: controlled by timer 1

Setting    Divisor    Frequency
0x01        1        31250
0x02        8        3906.25
0x03     64        488.28125
0x04     256        122.0703125
0x05        1024        30.517578125

TCCR1B = TCCR1B & 0b11111000 | <setting>;

Interestingly I have noticed that the speed of a fan will change when the PWM frequency is altered even although the duty cycle remains unchanged. Could to do with the characteristics of the fan or perhaps something to do with the MOSFET that I am driving it from??
2  Using Arduino / Programming Questions / Re: Adjusting PWM frequency on Leonardo on: October 02, 2012, 05:18:03 pm
I've seen the pin mapping table here: http://arduino.cc/en/Hacking/PinMapping32u4 but I'm still slightly unclear.

For example digital pin 10 shows (PCINT6/OC1B/OC4B/ADC13) PB6 I assume that "OC1B" tells me it is timer 1, or is it timer 4 (OC4B)??

My second question is how to work out what prescale factor to use and what settings are available. I know that on the Uno different timers have a different settings available and the same setting can result in a different frequency depending on the timer. I used the data referenced in this post http://arduino.cc/forum/index.php/topic,16612.msg121031.html#msg121031 for the Uno so was trying to figure out the same for the Leonardo.

Sorry if these are dumb questions - this pin mapping stuff just seems a bit cryptic to a novice like me!
3  Using Arduino / Programming Questions / Re: Adjusting PWM frequency on Leonardo on: October 02, 2012, 01:47:12 pm
Thanks for the info

I need to use delay() so I'll have to resolder the shield to use a different pin.

Is there some info somewhere about which pins are on which timers on the Leonardo?

4  Using Arduino / Programming Questions / Adjusting PWM frequency on Leonardo on: October 02, 2012, 06:16:25 am
I have some code running on an UNO that I need to port to a Leonardo.

One of the lines adjusts the PWM frequency of pin 3 to 31250Khz
Code:
TCCR2B = TCCR2B & 0b11111000 | 0x01; //set PWM frequency for pins 3 & 11 to 31250Khz

I'm having a hard time figuring out how to translate this to the Leonardo since I believe the timers and prescaler values are different but I can't really make sense of the 32U4 data sheet (I am new to microcontrolers).

I'd need to keep using pin 3 if possible.

Can anyone help me out or point me in the right direction?  Thanks!
5  Using Arduino / Motors, Mechanics, and Power / Re: interface with automotive pwm fan contoller on: June 09, 2012, 08:46:35 pm
Thanks for the info guys. I tried using pin 5 which should give the required 1khz signal but it still didn't work. I also tried the manual bit banging code to be sure the PWM frequency was correct. Finally I tried using a transistor to increase the output voltage to 12v but still no go!

so I think I will have to give up on this motor controller unfortunately...

I am right in thinking that instead I should be able to PWM control the fan from Arduino just by using something like a TIP142 darlington transistor?

edit: the fan draws about 5a continuous, but spikes up to 10a on startup.
6  Using Arduino / Motors, Mechanics, and Power / Re: interface with automotive pwm fan contoller on: June 03, 2012, 11:30:17 pm
Ok thanks!

I guess I need to figure out how to set the PWM frequency to 1khz.

Can this be done using code in my sketch? I have an arduino uno if that makes any difference.
7  Using Arduino / Motors, Mechanics, and Power / Re: interface with automotive pwm fan contoller on: June 03, 2012, 10:55:47 pm
ok, thanks, you may well be right as I was only guessing (hoping) that it was some sort of PWM controller!

I know that most cars just have one or two speed settings switched by relays however this one appears to be more sophisticated.

Anyway here's a couple of pics of the unit:



and the internal components:


Any ideas?

Edit: the unit is branded HKR, I believe it is something similar to this: http://www.hkr-seuffer.de/files/hkr_k__hlerl__ftersteuerger__t-variante1_eng.pdf
8  Using Arduino / Motors, Mechanics, and Power / interface with automotive pwm fan contoller on: June 03, 2012, 09:35:15 pm
Hi,

I have a car radiator fan and also a fan controller that I pulled from a wrecked Mercedes. The fan controller has four thick wires being power in and fan connections and also 2 thin wires which I believe take a PWM signal from the cars computer to control the fan speed.

I would like to be able to control the fan speed via Arduino using PWM. I am hoping to use the fan controller that I pulled from the car as it will save me from having to buy a motor controller (it seems that a motor controller that can handle the current draw of the fan will be quite expensive).

I've wired up the fan to the motor controller and connected the two thin wires to arduino ground and analog pin, however it doesn't work - no matter what PWM value I set the fan still spins at full speed.

Unfortunately I don't know anything about the fan controller - I've tried googling the numbers that are stamped on it but I haven't found anything useful.

I thought maybe the fan controller needs a 12v PWM signal instead of the 5v from the Arduino?? If so I could try using a transistor??

Does anyone have any suggestions or advise on what I could try to get this to work?

As you may have guessed I'm and electronics (and arduino) noob so please tell me if I am wasting my time.

Thanks!
Pages: [1]