Programming Propellers from iPad
Ken Gracey
Posts: 7,392
Hello,
Parallax has been running educator's courses for instructors in Taiwan, China, Netherlands and USA in recent months. The purpose is to introduce the teachers and their students to the Propeller ActivityBot and C for Propeller as shown in Learn.parallax.com. The reception has been very good and we're now seeing some classroom use as a result of our efforts.
We've also requested feedback from educators, like this http://www.parallax.com/news/oct23-2013/parallax-wants-educator-and-student-feedback-our-new-learn-program. Since last week, many educators have written us and requested iPad support. Between student-owned iPads and schools which are furnishing every student with an iPad this has become a very common request. No requests for Androids yet, only iPads. Even my own middler schooler is in a public school where iPads have been given to every single student (there's a funder who worked for Apple). They also want to program ActivityBots, but there's not a PC or Mac to be found in their building beyond the teacher's machines.
I thought I should start with you, our customers and developers, to ask about how this might be achieved. It's a project I will take on myself in Parallax, but I don't know much about the iOS environment and what possibilities may exist for running our tools. In order to talk with developers I need to have a better idea about what's possible. These are some considerations I'm aware of:
- programming interface: RS/232/USB via cable, WiFi, or Bluetooth
- tool compatibility: Qt tools and SIDE, OpenSpin - can these tools be compiled for iOS?
- running tools on iOS vs. externally on a server, with browser interface - is this possible?
- where to find developers
Anything you might be able to tell me about engineering issues, design considerations or alternatives would be appreciated. It is my hope to determine whether or not this is possible, and then to build a requirements document/specification so we could talk with contract developers.
Thank you in advance.
Ken Gracey
Parallax has been running educator's courses for instructors in Taiwan, China, Netherlands and USA in recent months. The purpose is to introduce the teachers and their students to the Propeller ActivityBot and C for Propeller as shown in Learn.parallax.com. The reception has been very good and we're now seeing some classroom use as a result of our efforts.
We've also requested feedback from educators, like this http://www.parallax.com/news/oct23-2013/parallax-wants-educator-and-student-feedback-our-new-learn-program. Since last week, many educators have written us and requested iPad support. Between student-owned iPads and schools which are furnishing every student with an iPad this has become a very common request. No requests for Androids yet, only iPads. Even my own middler schooler is in a public school where iPads have been given to every single student (there's a funder who worked for Apple). They also want to program ActivityBots, but there's not a PC or Mac to be found in their building beyond the teacher's machines.
I thought I should start with you, our customers and developers, to ask about how this might be achieved. It's a project I will take on myself in Parallax, but I don't know much about the iOS environment and what possibilities may exist for running our tools. In order to talk with developers I need to have a better idea about what's possible. These are some considerations I'm aware of:
- programming interface: RS/232/USB via cable, WiFi, or Bluetooth
- tool compatibility: Qt tools and SIDE, OpenSpin - can these tools be compiled for iOS?
- running tools on iOS vs. externally on a server, with browser interface - is this possible?
- where to find developers
Anything you might be able to tell me about engineering issues, design considerations or alternatives would be appreciated. It is my hope to determine whether or not this is possible, and then to build a requirements document/specification so we could talk with contract developers.
Thank you in advance.
Ken Gracey
Comments
It may be possible to migrate the existing SimpleIDE code to Qt5.2 ....
Of course Qt5 has other attractive features like mucho-better serial port support
See this thread, post #10. Using FemtoBasic is a way to get started with this while more general solutions are being developed.
For communication between an iOS device and a microcontroller board, you're currently limited to:
Bluetooth Low Energy (BLE)
WiFi
The serial comms method with RedPark's cables is also limited by Apple's policies on what apps they'll allow in the App Store (which without jailbreaking is the only way to install iOS apps for non-iOS-developers). RedPark's site claims that Apple policy does not allow apps that communicate via the RedPark cables, yet!
The only library-supported option for Bluetooth is for iPhone 4s and newer iOS devices. And that requires Bluetooth BLE (Bluetooth Low Energy) devices.
WiFI could provide a solution. That would require support in the Propeller board similar to the XBee upload solutions discussed in the forums.
Helpful URLs:
RedPark cable/adapters: http://redpark.com
Bluetooth Low Energy: http://en.wikipedia.org/wiki/Bluetooth_low_energy
Having stated the above, an app that garners huge interest might warrant Apple's attention. If a large number of educator's have interest in an app that requires serial communication between iOS devices and educational electronics devices, things could change.
dgately
I think the problem with SD card is mechanical failure opportunity (low MTBF). A WiFi SD card would solve the mechanical issue though.
Blue-tooth could be made to work in all environments with a little extra effort.
In any case other than a direct connection via serial port or USB HID, a secondary loader running on Propeller would be required.
I am assuming that it would have to work much like the GoPro does. You have to disconnect from your internet wifi and then connect to the GoPro network to use it., then switch back to access the internet again.
https://bluegiga.zendesk.com/entries/27615486-Tested-cable-replacement-sample-for-ble113-
Standard bluetooth, as everyone knows here, has the SPP profile to use as a serial cable replacement but low energy does not offer that same profile. I have also been looking into "dual mode" bluetooth modules that have both the standard and low energy components in one device. They are relatively new to the market and the ones currently available are rather pricey.
There is one that looks to be reasonably priced but is not available yet- the Panasonic PAN1026.
Here's another from ConnectBlue @ Digikey- http://www.digikey.com/product-detail/en/CB-OBS421I-16-0/809-1058-ND/3837627
I need to put more thought in the programming aspect. I'd lean toward WiFi because there's a lot of WiFi out there in the world, at least in the US.
I'm not sure this is a constraint.
The ipad is a fairly miserable content creation tool, even for spreadsheets and word processing. Besides the hardware interface lockdown (which can be overcome), you've then got the problem of the locked down file system which wont like accessing multiple folders of content like we do in spin or c.
Historically, apple hasn't allowed programming apps they don't control. I remember they banned a commodore 64 emulator from the store because it had BASIC, though I don't know if they are still that strict. Even so, it might mean having to load things with the developer platform, which is a huge pain. Keep in mind that all these challenges are completely intentional on apple's part.
Can you get an ide onto an iPad?? Probably. It might be easier to provide an android tablet or Linux/Chromebook netbook with a kit as part of a package. Either way, an iPad ide for programming wont be a great experience on an iPad. A graphical computing environment like nine blocks would be cool on the iPad, however.
A big reason why we stayed away from the iPad for NATO and the army was that apple could shut us down at any time on a political whim. As a company, they can be pretty evil. I dont mean to be negative, you CAN do it.
By the way, the schools wont let you jail break the iPad anyway. They want em locked down too.
The iPad (and tablets in general) are miserable text input devices. They are cool to carry around and open up amazing portals to the world for consuming content but they are really bad for creating content. They suffice for completing forms, filling in query boxes, writing forum comments and other small tasks with limited editing or cut/paste needs. If you get into creating any documents of more than one page or that require a lot of editing or that require you to view large parts of your document at a time, then the tablet is not the tool. These last few tasks describe the programming environment.
The best options for programming Propellers from an iPad seem to be:
1) use a graphical interface (like 12blocks or the S2 GUI)
2) use an interpretive language running on the Propeller with a command line interface (telnet or serial) - this currently leaves you with a Basic on the Prop or Forth (Propforth or Tachyon)
3) use a hosted IDE though a web browser. Something like Invento-O-Doc described.
The best two hosted IDEs I've worked with are Cloud9 for the Beagles or Google Coder for the Raspberry Pi (it can actually be hosted on any desktop or server, also). Google Coder is currently targeted for HTMl/JavaScript/Node.js learning and development but the implementation is well executed and it could be adapted to using other backends to generate and deliver code. I would think delivery of executable packages to a Propeller would certainly be doable.
A hosted IDE still leaves you with the basic text entry & editing issues of a tablet but it moves connectivity to the Propeller to a more open and better understood arena. The fact that it can be hosted on the Rasberry Pi gives you an inexpensive "programming module" that can be accessed from tablets or PCs. As a hosted application, it should also be scalable to larger platforms to support small groups or classrooms a s the needs change.
Either way you end up going, it's a project with a lot of upside for schools and hobbyists.
Is iPad coding (text entry) miserable with a bluetooth keyboard connected?
But I've got another question for you: have you seen how iPads are being used in schools? Like a full computer. There are some serious advantages that guys who've been raised on computers won't readily understand until you see a middle schooler or high schooler show you what's possible. Starting with their integrated keyboard case, they're turning a tablet into something that resembles a full computer. Add to it the iTune University tools for managing homework and curriculum, AirDrop for file sharing (no router required!), the wireless video display capabilities, a Bluetooth mouse to make presentations/navigation/videos easier and quicker and these tools are darned effective! Nevermind that most of it can be done on Chromebooks for $250...few seem to care if you get three of them for the cost of an iPad.
While I have trouble envisioning management of some of the current SIDE issues (where libraries are located, having multiple files, root directory location and naming) being managed on an iPad, I am also thankful for my naivet
It depends on the keyboard, I guess.
I'm not a touch typist, so I'm probably more adaptable to keyboards (real keys, membrane or virtual).
At least with an external keyboard, you can reclaim the screen space used for the virtual keyboard and display more content. This way (depending on the app), you have a 9-10 inch screen comparable to a netbook. Of course, then you get to tote an extra keyboard around with you. (nothing is perfect.)
I guess it depends on the app. A lot of times, if you need mouse support, cursor movement, etc., you need to poke and point at your screen which isn't as precise as mousing. I haven't tried a tablet with a bluetooth keyboard and mouse.
Even without a mouse, these kids manage to make it behave like a full PC.
However, for many of those getting skill today, that isn't as true.
They adapt how they input, and to some degree how they think and associate actions to characters. I very regularly see 20 something people rapidly inputting on phones and pads. They seem to be able to orient on the device well enough to input plenty fast enough to make sense for programming. Further, the idea of a context switch, as in needing to have another device, is a painful one! More or another device costs a lot of time, energy, headspace, and weight. Given those kinds of value judgements, the lack of an optimal input isn't a big deal, where to many of us it is!
In my own experience, I found the transition to a laptop a similar kind of thing. There are many non optimal tradeoffs between laptops and desktops. None of them really mattered given the strong advantage being portable had. Secondly, Running something like Windows, even though I have greater skill in Linux, ended up the same way. I could just run the environment where it all worked, saving me many context changes, all of which add up to a significant period of time per day. In a basic sense, this is what the iPad queries is all about.
Because of that, I believe a hosted thing would not make the best sense. One should be able to get it done with the pad, connection device, prop board, battery. That is optimal in that it all goes where the student does, gaining them hours, headspace, and freedom to do it when they can just as much as when they will.
A wireless SD card would be very compelling. Prepping the Prop board with some loader isn't a big deal, nor is the setup.
They will gladly jump through as many hoops as they have to in order to get the benefits of the device as they see them. They will also deal with some limits or less than optimal setup to do the same, simply adapting how they work.
If this is done, the setup steps should not be too much of a worry. The primary goal should be consistent and robust operation of the pad, prop board, connection technology and battery. All else can and will be explored when necessary. IMHO, that is how they will think about it all, and it is much different from how many of us think about it.
You probably did. Ether I didn't have a bluetooth mouse at the time or it didn't occur to me to use it (hey, it happens! )
I don't doubt the dexterity of the kids or the capabilities of the iPad. I'm currently an Android tablet user (hey, you aren't going to support those kids with Android tablets?? ..or the one kid out there with a Surface? ) I guess it comes back to the openness or lack there of for some solutions. Yes, iPads are great, yes, they have a big penetration into Schools (some Schools that are well funded or have well funded boosters but other schools aren't so lucky, so it might be Cromebooks, or donated whatevers or even (gasp!) PCs. At the current price of iPads, I doubt my currently 6th grade daughter is going to have her own iPad in the near future but she will probably have an Android tablet.
[soapbox]
Maybe I'm getting old but I don't think educational opportunities should be branded or only benefit those that have the proper devices. One reason I don't like the Lego Mindstorm domination in schools when it comes to Robotics clubs. I understand the burden on places on the teacher to have an inconsistent environment but I also understand the burden it places on families and the opportunities the kids can miss out on just because they can't afford the solution some company donated to the school district.
[/soapbox]
I also think about the issues Parallax has had with initial programming tools for the Basic Stamp and the Propeller being Windows only. At the time, it made sense but as the landscape has and is changing with PCs and devices, care should be taken with looking any efforts into closed, proprietary platforms. (maybe I shouldn't have turned my soapbox off yet! )
Anyway, just more stuff to consider. It's an interesting situation to be in and there are clearly a lot of exciting options to choose from.
I use a Mac myself for most things including Prop programming. I've resisted tabletomania but I can see the allure. Teachers will want things to be super simple and reliable. Parallax can't ship Mike Green with every package to set up the labyrinth of post #3. Also, my own experience with bluetooth on the Mac and the iphone has been less than reliable, although that it probably me.
I'd naively favor the wifi route. The idea of the SD card is intriguing. There was the recent thread on the FlashAir SD card. That or some similar link could go on an activityBot with some kind of bootloader. Programming IDE hosted either the locally (teacher's desk if not the iPad itself) or remotely.
Ken, Good luck with that trip into the forest, watch out for crabapples, small, pretty, hard to eat.
This is a much shorter development route as you don't have to port the Simple IDE into IOS, just exploit any available serial terminal application. SpinX includes supporting and SDcard file system and an Editor... so Forth programs are can be developed and stored with the Propeller board. I am doing so with a Propeller Demo Board and an SDminicard carrier from Parallax.
It is an excellent small portable system powered by a couple Lithium cells. I just use an Asus EEEpc for my dumb terminal in lieu of and Ipad, and a USB serial interface.
Only that I have not seen a Bluetooth LE device used with a Prop board yet... Not a huge obstacle.
dgately
I formed the items below for an internal email this morning, then was made aware of this thread, so I thought it'd be appropriate to post it here too.
[A quote from Ken]
"One thought I had is a non-IDE, or web-based system that works in the cloud. Phil and I have talked a bit about the S2 programming environment and whether or not some HTML-5 system could be used with a remote server. Im seeing several embedded tools go this route. Perhaps it even opens up support for tablets and other OS-limited devices?"
Ken, that's actually very close to something I've been thinking, but not strictly hosted, rather, something that combines some of the advantages of web and local. In looking for a long-term solution (i.e. one that may be the best for single-source, multi-platform development) I think we have an alternative that's already somewhat possible and expanding. It's Google's Packaged Native Client (and in particular, Portable Native Client).
[A Side Note]
We need to continue to target Windows, Mac, and Linux, but we also getting tech calls begging for ChromeOS support, and schools (and individuals) are also asking for iPad or Android tablet support. The iPad and Android tablet platforms have additional issues that stretch the viability of using them as development platforms, but there are already solutions that make it work.
[Native Client]
In short, Native Client (also known as NaCl) currently provides the means to take C/C++ source and compile for Win/Mac/Linux, package up, and deliver to and run on those platforms as long as they have the Chrome browser installed. The applications run with the Chrome engine as the user interface (either inside the browser, or outside of the browser). This has been available for a while, and PNaCl (see below) is a better solution on the horizon; in developer review as of Chrome 28 I think.
[Portable Native Client]
Also known as PNaCl (pronounced Pinnacle)- this is a nearly-released version of Native Client that takes it much further, providing Native Client support on Windows, Mac, Linux, ChromeOS, iOS, and Android without having to compile for each platform's processor. Just one source, one compilation, and release; runs on the Chrome "platform" already installed on our target devices (and is not executed as interpreter code in some VM). It may be about as close to a developer's dream as is possible to reach these days. It's Google's goal to bring "native" programming to the web; meaning equally to each platform that Chrome supports with the advantage of streaming distribution like enjoyed by mobile's apps.
Advantages
Disadvantages
Here are some links for more information
Other Links:
Alternatives?
What do you the teachers and students want? A textual environment close to the hardware, or a visual drag and drop like 9-blocks?
The audio out/microphone in port is used by several devices such as the Jawbone Up bracelet. https://jawbone.com/up
And, there are apps for iOS and Android, available on the app stores for each of these. Probably not the quickest way to upload executables to a Prop, but it's worth investigation.
dgately
Good point, Mike!
A TI Bluetooth LE device on a board with the XBee pinout would be a simple plug-in for the Activity board and others.
dgately
But it looks like the programming has to be done in JavaScript (which isn't so awful, actually).
Although program files can be saved in the cloud or on an institution's own server, the UI has to run from a local server program on each machine. Otherwise the latency would be unbearable.
-Phil
this is a Micon we are trying to program . not a whole move we are trying to X-fer ... the speed of audio as a * cough * modem is not a pinch point considering how easy it would be to make .
To Ken above....... I don't know ifs its the right voltage But I Know my old buddy in college 3 years ago booted a apple 2GS ( Yes a 80's thing ) off his Ipad with just a headphone cable and a few splices .
it was a hoot to see it work ..
http://www.amazon.com/REDPARK-SERIAL-IPHONE-Wireless-Accessory/dp/B005KVPJBO why not use this ?????
This works with Apple AirBook, so I assume it would work for iPad.
You would just compile a binary on iPad and then copy it over to the FlashAir card using a wifi connection...
Still, a direct connection would be a lot better for development...