Let's Make Robots!

How do I control 18 digital servos with a 28x1?

How do I control 18 digital servos with a Picaxe 28x1?

I have the microcontroller board with the 28x1 mounted and I've tried building the "start here" robo. 

 I now would like to know how to be able to control 18 digital servos since I am building a Hexapod :)

All I really need to know is what extensionboard I need.

Thanks in advance :) Please let me know if you need more info.

Comment viewing options

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

Check out Appendix E of the picaxe_manual3.pdf (google it). It explains how to reconfigure the input pins from their default input to output. There are a maximum of 16 outputs, so if you are using a Picaxe-28x1, you will be limited to that.

You may want to consider either a Picaxe-40x2 or a dedicated servo controller board in addition to your Picaxe-28.

Ooh, wow that was just the basics I needed thanks mate :) I think I will go for the 40x2 to save physical space

FYI, there is no equivalent of the Picaxe 28 project board with the IC slot for a darlington or motor driver chip, but there is a protoboard that works with the 40x or 28x. There's almost no room on the board for prototyping, so you have to have a second board if you use that board.

I also found the contat holes on that board were too small and not spaced for standard PC board pins and headers. I found this kinda annoying. Overall, it's an OK board for hosting the Picaxe 28 or 40. Just don't expect the same features you'd find on the Picaxe 28 project board used on the Start here robot and elsewhere widely on this site.

The protoboard you are refering to is this?  http://www.robotshop.ca/picaxe-28x-40x-proto-board-2.html

I was going for a design with minimal usage of external controllers and I think the 28x would do for the control for 16 digital servos, but if I later would want to attach a remote I am not sure anymore.

 

Thanks so far :)

Yep, that's the bunny I'm talking about. Just keep in mind if you use all 16 outputs for servos, you have no other outputs for anything else (lights, speaker, etc.) Some sensors (like the SRF05 ultrasound) need an output to operate.

If you are buying, the cost of a 40x is not much more than a 28x.

You know that picaxe has a board that will run 20+ servos and has a space for a 18x. You can also use this board as a stand-alone i2c device with whatever picaxe chip you want (as long as it has an i2c out). I am using (2) SD20 chips from acroname. This is a simple chip with next to no extra components and will control up to 20 servos. It costs about 20 bucks.

http://www.acroname.com/robotics/parts/R193-SD20.html

http://www.rev-ed.co.uk/docs/axe031.pdf

Well that is certainly another option for controlling more servos, however I do not know how to use i2c. I am aware of its excistence but that is it.

Lets say I do use the SD20, will I be able to controll it with a 28x ? 


Edit: I plan on making the hexapod controllable through some gamepad, so I will need room for this too.

The sd20 is actually simple as shit. It is basic i2c and there are really only 2 commands. The 28x will run it fine. Consult the manual about hooking up to i2c lines... they need a 4k7 resistor on each line going to + (pull-up). The 2 lines are clock and data and you don't need to know what that means, just be sure the D on the pic is going to the D on the servo driver and the C --etc.etc. You can build a circuit for the SD20 based on it's data sheet, it is really just pwr, a resonator (included), one pull-up resistor and that's it.

Commands:

Put this at the top of your code:

I2CSLAVE $C2, i2cslow, i2cbyte

This just says to the servo driver that "hey,I'm talking to you" --Don't worry about what this means, just cut and paste it

To move a servo:

writei2c x,(y)

x is the number of the servo and y is the posistion you want it in. That's it. Instead of using the servo command, you will use this command. The posistion numbers are the same a with the servo command... 150 is centered, 1 is all he way one way and 255 is the other end. If you send number 0, it will turn the servo off. That's it.

 Do u guys know how to hook up sd20 to pic28x1 projectboard?

i hooked it up the way it shown on the manual....then i wrote this:

 

i2cslave $C2,i2cfast,i2cbyte     

writei2c 1,(1)

 

wait 1

writei2c 1,(254)

 

wait 1

but its just not working at all..

 

wow, that really IS simple :P

Thanks for the help. I consider my question answered. I will return if I have troubles ;)