Raspberry Pi Media center

I was a big believer of HTPC (Home Theater Personal computer) and therefore upgraded my desktop some time back so that it could be connected to my Yamaha AV receiver. I also custom built/modified a custom remote using a old DVD player remote so that I could operate it without using a keyboard/mouse. In case you are interested in details of that build here is the post.

I used this setup for some time but later came to the conclusion that the desktop form factor does not fit well in a living room media player setup. At this point I decided to give Raspberry pi a try. I had an Model B+ lying around which was just used by me once in a while for my experiments. I had the impression that it would crash or in worst case burnout with the “heavy” media files i was going to throw at it. I still went ahead withe the following setup

  1. Media – A USB portable hard disk which had my media files.
  2. USB remote – The one i mentioned above
  3. Display – HDMI output connected to TV.
  4. Audio – USB to Optical / TOSLINK audio sound card which is then connected to my AV receiver.
  5. Internet (Optional) – A USB WIFI adapter which can be used for installing additional software or getting updates.
  6. Operating System – OSMC – https://osmc.tv

I was blown away by the performance of the setup. It was performing exactly like my desktop computer without any slowness.The audio and video play back was super smooth. I was also able to get Dolby Digital output from the sound card without any effort. OSMC is a beauty and works like a charm. Full marks to its developers.

