p1020429

Arduino + 4 x 4051 Multiplexer + 28 POTS = MIDI controller

Pretty straightforward build. 4 multiplexer output pins into the Analog in ports of the Arduino 1,2,3 and 4.

Pitfalls: If you have an Arduino Leonardo: use Serial1.print to write to the TX on the 2nd pin for MIDI. The normal Serial.print writes to the USB TX. (very useful for debugging)

Pitfalls: I have a significant voltage drop therefore I use the first pin on the first multiplexer to read the analog value and use it as a reference when mapping.

ex: midi_value = map(analogValue, 0, myREF, 0, 127);

myRef is read in the setup() function from 4051 chip 0, address 0.

 

1. Placeholder graphics and placement (Arrangement is identical to MiniMOOG ūüėČ )

2. Drilled holes and final placement

3. Bottom view with first ribbon cable in place

4. Remaining ribbon cables and +5V / GND connections made

5. Perfboard with BUS and sockets for the multiplexers

6. Wired together + added the MIDI connector

7. Close-up of the wiring

8. Finished product, running NI Massive

10. Close-up of finished product

And the final “product”. :)

How to fix YouTube video playback on an Apple Powerbook G4 running MacOsX 10.4

I almost gave up on this, but luckily I found a good solution that works for me. I own a Powerbook G4 1Ghz 1.25Gb RAM. I noticed that altough movie playback is great in VLC when it comes down to the flash player it has horrible performance. In fullscreen mode even in 360p playback youtube stutters and hangs and does a performance of around 8-12 fps on my system.

Here is a step by step description of what I did. This is for Firefox so make sure you install it!

What we are trying to do is to change the flash video player for Youtube only. Forcing an alternative player that is better supported by the OS. This can be either VLC or Quicktime since both players support FLV and MP4 playback.

Step 1: Get Greasemonkey

In firefox you go to Tools->Add-ons->Get add-ons

Search for the word “greasemonkey” and click “Add to firefox”. After installing this will restart your firefox.

Step 2: Go to userscript.org and get “Youtube without flash auto” script

http://userscripts.org/scripts/show/50771

Click “install”. A window will popup allowing you to install the script.

Step 3: Go to youtube.com and open a video. The flash player will initialize and will stop. A new menu will appear under every video. Click the “YWOF Prefs” button. A config screen will appear.

Step 4: for default quality choose MP4 and the quiality you would like your vids to default to. I use the quicktime plugin so I chose MP4. For “player” leave “Generic”.

Step 4 (Optional): If you would like to use VLC make sure you download and install VLC and the VLC Internet Plugin. You can find both for MacOS 10.4 here: http://www.videolan.org/vlc/download-macosx.html Again: only do this if you are sure you want to use VLC. I am using QuickTime. No need to do VLC unsless QT doesn’t work for you.

Step 5: Next time you open any youtube video the QuickTime plugin will play it. Double click the screen to go to fullscreen mode and enjoy stutter-free youtube on your Powerbook G4 with MacOS 10.4.* (to exit fullscreen: double-click the video, as keyboard did not work for me)

Hope this helps. Figuring this out surely made my day since the biggest issue with my Powerbook G4 for me was the inability to use youtube.

EDIT: Upon further tweaking I noticed that the VLC plugin work much better for me then QT.

.

Been busy building my new library: SimpleFaces for PHP

I have been inactive on my blog for a long time. In this time I have managed to screw up 4 Xbox360-s  with reflowing..I will give up fixing xboxes for now..

In all this time, I have been working on my new library which will definitely help out development for web applications. Soon I will post more info about the matter, but for now development is ongoing..

PHP SimpleFaces is an ajax framework built for PHP. It allows users to define interfaces via XML in a very similar manor to modern UI builders. The cool thing is that you can bind classes and methods to events on your frontend controls and you get to handle them in PHP. Although this seems like something that was done before by other libraries, in SimpleFaces you get to control all the frontend UI elements directly from within PHP.

http://www.phpsimplefaces.com

There are some demos available on the site as well an early video showing off the features. Hopefully I will release a public version in January 2010.

dell-vostro-1700

Dell Vostro 1700 with GeForce 8600M GT Review

I have been using a Dell Vostro 1700 for 1 year now, so I thought I’d share some info about it.

Processor: Core2Duo T9300 @ 2.5Ghz on 32W, 6Mb L2 cache, 800Mhz FSB

Memory: 4Gb

Graphics Card: nVidia GeForce 8600M GT 256Mb DDR2 @20W

Graphics card Memory Clock: 800/475Mhz, Shader Clock: 950Mhz (32)

Monitor: 17.2” Samsung/Seiko Epson SEC 3258

I bought this machine for gaming and work. It has great feature sets to do these tasks, but not too brilliant when it comes to mobility. It features a heavy chassis and heavy battery.

Mobility:

This machine weighs a ton. It is very heavy because of the big screen, heavy magnesium alloy chassis and batteries. It is hard to carry around and requires a BIG case. Since it has a huge monitor and a very power hungry graphics card it eats up the battery very fast. My machine gets an autonomy of about 2 hours with a 6Cell battery using the Dell power profile, and in power saver mode with low back-lighting I can get out a maximum of 3 hours tops.

However it is a rugged machine and most screws are held in metal instead of plastic, so you get the idea.

Work usage:

I am a programmer and I run a lot of heavy processing environments like J2EE with such IDE-s running as Eclipse and Netbeans. I sometimes peak both memory and processor usage, but this configuration doesn’t really slow down nor hang or swap. It runs everything smoothly and quickly becomes responsive when coming back from stand by.

In power saver mode there is some lag coming both from processor and powered down hard disks, but it’s bearable. I rarely turn it off, I just go on stand-by all the time.(standBy drowns the battery! so make sure the charger is plugged in)

I run Vista. I also used Ubuntu and LinuxMint for a while, ran fine, but power management was not really supported.

Gaming:

Here comes the main reason I write this article. This rig is great for gaming. It runs most games just fine including newer ones. Sometimes you need to tweak the options since it wont really run everything in high detail, but if you find a balance between resolution and video features you should have no problems.

It features a descent Class 2 graphics card. http://www.notebookcheck.net/NVIDIA-GeForce-8600M-GT.3986.0.html

Heat: the heat dispersion is great on this unit. My temperature sensor usually shows 40-45 C in normal usage. Peaks slightly around 55-58 C when running games, but it rarely reaches 60 C.

There is plenty room for overclocking but I didnt feel I need to commit to that. Especially in Crysis you will notice that a small overclock of just a few Mhz on the shader and memory clocks will result in very visible increase in framerate.

This laptop is a definite go if you’re a gamer and want to play serious games on it. However if you have the money try to go for a Class 1 graphics card like the Quadro3700M.

This laptop does NOT feature MXM, so you are stuck with the stock graphics card.

I use most DELL drivers on the system, but for video I recomend the updated driver found here: http://laptopvideo2go.com/

These drivers are hacked from the official driver releases from nVidia and updated much more often then the DELL drivers. Getting an updated driver results in HUGE visible performance increase.

For example: Crysis would barely run with the stock DELL drivers, and after the update from laptopvideo2go it ran perfectly. Same with BioShock!

c64keyboard

C64 keyboard in Arduino using multiplexers

I just bought a bunch of low cost 4051 analog multiplexers for use with my Arduino. I am working on a MIDI controller so I will need a lot of input both digital and analogical ones, so the multiplexers will come in handy to do analog reading using as few of the analog pins as possible.

As a first test I tried an adapter for a C64 keyboard, which has all keys placed in a 8×8 matrix of buttons.

The idea came from arduino playground where they explain the usage of multiplexers. The following image fits the c64 keyboard like a glove, so just go ahead and build the one on the right.

Link to more details: http://www.arduino.cc/playground/Learning/4051

Here is my solution. It’s the same circuit only on a perforated board. If you have the skills to make PCB-s, I really suggest to doing so.

And now for the code:

int v=0;

void setup() {
Serial.begin(9600);
Serial.print(“Hello”);
pinMode(2,OUTPUT);
pinMode(3,OUTPUT);
pinMode(4,OUTPUT);
pinMode(5,OUTPUT);
pinMode(6,OUTPUT);
pinMode(7,OUTPUT);
pinMode(13,INPUT);

}

byte bin[] = {
0,1,10,11,100,101,110,111};

int readKeyboard() {
int i,j,row,col,v, code;
byte r0,r1,r2;

code=0;
for(i=0;i<8;i++) {
for(j=0;j<8;j++) {
code++;
// address X
row = bin[j];
r0 = row & 0x01;
r1 = (row>>1) & 0x01;
r2 = (row>>2) & 0x01;
digitalWrite(2, r0);
digitalWrite(3, r1);
digitalWrite(4, r2);
// address Y
col = bin[i];
r0 = col & 0x01;
r1 = (col>>1) & 0x01;
r2 = (col>>2) & 0x01;
digitalWrite(5, r0);
digitalWrite(6, r1);
digitalWrite(7, r2);

// Read the actual Value
v = digitalRead(13);

/*
Serial.print(“(“);
Serial.print(j);
Serial.print(“:”);
Serial.print(i);
Serial.print(“)-“);
Serial.println(v);
*/

if(v==LOW) {
// instead of returning, you may use a buffer or whatever to keep track of all pressed keys
return code;
}
}
}
}

void loop() {
v = readKeyboard();
if(v>0) {
Serial.println(v);
}

delay(100);
}

Notes: make sure you click the SerialMonitor so you see some output. The above code will output the number of the key pressed.
For more information concerning the keyboard layout of the c64 here is a schematic of the key matrix.

(click the image to enlarge)

1up

Hands-on experience with arduino

I just got my Arduino last week, and although this is my first intro into electronics so I was very excited to get it and try out new things.

Why i liked Arduino a LOT:
– it lets me code in java (using the Processing IDE) and deploy my IO code directly onto the device through an USB cable
– You can program it to handle various kinds of serial devices, and has out-of-the box support and great tutorials for some of them right on http://www.arduino.cc
– You have 6 analog pins which lets you play around with analog stuff like sensors
– For beginners: it quickly lets you play around with leds :) *blinky*
– A lot of support for various hardware and a great forum to figure out how to connect your devices or interface with some requiring additional circuitry

What i miss:
– You cannot make Arduino become an USB host for various technical reasons, excepting a limited range of hardware which can be converted to serial, so some of my wild dreams where killed right here
– With the standard Arduino (Duemillanove) you cannot communicate to more then one serial device at a time (Only one RX pin) so you can’t really connect a Keyboard and a midi IN/OUT interface and so forth without additional electronics (like switching devices on a PIN so you can separate interrupts)
It would be great to have something like this built onto the motherboard by default. My example would be if one wants to create a small usable midi controller (THRU) he will need IN and OUT so it can be added to the midi chain of synths and controllers.

(my private stash)

So here are my Arduinos:

1. original bought from http://www.robotop.ro
2. My etched version
3. The famous breadboard version

What I am trying to accomplish now is to interface two low cost arduinos based on the Atmega8 chip to multiply the IO operations one board can handle using just a few of the digital pins. My ultimate goal is to build a nice sequencer with MIDI In/Out/Thru using Arduino.

My first etched version in detail (Atmega8 with Ghetto programmer)

My first etched version in detail (Atmega8 with Ghetto programmer)

Knobs on my sequencer to-be RetroKing

Mechanical encoder (clicky) on RetroKing

x

tv

My hack of the day: an Infrared remote for XBMC / Debian

I now have xbmc installed on my server, which is plugged into my monitor via a looong extension cable. Having a wireless mouse for controlling used to be OK, but it got kind of annoying to find a flat surface every time you wanted to pause the movie or browse through directories.

So I thought it would be nice to attach an IR pickup and preferably use the unused buttons of my Samsung T240HD TV’s remote. When in PC monitor mode, the TV does not use it’s directional keys, OK, Escape and none of the Colored buttons, so mapping these would be perfect.

To use IR you need two things: 1. an InfraRed receiver and 2. some software to go with it. In my case I did not have a nice usb IrDA, so I had to make my own. Luckily it’s quite simple. All you need is and infrared pickup diode(old tv or whatever) and +5V to power it. The computer will pick up the signals via your computer’s audio line-in port. You simply build this contraption and hook it up to you line-inport: http://lirc.org/ir-audio.html

