Shop OBEX P1 Docs P2 Docs Learn Events
Picco Z/Hevoc Heli Remote with the Boe-Bot — Parallax Forums

Picco Z/Hevoc Heli Remote with the Boe-Bot

jsmasterkingjsmasterking Posts: 35
edited 2008-07-25 00:02 in Robotics
I ordered two of these little buggers for 20 each. One of them crashed so I gutted it and was surprised to find a 38 kHz IR detector!

Searching around on the net I found this post by andrewm1973 covering the IR protocol. So I adapted the code from IR Remote for the Boe-Bot and now I have a remote control for the Boe-Bot with proportional steering and throttle (no reverse, although I made it so that you could inch backward by turn right-left-right-left as so on). The delay between IR commands are very large (and very with each channel, channel C being the least jittery). The following code is made for channel C, it will twitch a bit in B and a lot in A. The BS2 didn't have enough memory to handle all the info send by the TX, such as the channel number and trim button position. Thus I also wasn't able to use the checksum.

Here is the code. 38 kHz IR detector is connected to Pin 9 thought a 220 ohm resistor, the same circuit found in Robotics with the Boe-Bot and IR Remote for the Boe-Bot.
' {$STAMP BS2}
' {$PBASIC 2.5}

dummy VAR Word
time VAR Word(7)
throttle VAR Nib
rudder VAR Nib

leftPulse VAR Word
rightPulse VAR Word

DO
  DO
    RCTIME 9, 1, dummy
  LOOP UNTIL dummy > 900

  PULSIN 9, 0, dummy
  PULSIN 9, 0, dummy
  PULSIN 9, 0, dummy
  PULSIN 9, 0, dummy

  PULSIN 9, 0, dummy
  PULSIN 9, 0, dummy

  PULSIN 9, 0, time(0)
  PULSIN 9, 0, time(1)
  PULSIN 9, 0, time(2)
  PULSIN 9, 0, time(3)

  PULSIN 9, 0, dummy
  PULSIN 9, 0, dummy
  PULSIN 9, 0, dummy
  PULSIN 9, 0, dummy

  PULSIN 9, 0, time(4)
  PULSIN 9, 0, time(5)
  PULSIN 9, 0, time(6)

   throttle = 0
   rudder = 0

   IF (time(0) < 320) THEN throttle.BIT3 = 0 ELSE throttle.BIT3 = 1
   IF (time(1) < 320) THEN throttle.BIT2 = 0 ELSE throttle.BIT2 = 1
   IF (time(2) < 320) THEN throttle.BIT1 = 0 ELSE throttle.BIT1 = 1
   IF (time(3) < 320) THEN throttle.BIT0 = 0 ELSE throttle.BIT0 = 1

   IF (time(4) < 320) THEN rudder.BIT2 = 0 ELSE rudder.BIT2 = 1
   IF (time(5) < 320) THEN rudder.BIT1 = 0 ELSE rudder.BIT1 = 1
   IF (time(6) < 320) THEN rudder.BIT0 = 0 ELSE rudder.BIT0 = 1

   DEBUG HOME, DEC throttle, CLREOL, CR,
         DEC rudder, CLREOL, CR

   leftPulse = 750 + (7 * throttle)
   rightPulse = 750 - (7 * throttle)

   IF (rudder <> 0) THEN
      IF (rudder > 4) THEN
        leftPulse = leftPulse - (30 * (8 - rudder))
      ELSE
        rightPulse = rightPulse + (30 * rudder)
      ENDIF
   ENDIF

   PULSOUT 13, leftPulse
   PULSOUT 12, rightPulse
   PAUSE 20
   PULSOUT 13, leftPulse
   PULSOUT 12, rightPulse
   PAUSE 20
   PULSOUT 13, leftPulse
   PULSOUT 12, rightPulse
LOOP


▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·on····· plane··········································, when catching ducks

"In this house, we obey the laws of thermodynamics!"
··············································································^
http://profiles.yahoo.com/jsmasterking

Post Edited (jsmasterking) : 7/23/2008 9:21:44 PM GMT

