Servo controllers

BotB

Member
Hi!

I'm going back to university soon and I've had so much fun with PICAXE that I've decided to try and create animatronics with it for my second year... What I'd like to know however is what you consider the best servo controller "attachment" is for use with the PICAXE 28X board?

The more servos the better... the main thing that worries me though is the strength of servos I can manipulate with PICAXE as animatronics tend to get heavy... not too heavy mind you but more than say an RC front axel

I did see something online here about a direct attachment servo upgrade for the 28X board but I can't find it again...

Anyway I'm sure you guys know wayyy more than me on this subject so please feel free to point and prope!

Many thanks and I'm hapy to recieve any questions!
 

BeanieBots

Moderator
The board you have shown will drive 8 servos as it stands.
Replace the darlington driver with a 330R resistor DIL pack.
Fit 3 pin wide connector (dual plus single) on the outputs and Futaba style connects plug in direct.

As for servo "strength", well that depends on which servos you buy.
They come in all sorts of sizes, strengths and speeds. For heavy duty you want to be looking for undercarriage servos. These can typically lift several kilos. (they'll set you back £££s though).

I've often taken the electronics out of a servo and used it to drive a highly geared motor. Much slower but MUCH more torque.

If you have a weedy little cheapy such as the HiTech budget range, you can effect an increase in torque by decreasing the frame rate from 20mS to 10mS or even quicker. You will then need to do the timing yourself because you can't get "servo" to work like that.
 

BotB

Member
This 21 Channel Servo Controller looks interesting... will the voltage rating for this be sufficient for several qality servos?

As for the board, is there a 330R resistor DIL pack available to put in place of the Darlington Driver? I also presume then with the extra line of connectors on the board the servos plug nicely into it?

Also I obviously need to controll these servos by switches or potentiometers... Will the 21 channel board include inputs? and how many can I expect to controll using the 28X board?
 
Last edited:

BeanieBots

Moderator
I've never used the 21 servo controller myself so cannot comment except to say it's up to you how you interface it with switches & POTs etc. It's a controller, you tell it where you want the servos to go. It has an on-board 18X to help with such tasks.

The 330R is readily available.
http://194.201.138.187/epages/Store.storefront/?ObjectPath=/Shops/Store.TechSupplies/Products/RES034

The connector strips are also available from the same supplier.
As I mentioned earlier, you can plug FUTABA or HiTech style servo connectors directly. The higher quality MULTIPLEX style CANNOT be connected directly but you can get Futaba replacement leads for those.

Have a look at my Autonomous Hexabot.
It uses nothing other than the 28X board, servos and sensors all plugged directly onto the board.
http://www.picaxeforum.co.uk/showthread.php?t=7760
 

BotB

Member
Hey thanks for the replies... I got the servo pack a few days ago and have had a blast, I've read all the script and info about controlling servo position via a potentiometer connected to the inputs but do I require a certain resistance with the potentiometers? if I do at all?
 

BeanieBots

Moderator
Use a 10k POT. (linear)
To all those about to start an input impedance flame war, please don't. It has been covered so many times.
It was a simple question with a simple answer. 10k.
 

BotB

Member
many thanks for the quick reply! I am confused as hell however about how I am to connect the POT to the analog input on the board, do I require 2 pins or a 3rd?

I'm using the code from the book, however where do I specify the analog port I'm using? is it literaly just a change of the number that follows the "analogport =" symbol line?

symbol servoport = 1
symbol analogport = 4
symbol analogvalue = w1

start:
readadc analogport, analogvalue
analogvalue = analogvalue * 10 / 17 + 75 'divide by 1.7
servo servoport, analogvalue
goto start

I do apollogise as I've jumped straight into this and even though I understand it I feel I'm missing the really basic facts, the book just doesn't present it in plain English to me...
 

goom

Senior Member
Yes, just change the number after analogport to any valid pin (0,1, 2 or 3 for the -28X). See "readadc" in the manual for valid pins for other chips.
Connect the 2 outside legs of the pot. to supply voltage (5V) and ground respectively. The center leg will then sweep from 0 to 5V as the pot. is turned. This is the input to the ADC pin of the PICAXE.
The math in the code is simply to convert the 0 to 255 reading into 75 to 226 as required for a standard hobby servo.
 

BotB

Member
Superb! I had a go yesterday with a very badly behaved and totaly wrong choice POT... There was movement so I'm almost certain that I'm going down the right roads, I've ordered some Futaba extension leads to fit to the triple rails the inputs now have so I don't have wires going everywhere! I'll be down to Maplins to get some 10K Linear POTs soon too...

Thanks so much for the help so far! This is a great forum.
 
Last edited:

Marcwolf

Senior Member
SD 21

I have an SD21.

Very nice little board and very powerful when you do not want you PICAXE to be handling all of the servo housekeeping. It works using the I2C bus.


It also has some nice features like a battery monitor, and a way to control the speed of the servo so it is really a set to got to this position in this time and it will.'

Downside..

When powering it up it will default the servos to 0. So what I have done is to use one of the lines from my 18X picaxe to control a MOSFET that powers the servos.

So I can start with the servos powered off, set MY default values and then turn the servo's on again.


But its is a very nice little board with a lot of power...


dave
 

BotB

Member
Does the SD21 have inputs for each servo? if so then I'll definately be moving up to that sonner or later...
 

BeanieBots

Moderator
Does the SD21 have inputs for each servo? if so then I'll definately be moving up to that sonner or later...
Not sure what you mean?
It's a contoller. It has (effectively) ONE input.
You tell it "which servo", "where" and "at what speed".
 

BotB

Member
Ah... I was wondering if it had an input for each servo such as input 1 = servo 1, input 2 = servo 2... etc...

I do however have a recent issue with controlling the servos via potentiometers...

I have one servo running fine from a potentiometer (10k pot) but today I tried to controll two, each with a pot... I've made a mistake some place no doubt but I've found that the second servo works fine, turn the pot and the servo turns too, however the first one now mooves only slightly when the pot is turned... On power up it turns over half way and stays there even if the pot is turned fully down...

I'm using two Futaba S3003 servos so there shouldn't be any difference between them and the pots are both 10k too.

Please ask if you need more of a description... I have the code i'm using below...

symbol servoport1 = 1
symbol servoport2 = 3
symbol analogport1 = 1
symbol analogport2 = 3
symbol analogvalue1 = w1
symbol analogvalue2 = w2

start:
readadc analogport1, analogvalue1
readadc analogport2, analogvalue2
analogvalue1 = analogvalue1 *10/17+75 'divide by 1.7
analogvalue2 = analogvalue2 *10/17+75 'divide by 1.7
servo servoport1, analogvalue1
servo servoport2, analogvalue2
pause 10
goto start

Note: I have the pots and servos connected to 1 and 3 purely for space to keep things clean and easy to see...
Also the very short pause command is there because without one the servos seem to strain and I can smell them burning, the pause "prevents" this.

Many thanks again for the help so far...
 
Last edited:

BeanieBots

Moderator
You're updating the 'servo' command too quickly.
Change the "pause 10" to "pause 30".
Better still, have a look in the manual at "servopos". It is a recently introduced command specifically for this sort of problem.

In the past, I've used pulsout for driving servos with quick updates to get around the same problem. Try replacing your "servo" commands with "pulsout" commands and "pause 20" for the correct frame rate.

Another quirk with rapid updates of "servo" is the order. Just try swapping the two "servo" lines around.

The "correct" solution however, is to use "servopos".
 

Technical

Technical Support
Staff member
Even better is to not update if you don't neeed to (ie no change on pot). Do you also really need to read the pots every 10ms - is 100ms adequate...?

The main issue, as BB points out, is the two consequative repeatedly updated servo commands. The servo command likes to be left alone and just create pulses in the background, not to be rapidly updated all the time.

symbol servoport1 = 1
symbol servoport2 = 3
symbol analogport1 = 1
symbol analogport2 = 3
symbol analogvalue1 = w1
symbol analogvalue2 = w2
symbol old1 = w3
symbol old2 = w4

servo servoport1, 150
servo servoport2, 150

start:
readadc analogport1, analogvalue1
readadc analogport2, analogvalue2
analogvalue1 = analogvalue1 *10/17+75 'divide by 1.7
analogvalue2 = analogvalue2 *10/17+75 'divide by 1.7

if analogvalue1 <> old1 then
servopos servoport1, analogvalue1
let old1 = analogvalue1
end if

if analogvalue2 <> old2 then
servopos servoport2, analogvalue2
let old2 = analogvalue2
end if

pause 100
goto start
 
Last edited:

Marcwolf

Senior Member
SD21 Board

Hi there

Ok - programming the SD21 - to do this you use the I2C bus and set registers in the SD21 board.

There are several tricks to this (and the SD21 board can be confusing) however the way it works is pretty simple.

You have 1 set of WORD registers so you can do High Byte and Low Byte position values, and then set the Speed Value. this works well with Basic Stamps.

For a Picaxe you can use another set of registers that will then do an internal (to the SD21) to the Hight/Low byte registers. You can still set the speed of movement (or ignore it for the servo to run at full speed all of the time)

Each servo has it OWN set of registers so it makes it very easy to set up.

There is a thrid mode of setting things and it is a little more tricky. Baically you can set the 'center' position of a servo and then set the offset (+50 to -50) or something like that.

One things I have found which can be annoying is that the SD21 starts with all servo's set to 0.. Which if you rely on the servo beings at say position 60 at startup can be difficult.

What I ave done is used a MOSFET on the servo powerso that my PICAXE can preset the SD21's servo postion and THEN apply power to the servos.

Hopes this helps

Dave
 

BotB

Member
Thanks alot for the help guys! I've read everything you've said and am now using this code:

symbol servoport1 = 1
symbol servoport2 = 3
symbol analogport1 = 1
symbol analogport2 = 3
symbol analogvalue1 = w1
symbol analogvalue2 = w2

servo servoport1, 150
servo servoport2, 150

start:

readadc analogport1, analogvalue1
readadc analogport2, analogvalue2
analogvalue1 = analogvalue1 *10/17+75 'divide by 1.7
analogvalue2 = analogvalue2 *10/17+75 'divide by 1.7
servopos servoport1, analogvalue1
servopos servoport2, analogvalue2
pause 1000
goto start

It works well for me at the moment, I can't say how grateful I am, this will help me so much at university for my animatronics...

Thanks also for the description of the SD21, I understand now and it may well be something to use later on in bigger projects...

Many thanks again!
 
Top