Saturday, April 1, 2017

Raspberry Pi Torrentbox

Continuing with the Raspberry Pi posts this time I'm writing about how you can transform your Raspberry Pi into an always On torrent box.

Although this is April 1st but don't worry this method works. So why should anyone use Raspberry Pi as their torrent box? If you think about it a Raspberry Pi consumes very little power so it is very easy to keep it running for long time instead of keeping a full PC running. You can just start a download and go about your business and at the end of the day the file will be there for you to use. There is even no need for getting it to your computer, you can watch it on the Pi itself or turn your Pi into a Network attached storage so you can watch it directly from the Pi.

So what do we need? 

1. Raspberry Pi, whichever model you have. I find Raspberry Pi 2 to be the most suitable candidate.
2. Power Supply and micro SD for Pi.
3. Extra storage solution, whether an USB based flash drive or a hard drive.
4. Working copy of Raspbian.
5. Internet connection, I will recommend using the Wired one as it is much faster than the Wi-Fi.


1. Like always we will start the process with updating the operating system. The code for that is

sudo apt-get update
sudo apt-get upgrade

2. Now that everything is nice and updated it is time to install a torrent client called Transmission. Personally I have used both Transmission and Deluge and found that Deluge looks much smarter but Transmission is much easier to use. To install it we have to type

sudo apt-get install transmission-daemon

Seems like I already have the newest version.

3. Now to make Transmission work we have to modify couple parameters so what we are going to do is simply stop Transmission so that we can edit the settings.json file.

sudo service transmission-daemon stop

4. Now that the service is stopped we can start editing. To do so we have to type in

sudo nano /etc/transmission-daemon/settings.json

So the settings.json file is open, we have to edit some items such as


"rpc-authentication-required": false

This will get rid of authentication when connecting to Transmission via web browser.


"rpc-whitelist": ",192.168.0.*"

This will allow us to use the transmission web based interface with all computers on the network(including localhost) with IP 192.168.0.x, where x could be any numerical value. I know that the way my Router's DHCP server is set it will give out IP addresses like this, if your Router gives off different IP like 192.168.1.x then you have to use that value. As with the DHCP we know that after lease time IP addresses are given to other devices if not renewed, so the IP address of Pi can change. If you want to avoid that all you have to do is simply reserve an address for it. I will post in a link how to do that in your Router at the end of the post. 


"rpc-port": 9091
"rpc-url": "/transmission/"

that's all the edits we need. Save and exit from here.

5. Now let's start the service again by typing.

sudo service transmission-daemon start

6. Time to test. Get to the browser of your computer and type in the IP address and the port, for me I know my Raspberry Pi 2 can always be reached by a certain address that is reserved so for me

Seems like it is working.

7. So let's grab a torrent file and upload it or put the URL of that torrent after hitting the "Open Torrent" button at the very left.

So I grabbed the torrent file of Ubuntu OS and let's see if the Pi can download it.

Seems like the Pi is downloading the file just fine. Seems a bit slow but it is downloading it. You can change the default directory or limit speed from the settings menu by clicking on the bottom left corner buttons. So we have a working torrent down loader that can be kept on for long time.


1. Raspberry Pi might not download torrents that fast as it lacks Gigabit Ethernet so even if you connect it directly to your router via Ethernet port you will get 100Mbps at best, connection-wise, Pi might download it at somewhat lower speed.(If your internet is not that fast, say 4-5Mbps, you should be fine)

2. It also lacks high speed storage support. There are other boards out there with Gigabit Ethernet and SATA port or USB 3.0 port, those should be much suitable for this purpose but as you can see for normal usage this one works fine as well.

3. If after rebooting, the transmission web base interface does not show up just stop and restart the service by typing the following commands in the terminal or via SSH.

sudo service transmission-daemon stop
sudo service transmission-daemon start


1. Read my other posts here.
2. All posts about Pi.
3. How to reserve an address on your Router. 

Thursday, March 30, 2017

Taking Screenshot in Raspbian

So this will be a very small post about how you can take a screenshot through command line interface in Raspbian operating system.

