Posts Tagged ‘App’
Buddy 4000 + BLE App (work in progress)
We’ve been long awaiting the days when communicating to our robots from an iOS device would involve less jumping through hoops! BLE on the newer iOS devices is pretty sweet.
Here is a video demo of our app interacting with Buddy 4000 using BLE!
We’ve been working on this off and on for a few months. Actually, half of the core functionality was finished a while ago (sending data from the iOS device to the robot). The BLE module we were using wasn’t configured properly to send data from the robot to the iOS device, and we didn’t have a TI CC debugger needed to re-program the BlueGiga chip so yeah… When we heard that @sectorfej had new modules in his InMojo store, we quickly bought one!
Here is the BLE module (wires are 5V, GND, TX, RX):

There’s a great BGLib library for this module that has all sorts of features packed in to it. There wasn’t much documentation about sending data… Here’s how to do it:
-
ble112.ble_cmd_attributes_write(20, 0, data_len_var, data_var);
The number 20 is the hard part. We couldn’t figure out where to find the info about this number or anything… so we iterated from 0-49 to find it! You might have to do the same for yours as well. Just keep an eye open on Xcode for when data is received on the app side, and then narrow down the numbers until you find the one that works.
We didn’t show this in the video, but we use sending data from the robot to the app for triggering sounds. Specifically owl and fart sounds. (Yes, this might be the most complex fart app to date). It works better with RoboBrrd, as it has sensors that can be used to trigger the sounds.
Anyway, most of the ‘core functionality’ of the app is involved with this (below) and the communication. We can even make it auto connect to a particular device (as you saw in the video), which makes the experience even more seamless.

Here is how auto-connection is done. We save the UUID and name of the device, then check if we see that specific one:
-
- (void) connectToDefault {
-
// ok, let’s try this
-
-
if(connected) return; // already connected don’t do anything
-
-
//CBUUID *zeeUUID = [CBUUID UUIDWithString:givenUUID];
-
CFUUIDRef zeeUUID = CFUUIDCreateFromString(kCFAllocatorDefault, (CFStringRef)givenUUID);
-
-
int i = 0;
-
for(CBPeripheral *periph in allPeripherals) {
-
-
if(periph.UUID == zeeUUID) {
-
NSLog(@"same UUID");
-
if([periph.name isEqualToString:givenName]) {
-
NSLog(@"same name – let’s try to connect");
-
self.peripheral = periph;
-
}
-
}
-
-
i++;
-
}
-
-
}
Sometimes specific BLE modules have certain service UUIDs and characteristic UUIDs that you can only send data to. We’ve never experienced a problem with ‘spamming’ everything (yet), but we built in this feature just in case. This is when data is being sent from the app to the robot.
-
CBUUID *uuidService;
-
CBUUID *uuidChar;
-
-
int ss = [selectedShield intValue];
-
-
switch (ss) {
-
case 0: {
-
// any
-
uuidService = [CBUUID UUIDWithString:roboBrrdServiceUUID];
-
uuidChar = [CBUUID UUIDWithString:roboBrrdCharacteristicTXUUID];
-
}
-
break;
-
case 1: {
-
// kst
-
uuidService = [CBUUID UUIDWithString:kstServiceUUID];
-
uuidChar = [CBUUID UUIDWithString:kstCharacteristicTXUUID];
-
}
-
break;
-
case 2: {
-
// dr kroll
-
uuidService = [CBUUID UUIDWithString:drkrollServiceUUID];
-
uuidChar = [CBUUID UUIDWithString:drkrollCharacteristicTXUUID];
-
}
-
break;
-
case 3: {
-
// redbear
-
uuidService = [CBUUID UUIDWithString:redbearServiceUUID];
-
uuidChar = [CBUUID UUIDWithString:redbearCharacteristicTXUUID];
-
}
-
break;
-
default:
-
break;
-
}
-
-
-
for(CBService *aService in self.peripheral.services) {
-
if([aService.UUID isEqual:uuidService] || ss == 0) {
-
for(CBCharacteristic *aCharacteristic in aService.characteristics) {
-
if([aCharacteristic.UUID isEqual:uuidChar] || ss == 0) {
-
[self.peripheral writeValue:sendData forCharacteristic:aCharacteristic type:CBCharacteristicWriteWithResponse];
-
}
-
}
-
}
-
}
This also allows us to do certain actions for different shields. While going through the example code for the RedBear BLE shield, we noticed it needed a ‘reset’ (or something). We haven’t tested this yet, but hopefully it will make the RedBear one work:
-
if([selectedShield intValue] == 3) { // redbear shield is weird
-
-
CBUUID *uuidService = [CBUUID UUIDWithString:redbearServiceUUID];
-
CBUUID *uuidChar = [CBUUID UUIDWithString:redbearResetRXUUID];
-
unsigned char bytes[] = {0×01};
-
-
for(CBService *aService in self.peripheral.services) {
-
if([aService.UUID isEqual:uuidService]) {
-
for(CBCharacteristic *aCharacteristic in aService.characteristics) {
-
if([aCharacteristic.UUID isEqual:uuidChar]) {
-
[self.peripheral writeValue:d forCharacteristic:aCharacteristic type:CBCharacteristicWriteWithResponse];
-
}
-
}
-
}
-
}
-
-
}
The above is called whenever data is received by the app- eg:
-
peripheral:didUpdateValueForCharacteristic:error:
When it is all working, it’s really fun to interact with the robot in this way!

