Power to the People of Iran

..and welcome to eeeGadgets! This blog is dedicated to everything associated with the wide (and interesting) field of mobile computing. The main focus is on presenting all the various hardware modifications I made to my eeePC, but I will also give short reviews of other interesting Mobile Internet Devices I come across. Further I want to share some tips and tricks I found out to be helpful in getting the most performance out of Ubuntu linux...
On the right side under "LABELS" you can navigate between various assorted article categories. Also, on the very bottom of the site you will find some useful weblinks, as well as a small broadband connection speed test (which can be very useful sometimes).
If you want to, you can subscribe to my RSS news feed too, to be always up to date about my latest articles - simply click on "subscribe now!" in the little box on the right side. Alternatively, you can subscribe to my simple email newsletter by clicking here.
For questions, feedback, suggestions, criticism and everything else, don't hesitate to contact me:

....have fun reading!

If you like my site and want to support me , you can always donate to my personal "coffee funds" using the PayPal "donate" button further down on the right! :)

Wednesday, May 27, 2009

HowTo: make a small LED email notifier

I guess after my last articles bearing somewhat randomized topics it is time for a real "eeeGadget" again.. So, what about having multi-color LED signaling incoming email (and ICQ instant messages) for you, visually with various blinking colors for assorted message types, even when your netbook's lid is closed, for example? This is easily done using just a small circuit centred around a cheap 8-pin "picaxe08M" microcontroller, a USB/serial adapter cable and some python scripting (well - it surely can be done in a million different ways, but thats how I approached things!)...

The whole idea is based on Toms original design of a LED mail notifier, but I refined things a bit (specifically the py script part) to better suit my needs (also big thanks go out to Pete from nermal.org for his assistance/ideas regarding python coding!).. The device listens to instructions sent over the (emulated) serial port of my usb/serial converter by two python scripts. Those scripts regularly check my gmail account for new incoming mail (done by the first script which is called every ten minutes as a CRON scheduler job) and - this is where the other script comes into play - continuously listen to dbus system alerts concerning new instant message arrival, which are issued by Pidgin (my favorite instant messenger) as soon as a new instant message is being received (thanks to a Pidgin dbus notifying plugin). This can also be done with Thunderbird (email client), provided the necessary thunderbird dbus plugin is installed.
But first lets have a look at the hardware:

wiring schematic of the PICaxe circuit

The hardware part is simple (see schematic above). It consists of only six resistors, one common cathode RGB LED, a picaxe08m microcontroller (and some 9-pin female serial port connector) . The picaxe listens on Input 3 to bytes sent by the python script(s), and encodes Outputs 0, 1 and 2 according to the last three bit of each byte received. If it receives the ascii sign "1" the LED comes up red, "2" causes a green color and so on (there are seven possible colors). If it receives "8" the picaxe switches off the LED. It can be easily built on some piece of veroboard - but for the sake of being able to build this into my eeePc's interior (it has to be really small and tiny) I decided to design a small PCB using only surface-mount components (besides of three wire bridges).
this is scaled up to 200 percent already!

The python script that gathers email information is using the python "feedparser" library to fetch an RSS/atom feed of my gmail account's inbox two times in succession, each five minutes. If the number of mails in my "inbox" mail folder has increased (meaning new mail has arrived) the LED slowly flashes in red for, lets say, seven times when I have seven new emails. As soon ( a few minutes later actually) as I have read all my emails, the atom feed is updated with the new overall mail number "zero", and the LED doesn't light up anymore. The script is launched regularly every ten minutes by cron scheduler, so overall it observes my email inbox folder nonstop every five minutes. I reckon this is a bit often, but as long as it doesn't hurt...
The other script listens nonstop on the dbus for incoming alerts from Pidgin Instant Messenger, and decides whether the incoming message is from

a) a known person ("buddy")
b) a certain domain (for example all messages from employees of one company)
c) unknown person

Then the corresponding byte sequence is sent to the picaxe (who is using the last three bits of each byte to decide which pin to put high or low). For each of the three types of message the python script sends out the right bytes with the proper delay, so the LED is flashed accordingly: in case A it flashes fast and green for a few seconds, for B it flashes fast, red and not long (only a short burst) and for C it blinks three times very slowly in blue.
Both scripts also give some info output on the console, but can perfectly run in the background too since they don't need user interaction.. Only problem for windows users, the pidgin/dbus thingie doesn't work outside linux since there exists no dbus extensions for win32 (not yet, but a windows port of dBus is in development!). The email notifier does work with WinXP though.

fuzzy picture of the secret prototype :)

You can download the needed python scripts and PICaxe basic code here
Heres a small script to test your circuit (cycles through all colors one time)
Also here's the PCB layout

The scripts are written for python 2.6/linux and need to be customized a bit,
for example you need to change the buddy ICQ number entries to match your
buddy list, and adjust the /dev/ttyUSBxxx to your serial port's name...
Also you may need to install python-serial and python-time from the
ubuntu repositories, then it should work.

