Archive | November, 2016

Teaching with robots

20 Oct

Teaching with robots

The last two years I've done a course in at Westerdals Oslo School of Art, Communication and Technology (formerly NITH). The school offers Bachelor & Master studies in informatics and I've been brought in as a teacher on the topic of Embedded Systems. The course (200 hrs total) is a volunteer topic for third year students that covers all the basic use of Microcontrollers as well as some Embedded Linux.

It's been a great experience and I get to play santa - giving students a customised version of this kit. 4Tronix have been very helpful in making me a super Arduino-kit that covers the entire curriculum at a price that the school can live with. The only part of the curriculum that isn't covered by this kit is robotics and motor control. This year I think I've found a near perfect solution that I though I'd share with other educators.

First year - cheap robot kits

The first year I did the typical thing - I looked up various robot kits and grabbed what I thought would be a decent kit. The problem with this approach was that I didn't know what kits were good and not. Price was also an issue. The budget ($150/student) only allowed me to get 4 kits. With 28 students, that wouldn't work too well so I sat down and designed the NITH Penbot. This little Open Source robot uses cheap stepper motors to navigate & a servo to lift a pen. That way you have a robot that can be printed in 40 minutes (body + 2 wheels) and the students could build them with the components they already had in their kits.

It didn't go bad at all, but a lot of time was spent on the assembly. The focus of the course is software for hardware, not soldering/gluing/crafting. Due to the time needed to put the kits together, we didn't do much robot driving the first lesson (4 hours each) and had to postpone it to the week after. This in turn caused other problems as the students needed their Arduino's so as soon as the robot driving was finished, they had to dismantle the whole thing to be able to do other exercises. We also realised that while popsicle sticks are a cheap building material, they're not very solid at all. In other words - my solution worked but was not ideal. I knew I had to find a better solution for next year.

Maker Faire Oslo

While teaching at NITH, I was helping my kids building robots at home based on the kits from MakeBlock. My son got a Robot Starter Kit first, but when my daughter saw how much fun her brother had - she wanted one as well. Perfect! Here I'm getting my daughter to jump head first into STE(A)M education! My son did all of his robot alone (apart from the remote), but I had to help my daughter quite a bit. The building itself went quickly, but her project required custom hardware & software so she couldn't do it all by herself. They had their own stand at MakerFaire and it was a big experience for them both!

Having seen the quality of the Makeblock kits, I instantly bought some kits for myself. Over this last year I've built several robots and even a 3D printer based on this system, so it was obvious to think about using the same robot kit with the students.

Second year - Makeblock

For my second year, I now have 34 students! More students = more kits. I was able to convince the headmaster that since the Makeblock kits could be reused across more years, we should spend the extra money. I split the students into 8 teams & we got started. The teams were split into two - one half focusing on building, the other on software & picking up batteries (not included).

A nice thing about the kits is that they come with instructions for two different robots that each have their merit - a tracked vehicle or a wheel driven robot.

The students could of course have improvised and built other robots if they had more time, but these two are a good starting point. I had deviced a challenge in the form of a labyrinth that the robots had to navigate. A tracked vehicle will usually slip if you drive too fast, so driving slowly is key with this bot. The wheeled robot is easier to contol precisely, but no team selected that design initially. The "tank-design" is just much cooler looking I guess?

I'm very happy with choosing Makeblock over typical Arduino-style kits with plexi and tiny screws. The first team had their robot kit up and running in only an hour! There were practically no questions about how to build the bots and since the robot kits have their own Arduino with builtin motor drivers, there was no need to disassemble the robots in between classes. The only issue we had were a beam that was too short and an Arduino board that didn't work 100%. This was no problem since we had a spare kit, so we used parts from that.

Here's a short video from both the building and the competition (with some cheesy music from the Youtube video editor):

Summing up

As opposed to the previous year, the students quickly understood the difficulty of programming autonomous robots. This caused them to come up with various mechanisms using code to better detect the surroundings. Many tactics were tried and we all had great fun looking at the results. If this was a robotics course, we'd have much more time to dwelve into some proper problem solving. With the 4-5 hours we have available, it's only a small introduction to a much larger topic. The students loved it though and some now even blame me for having given them a new hobby.

I achieved my main goal of getting more time dedicated to coding the robots, rather than building them. Nothing was destroyed and it's now all nicely packaged for next years students to use the kits.

 

Pressure sensitive floor

28 May

Pressure sensitive floor

I just came back from the most challenging physical computing project I've ever done. It's a 13 by 8 meter labyrinth where you walk in the dark and get a sensory experience based on more than 300 sensors. The main challenge was actually how much time it took to execute it, but it was such a fun project that I didn't really mind. You can now try it out yourself at Energisenteret in the theme park Hunderfossen (Troll-themed!) near Lillehammer, Norway. I don't know for sure, but I think this is the worlds first "pressure sensitive floor"?

I've worked on several projects with the company SixSides and about a year ago, they asked me if I could build a floor that reacted to the people walking on it. The basic idea was to play back sounds of walking on other surfaces than you really were. Of course I said yes to the challenge!

Read the rest in the hardware blog...

 

2012 - what a difference a year makes

06 Jan

2012 - what a difference a year makes

The last year was full of changes for me professionally. My focus is still games and entertainment, but I'm drifting towards other languages and platforms than I've been using the last few years. I've changed office and I'm also spending lots of time on my new hobbies: electronics and 3D Printing!

Hardware

I started the year by taking two months off from client work so I could learn electronics and microcontrollers. I had heaps of fun and I've gotten far enough that I can solve pretty much any idea I get. From having just a very basic knowledge of electronics, I can now read datasheets, solder and build circuits that solve problems. Thanks to microcontrollers (such as an Arduino) I can get really far with only limited electronics experience. Throughout the year, I wrote 19 blog entries about Arduino and 9 about electronics.

3D Printing and modeling

In April I got myself an Ultimaker. I built it from scratch based on a kit and at the end of the year, I got myself a second 3D Printer - a Printrbot Jr. Throughout the year I've written 9 entries about 3D Printing and I'm sure it'll be at least twice as many in the year to come. I've always known how to model in 3D, but 2012 was the year I learned Rhino. It's very different from other 3D packages, but I absolutely love it! It's incredibly intuitive and easy to learn. Drop by Thingiverse to check out things I've designed this year.

Projects

I've done several great projects this year. My favorite was the Rock City Project where I got to work with my friends in Back on a huge museum installation. On this project I did 6 of 10 interactive installations and lots of hardware integration. If you're travelling in the Namsos area, it's well worth a visit!

Another favorite what the HTML5 game I made for NASA! The screen was 8x12 metres and anyone with a smartphone could open a URL and then play a game on the big screen using their phone as a controller. Unfortunately, the project was only live for a week. Due to that I can't really show it, but hopefully there will be more projects like this in the year to come.

My Arduino Companion app keeps going strong. It's now surpassed 70k installs on iOS and Android and it just keeps growing. I'm also working hard on another AIR-based game at the moment that I know is going to be a success. Hopefully, we'll have it out mid February.

My new office: Bitraf

I've said goodbye to my architect friends for now and moved to Oslo's biggest Hackerspace -> Bitraf. I share my office space with designers, 3D modelers, illustrators, programmers and other geeks. In the evenings, the office transforms into a lively Hackerspace with an even wider mix of people. It's a really great place with lots of nice people and it's something I've dreamt of for many years.

Bitraf works as a "DoOcracy", meaning that those that DO things there gets to decide what happens there. My biggest contribution this far has been the 3DP weekends, but I hope to contribute even more in the year to come. You'll usually find me there every Build-night (Thursdays).

If you're looking for an office in Oslo and you have an interest in code, creativity and making things - check it out. I don't think you can find a better deal on an office for freelancers in Oslo.

Adobe's lack of interest

I've put anything that has to do with Flash on hold until Adobe (or a new owner) take the platform further. I still do Flash & AIR projects, but when Adobe can't bet on it's own platform, then how can I? I'm looking beyond Adobe tools and I'm liking what I see on the Open Source side. The way Adobe has treated developers the last year clearly shows that they're all about graphics, not code. This also means that Flashmagazine.com is on hold until something new happens to the platform.

2012 is also the year when Flash User Group Norway (FUGN) went silent. The group was started 5 years ago by Paulo, Øystein and me. It's been a hotbed of creativity and inspiration over the years. I have gotten lots of good friends through it, but wouldn't you know - just as we were sitting in a meeting we got an email from Adobe saying that the group had been closed down?

Apparently the reason was that we had less then 50 active members. In other words -> if you run an Adobe User group - you better make sure it's in NYC or other big cities. "Small" cities like Oslo are apparently no longer being tolerated. After all - they do support you with free pens and a single software license per year so they can't waste that on good customers. What can I say… Words fail me…

I still do lots of projects based on AIR and I'll continue to do so as long as Adobe keeps the product up to date. It's by far the best cross-platform solution that I know of, but Adobe really isn't doing much to tell the world how great it is. It's sad…

Warming up to browser apps

11 Sep

Warming up to browser apps

I recenty did a really fun game for my friends at Last Friday in Stavanger. The game itself was a typical fly-in-space-and-shoot-asteroids-type of game. A simple, but easy to understand concept. However - what was special was how you controlled the game and the size of the screen!

The display was projected on a 8x12 meters screen located right in the middle of the Stavanger town square. People walking by could just pick up their smartphone, open a URL and then play the game. I did the code for client, server and game/display while Last Friday delivered the graphics, the physical installation and helped out on bits and pieces.

This is the solution that we came up with:

  • JS/HTML5 game controller that works on any smartphone / pad / desktop
  • Node.js on the server with socket.io as the transport
  • AIR app for the game and display

Node.js kept a queue of clients waiting to play the game. This was sent back to the clients so they could see what position they had in the queue. The info was also sent to the huge game display that showed the game-queue in between games along with instructions on how to join. Once it was your turn, your phone displayed a "Get ready"-message and the game controls faded in so you could play.

Sounds simple? It wasn't all smooth sailing and here's some lessons learned along the way.

The original idea

The original idea was to use a local socket server and a native game controller-application that people would have to install. I wanted a challenge and thought this was a good project for testing the maturity of mobile browsers and node.js/socket.io that I had heard so much hype about. Last Friday liked the idea and I started making a "proof of concept" browser-app. This turned out to work really well and Last Friday could sit in Stavanger and play the game running on a display and server in Oslo without serious lag. Not shabby? I hacked together the concept in just one day, including learning node.js... Maybe the hype around node.js could have some substance?

As the game progressed we realized that there was no need for making a custom app and there was also no need to set up a special access point for the players. They simply connected through their 3G connection and that provided sufficient speed. Users with iPhone's got the best experience since they can use WebSockets. For Android the default Webkit browser can't do websockets, so socket.io (the transport used with Node.js) falls back to using HTTP-calls. We initially thought that this would prove to be a problem, but it worked rather well.

The solutions

I initially spent 2 days on the server, 2 days on the game/display and initially just 2 days on the mobile client. This is before some minor game tweaks and starting the dreadful job of fixing browser bugs and incompatibilities. That part took another 3 days and then some. Here's some lessons learned:

  • When making a game-controller, it's important that you can hold the button to repeat the action. The problem with this is that if you tap and hold an image in a mobile browser, the Save-as dialogue will appear. This prevents controller input and crashes spaceships... Mobile Safari has a super-neat css property called "-webkit-touch-callout: none !important". Adding this line in your CSS prevents the dialogue from showing, but - oh joy - this is a proprietary CSS tag so it only works on iOS devices.

    For Android, you'll have to hijack all possible events (ontouchstart, ontouchmove, ontouchend, ontouchcancel) for the image and then kill any default responses to this (preventDefault, stopPropagation, cancelBubble, returnValue AND return false).
     
  • Another problem with mobile clients and game-controller input is that if you drag your finger on an image, the browser thinks you're dragging it. As before - mobile Safari has a proprietary CSS-tag for this as well: -webkit-user-drag: none;
    Mobile browsers will also try to highlight selected objects. This can be also be turned off using webkit magic: -webkit-tap-highlight-color: rgba(0,0,0,0);
     
  • Using jQuery Mobile accelerated development overall, but it also caused some extra debugging when it "killed" the first fix for the above problem. I'm guessing jQuery Mobile comes with its own set of hacks and that we did something that cancelled something that our app need? Not sure how it resolved, but Edvard at Last Friday got it working again.
     
  • Calling "window.scrollTo(0, 1)" is the clue to remove the address bar in mobile apps. Works well, but not fault free.
     
  • Mobile clients don't really tell that they've closed a connection. To solve this we implemented a polling from the server that cleaned out clients that didn't reply within a reasonable time - indicating that the browser was wither closed or fully disconnected.

The game was made only for the annual ONS conference so unfortunately you can no longer play it. While having a short lifespan, the project was a great learning experience. I have to say that overall, I'm not impressed by the current state of mobile browsers. However - node.js really is a beautiful piece of Open Source software!

Node.js

Working with Node has more or less changed my mind about making apps based on Javascript. A library that allow you to learn, implement and run a custom server in just hours is nothing less than stunning. If you're a Flash developer reluctant to move into Javascript - I urge you to go check out node.js and work through this tutorial. It's fun to play with, you can easily use it with your Flash / AIR projects and you'll probably learn something new about Javascript along the way grin

Oh - did I mention the coolest part? As you can see from the screenshot above - the client was IRIS & NASA. I've actually made a space game for NASA! How cool is that?

The game in all it's 100m2 glory in Stavanger

Arduino Companion - now out on Apple App store

17 Feb

Arduino Companion - now out on Apple App store

I knew about it, but it's facinating to experience firsthand the "Time To Market"-difference between Apple and Google. On Android, you can push things live on Market in a matter of minutes. Getting approval from Apple took 7 days. During that time I have received my first batch of feedback from Android users. I've gotten four 5-star reviews on Market, plus one 1-star review. The guy with the 1-star review didn't manage to install AIR on his handset for some reason. It hurts a bit to get a review like this when you're spending lots of time making something for the community to use for free, but it's better to know about the issue than not.

And - as my friend Paulo pointed out - export your app using Captive Runtime for Android. That'll include the correct version of AIR inside the app so the user never has to worry about it. It'll increase size, but reduce frustations so I'll certainly do that for the next version. Winter holidays and FITC Amsterdam is coming up now, but when I'm back I'll start working on the app again. I'll rebuild the views -system since I now know how I want it to work and I'll also add some more features. The plans are: a capacitor calc, a Volt/Ampere/Resistance/Watt calc and the first bits of a Hardware Reference!

The Rock City project

07 Dec

The Rock City project

Once in a while there comes along a project where you get to play with loads of fun things. This project was exactly that. Rock City Namsos is a brand new cultural building in the city of Namsos. It contains a movie theatre, a concert hall, a resource hub for professional music, a super-sweet recording studio as well as an exhibition centre. I worked on the exhibition centre part and I was hired by SixSides and my friends at Back to create six of the ten interactive installations. If you’re ever in that part of Norway - make sure to drop by!

The goal for the interactive part of the exhibit is to teach people about how music is created and let them have a go at making it themselves. The theme is the musical style “Trønderrock” which was more or less invented in Namsos. The difficulty of the task is of course that no music skills can be required. Based on seeing both kids and adults having a blast making songs with the software, I think we solved this really well!

The first installation I did was a GarageBand-like editor that had been dumbed down a lot to make it accessible. The app is called “Låtskriveren” (the songwriter) and I could not have done this without the excellent Tonfall library written by Andre Michelle. Thanks a lot for making this library Andre!

laatskriveren.jpg

You create your own tracks by dragging prefabricated loops onto the timeline. There’s drums, bass, guitar and accordion (important for proper TrønderRock!) available. You’ll get a random set of chords initially, but you can change this by just pulling down a drop-down menu. Advanced users can zoom in on the timeline for some minor edits and they can bypass the automatic chords to mix and match as they want. You can jump on the timeline by clicking/dragging the playhead as well, so the app is quite complete.

The other app I did based on Tonfall was a full mixing desk with motorized faders! This app called “MiksEnMaster” was incredibly fun to do! All the interactive parts of the exhibit are activated using RFID cards that is made to look like a stage-pass (with Access All Areas of course). The passes are given out when the user enters the exhibit. The user will go up to a station, scan the card and if they save the result and register, they’ll be able to view and share what they created at the exhibit when they come home.

miksenmaster.jpg

When you scan your badge on “MiksEnMaster”, the motorized faders will all move up to the max position. This is done using standard mixing desk faders that we picked up from Yamaha along with Phidget motor controllers. Next you’ll select one out of four classic Trønderrock tracks and on the “window” (a 46” monitor) in front of the desk,  a guy will show up to tell you what to do. Hit play and you can tweak the eight tracks as you like. When you know how you want it, you press record to do the actual mixing.

As the user is working the faders, I’m adjusting the volume of each track in the Tonfall-setup. It simply works super-smooth! When the song is finished or the user stops the recording, we write the captured sound-bytes to an uncompressed WAV file and then convert that to MP3 using AIR’s NativeProcess capabilities. If the user is happy with the mix, we’ll save it to the server so they can show it off when they get home.

kuler.jpg

There’s also a third app in the exhibit that uses Tonfall. This one was done by @sunjammer and @deplifer and it’s a rythm-table! A big desk contains a bunch of holes and a string of LED’s that play along the top. By putting different colored balls into the holes, you can build your own rythms. The installation uses an AIR-app that controls two webcams that read the color of the balls. Each color is a sound and you can build some pretty cool rythms (or make a complete mess) with this installation.

Another app I made is “CoverDesigneren” (the Cover Designer). This is a multitouch-application for designing your own CD cover. I had played around with multitouch quite a bit before, but making this work on a 23” screen for completely novice users was quite a challenge. I would say that any app should get at least 25% extra hours if proper multitouch (other than the basic gestures) is required.

In the app, you can select pre-made backgrounds or take a snapshot using a webcam, add graphics and text as well as add effects to all of these. It’s kind of a mini-photoshop for CD covers. Thanks to Mario for his neat color manipulation classes in this app! The resulting covers from this app is played back later in the exhibit on a multi-projector setup where you’ll see your own cover along with classic Trønderrock-covers.

Many museums/exhibits have an archive, but Rock City now has the neatest of them all. On a purpose built class table containing two 46” screens, you can browse a huge archive of newspaper clippings and images previously unavailable. The people sitting down at this installation can easily just sit there reading for 15 minutes or even more.

avisbordet.jpg

The navigation is really cool as well. Beneath the glass surface, there’s four touch-buttons that light up if navigation is possible in that direction. It took forever to solder the 32 LED’s but the end result was simply beautiful. They make the table really easy to use. Another fun bit of this installation is that it is placed in a room that is made to look like a hotel room and just above the table, there’s a “window”. The window is also a 46” screen and when you’re reading an article about Tokyo, the window will change to show a view of Tokyo. Both sides of the table will “compete” over the “view” so we needed a simple way for these to tell what image to use. The maybe obvious choice here would be to use a socket server, but we used something that is much smoother to work with - Peer 2 Peer multicast! Thanks to the Cocoon-p2p library created by Peter Elst, the apps will just send a simple message onto the network that is then picked up by the machine running the view on the window.

We also use Cocoon in another part of the exhibit - the stage! Here you’ll scan your badge and enter a proper Stage. Once the first badge is scanned, a countdown will display on monitors in front of the stage until a recording starts. When the song is finished, you can view your recording on a big screen in the adjacent room. The setup consists of four different computers controlled with Cocoon p2p that runs different projections as well as the concert lighting rig that hangs above. @thomasnesse did this installation and while it was a fairly complex setup, I think he solved it very elegantly and simple thanks to the p2p capabilities in Flash/AIR!

My friend @plo also did the app running the Multitouch kiosks in the exhibit. These were done as AIR apps based on HTML/CSS/JS and this worked quite well. Personally I would still use Flash for custom UI like this, but it was fun to see that HTML is getting there as well for stuff like this.

tnt.jpg

This is certainly the most fun project I’ve done in ages and we could not have done this in such a short amount of time if it wasn’t for open source projects like Tonfall and Cocoon.

Did I mention this was all put together in only 3-4 months time? The project owners had set the launch to be 11.11 2011 at 11.11 so we had no slack in terms of the opening. The setup of the exhibition also got more epic thanks to a huge water leak that went straight into our server room the day before opening, but I absolutely loved this project. So many nice people and fun challenges are rare to come by. Fingers crossed that I’ll get to do more projects like this!

(images by Rock City, Lars Petter Garen and me)

Busy, busy, busy

29 Nov

It’s been a while since I’ve posted an update on what I’m doing these days so it’s time to catch up a bit. I’ve been really busy the last year and now I finally have some time to post on it. Here’s some of my favorite projects the past year.

