Archive for the ‘Projects’ Category

Debian on a Lenovo x121e

Sunday, May 4th, 2014

I was looking for an ultramobile notebook with the following requirements:

  • Smaller than the Lenovo Thinkpad x230
  • Trackpoint
  • Decent hardware (especially RAM)
  • Long battery

and finally found a good contester: Lenovo Thinkpad x121e.

Since barely any models with a compatible formfactor feature a trackpoint, the alternatives like the Edge E135 or E145 were also from lenovo.

The decision towards the x121e was made because of the supposedly more sturdy housing, the still decent hardware and the lower price.

I didnt find a well priced model with the Intel i3, so i got one with the AMD 450 and the RAM upgraded to 8GB. Instead of the 320GB harddrive, i invested in a Samsung 840 Evo SSD with 120GB.

Operating System Install
The OS should be a Debian, so i got the 7.4 amd64 netinstall CD and connected an external USB-CDROM drive to the x121e. As always with no-drive notebooks, installing the OS could be also done by putting the SSD into a different computer or booting via network.

Wired network is required anyway though, since the driver for the wireless adapter is not included. Also make sure the battery is fully charged or use the power adapter.

The install procedure itself is pretty straight forward, once booted from the CD, i basically just did:

  1. in the inital boot menu, select expert install
  2. Choose language and keyboard
  3. choose extra packages: network console to continue via ssh (optional)
  4. detect network (only finds wired connection), rtlwifi/rtl8192cfw.bin for wireless is missing (will install later)
  5. configure network: dhcp or static, according to network infrastructure
  6. continue installation remotely (define a password and note the ip adress, optional)
  7. partition disks: guided encrypted lvm (but deleted logical volumes to change sizes), 4.4GB (swap), 10GB (root), 105GB (home) to 8GB, 20GB, 91GB (/boot is not encrypted at around 250MB)
  8. linux-kernel-amd64 and targeted
  9. deselect desktop environment, choose ssh-server to continue install remotely (see screenshot)
  10. install bootloader (grub) and finish installation
Selection in Debian Installer

Selection in Debian Installer

Some information could be used from a similar device/OS description from debian wiki.

Directly after basic install:

root@x121e:~# df
Filesystem 1K-blocks Used Available Use% Mounted on
rootfs 19223252 1154332 17092436 7% /
udev 10240 0 10240 0% /dev
tmpfs 778596 368 778228 1% /run
/dev/mapper/x121e-root 19223252 1154332 17092436 7% /
tmpfs 5120 0 5120 0% /run/lock
tmpfs 1557180 0 1557180 0% /run/shm
/dev/sda1 233191 10600 210150 5% /boot
/dev/mapper/x121e-home 88123672 188124 83459032 1% /home

root@x121e:~# free -m
total used free shared buffers cached
Mem: 7603 250 7353 0 26 147
-/+ buffers/cache: 76 7527
Swap: 7719 0 7719

Additional packages
Packages needed to tweak the performance, silence the fan and get a GUI are the following (root required)

apt-get update

apt-get install i3 firmware-realtek thinkfan lm-sensors lightdm lxterminal

and packages i like to have as well

apt-get install screen sudo htop powertop vim xinput wicd chromium xfce4-power-manager alsa

Configure Thinkfan
Without thinkfan, the fan is quite noisy. There are a couple of resources for thinkfan thinkwiki.org or in german on thinkwiki.de. Also, more specifically for the x121e, i found descriptions at kernelconcepts.de and solutionlocker blog.

Watch out, if the x121e has an AMD CPU, there is no coretemp module, instead its called ‘k10temp’.

Configure Graphics Card
To get the most out of the graphics hardware, the proprietary “fglrx” drivers worked for me. The performance of “flg_glxgears” improved from around 40FPS to 330FPS. Instructions on how to install the drivers can be found in debian WIKI. It basically boils down to the following

sudo apt-get install fglrx-drivers

sudo aticonfig –initial

Attention, this way will download quite some packages in order to compile the drivers via DKMS.

Other Notes

  • with xinput installed, disable touchpad:

    xinput –list && xinput set-prop ID “Device Enabled” 0

  • suspend/hibernate just worked out of the box via xfce4-power-manager, otherwise extra packages might have to be installed

Using an Atmel ATmega168 for Arduino on a breadboard

Sunday, January 5th, 2014

For all the people which want to profit from the easy development with Arduino also on custom hardware, here is how to get your hardware running when not completely copying the original Arduino (UNO) schematic.

The Arduino UNO board uses an external 16 MHz oscillator to clock the ATmega328. For a project, I used an ATmega168 with internal RC oscillator, so none of the standard Arduino boards offered in the Arduino IDE suited my configuration.

To be able to talk to the custom board and load the Arduino bootloader, you have to add a custom board to the Arduino IDE:

The available boards in the Arduino IDE are stored in the ./hardware/arduino/boards.txt file of your Arduino directory.

To add an additional board, just add the following code at the bottom of the file:
##############################################################

avr168p.name=Breadboard int clock 8MHz w/ ATmega168

