View Full Version : forum
Using a multiplexer to increase the possible number of servos, that's a great idea that never occured to me. Can I ask what chip you selected for your designs?
Hi Brain,
Any 1 to 8 line or 1 to 4 line TTL or CMOS multiplexor will work. Such as 74HC238.
Matt.
Hi M@,
could you give me some tips about multiplexing PWM channels? As far as I know I have to repeat PWM signal after maximum 20ms. Pulse width is usually about 0.8-2.2ms (1.5ms neutral). How should it work like? Should it in a sequence make following steps:
- turn off previosus PWM (because next servo shouldn`t receive previous signal after switching)
- select next servo on multiplexer
- turn on PWM with new parameters
..and so on, or there is another (micro ;))magic way?
If there is a force or terrain adaptation everything should be calculated in main loop, changes in PWM etc executed after timer interrupt? or this uC should only control servos without any calculations?
cheers ;)
Hi,
The PWM multiplex method that you have stated is correct. If your uC has enough power such as the p.Brain, then do all your PWM and gait algorithms within one uC.
Matt.
I`ll have to decide which functions should the controller have and then I`ll put uC which can handle them :) Mainboard will be probably equipped with ARM because its cheap (1/3 price of servo ;)) and quite powerfull - I`d like to use neural networks (as algorithms) for few functions without using external computer so (many)^n MIPS will be needed :D
servo controller doesn`t need ARM but... who knows? maybe this spider will start jumping and dancing because of having 2 ARMs onboard? ;)
You can also create a PWM in software using interrupts. I have created 32 PWM channels for a 4x4x4 LED cube with a dsPIC33FJ128GP710.
If you want more details you can e-mail me.
Justin
Opps, my e-mail did not show up.
The problem I find when using software PWM outputs, is when two PWM outputs are equal to each other, there is a slight delay glitch in one of the PWM outputs (caused by the ISR trying to servis two outputs simultaniously). This is not much of a problem in LED´s, but in servos is not desirable. This can be minimised by using fast processor clocks so the glitch is barely noticable, but if you have hardware PWM.. its usually better.
Matt.
When I make my hexapod I am going to try software PWM and if it glitches I'll tell you.
When I made my software PWM I used one interrupt to act as a counter. Each time the ISR was called it added one to a variable that I'll call counter. Then each value for the servos was compared to the counter. If is was less than or equal to then the pin was high, if it was greater then it was low. This code makes the PWM lines change within .5us of each other with the dsPIC running at 80Mhz. This may not work as well with servos as you have a 20ms delay between pulses and the ISR would have to be called for many wasted cycles. I will have to adapt it some, maybe use a second interrupt to wait the 20ms delay then enable the other? I am waiting for a regulator for my Robostix so I can't test yet.