Yes, it’s not a typo, the example is from reel life 🙂
Remember ending of all time favourite movie Sholay?
Well the one that I had seen in childhood was about Thakur surrendering Gabbar to police. Recently I downloaded a copy from totrent for family. Today when I watched it till end, I saw Thakur kills Gabbar in the end. I was stunned to realize how the simple concept of designing loosely coupled systems existed in Bollywood 40 years ago. Coming to programming world, now everybody is focussing on programming to an interface.
Amazing to notice that Mr. Sippi kept the climax scenes programmed to have different endings, each one as real as the other, one the director’s cut and other for cinema halls.
We the developers have a lot more to learn from outside the software sysyems!
To start with Raspberry Pi, I had installed Raspbmc OS a.k.a. Kodi on a 4GB MMC card that I took from my phone. This little computer is impressive and now I’m a proud owner of this cheap yet powerful media center.
I wanted to upgrade memory to 16GB so I can store more videos. But I wanted to keep the OS as is and didn’t want to redo the installation and configuration , backup and restore data.
So that’s the solution? At a high level, you need to backup the entire memory card(including it’s partition table) onto a file and restore from it.
On Windows, you need to use Win32DiskImager, the same software that you probably used during Raspberry Pi installation
- Install the s/w on a Windows system and insert the memory card. You can buy a cheap MMC card to USB adaptor from your local shop, in case your computer doesn’t have a MMC card slot.
- Run Win32DiskImager, give a name to the file where you want to backup your MMC card and hit ‘Read’.
- Now insert the new MMC card.
- Run Win32DiskImager again and this time, restore the backup onto the card by clicking ‘Write’
- At this point, your OS has been restored to a new card, but if you boot up Raspberry Pi, it sill still show old disk space.
- To make Raspberry Pi ‘aware’ of new disk size, I ran fdisk and resize2fs commands as mentioned in this accurate answer.
And this is all about it!
You have successfully upgraded the storage.
Although watching videos on a media center OS like Kodi using existing TV is much better experience than any other OS, one outstanding feature was about subtitles support. On VLC payer, I manually search for subtitles, jostle with ads on those sites, download and then point VLC to that file. It’s no longer the case with built in media player on Kodi. You just need to click ‘Download subtitles’, it will search for best match automatically.
Recently I saw this TVC of Voltas all weather AC, where it shows you can control your AC with a smartphone. It’s a brilliant idea, and not surprisingly the prerequisite for the app is – your smartphone should have IR transmitter.
So if you are buying that AC and want to use it’s app, there are chances your smartphone turns out to be not smart enough in this case and you may have to buy a new one!
Well, not necessarily. If you are ready for some DIY stuff, you may use Raspberry Pi and possibly use any AC + smartphone combination.
At a high level, this is what I’m thinking of-
- Connect an IR transmitter to RPi. Record the IR codes from AC remote and ‘train’ the LIRC. The most accurate and comprehensive blog I found is from Alex Bain
- To send commands remotely, either create an app or a host a web page inside RPi’s in-built web server.
- Connect smartphone to RPi over your home wifi.
Now you are all set to control AC from any device on your home network. Controlling it from outside the home network is also possible.
My first IoT project is a room temperature sensor publishing data to cloud.
Google DS18B20 + Raspberry Pi and you fill find many posts about it. I followed one of them
Purchasing the hardware and electronics part was a big difficult in India. The parts are cheap, but finding the correct ones on internet or local shops was a bit challenging for me.
Once I procured all the hardware, the only change in the above circuit diagram is to use 5V rather than 3.3V. With 3.3V, sensor was getting detected, but there was no reading from it.
Data is read by Python function
inputfile = open("/sys/bus/w1/devices/28-031464907dff/w1_slave")
text = inputfile.read()
tempdata = text.split("\n").split(" ")
temp = float(tempdata[2:])
temp = temp / 1000
temp = int(round(temp,precision))
To upload use API provided by data.sparkfun.com
url = "http://data.sparkfun.com/input/<public_key>?private_key=<your_key>&temp=" + temp
result = urllib2.urlopen(url).read()
And that’s it! This is an always on temperature sensor. You can not only publish it to internet, you can also use the reading to take decisions like controlling other IoT things.
Doing IoT on Raspberry Pi is dirt cheap. In less than ₹5,000, I was able to complete my first IoT project.
If you want to watch live streaming from internet to your non smart TV, you have an option to either to use it as a external display unit connected via HDMI from your computer or purchase something like Chromecast. I used Raspberry Pi.
Media centre Kodi on TV
This $35 ‘computer’ continues to enjoy attention worldwide for educational purpose, DIY projects and home automation. I had bought one to play around and found how easy it is to turn TV into a media centre. It has turned my TV much smarter than my imagination
- Watch HD quality streaming video from YouTube, Dailymotion and other channels
- Download and record from these channels
- Configure subtitles add-on
- Play media stored in USB drive or from network share or from your mobile as well
- Use your mobile as remote control for your TV
- Download from transmission torrent app
- And the best part is, you can still use other popular features of RPi like hooking up an IR or temperature sensor to the GPIO pins in RPi.
What you need?
- Along with RPi, you need some accessories like USB mobile charger as power supply, connectors, etc. Check out my previous post for this.
- Download and install RASPBMC, flavor of media center OS Kodi for Raspberry Pi.
- If your TV doesn’t have HDMI port, you will a converter.
- Additionally you may also want to install these Google Play apps or similar ones from your app store.
- Fring – Without logging onto RPi, you can know the it’s IP address. The app will do a network scan and list down all the machines along with their IP and MAC addresses.
- Juicy SSH – Turn your smart phone into SSH client. You will never feel like you are not using a computer while firing remote commands
- Yatse – Kodi remote control for smartphone. No limitations of IR remote; control your ‘smart TV’ from anywhere in your home. You can also play media files stored in your phone wirelessly to your TV.
And this is it !
The best case is when your TV has a spare HDMI port, so you don’t need to use the existing cable or satellite connection port for Kodi. You may leave both of them connected to your TV and choose whether you want a watch conventional TV or a want to have a smart TV experience.
Setting up IR receiver on RPi is also not that difficult. Once setup and configured on Kodi, you can use the TV’s remote to send commands to RPi as well as your TV. It’s very exciting to learn how IR receiver and sender work and create a programmable transceiver using RPi. I’ll blog about it later.
Recently I was in Jakarta on a client visit. While having breakfast at Century Park Hotel alone, I let me imagination wander. Breakfast there is buffet system, where guest can have multiple rounds of food items in fresh plates. Waiters clear up tables quickly after a guest has left to take another round. Next time guest may sit on the same table or in another free table.
One day it was peak time for breakfast and I was not getting a free table to occupy.I realized the situation is very similar to having a sticky versus non-sticky servers. I drew a comparison between a typical web application deployment and breakfast lounge. A hotel guest is same as the user of web app. Tables are like system memory. It gets fragmented when no. of guests occupying a table is less than it’s maximum capacity. It becomes sticky when guest wants to return to the same seat after taking next round of food. An abandoned session is similar to a guest going for next round and leaving used plat on previous used table. Waiters were no less than CPU doing garbage collection, clearing abandoned session to make room for new guests. User think time is comparable to time taken by a guest to think about next round, get it prepared and be ready to submit request i.e. find a table.
May be I was thinking too much, but I found tuning the application for peak loads is also comparable to how to deal with peak hour situations in this scenario. If you have limited memory(tables) then at the cost of frequent garbage collection(waiters clearing up tables), situation can be very well managed.
On the other hand, for non-peak hours, a sticky server(dedicated table for each guest) would be better. You can reduce the frequency of clearing up tables, and still sustain without any impact to end user experience. Though I have not seen a real application which can learn and adjust itself based on load, but wouldn’t it be nice to have such things in place?