Raspberry PI first steps

As every and each true geek, i get myself a Raspberry PI. First error, i ordered only the Raspberry, should have bought also a case (i will buy one soon, but with added shipment costs…).

First choice to make, a cheap decent SD card. I bought a 4GB SD card, 6 class (meaning 6 MB/sec – higher the better). The OS image (Raspbian – yet another debian clone) has a considerable size, almost 2GB, so anything smaller than 4GB is probably not a very good idea…

DSC00437Powered it up, and first problem, even though i had an HDMI connection to my TV screen no output was detected – shit! Besides no output, everything seemed normal and in my router it was registered a new device, so ssh to the assigned IP and could log easy with the default pi/raspberry credentials…. (yes i did tried with another cable and still no output), strangely enough if connected to a monitor with the same HDMI cable works fine and also the TV reads perfectly from other HDMI inputs (Laptop, PS3)….

Still about this, i have found that you can do a lot of tweaking in Raspberry HDMI settings, i will thinker with the various options and then report back:

After boot you must (or at least should) re-size (or make another) partition to reclaim the entire card space. After that i wanted to connect an external HDD, as documented and expected, if connected directly to one of the Raspberry USB ports there is not enough power and the Raspberry crashes and reboots (so does the HDD).  So, i went out to get a self powered cheap USB hub…

DSC00435I connected the USB Hub, and plugged in the Raspberry to it, worked fine. And then the HDD, also powered up nice and no more crashes and reboots as expected. But the damn thing wasn’t recognized… why? Yet another rookie mistake… the micro USB input on the Raspberry is power input only, doesn’t support data, so i fixed it with another external power adapter providing power to the Pi. I think another cable running from the USB hub would also do the job.

Of course i did setup root ssh access (as all good security practices advise not to do, but what the heck i like to live on the edge). Boot, and minimum setup complete, time to move to the real fun stuff 🙂

Raspberry PI with Raspbian “Wheezy” connected to a LG 50PV350 trough HDMI. The TV set reports “no signal” and shows no image. To fix this, open the SD card boot partition edit config.txt and add


this will set the PI output to HDMI always even if no device is detected, group 1 means TV (2 is monitor) and mode is set to 1080p.

Control big mean devices with an Arduino

Since Codebits, i had the Arduino in the bag… also in the bag (due to time constraints) the desire to put it to work, to do something with it, anything. Today they both jumped out of the bag, so the goal is to make a remote mains switch with a big red button (the end of the world type), sure i can walk to the switch but this way is much more fun :)…

The first step is to control (switch on/off) a mains powered device with an Arduino, wich operates in low DC voltage. For that i needed a Solid State Relay (other routes possible here), and curious enough that was exactly what i had today in the mailbox from China. These are really cheap from Ebay, just take time to read specs and match up to your needs. Remember, Volts x Amps = Watts

a 100w lamp = 220v * x amps = 100W = 0.45 amps
a 3000w heater = 220v * x amps = 3000W = 13.6 amps

so for the heater the SSR should have at least an Output Current of 15 amps (or a bit higher to play safe),  also the 220v should be within the Output Voltage range. The Arduino output Voltage is 5v, so also check the SSR Input Voltage range for 5v support (if not in range, you will not be able to control the SSR with the Arduino alone).

I used an old appliance cable, just strip the wire and there should be 3 wires, the green/yellow cable is the ground, dont touch this one, you should cut one of the other wires (normally a blue or gray). Strip each cutted side and connect the AC side of the SSR to them. Now connect the Arduino to the DC side of the SSR, one digital pin to positive and ground to negative. You can store the tools now.

You can connect now the Arduino to the computer, install the drivers if needed and download the Arduino Environment, just follow the instructions from the Arduino Website and you should be up and running in minutes. The code is as simple as it gets, it reads from serial and if receives 1 the pin goes high (with voltage) and if 0 the pin goes low (with no voltage).

int pinNumber = 13;
int incomingByte;