I am extremely happy with the current setup and also proud of myself (especially the remote 🙂 for getting this setup working.

Building remote for my media center PC

Around a year back I had posted on how I built my media center PC aka HTPC (Home Theater Personal Computer) . I had been operating that using my wireless keyboard and mouse which satisfied all my functional requirements. To work as a true media center though i felt it had to work with a standard television remote.

I had therefore thought of adding a Infrared receiver (IR) connected to my media center PC which would allow me to use a regular TV/ DVD remote control to operate it. I looked around for some ready made IR receivers but the only one i found decent enough was Flirc . The price was on higher side though which was around 20 USD in addition to availability only in US. This meant that I had to wait for someone coming back to India from US in addition to paying a good amount of money. I therefore decided to go ahead and build my own.

Requirement:

A micro controller based circuit which will accept commands from any existing remote control and pass these as keyboard commands.

Components required -:

  1. Pro Micro 5V 16M Mini Leonardo Micro-controller Development Board For Arduino
  2. TSOP1738 Infrared receiver.

Details-:

The Pro micro Arduino board has a great feature that it can act as standard USB keyboard to your PC with the help of a library. This made the work a lot easier as I then only had to read the IR remote commands and then convert them into equivalent USB keys and send them to PC. For the PC , it appears like it is just a standard keyboard and therefore no special driver or any software is required to be installed on the PC. Every IR remote sends a different set of commands for every key and after some debugging, I had the list of commands which my DVD remote was using. After coding that into the arduino code and writing some new code to map it to PC keys, the thing was working as expected. I then used a old Nokia charger which I had lying around to place the arduino and the IR receiver. Below is the working video and some pics of the board and the final product.

.

 

 

My water fountain

As a part of my DIY hobby projects I had recently created a indoor water fountain out of the things which were lying around the house unused.  This project used the following -:

  1. A submersible pump (18 w) which is used in air coolers, fountains. I did not select this for the rating but because it was available on a good discount on Amazon.
  2. A clay pot which was at home.
  3. My daughters water bottle.
  4. Base of the plant pot

Working:

The pump is connected to the base of the water bottle and pushes water upwards. The cap of the water bottle has holes drilled which allows the water to come out.  Also added few money plants to give it a natural look. Below are few pics and a video.

Slow updates with DNF in Fedora

The DNF utility in my Fedora 28 system had been running slow recently. For quite some i had ignored it assuming it to be a bandwidth issue at my end or at their end. Since this happened for quite some time, i had to look for some help and i did find it. Apparently there is a config “fastestmirror=true” which needs to be done in /etc/dnf/dnf.conf . Post this the system was back to its blazing fast mode 🙂 .

Make your existing router use hotspot wifi internet

UPDATE (5-SEP-2019) – There is something called WISP (Wireless ISP) mode in almost all new routers in market now. This mode solves the exact problem which I was trying to solve back then. I upgraded to a TPLINK router which has this mode and it works beautifully. You can still go ahead and read the below post for academic purpose or just to know some ways I keep on wasting my time 🙂 

——–ORIGINAL POST BELOW————–

I have a NETGEAR WNR612 router which is simple no frills device and does the job its made for. It connects to a modem with Ethernet output for Internet and connects its wired and wireless clients to Internet. Recently i decided to drop my wired broadband and go for JIOFI device which uses the Reliance Jio network and has really attractive prices.

Problem: How to connect my existing router to use the internet from the Jio hotspot device

JioFI and other hotspot variants are technically 2 devices combined into 1 . There is a modem which takes your SIM and connects to the network for internet . There is another piece of hardware which takes this internet and creates a wifi network. The usual routers available in market assume that there will always be a wired internet available at an RJ45 Ethernet WAN port for which they have to create the wifi network. Technically if you are using a hotspot device there is no need for another router which also does the same job. Well in my case my router is responsible for creating my home LAN network and also has a much larger range than the hotspot device. I have a wireless printer which connects to my home network for print jobs. There are other devices which use the router WIFI for internet. The problem statement here was to somehow add the functionality in my router so that it can get the internet from the hotspot and beam it own Wifi network so that the other clients are not disturbed. They get the same internet as always and are unaware that anything has changed, which is how it should be.

A google search revealed several posts and videos which recommend to use WDS ie Wireless Distribution System. My router did not support this mode. Also WDS is a variant of repeater mode which means your hotspot would be responsible for creating and maintaining the LAN using DHCP.  Your older router would act as a subordinate which is what i did not want as the hotspot did not offer much customization.

Solution: I put my R&D hat on. I had an old Linksys router lying around on which I had installed DDWRT the powerful firmware sometime back but was not using it. DDWRT  is a beautiful and powerful piece of software which turbo chargers your routers with features which the manufactures never intended to built into the product. I had written about it in the past here. There are modes in which the router can be configured.

Access point is the mode in which we expect our routers to operate in which it converts wired to wifi. ‘Client’ mode is what would solve my problem. In this mode the devices acts as a client and connects to the hotspot wifi and provides the internet in to the router LAN ports. This LAN port of the intermediate router needs to be connected to the WAN port of the main router. This is all that is needed.

My main router now connects to the Linksys router with DDWRT which in turn connects to the wifi hotspot for internet. Another day , new learning!

Parallel slowdown

https://en.wikipedia.org/wiki/Parallel_slowdown

Important concept for developers when they go full throttle on multi-threading. Too much context switching by the manager/master/coordinator becomes expensive as the parallel threads increase. Simple analogy would be to visualize a teacher teaching 20 students. If the student count is increased to 100 then we have a chaos in making as the teacher would not be able to give enough attention to the children.

My old wired printer made wireless

I have a wired HP printer which is quite old but in working condition. It was from the pre -mobile era so it assumed that it would always be sitting next to a desktop machine. Times change and we now have WIFI, mobile and everyone expects everything to be wireless and from a mobile. Being the resident IT support guy i decide to do something about it. I actually worked on it twice.

The first version was few years back before the RaspberryPi came. It was setup using a ASUS router which had a USB port and tomato usb third party firmware similar to DD_WRT which magically adds features to your router which the manufacturer never intended to.I wont explain this much now as I think it wont benefit anyone  NOW (and i am too lazy to type 🙂  ).

The 2nd version which I setup few months back is when the 1st version hardware stopped working and when the RaspberryPi ZeroW was launched. So I decided to go for a Pi based network print server. Its a very powerful piece of hardware and is well worth the money for the form factor. It is a full fledged Linux machine with USB and WIFI ! .This is a ideal machine to be used in kiosk type hardware. I hope they make it lot cheaper so that it becomes a no-brainer choice for such projects.

Hardware:

  1. Raspberry Pi ZeroW.
  2. I had to buy a OTG cable  to connect my USB printer to the pi as the pi zerow comes in with microusb only to save space.
  3. It is powered by the commonly available 5v mobile chargers.

Software:

  1. Installed raspbian OS which is tailor made for Pi.
  2. Setup pi to work in headless mode (no display) as it required a micro HDMI connector and i did not wanted to spend on one. This involves giving a static IP to the Pi and enabling SSH so that you can remotely log in from other machines through SSH and do whatver you want.
  3. Installed CUPS the powerful print server software which converts the innocent pi to a Network enabled printer.

Linux – I tested this setup on Fedora. Almost all linux OS’s have built in support of CUPS based printer and their configuration utilities will auto detect once you provide the IP of the pi.

Windows – I currently dont have a windows machine but I am pretty sure this should also work on Windows out of the box.

Android – There is a app available on android called LetsPrintDroid which easily setups CUPS enabled print server found on the network and allows you to print documents directly from the mobile without requiring any desktop/laptop. This is slowly becoming my preferred mode when all i want is a quick print without waiting for my desktop to be UP and running.

Whenever the printer is powered ON, the pi also boots up and within a minute connects to the WIFI and is ready to serve print requests from my home network.

Arduino based automatic aquarium fish feeder

I had setup a aquarium at home recently and realized the need to feed the fish twice a day. Since necessity is the mother of invention, I therefore decided to setup some kind of mechanism which will feed the fishes at regular intervals.

I looked at assembling something with 555 timers but found after some research on internet that they are not suitable for such long delays (twice a day). The next option was digital timer circuits and pre-assembled modules but looking at the cost factor arduino seemed a good option although using a micro controller for such a project seems to be a overkill but i think what matters is it fulfills the functional requirement with the lowest cost. I wont mind even using a RaspberryPi if its the cheapest 🙂

With an old vaseline box, few electric concealing pipes and a stepper motor I managed to setup something which did what i wanted it to do. Every 12 hours the arudino code is triggered and it signals a stepper motor to rotate 1 clockwise and 1 anticlockwise rotation. There was no particular reason for the clockwise and anticlockwise part , its just that i felt that it would be more fun that way.

The demo video shows a plate which acts as the manual override which can be used to test the system till we are confident that everything is working as expected.