pulsin from futaba reciever
glitch
Posts: 7
im trying to "read" a signal sent to a servo, i want to declare a dead zone, from aprox 140 - 160, and determine if servo signal is 160 + or 140 - , signal is from a futaba reciever, i am currently running 110k ohm resistor from signal wire of servo, to pin 15,· and using
pulsin 15, 1 , pls
if pls < 140 then goto tst
if pls > 160 then goto rst
the problem is when i debug pls, i get the ascii o with 2 circles above it, or 149, but when i change the symbol out of the reciever , i dont see proportional change from the var pls.. from what i see it should work to decode the pulses sent by the reciever, but doesnt work to use logic to create program flow,
i also thought about using pwm,
how do i get this to work , i just need to see if the end result of the signal is center (in dead band) , clock wise or cc, and have a program send it self to the corosponding leg of the program, about every 1/4 second or less ,
maybee is the 110k resistor to large,·
pulsin 15, 1 , pls
if pls < 140 then goto tst
if pls > 160 then goto rst
the problem is when i debug pls, i get the ascii o with 2 circles above it, or 149, but when i change the symbol out of the reciever , i dont see proportional change from the var pls.. from what i see it should work to decode the pulses sent by the reciever, but doesnt work to use logic to create program flow,
i also thought about using pwm,
how do i get this to work , i just need to see if the end result of the signal is center (in dead band) , clock wise or cc, and have a program send it self to the corosponding leg of the program, about every 1/4 second or less ,
maybee is the 110k resistor to large,·
Comments
···· I've only recently played with servo's but the attached piece of code allowed me to read a two channel radio without difficulty. I think the servo outputs are standard in the industry with about 1.5 mSec being the center and 1 mSec and 2 mSec being clockwise and counterclockwise. Therefore, using a BS2, the numbers range from about 490 to 950, with center being about 745 in my case.
·· Hope this helps.
·Cheers
· Tom Sisk
ch1 VAR Word· 'left-right direction
ch2 VAR Word· ' forward-reverse
loop:
PULSIN 6,0,ch1
PULSIN 7,0,ch2
DEBUG DEC ch1,"· ",DEC ch2,HOME
GOSUB motspd
PAUSE 250
GOTO loop
motspd:
IF ch1 < 300 OR ch2 < 300 THEN nolink
IF ch2 < 700 THEN revboth
IF ch2 > 715 THEN forward
RETURN
comon sence says if a i/o pin from bs2 can prouduce the signal i shouldnt need a resistor to recieve the signal, but fear of "noobing " one of my inputs had me place it,
Yes, it is best to use a resistor on your input pin, but about 1 kOhm will work better than the 100k you have now.
Klaus
··· The other thing I noted was that the voltage level of the pulses out of the radio was only about 4 volts; so, you may find that the resistor can be eliminated or reduced even further to about 100 ohms.
·· As well, in the code I posted, the pulsin parameter in my case was set to '0' because I used a transistor off the radio to invert the signal. Yours is OK I think, but make sure the variable is big enough ( a word, not a byte).
·· The debug statement should include the DEC parameter so that a number is displayed.
·Tom Sisk
do i need to change the numbers i have reading the positions ie 700 715,,
or is it posibly the resistor doing me wrong, over all it works but ,, seems to be "glitchy"
curent configuration includes
homework board, 9volt ,
futaba reciever / tx ,2 servos, run off a nmhi rechargable, 6 volt pack,
i keep getting funny results, and driving my self crazy, but i suspect the two runing off the same sorce, might yeild me corect results,, with my curent circutry and programing,
is there any weight in this? can supply circutry drawings, but dontthink its necesary
··· Glad to see you making some progress.
·· For sure, the neg of the radio power pack and the negative of your stamp board should be tied together. They don't have to be the same source as long as they have a common negative.
··· Its normal for the numbers to move around a bit. Its due to the way pulsin measures time, in chunks of 2 uSec. What I did was run the test program and note the numbers as I moved the stick to various positions. Then you can write some·IF statements or SELECT CASE statements so that they are triggered whenever the number is between some "bracket".
· Good Luck.
·Tom Sisk