Shop OBEX P1 Docs P2 Docs Learn Events
Control Boe Bot with Android Phone via Bluetooth module? — Parallax Forums

Control Boe Bot with Android Phone via Bluetooth module?

kwalsethkwalseth Posts: 7
edited 2012-03-02 10:02 in BASIC Stamp
I am trying to program my Boe Bot with my cell phone for a class project. Any ideas as to how this will work, or will it at all? My bluetooth module will be here within the next few days, but i am not sure what program to install on my phone or how to go about making this work... any advice??

Comments

  • Clive WakehamClive Wakeham Posts: 152
    edited 2011-04-18 03:34
    The first question you need to answer is "Do you have an app on the Android phone that allows you to send keystrokes etc via bluetooth?"
    Then you need to get the bluetooth of the phone to detect and link with the bluetooth module.
  • kwalsethkwalseth Posts: 7
    edited 2011-04-18 19:33
    I have seen this done on youtube videos with a sony-erickson phone and a nokia, i have done a lot of googling and have had no luck finding any kind of program.
  • kwalsethkwalseth Posts: 7
    edited 2011-04-27 19:34
    I found a program for my phone that sends bluetooth signal for forward, reverse, exc. My bluetooth adapter will blink when i press the screen but i am not sure where to go from here... how do i debug this to see what it is doing and how to program it to work? If anyone is interested the program for android is found on the android market "cellbots" any help??? the semester is coming to an end and i need to get this working!!!!!
  • Mike GreenMike Green Posts: 23,101
    edited 2011-04-27 19:50
    You will have to read the documentation for the Bluetooth module and write a program for your BoeBot based on the examples in the documentation that will open a channel to the phone and, with DEBUG statements, show what's being received. Who knows what the phone is sending for forward, reverse, etc.? Once you're able to receive data with the Bluetooth adapter and you know what those characters are, you should be able to write a program that moves the BoeBot in response to what it receives.
  • kwalsethkwalseth Posts: 7
    edited 2011-04-27 20:30
    Thank you for the help!!! my question now is i have my phone talking to my boe bot via bluetooth, and my boe bot talking to my pc via data cable.... how do i write a program to find out what kind of signal my phone is sending to the boe bot??
  • Mike GreenMike Green Posts: 23,101
    edited 2011-04-27 20:44
    You write the program. The Bluetooth module documentation shows how to get data characters from the Bluetooth connection. You turn around and send them to the PC using the DEBUG statement. Sometimes the characters sent might be non-displayable. Typically characters with values in the range 0-31 and 128-255 need to be displayed specially. Look up the description of ASCII in the Wikipedia for what these values are used for. Your program could test to see if each received character is in one of these ranges and, if so, display it with DEBUG in either decimal or hexadecimal (using DEC or HEX in front of the value).

    If you don't really know how to program the BoeBot, start with that ... you'll actually save some time doing so. The "What's a Microcontroller?" tutorial is a good place to start. It's included in the Stamp Editor's help files and you can download it from Parallax's Downloads webpage.
  • kwalsethkwalseth Posts: 7
    edited 2011-04-27 21:05
    Thank you very very much!!!! i just figured it out... now i just need to write the program. i have the phone and the boe bot communicating and i can now see it in the debug screen
  • bill190bill190 Posts: 769
    edited 2011-04-28 09:01
    If you have the time at some point, please post all about what bluetooth module you are using, where to get that, what Android app you are using, how the bluetooth is connected to the Boe Bot, etc.

    Everybody and their brother wants to get their Android phone to "do things". Sounds like you came up with an easy solution!
  • kwalsethkwalseth Posts: 7
    edited 2011-04-28 09:53
    well here is my issue now, i have it communicating and working, except it will not allow me to search for different signals from the phone while in a loop. i will post my basic stamp program and see if any of you can help. it will go forward, backward, left, right, for a given time, i want it to go untill i ask it to go another way.
    I have the parallax easy bluetooth module, HTC Aria phone, and cell bots app from android market.

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}

    direction VAR Word
    x var word
    RX CON 2
    TX CON 0
    Baud CON 84

    main:
    DO
    SERIN RX, Baud, [direction]
    SEROUT TX, Baud, [direction]
    DEBUG direction
    IF direction = %01100110 THEN GOSUB forward
    IF direction = %01110010 THEN GOSUB right
    IF direction = %01101100 THEN GOSUB left
    IF direction = %01100010 THEN GOSUB back
    IF direction = %01110011 THEN GOSUB stoping
    LOOP

    forward:
    FOR x = 0 TO 1000:
    PULSOUT 12, 500
    PULSOUT 13, 1000
    NEXT

    GOTO main
    right:
    FOR x = 0 TO 500:
    PULSOUT 12, 500
    PULSOUT 13, 500
    NEXT
    GOTO main
    left:
    FOR x = 0 TO 500
    PULSOUT 12, 1000
    PULSOUT 13, 1000
    NEXT
    GOTO main
    back:
    FOR x = 0 TO 100
    PULSOUT 12, 1000
    PULSOUT 13, 500
    NEXT
    GOTO main
    stoping:
    PULSOUT 12, 750
    PULSOUT 13, 750
    GOTO main
  • kwalsethkwalseth Posts: 7
    edited 2011-04-28 11:36
    Here is the final basic stamp code. It works very well!!! For all of those who said this was not possible... Wallllaa

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}

    direction VAR Word
    x VAR Word
    y VAR Word
    RX CON 2
    TX CON 0
    Baud CON 84

    main:
    DO
    SERIN RX, Baud, 20, No_Data, [direction]
    No_Data:



    y = 0
    DEBUG direction
    IF direction = %01100110 THEN GOSUB forward
    IF direction = %01110010 THEN GOSUB right
    IF direction = %01101100 THEN GOSUB left
    IF direction = %01100010 THEN GOSUB back
    IF direction = %01110011 THEN GOSUB stoping
    LOOP

    forward:
    PULSOUT 12, 500
    PULSOUT 13, 1000

    RETURN
    right:

    PULSOUT 12, 1000
    PULSOUT 13, 1000
    RETURN
    left:

    PULSOUT 12, 500
    PULSOUT 13, 500
    RETURN
    back:

    PULSOUT 12, 1000
    PULSOUT 13, 500
    RETURN
    stoping:
    PULSOUT 12, 750
    PULSOUT 13, 750
    RETURN
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2011-04-28 13:48
    Somebody posted, "For all of those who said this was not possible... Wallllaa"

    Looked up and down this thread, nobody stated this as being impossible.
    You were urged to get in there and get to work, to take ownership and make it happen.
    Good on you, kwalseth!
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2011-04-29 08:17
    @PJ Allen, if someone had said it was impossible, it would have been done even quicker *grin*.

    This is pretty cutting edge stuff.

    I've got an android "epad" ("apad", "pandapad") which cost me $110 including shipping, and it can do some cool things including being programmable with Basic4Android via wifi. But it doesn't have bluetooth. Pay another $50 and you can get a pandapad with bluetooth, and this opens up some amazing possibilities. Real world control of a basic stamp or propeller via a device with a hi res touchscreen. UAV for the masses, here we come!
  • Anarki4Anarki4 Posts: 5
    edited 2012-03-02 02:24
    And how did you make your Android phone see your Boe bot in Bluetooth network?
  • Martin_HMartin_H Posts: 4,051
    edited 2012-03-02 06:07
    Anarki4 wrote: »
    And how did you make your Android phone see your Boe bot in Bluetooth network?

    I've paired a Bluetooth module with a PC and Bluetooth devices with my Android tablet. The process is similar on both, so I would imagine that when you pair the Easy Bluetooth module with the phone it creates a new serial port on the phone much like it does on the PC.
  • Anarki4Anarki4 Posts: 5
    edited 2012-03-02 08:14
    I see. But you need the Android to see the module in Bluetooth devices list.
    My problem is that I can pair PC and module, phone and PC, because Android finds only PC after the Bluetooth scan.
    Maybe you rooted your Android?
  • Martin_HMartin_H Posts: 4,051
    edited 2012-03-02 09:26
    Yes my tablet is rooted.
  • Anarki4Anarki4 Posts: 5
    edited 2012-03-02 10:02
    Do you think this is the reason?
    How did the module look in the Android Bluetooth scan results? Which version of module do you have? Mine is eb500-SER D.
Sign In or Register to comment.