|Oct 23, 2008, 02:53 PM|
Joined Nov 2002
Diy ServoActuator Project
Diy ServoActuator Project Tools
Based on Silabs C8051F300 CPU
Using Silabs ToolStick Development Tools
C Compiler is SDCC...(free)
The sofware "super loop" runs a time slice scheduler based on timer interrupts. This scheduler lets each of 8 tasks run for .5 msec at a time.
The tasks include:
1. Reading the ADC channels,
2. Running the PID loop to determine how to program the hbridge to move the
actuator output arm to the requsted position,
3. Sendng the information about the PID gains, the PWM settings, the pulse width, and the angle of the output arm in the backbround over the TXD rs232 pin.
Progress so far,,,
Analyzed the hall effect sensor output from
a radiially polarized magnet spinning over the sensor
Can initialize the chip I/O
Can send bytes over the rs232 H/W
Can read all the adc channels
Can determine the servo pulse width using the PCA capture compare hardware
This was tested using my gws servo tester..
Can generate the PWM in H/W for the hbridge using the PCA hardware.
Verified the pwm changes with a scope and the LEDS changing brightness
Added in the time slice scheduler to run all required tasks.
Added the hbridge and verifed the 4 mm pager spins in both directions with some simple code to change the pwm outputs driving the hbridge. and the leds
Finished the code to run the actuators in open loop mode. The actuator respond to a 1 -2 msec pulse. I tested this with my servo tester in both manual and sweep modes.
The system also deenergizes the coils when the system itializes and when the 1 -2 msec control pulses disappear from the input. This was tested by shutting off the power to my servo tester that is driving the servoactuator
the PWM waveforms for the hbridge were verified with an oscilloscpe throughout the 1 -2 msec pulse input range and in the mode when the pulse nput disappears.
The next step is to add the selected hall effect sensor, and verify its operation and whether we need to use the pga on the cpu to get some gain
between the hall effect sensor and the cpu...
Received the CYL0101 N40 radially magnetized magnets from supermagnetman.net.
These are 4mm OD by 5mm long by 1 mm ID tube magnets. They easily force the a1391 hall effect sensor close to the rails when you move the poles toward the sensor. They should be fine in in the application. No additional gain is needed from the PGA in the cpu.
The next task is to build the prototype servoactuator mechanics using
the the 1391 hall effect sensor, the cyl101 magnet, and a suitable coil
and assocaited axles, plastic parts, etc....
Since I have not completed the mechanical setup for the actuator,
I decided to connect up some falcon servo mechanics to debug the PID math routines. In this prototype setup the falcom 4mm pager motor is driven by the a3901 hbridge, and the falcon hall effect sensor a3515 ( 5mv sensitivity) is used. I replace the falcon magnets wiyh a 2x3 mm radially polarized magnet from indoor flyer (courtesy of Paul Garrett).
Adjusting the sensor a little gives rail to rail operation, without over saturating the sensor.
This gives pretty much the optimum mechanical setup needed for debugging the PID routines for either a pager driven servo or a servo/actuator.
I attached a photo of the board with the falcon mechanics mounted to it...
In the meantime I bought and received a couple of microinvent actuators to use as development assets. I stacked the microinvent actuator on top of my hall efect sensor prototype adappter and saw that the magnet in the actuator
could force the hall effect sensors output to the rails. the magnet in the microinvent actuator is radially polarized, like the one we want to use in our final design. Some actuators like plantracos use dfferently polarized magnets, and that makes them harder to adapt to our feedback controller as easily....
I uploaded a clip of the microinvent actuator moving as the GWS servo tester was in sweep mode, driiving out servo actuator controller in open loop mode.
In that mode the controller is determining the pulse width from the servo tester, and programmin the nhbridge to move the actuator output arm. The current through the coil is proportional to the servo pulse width, and of course chages direction when the servo pulse time moves throught the 1.5 msec mark...This actuator had a centering magnet...
I tested one actuator with the centering magnet and one without(I finally got some CA debonder to remove one..). The one with the centering magnet moved proportionally throught the range of movement, while the one without seemed to move really quickly from one side to the next when the commanded position was close to the other side....
the weight of the arm seeemd to keep it to one side of center if no centering
force is applied...
I started to attach the actuator to the board with the hall effect sensor on it. I added a couple of basswood rails to set the actuator on, and this would have put the actuator just above the sensor.
I ran some tests with this setup , but I was not totally satisfied with the
operation of the hall sensor. I want the mechanical setup to operate between the rails throughout the movement of the output arm, but the current setup forced the hall sensor output to the rails.. I decided to buy some more hall effect sensors with different sensitivities and try this again later. I could have increased the distance from the actuator to the sensor, but this is a little cumbersome, and I want to try the other sensors first.
I received the other hall effect sensors and did some more experimentation.
and came to the conclusion that the sensor to use to modify the microinvent actuator to an actuator servo with e mechanical setup I am using is the highest sensitivity sensor (a1391).
It seems the as built properties of the actuator I tested was not very symettrical about the magnets neutral point.... My setup measured on the ADC from about 0x90 to 0xFF for the sensor output voltage...from one range of the output arm to the other.
I need to retest this to verify the data will have to test another one to see if it is close to the first one.. then I can come up with a model use use in the PID algorithm...
Here are all the app notes and web resources
I used for reference for this project...
Software PID Control of an Inverted Pendulum Using the PIC16F684
Low-Cost Bidirectional Brushed DC Motor Control Using the PIC16F684
RC Model Aircraft Motor Control
Intelligent Remote Positioner (Motor Control)
Servo Control of a DC-Brush Motor
Implementing a PID Controller Using a PIC18 MCU
Discrete PID controller
web reource on PID controllers......
ImagesView all Images in thread