+ Reply to Thread
Page 1 of 17 1234511 ... LastLast
Results 1 to 20 of 324

Thread: Open Propeller Project #1: iPad to ActivityBot

  1. #1

    Default Open Propeller Project #1: iPad to ActivityBot

    Click image for larger version

Name:	OPP-iPad2AB.png
Views:	1220
Size:	120.6 KB
ID:	106176
    Open Propeller Project: iPad to ActivityBot
    iOS Control of Propeller through TechBASIC

    Welcome to our first Open Propeller Project! This project stems from a prior effort we launched in these forums - programming a Propeller from an iPad and a movement quietly underway by banjo, unsoundcode and Mike Cook. You loaded the original discussion thread with every possible solution and educated us about new possibilities we hadn't considered. Many alternatives suggested were quite interesting, including a Propeller web-based programming interface and the concept of a "configurable" robot that completes actions using a serial exchange over XBee S6B modules.

    With that in mind, here are the goals for the first Open Propeller Project:
    1. Control an ActivityBot's direction and speed from an iPad using TechBASIC.
    2. Receive data from the Ping))) Ultrasonic Distance Sensor on the iPad and control the ActivityBot in a semi-autonomous fashion. While the robot would roam autonomously with the Ping))) sensor, the user would have the option to re-orient the ActivityBot's speed and direction anytime from the iPad.
    And for a bonus round:
    1. Should anybody be so inspired, could the ActivityBot run a fixed set of firmware that is configured with a string of serial commands to define its behavior? As an example: play different wav files when different sensors are actuated.
    This post will remain open until the project is mostly finished, at which time we'll change the tag to [completed]. Please put all of your development code on this thread.

    The second post is reserved. This is where we will collect the mostly-final files so others can do this project on their own without combing through long threads. Even when the project is considered complete the thread will remain open for new posts, of course.

    Will you join us in this effort?

    Ken Gracey

    Ken Gracey | Parallax Inc.| Direct
    : (916) 625-3010 | www.parallax.com

    Follow me on Twitter




  2. #2

    Default Re: Open Propeller Project #1: iPad to ActivityBot

    Reserved for source code.

    Ken Gracey | Parallax Inc.| Direct
    : (916) 625-3010 | www.parallax.com

    Follow me on Twitter




  3. #3
    Cluso99's Avatar
    Location
    Sydney/Brisbane Australia or 'sailing on the high seas'
    Posts
    10,060

    Default Re: Open Propeller Project #1: iPad to ActivityBot

    I am definately interested to see this work, but alas no time at the moment. I have aniPad Mini Retina for when I get time.

    Meanwhile I am followingthe other thread with the work heater, jazzed and others are doing. They are learning a great deal of useful info.
    My Prop boards: CpuBlade, TriBlade, RamBlade, www.clusos.com
    Prop Tools (Index)
    Emulators (Index) ZiCog (Z80)
    Prop OS (also see Sphinx, PropDos, PropCmd)

  4. #4

    Default Re: Open Propeller Project #1: iPad to ActivityBot

    I'm not familiar with techBASIC... Is this it?

    http://www.byteworks.us/Byte_Works/techBASIC.html

  5. #5

    Default Re: Open Propeller Project #1: iPad to ActivityBot

    @Rayman, yes thats the link.

    There is a thread in these forums where banjo successfully connected to an iPad using a Xbee wifi module http://forums.parallax.com/showthrea...how-to-connect

    There is a thread with info and video on Chris's Savage//Circuits where a Sparkfun Wifly is used. http://www.savagecircuits.com/showth...S-Coding/page2

    TechBasic has its limitations but has the potential to create some really nice GUI's for the Prop or Basic Stamp.

    Jeff T.

  6. #6

    Default Re: Open Propeller Project #1: iPad to ActivityBot

    If you'd like a head start, check out the tutorial blogs on the Byte Works web site. You can find them on the DIY Blogs page. There is also an O'Reilly book that shows how to use techBASIC to connect to other devices. It's available from O'Reilly, among other sources.

    Click image for larger version

