Saturday, March 30, 2013

Marrying old technology with new one! Use of your USB FM Transmitter

A few days back I wanted to listen to my music collection in my kitchen and it seemed like it was impossible. The music collection hosted on my music server in basement, the boombox in kitchen had everything but bluetooth, I stopped using cd's long back and the other music player that I have that has bluetooth seemed like a pain first pairing the device with my phone and then getting it to play. 

So my problem was how to play something and make it available in every room. Eureka! so what I did is I bought this $50 FM transmitter from Hi-Fast. Its an amazing piece of hardware as it is very powerful in terms of transmitting FM signal. 

Features of Hi-Fast USB Transmitter:

  1. Links computer music to audio equipment wirelessly
  2. USB bus-powered, no battery or AC adapter required
  3. Fashionable, smart, stereo, plug& play, easy to use
  4. USB-Flash-Disk-Like slim size and lightweight design
  5. 7 selectable frequencies: 106.7, 106.9, 107.1, 107.3, 107.5, 107.7 and 107.9MHz
  6. Whole-house-wide transmission range up to 160 feet (50 meters)** Strong ability to eliminate interference
  7. USB digital audio stream, no sound card required
  8. Frequency response: 20Hz – 20 KHz (Headphone/line output)
  9. SNR & Dynamic range: 96dB (Headphone/line output)
  10. Headphone/Speaker output power: 52mW/32 Ohm, 300mW/4 Ohm
  11. Audio output jack: 3.5mm stereo female
  12. Certified by USB-IF, Fully Compliant with USB Audio Specification
  13. Compatible with Windows 98SE / ME / 2000 / XP, Mac OS 9 or later, and Linux with support for USB audio without additional driver.
Next Step:
So we are set here pretty straight forward ey! Now with our headless (meaning no UI) linux system (preferably ubuntu) install the music player daemon. 

:~$ sudo apt-get -y install mpd

Once mpd is installed configure your music directory. So open the configuration file in your favourite text editor:
:~$ sudo nano /etc/mpd/mpd.conf and update your music directory and other settings. 

Your settings will be different then mine:

Audio Output
audio_output {
type "alsa"
name "My ALSA Device"
device "hw:0,0" # optional
format "44100:16:2" # optional
mixer_device "default" # optional
mixer_control "PCM" # optional
mixer_index "0" # optional
}

Equalizer
audio_output {
    type        "alsa"
    name        "My ALSA EQ"
    auto_resample    "no"
    use_mmap        "yes"
    device        "plug:plugequal"
    format        "44100:16:2"    # optional
    mixer_device    "default"    # optional
    mixer_control    "PCM"        # optional
    mixer_index    "0"        # optional
}

Restart mpd thereafter.
:~$ sudo killall mpd
:~$ sudo mpd



Now on your android smartphone (sorry iOS guys you need to buy MPD client) install MPDroid app should look like below:


Configure MPDroid with the mpd server ip address:


















Once you connect you can start playing and controlling your music collection on your server and the best part is that it will be available on any of your FM players....across the home even outside in the backyard. 

There you go guys no need to buy wifi enabled devices if you like this solution.

Wednesday, November 28, 2012

Installing Linux Server (Ubuntu distro) [Basic Installation]

Introduction

I have found people running away from linux fearing that it is really difficult to learn. I had zero experience in linux when i first installed fedora red hat linux in 2005. I am not an expert but almost know what to do if I get stuck. 

Linux is very easy to understand at first it looks difficult because you are used to windows style file and folders view. Linux file system starts at "/" which is called root. That's how linux file system looks like with directories under root:


bin, dev, home etc. Also note windows directories have "\" backslash whereas linux has "/" forward slash.

So to traverse between directories you would do 

:~$cd /home/username

Today linux has become mainstream, you see gadgets, smartphones, netbooks, laptops have pre-installed linux and are running smooth. Not to forget Android with the largest market share based on core linux is the smartphone OS.


