|
|
Spockie-Tech
Site Admin
Joined: 31 May 2004
Posts: 3160
Location: Melbourne, Australia
|
Dont quite understand your idea there Angus (?)
Assuming you mean the power to the servo from the receiver on the 3-pin servo cable, it doesnt turn on and off when the servo moves, it just stays at a constant voltage (whatever the battery is at), no reversals or anything..
The position of a servo arm is controlled purely by the variable pulse-width signal on the "data" wire of the 3-wire servo plug. To sense where the servo would be and activate a relay accordingly, you need to measure the width of that pulse accurately (at *least * 1/10,000th of a second resolution), which means you need a microprocessor or some accurate timing circuits.
The good news is that a $4 PicAxe Microprocessor chip can do it quite well if you can be bothered learning how to program it and building your own simple circuit board (its just an 8 pin chip and a few wires).. To drive a big relay, you need to add a second chip to handle the relay coil current.
It gets a bit more complicated when you want to drive 4 relays, since you need the more powerful ($15) 18 pin PicAxe Micro, and then people want mixing, deadbands, failsafe, and braking in there.. but its still do-able. I published a design and the software free for everyone to use, but only a couple of people had a go at it, since it requires some fiddly fine soldering to build.
Aaron was working on some relay controllers that he was going to sell commercially based on this design.. Havent heard how thats going though..
Thats about as simple as relay control gets, without going electro-mechanical servo-switches with their associated problems. Simple diodes just wont allow you to get any useful information from the receivers pulse signal. _________________ Great minds discuss ideas. Average minds discuss events. Small minds discuss people
|
Thu Feb 17, 2005 11:46 am |
|
|
|
|
Spockie-Tech
Site Admin
Joined: 31 May 2004
Posts: 3160
Location: Melbourne, Australia
|
Yes, the receiver supplies a constant voltage to the servo.. it doesnt vary in polarity or voltage.. its just a supply of power to the servo.
The servo contains a custom servo-control chip that measures the width of the incoming servo control pulse from the receiver, and compares that with the resistance value of a potentiometer attached to the servo's output shaft.
If the servo-drive signal says "I want you to be 1/2 forward" (1.75mS pulse width), but the position sensing pot tells the chip that the output shaft is presently in the center, then the servo drive chip applies power to the motor with the correct polarity to spin the motor "forward" until the sensing pot says its at that position.
If the servo input then says I want you to be full back (1mS width pulse), then the chip sees that due to the current position of the feedback pot, it needs to spin the motor backwards, so it applies a reverse polarity signal to the motor until the feedback pot tells it that it has reached full back..
Note that this all happens *inside* the servo, and before you ask (since many have tried before ), you cant easily do your diode/relay idea by tapping into the actual motor drive wires inside the servo either, because the actual motor is driven by PWM (Pulse Width Modulated) signals that will cause a relay to buzz on and off, rather than a constant voltage.
To modify a servo for continuous rotation, you just disconnect the feedback pot and either glue it in the cetner position, or replace it with a fixed resistor that tells the chip that it is in the center position.. that way, as long as the receiver is telling the servo to be in the center, all is well. If the receiver tells the servo to move to any other position, the servo tries to, but because the feedback pot isnt connected, it will never get there (as far as the chip can tell), so the motor will just keep turning until you return the stick to center.
Programming PicAxe's is relatively easy (compared to most microcontrollers).. you just need a 9-pin plug for the serial port on your computer, with 3 wires attached to it. These connect to your PicAxe micro (through a couple of resistors) and you run the free programming software on your PC.. Total cost about $5-$10..
Of course, if you've never done any programming before, and dont understand the difference between logic high and low, or inputs and outputs, and dont know a millisecond from a duty cycle, then you have a bit of learning to do first.. but PicAxes are a good starting point to play with if you like electronics.
lots of info over at www.picaxe.com
@George.. That link is a good one showing how to make servo switches and basics of speed control really well.. have to bookmark that one.. _________________ Great minds discuss ideas. Average minds discuss events. Small minds discuss people
|
Thu Feb 17, 2005 12:32 pm |
|
|
|
|
|
|
|
|
|
|
Spockie-Tech
Site Admin
Joined: 31 May 2004
Posts: 3160
Location: Melbourne, Australia
|
Yes, I've thought that on occasion myself..
I think the site is probably done by the guy who operates MicroZed and while he seems to know his stuff on PicAxe's, his web-design skills are obviously a little limited.. Done in Frontpage too (blech). Silvertone Electronics is very similair, and Bob does that in Word (!)..
Still, all the info you need is there, it just takes a bit of searching around to find it..
Perhaps someone should offer them a web-site re-design in return for some parts or something.. (before any eager young robot builder takes this seriously and rushes off to do this, remember its a good idea to have actually already done a quality website of your own to show your skills before seeking "sponsorship" like that)
Anyway, back on topic, heres a link to a copy of the current code I wrote for the PRC (Pic Relay Controller) that was running Vincent at RoboWars II.
http://www.robowars.org/docs/PRC-v1.2-code.txt
(make sure you have word wrap turned off in whatever you display it in, or else the long comments will wrap around and mess up the formatting of the code and make it harder to read)
Note that Microcode is usually *not* object-orientated in any way. it tends to be very linear, loop-based code, since OO code tends to require some form of supervisory level (usually an operating system) watching for a particular event to occur and then deciding to run the relevant block of code.
In a micro the closest you get to a supervisory system triggering events for you is the I/O or Timer interrupts, so the code has to run in loops watching for trigger conditions itself. makes it more "realtime" too, which is important when you are timing milli-second long pulses.
It could probbaly still do with a few tweaks, and to anyone who wants to build one, make sure the Pic-Axe micro has a well filtered power supply (nice big caps on the input) to stop it from glitching under the power spikes of your motors slamming on and off at full power. Vincent was occasionally getting stuck in a "locked-up" state with the micro crashed until we added some big caps to the micro power supply.
If anyone has any questions.. feel free to ask. _________________ Great minds discuss ideas. Average minds discuss events. Small minds discuss people
|
Sun Feb 20, 2005 1:24 pm |
|
|
|
|