Name:	cat.gif
Views:	70
Size:	20.4 KB
ID:	106190

  7. #7

    Default Re: Open Propeller Project #1: iPad to ActivityBot

    Hi Rayman,

    Yes, that's techBASIC. There's a lot there on the site. Be sure to check out the DIY Blogs page; there is a lot there to get you started.

    Mike

  8. #8

    Default Re: Open Propeller Project #1: iPad to ActivityBot

    Quote Originally Posted by MikeW50 View Post
    If you'd like a head start, check out the tutorial blogs on the Byte Works web site. You can find them on the DIY Blogs page. There is also an O'Reilly book that shows how to use techBASIC to connect to other devices. It's available from O'Reilly, among other sources.

    Attachment 106190
    Thanks for joining in, MikeW50! I take it you're from Byte Works. I've perused the resources you've identified and ordered the book myself.

    Many of our customers are familiar with and appreciate BASIC languages of all kinds, so I've seen a pretty quick adoption of techBASIC by some of the people above. The ease of making a quick WiFi or Bluetooth connection were exciting, too, as the iOS world has felt like it was under total lockdown until I saw those examples.

    Feel free to check back in with us, and welcome to the forums!

    Ken Gracey

    Ken Gracey | Parallax Inc.| Direct
    : (916) 625-3010 | www.parallax.com

    Follow me on Twitter




  9. #9

    Default Re: Open Propeller Project #1: iPad to ActivityBot

    I'll admit it.. I'm still snickering a bit about using the words, "iPad" and "Open" in the same sentence.

    Not all of us have access or have made investment in Apple "i" products, opting for the more inexpensive alternatives. Any chance that there is an Android version of this "techBASIC" in the works, so that not only can other non-apple users participate, or at least expand the potential for this project outside of it's current target?

    Jeff
    Visit PROPELLERPOWERED.COM -:- Micromite Companion available now!
    After you are done here, wander over to our Friendly Forums.
    Online Chat Saturday Nights 9pm EST -:- Projects, not Platforms -:- Follow me on Twitter.

  10. #10

    Default Re: Open Propeller Project #1: iPad to ActivityBot

    I have been working on a PASM driver for the Xbee Wi-Fi module as part of a Wi-Fi program loader. If the driver itself can be of use then I'm happy to share it here.

    One question though, how are you planning to connect from the iPad to the Xbee Wi-Fi module? Are you going to use the Xbee "Soft AP" or Wi-Fi Direct mode or will you just let the Xbee get an IP address through DHCP from a local router and then use that IP address to talk to the Xbee through the router from the iPad?

  11. #11

    Default Re: Open Propeller Project #1: iPad to ActivityBot

    I have ordered the Wifi modules from SparkFun, Ken said they were not for sale yet at Parallax.
    I bought an iPad last year and have enjoyed learning about it and using it .
    I have a Mac Mini and have been playing around with Xcode and Objective C learning for my own
    knowledge something about writing apps for iPhone and IPad.
    While following the programming the propeller with iPad thread I saw TechBasic and my first thoughts
    were here is someone who has been thru some of the issues to what was trying to be accomplished.

    I have the book from TechBasic and just starting to read it, seeing this thread last night caused me to look
    at it again.

    @Jeff and Chris
    I did not know SavageCircuits was back up.
    Jeff, good comments on your recent iPad and TechBasic project there.

    Tom

  12. #12

    Default Re: Open Propeller Project #1: iPad to ActivityBot

    Hi,
    Fully agree with Jeff about the apple and open.

    I looked into buying and programming a iPad a couple of years ago ,but was scared off by the fact that you need to own a apple computer to write programs for the iPad .Did some playing around with the android and the propeller though.

    Brian

  13. #13

    Default Re: Open Propeller Project #1: iPad to ActivityBot

    Quote Originally Posted by Brian_B View Post
    Hi,
    Fully agree with Jeff about the apple and open.

    I looked into buying and programming a iPad a couple of years ago ,but was scared off by the fact that you need to own a apple computer to write programs for the iPad .Did some playing around with the android and the propeller though.

    Brian
    Jazzed is working on a web-based project that will run under Android as well as the iPad and is planning on using the same Wi-Fi module on the Propeller end. That's what I'm hoping my Wi-Fi loader will get used for.

  14. #14

    Default Re: Open Propeller Project #1: iPad to ActivityBot

    Quote Originally Posted by Oldbitcollector (Jeff) View Post
    I'll admit it.. I'm still snickering a bit about using the words, "iPad" and "Open" in the same sentence.

    Not all of us have access or have made investment in Apple "i" products, opting for the more inexpensive alternatives. Any chance that there is an Android version of this "techBASIC" in the works, so that not only can other non-apple users participate, or at least expand the potential for this project outside of it's current target?

    Jeff
    Hey Jeff, whatever we can make open around our collective efforts, we shall. While we can snicker about Apple's closed system and complain about it, they're common in schools and Parallax's future depends on a higher level of integration than we have today. We're getting requests for iPad support with our products. Basic communication with iPad is one step, and program downloads is another lying somewhere in the future.

    You are not the ultimate target audience for anything related to iPad, so I wouldn't expect you to embrace this project.

    iPads were handed out at my son's public school. Their homework is distributed, collected and assessed using iTunes University. The benefit to him is tremendous - school days are shorter, class time is more productive, and less paper is shuffled around. It's a whole ecosystem around the iPad. I like what I see, and apparently others do as well.

    Would be great if there were an Android version of techBASIC (not sure) as I know this OS is quickly gaining speed on iOS in the general user market (not sure of schools).

    If you want to participate, we'd love to have you! I want to keep the tone and effort as productive as possible.

    Ken Gracey

    Ken Gracey | Parallax Inc.| Direct
    : (916) 625-3010 | www.parallax.com

    Follow me on Twitter




  15. #15

    Default Re: Open Propeller Project #1: iPad to ActivityBot

    The iPad just happens to be one component of this multi-part system. It happens to be the human interface device (it and TechBasic) making a WiFi connection eventually to the remote Propeller (robot or whatever). As long as nothing proprietary or iDevice specific is used to talk across this link, there shouldn't be any reason that the human interface device can't be replaced by a myriad of choices (Android, Prop2 RoboRemote, etc.). If all the pieces are made to work together with open standards, then as long as it is properly implemented and documented, the pieces should swap in an out.
    MOV OUTA, PEACE

    ... Rick


    I've stopped using programming languages with Garbage Collection, they keep deleting my source code!!

    "Forth is FUN!"

    Introduction to TACHYON Forth


    PropFORTH Wiki

  16. #16

    Default Re: Open Propeller Project #1: iPad to ActivityBot

    Hello everyone,

    Just a heads up that the Parallax store now has the new Wi-Fi XBee modules in stock and available for purchase:

    XBee Wi-Fi Wire Antenna (#32412)

    XBee Wi-Fi PCB Antenna (#32413)

    Clicking on the links above will take you directly to their product pages on www.parallax.com.

    Enjoy!

  17. #17

    Default Re: Open Propeller Project #1: iPad to ActivityBot

    Ok,
    I see techBasic is a programming environment that is on the iPad ,that makes it a little easier to start programming them.

    Brian

  18. #18

    Default Re: Open Propeller Project #1: iPad to ActivityBot

    Let me then start with some very rudimentary code.
    The setup is that I have a brand new Propeller Activity Bot (PAB) and iPad (3?) with TechBasic. Only the XBee Wi-fi S6B and a Parallax Ping sensor are added to the standard configuration.

    What I've more or less succeded with is controlling the bot by tilting my iPad. Somewhat successful in receiving data from the Ping sensor back to iPad

    As mentioned in http://forums.parallax.com/showthrea...=1#post1234690 I've some of the bits and pieces in place.

    On Propeller side I have this code:
    Code:
    /*
      XBee & iPad Example.c
    */
    
    #include "simpletools.h"
    #include "fdserial.h"
    #include "abdrive.h"
    #include "ping.h"
    
    fdserial *xbee;
    char response[10];
    char ch;
    
    int xbcmd(char *cmd, char *reply, int bytesMax, int msMax);
    
    int main()
    {
    // Initializing the XBee through AT-commands, some settings are router specific
      xbee = fdserial_open(11, 10, 0, 9600);
      pause(1000);
      print("cmd = +++\n");
      int bytes = xbcmd("+++", response, 10, 6000);
      if(bytes == 0)
        print("Timeout error.\n");
      else
      {
        print("reply = %s", response);
    
        print("cmd = Replace this with your SSID\n");
        xbcmd("Replace this with your SSID\r", response, 10, 20);
        print("reply = %s", response); 
    
        xbcmd("ATEE1\r", response, 15, 2000);              // setting WPA encryption
        print("reply = %s\n", response); 
    
        print("cmd = Replace this with your security code to the router\n");
        xbcmd("ATPK8482769243\r", response, 10, 2000);
        print("reply = %s", response); 
    
        xbcmd("ATMY\r", response, 15, 200);                 // showing the XBee's IP-address
        print("reply = %s", response); 
    
        print("cmd = ATDE2616\n");                               // ensuring the port is 2616 (hex)
        xbcmd("ATDE2616\r", response, 10, 20);
        print("reply = %s", response); 
    
        print("cmd = ATIP1\n");                                      // setting IP protocol to TCP
        xbcmd("ATIP1\r", response, 10, 20);
        print("reply = %s", response); 
    
        print("cmd = ATAI\n");                                      // showing 0 if the connection was successful, otherwise another connection status indicator is shown
        xbcmd("ATAI\r", response, 10, 20);
        print("reply = %s", response); 
    
        print("cmd = ATCN\n");                                    // exiting command mode
        xbcmd("ATCN\r", response, 10, 20);
        print("reply = %s\n", response); 
    
    
      int x, y;
      int cm;
      int tx_result;
      short int ping_now = 0;
    
      drive_setRampStep(7);                       // 7 ticks/sec / 20 ms
     
      while(1)
      {
        if (ping_now == 0)                        // only ping every second time
        {
          cm = ping_cm(8);
    //      writeChar(xbee, cm);                  // should send the distance to iPad, is not working correctly for me
          ping_now = 1;
        }
        else
          ping_now = 0;
    
        print("%c", HOME);                        // debug info when running through SimpleIDe
        print("x y cm: %d %d %d\n", x, y, cm);
    
        x = fdserial_rxChar(xbee);                // receiving x (speed) from iPad
        print("%c", CLS);
        print("%c", HOME);
    
        if(x != -1)
        {
          y = fdserial_rxChar(xbee);            // receiving y (direction) from iPad
          if(y != -1)
            if(x > 124 && x < 130)              // "dead zone" to avoid jittering speed
              drive_speed(0, 0);
            
            if(x > 129)
            {
              drive_rampStep((0 - (x - 127) - (y - 127)), (0 - (x - 127)) - (127 - y));
            }    
            if(x < 125)
            {
              drive_rampStep((127 - x) + (y - 127), (127 - x) + (127 - y));
          }
        }
      if(cm < 20)                              // if too close, then reverse
        drive_speed(-15, -15);
      }
    }
    }
    
    int xbcmd(char *cmd, char *reply, int bytesMax, int msMax)
    {
      int c = -1, n = 0;
      writeStr(xbee, cmd);
      memset(reply, 0, bytesMax);
    
      int tmax = (CLKFREQ/1000) * msMax;
      int tmark = CNT;
    
      while(1) 
      {
        c = fdserial_rxCheck(xbee); 
        if(c != -1)
          reply[n++] = c;
        if(CNT - tmark > tmax)
          return 0;
        if(c == '\r')
          return n;
      }
    }
    ...and this is the code on iPad & TechBasic:
    Code:
    Comm.openTCPIP(1, "192.168.1.17", 9750)
    
    sensors.setAccelRate(0.01)
    system.showGraphics
    
    ! Create a button 
    DIM quit AS Button quit = Graphics.newButton(10, 600, 600)
    quit.setTitle("This simulates the obstacle") System.showGraphics
    
    while 1=1
      a = sensors.accel
    
      x~ = (a(1) * 128) + 127
      y~ = (a(2) * 128) + 127
      z = a(3)
      
      REM Sending accelerator info to Propeller
      put #1,,x~
      put #1,,y~
    
    rem Remove below comments if sending distance or other data from Propeller
    rem  if not eof(1) then
    rem    GET #1,,b~
    rem  END IF
    
      rem Writing debug info to the console
      system.clearconsole
      print x~; " "; y~; " ";
      print b~
    
      ShowDist
    WEND
    
    rem Simulating the distance graphically by moving the obstacle on the screen
    sub ShowDist
      quit.setFrame (10, 650 - (b~ * 2), 600, 20)
    end sub
    
    rem Below sub not in use at the moment
    SUB nullEvent (time AS DOUBLE)
      !IF NOT EOF(1) THEN
      !GET #1,,b~
      !print chr$(b~)
      !END IF
    END SUB
    
    SUB touchUpInside (ctrl AS Button, when AS DOUBLE) 
      STOP
    END SUB
    Now, keep in mind that this is so far only a proof of concept and the code needs a bit cleaning and lots of comments. I'd anyway be glad to hear if others are able to get the concept working.

    Do also note that I still have some issues:
    1. Quite often I'm not able to connect between Propeller/XBee and iPad/TechBasic.
    I'm then rebooting Propeller and sometimes TechBasic to eventually get a working connection. Currently I have no clue where the root cause is, it might also be something with my router.
    2. When the Propeller is sending back the distance from a Ping sensor, what is sent on Propeller side is not received the same on TechBasic side. I'm still looking into this.

    OK, when writing this my router died completely (no power LED on, only Ethernet LED is on), so my connection issues might very well have been because of it...hmm where can I find a new router close to midnight in a small city in a small country.
    Luckily I have a bunch of iGadgets connectable through 3G.

    -Thomas
    Last edited by banjo; 01-15-2014 at 08:39 PM. Reason: Added some concept clarifications

  19. #19

    Default Re: Open Propeller Project #1: iPad to ActivityBot

    Thomas, I've got all the hardware to duplicate your setup. All I'm missing is a bit of time - my hands are full at Parallax and I'm not that good of a programmer anyway. However, as this progresses you can count on me jumping into the mix and testing the same hardware setup. So far, you've got the lead on our efforts. Unsoundcode is wandering around somewhere, and I could send him an XBee WiFi unit so he could help us out. I'll try to track him down.

    You mentioned that your router failed. I've pulled out my hair over slow-failing, sloppy-to-configure routers in the past. You're in Finland, so maybe go here https://foursquare.com/v/verkkokaupp...64a520cc6121e3 if you are in Helsinki tomorrow morning.

    And with techBASIC developers on the forum I'm thinking they'll jump in and help us troubleshoot, too.

    Ken Gracey

    Ken Gracey | Parallax Inc.| Direct
    : (916) 625-3010 | www.parallax.com

    Follow me on Twitter




  20. #20

    Default Re: Open Propeller Project #1: iPad to ActivityBot

    Just as an addendum to this thread...

    I've built an iOS app (iPhone and iPad compatible) that runs a version of openspin. At this point, my project is just a proof of concept for editing, compiling and loading of .spin-based projects.

    The current status is that the app can:
    • create new .spin files and edit them
    • upload previously created .spin files as well as .spin libraries (from eMail, websites, other apps, etc.)
    • compile .spin sources and included libraries
    • display compiled results data (binary or eeprom type, file size, etc...)
    • send all file types (.spin, .eeprom, .binary) to other apps (such as eMail) for transport to other devices
    • communicates via Bluetooth LE to a modified Bluetooth Xbee (upgraded with a Bluetooth LE HM-10 module), attached to an Activity Board
    • compiled projects have been tested, though loading took place from a MacBook Pro


    Current work "in-progress"
    • working on transport of compiled binary to RAM
    • working on transport of compiled eeprom to EEPROM
    • requires iOS 6.1 or newer, using CoreBluetooth Framework

    Future work:
    • port application to Bluetooth LE enabled Android devices
    • provide other transport support (XBee WiFi type devices)
    • provide a terminal for display of running program output/input

    As a proof of concept, the project will provide a simple 'app' as a Propeller IDE on iOS devices initially, with possible port to Android tablets. I do not want to de-rail existing projects, so I'll provide a thread for the project once a complete edit-compile-load-exec can be demonstrated.

    Having said all that, I'm here to help with this open source project... I'm available for any Mac/iOS testing and development work as the need comes up!

    Thanks,
    dgately
    Last edited by dgately; 01-16-2014 at 12:07 AM. Reason: spelling error...

+ Reply to Thread

Similar Threads

  1. Replies: 0
    Last Post: 11-27-2013, 06:33 PM
  2. Replies: 4
    Last Post: 11-05-2013, 02:11 AM
  3. propeller robot universal code open source project!
    By Sovr in forum Propeller 1 Multicore Microcontroller
    Replies: 6
    Last Post: 02-01-2012, 03:35 PM
  4. Open-sourcing the Propeller I: an open letter to Parallax
    By cde in forum Propeller 1 Multicore Microcontroller
    Replies: 31
    Last Post: 02-12-2011, 04:47 PM
  5. iPad vs. Propeller
    By Phil Pilgrim (PhiPi) in forum General Discussion
    Replies: 63
    Last Post: 09-26-2010, 03:45 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts