Thursday, January 21, 2010

Servo and Power Boards

In order to control the rocket, we need to have four independently controlled servo motors, one for each fin. This should in theory allow us to control roll, pitch and yaw. To begin with, the team had decided to use OpenServos to control the fins. OpenServos combine a standard servo motor with custom control electronics and are controlled digitally over an I2C bus. The theory was that the main board would tell each of the four servos what position they should go to via the I2C. Unfortunately however, the OpenServo electronics proved difficult to get going and the servos tended to be unstable. Rather than attempt to debug the OpenServo code, I decided to develop my own board that would control standard servos via the standard PWM method. Today I will run through what I've done and achieved to this end.

In order to control four servos independently, four separate PWM signals were necessary. In order to get good resolution of servo movement, good PWM duty cycle resolution was required. I decided to experiment first with at ATMega8, using timer modules to achieve PWM signals. Using the 'phase and frequency correct' mode on the 16 bit timer, I was able to achieve < 1 degree resolution for 2 channels (same frequency, different DC).

I order to control servos this way from the main avionics board the John Stowers had provided, it would be necessary to send commands via an I2C bus. I decided to use 2 x ATMega168 chips to achieve this. ATMega168's can run ATMega8 code with little modification but have the added advantage of I2C bus hardware. I needed two since each Mega168 could only generate two PWM signals.

I designed a circuit board in EAGLE to integrate the two 168's with the power supply board Robert Tang had partially built. The power supplies he had selected could supply 6A each so I decided to run with just one PSU for the time being but keep the option of adding another should 6A of current prove to little to run the four servos.

Before I went away for a month in mid-December, I had fabricated the boards but had not managed to load any code. It took me quite a while to design the boards since I had never used the EAGLE PCB design software before. On my return, I debugged the boards and got I2C communications and PWM up and running. The photo below shows the two boards, stacked in their current configuration.

Stacked Servo Control and Power Supply Boards connected to Servo Stack

The servos appear to be working well with this board and power supply with no over-current issues however some further testing is required which will have to wait until I have access to a computer with the correct drivers to program the Mega168s again...

I'll follow this post up soon with some details about progress on the main avionics.

No comments:

Post a Comment