void setup() {
    pinMode(pinNumber, OUTPUT);

void loop() {
    if (Serial.available() > 0) {
        incomingByte = Serial.read();

    if (incomingByte == 48) {
        digitalWrite(pinNumber, LOW);
    } else if (incomingByte == 49)  {
        digitalWrite(pinNumber, HIGH);

I choose pin 13 (Arduino to SSR positive) because there is a built in led that can help in debug. You can test now from the Arduino Environment, simply open the Serial Console (under Tools) and send 1 and 0 and it should light up and down. You can also connect using the Putty – a fine ssh client with serial interface or even the venerable Windows Hyperterminal. Just remember this is serial, so one client at a time :).

When you connect/disconnect from any client there was a rapid light flicker. First i thought that it was something related to the communication that was sending zeros and ones in the handshake or something. But i was wrong (normal), this is a feature of the Arduino to simplify and automate new programs upload. For every serial connection it resets itself, hence the flicker, and waits for a new program upload (sketch in Arduino lingo) for a couple of seconds then if there is not nothing being upload it proceeds to the normal program execution from the start (with state loss). You can disable the auto-reset feature to meet your needs if you want.

Of course you want to control it in some programaticaly way, so me first try was with PHP, there is some code floating around in the internets, something like:

$port = fopen('COM1', 'w'); // COM number where the Arduino is
fwrite($port, '1');

and to light off something like:

$port = fopen('COM1', 'w'); // COM number where the Arduino is
fwrite($port, '0');

BUT THIS CODE OBVIOUSLY WON’T WORK ON CURRENT STANDARDS ARDUINO, due to the auto-reset feature that i mention in the previous paragraph. It will open the COM (reset), then it will send too fast the bit to the port, when the device is still on the auto-upload sketch mode (witch is the reason of the auto reset in the first place), then it will close the connection (reset again). So you will only end up with some fast light flicker….

This code will work:

if ($port = fopen('COM1', 'w')) { // open arduino port
    sleep(2);                     // wait for end of auto-reset 

    $i = 1;
    while (true) {                // loop to keep port open
        if ($i % 2)               // if i is even lights on
            fwrite($port, '1');
            fwrite($port, '0');   // else lights off

        sleep(2);                 // waits 2 secs between each cycle
} else {
    print("Check port number or previous active session");

from here you could work it out, to make a daemon that connects to the Arduino via serial and listens to some socket and routes/proxies the input from socket to serial.  It’s doable, and not that hard but anyway PHP is not the correct tool for the job, at all… so used the Serproxy – a proxy program for redirecting network socket connections to/from serial links – very easy to use and makes just what i wanted.

From there you simply connect and send the on/off (1/0) command to the socket, and don’t have to worry about auto-resets. When you close the socket connection the serial link always stays up. So, making a web interface from here was simple, and it was what i have done just for the fun of it (PHP works good here).

Here it is working:

You can light my desk lamp now 🙂 on http://light.waynext.com/, sorry no upload bandwidth to put a webcam stream (Porto Salvo = Juda’s ass) so you have to trust my word, call to Waynext or check out the video.

Your RGI (Reality Gateway Interface) is now complete. Next step is to put it to work remotely, with the Arduino unconnected from the computer, must dig into xbee shields. Also to dig into a direct interface with PERL, Python or Java.

Oil change

My car odometer logs 260k kilometers plus some nickels and dimes, time was due to yet another oil change. This is the most simple maintenance operation you can do to your car, but is very common to be overlooked or overdone by car owners. It should be done according to your vehicle manual intervals and with the right oil specification and quantity. Its advisable to always change your oil filter with the oil, something that i don’t comply myself, because since the ECU reprogramming i shortened the oil change intervals (from 15k to 10k), and if the new oil is the same brand/viscosity of the old i keep the same filter between two oil changes (for 20k).

This is normally a cheap work to do at the shop, but i rather do this myself, because of several reasons:

  • This work is normally done by the workshop less qualified person
  • Sometimes they add too little or too much oil
  • Most places do this by suction through the oil level stick, so some impurities just remain at the carter
  • If done the correct way, through the carter, they have a tendency to over tight the drain screw (into the aluminum carter…)
  • I know for sure the stuff i am pouring in, witch is adequate (has the correct certification) for the engine, also i try to stick to the same brand and viscosity
  • Normally i take around 1h, witch is less than you usually wait at shop looking to some grease monkeys working at slow motion.
  • The economical savings (even if really not that much, they do add up with time)

So, first thing prior to get started, is to join everything you will need together:

  • Jack stands (well within your vehicle weight)
  • A jack
  • A red newspaper (ex: Expresso economy section)
  • Oil according to engine, for me its 4.2L of VW505.00 specs, normally BP 5000 (it depends on the promotional prices).
  • An oil catching pan
  • A rag (ex: old Lisbon Half Marathon t-shirt)
  • A wrench that works good on the drain screw (normally hex or monkey-wrench)
  • Some screwdrivers, Phillips, Torx, Flat, etc to remove the lower engine cover
  • Eye protection goggles
  • Funnel
  • Silicone joint tube (optional)
  • All purpose rubber compatible lubricant (optional)
  • Oil filter (not in pics cause i didn’t swapped it)
  • Oil filter wrench (not in pics cause i didn’t swapped the oil filter)

Lets put those hands to business, first and most important, park and break the car in a flat area (can be outside) and lift the front of your car and place it SECURELY on the jack stands. Do not improvise or try to be inventive in any way in this point, later if this goes bad and you happen to be under the car…. also don’t forget to put the eye protection goggles when working under the car, remember safety first.

Start to take the lower engine cover out with the appropriate screwdrivers . Afterward, locate the drain plug and cover the ground with the newspaper and place the oil catching pan, now remove the drain plug, and be careful so the the drain plug don’t fall to the pan…. let the old oil flush out, with the engine a bit warm the oil will flow much faster, so normally i do this half an hour after a drive.

While the oil is flushing you can get swap the oil filter, in the VW Golf is a cartridge that you can access from the top, with the filter wrench, there are some o-rings that you should also replace in the filter assembly when putting the new filter on.

Now, you should put the drain plug on again, many people always replace with a fresh one, but i only do this if it is getting old or threaded, if not i simply clean it of old sludge (with the rag) and put a tiny bit of silicone oil joint at the end, so it will seal nice and easy. Put it on, but DO NOT over tight, specially with an aluminium carter, it should be snug, just don’t over do it.

Now, its time to refill your engine with the new oil, use the correct quantity or put in small portions and check the oil level stick. About the oil, check the manual and make sure it has the needed specification for your engine and climate. The oil level should be between the max and min marker, not more nor less.

About the brand, there are tons and tons of information floating around, and everybody seems to have their own opinion or sympathy. My 2 cents, again don’t over do it,  use the manual specified oil of a major brand, and choose by some rational criteria, like price or by tech sheets (not just because someone told somebody that eared a person talking about a 1 zillion kilometers car that run only with oil xyz). If you want to upgrade the engine specified oil, fine, but i see so many folks pouring money in ultra high tech oils into some engines that would live happily with a 10W40…

At this point, usually i take advantage as the car is already in jack stands to lubricate the car silent blocks and rubber joints with an all purpose rubber compatible lubricant. Don’t forget to put the engine cover back in place and to clean everything, and to pack up your tools. Also put the old oil in the new oil container (now empty), and please do deliver it to recycling in a workshop (normally the same place where you bought the new oil).

Put the car back on the ground, get a cold beer and enjoy the next thousands kilometers.

Car care – AC clean and spare tyre stow

The AC clean is a very important procedure to get a good air quality inside a vehicle, it can avoid nasty bugs like Legionella developing . It is a very easy procedure, any DIYer should be able to do it with good results and saving some good money (really dont understand how some shops charge over 50 euros for this…). So, what you need:

  • AC cleaner product – i use the 1z klima-cleaner due to very good reviews online – you can get it at a paint shop or car parts shop .
  • Philips screwdriver
  • New cabin filter with charcoal element (if outside big cities get the simple no need of the charcoal).

So first, gain access to the cabin filter and remove it. The Golf 4 is very easy, lift rain rubber seal, remove the screws that hold the filter cover (located in engine bay in front of passenger seat), press clips of the filter frame and pull out. With the old filter out of the way, clean everything up (dust, leaves, cigar butts…).

© Volksbloggin

Now comes the very hard part (not), shake the AC cleaner can and insert the hose that comes with it all the way down the AC system thru the openings revealed by the filter remotion. Use half of the can there, the other half use evenly in the air vents. Remember, AC off and air blower off, open the vents and select in the dash the corresponding air direction as you deliver the product in each vents/section. After the can is empty, put the new filter in place (installation is the reverse of the removal). Then, open the windows and let AC pump air for 10 minutes with nobody inside. You can now enjoy the fresh air inside your car, so go buy something pretty to yourself with the money you have just saved.

I also cleaned up the mess that was the spare tyre compartment. I had a flat (a big rupture at tyre wall) and needed to change the tyre at the highway shoulder, so the wrecked tyre had lots of debris attached to it, brake dust, road dust, bits of tyre rubber, etc that were laid up to the spare tyre compartment. Everything normal, i just don’t understand why when afterward you get the car to the tyre shop they couldn’t care less about that mess, and don’t even pass up with a rag… what a pigs… so unless you want to carry at the trunk brake dust, bits of burned rubber in decomposition and other things that are not good to your health, its up to you to clean up, its very easy and need simple tools:

  • Portable vacuum cleaner
  • Water
  • Nivea lotion

Remove the spare tyre, wash it up with water. Let it dry. Vacuum all the shit of the tyre compartment and clean up with a rag. When the tyre has dried apply a coating of Nivea lotion to the rubber, better more than less. Check and inflate if needed. Now you can store the spare tyre and rest assured that will serve you good in case of need.