Control a few servos at the same time
Henry Chan
Posts: 5
Is this possible?
I want to make an model airplane Radio Control system using Stamp with RF module. Just like a usual radio control, I need to monitor at least 4 channels(Throttle, alieron, elevator and rudder) at the same time from 4 potentiometer. As there's no interrupt in Stamp, how can I do this? Hopefully I don't need to get an extra Stamp chip for every extra channel!
Thanks a lot
I want to make an model airplane Radio Control system using Stamp with RF module. Just like a usual radio control, I need to monitor at least 4 channels(Throttle, alieron, elevator and rudder) at the same time from 4 potentiometer. As there's no interrupt in Stamp, how can I do this? Hopefully I don't need to get an extra Stamp chip for every extra channel!
Thanks a lot
Comments
GOSUB ReadPorts
GOTO MAIN
ReadPorts:
PULSIN 1, 1, Port1Val
PULSIN 2, 1, Port2Val
PULSIN 3, 1, Port3Val
PULSIN 4, 1, Port4Val
RETURN
' Note each "PULSIN" may take up to 20 mSec to complete,
' it depends on the order the 'reciever' channels are sent.
IF you're looking to INTERCEPT or MONITOR the R/C signals from an EXISTING R/C Transmitter/Receiver system, Allan has given you a fine example. Many folks have been quite surprised and pleased at·how much additional function or the various alterations they can achieve this way.
IF you are looking to CONSTRUCT an R?C transmitter/Receiver system with a PBASIC Stamp, I'm afraid that's just not going to happen, for at least 1/2 a dozen different reasons.
Regards,
Bruce Bates
Post Edited (Bruce Bates) : 10/25/2006 10:19:24 PM GMT
Take it simple first. If I only make the Stamp as a dummy device, that is, I connect my existing 4 Channels R/C receiver to my BS2 port 1-4, and I connect my servos to port 5-8. So I read ports 1-4 using Allan's code and add another subroutine for ports 5-8 using PULSOUT command. Is this correct?
Here's my actual scenario. I want to make a very simple UAV autopilot system like this http://www.micropilot.com/prod_mp2028g.htm. For my first version, I only need to INTERCEPT the R/C signals from my existing JR/Futaba remote control. And when I switch on the autopilot, the plane can fly itself from my preset GPS waypoints. When I switch off, I can control the plane again just like a usual R/C plane. Meanwhile the real-time flying data can be transmitted to my computer by the RF module. I found a transceiver(I only use it as transmitter), http://www.haccom.com/en.htm, that got 2km range which is good enough for my project.
And for my second version, I don't want to waste half of transceiver(use to both transmit and receive this time) and I want to control my plane in real-time from my PC, this is my final goal!
Sounds my first version is more realistic to complete than the second one.
Thanks a lot!
I'd prefer to think of the Stamp as an intercept device, rather than a "dummy device", but it sounds like you have your plan well in hand. Good luck with it, and let us know if we can be of further assistance.
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
<!--StartFragment -->
WritePorts:
PULSOUT 4, Port1Val
PULSOUT 5, Port2Val
PULSOUT 6, Port3Val
PULSOUT 7, Port4Val
RETURN
Note the 'servo' output signal should be refreshed every 20 mSec. In this app, the delay of reading the INPUT signal will already give you that delay, so you don't need an additional "PAUSE 20" instruction in your code.
If you DO want your BS2 to control the servo's "autonomously", then you'll need a PAUSE somewhere so you don't refresh the servo's too often.
Why wouldn't it work (I am not asking sarcastically)? I want to know because I have a couple more projects planned and maybe I should switch methods.
Thanks,
Carlos
So my next step is to start my Maths lesson: work with the GPS, tell the plane how to fly.
Have you ever used an ordinary multiple channel R/C transmitter and receiver? If not, just using one will show you part of the problem. With your setup, you can only move one servo at a time (concurrently). With an ordinary R/C transmitter you can operate multiple servos different amounts (nearly simultaneously).
Next, unless I'm mistaken, using 433 MHz for "control purposes" is an illegal use under Part 15 of the FCC Regulations.
Additional deficits can be found in individual channel trim, servo reversing, signal validity, transmitter range (Part 15 issue), minimal channel refresh time, and I suppose I could go on if you want me to.
I'm glad your system worked out to meet your minimal needs.
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
<!--StartFragment -->