Comments

  • O.T.RobotO.T.Robot Posts: 17
    edited 2008-02-11 11:23
    Thanks

    it helped cous i have 3 Picco Helis
  • NecromancerNecromancer Posts: 6
    edited 2008-07-23 16:57
    Hi,

    I've been attempting to figure out how to fly my Picco Z helicopter autonomously, so I was intrigued when I searched and saw your post.

    I should clarify that by "autonomous" in this case, I mean·my BS2 on a BOE is pulsing out the IR codes to fly the heli, not that everything is onboard the heli as it's probably too small for that.

    Unfortunately though, I tried this code and still wasn't able to get the Heli to do anything.· I had been looking at Andrewm1973's post earlier as well, and it looks like there are discrepancies between the pulse times he lists vs. the code here.· With me being somewhat new to the BS2 and PBasic though, maybe I'm not understanding something about how the timing works.

    In any case,·I was hoping I could get clarification on how to at least trigger the throttle from my BOE, and then I should be able to derive everything else from posts.

    Thanks in advance!
  • jsmasterkingjsmasterking Posts: 35
    edited 2008-07-23 21:24
    Hey Necromancer,

    From your post, I gather you were trying to control the Picoo Z using my code. However, I regret to inform you that my code is for controlling the BOE Bot using the Picoo Z's remote. I am unsure if the Basic Stamp has enough power to control the Picoo Z. If I find time, which is not very likely in the next few months, I'll try to investigate since your idea is very intriguing.

    PS. I just looked at the code I have posted and I see that I posted the wrong version. This version of the program was made to control the Roomba with the Picoo Z's remote over the Roomba's IR protocol - which I never got to test. How dumb of me. I see why you got confused.

    I have edited post and replace the code with the correct version - so if you have a Boe-Bot and the Picoo Z remote you can try it out if you like. If you need any help, please feel free to contact me.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·on····· plane··········································, when catching ducks

    "In this house, we obey the laws of thermodynamics!"
    ··············································································^
    http://profiles.yahoo.com/jsmasterking
  • NecromancerNecromancer Posts: 6
    edited 2008-07-24 17:33
    Hi jsmasterking,

    Thanks for getting back to me on this.· It looks like I was confused after all. smile.gif

    I am going to try out your code though, since it'll help me to understand the systems better, and I·now have a couple of these·Picco·Z remotes sitting around idle anyway.

    And thanks for your offer of help - I just might take you up on that if I need it!
  • jsmasterkingjsmasterking Posts: 35
    edited 2008-07-24 23:57
    I hope my code work!

    Before you continue with your conquest however, I would like to tell you some milestones you'll face. One is that the IR protocol requires you to have a carrier signal 38 kHz - which the Basic Stamp cannot do. The FREQOUT command does accept 38 kHz - which is used for the IR headlights for the Boe-Bot however, it generates the 38 kHz using a lower frequency which contains the 38 kHz as a harmonic. This means the signal is very weak (shown by the effective range of the IR headlights for the Boe-Bot). The rest however should be fine. You might have a hard time calculating the checksum, but the speed of the Basic Stamp wouldn't matter. The Picoo Z holds onto the last command it received for a few seconds, so as long as the Basic Stamp can transmit every 5 seconds (I think, I haven't timed this) or less, the Picoo Z will hold the last command. You can test the time by hovering the Picoo Z and then shutting off the controller and timing how long it takes for the Picoo Z to idle.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·on····· plane··········································, when catching ducks

    "In this house, we obey the laws of thermodynamics!"
    ··············································································^
    http://profiles.yahoo.com/jsmasterking
  • jsmasterkingjsmasterking Posts: 35
    edited 2008-07-25 00:02
    Good news!

    I just remember that I came across a site where someone controlled the Picoo Z using his computer. Here's the site: http://www.josephn.net/?p=picooz

    He used the printer port, which means you should be able to swap the Basic Stamp in for the computer.

    PS. You might wanna save/download that page because the website goes down often - at least for me.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·on····· plane··········································, when catching ducks

    "In this house, we obey the laws of thermodynamics!"
    ··············································································^
    http://profiles.yahoo.com/jsmasterking
Sign In or Register to comment.