You would probably have better luck going faster. At a high enough frequency, the inductance of the motor coils plus any filter capacitance will do a better job of filtering it out.You could go still slower on the clock rate
Remove PWM-frequency sound
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: Remove PWM-frequency sound
- blckpstv
- Posts: 55
- Joined: Mon Jan 06, 2014 8:06 pm
Re: Remove PWM-frequency sound
I've read that a 20khz frequentie should eliminate the sound.
I want to try it but how do I do it on a trinket?
It's really important, if this is fixed my whole project is finished
I want to try it but how do I do it on a trinket?
It's really important, if this is fixed my whole project is finished
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Remove PWM-frequency sound
If you want to try faster, then do this:
This will reduce the prescaler to clock-divided-by-8. Your millis and delays will now be fast by a factor of 8 - the processor will count a millisecond every 125 microseconds. You don't need to worry about that for your random numbers, but it will affect any delay() statements you have.
Code: Select all
TCCR0B |= CS01;
TCCR0B &= ~(CS02 | CS00); //note! that's a tilde '~', not a minus sign
- blckpstv
- Posts: 55
- Joined: Mon Jan 06, 2014 8:06 pm
Re: Remove PWM-frequency sound
adafruit_support_rick wrote:If you want to try faster, then do this:This will reduce the prescaler to clock-divided-by-8. Your millis and delays will now be fast by a factor of 8 - the processor will count a millisecond every 125 microseconds. You don't need to worry about that for your random numbers, but it will affect any delay() statements you have.Code: Select all
TCCR0B |= CS01; TCCR0B &= ~(CS02 | CS00); //note! that's a tilde '~', not a minus sign
This is the solution I think, without my mic it's not heard, going to try it with the mic later on.
The delay I have to bring much higher like 8000 to give it the pause again, maybe even higher.
I'll post if it completly works!
- blckpstv
- Posts: 55
- Joined: Mon Jan 06, 2014 8:06 pm
Re: Remove PWM-frequency sound
This solves the sound question perfectly!
The only thing is the delay works strange when I gave it 12000 it did a ritmic varation.
When giving it 300 it just keeps on going.
It's fun to play with.
Thanks GURU's!!!
The only thing is the delay works strange when I gave it 12000 it did a ritmic varation.
When giving it 300 it just keeps on going.
It's fun to play with.
Thanks GURU's!!!
Please be positive and constructive with your questions and comments.