Website: Strawbees.com

Together with the briliant mind of studiooddball we created a refreshed website for Strawbees; a Swedish toy company. She did the design and I did all the programming. Some features:

  • Online store
  • Driven by WordPress, PHP and MySQL
  • Custom javascript to showcase their play guides
  • Responsive design

Check out their website


Working on a game in Unity3D

Together with my brother we are creating a game for iOS, Android, Mac and Windows. Currently a work in progress but it is starting to be rather fun and challanging gameplay.

Computer graphics is done by my brother; Jonathan Nilsson at Crocoraff.com. I do the C# programming in Unity3D which is quite pleasant to work with. The whole project is open sourced at github.

Website: Lumlyx.com

In colaboration with Studio Oddball, I made a simple yet functional WordPress website for Lumlyx. The website is made with responsiveness in mind to make sure it is usable on mobile devices. Check it out at lumlyx.com

Almost completely quiet pc

I hate computer noise but I love computers and it was time for a new computer purchase. My first approach was to buy everything passive (GPU, CPU, PSU) but apparently there are not many components that fit those constraints. Instead I went for semi-passive components that only run their fans if necessary. I chose:

  • low power CPU to not generate too much heat
  • gigantic CPU cooler to eliminate the need of a fan
  • just one big case running on very low rpm to transfer heat out of the chassis

Full component list for a quiet pc

Booting up is a bit noisy because the GPU fans and the HDDs throttle up. But after a few seconds it is almost completely quiet.

ODE solver in Python using custom Forward-Euler


For realtime simulation it is important to have an ODE solver that is simple enough. I did not find any plug-and-play kind of ODE solvers for realtime applications so I wrote one myself. The greatest benefit of this approach is that you have full control of every time step. Good for realtime simulations.


It is very simple but show the basics of how to write an ODE solver. It could be extended to use more sophisticated solvers like Runge-Kutta or Crank-Nicolson.

Tagged with:

Trying some game development in Python

I wanted to learn some basic game development in OpenGL and Python. Pyglet is very good for this kind of thing. Unfortunately it seems to have a less active community compared to Pygame (but in my opinion Pyglet seems much more Pythonic in its design). My game will not win any awards since it is a Asteroids clone. But it has some other features like:

  • Bullets have recoil and will slightly accelerate the ship rearwards when shooting.
  • Game graphics from a professional artist. (nalishac.com)
  • When I started this list I thought there would be more features but I think this is it.

pyglet-asteroids on Github


Using a lot of code and inspiration from:

Code structure and inspiration from:

Tagged with:

Infrared experiments to control the television from a website

Where is the remote? Wouldn't it be good if you could switch channels on the television from a website. A wanted to see if it is possible. It didn't.. Note to self; buy more powerful IR transmitters.

Calculate Personal Financial worth with Python

I wanted to know how much my financial assets are worth across one or more bank accounts, so I created a small python script for it.

I just type all my assets into a list like this:

assets = {
    'AAPL': {
        'own': 40,
        'current_value': yahoo_share('AAPL')
    'Coca-Cola': {
        'own': 35,
        'current_value': yahoo_share('KO')
    'NOF': {
        'own': 170,
        'current_value': yahoo_share('NOF.OL')
    'Nordnet Superfonden Sverige': {
        'own': 6.4099,
        'current_value': morningstar("http://www.morningstar.se/Funds/Quicktake/Overview.aspx?perfid=0P0000J24W")
    'SEB Japanfond': {
        'own': 491.8263,
        'current_value': morningstar("http://www.morningstar.se/Funds/Quicktake/Overview.aspx?perfid=0P00000LU7")

Then I run the script and get an output looking a bit like this:
Skärmavbild 2015-09-12 kl. 13.40.51

(Not my actual positions 🙂 )

Next step is to program a get rich quick algorithm. Until then the code for calculating assets is published here:

Tagged with:

Responsive one-page WordPress site

I have not been doing wordpress sites for a while but today I changed that. Nalisha Chouraria needed a simple personal webpage and I got it done in a day by using some shortcuts (mainly Twitter bootstrap css).

Skärmavbild 2015-09-06 kl. 18.50.15


Tagged with: ,

HIL testing in Arduino

I am trying out Hardware-in-the loop simulation on a new Arduino project for a client. Test driven development is unfortunately not very big in the Arduino community (yet) so I decided to implement something by myself. The setup is simple:

  1. One Arduino is running the application software.
  2. Another Arduino connects to inputs and outputs on the first Arduino. This Arduino will include all the test code.

2015-05-14 16.08.09

A test case could for example be, when the user presses a button a LED should light up. The second Arduino will output a signal to the button input on the first Arduino, and then check if the LED pin output is high. Example code is shown below.

void loop() {
  // Simulate that user presses button
  digitalWrite(BUTTON_PIN, 1);

  // check that the LED lights up
 assert(LED_PIN, 1);


  // check that some actuator starts running
  assert(ACTUATOR_PIN, 1);

  // Simulate that user releases button
 digitalWrite(BUTTON_PIN, 0);

  // Led and actuator should turn off
 assert(LED_PIN, 1);
 assert(ACTUATOR_PIN, 1);

  // stop execution
 while (1) {}

bool assert(uint8_t pin, bool expectedState) {
 bool state = digitalRead(pin);
  if (state != expectedState) {
   Serial.print("## FAILURE: pin ");
    Serial.print(" == ");
    Serial.print(" != ");
   return false;
 else {
    Serial.print("## OK: pin ");
    Serial.print(" == ");
   return true;


Why the hassle?

It might seem unnecessary, (and it is for simple problems), but it does increase code quality and decreases the risk of bugs being introduced when writing new features to the code.

Making it better

I would like to write my test code in Python on a laptop and control an Arduino (via Firmata for example). Then I would have proper tools for testing and generating test reports. For now the Arduino solution is sufficient though.

Tagged with: