Archive for March, 2011


The Morse Buzzer

This is the Arduino project I worked on while attending last weekend’s all-night hackfest at our local hackspace, P-space.

It is a simple Arduino project for playing back any text sent to the Arduino via the serial interface in Morse code.

The hardware setup is trivial, just hook up a buzzer in one of the Arduino pins (existing code uses pin 10) and you are set.

The pin and playback speed are configurable, and so is the mapping of ASCII characters to Morse sequences if you’d like to add something.

Since the Arduino reads from the serial link, any number of applications computer-side could send text to be played out. Maybe a twitter client in Morse? Or you could hook up an ethernet shield to your Arduino and have it fetch any web site you want to play it back.

Code-wise, this is definitely not my best written code. Damn, that chartobuffer() function looks ugly to me. But I’m happy that I stepped out of my Python comfort zone and explored the C-like language of Arduino with it’s quirks and limitations. This board is a beginner’s dream, just as advertized 😉

Code can be found in my bitbucket repositories, free for you to look and play. Link is here.

Oh, and here is a picture of me having great fun at it =)

Morse code

Nick

P3191597

This weekend was full of fun and WIN!

We had an all-night hackfest on both Friday and Saturday nights at our local hackerspace, P-Space. The event was the first of it’s kind for us and was an open invitation for local hackers to come, socialize and write code on Arduino (or whatever else) projects.

The event was a HUGE success. It marked an attendance of over 50 people, many that we hadn’t seen before, with various levels of experise, from begginer to pro, all hacking together in groups, attending classes, producing interesting sprint projects and generally having tons of fun.

The first day produced lots of introductory classes on Arduino hacking, then working in groups to produce a plethora of projects. Such were, to name a few in my vicinity:

  • A question and answer game, with an LCD and buttons interface (watch out for the annoying FAIL sound there when you got an answer wrong),
  • A guitar-hero push-the-right-button-when-a-LED-comes-on game,
  • An arduino playing the Star Wars Imperial Theme (geekgasm),
  • An interactive light writer with a LED array and accelerometers,
  • My own Morse code buzzer, which played back in Morse whatever text it was fed to the Arduino via the serial interface. More on a later post 😉
  • The award winning (the winners took home everything they used) project that notified you in real life of unread e-mails (via POP3) or a file changing on your computer.

And that’s just the projects which were happening on the room I was in, with lots others being fleshed out in 3 other rooms I unfortunately didn’t have time to look at.

The second day of the event was a special charm as our friend Dimitris held a great class on PCB manufacturing, covering hands-on the whole process of etching UV-sensitive copper boards. A rare and mind-blowing class. Thank you Dimitris =)

I’ll add material to projects and photos as I find them, in the meantime, you can check out powerfool’s Flickr for photos from the event.

Congrats,

A very happy (and sleepy) Nick
The class

Couple of days ago a drummer friend of mine asked for some help with setting up an I/O sound card for his home studio.

Said sound card was the Focuswrite Saffire Pro10

My friend who studies as a recording studio engineer had set up the box to his Windows PC via firewire and had done geat work installing all his 8 mics to his drum set.

What was needed from me was to hook up the audio outputs to his amplifier setup and most importantly, tinker his Cubase 5 installation to interface the sound card.

A couple of hours latter we had a great working system. Now, I never counted myself as having sound engineering expertise, but it’s great to know that after all those years, my all-things-computer common sense and sound systems knowledge enabled me to make this work flawlessly.

I rock!

Nick =)

Prompted by an article in the latest totalXAKER magazine, I decided to give VirtualBSD a try 😉

VirtualBSD is a FreeBSD 8.1 desktop installation, packaged as VMware appliance. Go check their website out.

Now, being more familiar with VirtualBox than VMware, I decided to take the bit more complicated installation decribed here. I’m delighted to report that everything works as a charm out of the box.

My VirtualBox installation is the Oracle proprietary one (not virtualbox-ose) at version 3.2.12 straight out of their ubuntu ppa. Host system is as always my Linux Mint 9 (which is based on Ubuntu 10.4).

Here are some additional changes/remarks to the VirtualBSD walkthrough for VirtualBox:

  • I personally didn’t like the way the .vmdk is split in the VirtualBSD folder. No problem there, just register the main .vmdk in Virtual Media Manager beforehand, and clone it using “VBoxManage clonehd” to a new file. Then discard the whole folder and just use the new file instead. The UUID of the virtual hard disk changes with this process, but it’s no problem because internally, VirtualBSD doesn’t hardcode UUIDs in it’s /etc/fstab like some linux distros do.
  • I also changed the Network parameters in VirtualBox to “Bridged adapter” instead of “NAT”. VirtualBSD’s networking was smart enough to configure its IP via DHCP. Great!
  • What the vmware2vbox script does is first uninstall any VMware specific software, then install virtualbox-ose Guest Additions. Now, since I’m not using virtualbox-ose, that is not optimal, but everything seems to be in order (with maybe USB missing, but untested). Removing that and installing the right GuestAdditions is still a work in progress which I reserve for when I’m more acquainted with FreeBSD internals (lazy).

So, that’s all for this installment and I hope I have a great time exploring FreeBSD via VirtualBSD and get some more of you to check it out. Great little appliance there 😉

Nick

VirtualBSD running in VirtualBox

So, here’s a recipe for destruction:

  • Open your Windows VM you have for uni classes to write up a nice little recursive version of a simple algorithm.
  • Put some printf statements there for debugging too. Should look something like this:
int eukleid(int x, int y)
{
    printf("%10d %10d", x, y);
    if(y=0) return x;
    else return eukleid(y, x%y);
}
  • Fail to notice that y=0 instead of y==0 sends your program to endless recursion
  • After 10 minutes of crashing in Windows, decide that, what the hell, I’ll try it in my linux machine.
  • Compile program
  • Instead of running in a shell, double click the executable in nautilus by negligence.
  • Watch your /home partition run out of space in seconds!!!!

Now, what happened is that stdout and stderr of programs started outside a terminal get logged in .xsession-errors. The recursion shouldn’t have gone forever, but, by some strange bad luck, it filled up what was left of my 5GB headspace I had in /home

Not finding the culprit at first glance, I decided to close all programs and restart to single-user to look into it. Unfortunately, closing the VM meant virtualbox trying to update the VM’s xml file. THAT didn’t go well.

So, I was left with an unusable VM which took me a couple of hours to restore to some working condition.

Hey, it could have been worse! All the other programs (firefox, thunderbird to name a couple) handled the problem nicely. And thank Cthulu I had a separate partition for /home. Can’t imagine the mayhem if the root partition had zeroed out.

But everything is swell! I now know a couple tricks more than yesterday and opportunities like this don’t come everyday 😉 Such is the mantra of a troubleshooter soul like me! =)

Nick