What we will cover today

In my last blog post I covered installing SSH server on windows and creating SSH proxy. Today we will learn how to clean install Ubuntu Server (no gui) and setting it up as our basic home media / file server.

This machine ideally has to be online 24/7 and connected via LAN cable rather than wifi as you need good speed during media sharing, file sharing and vpn etc.

Pre-requisites

  1. Download ubuntu server iso file from Ubuntu website (link).
  2. Download unetbootin (link) for your OS.
  3. USB Pen drive with minimum 4 GB space

Let the show begin

Step 1: Format the usb drive to fat32. This is very easy insert your USB pendrive in any windows machine and in right click the drive letter to choose "Format". Select Fat32 while formatting.

Step 2: Now select the iso file that you downloaded, choose the usb drive and press ok to prepare the bootable usb drive.




Step 3: Once the usb is ready, reboot your machine. Now here is the tricky part:
This will depend on the manufacturer of your machine in many cases its the F10/F12 key that prompts user to select what drive to boot from. You have to be quick or keep hitting F10/F12 key to arrive at that menu. Once you are there - : "Choose USB Drive at this prompt. My dad has done it so anyone can do it :-).

Step 4: From here just take a look at the screenshots below and they are self explanatory. Navigate using TAB and Up / Down Arrow keys to navigate.



If you are Advanced User then select Manual else do the previous selection of "GUIDED"




 
Above snapshot brings us to the last part. After this we can choose additional software that we can select now and install.

  1. Openssh is a server that allows ssh clients to connect to server remotely and pass control commands.
  2. LAMP stands for - Linux, Apache, MySQL and PHP engine to set up webserver (Microsoft has IIS and Microsoft SQL).
  3. Samba file server to allow file sharing cross platform (Windows/MacOSX and Linux)
  4. Press Continue.


If everything goes well you will see reboot prompt and the machine will reboot. Remove the usb drive from the slot.

Thats all. 

The machine will boot to ubuntu operating system with following screen. Enter the username that you created and password that you typed in while installing ubuntu.
You should see the following prompt now. Thats it! 


You have successfully installed ubuntu and its up and running. Next steps on fine tuning and connecting remotely to the ubuntu server via ssh in my next blog post.


Tuesday, November 20, 2012

How to connect from office to home using SSH proxy

SSH Proxy

Often you might have noticed that offices block personal email accounts as they have firewall implemented. Every time you try to open a website such as "gmail.com", "facebook.com" and you see policy notice indicating you cannot access as blah..blah...blah..

No worries. There's a a work around. So lets start with the pre-requisites.

Pre-requisites

  1. Basic knowledge of Networking (IP Address e.g. 192.x.x.x, Netmask 255.x.x.)
  2. Knowledge of terms such as routers, firewall and modems etc.e
  3. An installed operating system such as Winxp, Windows Vista, Windows 7 (32 or 64bit) or a linux machine preferably Ubuntu (my choice) or your choice.
  4. Your home machine should remain online at all times (24/7) or atleast for the time you are not at home.
  5. You should know the username and password of your router that was provided by your ISP. Normally the default username is "admin" and password is "admin", "passw0rd", "admin123" etc. It is advisable to change your default password to something more complicated.
  6. Setup Dynamic DNS Service with dyndns or noip etc (look for other free alternatives as well click link for google search returns). I have setup with dyndns.com. You can go on these sites and register with username and password independently. Check for free options.

Windows - Downloads

  1. Download MobaSSH for windows (link to download)
  2. Download Putty for windows (link to download)

Preparing our Router 

Step 1: Lets start now. On your windows machine click start and in the search window type "cmd" and when you see results click the one with "cmd.exe".

Step 2: On your windows OS Type ipconfig /all in the command line window. Your window should look something like below based on OS. Take a note of  physical addressip address and default gateway. Your ip address should look like 192.168.x.x and gateway should be 192.168.x.1. I am on LAN with cable so you see ethernet adapter. If you are on wireless it should show you wireless device.


Step 3: Now open a browser of your choice (mine is chrome :-)) and open your gateway ip address http://192.168.x.1.







Step 4: Go to Setup -> DDNS in your router and enter required fields that you did in Pre-requisites # 6. Save Changes.



Step 5: Make the ip address of your machine running SSH server static. Save Changes.





Step 6: Go to port forward settings in your router and add a rule as in the image below. 
Application Name: SSH
Protocol: TCP
Source Net: keep blank
Port from: 22
IP Address (this is important) put the ip address of your machine that is running SSH server that you obtained in Step 2 above. Save all changes.


To test if the port forward was successful click link. In the port section write "22" and hit "Check Your Port". If you did everything correctly you should see "Green" or "Success". Else you may need to check your settings again.

Good we are all set with router. The reason why we need dynamic dns or no-ip service is your ISP (internet service provider) assigns you a dynamic ip that keeps on changing. Therefore we map the changing ip address to a static name and this service is provided by dyndns and no-ip kind of companies.

Ok lets get to the next part now.

Preparing our Windows Machine

Step 1: Install MobaSSH with default settings. If it prompts for allowing on firewall of XP, Vista and Windows 7 always select "Allow". For more information see link

Step 2: Check if the SSH Server is running from Windows Services. 

Step 3: That's it!

Preparing our Office / Client Machine

I like chrome so I will demonstrate in chrome browser. But you can achieve this in any web browser.

Step 1: Copy the putty file on the office or the client machine. Open Putty.

Step 2: Enter your static host name that you registered with dyndns or no-ip. 




Step 2: Expand the SSH in Putty and enter tunnel information. 

























Step 3: Finally hit Save (Save button as showin in Step 2). It will prompt you for a profile name.


Step 4: Open Chrome Browser and go to chromestore. Click link and install Proxy Switchy for Chrome.

Step 5: After adding the tool to chrome. Do the following:



















Step 6: Click "Extensions" on the left and look for "Proxy Switchy". Just type the same in your section as shown below.


So guys here we come to end of the setup. To test it take your office or client machine. Open putty and open the profile that you saved in Preparing your office Machine -> Step 3. Hit Open. You will be prompted for your computer's password. Key in password for the user id that you have used. You should see something (not exactly) like below:

Go to chrome and choose your proxy:
You are now logged in to your home via secure SSH connection. Click open any site that is blocked and you should be able to bypass the web filters and firewalls. The only exception is that your outgoing port 22 is blocked by your organization (which is a remote possibility). 

This can also help you when you are at a public place and using public wifi networks use SSH proxy so that the traffic is encrypted and you atleast have some defence against the bad guys.

I will add linux based client/server as an update to this post.

Enjoy!

Why I started writing technical blog?

After days long battle with myself I finally took a decision to write. For past seven years I have been playing with different OS's, mobile phones and router firmwares and debating how to use technology in my own home and make use of it to the fullest.

I finally reached that landmark where I cannot think of anything more convenient than the way I have exploited technology. Yeah, there may be other simpler ways and let me tell you I am open for suggestions. My parents are at age over 60 but that doesn't stop them from using "Ubuntu" linux variant, connect to my home using vpn listen to my ever expanding collection of songs, pictures and movies. I am proud of my parents that at this age they have been learning and keeping up with technology :-). 

Firstly, the driving force was to make it simple in such a way that any layman can do it. The information is just a google search away, but my intention was to make it collaborate all information at one place and make it easier for people to search.

Secondly, often I found that people who write solutions; seem to make it so complicated that to implement for normal person without much knowledge of technology is difficult.

Thirdly, call it opinion, perspective or whatever I believe that if you cannot exploit technology in your day to day life and it is useless. 

So here it starts. I have a day job and a family to look after, so I will try to answer questions as soon as possible and will keep writing as and when I get time.


Happy Reading!