PDA

View Full Version : Help!! Need to read the output from a Futaba receiver.



DavidNyman
11-28-2009, 07:58 AM
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!

stamptrol
11-28-2009, 08:10 AM
·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

DavidNyman
11-28-2009, 08:21 AM
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!

DavidNyman
11-29-2009, 02:20 AM
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?

W9GFO
11-29-2009, 03:04 AM
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. (http://www.gadgetgangster.com/206)

DavidNyman
11-29-2009, 03:53 AM
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.

W9GFO
11-29-2009, 04:34 AM
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 (http://www.emesystems.com/BS2speed.htm) 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. (http://www.gadgetgangster.com/206)