You can get +5V from any of your power connectors, if you have a multimeter make sure you have the correct tension before connecting everything to your sound card.

When everything is done, you can test it by enabling the Line-In playback on your PC and pressing some buttons. If everything is set up correctly you will hear strange noises when the IR receiver picks up any signals.

Now for the fun part: using LIRC to map unknown IR signals to keyboard events.

1. Install LIRC using aptitude or whatever, and make sure the programs irrecord and irxevent are installed.

2. You need to start up irrecord so you can test your connection and records some IR events.(i have mi input on the right channel of the sound input, depending on how you’ve set up your rig yours mith use the l parameter)

irrecord –driver audio_alsa –device hw@44100,r myConfigFileToBe

This will fire up irrecord and you can name your buttons after each successful read. You will also get a new config file which contains the codes of your remote.

Once this is done, it is time to test it:

1. Run the lirc daemon

lircd –driver audio_alsa –device hw@44100,r pathToYourConfigFileThatWasJustCreated

2. run irw

irw

When you push buttons on your remote, irx will look them up in your config file and display the appropriate events.

All we need now is to map this input to keyboard events. You do this by using a program called irxevent. Once the lirc daemon is running, you can start irxevent by supplying a config file which contains the mappings: you need to create this file manually!

Create a blank text file, and enter any number of mappings in the following form:

begin
prog = irxevent
button = YOURBUTTONNAMEFROMLIRCCONFIG
config = Key Page_Up CurrentWindow
end

begin
prog = irxevent
button = InfraOkButton
config = Key Enter CurrentWindow
end

and so forth…

When you are done, lunch irxevent like this

irxevent yourEventConfigFileName

Now test it: press some IR buttons and see if the keyboard events are fired.

From here, i just lunch XBMC and everything is working fine. (Note that XBMC does have support for lirc directly, you can use that aswell)

How to build XBMC in Debian (etch)

After many long hours of forum sweeping and googleing I finally managed to build XBMC in Debian. It took me exactly 18 hours to do this starting from scratch. (final build after satisfying all perquisites took about 3 hours)

Yes, it is possible to build and run XBMC in Debian without too much hassle.

Why: I have a linux machine running a server environment for my files, and I thought it would be nice to use it as a media center since it is always on. Since it is al set up i did not want to install an ubuntu on it just for the media center, so I had to build XBMC for Debian (etch)  from the sources. Unfortunately Debian is not yet supported by XBMC community, but you can obtain the source code and build it anyway. Here is what i did. (I am in no way a linux wiz, so this is probably not the best way to build it, but it should work)

My configuration: AMD K7 1300 Mhz, 768Mb RAM, GeForce MX440 SE using Debiean (etch) with Kernel Image 2.6.18-6-k7

Step 1 – Get the source code

(assuming you are root and are in your home folder)

(if you don’t have subversion installed: apt-get install subversion )

Step 2 – Install the required packages

Add the backports to your /etc/apt/sources.list

Edit the /etc/apt/sources.list and add contrib and non-free
Install graphics driver so when you run glxinfo you should see Direct rendering enabled.

Now install these packages.

I did my build by excluding faac and pulse audio.

This command will most likely FAIL at the first time you try it, so just get rid of the packages which are not found, and use a tool like aptitude to search for different naming. (lib in front of the name, and/or -dev at the end) My environment is very messy, so I am not sure which ones I had from different sources. Try running ./configure –disable-faac from your XBMC sources directory, and it will complain about what you are missing from the environment.

Step 3 – Configure script

Change to your sources directory and run the ./configure script. (for me it is linuxport/XBMC/)
If ./configure finished successfully you should try to run make
If your lucky enough it might run, but I had several issues with it.

For me the first fix was to re-run configure with disabled PulseAudio and faac.

Step 4 – Editing and running the makefile

From this point my serious issues started, I will list a few which i had, if you are lucky and make finishes successfully, you may skip this section :)

The sqlite3_prepare_v2() issue
I got a missing function error here, so i changed the line of code in question(in the file the error was coming from).

