Shop OBEX P1 Docs P2 Docs Learn Events
pulsin from futaba reciever — Parallax Forums

pulsin from futaba reciever

glitchglitch Posts: 7
edited 2005-02-28 02:14 in BASIC Stamp
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,·

Comments

  • glitchglitch Posts: 7
    edited 2005-02-27 12:31
    is my question clear? can any one help?
  • stamptrolstamptrol Posts: 1,731
    edited 2005-02-27 13:13
    ·· Hi,

    ···· 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
  • glitchglitch Posts: 7
    edited 2005-02-27 13:30
    so, do i need a resistor run between input and signal wire from the reciever, mebe this is why i cant see a diff when i create change via remote controll, i really thought my circut should have worked, but it didnt,, pulsin comand does infact work this way though,? must be my wireing or my resistor, i think its the reistor, , any sugestions on a beter value for it ,, or is it needed,

    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,
  • K de JongK de Jong Posts: 154
    edited 2005-02-27 13:48
    Hi glitch,

    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
  • stamptrolstamptrol Posts: 1,731
    edited 2005-02-27 16:44
    ·· glitch,

    ··· 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
  • glitchglitch Posts: 7
    edited 2005-02-27 20:06
    alright man, im geting closer, i switched to 100 ohms, and 90 % of the time it reads corectly, the thing im noticing, is that when i leave the controler alone, i sometimes read left, and it only seems to regester a right,,, when i turn the remote 1/6th of the way turning all the way does not exact a change in program flow, and sometimes it reads a change when none is present,

    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"
  • glitchglitch Posts: 7
    edited 2005-02-27 22:36
    quick question relating so ill drop it here,

    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
  • stamptrolstamptrol Posts: 1,731
    edited 2005-02-27 22:51
    ·glitch,

    ··· 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
  • glitchglitch Posts: 7
    edited 2005-02-28 02:14
    ureeka working [noparse]:)[/noparse]
Sign In or Register to comment.