Monday, October 26, 2009

Malcolm (probably in the middle) ... The LastFM MP3-Ripping Proxy Server

Nothing much to say .. the title describes it already.

Just have a look at this: http://robbeofficial.blogspot.com/2009/10/lastfm-ripper-in-middle.html

This post may look like a repost/reblog, or whatever this is called now, but I actually had my fingers in this project too ;) even though my friend Robbe did most of the work.

Friday, October 23, 2009

SDcard Unlock Hack

Holy shit! Is there anything that is more annoying than these little lock-switches they build in SDcards? I mean really guys ... the floppydisk died like centuries ago ... what on earth is the matter with you? Nobody needs these crappy switches! And the worst part is they are particularly flimsy and tend to break off.
That happened to me ... again! And this time I had enough once and for all! No more duct tape, no more hotglue, I wanted to eliminate this problem once and for all, so I bought a cheap USB cardreader thingy, cracked it open and measured the pins with and without the lock switch flipped on a spare SDcard. Luckily the two rightmost pins indicated the position of that damned switch. So I put a blob of solder onto them ... no need for a switch ... NO MORE USELESS SWITCHES!
DONE! FINALLY! :D


Monday, September 14, 2009

Nunchuck + Arduino + Linux = new controller

Well I love using things in the "wrong" way, and I recently got a Wiimote + Nunchuck and the Arduino I was talking about in the last post. So since the last post was about my first steps with this Arduino thingy, this one might be slightly more useful.
I decided that I wanted to use the Nunchuck standalone without the Wiimote, so I carved a little connector-something out of an old PCB and soldered on 4 wires to connect with the Arduino.
Well that's nothing new so far .. has been done here and here and here (this adapter looks a little bit like mine) and of course here ... you get the idea.

So most of my work was writing a little C-Programm that reads the Nunchuck data that the Arduino sends trough serial/USB and maps it to mouse movement, button clicks etc. With the "finished" program (still hacky though) its now possible to completely control the mouse including left- and rightclick, volume control and the Compiz Desktop Zoom function. The last two functions are activated when the Nunchuck gets turned upside down to enter that "alternative mode".

I'm pretty happy with the finished product because it's a really nice to have thing when you have a lazy movie-evening in bed. A normal mouse, lying in the bed always moves when you move and that can get extremely annoying.

If anybody is interested in the code, here it is: http://pastebin.com/f290d8878
(I'm not responsible for anything that code might damage, use at your own risk)
UPDATE: compile the C-code with "gcc -Wall -I/usr/X11/include -o arnumo arnumo.c -L/usr/X11/lib -lX11 -lXtst"

Tuesday, September 8, 2009

Arduino! Yes, I hopped on that train ...

... and so far I'm loving it! For a long time now I wanted to get into microcontroller programming but never really got the right motivation. Partly because the stuff you need was expensive and fragile and/or uncompatible with my PC (no serial/parallel ports, just USB).
But now I discovered the Arduino board and had to buy one to play with.

At this time I had no concrete project plans or anything but when I read about the things that little bitch is able to do and overflew a few projectdiscriptions of other hackers I just knew it will come in very handy sooner or later ;)
Now, about one and a half weeks later, I just finished my first dummy-project to start with: A simple datalogging programm that saves values to EEPROM.

The values it saves are read from a simple light-sensor (actually I used an old solar cell I once slashed out of a cheap calculator) and it reads and saves one sensor value every 30 seconds. Since the Atmel controller on my Arduino board has a total of 1024 bytes EEPROM, this results in about 8.5 hours logging time. After that it stops logging and blinks the onboard led to indicate that it's out of memory.
After that (or sooner of course) you can plug the Arduino to your PC, upload a simple datareader programm and retrieve the logged data per USB-serial connection.

I have to admit this is not a very advanced project, but I haven't done a blogpost here since ages so I thought why not...

If anybody is interested in the code, here it is:


#include <EEPROM.h>
#define EEPROMSIZE 1024

int sensorPin = 5;
int ledPin = 13;
int logMs = 30*1000; //log every 30 seconds (can log for 8.5 hours then)

int eepromAddress = 0;
int sensorValue = 0;

void setup() {
pinMode(ledPin, OUTPUT);
for(int i=9;i>1;i--){//blink to indicate eeprom clearing
for(int j=0;j<1000;j+=i*20){
digitalWrite(ledPin,!digitalRead(ledPin));
delay(i*20);
}
}
digitalWrite(ledPin,LOW);
for(;eepromAddress < EEPROMSIZE; eepromAddress++)
EEPROM.write(eepromAddress, 0);
eepromAddress = 0;
}

void loop() {
digitalWrite(ledPin,!digitalRead(ledPin));
if(eepromAddress < EEPROMSIZE){
sensorValue = analogRead(sensorPin) / 4;
EEPROM.write(eepromAddress, sensorValue);
eepromAddress++;
delay(logMs);
}else{
delay(100);
}
}


And the one to retrieve the logged data:


#include <EEPROM.h>
#define EEPROMSIZE 1024

void setup(){
Serial.begin(9600);
for(int eepromAddress = 0; eepromAddress < EEPROMSIZE; eepromAddress++)
Serial.println(EEPROM.read(eepromAddress), DEC);
}

void loop(){
}



Oh and the purpose of that little experiment besides the simple "hey that would be a nice thing to do" motivation: I thought it could be interesting to "log the sunrise" ;) and just wanted to try out the arduino with another powersupply but the usb.

Tuesday, March 3, 2009

WiiMote Data Logging - short status

I'm logging motion data every night now for a few days so that I have some data to analyse and to improve my program code.

The long term goal is to develop an application that monitors and logs your motions during the night and is able to wake you up gently (maybe with some vibrations from the WiiMote, and a little music or so) at the perfect time according to your motiondata. It should try to find sleep phases in which waking isn't that horribly stressful so that you get a better start in the day even if you slept less.

Of course there has to be a finite time limit so that you don't oversleep work etc ;) and there would be a minimum limit so that you get at least x hours of sleep. One could experiment with these settings...

As I said, I'm improving the code nearly every evening now and collect data during the night, and as soon as I think that it's worthwhile I will release the sourcecode of course :)

A little hint for the early birds: I'm using the wiiuse c library with Ubuntu.

Sunday, March 1, 2009

WiiMote Sleep Motion Logger - Result

Okay, the night is over and the logging succeeded :)

My concerns that the bluetooth connection would break off or that the WiiMote would be hellishly uncomfortable were unnecessary! I just put the WiiMote in a sock, made the wristband on my leg, and put the WiiMote-in-a-sock into the sock that I was wearing. The laptop that logged the data was standing in the next room utilized with a class 1 bluetooth stick. So I walked to the bathroom to brush my teeth and came back to check if the connection was still there, and it worked great. So I went to bed ...
And a few hours later I converted my motion data to this neat image:


So ... has anybody any ideas how to interprete that? ;)
PS: The first 40 minutes or so are the falling asleep phase including a little reading etc.

WiiMote Sleep Motion Logger

There is a new project coming up I was looking forward to for quite a long time now: Monitoring my heartbeat data while sleeping to analyze different phases and maybe, get it done to have my computer wake me up at exactly the right moment to get a fresh start in the day.

Well, building a heartbeat sensor, a wireless preferably, isn't that easy as it turned out after a funny hack-night with a friend some time ago.

But recently I a new idea came to my mind... why not make things simple, use stuff that already works and where libraries exist? I remembered that another friend owns a Nintendo Wii and as his TV died a few days ago he barely uses that baby. So I had no trouble to borrow a WiiMote controller. After a little hacking, cursing Java, turning to C and got stuff done, I just finished a datalogger application that monitors the accelleration sensors of the WiiMote and saves the data as CSV.

Now I hope to see something at the morning when I sleep a night with the WiiMote attached to my leg... You know, like from fluttering your legs while dreaming and turning around etc. The WiiMote sensors are quite sensitive and so there has to show up something ... I'm really full of expectation now and will get to bed to start of that experiment while my little netbook (yes the one from the robot project) stays awake to record my movements wirelessly through the bluetooth connection to the WiiMote :)

Stay tuned...

Friday, January 16, 2009

moBlog test

this is just a testpost from moblog, a blogging client for windows mobile. i hope it works ;) Posted from moBlog – mobile blogging tool for Windows Mobile

Thursday, January 15, 2009

Mighty Mouse

Right, this post is about mice. Optical mice to be more precise.
Since the very functionality of an optical mouse is to detect x/y motion at a very precise level in pretty high speed, I could not think of a reason not to use one of these -nowadays very cheap and common devices- as a sensor for my robot.

Two of the key concepts of the robot are cost effectiveness and simplicity, so an optical mouse has to be a great way to start when it comes to the point of giving the robot some other sensor than the built in webcam that most netbooks have.

I didn't even went through the trouble of disassembling the mouse and ripping out the guts or so. I simply attached a tiny notebook mouse to the robot using some lego technic of course and wrote a quick program in c which reads the informations that comes in through /dev/input/mice. This also contains the most interesting values for our purpose: The movement delta for x and y. This means it gives you the amount of movement since the last time. So you can simply calculate speed, add things up to get absolute values, or do other fancy stuff as you wish.

Since then I just tested some simpler stuff as "drive forward until the speed from the mousesensor drops drastically, then drive backwards" etc, but I'm looking forward to implement things like a PID Controller that is able to autoadjust deviations while driving over irregular ground.

Suggestions welcome! :)

Tuesday, January 13, 2009

More fun with PWM

Pulse Wave Modulation is a simple technique to regulate elsewise binary (i.e. on or off) controlled motors or leds etc.
I just implemented a simple variant of this technique in my motor driver class, and I'm looking forward to put it in the next release of the software.
There are quite a few new features waiting to be dragged in the next release, but this is definitely one of the coolest :D I tested a simple routine a few minutes ago where the robot starts real slow, getting faster during a few seconds, then slowing down smoothly and doing it all backward again. Sounds simple, is straight simple, but very much fun to watch it work so nicely :)

Also worth mentioning: A few friends of mine who were able to drive the robot through my apartment using the WebBot server told me that it's really awesome but for one tiny thing ... the turning movement is too fast for the webcam. And it's true, if you don't see the robot but just see through the robots eye from remote, it's quite hard to control the turning. But that's old news now because now I can just finetune the turning speed with just one variable thanks to the PWM class :)

So friends, get ready for another testrace soon!

Friday, January 9, 2009

Let there be source!

This is just a quick announcement: I just created a GoogleCode project, so you can download an early alpha of my sourcecode! (At the right side, click on Downloads)
It includes everything you need to play with the usb card and your webcam, plus a cool application that lets you remote control your robot from another computer using the browser!

I hope you like it and I would love to get feedback from some testers. And if someone likes to contribute to the project feel free to contact me. :)

Thursday, January 8, 2009

The 'hard' part

Today I want to show you the hardest part about building that robot I talked about last time: The interface from your netbook to the hardware we desire to use (i.e. Lego Technic part nr. 8883 Power Functions motors).

As I'm using the term 'netbook' for the controlling computer, I'm having in mind a really-nicely-driving-around kind of a robot. If you don't have a laptop at all but would like to build a cool stationary robotic arm on your desktop or something like this instead, that'll work just fine too of course.

But back to the interface part. You just grab your USB missile launcher toy that you once bought with great hope for long time coolness but realized after 20 minutes that this hope has ended 10 minutes ago, and start openening it at the bottom. Unscrew the beast completely but don't open the gearbox modules since they could be used as they are in another project. What you want to get out -beside the fun of disassembling stuff- is the circuit board that controls the three motors of the device. If you are lazy you can simply cut the wires at a reasonable length, but not the USB wire though ;).

When you finished your exploit you should victoriously hold the circuit board in your hands, put on an evil smile and shout something intimidating like "soon it's time for revenge!", just to scare anyone around you... make that a usual habit for better effects.
Nevertheless the circuit board should look like this:

You should be able to spot 3 slightly thicker cablepairs (red arrows) and 5 thinner ones (green arrows). Click on the picture to zoom. The thicker pairs control the motors, the thinner ones are used for sensory input with microswitches.
The two ports that control the left/right and up/down motors can be used in both directions, aka inverting their current flow direction. But the one that controls the motor to fire the missiles can not do that (I would be glad to be proved wrong!).

So it might be better to test out the functionality and play around with the driver program and a multimeter first... but this is optional if you are sure you know the right pairs.
Note the 4.8 Volt at the multimeter after telling the board to "turn left".
For the Lego motors this is enough to run nicely. We won't need any other power source and can connect them directly to the board. (Still, I'm not responsible if that destroys anything of your stuff! You are warned, and doing this at your own risk :-P)

You should now use the extension cords (Lego part nr. 8886), cut them in half, and connect them to the circuit board using wire nuts. The cords have 4 wires and you will need the two in the middle. Feel free to use this great site about the Power Functions elements (scroll down).

Now, if everything worked out fine, you should be able to control the motors via the driver program. Remember you need to be root, use 'sudo'.

I will provide sources etc as soon as possible. Click here!

Stay tuned for more :)

Tuesday, January 6, 2009

Let's get started

OK, what do we need for our robot? Without further delay I'll tell you the complete list of components I used:
  • A netbook (I own the Asus EEE 701, and installed UbuntuEEE) ~200€ @ Amazon, but you could also use nearly any other netbook or maybe a "normal" notebook that's not too heavy.
  • An USB-RocketLauncher, or CircusCannon or something like this. (I got this one from a nice friend ;) thank you!!) ~20€ ... plus the servos in the inside could be quite nice for other projects.
  • A little bit of Lego. A set like this should be sufficient, but you can confess... you already have enough Lego right? ;) ~50€ ... but you need ...
  • More Lego! Two of these and two of these. ~25€
  • A few wire nuts, a knife, duct tape, screwdriver ~5€? If you are reading this you should at least have 3 out of the 4 items, if not go read something else!
Alrighty, that's more than enough to build a really cool robot! And it sums up to 300€ if you don't have any of the items. You already own a laptop? Then it's just 100€ for you! You love Lego or can steal some from a defenseless child? You're down to 50€ ;)

And let's face it, you could'nt make a lot of noise or filth with the stuff we just talked about. So it will make a really nice project you can do nearly anywhere at every time of the day without making your girlfriend or neighbours mad ;)

Next entry will be about the execution of the project. Stay tuned!

Oh and I guess it's about time for a graphical teaser, so have a look at my version 1.0 :)



PS: I wrote this article on my robot :D how cool is that huh?!

What's cooler than a robot?

Many geeks around the world share one dream: Building a robot!
And there are of course a few gazillion projects flying through the internet covering exactly that one topic. But let's face it, there are too many obstacles for the busy and lazy persons that we are.
There is always at least one k.o. condition that makes us stop the project before even getting started. A few examples would be:
  • too expensive
  • too time consuming
  • requires tools that we don't have or that are to expensive (e.g. milling machine, microcontroller programming device, ...)
  • the robot ends up being a boring line follower
  • you have to stick to the c-programming language
  • and so on ...
But what if I would tell you there is a way to build a robot that is relatively cheap, can be build without even touching a soldering iron or making any dirt at all, can accomplish an impressive amount of things you would like your robot to do, and can even be disassembled and reassembled to something else equally cool without any hassle? "Impossible" you say?

Let's nail the facts:
  • pricerange: 240 - 340€ (320 - 450$) including EVERYTHING and ignoring the fact that you probably already own a few of the items
  • time: about 2 to 6 hours depending on your skills and including time for beer and or coffee
  • tools: screwdriver, knife, a few wire nuts
  • dirt: a few wire isolation cut offs, that's all, really!
  • noise: none!
What will the robot be capable of? A few teasers ...
  • Movement .. of course ;)
  • Sensors
  • WiFi communication
  • Camera vision
  • Multi-lingual speech synthesizer
  • Linux based (I used Ubuntu)
  • Java controlled (or any language you like)
  • a lot more!
If your mouth is wetted now stay tuned for my next entry where I will describe the project in detail...