MyActivityBot (Android App) - Motion-Control your bot
MacTuxLin
Posts: 821
Received my ActivityBot over a month back but just didn't had the time to do anything with it other than feeling happy about it. Anyway, managed to complete my last design & take a little time off to tinker with my new toy. When I first received it, I sort of have an idea what I'll do with it but just KIV till now. And, I had not been spending time on this forum so I'm not sure if anyone have already done this so pardon me if its a repeat project. I've spent about 3 days assembling, writing the C code in SimpleIDE and wrote the Android App to use motion control the bot.
Simple User Guide
Just done up a simple User Guide.
Android App
I've published the Android App in Google marketplace. Please look for MyActivityBot & download to your smartphone.
Bot Setup
I bought the Easy Bluetooth a few years ago but never really did anything with it so I mount it on my bot. You can use any Bluetooth module as long as you are able to communicate via UART to your board. And, I know, I've mounted the board in the reverse but I'm too lazy to do it right at the moment
C Code
I'm attaching the simple code since most of the hard work were already done by the Parallax team. I had, however, encountered some weird problems. E.g.
Anyway, hope you guys will enjoy this. If you want to have higher speed, then just add another multiplier to the drive_speed().
Cheers
Simple User Guide
Just done up a simple User Guide.
Android App
I've published the Android App in Google marketplace. Please look for MyActivityBot & download to your smartphone.
Bot Setup
I bought the Easy Bluetooth a few years ago but never really did anything with it so I mount it on my bot. You can use any Bluetooth module as long as you are able to communicate via UART to your board. And, I know, I've mounted the board in the reverse but I'm too lazy to do it right at the moment
C Code
I'm attaching the simple code since most of the hard work were already done by the Parallax team. I had, however, encountered some weird problems. E.g.
int main(){ fdserial *portNumPt = fdserial_open(rxPort, txPort, modeValue, baudRate); : :This works but if I placed this in a function like:
int main(){ setComm(); : } void setComm(){ fdserial *portNumPt = fdserial_open(rxPort, txPort, modeValue, baudRate); }This doesn't work. Not sure why as I have done such in AVR C/AS6 without issues. Also, the volatile uint variable doesn't seems consistent (I've commented in the code).
Anyway, hope you guys will enjoy this. If you want to have higher speed, then just add another multiplier to the drive_speed().
Cheers
Comments
Wow, what a fantastic project!
I will probably move this to the Projects forum because it is outside the scope of the Learn tutorials at this point. We might add a sticky post with links to interesting projects like this so that folks looking will have an easier time finding. For this project, we might also ask your permission to publish it in the Projects section of learn.parallax.com. Would that be okay?
About the serial communication question, the answer is to declare your serial type globally (above any functions) so that code in any function in that file can work with it, like this:
With the code like that, you'll be able to move that initialization to another function (like your setComm) because the portNumPt pointer will be visible there as well as in any other function in that file.
Andy
Great work.
OK, got it. So I guess the function fdserial_open() must be in main().
Thank you very much for your permission to point to and potentially republish your material on our learn site. We greatly appreciate it, and many ActivityBot enthusiasts will too! I'm pretty sure using our picture is fine for this, but will forward your question to our editor in case she has any suggestions.
About the serial communication, you do not have to place fdserial_open in main. The trick is to declare your fdserial type outside of main so that it's global. So, this should work:
In contrast, this will not work because you are declaring the fdserial type within a function. When the function is done, the uart pointer is gone:
Andy
Yes, you hereby have our enthusiastic permission to use the ActivityBot photo with the Google Play app!! What a great project. I'd like to give this a try with my Samsung tablet to see what happens.
Thanks Steph. Just uploaded v1.1.1 (solve a bug).
Edit: Very nice work indeed. I have been trying to get an EBT module to work with the Prop and this will make life much easier.
cmdStream[0] => Left Signal.
cmdStream[1] => Right Signal.
cmdStream[2] => Acceleration multiplier
Have fun!
Oops, sorry, I'll try to write up the documentation soon as I'm juggling with a few things at the moment.
Are there any available bluetooth boards that work with the Activity board that could be recommended (with source)?
Thanks
Tom
Sparkfun has a number of them but I found one fairly reasonable in terms of cost. https://www.sparkfun.com/products/10269. I have not tried this module myself but looking at the schematics, it seems quite straightforward. The only drawback I see is that they include a regulator onboard so it operates at 5v instead of the module's 3v3. Most likely they made it for Arduino. You might need a voltage translator for your Rx & Tx pins connecting to your prop. Other than that, I see they have some code examples.
Thanks for the response. That product is also out of stock with no intention of restocking. Do you think that this product might work ?
https://www.sparkfun.com/products/11601
It uses the RN-42 in an Xbee form, and would plug into the XBee socket on the Activity Board. It appears that the necessary pins would be available to connect to. It also is a 3.3v board, and very reasonably priced.
Thanks
Tom
I have some HC05 modules, and ordered some BluetoothBee PCBs. I could probably give some away at my cost depending on yield ($20+postage US only). Here's a link for the same module: http://www.robotshop.com/en/seeedstudio-bluetooth-bee.html
Yeap, I've tested HC-05 & HC-06 modules & they worked without any problems too. Didn't recommend to Tom as the pitch were so narrow & there weren't any breakout boards the last time I searched but since Steve pointed it out, its probably worth taking a look too.
I found that the simpletext serial port has some trouble receiving from the HC05. I'll be updating simpletext to fix that and add some functionality soon.
Still have some other things to do before trying your app.
Happy New Year.
Yea, I just tried my HC-06 on my ActivityBot & couldn't receive anything too. Previously I tested HC-0x with PropTools without problem so I assume it should be fine.
The problem exists only with the default simpletext serial IO (the RX sample delay is wrong for some devices).
Here is an example terminal using fdserial.
http://code.google.com/p/myactivitybot/
Thanks for sharing!
Once I get past my first month of school, I am going to try to write an Android app for one of my Parallax projects, and would like to get my hands on some sample code first.
Thanks
https://www.dropbox.com/s/ep1hursll8f6oim/MyActivityBot%20(v1)-%20User%20Guide.pdf
Sorry, I've recently dropped Dropbox as my 25GB is no longer free. I've moved over to ownCloud but have forgotten to relink the public files.
However, I am receiving the attached errors upon compiling: Please help.