What Do we Need?

1. Raspberry Pi or any other single board computer that supports Raspbian.
2. Mouse, keyboard and Monitor if you want to use the Raspberry Pi alone.
3. Internet Connection.
4. Raspbian OS.
5. Power supply for the Pi.


1. Like always we will start off with making sure the Raspbian is fully updated. To do so just run the commands.

sudo apt-get update
sudo apt-get upgrade

2. Next we are going to install a small software called Scrot. To do so we have to type.

sudo apt-get install scrot

3. Now to take a screenshot all we have to type is


 4. You can also use a small timer that will allow you to take the screenshot after certain amount of time. To do so you have to type

scrot -d x
[where x will be a numerical value which is in second]

That's pretty much it! Hope this was helpful.


1. My other posts.
2. All Pi related posts.

Tuesday, March 28, 2017

Check Your Internet Speed With Raspberry Pi

Good evening, welcome to another Pi post which is about checking your internet speed with Raspbian on Raspberry Pi. This post will be very brief and just to show how you can check your internet speed without using anything other than the Terminal.

So, what do we need? 

1. Raspberry Pi!
2. Internet Connection to it either via Wired or Wirelessly.
3. Power supply for Raspberry Pi.
4. Working installation of Raspbian on Micro SD card, I'm using the latest release.
5. Monitor, keyboard and mouse if you want to only use the Raspberry Pi.

Note: You can also use another computer to SSH into the Pi or maybe use Virtual Network Computing but if you have a computer where is the point of doing a speed test on Pi although it might be helpful to understand how fast will the Pi download something if used as a Torrent box.

Hardware Connection:

1. Connect Mouse, keyboard and Monitor.
2. Next connect the internet, however you like.
3. Finally plug in the micro USB power cable to power it up.


1. After the boot up, launch the Terminal and make sure to fully update the Pi. To do so type in

sudo apt-get install update
sudo apt-get install upgrade

Once that has accomplished let's move on to the actual installation.

2. Now we need to install the Python-pip which is a package management system used to install and manage software packages written in python. In the terminal type in

sudo apt-get install python-pip

Here I already have the latest version so nothing new installed.

3. Not time to install the speed test part which we will do using the Package Management system.

sudo pip install speedtest-cli 

Again I already have it installed so not much was shown here.

4. Let's do the speed test which will be shown in the Command Line Interface. To do so we have to type in


Just to make sure let's compare this with my computer that is also directly connected to the Router via Wired Ethernet just like the Raspberry Pi.

Ping has increased in Pi but speed is consistent. Although my internet is not that fast so it also proves another thing that for slow internet Pi is good enough.

That's pretty much how you can use Pi as your internet speed tester.

More links:

1. Read my other posts here.
2. More Pi related projects.

All About Pi!

Short Index for all Pi Related posts! Hope you will enjoy it.

1. Raspberry Pi Starter Kit. (Coming Soon)
2. Let's talk about operating systems for Raspberry Pi. (coming soon)
3. Virtual Network Computing(VNC) on Raspberry Pi.
4. Raspberry Pi as Network Attached Storage.
5. Turn your Pi into a Torrent Box.
6. Internet Speed test using Raspberry Pi.
7. How to take Screen Shot in Raspberry Pi
8. Turn Your Raspberry Pi into a IR Remote Controller. (Coming soon)

Visit my full blog!

Tuesday, February 14, 2017

Musical Doorbell

This post is about making a simple musical doorbell circuit that can be used in your house and might take only couple minutes to build it.

Goal here is pretty simple, it will be a musical doorbell that has a very small power consumption and can play the music for couple moments even after releasing the momentary doorbell switch. For the music we will be using a melody generator integrated circuit to make our work easy and to turn on and keep it on we will be relying on Capacitor and transistors, so let's take a look at the component list.

Component List.

1. Integrated Circuit UM66.
2. Transistor 2N3904, 2N3906, SS9013, one piece each.
3. Capacitor 100uF.
4. Resistor two 1Kohm, and one 10kohm and one 100kohm.
5. Battery holder, two AA type.
6. Speaker 4/8ohm.
7. Momentary press button.

