Archive for the ‘Tutorial’ Category

Fit-PC 2 as HTPC using (L) Ubuntu 11.04 Natty Narwhal

Monday, May 23rd, 2011

This post explains how you can setup our own media centre using Lubuntu. Using my Fit-PC 2 as example.

Fit-PC is a small, light, fan-less nettop computer manufactured by the Israeli company CompuLab. I use it in my living room and it’s nearly invisible. When I install an SSD in it, I will stick it back on my TV.

After the installing Lubuntu from USB stick I had to manually shut the computer down. Apparently there are some ACPI bugs in Natty, but it’s not important. It will be on most of it’s life. I made sure the computer was up to date before installing display driver.
sudo apt-get update
sudo apt-get upgrade

The fit-pc 2 ships with GMA500 Intel graphics. It kinda sucks since Intel is unable to give us proper drivers for it! This is why I will think twice or even three times before buying anything from Intel again.

To use GMA500 I deceided to use EMGD (source):
sudo add-apt-repository ppa:gma500/emgd
sudo apt-get update
sudo apt-get install xorg-emgd emgd-dkms
sudo emgd-xorg-conf

emgd-xorg-conf creates a config in /usr/share/X11/xorg.conf.d/10-emgd.conf. This is when the problems occour. emgd-xorg-conf discovers wrong port which I had to manually edit. My modified 10-emgd.conf:
Section “ServerLayout”
Identifier “Default Layout”
Screen 0 “Screen0″ 0 0
EndSection

Section “Device”
Identifier “Intel_IEGD-0″
Driver “emgd”
VendorName “Intel(R) DEG”
BoardName “Embedded Graphics”
BusID “0:2:0″
Screen 0
Option “PcfVersion” “1792″
Option “ConfigId” “1″
Option “ALL/1/name” “svdo-display”
Option “ALL/1/General/PortOrder” “24000″
Option “ALL/1/General/DisplayConfig” “1″
Option “ALL/1/General/DisplayDetect” “1″
Option “ALL/1/General/Accel” “1″
Option “PortDrivers” “svdo”
Option “ALL/1/General/VideoRam” “131072″
Option “ALL/1/Port/2/General/name” “sdvo”
Option “ALL/1/Port/2/General/Edid” “1″
Option “ALL/1/Port/2/Attr/70″ “0″
EndSection

Section “Screen”
Identifier “Screen0″
Device “Intel_IEGD-0″
Monitor “sdvo”
SubSection “Display”
Depth 24
Modes “1024×768″
EndSubSection
EndSection

Section “Monitor”
Identifier “sdvo”
ModelName “sdvo panel 1024×768″
EndSection

Section “DRI”
Mode 0666
EndSection

Section “Extensions”
Option “composite” “enable”
EndSection

Keyword here is ALL/1/Port/2 were port 2 was 4 in the orginal configuration and sdvo was lvds.

I then installed lirc to be able to use my transcend remote for my picture frame, you can use anything. I followed some tutorial for making it work. Basically run irrecord to trian lirc to understand my remote.

sudo irrecord -d /dev/lirc0 /etc/lirc/transcend.conf

 

I tried Boxee first, but it’s bloated. Ended up using XBMC:

sudo add-apt-repository ppa:team-xbmc
sudo apt-get update
sudo apt-get install xbmc
sudo apt-get update
sudo apt-get upgrade

Edit #1
If you want XBMC to automatically detect new movies just open crontab

crontab -e

and add the line

* 10 * * * wget -T 60 -q -O /dev/null "http://user:passwd@localhost:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn(updatelibrary(video))" # run once a day

You will of course have to enable HTTP controlling in XBMC for this to work. Also make sure your user, password and port is correct from the line above.

End of edit

To make lirc work with XBMC we will have to setup a config in XBMC. It should be located in /home/user/.xbmc/userdata/Lircmap.xml. Here is mine:

