Category Archives: Soft
HUB75 RGB LED matrices with Arduino
Cheap HUB75 RGB matrix working

Cheap HUB75 RGB matrix working

Everyone likes LEDs. I like when I have a bunch of them. So one day I realised that I have about 15 big 32x16 RGB LED matrices in my lab. They are cheaper versions of Adafruit's led matrixes. Both matrices use standard HUB75 pinout. The pinout is same, LED count is the same, but display doesn't work - it is wired differently inside.

Driving matrices

Most simple way to do a led matrix is to drive low side columns with sinking driver chips and rows with high side mosfets. When you have bigger display - let's say 24 driver chips in total, then usually you will make multiple parallel lines of data to clock information faster.


HUB75 is a standard interface to control matrices like that. It has binary inputs for mosfet control: A, B, C and D. So you can have up to 16 rows. Also, you have 6 data buses: R1, G1, B1, R2, G2, B2. Now, to control a matrix you have to know two things: how many virtual rows and columns does your matrix have and how are they mapped with reality.

Backside of my LED matrix, 24 drivers are visible.

Backside of my LED matrix, 24 drivers are visible.

Differences from device to device

The Adafruit matrix has 12 driver chips and 8 rows controlled by mosfets. Mine have 24 driver chips and 4 rows. Also, Adafruit's one seems to be mapped quite straightforward way. Mine in the other hand.. rows are separated to eight banks that are all in different directions. Still - no problem. Mark Laane, a programmer in my lab, sat down with the matrix and soon we had a working library. You can find it from here:

Arduino Micro soldered to HUB75

Arduino Micro soldered to HUB75

Electrical wiring

I soldered my matrices directly to Arduino Micros. Since the pinout is slightly different from Uno, the connection diagram got hurt a bit. This library works with following connections:

HUB75 Connect to On Micro
B1 PB4 8
R2 PB5 9
G2 PB6 10
B2 PB7 11
A A0
B A1
C A2


Kicad gerber renamer

School is over, I'm finally able to do some work again.

I had some PCB orders to make. So, script I have been wanting to make for a long time - KiCad gerber renamer. It is a shell script that takes gerber files that KiCAD produces and renames them to match ITEAD or Seeedstudio file requirements. Really handy. Works with multiple versions of KiCAD (daily and older).


Posted on 2013-07-15, 20:03 By
No comments yet Categories: Soft
FreeCAD experience
FreeCAD Sketcher view

FreeCAD Sketcher view

FreeCAD is an open source freeware 3D CAD program. I needed some 3D models for my CubeSat battery post and it looked user friendly, so I gave it a try. I have previously used Blender3D, Solid Edge, SolidWorks, Google Sketchup and HeeksCAD. So I have some experience with 3D modelling and no experience with formula generated modelling (like many open source CAD programs tend to be).

First impression - where are ALL the buttons. Then I discovered workbench switching - makes sense now. Couple of small tutorials later and I was able to model simpler things.

It has usable 2D sketching tool and possibility to modify 3D models. Also almost normal assembly making ability.

Like all open source tools - the GUI is still a bit rough from the edges. SolidWorks style constraints are a step to the right direction, but they are still a bit buggy. For example clicking on the constraints is pretty challenging. I modelled CubeSat PCB after CubeSat Kit PCB Specification and made some simple assemblies. Pictures are in the last post and here are the models.

Posted on 2013-01-26, 23:15 By
No comments yet Categories: Soft
MSP430FR variables to FRAM

So I use MSP430FR because it has FRAM. But it also has 1 kB of SRAM and all the variables and the stack is in the SRAM. That is no fun I want my data do be safe and maybe even survive a power off.

First idea is to use static addresses. But that is super bothersome and error prone to more than 2 variables.

Fortunately there is linker command file in the Code Composer Studio project - lnk_msp430fr5739.cmd. I found lines 119 to 121. They say that variables and stack should be in ram. One simple hack later and:

.bss       : {} > FRAM          /* GLOBAL & STATIC VARS */
.data      : {} > FRAM          /* GLOBAL & STATIC VARS */
.stack     : {} > FRAM (HIGH)   /* SOFTWARE SYSTEM STACK */

Checked it out with debugger, and indeed. All variable memory locations were in FRAM area (device datasheet, pg 23, Table 6. Memory Organization).

Fun - but.. but... there are restrictions that apply!

1. FRAM speed is 8 MHz

So if your MCU is faster then all operations with memory will be delayed a bit. There is some caching, but my application run at 8 MHz and everyone else's even slower so whatever.

2. FRAM is non volatile

You can be extra sure that all your variables contain random values at startup. Or - not random, but the same that they had on last power down.

3. FRAM is not indestructible

Datasheed explicitly warns about it. But also it says that it will survive 1015 writes. Most read and writeable variable in my code is i. It is the counter in inner loop. It gets read or written (endurance wears with reading too, it has destructive reading) about 5 times per loop. Inner loop runs 100 times and the outer loop runs at 600 Hz. So my code writes the variable at 5*100*600 Hz = 300 kHz. With this much use the FRAM will be destroyed in - 105.62 years... So.. I think I'm good.

Posted on 2013-01-16, 01:25 By
No comments yet Categories: Soft
Texas Instruments Grace download

I still hate registration walls and US export approvals. I upload so you wouldn't have to see them. This time: Grace – Graphical Peripheral Configuration Tool. Also, my server seems to be faster than


Posted on 2013-01-13, 16:16 By
No comments yet Categories: Soft
Code Composer Studio Version 5 Download

I hate registering to pages to get information or downloads. I really hate it. This is one of the two reasons Arduino has been so popular - it's open source and you can do whatever you want with it.

So I have a Texas Instrument FRAM development board MSP-EXP430FR5739 that I can buy here, in Estonia with no questions asked. I want to program it - I have two choices: commercial Windows only IAR or cross platform Eclipse plugin Code Composer Studio. Off course I try to download Code Composer Studio. But no, I can't. I have to fill out some stupid U.S. Government export approval. WTF. I can get the board and all your high tech chips with no problems but downloading plugin to my Eclipse requires a export document. You have to be crazy. So, if anyone wants it. I host a mirror now:




Edit: Windows installer is now offline one so it would work.

Posted on 2012-07-07, 14:30 By
23 comments Categories: Soft
Using Scons to compile and program AVR ATmega

For one part of ESTCube-1 satellite we need to compile big and changing project to our AVR ATmega. Just using AVR Studio doesn't fit because we have people with linux (me), windows and mac in our team. The other common way - using hand modified AVR Studio Makefile doesn't fit either because it is prone to errors and irritating when working with tens of files. Lets use build automation tools! First though was Makefiles. After half a week of studying about the cryptic ways of Makefiles it was clear that it is not the right way. So lets use something simple (simple usually means python) - Scons. It is a tool very similar to Makefiles. But instead of writing cryptic and non debuggable pseudo code we can use python! I worked on it for couple of days, finally taught myself Scons with really really simple example and then copied the structure to real project.

The base for the code comes from some weird german wiki.


env = Environment()

mcu = 'atmega1280'

Target = ''

# Optimization level, can be [0, 1, 2, 3, s].
opt = "2"

env['CC'] = 'avr-gcc -mmcu='+mcu+' -O'+opt
env.Append(CCFLAGS = "-Wall")
env.Append(CPPPATH = 'EPS_Library')

# Make elf
env.Program(Target+'.elf', [Glob('Library/*/*.c'), 'Tests/'+Target+'.c'])

# Make hex
env.Command(Target+".hex", Target+".elf", 'avr-objcopy -j .text -j .data -O ihex $SOURCE $TARGET')

# Show memory usage
env.Command(None, Target+".hex", "avr-size $SOURCE")

# Program the thing
env.Command(None, Target+".hex", 'sudo avrdude -c dragon_jtag -P usb -p m1280 -u -U flash:w:$SOURCE')

To run it just write:

scons Test0
scons Test0

Where "Test0" is the name of the target file in the Tests directory.

