Greetings!

If any of the info on this website was useful for your projects or made your head spin with creative ideas, and you would like to share a token of your appreciation- a donation would be massively appreciated!

Your donation will go to my Robotics Fund, straight towards more sensors, actuators, books, and journeys. It takes a lot to continue building these robots, and I’m really thankful of everyone who helps encourage me along the way.


USD


CAD

“A wise robot once said to me through Serial.println- that robots teach us about ourselves.”

All posts tagged Robot

Tentacle Mechanism (work in progress 3)

tentacle_mech_more_1

The tentacle mechanism has come a long way since the last update. More LEDs, a better behaviour, and a mount for the electronics and wall. Plus some fun long exposure photos ;)

Here is a video clip where you can see it in action:

Also, the tentacle mechanism appeared on the Adafruit Show and Tell-

Check it out here at the 2:55-7:06 mark!

The behaviour for the tentacle mechanism has been difficult to figure out.

Our fist attempt was to use the outputs to communicate how many times the button should be pressed. At first, it was fun, but then it just becomes confusing. Sort of similar to: ‘Why is this thing doing this thing, what can I do to change it?’. You can watch a video of this here.

The next attempt was to use the ultrasonic sensor, and have different actions for each distance threshold. There are also ‘mini-actions’ that occur from the changes between these distances. So when you are interacting with it, the ‘dances’ that the tentacle does will be similar, but the introduction to that dance, LEDs blinking, will be different.

But in the code, it’s more than controlling the robot. There are ‘debug’ statements where the robot is saying things. It gives some context as to what the robot thinks is happening.

Screen Shot 2013-08-02 at 4.05.02 PM

So as you can see, this robot has some sort of creepy obsession with distance.

And it gets even more interesting when the human goes away:

Screen Shot 2013-08-02 at 4.05.24 PM

As for actually displaying the text to the humans, it might be nice to have a tiny OLED display at some distance away from the robot, that only lights up after some amount of time of interaction. This way the humans will pay more attention to the tentacle moving at first, then notice the display and keep interacting.

What is all this ‘be’ functions about in the code? Those are the ‘mini-actions’, as mentioned above. They just blink the LEDs in certain patterns and such. In a future robot, this will be more involved with the social drives/mind/emotions.

Taking long exposures of the tentacle moving has been quite fun. Here are some of my favourites:

tentacle_mech_more_2

tentacle_mech_more_4

tentacle_mech_more_6

Working on documenting it, there were a lot of lessons learnt while building this! ;)

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):

ble_buddy_wip 004

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:

  1. 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.

ble_buddy_wip 003

Here is how auto-connection is done. We save the UUID and name of the device, then check if we see that specific one:

  1. - (void) connectToDefault {
  2.     // ok, let’s try this
  3.    
  4.     if(connected) return; // already connected don’t do anything
  5.    
  6.     NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
  7.     NSString *givenUUID = [userDefaults objectForKey:defaultDeviceUUIDKey];
  8.     NSString *givenName = [userDefaults objectForKey:defaultDeviceNameKey];
  9.     //CBUUID *zeeUUID = [CBUUID UUIDWithString:givenUUID];
  10.     CFUUIDRef zeeUUID = CFUUIDCreateFromString(kCFAllocatorDefault, (CFStringRef)givenUUID);
  11.    
  12.     int i = 0;
  13.     for(CBPeripheral *periph in allPeripherals) {
  14.        
  15.         if(periph.UUID == zeeUUID) {
  16.             NSLog(@"same UUID");
  17.             if([periph.name isEqualToString:givenName]) {
  18.                 NSLog(@"same name – let’s try to connect");
  19.                 self.peripheral = periph;
  20.                 [bleManager retrievePeripherals:[NSArray arrayWithObject:self.peripheral]];
  21.             }
  22.         }
  23.        
  24.         i++;
  25.     }
  26.    
  27. }

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.

  1. CBUUID *uuidService;
  2.     CBUUID *uuidChar;
  3.    
  4.     int ss = [selectedShield intValue];
  5.    
  6.     switch (ss) {
  7.         case 0: {
  8.             // any
  9.             uuidService = [CBUUID UUIDWithString:roboBrrdServiceUUID];
  10.             uuidChar = [CBUUID UUIDWithString:roboBrrdCharacteristicTXUUID];
  11.         }
  12.             break;
  13.         case 1: {
  14.             // kst
  15.             uuidService = [CBUUID UUIDWithString:kstServiceUUID];
  16.             uuidChar = [CBUUID UUIDWithString:kstCharacteristicTXUUID];
  17.         }
  18.             break;
  19.         case 2: {
  20.             // dr kroll
  21.             uuidService = [CBUUID UUIDWithString:drkrollServiceUUID];
  22.             uuidChar = [CBUUID UUIDWithString:drkrollCharacteristicTXUUID];
  23.         }
  24.             break;
  25.         case 3: {
  26.             // redbear
  27.             uuidService = [CBUUID UUIDWithString:redbearServiceUUID];
  28.             uuidChar = [CBUUID UUIDWithString:redbearCharacteristicTXUUID];
  29.         }
  30.             break;
  31.         default:
  32.             break;
  33.     }
  34.    
  35.    
  36.     for(CBService *aService in self.peripheral.services) {
  37.         if([aService.UUID isEqual:uuidService] || ss == 0) {
  38.             for(CBCharacteristic *aCharacteristic in aService.characteristics) {
  39.                 if([aCharacteristic.UUID isEqual:uuidChar] || ss == 0) {
  40.                     [self.peripheral writeValue:sendData forCharacteristic:aCharacteristic type:CBCharacteristicWriteWithResponse];
  41.                 }
  42.             }
  43.         }
  44.     }

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:

  1. if([selectedShield intValue] == 3) { // redbear shield is weird
  2.        
  3.         CBUUID *uuidService = [CBUUID UUIDWithString:redbearServiceUUID];
  4.         CBUUID *uuidChar = [CBUUID UUIDWithString:redbearResetRXUUID];
  5.         unsigned char bytes[] = {0×01};
  6.         NSData *d = [[NSData alloc] initWithBytes:bytes length:1];
  7.        
  8.         for(CBService *aService in self.peripheral.services) {
  9.             if([aService.UUID isEqual:uuidService]) {
  10.                 for(CBCharacteristic *aCharacteristic in aService.characteristics) {
  11.                     if([aCharacteristic.UUID isEqual:uuidChar]) {
  12.                         [self.peripheral writeValue:d forCharacteristic:aCharacteristic type:CBCharacteristicWriteWithResponse];
  13.                     }
  14.                 }
  15.             }
  16.         }
  17.        
  18.     }

The above is called whenever data is received by the app- eg:

  1. peripheral:didUpdateValueForCharacteristic:error:

When it is all working, it’s really fun to interact with the robot in this way!

ble_buddy_wip 002

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.

ble_buddy_wip 001

More fun coding ahead! :D

Fun Robot Project Complete

toy3dprobot31

Hooray! The iterations on the ‘Fun Robot Project’ are complete! Since the last post, more work was done on the faceplate/style aspect.

The first idea was to print the style directly onto the piece. However, this made accessing everything inside of the pieces quite difficult. Shown below is the head, with the LEDs and servo in it.

toy3dprobot2

It looks cool from the outside, but it had to be glued together (yikes).

toy3dprobot4

That really didn’t work out. Instead, went with separate pieces for the styles.

toy3dprobot8

In the CAD it was pretty easy to make ‘negative’ extrusions- so they could be printed in a different colour of filament. In order to do this properly, the shapes were scaled down by 0.96. If it was a (what I call) ‘inside-facing-shape’, then it was scaled up by 1.01. This would leave enough space for the kerf, so it could be glued in.

toy3dprobot13

The colours make it look snazzy!

toy3dprobot14

This wasn’t done using dual-extrusion, we’re debating whether it would be worthwhile to upgrade or not. Taking these off the build platform has to be done very carefully, otherwise they jump all over.

toy3dprobot3

Now for the electronics! There is enough space inside of the body of the robot for everything. There are two perfboard breakouts: one for the RGB LEDs, and one for the servos and power distribution. The microcontroller is a 3.3V Arduino Pro Mini, and a LiPower board transforms the 3.7V (or whatever it is, can’t remember) to 5V for the servos and LEDs.

toy3dprobot23

toy3dprobot26

Here is how it all fits inside of the robot. The servo cables and battery are nearest to the front wall:

toy3dprobot22

Everything gets patiently wiggled inside. The servo & power perfboard breakout goes near the bottom.

toy3dprobot21

That breakout then gets folded over, and the servos are plugged in.

toy3dprobot19

Finally, after more poking, it looks like this!

toy3dprobot27

Since it has its battery inside, it will be able to be wireless. Maybe there is room inside somewhere for an XBee as well. ;)

Because of the sockets that are on the arms, head, and feet, it has a few degrees of posability. Combining the poses with the servo movements is going to be fun. Check it out!

Robot is greeting you:

toy3dprobot36

Robot is sad:

toy3dprobot33

Robot is happy:

toy3dprobot32

Robot is cool:

toy3dprobot29

This week we’ll be working on programming it, making a video, getting it on the RoboBrrd Store, and documentation.

But of course before all of this happens- we need to find a name for this robot! We originally made it to look similar to the old ‘tin toy’ robots. Hmm…

Anyway, it is nice to reflect on where this robot has emerged from. Check it out, taking a leisurely swim in the pool of fails!

toy3dprobot44

toy3dprobot42

More robots to come… of course!

toy3dprobot40

ROBOT DANCIN DANCIN TO THE MUSIC OF STEPPERS STEPPIN!

toy3dprobot39