I've just placed an order at SeeedStudio for some PCBs that I've designed in KiCAD. It's a very simple circuit consisting of an LM7805CT voltage regulator, capacitors for said regulator, a mount for a crystal, mount for load-capacitors and three sockets for the different kind of µCUs that I use. It's so that I don't have to fiddle with jumper-cables every time I do some experiments on a breadboard.

The µCUs that it can handle are as follows:

  • ATTiny 25/45/85
  • ATTiny 2313/4313
  • ATMega 48/88/168/328

2d A cool 3D-view of the board 3d

All the files can be found at my GitHub.

Feel free to use the board yourself, just remember to distribute your changes!

I've recently written a small utility for downloading shows from SVTPlay called SPPD. It is written in python 3 and requires the requests library.

The program takes two arguments;

  1. A url to a program on SVTPlay
  2. A filename to save the files to

It hasn't got all the cool setup-tools-stuff yet, but I plan to add it.

The reason I wrote this is so that I can record copies of shows before they get taken off air, like you used to do with old VHS-tapes back in the 1990s. It even has a really cool looking status bar!

$ ./sppd.py http://www.svtplay.se/somevideo/ dunz0rs-show.ts
Fetching segments: [############################################################] 57/57

The way it works is that it fetches the playlist by appending ?output=json, this playlist is then fetched and the segments in it are fetched sequentially and appended to sys.argv[2]. I have future plans to let it use multiple threads for fetching the segments, storing them in RAM and then writing them to a file when they're all done. Not that I think that it would increase the download speed very much but it would be a fun exercise :).

I work in an office enviroment. This means that sometimes I need to write documents and presentations to keep the salespeople and bosses happy(sometimes my colleagues too, not everyone enjoys a presentation that is just an xterm -fn 10x20). I tried several projects including Reveal.js which I had previously used for my presentations held at Birdie 23; 8-bit AVRs and 3D-printing.

I realised that I really don't like writing HTML; it feels clunky. So I went on a quest to find the perfect tool for making perdy presentations for terminal junkies and I found Cleaver.

It's a marvelous tool and is very easy to get started with. All I have to do is write my presentation in markdown and then open it in a browser and control it with my keyboard. There's even themes! The themes are supereasy to use also, in the header part of the presentation, just add

theme: jdan/cleaver-retro

The URL points directly to a github url, which is quite convenient.

What are you waiting for? Go write a presentation with Cleaver!

Salt is an automation and deployment system. I've started implementing it at work. I plan to write more about the specific things we've done, but not now, now I want to share something that I discovered.

We basically have decided to divide the machines in two different "classes"; Internal and external based on subnets. Initially I couldn't find a good way to do this. I tried all manner of weird matchings including 'G@ipv4:10.0.0.*'. Looking at the source of the ipcidr-matcher I discovered something... it can be used in States/pillar-matching!

I found out that you can do it like so:

# Pillar
  - match: ipcidr
  - node_class:internal

This is more or less unmentioned in the documentation, so I've done a pull request that got merged which documents how this is done. My next plan is to implement IPv6-support in the ipcidr()-matcher, something I suspect won't be as easy.

layout: post title: "New format for this blog"

categories: blog

I've noticed that I don't write very often. Most of the time it's because I don't feel I have any interesting updates on any "projects" that I can share. So now I'm going to try and stop writing shareworthy posts and just write for my own sake. That's why one should write, not in case someone else wants to read it. I am no writer though, I'm a technician.

I will do my best to make at least 2 posts per month about something. Be it cooking, photograpgy, electronics, linux or programming or just one of those "sorry-that-I-dont-have-anything-to-write-posts".

With my blog set up as it is now, making a post is very effortless. All I do is use my rake-file to make a new post and start writing. There seems to be some bug/misconfiguration though. It doesn't name the file with a fileextension. I just had a look at my 'config.yml' and I had spelled extension as extentsion...

Two weeks ago I attended Stockholm Robot Championship at Tekniska Muséet. I participated with two robots; my minisumo Perfected Titan and a linefollower named squarewave which I didn't get to work properly in time. The results weren't that bad... Perfected Titan finished on 8th place out of 16 participants but he has played out his role now. He's been at two competitions so far and have only finished sort of half both times, it's time for a new build. The results from the competitions are here if anyone is interested. I filmed the minisumo-deathmatch of the competition, so here it is;

I develop using Vim as my IDE, it's very handy, but it has taken me a while to get there. I've recently spent time cleaning my vim plugins, now everything is fetched via Vundle.
Anyway, let's get on with it.
Two very crucial plugins for developing any C or C++, not just AVR-C, is YouCompleteMe and Ultisnips.
Both these plugins work very well together with a bit of configuring:

" Ycm vs ultisnips
let g:ycm_key_list_select_completion=[]
let g:ycm_key_list_select_previous_compltetion=[]

let &path = "/usr/avr/include,/usr/include,./"

au BufEnter * exec "inoremap <silent> " . g:UltiSnipsJumpBackwardTrigger . " <C-R>=g:UltiSnips_Reverse()<cr>"

let g:UltiSnipsJumpBackwardTrigger="<s-tab>"

The important part here being let &path = "/usr/avr/include,/usr/include,./". It adds /usr/include and /usr/avr/include to YCMs path where it looks for things to complete with.

When you're developing microcontroller code you very often have the datasheet for the microcontroller in question open at the same time, because let's face it; no one remembers all those registers in their head :).
For this I use Open-Pdf and a simple mapping that saves me a few keystrokes. I save all the datasheets of the processors/components that I work with in ~/Documents/Datasheets which is then linked to my ownCloud-folder so that I can have the same set of Datasheets on all my devices. The mapping is nothing more than a timesaver: map <Leader>d :Pdf ~/Documents/Datasheets/. It certainly doesn't look perfect, but it's quite handy to be able to search for registers and the like from within vim directly.

