Tired of having to get up to stop robot invasions? Well not anymore — Mobile Remote Control Club to the rescue!

1 Dec

Starting a new club is hard. It’s ambitious. But that’s what we did. It’s called Mobile Remote Control Club. The whole purpose of the club was to engage and experiment with technologies that enable us to do computing and control objects (digital objects in this case) at a range (be it close or far). Our first meeting was held November 24th, 2011 and to our surprise more than just the initial group actually showed up!

Caitlin and myself made posters and spoke in front of other classes on the Sheridan College campus in Oakville to draw attention. We were even able to get up to 22 members on facebook! I put out a live broadcast to my networks and people were genuinely interested in the fun twist of “controlling robots” we branded our club with.

To be fair, Roger, Saad, Travis and above all else Joel Brown did the majority of the coding and testing and messing around. I want to be clear — those guys are power horses who won’t stop until every circuit has been explored.

So anyway – how did we do it? What did we decide to use in terms of tech?

  • Arduino circuit boards – These things are open source and gaining a ton of support in the development community. Essentially it’s a circuit board you can upload code/instructions to and it will do it for you via “ports”. See the image of it below.
  • Bluetooth – most people know this technology from the loud-talking douchebag lawyers on Bay Street wearing it down the sidewalk for some reason (I mean come on, bro, really?). This tech communicated from our phone to the device (it activated our arduino code).
  • Android-powered phones – Nerds rejoice because we couldn’t get it to run at all on our iPhones. As a designer that was a bummer, but oh well. Apple is a bit of a  bastard, what more can you say?

Check out our connection and set up:

As my best friend Roger would say: “Arduino Bluetooth Magic, baby!”

Wowzers! I know what you’re thinking: for wireless Bluetooth that sure is a lot of wires! It’s very important to set this stuff up correctly – but it just takes some trial and error for people who aren’t familiar with technology (kind of a trend — just have fun and play around with new tech — if you read my multi-user post below!).

We used a “sketch” (a snippet of code) from www.amarino-toolkit.net — see below:

#include<MeetAndroid.h>
MeetAndroid meetAndroid;

int onboardLED = 13;

void setup()
{
Serial.begin(115200);
meetAndroid.registerFunction(testEvent, ‘A’);
pinMode(onboardLED, OUTPUT);
digitalWrite(onboardLED, LOW);
}

void loop()
{
meetArduino.receive();
}

void testEvent( byte flag, byte numOfValues)
{
flushLED(1000);
flushLED(1000);
flushLED(1000);
flushLED(1000);
}

void flushLED( int time )
{
digitalWrite(onboardLED, High);
delay(time);
digitalWrite(onboardLED, LOW);
delay(time);
}

So there’s that. It essentially tells the board to send power to a certain port (we plug the led light in to that port) when it receives a message from the bluetooth attached to it.

Pretty simple for connecting something remotely. Arduino runs on a language called Processing which is eerily similar to Javascript. So coming from a web coding background it’s really easy to manipulate the data and code.

During our gathering our goal was to get the light on the board to turn off and on as we texted/pinged it a message through a wireless bluetooth connection. It took about 20 – 30 minutes of troubleshooting and setup but we got it to work!

If you require proof (what are you a detective or something?):

So why is turning a light on important? Well for one it means the Arduino is listening to our code. And considering how many attachments Arduino’s can attach the possibilities of that are endless. When you’re coding the rule of thumb is to dream big but start small. Don’t bite off more than you can chew — you get frustrated and turned off if you do that. This isn’t even our first step — it’s our first crawl in to the realm of remote computing.

Our inaugural meeting, Nov 24th, 2011:

Some guy came and wanted to take footage of us working with our gadgets and gizmos so we acquiesced. The more the merrier! Also it’s a good opportunity to potentially get more members to join our group.

Dreaming Big
So what can be done with this technology once we master it? A few ideas we came up with:

  • Remote controlled juke box for bars and pubs – with digital money exchange. You could queue songs up you wanted without having to even get up from your table. Just download an app and you’re done!
  • Home stuff – turning on and off lights, and things of that nature already exist. But it would be wholly inexpensive to utilize these boards and this technology/code to do it yourself giving you full control.
  • Mixing yourself a margarita by turning on your blender as you pull up to home after a hard day at work!
  • Add a humidity sensor to your flowers and have the Arduino automatically water them for you when it’s too low!
  • Stopping bloodthirsty robots from uprising and killing all life on earth (except turtles of course, not even robots could hate those little scamps).

If you’re interested in this stuff please join us on facebook and keep up. Hopefully it catches on because it’s inevitable robots will try something funny. I don’t trust them.

And as a survival tip always remember — when the robot invasion happens be on the second floor.

– Andrew Corway

Rappin’ Robin – Experimenting with Multi-user in Flash!

30 Nov

Hey everyone! I’m back with another experiment in Flash! This time I’m using another class path by Flash master Dan Zen! It’s called Robin. For my small demo I decided to mix things up and use avatars from the Rap Board. My ambition was initially to create a demo that involved the disembodied heads of everyone’s favourite rap stars that you could make talk in one line sentences via a chat prompt (the text would float underneath the head). Due to time constraints I was only able to get the heads moving and randomizing upon entering a “circle”. I called it Chizzat.

Only 5 people are allowed in the room at a time, and each person receives a unique avatar based on the order they enter the room. Users can drag their little head avatar over a circle in the corner and randomly generate a new one (out of a set of about 15!).