Changed the function name sqlite3_prepare_v2 to sqlite3_prepare

I guess my sqlite libraries are old, you might try updating yours.

The CPulseAudioDirectSound issue

I got an error in the file “AudioRendererFactory.cpp” in line 64 related to CPulseAudioDirectSound not being found. This was strange because i explicitly disabled Pulseaudio. I just commented out both lines of code in this section. (lines 64 and 65)

The smbclient issue

This was a strange issue, i don’t know why xbmc-s internal smbclient library does not work. In any case, I’ve installed smbclient via: apt-get install smbclient smbclient-dev

And edited the Makefile like this:

Find something like: OBJSXBMC += \
continued by path to libsmbclient-i486-linux.a, should be around line 314 and 315, and enclose it in /* .. */ block. (comment it out)

Next look for the LIBS=… line (around line 85) which contains all libraries and append: -lsmbclient to it’s end.

The xrandr.c issues
All of these can be solved by upgrading your libxrandr packages. I did this by manually fetching the files and requirements from the debian packages list. Etch has xrandr 1.1.0 i think, and xbmc requires at least 1.2.3

http://packages.debian.org/lenny/libxrandr-dev

You can get the deb file here and try to install it by: dpkg -i PACKAGENAME.DEB (it will tell you what it’s missing, and follow the links on the debian page, you will find them there. Get those packages, and install them the same way, then retry installing xrandr package)

Step 5 – Make Install

Once make has completed successfully (will take a few hours on slower machines) you can install xbmc.

Step 6 – Run and enjoy

Once you installed run it by typing “xbmc” in your terminal.

————————————–

I will try to keep this list updated as comments roll in with problems and solutions.

Have fun using XBMC, and thank the guys and babes at xbmc.org for making such a cool software.

A little Fallout 3 humour

In war, it doesn’t matter who is “right”, only who is left.

How to run Fallout3 in linux with Wine on Ubuntu (nvidia)

To run Fallout3 installer and game in Wine, you need to download the source code, patch and compile Wine.

1. Download the wine sources

I use 1.1.8: http://ibiblio.org/pub/linux/system/emulators/wine/wine-1.1.8.tar.bz2

2. Get the following patches (save them to your computer):

– the mouse patch (mousepatch.diff)

http://bugs.winehq.org/attachment.cgi?id=15638

– the directx patch (driver.diff)

http://bugs.winehq.org/attachment.cgi?id=17130

3. extract the source code files within the archive to any folder, copy the patches into the the same folder, change directory to it and  run the following commands using a terminal:

patch -p1 < mousepatch.diff

patch -p1 < driver.diff

4. to build wine type the following:

./configure

Once ready, you will get some messages, make sure you download all required deppendencies should configure tell you so. (should you get an error sayin no opengl support and you are sure you downloaded libGL, go to /usr/lib and: sudo ln -s libGL.so.1 libGL.so)

Next run:

make depend

make

sudo make install

5. You should have a patched wine ready and installed. It’s time to get winetricks

http://wiki.winehq.org/winetricks

and use it to install vcrun2005, directx

6. type in “regedit” to bring up the registry editor. Open HKEY_CURRENT_USER/Software/Wine/Direct3D

– make a new string value: VideoDescription

– set it to something like: NVIDIA GeForce 8600M GT

– make another string value: VideoDriver

– set it to: nv4_disp.dll

– do a search on “MouseWarpOverride” and set it to: true

if it does not exist create the string value inside HKEY_CURRENT_USER/Software/Wine/DirectInput and add it as a new string value.

7. Install the game. Run the launcher and configure video options, then quit the launcher.

Start game with: wine Fallout3.exe

Everything should be set. If you have problems drop a line in the comments and we’ll try to figure it out.

———————————–

EDIT:

If xlive.dll gives you any trouble try installing this: Try this: http://www.microsoft.com/downloads/details.aspx?familyid=D6A69B9F-2AEF-4125-B162-EDF0AE922CAF&displaylang=en

You will also need XINPUT1_3.dll, which you should google around and download from somewhere.

Both dlls are ment for your .wine/drive_c/windows/system32/ directory.