The code compiles the test and library to elf with avr-gcc. Then the the elf to hex. The avr-size then shows the size. Finally avrdude, using AVR Dragon JTAG erases the device and flashes fresh .hex file. For clean command the target must also be specified.

scons Test0 -c
scons Test0 -c
Posted on 2012-07-06, 00:47 By
No comments yet Categories: Soft
Free linux programs

I am using much free software and I though to recommend some better ones. Like all linux programs, they all run on Window and maybe even Mac.



Posted on 2012-05-09, 11:15 By
1 comment Categories: KiCad, Soft
Tech-thing KiCad library manager
Screenshot of Tech-thing KiCad Library editor

Screenshot of Tech-thing KiCad Library editor

The KiCad default library is so messy. Sorting and editing everything with text editor is pain in the ass (atleast possible *hint at eagle*). I tried to download some existing library managers, but none of them worked. So... I made my own.

Tech-thing KiCad library manager manages both, the library files and module files. It lets browse all your library and module files and their content. You can delete and add files. Also delete, rename, copy and move their content. Supports library components with aliases, just use / between aliases (example: OPA334/OPA2334/OPA335/OPA2335). To use it, copy it to KiCad base folder and run it with python.

The code is made in python, using tkinter. I tried to make it readable and pretty but it ended up as always. At the moment it's at version 1.0 because it has all the functionality I wanted it to have, maybe sometime in the future, if there is an interest for it, I will continue developing it, but not this week.

v1.1 add file rename button
v1.2 make it easier to run on different operating systems
v1.3 refactor the code with askstring(...)
v1.4 make it possible to copy modules from board files
v1.5 add whole library viewer
v1.6 add search
v1.x maybe add more parameters to edit in each component (3d file location etc.)
v2.0 display pictures of each component

Source in Github


My KiCad libraries

Posted on 2012-03-15, 09:32 By
8 comments Categories: KiCad, Soft
Qt4 and C++
Qt4 grass physics engine

Qt4 grass physics engine

I got a little bored when visiting my parents and last place I tried to go to work didn't want me because of my poor C++ skills. So best way to practice OOP in C++ and familiarise myself with the syntax is to make a project. My idea of project - a 2d physics engine for grass... It had GUI, OOP and was simple enough for one evening project.

I found very good tutorial from site . Surprisingly GUI programming in C++ was exactly the same as in Java or in Python. The C++ syntax was easy too because I had seen it for years, and finally I understood why it was like that all along. Also qmake is very useful, must learn that more.

Secondly I realised (again) that random function is very useful in games, and more or less useless in everything else. And finally - the GUI worked at 100FPS, I love fast reacting GUI. Damn shame that my computer is slow/Intel Atom.


Posted on 2011-12-21, 13:06 By
No comments yet Categories: Soft
HeeksCAD: the open source CAD

It is sad how all CADing is still be done with proprietary software. Like: I use SketchUp, it's easy to use, but the full version costs and it's not made for technical drawing. So searched in the web and found many free CAD programs. But all of them were unusable for Sunday mechanic. Most of free linux programs had so steep learning curve or were just plain retarded from modern point of view. The only interesting thing I found was BlenderCAD. This is a project that tries to make plugin that converts existing and good 3d software Blender3d into CAD program. I have used Blender and it is a very good program for drawing, also many people(like Open Source Ecology guys) already use it for CADding. Unfortunately I can't talk more about it because I wasn't able to install it - a classical problem with non-pro linux users.

First model in HeeksCAD

First model in HeeksCAD

Later, while cruising around in RepRap wiki I found HeeksCAD. There were some problems with installing. I followed , but used too new Ubuntu for it, so I temporarily broke package system on one computer, couldn't install on other. They really should get it on the Ubuntu repositories. I would have made a donation to them with that comment, but they donate button is not working on my computer.

After installing I found myself from 3d space, much like SketchUp. But differently from SketchUp HeeksCAD is more number based CADing program and less like drawing. I watched couple of tutorials and tried a bit of modelling and I approve. I think this is THE CAD that I have been looking for. It even has CAM built in it. On the downside I couldn't find measuring button and the undo isn't working half of the times. But it still is very promising project. It will be one of the biggest hobby CAD programs around.