Easier shown than said, so here’s a pic:

Note the two windows and that each avatar has a different glow around it. The glow indicates which avatar the user can control on their end. You can see the circle in the corner, too, with the caption “change yo’ dude, change yo’ mood”. It’s kind of fun to try and land on a new rap star every time.

To do this all I had to do was send the information to the other users with a handy “setProperties();” function given to us in Flash. Everytime data changes Robin searches and grabs it for you across the network. See my code:

It really wasn’t that hard to do. Once you get used to the framework of Robin and play around with it. The hardest part was getting Robin to display locally on my system! Usually you’d just load this stuff on to a web server with MySQL and Apache active. If you’re like me — just a dude tryin’ to get by — don’t be intimidated by the network stuff. I have ZERO back end experience and I was able to get it up and running with 6 simple steps:

1) Place the Robin working files in your C drive under xampp (get xampp installed first) and the htdocs folder. Plop everything in there!
2) Open Robin.as and change the server name/address to localhost (all one word)
3) Open robin.php and comment out line 33 – it’s a run check for the server and since we’re not connecting to an external server we don’t need it — it will just give us an error.
4) Publish the .FLA files in the samples folder so you have a .swf and .html file!
5) Open up a browser and dial localhost/robin/robin.php – NOTE: This will just continually load over and over. That’s fine! It’s not SUPPOSED to go anywhere except run the robin.php file so users can connect to each other.
6) Open a new tab and dial up your robin sample — localhost/robin/samples/ball.html is the one I tweaked for Chizzat.

That’s pretty much it!

If you want to try it please download Robin and play around. It was a lot of fun and in about 3 hours I was able to get a half decent looking multi-user room up and running (including graphic design!). Dan Zen has other cool classes, too. Read below for my venture in to gesture technology with ostrich. Together he calls all of these bird classes Flash Feathers.

That’s it fellas. Till next time!

– Andrew Corway

My Introduction to Gesture Tech! (w/ Flash)

11 Oct

Hey everyone! I’m new to this whole “coding” thing.

One of the languages I’m attempting to master is ActionScript 3.0. It’s a language native to Flash and so far I feel I’ve had a lot of luck picking it up! Though Flash has had its share of ups and downs and detractors over the last few years it’s apparent Actionscript is going to be here for a good while longer. Why? Brand new and exciting uses for it keep on creeping up from unlikely places.

One such use is gesture technology. I’ve been experimenting with it. The technology is called Ostrich, and was created by interactive development guru Dan Zen. (link!) Dan Zen is responsible for a lot of really cutting edge development and experimentation in Flash and better yet he’s prone to sharing it with the world. So check out his site if you’re interested.

To use Ostrich all you have to do is put it in your classes folder and import it using the class path structure. (google it!) Ostrich is so powerful because it can serve several functions at once. First, it sources and draws the users camera to stage. You have to declare and add the camera to the stage as an object. This is the lynchpin of all Ostrich – because if you don’t have a camera inputting commands to Flash how could it ever work? This is gestures, after all — and we get those gestures from the camera! Next, you can draw a cursor to the stage. Ostrich will do the heavy lifting for you – determining the x,y coordinates of the cursor on stage depending on what motion is on screen. If there happens to be two people moving their hands on screen it averages the motion between them. This can cause the cursor to stick in the direct middle of the two areas Ostrich is sensing motion. So if one person is waving their hand in the bottom left corner and another person is waving their hand in the top right the cursor will appear somewhere in the middle of them! Ostrich also allows you to recognize blobs (such as hands) and input graphics over them. Check out Dan’s site for more samples — for my experiment I was messing around with the cursor only!

The simple Flash program I made from Ostriche’s technology draws a balloon to the stage wherever the cursor is. And you can move the position of the cursor by waving your hands around. The balloon will float to wherever it senses motion from. It works best if you stand out of frame and use only your finger / hand to lead the balloon. My first idea was to draw clouds to the stage, and whenever the balloon hit a cloud its position would reset back to the top left corner. So essentially it was a maze! And you’d have to try and navigate your balloon through the maze and keep it out of trouble. But it wasn’t the balloon that ran in to trouble… it was me trying to craft this small game!

The problem was when I was trying to reset the x and y on the Ostrich camera the balloon would pop to the top left hand corner like I wanted it to, but immediately after that it would pop back to where it was before going to the top corner. Ostrich’s was still determining the x and y coordinates based on where it was sensing motion (instead of defaulting).

Bummer dude! 😦

Bittersweet, though! I mean, I got the balloon to follow your hand / motion on screen. That’s a win for a novice like me. Imagine if you could reset the coordinates cleanly, though?! I would have completed my first game! And with motion sensing, no less! As a work around I removed the resetting of the x and y coordinates. When you hit the cloud all the program does is trace “You’re hitting the cloud!”. I was thinking that I could make the balloon have a life bar and every time you hit a cloud it takes away from that hit bar. When your balloons life is reduced to nothing (after hitting the cloud 10 times or something) it’s game over.

Regardless of whether or not my game was successful I’m really glad I did this exercise using the Ostrich!  flash class code. It helped further along my understanding of drawing and manipulating objects in Flash without drawing them directly on the stage. Everything I drew from the balloon to the clouds was done by outputting movieclips from the library using Actionscript 3.

I’ll try and post my swf and fla/as files for you check out sometime. WordPress isn’t letting me upload them natively in WordPress for some reason.

– Andrew Corway