elefurtronik, for a brushed DC motor why do you need more than 1 channel of PWM? Unless you are running twenty separate motors, or giving PWM to 20 separate PWM controlled servo motors which just hapen to have brushed DC motors within them? A h-bridge driver (which lets you easily reverse and do coasting versus sudden braking) chip might be more to your liking than a MOSFET here too, h-bridge chips are designed with logic level inputs in mind, no need to worry about exact gate voltages. This becomes even worse if you are taking a pin high and low using PORTx register single clock cycle operation commands which don't have the same logic around them as digitalWrite() does (these methods can be really useful where an arduino compatible microcontroller's putput needs to change rather fast though, digitalWrite() is pretty slow). In my experience, calling digitalwrite() on the same pin as you are PWMing may sometimes have unexpected effects. The alterantive for having many PWm channels would be to buy an I"c or SPi controllable PWM generator chip, or buy a microcontroller which you would program to be an I2C/SPI slave and perform this same role. You could set up an interrupt service routine to run triggered by a timer, and whenever it runs it manually turns specific pins on or off as required by your PWm needs. IF you can cope with having your software which runs on the arduino spend a lot of its clock cycles on manually toggling pins then you can bitbang out PWM on any pin you want, how much of a strain it will put on doing the other things your program tries to do depends on how fast a frequency you want to apply the PWM to.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |