- By: Ken Gracey Published: 18 March, 2014 1 comments
Parallax is planning to support iOS (iPhone and iPad) Propeller Application downloads to the Propeller. I’ll mostly refer to iPads in this post since they offer the most useful coding and editing environment, but the work described pertains to both hardware platforms. As you read through this post, keep in mind our end goal is to support this in education – and that the tools must be very simple, reliable, and mostly free of setup. If you’re an educator, you could skip to the bottom and answer a few questions for us about our next steps. If you’re a Propeller developer or iOS programmer you might want to read about how this will work.
iPads, Education and Robotics
The numbers of iPads in schools are staggering - Apple has sold over 10 million iPads to educational institutions and the Los Angeles Unified School District will buy 67,700 more units with an approved $115 million proposal. With this increased use of iPads in classrooms, we can hardly go to a Propeller training seminar or conference without people asking for the ability to program robots with an iPad. It’s obvious that this is a hardware platform we must support.
There’s a big challenge with connecting iPads to all of the new STEM-inspired classroom equipment like robots, CNC machines, and 3D printers. First, the legacy software for controlling these machines was usually developed on Windows and software probably has to be rewritten to run on iOS. Next there’s communication with the hardware – iPads don’t have easily accessible hardware serial ports without using application-specific approved cables. And if this isn’t enough, educators ask about connecting iPads to robots after somebody else made the tablet purchasing decision. So we’re already late in achieving this goal.
Parallax’s iOS Development Process and Team
Last October we launched the discussion thread Programming Propellers from an iPad as part of our Open Propeller Project to identify our technical solutions and possibilities. The challenge quickly grew with 500+ replies and almost 20,000 views. The Propeller community is fairly small, but they’re very strong and supportive of everything related to Parallax! We thank our forum developers for helping us narrow the options and get this project started. David Betz and Steve Denson also provided valuable information about how this might be accomplished.
For communication, we chose Digi’s XBee® Wi-Fi® S6B. From this point we contracted with Mike Westerfield of ByteWorks to leverage his experience with their TechBASIC product and Apple’s Objective C language. Our Senior Software Engineer Jeff Martin provided all of the Propeller hardware and communication protocols. Jeff has written or been involved with the design of all of our products and programming tools and offers invaluable experience. These two had a functional downloader working within three days!
iPad for Propeller Development Circuit
We’ve prototyped with our Propeller Mini Modules and QuickStart Boards, as they provide access to the P30/P31 and Reset lines. These were connected to the XBee’s DOut, Din and D02 I/O pins. The main Parallax board we’d like to support with Wi-Fi downloading is the Propeller Activity Board. In the current revision this board doesn’t have ready access to the Propeller’s P30/P31/Res programming pins, but once we settle on our circuit we will make some hardware revisions to the Propeller Activity Board to route the XBee socket to the Propeller’s programming pins.
The iPad software is written in Objective C. We start the binary program download by sending a few UDP packets that cause one of the XBee GPIO pins to reset the Propeller. Next, the communication bytes are transmitted via TCP packets in exactly the same format as what’s in the existing Propeller programming protocol from a PC or Mac. This is carefully transmitted in blocks of 1400 bytes (or less) using TCP/IP at a pace that keeps the XBee’s buffer around 90% full while it converts and transmits that data via asynchronous serial to the Propeller. This combination seems to emulate a computer with a cable quite nicely.
The pictures above show the current iOS downloader. It can only be distributed after it’s been approved by Apple, and we’re currently in the process of making some improvements to it for more robust operation. All of our Objective C source code will be released, open source. For those concerned about the iPad’s closed nature, this should come as a bit of a relief.
XBee S6B and Router Setup
In the development stages there’s a minor amount of XBee Wi-Fi S6B configuration required. However, when we release the downloader as an iPad/iPhone app, this step will be simplified with support for discovery mode that lets the XBee-enabled Propeller reveal its IP address and port to use in the downloading software – so the configuration I’m about to describe wouldn’t be required.
The Digi XBee S6B Wi-Fi module is configured in Digi’s X-CTU software. The only settings you need to change are:
- ID: Your wireless router access point name; aka SSID
- EE: The security setting of your access point
- PK: Your access point’s passphrase; if any
- IP: TCP
- MA: DHCP
- BD: 115200
- D2: Digital Out, High (connected to Propeller’s Reset line)
In our tests, the Digi XBee S6B Wi-Fi module’s DOUT, DIN, IO2, and Vss pins are wired directly to the Propeller’s Rx, Tx, RESn, and Vss pins, respectively.
What About PC, Mac, Linux, Android, and Chromebook?
That’s next. We’d like to support Wi-Fi enabled downloads from these devices as well. As soon as we get the iOS effort finished, we’ll move our attention to other platforms.
Your Feedback and Our Next Steps
Now that we have this capability, how would you like us to use it? This is what we’re planning but we’d like to hear your thoughts:
- Propeller Code Downloader and Terminal App Our very first iOS application will be a Propeller binary code downloader. Using the Propeller Tool or Simple IDE you can output a binary file. You’ll be able to e-mail yourself a file and download it to the Propeller over Wi-Fi. We still need a name for this product – it could be “Prop Loader for iOS”. A second app will be a serial terminal program so your Propeller project could communicate with an iPad, providing the ability to both control the Propeller and obtain data from it remotely.
- ActivityBot App An ActivityBot App would enable iOS program download and control of your ActivityBot. Imagine being able to wire the robot for ultrasonic distance detection, light following or infrared, and then simply downloading the code to run the project. The iPad could provide feedback about the sensors and allow for speed overrides. This could make the ActivityBot useful for middle schoolers, or be a quick debugging tool for PC programming.
- Simple IDE for iOS This is our ultimate and most important goal, and what our educational customers would like to have the most. We would create a programming environment for our C language, so that code could be edited, compiled and downloaded. Simple IDE was created in the QT Project who has now released a QT Project iOS port of their software. Our thoughts are that file management would be difficult on an iPad, but a reduced-feature “Simple View” code editor in which students only have access to the C program’s main file would be sufficient We wouldn’t expect to provide access to all of the Simple IDE files like you find in the PC/Mac/Linux version.
Our goal is to have an iPad to Propeller editor and downloader ready for distribution by the beginning of the Fall semester. Please tell us your thoughts on these plans and what you’d like to see for iOS support!