Posted on 2011-11-28, 10:57 By
No comments yet Categories: Soft
KiCAD experience

So I finally forced myself to try KiCad, yes, forced, their user interface is really so horrible. I decided to try KiCad because its one of the biggest open source EDA programs. Another option was gEDA, but KiCad looked friendlier. The reason I went away from EagleCAD is because it is controlled and owned by evil corporation. Its free and juicy today, but tomorrow you want to sell something you designed with it and you can't unless you pay 50$ (or 1494$ for full version).

First I had to make the schematic. I chose small and easy schematic - Attiny13, some pinheads and capacitors. Because It didn't had Attiny13 by default, I downloaded Attiny library from . Adding the lib was bearable. Adding the components was.. good? I liked the shortcuts version more than Eagles command line communication. But the user experience at whole was terrible. The graphic lagged behind, there were artifacts on the screen all the time. GUI and buttons were a little old looking and .. random. I wanted to add six same connectors and I had to click add button (a) every time. But like, searching from library was better than in Eagle. When moving components the wires stay in position what is silly.. But whatever, actually I love the library idea in there, totally makes sense and is logical. And the ERC is times better than Eagle.

KiCAD schematic editor with basic circuit.

KiCAD schematic editor with basic circuit.

So next I had to annotate, sound reasonable, but why do I need separate dialog. I probably will use it a million times the configuration can be in preferences or wherever. Next fight with netlist generator. I didn't get that. Why do I have to press four buttons to generate nets. Not like there is more than one way to generate those. And later, I wanted to generate new version of netlist and there was no Save button, only Save As. WTF, I still have the same project, I change the components for like 20 times before I'm satisfied, why should you Save As, stupid!

After that - CvPcb. Basically you assign the footprints to components. I think that this is great idea, it brings down time to draw new components. And that IS important, because if you do something else than LED+Resistor+555 then you run into components/footprints/etc that is not in library. And it has online symbol generator too, brilliant. So tried to match my polarized capacitor to package, after trying all of the packages I gave up and took the SIL package. The GUI was frustrating again. I have to press some ultrasmall button in order to see what the package looks like. Totally not starter friendly. Although if you use it daily you will remember all of the packages. Later I found out that right polarized cap packages were available online. So.. I download the package and its useless, I need some random webpage's help even to make the most basic schematic. Bad. Then I chose DIL for AtTiny and started to look package for my 3 pin connectors. I tried about 3 different packages before it got to me that SIL (Single-in-line) is the thing I want. Again, Eagle has ruined my logic and simplicity of world. I just hate library management in Eagle, like, stupid.

KiCAD board editor with basic circuit.

PCB Board

Finally, routing. I moved everything to place (I love those shortcuts) and started routing. First thing I noticed was the trace width: it was too narrow. So I read my tutorial, try to follow it, but there is no such menus. I find three more tutorials and still, I can't find such menus. I had different version! So half an hour of manual searching and menu digging later, still nothing. Okay, whatever, I can live with that. Routing was a bit stiff but nothing worth mentioning. The graphical things crashed, showed ghost airwires and made some other airwires invisible.. Again. Annoying. But I managed it, even the ground plane took only three tries to make.

So, KiCAd, I want to like you, but yea. There is just too many cliches, bugs and not enough user friendliness in it. But it is so close. If the developers would focus on GUI for a week and left that stupid autorouter to wherever it is then it would be real competition to Eagle. Good job!

Posted on 2011-06-29, 22:39 By
3 comments Categories: KiCad, Soft
International Conference on Advanced Robotics 2011

So, my university provided me and Cmc with opportunity to go to ICAR (INTERNATIONAL CONFERENCE ON ADVANCED ROBOTICS) 2011 for free. Yai for awesome. It started on 20. June with workshops. I chose workshop titled "Performance Measures for Quantifying Safe and Reliable Operation of Professional Service Robots in Unstructured, Dynamic Environments". Behind the scary and long title was series of interesting lectures. Most of them were about industrial robots, which as turned out - is about only topic simple enough for me to understand.