Sukker.no

Sukker is the largest dating site in Norway and it’s used by more or less every single person below 50 that I know. I were originally hired to solve a problem that others had given up - making a 22 Gigapixel image zoomable and interactive. At any time of the day, this app will show the online status for many thousand users, offering new ways to explore and connect to people. Making an app like this run on old machines was quite a fun task! You can check out the city yourself but you’ll have to be logged in to see who is behind each blinking dot.

sukkercity.jpg

I also made two more apps for Sukker and they both allow their users to utilize more than just pictures to show others who you are. One is an “Apartment configurator” where you can create a kind of fantasy apartment allowing others to see what taste you have in music, film, food and much more. You can even peek into the fridge! The other app is sort of a “powerpoint”-app that allows people to build stories based on slides, images, video and text.

RIM / Playbook

I can’t say much about this project, but I’ve been allowed to say that “I have been working on a first party application for RIM”. I can also say that it was great to work with my friends at Jadehopper!

Minegunner

The only breaks from commercial projects have been working on a Tower Defense game called MineGunner. The paying gigshave enabled me to take time off to work on this. There’s still work to be done on it though so I’ll spend my time from now and a little into January trying to get it finished and published. (Come to think of it - I don’t think I ever posted a link to my old sparetime project - the Rampgenerator?)

mingunner.jpg

Rock City

This has certainly been the most fun project ever! I’ve used multitouch, low level audio manipulation (with Tonfall), peer to peer apps (with Cocoon p2p), controlling lights and LED’s, webcams, motorized faders as well as literally bags of Phidgets! I’ll write up a separate post on this soon since it was simply too much fun to fit in just a few paragraphs.

What did I do the last year

26 May

I just delivered yet another Away3D project for a longtime client of mine - dna shoes. It’s a nice competition for Converse shoes that use MMS and email to build a nice 3D gallery (based on one of my workshop files). I’ve done lot’s of Flash 3D this year and it’s actually become my main income the last 12 months.

For many years, I’ve used Blinksale for my billing purposes. It’s a very basic service, but it does have one neat feature and that’s tagging. By selecting invoices by tags, I can easily see what I spent my time on and Flash 3D is a BIG part of it. This chart shows what kind of projects I’ve billed the last 12 months:
whatdidIdo.png
This is just my commercial work and in addition I’ve also done many personal projects. Most of these include Away3D in some way so if anyone ever wondered if it’s possible to make money from Open Source Flash - here’s another little bit of proof. Thanks to the entire Away3D team for filling my days (and nights) with fun!

PS: The 6% training is also Away3D! :-D

Portfolio and update

02 Apr

Lille.jpgAbout two years ago, I quit my own company to go freelance. I was working on a huge project with more than 50 small Flash apps, but I left the project some months ago more or less out of frustration. It’s now more than three years since it was started and there’s still nothing I can show publicly.

Well, I’ve not been sitting idle. I’ve made a kids game (with Netron)  that has gotten rave reviews. The game was done in both Norwegian and English and it will soon get worldwide distribution in even more languages. With a fun storyline, more than 40 minutes of animation, 30 mini-games and a drawing program it’s a solid package of kids entertainment. The game targets kids 3-10 but should work well for childish grownups as well.

Tusenfryd

I’ve also done an awesome looking 3D map for an amusement park (also with Netron) as well as changing the backend of Flashmagazine to ExpressionEngine. I’ve also been working on an AS3 version of an Open Source project that I’ll get out the door soon. It’s lagged behind because of fun commercial work, but I’ll get it out within the end of next week.

tusenmap.jpg

Various Architects

I’ve also gotten myself an office downtown Oslo, in Storgata 51, straight in between the town centre and Grunerløkka. I share offices with two product designers that has a really cool device, one designer as well as three architects.

The architects website was designed by Junebug and I converted the design to ExpressionEngine and set it up. I’m yet again amazed at how flexible EE is. Every item written on the site can be associated with an architect and/or a project. If you look at an architects page, you can also see all the latest news for the projects they work on. Every project page also shows the news associated with it, so it’s effectively a full project history. Every project has a unique RSS feed so anyone can easily track the progress in a project with next to no extra effort for the one filling in the content in the CMS. Really pleased with how the site tuned out.