Let's talk about music!

Part number of the UM66 will give us an idea of what music it is going to generate. To find the right music for doorbell buy the one with the right part number.

The diagram!

Now that we know which Integrated circuit to order let's build the circuit.

How does it work? 

Power source for this circuit is two AA size cell, preferably Alkaline. They will provide roughly 3V.

When SW1 or the momentary press button is pressed the 100uF capacitor will be charged and at the same time the 2N3904 transistor will start conducting as it is getting current to it's Base.

As the 2N3904 can now be treated as a close switch we can assume the Base of 2N3906 to be at the ground which will cause the 2N3906 to start conducting.

Now we can see the current can enter into the integrated circuit causing it to turn on. This circuit will output a melody signal which will be amplified using SS9013 transistor which is feeding a loud speaker.

If the momentary switch is released, the 100uF capacitor will discharge through the 10kohm resistor and the 2N3904 transistor. So it will keep the circuit alive for couple moments after releasing the switch. Once it is fully discharged both the transistors will be open again and the integrated circuit will not get any power to stay On.


1. You can use ZL66 instead of UM66 too.
2. Two AA Alkaline cells will be fine for this doorbell.
3. A normal 1-3W speaker will be fine.
4. Increasing the value of the capacitor will cause the circuit to stay alive longer after the press button is released.
5. Both the 2N3904 and 2N3906 can be replaced by similar NPN and PNP transistor respectively.


1. UM66 Datasheet.
2. SS9013 Datasheet.
3. Read my other posts.

Tuesday, December 13, 2016

Show Temperature on 16x2 LCD with LM35 and Arduino

Good evening everyone so in my Arduino series last two posts were about temperature reading, displaying it on Serial monitor and using a 16x2 LCD display. Now allow me to merge them together to show the temperature reading in that display.

Parts Needed:

