This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sound when connecting liniair actuator on pypilot
#11
Did you get the higher frequency to work? Sometimes it overheats certain hbridges at high frequency I know my vnh2sp30 did.
Reply
#12
I am not sure yet, I know the new code uploads successfully, but I have no way to test the frequency with an oscilloscope. The only way for me now is to check if the sound pitches or not. The strange thing is, even though I have changed the frequency in the code, the sound is still exactly the same "octave/key".

Maybe I can try some other frequencies, to check if it makes a difference, but I'm not sure if it might break something.
Reply
#13
Maybe your hbridge drives it's own frequency?
Reply
#14
Good one, I'll take a look in the datasheet.
Reply
#15
I got it to work making a few more changes, at around lines 439, 448, 458, 618 and 636 of motor.ino; on these lines I changed the factor 16000 to 8000 and finally got a 2kHz cycle. This was trial and error on my part because I have still no classical understanding of this piece of code.

I wanted to check this out because I am also planning to use pwm_style=2 and I don't want to run into a noisy motor then.

   
Reply
#16
(2020-04-08, 11:19 PM)ironman Wrote: I got it to work making a few more changes, at around lines 439, 448, 458, 618 and 636 of motor.ino; on these lines I changed the factor 16000 to 8000 and finally got a 2kHz cycle. This was trial and error on my part because I have still no classical understanding of this piece of code.

I wanted to check this out because I am also planning to use pwm_style=2 and I don't want to run into a noisy motor then.

Nice! I'll give it a try, I thought that changing it in one line would be enough not realizing that the value is repeated in other lines. Maybe a variable in this case would be nice. Anyway, as soon as I am on the boat I'll give it a try.
Reply
#17
I've got it now. For if(pwm_style == 2) you need to modify two lines. Search for if(pwm_style == 2) and if below it mentions 16000, change it to a lower one. I've adjusted it to 1000 and the motor sound is perfect! In the newest motor.ino those are lines:

467: uint16_t OCR1A_u = 1000, OCR1B_u = 1000, ICR1_u = 1000;
482: ICR1_u=1000/DIV_CLOCK; //fPWM=1khz original was 16000, now 1000 is more khz

And of course, for the motor to work at all you need to define the proper board. In my case, even though i use an h-bridge i needed to define the VNH2SP30

119 #define VNH2SP30 // defined if this board is used
Reply
#18
(2020-04-16, 04:49 PM)jamos.tan@gmail.com Wrote: I've got it now. For if(pwm_style == 2) you need to modify two lines. Search for if(pwm_style == 2) and if below it mentions 16000, change it to a lower one. I've adjusted it to 1000 and the motor sound is perfect! In the newest motor.ino those are lines:

467:         uint16_t OCR1A_u = 1000, OCR1B_u = 1000, ICR1_u = 1000;
482:         ICR1_u=1000/DIV_CLOCK;  //fPWM=1khz original was 16000, now 1000 is more khz

And of course, for the motor to work at all you need to define the proper board. In my case, even though i use an h-bridge i needed to define the  VNH2SP30

119         #define VNH2SP30 // defined if this board is used

Thanks for this man. For myself, however, I turned away from changing the pwm frequency, because it turned out to have undesired side effects. The whole servo system, including the servo slew mechanism, became way more nervous in reacting to input. In particular, the stopping of the motor became so abrubt that it did not sit well with me, and I could not fix that with the slew parameters. So in the lab here the sound is irritating, but chances are on the boat it will drown in the lovely background symphony of wind and water.
Reply
#19
I'm not sure why it's more nervous, but I do know that some hardware cannot handle switching at certain frequencies. Once the duty cycle is high enough, the frequency can be lower without making noise, but this only works when driving as an hbridge.
Reply
#20
Photo 
I got this Pololu #2991 motor driver now, which is perfect for my limited space tiller pilot application, and it's rated to 100 kHz pwm. I'll check first if it holds up on the boat. If it does, I will get back into safely increasing the pwm frequency again. It's a bit of a hassle, though, because each time I want to reupload a new motor.ino, I have to disassemble the whole machine.


[Image: attachment.php?aid=928]


Attached Files Image(s)
   
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)