<lircmap>
 <remote device="/etc/lirc/transcend.conf">
 <play>KEY_PLAYPAUSE</play>
 <pause>KEY_PLAYPAUSE</pause>
 <stop>KEY_STOP</stop>
 <forward>KEY_NEXT</forward>
 <reverse>KEY_PREV</reverse>
 <left>KEY_LEFT</left>
 <right>KEY_RIGHT</right>
 <up>KEY_UP</up>
 <down>KEY_DOWN</down>
 <select>KEY_OK</select>
 <pageplus>KEY_PAGEUP</pageplus>
 <pageminus>KEY_PAGEDOWN</pageminus>
 <back>KEY_EXIT</back>
 <menu>KEY_MODE</menu>
 <title>Guide</title>
 <info>KEY_CYCLEWINDOWS</info>
 <skipplus>Skip</skipplus>
 <skipminus>Replay</skipminus>
 <display>Aspect</display>
 <start>KEY_HOME</start>
 <record>Record</record>
 <volumeplus>KEY_VOLUMEUP</volumeplus>
 <volumeminus>KEY_VOLUMEDOWN</volumeminus>
 <mute>KEY_MUTE</mute>
 <power>KEY_POWER</power>
 <myvideo>KEY_VIDEO</myvideo>
 <mymusic>KEY_MUSIC</mymusic>
 <mypictures>KEY_PROG1</mypictures>
 <mytv>KEY_CALENDAR</mytv>
 <one>One</one>
 <two>Two</two>
 <three>Three</three>
 <four>Four</four>
 <five>Five</five>
 <six>Six</six>
 <seven>Seven</seven>
 <eight>Eight</eight>
 <nine>Nine</nine>
 <zero>Zero</zero>
 <star>Star</star>
 <hash>Hash</hash>
 <clear>Clear</clear>
 <enter>Enter</enter>
 <red>Red</red>
 <green>Green</green>
 <yellow>Yellow</yellow>
 <blue>Blue</blue>
 <teletext>Teletext</teletext>
 </remote>
</lircmap>

Give me a comment if anything is unclear.

Turnigy Super Brain 100A ESC stick/TX programming

Sunday, May 23rd, 2010

The manual for this ESC is pretty bad, but do we really care when the product is cheap and has nice features?

This ESC has simliar features as the aquastar ESC Turnigy produces. I used aquastar`s manual and managed to produce a programming sequence chart for super brain ESC.

Bristlebot – clean your home

Friday, February 26th, 2010

Check out this simple little robot which does nothing else than sweeping the ground beneath: http://www.evilmadscientist.com/article.php/bristlebot

Why not make a larger version and make it clean your crypt?

Re winding a brushless mini motor

Friday, November 27th, 2009

After running this motor to hard outside, I managed to burn the motor. You can see pictures of the “burnt” motor in the gallery below.

First of all I opened the motor to take a look noticing protective isolation layer on the copper were melted. Not so strange, because when I approaced the motor after the plane fell from the sky, it was insane hot.

Before removing all wire I measured the wire diameter to 0,30mm. I found this king of wire inside very small tranformators in a computer power supply.

By using this picutre, found on this page. I was able to re wound the motor.

I actually did wound all the poles at the same time, well, one by one, but all three wires were in use, if you follow.

After finish wounding I had to connect wires together to make only three wires, brushless motor has three out wires.

Since it`s a pretty fast motor I made a delta hookup, but I did a mistake at first. This motor should have around 195mOhm per 14-turn, maybe I did not mention it is a 14-turn motor. Which means each pole (there are nine here) needs 14 turns of isolated copper wire and in a small motor like this one, it`s not that easy. Anyway, by hooking up wrong end`s I broke a ESC of mine ($10) so I had to buy another one.

The motor works just great now and I might add a video later.

Gallery

Fixing brushless motor

Installing Frets On Fire on Ubuntu by making .deb package

Sunday, November 8th, 2009

sudo apt-get install dh-make
mkdir fretsonfire-1.3.110
cd fretsonfire-1.3.110
dh_make -s -n
cd debian
rm *.ex *.EX
mkdir fretsonfire
mkdir fretsonfire/usr
mkdir fretsonfire/usr/share

Now download the game
wget http://downloads.sourceforge.net/fretsonfire/FretsOnFire-1.3.110.tar.gz?use_mirror=osdn
tar zxf FretsOnFire-1.3.110.tar.gz
mv Frets\ on\ Fire-1.3.110/ fretsonfire/usr/share/fretsonfire
rm -rf Frets\ on\ Fire-1.3.110/ FretsOnFire-1.3.110.tar.gz

mkdir fretsonfire/DEBIAN
pico control

Make sure it look something like this
Source: fretsonfire
Priority: optional
Section: universe/games
Maintainer: yourname
Homepage: http://fretsonfire.sourceforge.net/
Package: fretsonfire
Architecture: all
Version: 1.3.110
Depends: python-pygame, python-opengl, python-numpy
Description: Open source guitar game

cp control fretsonfire/DEBIAN/
mkdir fretsonfire/usr/bin
echo -e "#\!/bin/dash\ncd /usr/share/fretsonfire/src/\npython FretsOnFire.py" > fretsonfire/usr/bin/fretsonfire
chmod +x fretsonfire/usr/bin/fretsonfire
mkdir fretsonfire/usr/share/pixmaps

# if the following image does not exist, find another one through google
wget http://www.freedownloadsplace.com/photo/Frets-on-Fire-1.png -O fretsonfire/usr/share/pixmaps/fretsonfire.png
mkdir fretsonfire/usr/share/applications
pico fretsonfire/usr/share/applications/fretsonfire.desktop

Overwrite with this text
[Desktop Entry]
Version=1.3.110
Type=Application
Name=Frets On Fire
Comment=A opensourced guitar game
Icon=fretsonfire
Exec=fretsonfire
Terminal=false
Categories=Game;ArcadeGame;

cd ..
dh_builddeb
cd ..
dpkg -i fretsonfire_1.3.110_all.deb

Ubuntu network install (PXE)

Sunday, October 25th, 2009

sudo apt-get install tftpd-hpa tftp-hpa xinetd dhcp3-server
sudo pico /etc/xinetd.d/tftp

Then write following

service tftp
{
protocol = udp
port = 69
socket_type = dgram
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = /var/lib/tftpboot
disable = no
}

Edit TFTP config
sudo pico /etc/default/tftpd-hpa

Make it look something like

#Defaults for tftpd-hpa
RUN_DAEMON="yes"
OPTIONS="-l -s /var/lib/tftpboot"

Create TFTP directory and get latest netboot image

sudo mkdir /var/lib/tftpboot
cd /var/lib/tftpboot
sudo wget -np -r http://archive.ubuntu.com/ubuntu/dists/karmic/main/installer-i386/current/images/netboot/
sudo mv archive.ubuntu.com/ubuntu/dists/karmic/main/installer-i386/current/images/netboot/* .
sudo rm -rf archive.ubuntu.com

Now restart TFTPD
sudo /etc/init.d/tftpd-hpa restart

To check if running@
netstat -uap

For DHCP, make sure you have a fixed ip for your device
pico /etc/dhcp3/dhcpd.conf

I did use firestarter as a DHCP generator since I used my desktop as PXE-server.


# DHCP configuration generated by Firestarter
ddns-update-style interim;
ignore client-updates;
authoritative;

subnet 192.168.66.0 netmask 255.255.255.0 {
option routers 192.168.66.9;
option subnet-mask 255.255.255.0;
option domain-name-servers 130.67.60.68, 193.213.112.4;
option ip-forwarding off;
range dynamic-bootp 192.168.66.10 192.168.66.20;
default-lease-time 21600;
max-lease-time 43200;
next-server 192.168.66.9; # important for PXE
filename "pxelinux.0"; # important for PXE
}

After the DHCP change we must restart DHCP
sudo /etc/init.d/dhcp3 restart

You should now be able to boot PXE of this machine.

Ubuntu 9.04 on MacBookPro5,3

Thursday, August 20th, 2009

How I installed Ubuntu Jaunty Jackalope 9.04 on my MacBook Pro 5,3.

After you have installed Ubuntu on your MBP and connected to internet. We need to add some lines in sources.list to be able to get special packages developed for apple products.

WARNING: be carefull with all the ” when pasting, they tend to change into a similar sign!

Update
echo deb http://ppa.launchpad.net/mactel-support/ubuntu jaunty main | sudo tee -a /etc/apt/sources.list
echo deb-src http://ppa.launchpad.net/mactel-support/ubuntu jaunty main | sudo tee -a /etc/apt/sources.list
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 7A6BC20C4FE04DADD10837608DB7F87A2B97B7B8 (DONT WORK)

sudo apt-get update
sudo apt-get upgrade

REBOOT (recommended)

Get hardware packages
sudo apt-get install mbp-nvidia-bl-dkms applesmc-dkms hal-applesmc bcm5974-dkms lm-sensors

Reboot if you want it to work right away or just continue below.

Keyboard
Apple keyboard backlight and Fn-keys should now work.
If you want to change the fn-usage buttons.

echo options hid_apple fnmode=2 | sudo tee -a /etc/modprobe.d/hid_apple.conf
sudo update-initramfs -u

I like to use gnome-do and usually use the Menu key for this. You will be prompted for next login, make sure you load the file.
Add this to ~/.xmodmaprc
keycode 252 = Super_R
echo keysym Super_R = Menu
keycode 49 = apostrophe

If you`re having problems getting the $ or brackets (and more) we need to do edit your keyboard layout. Go to Gnome menu -> preferences -> keyboard -> layout and change keyboard model to apple and make sure you have the right layout selected.

Sensors
For using sensors and fans we need to load apple modules:

echo coretemp | sudo tee -a /etc/modules
echo applesmc | sudo tee -a /etc/modules

Reboot (optional).

Caps lock
By default the green caps-lock does not work. It´s a easy fix.

sudo apt-get remove mouseemu

Monitor
If you don`t like the way your MBP auto dim your screen, you can disable it.

gconftool -s /apps/gnome-power-manager/ambient/enable -t bool false

Touchpad
To get multitouch we need to do a little trick.

echo bcm5974 | sudo tee -a /etc/modules
echo usbhid | sudo tee -a /etc/modules
echo blacklist usbhid | sudo tee -a /etc/modprobe.d/blacklist.conf

Open /etc/hal/fdi/policy/x11-synaptics-bcm5974.fdi and paste.
sudo gedit /etc/hal/fdi/policy/x11-synaptics-bcm5974.fdi

<?xml version="1.0" encoding="ISO-8859-1"?>
<deviceinfo version="0.2">
 <device>
  <match key="info.capabilities" contains="input.touchpad">
   <match key="info.product" contains="bcm5974">
   <merge key="appledevice" type="bool">true</merge>
   </match>

   <match key="appledevice" bool="true">
        <merge key="input.x11_driver" type="string">synaptics</merge>
        <merge key="input.x11_options.SHMConfig" type="string">1</merge>

        <merge key="input.x11_options.FingerLow" type="string">40</merge>
        <merge key="input.x11_options.FingerHigh" type="string">70</merge>
        <merge key="input.x11_options.ClickFinger1" type="string">1</merge>
        <merge key="input.x11_options.ClickFinger2" type="string">3</merge>
        <merge key="input.x11_options.ClickFinger3" type="string">2</merge>
        <merge key="input.x11_options.TapButton1" type="string">1</merge>
        <merge key="input.x11_options.TapButton2" type="string">3</merge>
        <merge key="input.x11_options.TapButton3" type="string">2</merge>

        <merge key="input.x11_options.VertEdgeScroll" type="string">false</merge>
        <merge key="input.x11_options.HorizEdgeScroll" type="string">false</merge>
        <merge key="input.x11_options.VertTwoFingerScroll" type="string">1</merge>
        <merge key="input.x11_options.HorizTwoFingerScroll" type="string">1</merge>

        <merge key="input.x11_options.MinSpeed" type="string">0.5</merge>
        <merge key="input.x11_options.MaxSpeed" type="string">2.5</merge>
        <merge key="input.x11_options.AccelFactor" type="string">0.15</merge>

        <merge key="input.x11_options.PalmDetect" type="string">0</merge>
        <merge key="input.x11_options.PalmMinWidth" type="string">25</merge>
        <merge key="input.x11_options.PalmMinZ" type="string">250</merge>
   </match>
  </match>
 </device>
</deviceinfo>

Reboot (optional).

Sound
Follow this recipe and your sound should work.


sudo apt-get install linux-headers-generic linux-image-generic linux-restricted-modules-generic
wget ftp://ftp.kernel.org/pub/linux/kernel/people/tiwai/snapshot/alsa-driver-unstable-snapshot.tar.gz
tar xf alsa-driver-unstable-snapshot.tar.gz
cd alsa-driver-unstable
sudo ./configure --enable-dynamic-minors --with-cards="hda-intel" --with-oss
sudo make
sudo make install
cd ..
sudo rm -rf alsa-driver-unstable alsa-driver-unstable-snapshot.tar.gz

REBOOT (recommended)

Now, don´t forget to unmute sound channels.

If you´d want a automatic fan program, I wrote one in bash. It requires lm-sensors (installed above) to work. I will write it in C some day.
#!/bin/bash

# we don`t want to go all the way up to critiacal temp, safe_temp is substracted from critical temp
SAFE_TEMP=10

# AUTOMATIC VALUES BELOW, DON`T EDIT

# CPU critical temp
CPU_CRIT=`cat /sys/devices/platform/coretemp.0/temp1_crit`

# FAN SPEED
FAN1_SPEED_MIN=`cat /sys/devices/platform/applesmc.768/fan1_min`
FAN1_SPEED_MAX=`cat /sys/devices/platform/applesmc.768/fan1_max`
FAN2_SPEED_MIN=`cat /sys/devices/platform/applesmc.768/fan2_min`
FAN2_SPEED_MAX=`cat /sys/devices/platform/applesmc.768/fan2_max`
CPU_CRIT=`expr "(" "$CPU_CRIT" "/" 1000 ")" "-" "$SAFE_TEMP"`

echo 1 > /sys/devices/platform/applesmc.768/fan1_manual
echo 1 > /sys/devices/platform/applesmc.768/fan2_manual

# dynamic values
while [ 1 ]; do

# CPU TEMPS
CPU_TEMP0=`cat /sys/devices/platform/coretemp.0/temp1_input`
CPU_TEMP1=`cat /sys/devices/platform/coretemp.1/temp1_input`
CPU_TEMP=`expr "(" $CPU_TEMP0 + $CPU_TEMP1 ")" "/" 2000`

# calculate
FAN_SPEED=`expr "(" $CPU_TEMP "-" 34 ")" "*" 200`

# if CPU reaches critical - SAFE_TEMP, shut off
if [ "$CPU_TEMP" -gt "$CPU_CRIT" ]; then
shutdown -h now
fi

# don`t go below min limit
if [ "$FAN_SPEED" -le "$FAN1_SPEED_MIN" ]; then
FAN_SPEED=$FAN1_SPEED_MIN;
fi

# don`t go above max limit
if [ "$FAN_SPEED" -gt "$FAN1_SPEED_MAX" ]; then
FAN_SPEED=$FAN1_SPEED_MAX;
fi

# only write if speed has changed
if [ "$FAN_SPEED" != "$FAN_SPEED_OLD" ]; then
#echo $CPU_TEMP $FAN_SPEED
echo $FAN_SPEED > /sys/devices/platform/applesmc.768/fan1_output
echo $FAN_SPEED > /sys/devices/platform/applesmc.768/fan2_output
fi

# store old speed
FAN_SPEED_OLD=$FAN_SPEED;

sleep 5
done

Pommed
If you would like to install pommed on this machine at this time we have to modify pommed. I have notified creator of pommed about macbook5,3 support. If you have version above 1.27 you can skip this how to.

wget https://alioth.debian.org/frs/download.php/3084/pommed-1.27.tar.gz
tar zxf pommed-1.27.tar.gz
cd pommed-1.27/pommed/
pico pommed-mpb5,3.patch

Then paste following.
--- pommed.c-old 2009-08-22 20:23:21.796989322 +0200
+++ pommed.c 2009-08-22 20:22:42.270020918 +0200
@@ -677,6 +677,7 @@
* MacBook Pro 13" (June 2009) */
else if ((strcmp(buf, "MacBookPro5,1") == 0)
|| (strcmp(buf, "MacBookPro5,2") == 0)
+ || (strcmp(buf, "MacBookPro5,3") == 0)
|| (strcmp(buf, "MacBookPro5,5") == 0))
ret = MACHINE_MACBOOKPRO_5;
/* Core Duo MacBook (May 2006) */

