Let's Make Robots!

Picaxe 40X2 servo control

Hey guys,


I have been working on a new project over the past couple of days and I have just come to the electronics stage of the project.  What I need is control of 18 servos.  For this I purchased a 40x2 chip as I saw how many I/O it had and seemed like the way to go.  Problem is that when I plugged in my Picaxe 40X2 and attempted to control a servo, The editor advsied me that only the "B" pins could be used with the servo commands.  This means that I can only control 8 servos with this chip?

I probably should have looked into this further before planning on using this chip for my project.  Just wondering if there is any possible way to configure other pins to be able to control my servos?  Did not really want to have to buy a servo controller but things are not looking too good for me!


Thanks guys!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

That does appear to be a limitiation of the Picaxe boards. You can buy a separate servo controller that can be commanded by the Picaxe via seriel or i2c commands. This would probably be your best option if you want to stick with the Picaxe platform.

The Arduino can support more servos. Here's a snippet from http://www.arduino.cc/playground/ComponentLib/Servo:

"... the Arduino Servo library supports up to 12 motors on most Arduino boards and 48 on the Arduino Mega."

Good luck!

the underlying hardware is capable of controling 8 servos per Timer. There is a free programming language for PICs called JAL. One of the libraries that get included when you download jallib is a servo control library that will give you control of up to 24 servos on an appropriately sized PIC.

No, JAL is not magically compatible with PICAXE. At least it allows one to stay with PICs rather than a switch to AVR chips.

Thanks for your help once again IgnobleGnome, I think I will definately pull out my arduino and start getting use to using it for future projects. for now I think I will have to settle for a servo controller!

I also discovered that a few days ago. I needed only two servos, so it was not such a prbl.

But I wasn't satisfied at all, I ran into terrible "jitter" issues, I found many discussions here about this subject, but no way to have them work exactly as expected, so I tried to add a SD 20 servo driver and... it solved all my problems ! No more jitter, it just work perfectly. I should have tried that sooner, I've always had so much trouble with picaxe and servos :/

If you want to drive as many servos as that, with a Picaxe, I strongly advise you to have a look to the SD20 chip (+ a small resonator) (you will be able to drive 20 servos)

It's a real let down when you think you have it all sorted in your head and reality hits!  I was actually researching servo drivers and found the SD20 aswell.  Looks like luck is on my side as there is an ebay seller who lives 15 mins from me!  going to shoot over tomorrow and pick a few chips up. Thanks for helping out! :)

I am currently experimenting with the 20x2 chip and I run into very frustrating jitter problems, just like on all the other picaxe chips i've used. As soon as I've activated I2C, the servos go bserk. I think it has to do with timer limtations on the PICs. 

I am switching to using the pulsout command in a repeated loop. As long as it pulses more or less every 20ms the servos work fine. Since the X2 chips can run at 32 MHz or more, this works very well for me.

Also, the pulsout command can be used on other ports like on the "C" pins.

The I2C you are using is hardware based. As such, I would find it hard to believe that any other internal hardware would confilict with it. Interrupts would be more likely to cause problems as I would guess that Rev-Ed uses interrupts for their servo control routine.

Do you mean the I2c code is hardwired in the PICs?

I don't know why, could still be a wiring problem or other interference, but there have been many ocassions where I  replaced the pwm or servo code with my own code, because of inexplicable problems.

Anyway, the main thing is that by replacing the servo command with a repeated pulsout command, you are no longer bound to the port B pins.

have hardware I2C. I have looked a few times at trying to use I2C on chips that don't have the hardware, but, I2C master in software is not a doable prospect.

I didn't mean to derail the OP question. I just thought I would point out that the chips have hardware I2C rather than a software implementation, if that is even possible.

Your pulsout suggestion is a definite plus and workaround for Port limitations.

I understand. Still somewhat offtopic, but isn't I2C on arduino software based? if I recall correctly, you need to load a library before you can use it.