This all is "deprecated" as they say in linuxland. In other words it should be considered "public alpha" release and has been superseded by my all-new and shiny dBird notifier script collection as detailed in the article ABOVE. (just wanted to mention it here too)

Friday, May 22, 2009

what have fireflies got to do with BASIC?

During the last days I've been quite excited about a certain idea I want to report about here, and which I think is quite an entertaining project. During one of my web journeys I recently happened to stumble upon this link over at instructables.com and was fascinated: I was looking at a 5x5 LED matrix that initially blinked its LEDs randomly, but somehow "magically" (with the support of 25 light-dependent resistors) synchronized them very slowly, to finally reach a state of absolute synchronicity - and all this with 25 totally independent control circuits, all based on 25 single atTiny13 microprocessors!! The whole thing should be considered as being a model of large swarms of thousands of male fireflies in sout-eastern asia, which are capable of synchronizing their blinking to attract more female fireflies over a greater distance. For more detailed explanations about the background (and how to set up a physical logic model using AtTiny13 chips and C coding) I want to forward you to the instructables link above as well as to this scientific paper explaining the underlying mathematical theory behind this..

And, of course, to a video of "the real McCoy" - real fireflies sitting in a tree, blinking like there would be no tomorrow:

To put it shortly: I decided I wanted something like this hanging on my wall too!

..but since neither the AtTiny nor its "C" language appeal to me, and since further I'm NOT in posession of any ATMEL programmer to accomplish this new goal of mine, I decided that I needed to use something simpler. I instantly thought of the "picaxe" microcontrollers (which are intended for schools originally, sold by a company called "rev-ed.co.uk", these things are basically a customized "microchip" PIC microcontroller with a bootloader enabling easy direct programming via serial cable, and programmable in a very easy-to-learn BASIC dialect), which would surely allow me to arrive at a nice blinking and syncing LED array in not too much time.

Now while I have not started to assemble any circuit yet, I already have written a small piece of BASIC code which, I think, is quite easy to understand and fun to read - and so I will present it here for the amusement of my dear readers.

here it is:

; *** FIREFLY.BAS ************ Version 1.1 beta ******* SELF-SYNCHRONIZING NETWORK OF LED FIREFLIES ***
; this program is intended for simulation of a swarm of fireflies by many individually controlled LEDs, designed
; to run on a PICaxe08M with a LDR connected to pin 1 and one LED wired to pin 2 (each firefly needs one PICaxe)
; Since they are totally independent besides of sharing the same reset switch, one can easily combine any number of
; fireflies to form a large array of blinking, self-organizing LEDs... pressing the "reset" switch will of course disturb
; the fireflies and their uniform blinking pattern, like walking right into a swarm would disturb real blinking fireflies too,
; probably, and it takes awhile before they start blinking and syncing again...
; --------------------------------------------------------------------------------------------------------------------------------------------------
; Copyright (c) 22/05/2009
; Dennis Schulze

; variables
symbol Power = w4 ;determines how urgently the firefly wants to pulse or how hard it "desires" to do so
symbol Brightness=w3 ;this later contains the reading of the LDR value
symbol Ambient =w2 ;initial ambient light intensity value is stored here for comparison reasons
symbol Counter = b2 ;Counter needed for initialisation blinking loop
symbol RndDelay = b1 ;this will be seeded with a random number for individual delay time

; constants
symbol Daylight=195 ; above this light intensity threshold the firefly does not glow at all (i.e. if its not "night")
symbol MaxPower = 80 ; Urgency threshold that triggers an immediate pulse

let Counter = 1 ;reset all counters
let Power = 1 ;

gosub pulse ; firefly wakes up

;randomize a bit to give individuality - "the learning phase" during sunset!

for Counter = 1 to 10 ; read out ten times...

read 0, w0 ; ...a random value from EEPROM..
readadc10 1, Brightness ; ......and the current LDR value....
w0 = w0 + Brightness ; combine the values giving a seed....
random w0 ;....which is used for seeding RANDOM with some highly individual value
write 0, w0 ; seed stored for next readout cycle, "randomness accumulates"
pause 100

next Counter

let RndDelay = b1 * 24 ; now use last 8bit of the random word w0, multiply with 24 to give max 6 sec delay

let Counter = 1 ; reset counter

; initialisation blinking loop

for Counter = 1 to 5 ; blink five times

gosub pulse

pause 700

next Counter

pause 500 ; wait a little bit

readadc10 1, Ambient ; then read out ambient light intensity and store value in "Ambient"

pause RndDelay ; pause for an "individual" (hopefully) amount of time before doing anything else

main: do ; main loop

let Power = Power + 1 ; slowly start incrementing the fireflie's desire to blink..
readadc10 1, Brightness ;...while watching the surrounding fireflies too!

if Brightness >= Daylight then ; unless its daytime (fireflies are sleeping during daytime!)...
sleep 3
goto main

if Brightness > Ambient then ;......perceiving pulses from other fireflies will
Power = Power + 30 ;..strongly increase our fireflys desire to pulse with them!

if Power > MaxPower then ; if the desire is strong enough...
gosub pulse ; ...the firefly bursts out a light pulse
let Power = 1 ; what a relief for the firefly! "desire" is reset to initial value
endif ; (equals satisfaction about just having pulsed)

loop ; starts building desire for another pulse again (while slowly approximating the other's frequencies)



high 2 ; give a short flash of light
pause 300
low 2

Thats all for now, only code and no soldering yet. Thus the code is not functional since not tested, and it still has some flaws (like for example the needed initial randomness in blinking rate is not implemented yet), but rest assured that I will update on this blog as soon as physical results can be presented. I just need to order the needed chips and stuff. In the meantime you can read more about the project over at the picaxe forums where I started a topic about this self-organizing stuff too, and got many great replies concerning ideas for good "true" random number generation and other stuff.

Friday, May 8, 2009

"Viliv S5 Premium Air MID": premium UMPC with GPS?

Now Viliv is jumping on the UMPC train too: since several weeks the long-announced "VILIV S5 MID" is available in several configurations. The "Premium Air" version sports a 16GB SSD, 4.8" touchscreen LCD with a resolution of 1024x600 pixels, and full 3G/HSDPA functionality - whereas the "normal" versions come equipped with 30 or 60 GByte 1.8" HDD instead, 800x480 LCD only, and no wireless broadband at all.
Both models have the same 24Wh battery, allowing for 5-6 hours of continuous use, and are available with either WinXP, Vista or Linux (unspecified distro) preinstalled, both weigh around 380 grams and have 802.11 b/g wifi, bluetooth 2.0 and external video connectors (for VGA, S-Video and Composite-video cables!), the whole controlled by a "Silverthorne" Intel Atom clocked at 1.33GHz and supported by 1GB RAM. Graphics are rendered by the GMA500 chipset. Also common to both models is a built-in GPS for easy on-the-road navigation. Prices starting at 599$ for the basic version. Design looks mature. I think I'd want such a thing if it wasn't for the small display..

Sunday, May 3, 2009

howTo: Jaunty Jackalope with custom netbook kernel

Now it has been over a week since I installed Ubuntu 9.04 "Jaunty Jackalope" on my netbook, and in the meantime I've been working on customizing things to my needs. One main tweak consisted of replacing the default "2.6.28-8-generic" kernel with the more appropriate "2.6.28-12-netbook-eeepc" kernel compiled by Adam McDaniel over at array.org, main reason was merely the unpleasant sound of the word "generic" to me, since this "generic" kernel was working quite well - there was no obvious need to replace it.
But I still thought it would be nice to have the core of the operating system customized to my hardware. However the netbook-eeepc kernel is not officially available on the array.org website (yet), although there already exists a repository and .deb packages - I guess Adam hasn't found the time to update his website yet..
To install the latest "adams kernel" (from array.org) on your eee PC netbook you therefore need to enter the following in a terminal window:

sudo -s
echo "deb http://www.array.org/ubuntu jaunty main" > /etc/apt/sources.list.d/array-jaunty.list
wget http://www.array.org/ubuntu/array-apt-key.asc
apt-key add array-apt-key.asc
apt-get update
apt-get install linux-netbook-eeepc

Thats all about it. Now you can also add some scripts to gain full hotkey functionality if you wish (I did), for example the elmurato ACPI scripts I use. Simply go to your home directory and type in

wget http://www.informatik.uni-bremen.de/~elmurato/EeePC/Jaunty_Eeeasy-Scripts.tar.gz
tar xzvf ./Jaunty_Eeeasy-Scripts.tar.gz
cd Jaunty_Eeeasy-Scripts
sudo ./eeeasy-scripts.sh install

if you get an error message you may need to install the "asus-eee-dmks_3.0_all.deb" package located in the Jaunty_Eeeasy-Scripts folder (elmurato ACPI scripts depend on it) and then try to run the install script again. If everything has worked you now can use all eeePC hotkeys with Jaunty.

Wifi toggle works too if you add the following kernel parameters to your /boot/grub/menu.lst right behind the line "# defoptions=quiet splash" - it has to look like this:

# defoptions=quiet splash pciehp.pciehp_force=1 pciehp.pciehp_poll_mode=1

when you now run

sudo update-grub

the PCIeHotplug options will be added to your new kernel entry and after a restart, wifi can be switched on/off with alt+f2 to save on battery runtime.

Did I already mention I like Jaunty? 49 seconds from pressing enter in the GRUB menu to having the gnome desktop loaded and ready to go!
And pidgin integrates into the desktop panel very smoothly - nice.
Oh did I mention that my HSDPA modem worked right from the start?
Was able to dial in right after first boot. Huge improvements in that area. I'm lucky with my new jackalope.
picture of a real Jackalope! ->

Broadband Connection Test:

Just click on "Speedtest starten" to evaluate your actual downlink in MBit/sec (takes 10 seconds approx.)

(c) dsl-speed-messung.de - DSL Speed Test