Now apply the patch
patch -p0 < pommed-mpb5,3.patch

Install required packages
sudo apt-get install pommed libdbus-1-dev libalsa-ocaml-dev libaudiofile-dev libconfuse-dev libpci-dev

Compile
cd ..
make pommed
sudo cp pommed/pommed /usr/sbin/pommed

Reboot.

Read additional info here.

Download youtube/flash in Ubuntu (Linux)

Friday, June 5th, 2009

Ever seen a cool movie on the Internet? embedded in flash, unable to download it? who haven’t..

Solution is quite simple and here is it quick for you: Open a page with flash. Wait till it’s completely downloaded, then fetch if from /tmp/.

A longer explanation would be to a youtube page and load the entire movie like so:

When you see the movie has loaded fully, without interruptions from the user (you). You can find it in /tmp/:

Now you just copy it to where ever you’ll like. If you want to convert it, you can open it with avidemux or Kino and then export it to .mpeg or whatever format you’d want.

Using ffmpeg:
ffmpeg -i "/tmp/Flash8CRIFL" "mechanical hand.mpeg"

Team Losi mini rock crawler modifications

Wednesday, May 20th, 2009

Reading this, I assume you know how stock Team Losi mini rock crawler looks, since I don’t have any images of a stock one. Google does!

First of all, top plate was removed, gear box turned around and electronics placed where I wanted them.

