geek in holidays – Arduino startup

So it seems that I am back on “blogging”. Long time no see, my friends 🙂 and thanks for all the messages I got in the meantime.

Most probably I won’t be able to keep up blogging as in the past (not enough time to do all the geeky stuff), but I will not abandon it anymore.

The past few days I’ve found out about the passing of a friend, one of the geekiest people I know, an elderly gentleman, who has spent most of his life in the search for knowledge (he was speaking 11 foreign languages), curiosities and geeky stuff (a BSD passionate and founder of the foundation behind EuroBSDCon). I was very sad to get the news from Gavin and Henning this week, posted via the OpenBSD lists.

RIP Paul!

So, given the fact that for the past few weeks I can only sleep till 2AM every night, with occasional nights when I can fall asleep somewhere close to the morning, I have decided to spend this time on something useful, rather than with thinking and worrying about purpose of life and ponies and butterflies. First thing at hand: my new Arduino kit.

First time playing with this toy, I’ve went through the Startup Guide, and made the lights blink, the buzzer go off etc. The ones I am going to use later on though are the following:

Indeed, these are just playing around with the very basics, but at least now I get the logic of how this works, and the code itself looks a lot like C programming, with libraries you can include and work with (and have the Arduino board become unresponsive when the libraries folder has a different name than the .cpp file inside it).

The entirety of the Arduino-specific function (like pinMode() ) implementation is called a “core” and people have made “cores” for smaller things (like the ATtiny) and much, much larger things (such as ARM Cortex-M varieties [see libmaple, for a vivid example] and even full blown Cortex-A chips (pcDuino, BeagleBone etc.).

The language is plain C++ “but you don’t have to” 😉 Keeping the avr-libc reference at hand is highly recommended, as well as the ATmega328p datasheet .PDF.

Oh, I’m afraid that’s about two orders of magnitude above the raw computing power available in the ATmega328p. Maybe somebody like John Carmack (that can write sin/cos tables out of memory on a napkin while at lunch) will prove me wrong, but that’s my current assessment.

You can use the Arduino to control the galvos (http://en.wikipedia.org/wiki/Galvanometer#Modern_uses) that steer the beam and you can probably use the same MCU to do light/dark detection for the point the laser is currently aimed at (assuming the photodiode’s optical path is parallel to the laser one and thus is auto-aimed by the galvos which point the laser).

The output part (make the laser write stuff on the wall) is probably easy to achieve, assuming a finite size for the written text/drawing. Simple reflexes can probably be done in the Arduino itself, like “if you see black, move left” or “wobble around that place”.

Mostly anything more complex (in realtime) which goes into computer vision domain (see OpenCV) is however too much for the Arduino. Bear in mind the ATmega328p doesn’t have an FPU, nor a DIV instruction, so anything that deals with curves will be very slow (in current day and age terms).