1. Any Arduino board ( And yes I'm using the UNO);
2. USB Type A to Type B cable to connect to computer and upload the code.
3. 16x2 LCD Display.
4. Male to Male Jumper Wire.
5. Practice Board.
6. 220ohm Resistor.
7. 10kohm Variable Resistor.
8. LM35.
9. Arduino IDE.


Let's start with the display.

Pin 1 - Ground.
Pin 2 - +5V.

Pin 3 - Connect to the Wiper Terminal of the variable resistor. Variable resistor needs both Ground and +5V on it's other two terminal. This resistor is used as contrast control.

Pin 4 - Register select, connect this to Arduino pin 12.

Pin 5 - Read or Write pin. Connect it to the Ground to enable Write mode.

Pin 6 - LCD Enable Pin, connect it to the Arduino pin 11.

Pin 11 - D4 to Arduino pin 5.

Pin 12 - D5 to Arduino pin 4.

Pin 13 - D6 to Arduino pin 3.

Pin 14 - D8 to Arduino pin 2.

Pin 15 - LED+ to 5V/3.3V with a series resistor maybe a 220ohm one. I'm using a 1K one though.
Pin 16 - LED- to Ground. 

Now let's hook up the Temperature sensor.

Pin 1 - +5V
Pin 3 - GND

Pin 2 - Arduino Analog input pin 5.

That's pretty much the connection that we need.

The Code:

Here is the code with necessary explanations.

// Let's start with including the LCD Library.

#include  <LiquidCrystal.h>

// Define the Input pin for LM35, in this case it is A5.
int  tempPin  =  5     ;

// Declare variable
int  value;

// Initialize the library with the numbers of the interface pins.
LiquidCrystal  lcd    (12, 11, 5, 4, 3, 2);

void  setup()

  // Sets the data rate in bits per second (baud) for serial data transmission.

  // Set up the LCD's number of columns and rows.
  lcd.begin(16, 2);

  // Print a message to the LCD.
  lcd.print("Temperature: ");


void  loop()

{ // taking in the value from input pin.
  value = analogRead(tempPin);

  // convert the voltage information, as LM35 is already calibrated in celcius to get the celcius output not much code is needed.
  float mv = ( value / 1023.0) * 5000;
  float cel = mv / 10;

  // convert the celcius value to farenhite, uncomment this and print it to get the fahrenheit result.
  //float farh = (cel * 9) / 5 + 32;

  // Serial Print will print value to serial monitor.
  Serial.print("Temperature = ");

  // Let's give it a vertical shift so it will be on the bottom line.
  lcd.setCursor(0, 1);

  // Print a message on the bottom line.
  lcd.print(" *C") ;

  //Start again after 300ms.


So how does it work?

Well I have separately written how the display and the temperature monitoring works so I will just put links to those post at the bottom of this post where you can find details on them.

Let's look at the completed project.

Here you can see the display, Arduino and the LM35. The reason there is no variable resistor is because I don't need to control the contrast in this one. So I just left it out.


Temperature sensor can be really helpful and putting it on a display can be even more helpful. It not only can be used as a visual modification for your project but can be used in many different projects where it is necessary to show the temperature. You can also control other devices using temperature as the trigger point. One thing you can do is to make something like the following image and cover the wires with heat shrink material and can be used as a temperature probe to lower it in a liquid or reach in a place where it wouldn't be practical to put the practice board in.

In Here I'm Just using three Male to Female jumper wire, the one that is used with Raspberry Pi.

So that's pretty much it, hope this has been helpful.


1. Temperature monitor using LM35.
2. Using 16x2 display with Arduino.
3. Read my other posts here.

Monday, December 12, 2016

Temperature Monitor Using Arduino and LM35

Good evening. This is the continuation of the Arduino series and this particular one is about how to make a simple temperature monitor using the LM35 precision temperature sensor.

This will a very small project as the part it needs is the LM35. Reason behind that is this small chip is already calibrated in centigrade so it is just as simple as reading it's output value, do a small conversion and show it on display or use it in somewhere. LM35 is a linear temperature sensor and it's output voltage is proportional to the temperature. It's output is 10mV/Degree Centigrade. So if you rise temperature by 1 Degree Centigrade, output will increase by 10mV. So all you have to do is read that through Analog input pin of your Arduino and done. There are couple different positive things about using this. It has wide voltage range, it is a very small device so it is suitable for pretty much any application where temperature reading is needed.

So let's go over the parts list:

1. Arduino, again for basic projects like this I use UNO.
2. LM35.
3. USB A to B cable and Jumper Wires.
4. Arduino IDE on computer
5. Practice Board.

Procedure and Connections:

As there will be no other parts other than the LM35, the connection is pretty simple. LM35 has three pins. Pin1 takes in positive voltage which can be anything from 4V to 30V and Pin3 is the ground pin. I have just powered it directly from the Arduino 5V and GND pin.

Pin2 is the output pin of LM35 which needs to be connected to any of the analog input pins of the Arduino. You might have to change the code if you use anything other than 5 because that's what I'm using.

After connecting upload the code provided, code has all the necessary explanation and how you can modify it. Then open up the serial monitor to see the temperature reading.

The Code:

// declare variables.

int value;
int tempPin = 5;

void setup()
void loop()
  // taking in the value from input pin.
  value = analogRead(tempPin);

  // convert the voltage information, as LM35 is already calibrated in celcius to get the celcius output not much code is needed.
  float mv = ( value / 1023.0) * 5000;
  float cel = mv / 10;

  // convert the celcius value to farenhite
  float farh = (cel * 9) / 5 + 32;

  Serial.print("Temperature = ");

  /* uncomment this and comment the previous 5 lines to get temperature in farenhite
    Serial.print("Temperature = ");


Here is the project:

How does it work? 

I have talked about LM35 earlier on this post, so you get the idea of what happens with different temperature, it gives different output voltage which is analog. Hence we put that in the analog input of Arduino. Now we have to convert it to digital in a way that it represents the proper temperature value.


 You can check for the accuracy using a source with known temperature.


This one might be a very simple project but you can use it in many different things like battery over temperature protection or any kind of over temperature protection. It can also be used to control devices based on temperature. 

Hope you have enjoyed it.