Open Propeller Project #1: iPad to ActivityBot
Ken Gracey
Posts: 7,392
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:
- Control an ActivityBot's direction and speed from an iPad using TechBASIC.
- 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.
- 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.
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
Comments
Meanwhile I am followingthe other thread with the work heater, jazzed and others are doing. They are learning a great deal of useful info.
http://www.byteworks.us/Byte_Works/techBASIC.html
There is a thread in these forums where banjo successfully connected to an iPad using a Xbee wifi module http://forums.parallax.com/showthread.php/153072-XBee-Wifi-amp-Propeller-Activity-Board-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/showthread.php?258-Mac-OS-and-iOS-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.
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
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
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
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?
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
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
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
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!
I see techBasic is a programming environment that is on the iPad ,that makes it a little easier to start programming them.
Brian
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/showthread.php/153072-XBee-Wifi-amp-Propeller-Activity-Board-how-to-connect?p=1234690&viewfull=1#post1234690 I've some of the bits and pieces in place.
On Propeller side I have this code: ...and this is the code on iPad & TechBasic:
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
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/verkkokauppacom/4adcdb27f964a520cc6121e3 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
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:
Current work "in-progress"
Future work:
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
@banjo, I have your techBasic source on my Ipad and browsing through it right now. I am looking with the intent of getting the steering and speed ironed out first then ping second, I like your use of accelerometer for the controls.
@Ken, I am using the Sparkfun Wifly at the moment in a point to point configuration, I have exchanged ASCII data with a Propeller and now I intend to use binary with banjo's program source. I am not truly familiar with some of the concepts of wifi but thought if the principal is the same then I will just stick with Sparkfun for now rather than go through configuring a new connection. Can you see this being a problem in the short term?
Jeff T.
Perchance, might you have time for a Video?
Once I get the loader working, I'll make a video... May take some time, though.
dgately
I'm curious as to what approach you plan for the loader? How much space does the Bluetooth code take? Can it run entirely in a COG so you can have the loader fill all of hub memory with the user program? Also, how will you provide a console link back to the iPad after the user's program starts? I'm working on something like this for an Xbee Wi-Fi module but haven't gotten as far as you have. My plan is to have the Xbee frame driver and loader run entirely in a COG once the download starts and to have it act as a console interface after the user program starts. I'm not sure there is enough space in a COG to do this but I'm optimistic. Can you share your approach with Bluetooth?
Thanks,
David
@banjo, I'm still perusing the code and have a stripped down copy that I'm building a little at a time which I'll post here. I did away with the While/Wend because it was eating all the processor time and slowing things down greatly for me. The event sub routine named "nullevent" is designed to handle misc. events that include some changes in sensor values so that is where I put all the update stuff. I also have two bytes going to the Prop but have run out of time for today to try and receive anything. Check this out and see if it helps any, I will be back on tomorrow.
Jeff T.
http://www.usasciencefestival.org/newsletter-volume-3-number-13/3rd-usa-science-engineering-latest-festival-news.html
I'm in DC. If any of you are coming we can meet for coffee - PM me.
- John
Bring Your Robot To The Expo!
Do you have a robot that you would like to showcase at the largest celebration of STEM? The USA Science & Engineering Festival is hosting our first ever "Robot Zoo" at the Expo Finale at a premiere location inside the Washington, D.C. Convention Center!
We expect over 250,000 attendees to once again fill the halls of the Convention Center and we would like to offer them a futuristic zoo experience like no other! Do you want to share your robot design with the public? Do you like to interact with others? Would you like to show Festival attendees what makes your robot unique?
The Festival Team will choose a group of robots to feature in our "Robot Zoo" at a special booth inside the Convention Center. Attendees will be able to meet the robots and talk with the robot creators.
Probably not a problem, but I don't know for certain.
My experience with embedded WiFi was both challenging and disappointing by watching our engineers work on a project for several years that never saw completion. The Wifly and XBee S6B devices likely operate similarly as far as techBASIC is concerned, but I really wouldn't know. Perhaps the most important reason to use the XBee devices is because that's what we're selling and supporting at Parallax. Drop me an e-mail kgracey@parallax.com and I'll get you the XBee S6B (choose chip or wire antenna) so you're using the same hardware.
Even if you have an XBee WiFi, I think it's good to have that SparkFun Wifly device as well. We really don't know if either of these devices have issues. And if our efforts serve both hardware platforms that'd be great.
I think it'd be best if you had both pieces of hardware. Drop me your info.
Ken Gracey
Hey John! I'll be there this year, so let's connect! This time we should be able to get together for dinner, too.
Also, I received your message about taking one of our bots to the Robot Zoo. I'm interested and will reply to your PM as soon as I can.
Ken Gracey
Dan, this is most interesting and I had to read your post twice just to make sure I've got it all straight. What I'm not clear on is whether or not you've actually downloaded code to a Propeller from iOS over WiFi. Can you confirm? And Spin/ASM only, which is actually probably just fine. You might have the backbone of what we need for the S3 robot revision.
If so, you're pretty far down the road with this project. Is it being done for personal or professional purposes? Would it helpful to have us get behind your effort as an Open Propeller Project?
I'd like to know a bunch more, if you can share.
Thanks,
Ken Gracey
It's 'Dennis' :thumb: but, basically, I've not yet been able to load the Propeller from the iPad. I am able to send serial text data from the iPad to the Activity Board, but binary data transfer is what I'm working on now. The iPad app uses the Apple's Core Bluetooth framework, which allows communication to a Bluetooth LE (HM-10) module that I've shoe-horned onto a Bluetooth XBee board after removing the Bluetooth 2.0 module (HC-06). The pinouts of these two modules are similar, though not exactly the same. That board is plugged into the Activity Board's XBee socket and wired like any XBee device. (http://www.jnhuamao.cn/bluetooth.asp?ID=1)
The BTLE device I am using is built by Jinan Huamao technology Co,. Ltd. The onboard firmware, labelled HMSoft version 5.21 and greater handles the BTLE connection as a peripheral device, responding to Core Bluetooth API on an iOS device. The company provides sources for an example application that runs on iOS devices. They have Android examples as well!
To answer Dave's question: On the Propeller side, the Bluetooth device is just another UART connection. The HMSoft firmware responds to AT+ type commands to set up the UUIDs and modes needed to communicate to a "central" Bluetooth device, such as an iPhone, iPad or Android device. There is so far, very little code on the Propeller side. I send about 8 commands to the device to create an LE server (peripheral). It appears that a method very similar to previous XBee loader methods is needed. Right now, my issue is sending binary data rather than textual data.
After reading Ken's post on iPad as development device, I remembered that I had been planning on developing an iPad/iPhone app for similar purposes. Since there are already some great open source tools available (specifically, openspin), it was just a matter of getting sources to re-compile inside an iOS project.
Loading the binary code to the propeller is an area where I could definitely use help (Thanks to Jazzed for giving me pointers to get this far!). I'm open to any help as I think once I have this basically working from edit to loading, the app will need help in making it acceptable as an AppStore level app.
BT LE module: http://www.ebay.com/itm/wireless-MBTV4-bluetooth-4-0-module-Low-Energy-BLE-module-Serial-port-module-ios-/271371192418?pt=LH_DefaultDomain_0&hash=item3f2efbc862
dgately
Jeff, thanks for the information and new code, learning something new every day. Might be that the WHILE/WEND was sometimes eating too much resources and causing some of the issues I've had.
I'll try your code hopefully later today if I get a new WLAN ADSL-router (the old died yesterday, got resurrected this morning, but will anyhow be retired)
-Thomas