Shop OBEX P1 Docs P2 Docs Learn Events
Propeller based Wireless Remote Controller with Accelerometer — Parallax Forums

Propeller based Wireless Remote Controller with Accelerometer

TheGrueTheGrue Posts: 114
edited 2010-04-24 07:02 in Robotics
I haven't posted anything on my robot TOBI - The Tool Bot for a while because I have been working building a new Remote Controller for TOBI. The RoBo Remote is the result of my work. I originally purchased everything for my remote but all the parts ran on 5V and the Propeller runs on 3.3V. I went through several redesigns and newer hardware kept coming out that was 3.3V. Size has always been my issue as well as complexity of design. The Propeller chip called the PropStick has an on-board 3.3V regulator that I could use to power other 3.3V devices. I wanted to use that and not have to have a separate 5V regulator and the extra interfacing resistors to run parts that are 5V.

New Developments:

Parallax released a book on the Propeller 'Programming & Customizing the Multi-core Propeller Microcontroller: Official Guide' and in there, there is a chapter on using XBee transceivers for setting up a 3-node robotic network. After reading just a few pages, I was hooked on the XBee's. Since they were only $20 a device, I bought two.

The old accelerometer I had is a 5V 2-Axis one and I wanted 3.3V version. Parallax recently release one and I picked that up as well.

Planning:

After reading only the first part of the chapter on the XBee's I found that they can be set to an ID number and you can form packets to be targeted to specific ID's and all other XBee's will ignore the transmission not sent to them. This is when my TOBI remote became a general RoBo Remote. Since I have another robot I wanted it to be able to control that one as well.

Assembly: See letsmakerobots.com/node/18692

Programming:

The best part is that it is fully programmable. Each button and LED is assigned by your imagination. I have included code to send the Accelerometer data across the XBee connection and some code to test all of the switches and LED's. My thought for my TOBI robot is that I will convert the data from the accelerometer into servo pulses and send those to robot along with several other variables and/or switch states. I will post a more final code once I figure out what I want all of the buttons and switches to do and interface them to the first robot TOBI

TheGrue
John Harris

TOBI – The Tool Bot
letsmakerobots.com/node/7025/
RoBo Remote - Programmable Remote Controller
letsmakerobots.com/node/18692

Post Edited (TheGrue) : 4/11/2010 3:42:47 AM GMT

Comments

  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2010-04-12 01:24
    Great Project nice and neat·work

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ··Thanks for any·idea.gif·that you may have and all of your time finding them smile.gif

    ·
    ·
    ·
    ·
    Sam
  • TheGrueTheGrue Posts: 114
    edited 2010-04-16 05:44
    I am working on an Object that takes the readings of the Accelerometer and converts them to Servo Pulses to feed to the Servo32 Object that I downloaded from the OBEX. Right now it just displays diagnostic data in the Serial Terminal but I will make it into an object that I can call for pulses to send to the robot. I was disappointed by this Accelerometer because it is so jittery even when stationary on a table with no movement. I used the least sensitive 8G mode to generate my pulses.

    Oh and before you try this with a BOE-Bot or a set of Servos, please note that my robot is not using servos but HB-25's. So I send a 2ms pulse to both HB-25's and they move my motors forward. If you wish to use servo's you would have to change the equations to make one servo 2ms and the opposite 1ms to move your robot in one direction.

    Post Edited (TheGrue) : 4/16/2010 5:55:00 AM GMT
  • TheGrueTheGrue Posts: 114
    edited 2010-04-20 07:00
    UPDATE: 2010.04.19

    I just completed the writing of two Objects of code and had a successful test with TOBI (video to come when daylight is available). The code structure looks like this:

    RoBo_Remote_v8.spin

    ├──XBee_Object.spin
    │ │
    │ └──FullDuplexSerial.spin

    ├──Acc_2_Servo_v4.spin
    │ │
    │ └──MMA7455L_SPI_v2.spin

    └──Conduit.spin

    First I worked on the Accelerometer code in steps until it gave me 4 digit numbers that can be plugged into my servo Object on TOBI. This Object eventually came to be called "Acc_2_Servo_v4.spin". I made it initially as a stand-alone top Object that just displayed numbers on the Terminal screen. When I got the numbers that I needed I turn it into an Object that other Objects could call and pass 2 variable addresses for it to store the results in.

    Next I worked on another Top Object to call the Acc_2_Servo_v4 Object that I eventually called "RoBo_Remote_v8.spin". RoBo_Remote_v8 first tests the LED's with a display pattern. Then initializes the accelerometer Object and programs the XBee radio. The bulk of the work is done in "PUB SendControl". First it checks my top three slider switches to see if I changed them. If so, it calls a method that will read them and reprogram the "SendTo" address on the XBee radio. Next it checks to see if my right slider switch is off or on. If it is off, it calls the XBee Object to send a simple "h" (that stands for Halt on the robot end). If the switch is on, it calls my Acc_2_Servo_v4 to read the accelerometer and gets back two variables: "LeftPulse" and "RightPulse". Then it calls the XBee Object again and first it sends a simple "d" (for Drive) followed by the RightPulse and the LeftPulse variables.

    It was surprisingly simple for someone who only started learning Spin this January. The fact is that you do not have to know how someone elses code works as long as you know how to call it and if the writer is good on his in-code documentation then he/she will tell you how to call code and get back the results.

    Lastly, is that I have attached a zip file (RoBo_Remote_v8_-_Archive__Date_2010.04.19__Time_22.20.zip) which is the Archive feature of the Propeller Tool that includes all Objects that make up this project. I created only 2 of them but all of the others came from the OBEX or the product page on Parallax.

    I will have more postings on TOBI's page as I work with both devices.
  • Rob7Rob7 Posts: 275
    edited 2010-04-21 13:03
    Great Job !
  • TheGrueTheGrue Posts: 114
    edited 2010-04-22 03:40
    UPDATE: 2010.04.20

    I altered and enhanced the code by adding a maximum speed limit by adding two variables PulseMax and PulseMin plus I brought the TurnAdjust variable out of Acc_2_Servo_v6 Object so that I can adjust my turn ratio from the top object. So all of my limits and ratio's are now passable to the Acc_2_Servo_v6 Object for more versitility in adjusting the movements and speeds of TOBI. I also added a second speed of TOBI. I programmed the RoBo Remote to send pulses of half speed unless the middle slider switch is on. So in a sense, I have an indoor speed set as default and a higher outdoor speed.

    I ran into an issue with the slow speed. The max speed limit was set to 1750 and I noticed that if I tilted the remote full forward and then to right or left to turn, TOBI would not turn. I had to go back to the drawing board so to speak. I re-ran the old accelerometer Object that is standalone and assigned my lower limits. Again the problem of turning at full throttle appeared. I solved the issue by adding a line to the code:

    Forward := PulseMin #> Forward <# PulseMax

    This applied my limits to the Forward variable first. Otherwise it could store up to 2000. If it stored 2000 then the max Turn value of 250 would still be above the limit and thus TOBI would not turn as you can see by the following 2 lines of code to set the Pulse variables:

    long[noparse][[/noparse]LeftPulse] := PulseMin #> Forward + Turn <# PulseMax ' Write result of Forward and Turn back to the Variable LeftPulse
    long[noparse][[/noparse]RightPulse] := PulseMin #> Forward - Turn <# PulseMax ' Write result of Forward and Turn back to the Variable RightPulse

    So I also needed to compensate for my variable TurnAdjust by rewriting how I computed the Forward variable from the two X and Z variables like this:

    LLimit := TurnAdjust + PulseMin
    HLimit := TurnAdjust + PulseMax

    ' Find common forward speed from X and Z-axis
    if Z =< -1
    Forward := (LLimit #> ((X * 50) + 1500)) '
    else
    Forward := (((||X * 50) + 1500) <# HLimit)

    This is how I figured out the problem. TOBI is nice and manuverable indoors and fast plus agile out of doors. Time for a Road Test!!! I want to shoot some video but my camera is broken. Somehow I will get some video.
  • TheGrueTheGrue Posts: 114
    edited 2010-04-24 07:02
    UPDATE: 2010.04.23

    I have been working on both the RoBo Remote and TOBI - The Tool Bot projects since they interface with each other. The hardware is done on the RoBo Remote and only the programming needs to be completed. But as I see it, it will never be completed because that is the way I designed it. To be versatile and programmable. So I consider this project as completed. Any further programming for my current and future robots will be posted on their pages. I leave you with parting video of RoBo Remote controlling TOBI - The Tool Bot.

    www.youtube.com/watch?v=uuwb3fn51r4

    Post Edited (TheGrue) : 4/24/2010 7:07:22 AM GMT
Sign In or Register to comment.