A 5x3mm carbon tube was added as stiffer for the chassi when top plate was removed. Shocks was mounted on the outside making them not straight.

Electronics in and I made a battery tray.

I tend to use this car anywhere in any weather. The electronics in my car has been opened and tried several times, so I decided to the essential parts in balloon. Servo is shipped waterproof.

Velcro on roof, weird, eh? well, I had a 1/10 body laying around and it turned to look great on this car. It was hard to mount and I wanted to be able to remove the 1/10 body from the car when I needed ultimate crawler abilities.

A box was necessary to get enough height over wheels.

I still have the bead lock mod. to do on this car. It will be done as soon as I find a suitable pipe to use.

As always, more and larger pictures in my gallery.

Team Losi Mini Rock Crawler

Ford Mustang GT-R – Knight rider edition

Saturday, March 21st, 2009

Ok, I’ve been wanting a new body for my touring car for a while. I’ve been running Tamiya’s Raybrig body since I first bought the TA05IFS, but didn’t use enough time to make it cool and neither did I have RC-lights.

I wanted Ford GT500 body, but it didn’t/don’t exists and I didn’t want to create one from the scratch either. My best choice then was HPI’s GT-R.

I always cut the body first, drill holes and grind uneven areas with sandpaper. Front was cuttet to be able to have a grind in front, made holes for lower light’s and added stickers both front and back for disguising lights.

Step one in painting was black.

Doing a new disguising for middle part, to make inside a bit cleaner. Due to holes in the front, I was unlucky with disguising the front and had some leaks. Damn leaks.

From distance the car turned out great! If we look closer we can see all the leaks I had because of bad, bad tape. Next step was to darken the windows, but I was stupid enough to remove the lexan cover before doing so and I had to create me a new one.

To disguise back lights I used stickers shipped with the car. I cut them the way I wanted and it did fit like I wanted. I now had to use it’s shape to create a light bucket. For making light buckets I find it best to make it in paper first, it’s cheap, easy to use and environment friendly. You can see on left image below how I got the first shape to start with then I just added 0,5cm etc. for what I thought would be enough.

Being a perfectionist and all, I had to do this a couple of times before I was satisfied.

When it finally fit, I unfolded the paper again and taped it to 0.10mm thick metal I used and cut it out.

Front light’s are basically the same, but I had to cut my shape in half since i were going to put a cone in there.

Putting the pieces together was a hell because it the pieces didn’t have any areas to connect togheter, the only thing was the cone and it was going in after they were connected.

Mounting the lights with double sided tape.

GT500 knight rider has read light in the front. This car don’t have the same opening at front, so I had to improvise and make a crack another place. I also tried with underglow, but it didn’t look good enough.

I used a simple 6,0V light system to start with on this car, but I had to modify it allot since I were going to use 13 LEDs and not 6. I wanted to power this system directly from driving battery which is a 3S lipo battery, this means 9-12.6v. To be able to use such high voltage on light system, I had to put int resistors. To calculate resistors for each parallel connected resistor I used the formula Vr = (V-Vwanted)/I.

If you want to view all the images for this project feel free to browse my gallery below.

Ford GT-R – Knight rider edition