There are still some wonky things that happen. For example, if you send too much data- or if you send it at the same time. Sometimes we don’t even know what we did and it will just disconnect (though thanks to our code, it re-connects quickly and without interrupting the user). This happens infrequently, so it might be odd cases.
Special thanks to @macisv, who at SecondConf last year taught me lots about BLE and let me experiment with it! And of course @sectorfej for making this great module that we used
Now for the hard part: completing and releasing it. It’s kind of weird, even though we are using this quite often… we have kind of come to dislike this interaction (of pressing and holding buttons) because it’s quite boring. So we’re not sure yet if this one will be finished, or if we’ll be trying something else, perhaps with more gestures and such.

More fun coding ahead!
Speech for Arduino (new Mac App)
Introducing Speech for Arduino! This app will give your electronics a voice, your Arduino-based project will be able to synthesize speech!
You send a string over Serial, and the app will say it for you in various voices. You can use voice modifiers to place emphasis on words, change the pitch, rate, volume, and more.
Check out the video demo below!
Speech for Arduino from RobotGrrl on Vimeo.
This was a really fun app to make. I actually wrote it while in transit, so that was interesting. Coding in a moving vehicle is an interesting experience.

This app is Donationware, with a suggested minimum donation of $5. I put a lot of effort in this app, so it really means a lot ^_^
Go and get it on AppsForArduino.com! Hope people will make cool projects with it!
Hotkeys for Arduino!
Developed another ‘for Arduino’ Mac App! This one lets you use custom global hotkeys to control your Arduino. Let me tell ya, it is SUPER useful!
You can learn more about Hotkeys for Arduino here!
As I was making it, I realized how easy it is to just be able to control actions on your Arduino. So I had RoboBrrd reacting to different shortcuts, so it could easily open/close its beak and flap its wings.
Since this app is more ‘action based’ rather than ‘pin based’, I find it more open ended to be used in different projects!
Here’s a quick video of the app:
I really really really enjoyed making this app. It made me realize how cool Matatino is. Really, I spent 4 hours on getting the hotkeys working, then I drop in Matatino and POOF it works! How cool is that?!
It’s on sale right now for $0.99 on the Mac App Store! The small amount of money goes towards RoboBrrd and funding more development.
…have you ever wondered what ‘funding more development’ really means? I have, and I’m pretty sure the universal commonality between this is buying more junk food to keep us programmers happy. It probably changes from dev to dev though
Dogcow + iPad

Dogcow now works with the iPad without the use for a middleman in between! It goes straight from the App to the XBee for Dogcow to receive.
Here is a video explanation:
The process begins with an App using the ExternalAccessory framework:

Then goes through the SkyWire cable:

RS232 is converted to TTL:

Which is then sent through the XBee:

The XBee is powered by 3.3V, using an Arduino as a simple power supply haha:

And Dogcow receives with the XBee:

Making this whole process really cool!

Here are some resources that may be helpful:
- ExternalAccessory framework
- EADemo Code
- SkyWIre 30 pin to RS232 cable
- Sparkfun RS232 to TTL
- More photos on Flickr
- Also FYI, the baud rate is 9600 on the SkyWire cable
Also, as per Technote #31:
Dogcows, by their nature, are not all dog, nor are they all cow, but they are a special genetic hybrid. They are rarely seen in the wild. Since dogcows are two dimensional, they will stand facing a viewer “on edge” to avoid being seen.

Stwutter Introduction
Here’s a video of a Mac Application that I have been working on. It is Twitter + speech. The tweets speak to you, and you can speak back at the tweets. I’ll post an update when Stwutter is available for everyone! In the meantime, enjoy the video:
Stwutter Introduction from RobotGrrl on Vimeo.
Or you can view it on YouTube.
Logomotionator

Logomotionator is an App for the FIRST Robotics Competition 2011 that I created during the build season while helping out Team 296: The Northern Knights! You can download it on iTunes for free.
Here is the description of Logomotionator:
Logomotionator provides a way for teams to organize and collect their ideas about strategy and scoring during the 2011 FIRST Robotics Competition season.
Features:
- Fabulous user interface design
- Track the scoring for the red and blue alliance
- Up to 5 tubes per peg will be counted (in case some are deflated)
- Record which teams were on the alliances, their minibot scores and penalties
- View your saved scores and email them
- Draw strategic plays on the game field in red and blue
- Easily access the usfirst.org websiteThe FIRST Robotics Competition is a fantastic way to get youth interested in Science, Technology, Engineering and Math. Check out one of the regional competitions in your area to see what the future holds.
Inspiration for the App came about by the temptation of an Apple eMate 300 (an iPad of 10 years ago, basically)! I took in some feature requests and just started to work away at it. Making the calculator algorithm was fun
All of the coding was straight forward. I must be getting really good at making Apps or something. Making the game field drawing stuff was probably the part I most enjoyed:

I also really enjoyed the email stuff too:

The only rough spot was on the saved scores view, because the “Remove button” is actually in a different section, I have to replace it with an invisible cell when removing everything because of the protective UITableView cell math.

Once all of the functionality was there I wanted to make something that would really capture the energy that the competitions have. I figured it would have to look snazzy, so I paid close attention to detail when styling the App. On the iPhone 4′s retina display, the graphics look beautiful.
This is what the background looks like, I had a lot of fun making it!

This is my most complete App ever (so far). I really like the finished product. I can’t wait until after the season is over to go through some of the code with the programming students. It would be a fun exercise to break down the calculator algorithm!
I hope you enjoy it. There’s some more screenshots on flickr. Go download Logomotionator now! It’s free!
FIRST®, FIRST® Robotics Competition, FRC®, FIRST® Tech Challenge, and FTC®, are registered trademarks of FIRST® (www.usfirst.org) which is not overseeing, involved with, or responsible for this activity, product, or service.
Yelling Robot – Titanic with Wings?
Yelling Robot was a Mac App that I released at the beginning of the Mac App Store. Thanks to a critical bug, it sunk like the Titanic.
The critical bug was that the files were being saved to the application bundle. At the time, the documentation never explicitly said that this would not work. Rather, it suggested to save in the appropriate location in the Library. It turned out that Mac App Store Apps are a little different than Mac Applications. Have you tried to delete a Mac App Store App? You won’t be able to, because of the permissions. This is essentially what was happening to us. We were trying to save to something that wasn’t able to.
It was interesting to see how fast Yelling Robot sunk. I was documenting the status of the App during the whole day, here were some of my notes:
9:30AM
Yelling Robot #14 on USA
Yelling Robot not on top charts for Canada
10:30AM
Yelling Robot #11 on UK
Yelling Robot #20 on USA
Yelling Robot not on top charts for Canada
11:00AM
Yelling Robot #21 on USA
Yelling Robot #65 on Australia
Yelling Robot #11 on UK
Yelling Robot not on top charts for Canada
12:15PM
Yelling Robot #11 on UK (rated 2 stars, 5 1 star ratings)
Yelling Robot #82 on Canada
Yelling Robot #26 on USA (rated 2 stars, 5 1 star ratings)
Yelling Robot #60 on Australia
1:00PM
Yelling Robot #14 on UK (rated 1.5 stars, 8 1 star ratings)
Yelling Robot #60 on Australia
Yelling Robot #69 on Canada
Yelling Robot #31 on USA (rated 2 stars, 6 1 star ratings)

Here are some observations from the notes:
1) Once again, Canadians never download my Apps. I thought it would be different for Mac App Store Apps, but it wasn’t. It sucks because I make them here in Canada! You would think that people would at least download it…
2) The UK still seemed to like it even though it didn’t work. Weird!
3) The one-star ratings KILL YOU.
We were able to push an update out before the weekend, so that was really good. This was nice because all of a sudden, you get to see the ratings go up and up and up! As of today (Jan. 28, 2011), we are back to a 4.5 star rating.
We went from a 1 star to 4.5 stars! Woot!

The wind for Yelling Robot has been keeping up for a very long time. With iOS Apps, we usually see it die within three days. Yelling Robot has been going strong for weeks.
I think this is because of a few reasons…
1) We were #1 in Entertainment (Free) for a while
2) It’s a FREE Mac App, not many of those around

For a while, I was wondering how on earth so many people could be downloading Yelling Robot, day after day it never seemed to tail off. “Were there really that many Mac OS 10.6 computers out there, that would want to download Yelling Robot? Wow!” It does turn out that some fireplaces are now currently ranked higher than Yelling Robot in the Free Entertainment, and our downloads are tailing off. Being on the top of the charts evidently does help.
So, the ride of Yelling Robot was pretty good. I would have enjoyed it more if we didn’t have that critical bug. I wonder what would have happened?
To answer a FAQ, “Why is Yelling Robot a 17+ Application?” … it is because to some people it may not seem clear that what you type in the text fields will actually be said, OUT LOUD. We didn’t want any mishaps on that end. There is not any 17+ material in the App itself, it is just a precautionary measure. There is actually a review that demonstrates this:

That’s why we made it 17+. Exactly for the above situation.
Now that we are over the initial hype, what updates would everyone like to see in Yelling Robot?


