Bergen Fisheye from Ulriken Bergen fisheye - Photo Credit: Stian Eikeland
Stian Eikeland bio photo

Stian Eikeland

Developer. Does consultancy work from own company. Lives in Bergen, Norway.

Twitter Github Flickr Vimeo Instagram 500px


Bluetooth LE garage opener

The yak I'm trying to shave here is the garage opener (keychain-)remote. You know those big clunky remotes people carry around on their keychains? I try to maintain a minimum (viable?) keychain and I absolutely hate keychain remotes and big keys with a passion.Remotes are fine in the car, but I don't want to carry one. The garage in question here only have access through the main port - no door. And since I live on a hill, with a garage down by the road, connected by long flight of stairs, it's …

Office coffee alarm WiFi-button for Slack (ESP8266)

We have a Slack integrated coffee notification service at work. It's basically just a few lines of Clojure w/ PostgreSQL (for brew logs and stats), notifying our Slack channel whenever someone put on a brew. It recently got upgraded with a WiFi-connected hardware button button, and now the system operates like this: Internet connected Coffee alarm button. So.. how was this made? Let's start with a few of the requirements. Originally I wanted this to be automatic - maybe triggered by an inductiv …

Capacitive touch banana piano in Clojure / Overtone.

Making of a banana piano, with a bit of swedish jazz from my co-worker Håvard Sørbø This weekend my niece-in-law is staying over, and to maintain my image as the crazy scientist uncle I've planned to make a banana piano (and lots of weird ice creams). In clojure there's a pretty cool programmable audio environment called Overtone. Overtone features a decent sampled piano, and I'm thinking this could be a great basis for a banana-piano. Fun fact: a full piano requires about 11 kg bananas - at $3 …

Boiling Sous-Vide Eggs using Clojure's Transducers

I love cooking, especially geeky molecular gastronomy cooking, you know, the type of cooking involving scientific knowledge, -equipment and ingredients like liquid nitrogen and similar. I already have a sous-vide setup, well, two actually (here is one of them: sousvide-o-mator), but I have none that run Clojure. So join me while I attempt to cook up some sous-vide eggs using the new transducers coming in Clojure 1.7. If you don't know what transducers are about, take a look here before you conti …

Transduce me up, Hickey!

Transducers (reducing function transformers) are apparently coming to Clojure in v1.7 - but what is a transducer? Are they some sort of a continuum transfunctioner? Some say they are perverse lenses, others that they are monoidals. I have no idea, but I want to find out! So let's figure out what's changed and play with them for a bit.Here's the work in progress commit that added them to clojure.core. A few signatures were changed, and a few functions were added. In particular, it seems like mos …

GL.iNet Openwrt router

I recently bought an interesting little router on eBay, a GL.iNet router. Pretty cheap, about $25 + shipping.It sports the same form factor as the sweet little TL-WR703n - everyones favorite hackable cheap linux router. Not only is the form factor the same, it's the same SOC - a AR9330.Here the similarites end however. Many people (me included) modify their WR703n routers, upgrading the hardware with larger flash, more ram, break out GPIO, etc, etc. And guess what - the GL.iNet router has all of …

Banana Phones, Clojure and the Expression Problem

Clojure is a Functional First language, and I usually get by simply by passing around native datastructures such as maps, lists and vectors. Other than doing some simple Java interop I haven't really dug deep into the Object-Oriented features of Clojure until now. But, just because a language is FF doesn't mean that it's OO is weak sauce.The Banana (ns oop.fruits) (defprotocol Fruit (peel [this]) (describe-fruit [this])) (defrecord Banana [degree peeled?] Fruit (peel [this] (Banana. de …

CSP-style concurrent prime sieve using core.async

The Sieve of Eratosthenes is a well known old algorithm for finding prime numbers up to a given limit. If you don't know how it works, the short version is that you basically write up every number starting with 2 up to the limit. You then remove all multiples of 2, and the next number in the list (3) is prime. Remove all multiples of 3.. next number (5) is prime.. and so on. Sieve of Eratosthenes (wikipedia). Now imagine modeling the sieve using Communicating Sequential Processes (CSP). Start b …

Clojure 2048 at the dojo

I've attended Bergen CodingDojo a few times this year. BCD is a monthly meet-up here in Bergen where developers meet for kata-solving, pizza and usually a few beers afterwards. Number of people showing up varies a lot, but usually there's around 10 - ranging from students to people who has been programming professionally for many years.Generally it's quite fun, lot's of different katas, some easy, some hard, and some really hard (traveling santa problem, I'm looking at you..) considering the 2-3 …

Tools of the trade

Developers are the ultimate power users, we're really lazy and we hate to repeat ourselves. We'll spend hours automating 5 minute boring repetitive tasks - often wasting more time than it would take just to do it manually. Over the years we build up arsenals of useful tools that makes us more efficient, in this blog post I'll cover some of mine.HTTPie - CRUD with style!HTTPie is a small CLI tool for interacting with http-servers, it's very useful for debugging and testing out CRUD-like (REST, et …

Max7219 LED matrix + clojure + justin bieber == true

Max7219 is a serially connected (SPI) LED matrix. They are quite simple devices, and you can buy them from eBay for a few bucks (including a 8x8 LED matrix display). I've bought 3, and hooked them up to the SPI-bus on a Raspberry Pi. Each device accept 2 byte at the time, one byte for command and one byte for data. If you send it more than 2 byte in a transmit cycle it will shift it's old values to the next device. The driver executes the command currently in memory when you end the transmit c …

Clojure blog engine!

I've had a few times where I've tried to blog lately, but instead ending up closing the blog post in anger because of some stupid wordpress issue. Some times it would destroy my markup when trying to switch between visual mode and text mode, other times just plain stupid errors. I've been using a hosted blog for many years now, mostly out of convenience - but once the tools work against me I guess it's time to pack my bag and move on.Static blog pages on S3So I've jumped on the gen … PDF file size

You get a 11 Mb PDF from a (non-configurable) scanner and need to email/upload it to someone. You open it in on osx, export, select the Reduce File Size quartz filter. Open the exported PDF.. and it looks like complete crap, not even remotely readable - thanks you so much Apple for the overzealous reduction filter. Here is a custom one you can add to /System/Library/Filters and get actually readable and decently small PDFs, save it as Shrink.qfilter or similar. <?xml version="1.0" en &hellip;

$10 GPS

On ebay you can find cheap u-blox mini-pcie gps units for around $10 including shipping. They are for internal use in laptops and similar (most likely hooking up to the usb bus over Mini PCIe), but it turns out that the pads on the backside expose connectivity options such as uart and usb data.I soldered on a pin header for ease of use, and also attached a cheap ceramic antenna using double sided tape.The UART pins will spew over standard NMEA 183 data, so it should be easy to use with both comp &hellip;

Go GPIO library for Raspberry Pi

Been playing a bit with Go-lang lately, it seems like a fun little language. Very minimalistic and clean, yet quite powerful - you can do so many things with the simple constructs they provide (especially the goroutines, channels and type-system). Sadly, it looks like it's pretty slow in benchmarks compared to the other natural alternatives - but it's still early. Anyway, in an attempt to mix Gophers and Pi, I've made a small native GPIO library for Go on the Raspberry Pi (or the bcm2835 chip &hellip;

OpenWRT on Hama MPR-A1 (v2.2)

Hama MPR-A1 is a tiny pocket router (ralink 5350f based, 360 mhz, 4 mb flash, 16 mb ram) that features a 1800 mah built in battery. I bought one on ebay for about $20 and wanted to get OpenWRT running on it. You can find patches for openwrt on 5350 here: OpenWrt-RT5350You need a uart connection to flash this thing, so open it up and remove the battery from the backside of the PCB.Apparently there are multiple revisions of MPR-A1 around, and mine was a bit different from the others I've been able &hellip;

Decoding shellcode

Nasjonal Sikkerhetsmyndighet (NSM) recently put up a few security challenges on their page as part of a hiring, and was linked to by one of the major norwegian tabloids - VG.Most of them looked like boring substitution cipher and so on.. but one sparked my interrest - shellcode. 31 db f7 e3 68 ff f4 f5 e2 68 fb f5 b0 f8 68 b0 fb fc ff 68 fc f5 e2 f5 68 f5 e2 b0 f6 68 e2 f5 fe f7 68 c6 f9 b0 e4 b9 90 90 90 90 31 0c 04 04 04 3c 1c 75 f7 89 e1 31 c0 b0 04 b2 1c cd 80 b0 01 cd 80 In intel x86 asm op &hellip;

Liquid Nitrogen Hop Ice Cream

Made hop ice cream with some friends this weekend, using cascade hop. Left hop pellets in milk overnight, filtered out the remains, made ice cream batter the usual way, and then added liquid nitrogen while whisking vigorously. Ingredients: 3 dl whole milk A couple of hop pellets 2 dl cream 2 eggs 70 g suger 1-2 tablespoons of honey 7 dl liquid nitrogen Tasted quite bitter (as expected), only the heavy beer drinkers really liked it. &hellip;

Dead cheap li-ion charger - TP4056

There's a chip called TP4056 that's quite good for charging li-ion/li-po cells. You can buy the chip really cheap, or like above - a finished board with usb power in for $1.50 (!) on ebay including shipping. I bought one, soldered on a couple of silicon wires with magnets attached to the end. Also added a plug-able tiny voltmeter (ebay, but this other one from fasttech also looks quite good). I'm not sure how the voltmeter affects the charging (as it feeds off the charging current), but I recon &hellip;

Building a home automation system – Power control (Part 3)

Just got myself a RFXtrx433 USB transceiver from RFXcom. It's a tiny box which allows you the communicate with a wide range of home automation hardware that uses the 433 MHz band, check out the impressive list of supported hardware on their website. There is one store in Norway that sell these, and guess what, it's in Strandgaten here in Bergen (walking distance) - There's a guy named Kevin that have been working a nodejs library for it, available here &hellip;

Flocking / Synchronization

There are a few behaviors in nature that seems really advanced, impressive and organic, that actually can be simulated on a computer using only a few simple rules. One of them is flocking - the "formation"-flying of birds or movement of schools of fish. There's an old algorithm/simulation by Craig Reynolds called Boids (often used in screensavers and even used for modeling the flying bats in batman) that explains this pretty well. Make a few objects that react to their neighborhood according to &hellip;

The Shell - zsh, dotfiles, etc.

I decided to go for zsh again (instead of bash) as a default shell not that long ago. I've used it on and off before, it's really powerful, but takes a lot of configuration to get access to all the nice features it offers. Whenever i reinstalled or changed computers I usually just returned to the de-facto bash shell.These days configuration/plugin/themes collections like oh-my-zsh and the more recent fork prezto makes it really easy to get a a fully functional and good looking zsh up and running &hellip;

Building a home automation system - The broker and sensors (Part 2)

Every now and then (when I have time..) I do a bit of work on what's going to become my home automation system. At the moment it's pretty basic, it's simply events going over a message broker that small stubs of code react to. Most of it runs on my raspberry pi and a few jeenodes (atmega328 + hoperf rfm12b radio) as wireless sensors.Everything connects to a simple message broker built on ZeroMQ - and I love it! ZeroMQ is so great to work with, it takes most of the hassle of network socket progra &hellip;

Better WR703N Antenna mod

EDIT: I recommend looking at this method: blogged about a WR703N antenna mod earlier, I found some hints about a better way of doing it on the openwrt forum. There's a (0 ohm) shunt resistor in the antenna path - labeled J1. I undid the changes I did earlier, unsoldered the J1 resistor.With the board oriented with the wired lan to the left, I then soldered the core of the antenna wire to the RIGHT pad of the now removed J1 resistor. There is a big emp &hellip;

Pioneer SR-Link control

I have a decent (but aging) surround receiver connected to my HTPC - a Pioneer VSX-2016av. Because of it's age it really doesn't have any good ways to control it from a PC (USB or even serial).As part of my home automation setup it would be great to be able to control some of the features on the receiver. Volume up, volume down, power off, power on, etc.. Most of the time I use a wireless keyboard as an interface to my HTPC (running XBMC) - and the remote control for the receiver is only really &hellip;

WR-703N External Antenna Mod (DIY)

UPDATE: Don't do this mod, there are better techniques. Example: Solder directly to PCB antenna, or trying the J4 bridge mod as described here: better-wr703n-antenna-modMaybe you've heard about the TP-Link WR-703N router? It's a small "pocket"-router with wlan, 1x lan, 1x usb, Atheros chipset, 32 mb ram, 4 mb flash. It can run OpenWRT, and it's really really cheap ($23 on ebay currently). They require very little power to run (100ma ish) and are powered via a micro-usb connector. And they have g &hellip;

Building a home automation system - Part 1 (intro)

Ever since i bought my own apartment 1.5 years ago I've been thinking about adding a bit of home automation. Given an API to sensors, lighting, heating and other electronic devices there are so many smart things you could do.Using temperature sensors and control over heating you could PID-control (see my sous-vide cooker) indoor temperatures way better than any regular termostat could. And it would be easy to add day and night temperatures. You could make it fully automatic (integrated with your &hellip;

Building a battery pack for 35W HID canister light - part 1

I had a bit of luck recently and got a 35W HID canister light from a friend for a good price. His was broken and he had already bought a new one, so I had a go at it. The lamp and driver curcuit seemed to be working, but the battery pack was dead. Anyway, building a battery pack should be a doable build, so I bought it from him.Canister lights are high powered lights often used by divers, a very popular choice is to use 21W HID bulbs (HID - High Intensity Discharge - the same type of bulbs used &hellip;

Algorithmic bluetooth tenderloin

We had a tapas night at my place recently with all the usual suspects such as bacon & dates, blue cheese & shrooms, etc.. In addition to this Magnus brought over a large piece of beef tenderloin because he wanted to try out my SousVide-O-Mator. To cook a steak medium-rare the temperature to aim for is 54.5°C, while medium is reached at 60°C. We wanted it closer to medium-rare than medium. The machine was set at 55°C, and left until it would converge on the set temperature. We added the beef (and &hellip;


Sous Vide (french for under vacuum) is a cooking technique where food is sealed in airtight plastic bags and submerged in a water bath held at a specific temperature. Cooking sous vide usually takes a long time, but it has the advantage that the food is cooked perfectly evenly, you are able to heat a steak to the exact same temperature through out the entire piece of meat. A cut through a normal steak cooked on a pan usually reveals a gradient going from brown/gray to pink/red in the middle - le &hellip;

MSP430 Coffeetimer

The MSP430 is a familty of cheap microcontrollers from Texas Instruments featuring ultra low power usage. TI offers a devkit with everything you need to get started (USB-based development board and 2 microcontrollers from the value line) called the MSP430 Launchpad. The killer - it's dead cheap - $4.30 for two microcontrollers and the launchpad including shipping (fedex!). You can also probably manage to get a few MCUs for free as samples. TI is probably selling the kit at a loss really trying t &hellip;

Festival of Light

Festival of Light (Bergen 09) from Stian Eikeland on Vimeo. &hellip;

Fløibanen fisk

Fløibanen - Fisheye ride. from Stian Eikeland on Vimeo.Fløibanen in Bergen, fisheye style! &hellip;

Some masters stuff

Brain on Alzheimer's from Stian Eikeland on Vimeo. &hellip;

Visibility techniques..

Gecko from Stian Eikeland on Vimeo.Playing with some visibility techniques, trying to keep some contextual information based on the local curvature to improve depth perception. &hellip;

Pentax k-m / k2000

Sorry Havard, you can just skip this one, it doesn't feature any arrows showing which direction electrons travel :pI bought a new DSLR body not long ago, a pentax k-m. It's a rather cheap 10MP entry-level dslr, going for as low as 3600 NOK new here in Norway - I gave around 2800 NOK for it in the UK. So, what can this "toy"-camera do? Most of what the bigger brothers k10d/k20d can do actually. Here are a few of my own experiences with it.. Pentax k-m with da 21mm limited on flickr (cdehaan):What &hellip;

London + viz stuff..

Just came back from London, had a fun few days enjoying the low GBP value.. Weather was really nice too, relaxed in Hyde park under a (semi)-blue sky and 21C. Now it's back to school and work, currently doing some multimodal visualization. Here's an example I'm working on, combining CT, MRI and PET of a monkey. Showing a slab of volume rendered CT (bones) and PET (brain activity) on top of a MRI slice.. &hellip;

Popcorn Hour

The Popcorn Hour is a relatively small networked mediaplayer running linux. Out of the box it's fanless, so the only source of noise is the added harddrive (it supports a SATA-drive or external USB drives), making it a good candidate for a quiet multimedia system. It can read most filesystems, but only has write-support for ext2/3. I put a 1 tb western digital green power drive in mine. On the output side it supports component, svideo, composite, hdmi 1.3a, analog and digital sound.There are sev &hellip;

Illustrative Volume Rendering

This semester I've been doing a bit of shader programming (GLSL), and have implemented a series of illustrative techniques for volume rendering. The goal was to simulate some of the techniques used by illustrators and apply them to volumetric data (such as a CT-scan). The first is a CT-dataset rendered using a classic cartoon-shader, it also includes curvature-controlled contours: Last is a CT-scan of a gecko, using different contour techniques - curvature controlled for the edges, and a lo &hellip;

Håvard - Bringer of Entropy

Green plot is me walking from home to Fløyen. Red plot is my route back home trying to follow Håvard. Not even experts in the field of Chaos Theory can predict his path. &hellip;

Klein Bottle

Got my handcrafted glass 2-manifold from Clifford Stoll recently. It's a bottle which outside is it's inside, and it has 0 volume (well, at least in it's usual habitat (4 spatial dimensions) and not immersed into our 3 spatial dimensions..) See: Here it is, in a dark room, illuminated by a blue LED:And here is the crazy guy who makes them:If you haven't seen it before, you should check out his TED talk. &hellip;


I've spent some time working on a virtual 3d bergen as a part of INF251 (Computer Graphics) this semester. Basically what we did was to render the terrain based on a height map (a file containing a height value at every x,y position), modeled some buildings, added textures, spline based camera paths.. etc.. Mine was developed on linux and uses Glut, GLEW, GLM, DevIL, Vmath.. etc.. You can fly around in Bergen using FPS-style controls (WASD+RF/mouselook). Bergen 3D from Stian Eikeland on Vimeo. &hellip;

The Norwegian Customs Tariff

I've been buying a lot of stuff from places like ebay lately. You can generally save money doing this, because of the falling dollar value (1 USD was 5.07 NOK the other day). I generally try to avoid going over the duty-free limit, but it happens on big items from time to time. Most items (electronics at least) only have value added tax (moms), while some have an extra customs tax. All of this is described to the smallest detail in the customs tariff ( ). I had a look at it the other day &hellip;