Shop OBEX P1 Docs P2 Docs Learn Events
Help!! Need to read the output from a Futaba receiver. — Parallax Forums

Help!! Need to read the output from a Futaba receiver.

DavidNymanDavidNyman Posts: 52
edited 2009-11-28 21:34 in BASIC Stamp
I've built a quadrotor helicopter and I'd like to use a BS2 to handle the flight controls.
I'm using 4 Rimfire Brushless motors with a brushless controller on each corner.· Each corner has the pitch controlled by a small servo mounted directly under the brushless motor.· There's a piezo gyro controlling each servo.·
The BS2 will handle some mixing duties between all four servos.· I'd like to read the pulse output 1-1.5-2 ms output (standard servo stuff) with the BS2 and program the outputs to output a mixed number to each servo.
I can handle the mixing duties I just need a few simple lines of code to read the output from the receiver.

I've attached a picture to show what I'm doing.

Any help would be greatly appreciated.
Thanks!
600 x 800 - 143K

Comments

  • stamptrolstamptrol Posts: 1,731
    edited 2009-11-28 01:10
    ·Heres a bit of programming I did for a twin-motored survey barge.

    · I know you wanted a short example...but the guts of what you need happens in the first 29 lines of code.
    The remainder is for all the left-turn choices.

    · I was limited to 3 speeds on each motor, but in both forward and reverse in order to steer. This program
    only uses 2 channels; by the time the project was done, all 6 or 7 channels had a job.

    · Cheers,

    ·

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tom Sisk

    http://www.siskconsult.com


    Post Edited (stamptrol) : 11/28/2009 1:16:31 AM GMT
  • DavidNymanDavidNyman Posts: 52
    edited 2009-11-28 01:21
    Thanks for the quick response!
    I'm guessing the following is for reading the receivers pulse output at inputs 6 and 7 of the BS2:

    PULSIN 6,0,ch1
    PULSIN 7,0,ch2

    I'll give it a try!

    Thanks again!
  • DavidNymanDavidNyman Posts: 52
    edited 2009-11-28 19:20
    I must be a bit more out of practice than I realized.
    I'm trying to get started reading the input on ch1 and ch2 and then outputing the results on P0 to a servo.
    I can't seem to make the servo work.
    Can anyone help?
  • W9GFOW9GFO Posts: 4,010
    edited 2009-11-28 20:04
    DavidNyman said...
    I must be a bit more out of practice than I realized.
    I'm trying to get started reading the input on ch1 and ch2 and then outputing the results on P0 to a servo.
    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    
    DO
    
    PULSIN 6,0,ch1
    PULSIN 7,0,ch2
    
    DEBUG DEC3 ch1," ", DEC3  ch2,"  ", HOME
    PAUSE 10
    
    IF ch2 > (740) AND ch2 <(760) THEN PULSOUT leftservo, 750
    IF ch2 > (760) AND ch2 <(780) THEN PULSOUT leftservo, ch2
    
    LOOP
    



    Try "PULSIN 6, 1, ch1"

    Also, reading four channels and then controlling four ESCs plus four servos is going to be way too much for the Basic Stamp, it just isn't anywhere near fast enough. Each one of those things happen at 50 times a second - that would be 4 inputs and 8 outputs, plus whatever calculations need to occur with only 20mS of time to get it done.

    The Propeller could do it easily.

    Rich H

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Simple Servo Tester, a kit from Gadget Gangster.
  • DavidNymanDavidNyman Posts: 52
    edited 2009-11-28 20:53
    I never mentioned controlling the ESCs with the BS2. As mentioned above I will have the BS2 handle the mixing duties between the four servos alone.
    The ESCs will be controlled directly from the radio on channel 5. I'm only controlling the ESCs with one channel as the speed on each motor will remain constant and the pitch on the prop will be the only thing that changes.
  • W9GFOW9GFO Posts: 4,010
    edited 2009-11-28 21:34
    Even if you read only two channels and output only two channels I think you will find that the stamp is not fast enough. Each PULSIN alone could take up to 20mS because it waits for the signal to go high then counts how long the pulse stays high. Since that pulse only occurs once every 20 mS - well, it may have to wait for it. Then it may have to wait again for the next channel. Then there's the time it takes for each command to execute...

    I've used the V-Pitch props before. What I noticed is that they are not precise. Meaning that subtle changes in pitch, like what you need in a VTOL, were not possible. It could be the way I had it set up, but I think you may find when under power that the pitch movement is "notchy". I hope you have more success than I did.

    Rich H

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Simple Servo Tester, a kit from Gadget Gangster.
Sign In or Register to comment.