avr168p.upload.using=arduino:arduinoisp
avr168p.upload.maximum_size=16384

avr168p.bootloader.low_fuses=0xe2
avr168p.bootloader.high_fuses=0xdd
avr168p.bootloader.extended_fuses=0x07
avr168p.bootloader.path=arduino:atmega
avr168p.bootloader.file=ATmegaBOOT_168_pro_8MHz.hex
avr168p.bootloader.unlock_bits=0x3F
avr168p.bootloader.lock_bits=0x3F

avr168p.build.mcu=atmega168
avr168p.build.f_cpu=8000000L
avr168p.build.core=arduino:arduino
avr168p.build.variant=arduino:standard
##############################################################

The parameters are pretty self-explaining – this is also the point where you can set the fuses of your controller. To get the fuse values, I recommend to use a fuse value generator like http://www.engbedded.com/fusecalc/

Playing Fallout 3 on Linux with PlayOnLinux and Steam

Wednesday, September 25th, 2013

This week I bought a bottle of “Nuka Cola” (www.nukacola.eu) in a geek shop which has opened in Munich recently. This remembered me of the good time I had when playing Fallout 3 – so I decided to give it a try to get the game running on my current Mint 14 machine.

Remembering I had the game running once using Wine on Snow Leopard, I was confident get it working on Linux, too. I read about something called “PlayOnLinux” some time ago, I wanted to try this handy tool also. And, it really helped me and saved precious time which I would have normally wasted on configuring Wine.
To keep the long story short, here my approach:

– get PlayOnLinux (apt-get install playonlinux)
– install Steam inside of PlayOnLinux (the automatically chosen version of Wine 1.5.25 works fine for me)
– install d3dx9 and msasn1 packages for the Steam virtual drive
– start steam, log in with your account and install Fallout 3
– launch Fallout 3 and have fun!

The game runs fine with me GeForce 210 graphics card and the NVIDIA binary Xorg driver (304).

Simple FM Receiver with OsmoSDR in GNURadio

Monday, May 14th, 2012

Finally, my 20$ EZcap USB DVB-T stick has arrived, and I wanted to start with a simple FM receiver to see how to operate this thing with OsmoSDR in GNURadio!

I’ve already installed GNURadio, RTL-SDR and OsmoSDR using the GNURadio build script on my Ubuntu 11.10 machine. To start out with the USB-receiver, you can just run the example contained in the OsmoSDR sources (./gr-osmosdr/apps/osmosdr_source.grc) to see if the stick works. It should do its job out of the box, at least it did for me. When running this example, you should see a nice FFT of the received radio signal at the defined frequency with sample-rate dependent bandwidth.

Slightly altered osmosdr_source.grc example

If this example works, you can go on and work on bigger things instantly. As already mentioned, I wanted build a very basic FM receiver. GNURadio has everything you need for that on-board, and therefore the grc model for such a receiver looks like this:

Basic FM Receiver in GNURadio Companion

Some comments on the used blocks and their parameters:

  • OsmoSDR Source: gets the desired frequency from the osmo_freq slider, samplerate is chosen in the osmo_samp_rate variable
  • Rational Resampler: gets the decimation and interpolation values from osmo_samp_rate and samp_rate
  • Frequency Xlating FIR Filter: sample rate from samp_rate, filter_taps is defined as a firdes.low_pass(1,samp_rate,100e3,1e3) (feel free to play around with the latter two parameters of the filter!). The center frequency can be changed with xlate_tune
  • WBFM Receive: Quadrature rate is samp_rate
  • For the FFTs, I’ve chosen a configurable refresh rate, you can tweak it according to the performance of your computer (as well as the FFT size…). Also, their baseband frequency is set to osmo_freq, respectively osmo_frequ+xlate_tune to change the x-axis of the FFTs according to the currently slider settings.

After putting everything together, the following GUI should appear and you can tune and listen to your favorite FM station!

Running and receiving fm_rcv

 

Known issues:

When I’m running GNURadio simultaneousely with other sound sources (e.g. a video in a browser), the grc model throws the following error:

audio_alsa_sink[hw:0,0]: Das Gerät oder die Ressource ist belegt
Traceback (most recent call last):
  File "/home/chris/ufsdr/osmosdr/fm_rcv/fm_rcv.py", line 280, in <module>
    tb = FM_rcv()
  File "/home/chris/ufsdr/osmosdr/fm_rcv/fm_rcv.py", line 201, in __init__
    self.audio_sink_0 = audio.sink(48000, "", True)
  File "/usr/local/lib/python2.7/dist-packages/gnuradio/audio/audio_swig.py", line 345, in sink
    return _audio_swig.sink(*args, **kwargs)
RuntimeError: audio_alsa_sink

I solve this problem by a forced restart of the alsa-device by identifying the process(es) using PCM currently with

lsof | grep pcm

and killing the appearing tasks by their ids with

kill <id>

 

For further (basic) information see:
OsmoSDR Wiki: http://sdr.osmocom.org/trac/wiki/rtl-sdr
GNURadio Homepage: http://gnuradio.org