The second day started with some talks. First one was about human sensors and how human fuses its sensor readings together. Very fascinating was to listen analysis of human sensors like humans were robots. They discussed how humans find out the error percent of all of their sensors and how they measured all those constants.

The second talk was about robot companions ( Its a long term project to make robots for home use and prepare humans and robots for cooperation. Again, pretty interesting. After the talk it got funny questions, like "Won't robots replace humans?" and the answer was something like "We need to overcome these kind of perception." in short and blunt - "Yes, so what". You got to love robotics.

Then was some research opportunities talks, some interesting stuff but way out of my league/interest. And then - 15 minute oral sessions. So, many good topics and bad performers, typical nerds. Papers I remember form there were "Background Elimination Technique in the Structured Light Systems for Dynamic Environments" - about how to eliminate background from moving projector/camera systems. The example of this would be kinect. Another interesting one was "Robust Localization of Furniture Parts by Integrating Depth and Intensity Data Suitable for Range Sensors with Varying Image Quality" - a paper showing ways to localize furniture, useful for future service robots.

After lectures we went to Centre for Biorobotics. They showed female robot, UAV and some robot fish. Most of the tour time we just hang out in electronic lab and talked about microcontrollers..

It ended with Interactive session/reception. Finally something on my level and something innovative. I talked with couple of people there (noticed that my English is awful). One of the most interesting papers was named "Magnetic field-based SLAM method for solving the localization problem in mobile robot floor-cleaning task". Basically it showed that indoor magnetic fields are good enough to do mapping using them. The sensor for this is low cost and can be integrated with cheap odometry and cheap low-range distance sensors, creating localisation good enough for most of indoor robots. Very fascinating, the larger scale mapping device was the thing missing from low end indoor robots.

Also worth mentioning is paper "Localization of Intelligent Ground Vehicles In Outdoor Urban Environment Using Stereovision and GPS Integration.", about integration of optical flow and GPS (if you already have 3d map). Also "Navigation strategy and path planning for autonomous road crossing by outdoor robots" - the first mentioning of smaller mobile robots in urban environment, a field that sounds very interesting to me. Also couple of interesting devices, described in papers "Development of an intelligent object for grasp and manipulation research" - small cylinder with massive amounts of tactile sensors and "Vibrotactile Display for Hand-held Devices and Its Preferable Pattern Generation" - the first step towards touchscreens with touch feedback.

This is very awesome convention, it is funny to read paper names what are longer than ten words. Also the specialization of the papers, its mad. I'm sure I will get more used to all this academic world but for now, I'm still first year student.

Posted on 2011-06-23, 13:45 By
No comments yet Categories: Soft
Space thing - new HTML 5 game

Flying between planet and its moon

So about a year ago, I started making HTML based game. Technology seemed ready enough and interesting so I thought to give it a try. After a bit of trying it came out that it is very possible to build real time space shooter game using only JavaScript and canvas element, in your face Adobe Flash. For now it has reached version 0.18. It features fast flying, realistic space physics, moving planets, minimap and more. Just go to page and start flying. Goal so far is to have fun exploring the space and trying to control the spacecraft.

For graphics I chose Raphael JS library and for server communication and other tasks - JQuery. Space shooter game was selected because I like making physics engines, not games. The version number is so small because I have enormous ambitions, so about one day spent programming pushes the number about 0.01 forward. At the current version (0.18) there is only 4 planets, but I will fix it when my brother (the artist) draws more planet and sun pictures. More planets, naming, changing view size and more spaceships will be in version 0.2.

All planets, spaceships and their positions are stored in a mysql database. Cron job moves the planets once a minute. So they are moving, just so slowly that you can't see it. Game sends a query for planets every minute and, if you fly forward. For other ships I use long polling. Unfortunately Apache+PHP+MySQL isn't very fast combination. Or - they are fast but not real time. So that's why current FPS for other ships is - 5. I'm planning to move to faster server, don't know yet to what. First thought is Google appspot and Python because.. I'm familiar with it.

So yea, my little game project. I hope you have fun.

Posted on 2011-06-16, 15:21 By
No comments yet Categories: Soft