I'd thought I'd share a list of the tools that I use in my day to day business.

  • Sipcalc is an IP-address/network mask calculator, I should probably know this by hand, but sometimes it's hard to remember if a /28-mask is a 248 or 252 netmask.
  • Tmux is the best terminal multiplexer I have ever used, I spend most of my working day in either tmux or my browser
  • Curl is a library and command-line client for transferring data over a number of protocols, I mostly use it for testing JSON-responses though.
  • Vim shouldn't need an introduction.
  • Midnight Commander is a norton commander like filemanager with a two pane view, it's got both FTP and SSH-support, great for moving files without a coherent naming pattern back and forth.
  • MPD/NCMPCPP is what I use to listen to music with. I stream MPDs audio via a websocket from my home server to my job so I've got access to all my music all the time.

A few weeks ago my local LUG(which I've been a member of since the start) organized a so called "mini hackaton". We try to do this every three months or so, they're very popular. There's something special with getting together with other nerds and working on projects, be it software or hardware, for a day and chat.

I worked on this: Timerbox a small board with a relay, two buttons, a rotary encoder and an LCD that I've designed. The µCU is an Attiny 4313. I managed to get the LCD working quite well with a library written by user alan2k on AVRfreaks.net. This library is based on the library by Peter Fleury modified by Martin Thomas and Andreas Heinzen. It removes most of the "unnecessary" functions like scrolling but adds a very crucial setting for my PCB; disabling/enabling the RW-line. My PCB has the RW-line tied to be write-only, since I very rarely will care if the display says it's done or not, I'll handle it with delays instead.

I did however miss some things on the board, as you always do with 0.1-versions. As you can see the relay is "on stilts", that's because I forgot to change pad size when I did the footprint. I also tied the relays coil pin to +5V instead of +12V for some reason, I don't know what I was thinking there. But it's just version 0.1, 0.2 will be a lot better :)

Today I've been coding a bit on my KSP Control Center project. It's so far just 11 buttons, three SPI-controlled LED-displays and an analouge gauge, but it's getting closer to something more "real" every day.

It's for playing Kerbal Space Program, one of my favourite games. Heres a video of me showing of some of the new displays.

The three position switch in the video is for going between surface, target and orbital velocity. The code's on my github for anyone interested.