I had an Adruino kit lying around for a long time but never did anything with it. Few days back I bought a few sensors and started to build a pollution sensor system consisting of atleast two sensors for now and multiple ways of monitoring. I don’t know any programing and most of the code is copied from different sources and modified wherever required to suit my requirements. As I worked, it became clear that it is not as easy job, so this project is going to be split in to multiple steps.

This project uses two different sensors, a simple MQ135 and a Sharp GP2Y1010. Data sheets are easily available on internet, but for quick reading here are short descriptions:

MQ135: It is a simple sensor used to measure presence of some common pollutants like NH3, NOx, Alcohol, Benzene, Smoke, CO2.  It has 4 pins, two for power supply and 2 for analog and digital readings.

Sharp GP2Y1010 is an optical dust sensor which measures the volume of suspended dust particles in air by using a LED and phototransistor. It has 6 pins.

Adruino pollution sensor project with MQ135 and Sharp GP2Y1010


1 POWER SUPPLY: As of now, Adruino is powered by a USB cable connected to PC. I also have a 9V compatible power supply which can be used once it’s disconnected from PC. I have a old powered USB hub which I plan to use in order to supply a 5V supply later to some components which will be added later. This may be necessary as some components seem to require a bit more power than what is good for accurate readings.

2. ADRUINO : A basic Adruino Uno board.

3. BASE: As of now, I am using breadboard for prototyping stage. If everything goes well, I may rebuild it in a more permanent way.

4. OUTPUT: All the output is being sent to Serial Monitor of Arduino programming interface. A LCD screen and an internet server interface will be added later.

Sharp GP2Y1010 Configuration

  • Pin 1 – Connected to +ve of 220 microF capacitor. -ve of capacitor connected to ground. A 150 Ohm resistor connected to 5 V.
  • Pin 2 – Connected to  -ve of capacitor
  • Pin 3 – Connected to D11 on Adruino
  • Pin 4 – Connected to ground.
  • Pin 5 – Connected to A0 on Adruino
  • Pin 6 – Connected to 5V


int measurePin = 0; // Connected to pin 3
int ledPower = 11;  // Connected to pin 5
int samplingTime = 280;
int deltaTime = 40;
int sleepTime = 9680;
float voMeasured = 0;
float calcVoltage = 0;
float dustDensity = 0;
void setup(){
void loop(){
  digitalWrite(ledPower,LOW); // power on the LED
  voMeasured = analogRead(measurePin); // read the dust value
  digitalWrite(ledPower,HIGH); // turn the LED off
  // 0 – 5V mapped to 0 – 1023 integer values
  // recover voltage
  calcVoltage = voMeasured * (5.0 / 1024);
  // linear eqaution taken from http://www.howmuchsnow.com/arduino/airquality/

  dustDensity = 0.17 * calcVoltage – 0.1;
  Serial.print(“Raw Signal Value (0-1023): “);
  Serial.print(” – Voltage: “);
  Serial.print(” – Dust Density: “);


  • 20:41:58.934 -> Raw Signal Value (0-1023): 180.00 – Voltage: 0.88 – Dust Density: 0.05
  • 20:41:59.950 -> Raw Signal Value (0-1023): 190.00 – Voltage: 0.93 – Dust Density: 0.06
  • 20:42:00.967 -> Raw Signal Value (0-1023): 175.00 – Voltage: 0.85 – Dust Density: 0.05
  • 20:42:01.981 -> Raw Signal Value (0-1023): 182.00 – Voltage: 0.89 – Dust Density: 0.05
  • 20:42:02.996 -> Raw Signal Value (0-1023): 175.00 – Voltage: 0.85 – Dust Density: 0.05
  • 20:42:04.009 -> Raw Signal Value (0-1023): 174.00 – Voltage: 0.85 – Dust Density: 0.04
  • 20:42:05.025 -> Raw Signal Value (0-1023): 173.00 – Voltage: 0.84 – Dust Density: 0.04
  • 20:42:06.036 -> Raw Signal Value (0-1023): 162.00 – Voltage: 0.79 – Dust Density: 0.03
  • 20:42:07.081 -> Raw Signal Value (0-1023): 176.00 – Voltage: 0.86 – Dust Density: 0.05
  • 20:42:08.096 -> Raw Signal Value (0-1023): 170.00 – Voltage: 0.83 – Dust Density: 0.04

As the voltage level fluctuates the dust density readings change accordingly. I burnt a small piece of paper to see if reading schange and they did.


To get maximum values, I inserted a piece of rolled paper to block the sensor. Voltage readings jump to their maximum value, 3.69 volts and output dust reading is 0.53 at it’s maximum corresponding value.

  • 20:43:33.582 -> Raw Signal Value (0-1023): 755.00 – Voltage: 3.69 – Dust Density: 0.53
  • 20:43:34.598 -> Raw Signal Value (0-1023): 756.00 – Voltage: 3.69 – Dust Density: 0.53
  • 20:43:35.645 -> Raw Signal Value (0-1023): 755.00 – Voltage: 3.69 – Dust Density: 0.53
  • 20:43:36.659 -> Raw Signal Value (0-1023): 755.00 – Voltage: 3.69 – Dust Density: 0.53
  • 20:43:37.673 -> Raw Signal Value (0-1023): 755.00 – Voltage: 3.69 – Dust Density: 0.53
  • 20:43:38.688 -> Raw Signal Value (0-1023): 756.00 – Voltage: 3.69 – Dust Density: 0.53
  • 20:43:39.704 -> Raw Signal Value (0-1023): 755.00 – Voltage: 3.69 – Dust Density: 0.53

MQ135 Pollution Sensor Configuration

  • Vcc – To 5 V
  • GND –  To Ground
  • A – To A1
  • D – Not connected


int sensorValue;
int digitalValue;
void setup()

Serial.begin(9600); // sets the serial port to 9600
void loop()
sensorValue = analogRead(1); // read analog input pin 1
Serial.println(sensorValue, DEC); // prints the value read
Serial.println(digitalValue, DEC);
delay(1000); // wait 100ms for next reading


  • 22:40:14.593 -> 105
  • 22:40:14.593 -> 1
  • 22:40:15.608 -> 105
  • 22:40:15.608 -> 1
  • 22:40:16.589 -> 105
  • 22:40:16.589 -> 1
  • 22:40:17.607 -> 104
  • 22:40:17.607 -> 1
  • 22:40:18.589 -> 104


By themselves, both sensors work fine. The readings seem to be consistent with environmental conditions and change with changing level of pollutants like smoke.


  1. Attach a LCD screen and output the reading directly to it without use of PC.
  2. Adding and configuring a WiFi module to upload data to an online monitoring application.


  1. There is a noticeable change in readings if both sensors are used at same time. Adruino doesn’t seem to be able to supply same amount of voltage to multiple components. It will affect readings adversely when more components like LCD screen are added. Perhaps use of a separate power source, like a powered USB hub supplying 5 V will help.
  2. I don’t know of any way to properly calibrate the sensors. These are just the raw readings and may not be entirely accurate. I have not figured out a way to address this issue yet.

More in next post.

Few days back I noticed that my Raspberry Pi 3 is running quite hot. Sometimes crossing 80 degrees. This is  quite rare but since it is running for days without a break in this hot weather, I planned to do something to bring temperature lower. But problem is that Raspberry Pis don’t come with any kind of cooling kits which are easily available. Most of the options commercially available are quite useless for the price. I didn’t want to spend too much for it, so started with some DIY cooling kit and ran stress tests to check which work and are worth the effort to keep.

I found a simple script for stress testing online. It just runs CPU under full load and takes temperature readings every few seconds. Full script:

Ammunition box with all of Raspberry pi setup inside

Ammunition box with all of Raspberry pi setup inside

vcgencmd measure_temp
sysbench –test=cpu –cpu-max-prime=20000 –num-threads=4 run >/dev/null 2>&1
vcgencmd measure_temp

In spirit of full disclosure, all these tests were done over the course of 4 days. They were all hot with outside temperatures during day time around 40 degrees but air conditioner was on for most of them time. Still, the room temperature was not constant for more than 4 tests at a time.  The data below is not 100% reliable and just gives an indication about the general characteristics of each cooling method based on my observations.


  1. A 80 mm cooling fan from an old PC case. I spliced a USB cable on to it (red and black wires) and powered it using an old tablet charger (5 Volt, 2 Ampere). The fan is rated for 12 V, runs a bit slower. It is not ideal solution but works for now.
  2. Very cheap thermal paste.
  3. A 1 Rupee coin with one side filed smooth as a test heat sink.
  4. Cheap and small aluminum heat sinks supposedly designed for Raspberry Pi. They had some sticky “thermal paste” on bottom which looked more like a sticker. So I removed that used my own.
  5. All of this Raspberry Pi setup is inside an old ammunition box salvaged from a junkyard. It has a power supply extension board, a powered USB hub, a USB wifi dongle, a USB harddisk (connected to Raspberry Pi itself, not hub), a 80 mm fan as described in point 1 and OSMC operating system with Kodi.


1.These are temperature readings without any type of cooling.



Passive cooling with heatsink, cheap thermal paste and a filed coin

Passive cooling with heatsink, cheap thermal paste and a filed coin

Difference in starting and peak temperature : 15.1
Difference in starting and peak temperature : 33.3
Result: Peak temperature varies between 75 and 84 degrees. But hovers around 83 for most part when air conditioner was off. Quite hot.

2. With only coin on processor. No thermal paste or fan

Difference in starting and peak temperature : 18.3
Difference in starting and peak temperature : 23.1
Difference in starting and peak temperature : 17.7
Difference in starting and peak temperature : 24.2
Result: With a filed coin acting as a heat sink, there is a small drop of 2 to 4 degrees. Not much to be useful.

3. With the fan blowing air directly on processor.

Difference in starting and peak temperature : 8.1. It is great as the peak temperature was only 58.
Difference in starting and peak temperature : 17.2
Result: Idle temperatures are lower by 10 degrees and peak temperatures by 19 – 20 degrees with fan blowing air directly on processor. Differences in starting and peak temperatures also show a lot of improvement as the peak temp stays closed to 70.

4. With fan facing up.

This was an experiment to check if the reverse air flow would be as effective in cooling.
Difference in starting and peak temperature : 18.35
Difference in starting and peak temperature : 17.2
Difference in starting and peak temperature : 20.4
Result: This result is interesting as the peak and idle temperatures are quite close to those with opposite airflow.

5. Coin with thermal paste, no fan.

I applied a thin layer of thermal paste on coin and ran test without the fan
Difference in starting and peak temperature : 16.7
Difference in starting and peak temperature : 30.6
Difference in starting and peak temperature : 26.9
Result: Seems like thermal paste I got is fairly useless. I ran the test 3 times to be sure.

6. Coin with thermal paste and fan blowing on it

Difference in starting and peak temperature : 13.4
Difference in starting and peak temperature : 14
Result: There is some improvement from direct fan without a heat sink and quite a bit improvement from running with only coin with thermalpaste.

7. With aluminum heatsink, no fan or thermal paste

These tests were done with the small aluminum heatsink.

Difference in starting and peak temperature : 23.2
Result: This heatsink has minimal effect in cooling the processor. It is too small and even the fins don’t help much compared to a simple coin.

8. With aluminum heatsink and fan blowing on it

Difference in starting and peak temperature : 13
Difference in starting and peak temperature : 17.3
Result: Somewhat surprisingly, this is better than direct air flow on processor.

9. With aluminum heastink and thermal paste

Difference in starting and peak temperature : 24.8
Difference in starting and peak temperature : 30.7
Result: This thermal paste seems to be quite useless.

10. With aluminum heastink, thermal paste and fan

Difference in starting and peak temperature : 20.4
Difference in starting and peak temperature : 16.7
Result: In this case, temperatures are around 2 degrees higher than without thermal paste.

11.With aluminum heastink, thermal paste and coin.

I put the coin on top of processor. Applied some thermal paste on it’s other side and put the heatsink on it. This test was without fan. I thought extra metal will help cooling.
Difference in starting and peak temperature : 29.6
Result: There is a difference of only 1 -3 degrese less if only one of either heatsink or coin was used. For some reason, extra metal made no difference.

12. With aluminum heastink, thermal paste, coin and fan.

Same set as above but with fan blowing air on top of it.
Difference in starting and peak temperature : 12.9
Result: This is slightly better than using either coin or heatsink and 4-5 degrees better than direct airflow.


For some test runs, using the filed coin was better than the heat sink. Cheap thermal paste is next to useless in this case here. Only active cooling with fan provides any kind of appreciable cooling. Passive cooling will probably work if the heatsinks are bigger. But I don’t have any lying around and there will laso be the issue of bigger heatsink touching and shorting other components on the board.

Other posts related to Raspberry:

Ever since I bought a camera, batteries have been an issue specially while traveling. A fully charged DSLR battery is enough for up to 1000 photos or more if used properly. But in places without electricity like when camping and cold weather, battery charge is an issue. I found out during my last trip to Lahaul Spiti that batteries lose their charge in cold weather much faster even when not in use and specially with long exposure shots. So I’ve been looking for a way to charging DSLR batteries while traveling without access to electric supply. There is some information on internet, but nothing really useful. Most people just prefer carrying 3-4 extra batteries or a complicated setup of wires and adapters for the purpose..

But I found 2 gadgets which make camera battery charging much easier with minimal amount of work and expense required. So there is no cutting, joining wires or similar work, just simple plug and play.

1) First is a portable solar panel easily available from a number of online retailers. I bought a 21 W capacity panel like this. These panels have 1 or 2 USB ports for output and weigh less than half a KG. Mine came with 4  carabiners and has 4 slots which makes it easy to just sling across the backpack or any surface. The USB slots are inside a pocket which is pretty handy of storing cables and charger or to keep them away from sun while charging. There are multiple type with different capacities and weight, but it’ll be preferable to get one with maximum wattage possible. It seems to be water resistant and strong. While hiking, it can be just attached to the rucksack and charge batteries while you walk. It will probably be useful on some DIY projects in home too.

2) 2nd is a DC input charger for the camera battery. Canon and Nikon DSLRs both have different batteries and will have different chargers. Mine is Nikon D7100 with EN-EL15 battery and I got EN-EL15 DC charger. Most Canon DSLRs will use LP-E8 batteries and these chargers will work LP-E8 DC charger. None of the chargers available are manufactured by camera companies themselves and the build quality is not great. Atleast the one I got is Chinese made and looks like one. But it’s working while it works. It has slots for two batteries as visible in picture below, but I’ve used only one till now. While charging the display shows a level and blue backlight. For some reason, it fluctuates while connected to solar panel and stable if connected to a phone charger, but charging seems fine either way.

These chargers use DC as their input supply unlike the normal chargers which use AC. If you have a normal phone charger or a power bank, these battery chargers will work with those too. If you’re willing to carry a high capacity power bank like these with you, you can use the setup to charge your batteries even at night. There are also some solar power banks available with an attached solar panel. But it’s another KG or so of additional weight with lower capacity.

Next step is just to plug the USB cable of charger in to the USB slot of panel and place it in sun. As I’m writing this, this setup charged my Nikon EN-EL15 battery from 60% to 100% in 150 minutes. But it took 3 hours yesterday to charge the battery from 20% to 62%.  So even with good amount of sunlight, there seem to be some fluctuations. It’s also a good charger for other gadgets like phones, tablets etc. My 4 years + old Samsung tablet gets fully charged in 70-80 minutes with this panel.

The pictures below is the charging setup in action. Taken by a phone camera in very bright sun , so not very clear but good enough for the purpose. The red LED inside pocket lights up whenever the panels are exposed to sun.

Solar charging for camera battery

Solar panel pocket

This post is a follow up of my previous post about using Raspberry pi as a media server and a torrent box. Since last time, I’ve managed to fix up most of the problems that came up and now my Raspberry Pi setup is working well as a media server and torrent box. The major update is that the whole rig sits inside an old metal ammunition box. I went out of city for 4-5 days twice in last 6 weeks after turning it on and the whole thing worked extremely well.  It boots up and starts all required processes in case of a power failure without any intervention. As of now it’s not accessible from internet, but I’d rather keep it this way . May be if something comes up in near future then I might think about enabling connections from other networks, but it’s pretty much adequate for now. I had taken some pictures while doing all this, but can’t  find them.
Since last time, I’ve moved the whole set up in to an old metal ammunitions box salvaged from a junkyard. The boxes were not exactly in good shape.  Dust and random debris was everywhere and there were big patches of rust where paint had been chipped off. So my first job was to clean the boxes by a blower, then washing them with water. Later on, I applied some rust remover on rust patches to clean away as much rust as possible. After this point, I applied a coat of clear spray paint on whole box.  It prevents further rusting and creates a nice shiny coat.
Next I bought an extension cord and took out the cord. After fixing the board inside ammunition box, I drilled a hole in the box using my drill, hammer and a file. It wasn’t an easy job with the tools I had. Proper tools for this kind of work in such a metal box are way too expensive. It isn’t exactly clean, but does the job. Now as I’m writing this, I now realise that the hole should’ve been bigger but too lazy to change it now. Next step was to solder the wire of extension cord back which was unexpectedly more difficult than I anticipated. Rest was pretty easy. Hard disk is placed on a aluminum heat sink salvaged from an old graphics card. Rest of the stuff like Raspberry Pi, USB hub and extension board are stuck using double sided tape to interior of box. This whole setup by  itself is pretty rugged and can take some rough handling apart from the power adapter which is a bit loose in extension board.
I was also thinking about installing a cooling fan to dissipate some heat, The fan from that old graphics card is just right for the job. It can be powered by attaching it to a USB cable powered by the USB hub. It’s voltage rating is higher but it ran perfectly fine on 5 V when tested. But the temperature of Raspberry Pi never exceeded 51 degrees even in  40 degrees weather, so dropped the idea.
I’ve also installed Kodi on it and now it can be connected to the TV via HDMI and media played live. Streaming as described above works too, but finding a particular file to play can be difficult when you have a large number of files with no proper naming convention. Kodi can also be accessed over HTTP but haven’t had the time to check the functions yet.  Attached to TV via HDMI, it works pretty well. All of this can be controlled via TV remote or any of dozens of Android apps. The whole setup remains mostly powered on unless I am not streaming, downloading or seeding something. Pi can be shutdown remotely but haven’t tried to enable remote power on option yet.
After purchasing a Netflix subscription, it seems that this box will not be as heavily used, but is still pretty vital considering the limited library available in India.
Following configuration changes were made since last post:
1) Transmission as a torrent client and it’s web interface start automatically at each boot up.
2) File sharing service Samba for accessing files on attached hard disk from other computers on network.
3) miniDLNA for streaming media to other devices.
4) Health and running status of setup can be checked via NoMachine and Android applications based on ssh.
Following are configuration files, mostly for my record:
# Sample configuration file for the Samba suite for Debian GNU/Linux.
# This is the main Samba configuration file. You should read the
# smb.conf(5) manual page in order to understand the options listed
# here. Samba has a huge number of configurable options most of which
# are not shown in this example
# Some options that are often worth tuning have been included as
# commented-out examples in this file.
#  – When such options are commented with “;”, the proposed setting
#    differs from the default Samba behaviour
#  – When commented with “#”, the proposed setting is the default
#    behaviour of Samba but the option is considered important
#    enough to be mentioned here
# NOTE: Whenever you modify this file you should run the command
# “testparm” to check that you have not made any basic syntactic
# errors.
#======================= Global Settings =======================
## Browsing/Identification ###
# Change this to the workgroup/NT-domain name your Samba server will part of
   workgroup = WORKGROUP
# Windows Internet Name Serving Support Section:
# WINS Support – Tells the NMBD component of Samba to enable its WINS Server
#   wins support = no
# WINS Server – Tells the NMBD components of Samba to be a WINS Client
# Note: Samba can be either a WINS Server, or a WINS Client, but NOT both
;   wins server = w.x.y.z
# This will prevent nmbd to search for NetBIOS names through DNS.
   dns proxy = no
#### Networking ####
# The specific set of interfaces / networks to bind to
# This can be either the interface name or an IP address/netmask;
# interface names are normally preferred
;   interfaces = eth0
# Only bind to the named interfaces and/or networks; you must use the
# ‘interfaces’ option above to use this.
# It is recommended that you enable this feature if your Samba machine is
# not protected by a firewall or is a firewall itself.  However, this
# option cannot handle dynamic or non-broadcast interfaces correctly.
;   bind interfaces only = yes
#### Debugging/Accounting ####
# This tells Samba to use a separate log file for each machine
# that connects
   log file = /var/log/samba/log.%m
# Cap the size of the individual log files (in KiB).
   max log size = 1000
# If you want Samba to only log through syslog then set the following
# parameter to ‘yes’.
#   syslog only = no
# We want Samba to log a minimum amount of information to syslog. Everything
# should go to /var/log/samba/log.{smbd,nmbd} instead. If you want to log
# through syslog you should set the following parameter to something higher.
   syslog = 0
# Do something sensible when Samba crashes: mail the admin a backtrace
   panic action = /usr/share/samba/panic-action %d
####### Authentication #######
# Server role. Defines in which mode Samba will operate. Possible
# values are “standalone server”, “member server”, “classic primary
# domain controller”, “classic backup domain controller”, “active
# directory domain controller”.
# Most people will want “standalone sever” or “member server”.
# Running as “active directory domain controller” will require first
# running “samba-tool domain provision” to wipe databases and create a
# new domain.
   server role = standalone server
# If you are using encrypted passwords, Samba will need to know what
# password database type you are using.
   passdb backend = tdbsam
   obey pam restrictions = yes
# This boolean parameter controls whether Samba attempts to sync the Unix
# password with the SMB password when the encrypted SMB password in the
# passdb is changed.
   unix password sync = yes
# For Unix password sync to work on a Debian GNU/Linux system, the following
# parameters must be set (thanks to Ian Kahan <<kahan@informatik.tu-muenchen.de> for
# sending the correct chat script for the passwd program in Debian Sarge).
   passwd program = /usr/bin/passwd %u
   passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
# This boolean controls whether PAM will be used for password changes
# when requested by an SMB client instead of the program listed in
# ‘passwd program’. The default is ‘no’.
   pam password change = yes
# This option controls how unsuccessful authentication attempts are mapped
# to anonymous connections
   map to guest = bad user
########## Domains ###########
# The following settings only takes effect if ‘server role = primary
# classic domain controller’, ‘server role = backup domain controller’
# or ‘domain logons’ is set
# It specifies the location of the user’s
# profile directory from the client point of view) The following
# required a [profiles] share to be setup on the samba server (see
# below)
;   logon path = \\%N\profiles\%U
# Another common choice is storing the profile in the user’s home directory
# (this is Samba’s default)
#   logon path = \\%N\%U\profile
# The following setting only takes effect if ‘domain logons’ is set
# It specifies the location of a user’s home directory (from the client
# point of view)
;   logon drive = H:
#   logon home = \\%N\%U
# The following setting only takes effect if ‘domain logons’ is set
# It specifies the script to run during logon. The script must be stored
# in the [netlogon] share
# NOTE: Must be store in ‘DOS’ file format convention
;   logon script = logon.cmd
# This allows Unix users to be created on the domain controller via the SAMR
# RPC pipe.  The example command creates a user account with a disabled Unix
# password; please adapt to your needs
; add user script = /usr/sbin/adduser –quiet –disabled-password –gecos “” %u
# This allows machine accounts to be created on the domain controller via the
# SAMR RPC pipe.
# The following assumes a “machines” group exists on the system
; add machine script  = /usr/sbin/useradd -g machines -c “%u machine account” -d /var/lib/samba -s /bin/false %u
# This allows Unix groups to be created on the domain controller via the SAMR
# RPC pipe.
; add group script = /usr/sbin/addgroup –force-badname %g
############ Misc ############
# Using the following line enables you to customise your configuration
# on a per machine basis. The %m gets replaced with the netbios name
# of the machine that is connecting
;   include = /home/samba/etc/smb.conf.%m
# Some defaults for winbind (make sure you’re not using the ranges
# for something else.)
;   idmap uid = 10000-20000
;   idmap gid = 10000-20000
;   template shell = /bin/bash
# Setup usershare options to enable non-root users to share folders
# with the net usershare command.
# Maximum number of usershare. 0 (default) means that usershare is disabled.
;   usershare max shares = 100
# Allow users who’ve been granted usershare privileges to create
# public shares, not just authenticated ones
   usershare allow guests = yes
#======================= Share Definitions =======================
   comment = Home Directories
   browseable = no
# By default, the home directories are exported read-only. Change the
# next parameter to ‘no’ if you want to be able to write to them.
   read only = yes
# File creation mask is set to 0700 for security reasons. If you want to
# create files with group=rw permissions, set next parameter to 0775.
   create mask = 0700
# Directory creation mask is set to 0700 for security reasons. If you want to
# create dirs. with group=rw permissions, set next parameter to 0775.
   directory mask = 0700
# By default, \\server\username shares can be connected to by anyone
# with access to the samba server.
# The following parameter makes sure that only “username” can connect
# to \\server\username
# This might need tweaking when using external authentication schemes
   valid users = %S
# Un-comment the following and create the netlogon directory for Domain Logons
# (you need to configure Samba to act as a domain controller too.)
;   comment = Network Logon Service
;   path = /home/samba/netlogon
;   guest ok = yes
;   read only = yes
# Un-comment the following and create the profiles directory to store
# users profiles (see the “logon path” option above)
# (you need to configure Samba to act as a domain controller too.)
# The path below should be writable by all users so that their
# profile directory may be created the first time they log on
;   comment = Users profiles
;   path = /home/samba/profiles
;   guest ok = no
;   browseable = no
;   create mask = 0600
;   directory mask = 0700
   comment = All Printers
   browseable = no
   path = /var/spool/samba
   printable = yes
   guest ok = no
   read only = yes
   create mask = 0700
# Windows clients look for this share name as a source of downloadable
# printer drivers
   comment = Printer Drivers
   path = /var/lib/samba/printers
   browseable = yes
   read only = yes
   guest ok = no
# Uncomment to allow remote administration of Windows print drivers.
# You may need to replace ‘lpadmin’ with the name of the group your
# admin users are members of.
# Please note that you also need to set appropriate Unix permissions
# to the drivers directory for these users to have write rights in it
;   write list = root, @lpadmin
path = /hdd
browseable = yes
   read only = no
   guest ok = yes
path = /hdd/hd1
browseable = yes
   read only = no
   guest ok = yes
# Package generated configuration file
# See the sshd_config(5) manpage for details
# What ports, IPs and protocols we listen for
Port 22
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes
# Lifetime and size of ephemeral version 1 server key
KeyRegenerationInterval 3600
ServerKeyBits 1024
# Logging
SyslogFacility AUTH
LogLevel INFO
# Authentication:
LoginGraceTime 120
PermitRootLogin without-password
StrictModes yes
RSAAuthentication yes
PubkeyAuthentication yes
#AuthorizedKeysFile %h/.ssh/authorized_keys
# Don’t read the user’s ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
# For this to work you will also need host keys in /etc/ssh_known_hosts
RhostsRSAAuthentication no
# similar for protocol version 2
HostbasedAuthentication no
# Uncomment if you don’t trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes
# To enable empty passwords, change to yes (NOT RECOMMENDED)
PermitEmptyPasswords no
# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no
# Change to no to disable tunnelled clear text passwords
#PasswordAuthentication yes
# Kerberos options
#KerberosAuthentication no
#KerberosGetAFSToken no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes
X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no
#MaxStartups 10:30:60
#Banner /etc/issue.net
# Allow client to pass locale environment variables
AcceptEnv LANG LC_*
Subsystem sftp /usr/lib/openssh/sftp-server
# Set this to ‘yes’ to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of “PermitRootLogin without-password”.
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to ‘no’.
UsePAM yes
TRANSMISSION settings.json
    “alt-speed-down”: 50, 
    “alt-speed-enabled”: false, 
    “alt-speed-time-begin”: 540, 
    “alt-speed-time-day”: 127, 
    “alt-speed-time-enabled”: false, 
    “alt-speed-time-end”: 1020, 
    “alt-speed-up”: 50, 
    “bind-address-ipv4”: “”, 
    “bind-address-ipv6”: “::”, 
    “blocklist-enabled”: false, 
    “blocklist-url”: “http://www.example.com/blocklist“, 
    “cache-size-mb”: 4, 
    “dht-enabled”: true, 
    “download-dir”: “/mnt/hd2/dl”, 
    “download-limit”: 100, 
    “download-limit-enabled”: 0, 
    “download-queue-enabled”: true, 
    “download-queue-size”: 5, 
    “encryption”: 1, 
    “idle-seeding-limit”: 30, 
    “idle-seeding-limit-enabled”: false, 
    “incomplete-dir”: “/mnt/h5/dl”, 
    “incomplete-dir-enabled”: false, 
    “lpd-enabled”: false, 
    “max-peers-global”: 200, 
    “message-level”: 1, 
    “peer-congestion-algorithm”: “”, 
    “peer-id-ttl-hours”: 6, 
    “peer-limit-global”: 200, 
    “peer-limit-per-torrent”: 50, 
    “peer-port”: 51413, 
    “peer-port-random-high”: 65535, 
    “peer-port-random-low”: 49152, 
    “peer-port-random-on-start”: false, 
    “peer-socket-tos”: “default”, 
    “pex-enabled”: true, 
    “port-forwarding-enabled”: true, 
    “preallocation”: 1, 
    “prefetch-enabled”: 1, 
    “queue-stalled-enabled”: true, 
    “queue-stalled-minutes”: 30, 
    “ratio-limit”: 2, 
    “ratio-limit-enabled”: false, 
    “rename-partial-files”: true, 
    “rpc-authentication-required”: false, 
    “rpc-bind-address”: “”, 
    “rpc-enabled”: true, 
    “rpc-password”: “{87gj106666666h98i8h;lo666666666662″, 
    “rpc-port”: 9091, 
    “rpc-url”: “/transmission/”, 
    “rpc-username”: “transmission”, 
    “rpc-whitelist”: “192.168.1.*”, 
    “rpc-whitelist-enabled”: false, 
    “scrape-paused-torrents-enabled”: true, 
    “script-torrent-done-enabled”: false, 
    “script-torrent-done-filename”: “”, 
    “seed-queue-enabled”: false, 
    “seed-queue-size”: 10, 
    “speed-limit-down”: 100, 
    “speed-limit-down-enabled”: false, 
    “speed-limit-up”: 100, 
    “speed-limit-up-enabled”: false, 
    “start-added-torrents”: true, 
    “trash-original-torrent-files”: false, 
    “umask”: 18, 
    “upload-limit”: 100, 
    “upload-limit-enabled”: 0, 
    “upload-slots-per-torrent”: 14, 
    “utp-enabled”: true

A few weeks back I bought a Raspberry Pi 2 with a vague idea of using it as a device for downloading torrents and streaming videos. Using a PC for this work seems like an overkill. But work, travel and other stuff didn’t leave enough time and I could work on this project only for a few minutes every week. There were  a few problems and it delayed the whole project further. But after some effort, almost everything is ready and working fairly well. There are still some things which need to be sorted out, but it meets my needs for now. I will keep on tinkering to improve and sort out the kinks. This post is about the equipment, it’s configuration and use. I am not writing down all the details as most of procedures I used are easily found on internet. To begin with, I bought the following stuff:

Raspberry Pi 2 Board.
A plastic case.
Power adapter and USB cable.
A USB WiFi adapter.
HDMI cable.
HDMI to VGA adapter.
Cat5 Ethernet cable.
A memory card with OS pre-installed.
A pen drive I already had. Will replace it later with a hard disk.
Used keyboard, mouse and monitor of my existing PC.

1st Phase, WiFi:

First step of the project was to assemble everything and connecting it up to a monitor which was trivial. essentially it becomes a matchbox sized personal computer. As the seller had already installed an OS on it, I just booted and started working. But the WiFi adapter included just refused to work. I must have spent more time on this adapter troubleshooting than rest of the steps combined. Then I gave up on it, reset the system and downloaded a new version of OS. Surprisingly my older and new USB Wifi adapters both worked fine without any need of installing any drivers.
2nd Phase, Command Line and GUI access:

Once connectivity issue was solved, I configured SSH server and installed NoMachine for remote GUI login as unplugging and plugging in monitor and keyboard wires was becoming annoying. SSH had some problem in beginning, but was fixed easily. After this, I could access the Raspberry from my phone and PC. NoMachine can also be used from android.
3rd Phase, External Storage :

Adding this was pretty straight forward. Make a folder, mount it, apply necessary permissions and make it mount on every boot.
4th Phase, Torrent client :

Installed a torrent client, Transmission. I needed a torrent client which can be accessed via a web GUI. There are 3-4 options available and I tried them all before settling on Transmission. I still can’t get the web interface to run on every boot, but I am working on it and hopefully will be able to sort it out soon. I also tried Deluge and rTorrent, but wasn’t really satisfied with them. In the meanwhile, Transmission works fairly well.
5th Phase, External IP access:

Another step which I still haven’t figured out is how to allow access to Raspberry from an external network. I have downloaded and installed NoIp client which works well. But for some reason, port forwarding is not working as it should. So I can control the setup only when I’m connected to home network. It’s not really a big issue right now and I expect it to be solved soon.

6th Phase, Media Server:

Next step is to stream the videos to my TV and android tablet. Thankfully, it’s a smart TV so there is no need to buy another gadget like Chromecast to enable networking. Enabling this feature on Raspberry pi was achieved by installing MiniDLNA. Takes 2-3 minutes to install and configure. My android tablet can stream movies to TV but can’t play streaming videos by default. I tried ES File Explorer first which worked, but didn’t really liked it that much as it seemed too bloated. Installed iMediaShare which works pretty well.

So this is the basic overview of my new setup of downloading movies and watching them on TV and android tablet. I can access media on my Raspberry Pi, Tablet and  Still needs some fine tuning but does the job for now.

Unless you have been living under a rock, you must have heard about some telecom providers like Airtel  offering certain kind of “free” internet.  This sounds like a great deal to a few people, but it violates all the principles of a non-discriminatory internet infrastructure. In medium to long term, it will lead to monopoly of a few corporates over internet instead of free and fair utility it is right now. Getting greedy corporates like Airtel get away with it will mean that in a few months, subscribers will be paying separately for different services like Email, Skype, Facebook, Whatsapp, p2p and so on. Your net connection will not enable to use  your internet according to your needs, but according to which company paid your ISP more. Read more dteails about it on following link:


First, if there is licensing of Internet services, or even some Internet services, then it will impact the ability of Internet businesses and startups to remix multiple types of services like messaging and video: a fitness application linked to a band might need a government license in order to allow a customer to message a trainer, or a separate license to offer video within the application. This is what the TRAI calls “OTT licensing”.

Second, if telecom operators are allowed to discriminate between different Internet companies or types of Internet services, it will mean that some services which pay them will be faster and others slower, some might be more expensive to access and others cheaper, and some might be more visible or accessible than others. This is what Net Neutrality is about.

Net Neutrality in India

Net Neutrality in India

To gather opinion of citizens, TRAI has issued a set of 20 questions in a document which can be downloaded from following link : http://www.trai.gov.in/WriteReaddata/ConsultationPaper/Document/OTT-CP-27032015.pdf

I have copied the questions and attempted to answer them to the best of my knowledge. Normally I don’t care about campaigns on internet, but this is one campaign which can work due to it’s basic nature. You can send your own answers to TRAI on advqos@trai.gov.in before 24th May. Take action before it’s too late.


Question 1: Is it too early to establish a regulatory framework for OTT services, since internet penetration is still evolving, access speeds are generally low and there is limited coverage of high-speed broadband in the country? Or, should some beginning be made now with a regulatory framework that could be adapted to changes in the future? Please comment with justifications.

Answer: No. Yes. Internet is a rapidly evolving system with path breaking changes every few years. Originally a communications medium limited to emails and online forums (bulletin boards), it has changed to include online commerce (Ebay, Amazon, Flipkart), information source (Wikipedia), academic source (University and online courses), 24 hours connectivity (Whatsapp, Viber), Social media (Facebook, Orkut, Twitter) and new such applications are being added everyday. Making any guidelines which will encompass every such application will be difficult, but needs to be done to avoid misuse by any of the parties involved.

Question 2: Should the OTT players offering communication services (voice, messaging and video call services) through applications (resident either in the country or outside) be brought under the licensing regime? Please comment with justifications.

Answer: No. Data packets on their own should not be discriminated according to the content they are carrying. There should be no such restriction.  OTT players offering communication services ( Whatspp, Viber, Facebook) are providing a type of communications service and telecom companies are providing a platform to access it. Latter should not be allowed to interfere in any way. Allowing this will be like allowing bus operators to charge extra from passengers who want to visit a car dealership compared to passengers visiting a movie hall in the same building. Using the data should be choice of consumer, not telecom companies.

Question 3: Is the growth of OTT impacting the traditional revenue stream of TSPs? If so, is the increase in data revenues of the TSPs sufficient to compensate for this impact? Please comment with reasons.

Answer: Maybe. Yes. Continuing from point 2, TSPs are now trying to make more money by riding on the success of OTTs.  TSPs provide a route to access the services offered by an OTT and should be allowed to charge for that service only. They should not be allowed to charge differently for different categories. When automatic exchanges were installed, was there any rule which prohibited their use citing loss of employment to manual exchange operators ? Did rising popularity of cellular phones led to any subsidies or help for landline phone manufacturers ?

Question 4: Should the OTT players pay for use of the TSPs network over and above data charges paid by consumers? If yes, what pricing options can be adopted? Could such options include prices based on bandwidth consumption? Can prices be used as a means product/service differentiation? Please comment with justifications.

Answer: No. Internet has become such a big part of the world economy because it is free and doesn’t require massive investments by small players and team of legal experts. All they need is to offer a good product and it will become successful. Ebay, Google, Facebook and various other services were started by individuals/small parties who had an unique idea and were able to present it to the world without jumping through numerous legal hoops. Any restriction, licensing and suggested pricing will make such innovations difficult and will be a net loss for humanity. If OTTs are made to pay, then only big companies with deep pockets will control the internet and should be avoided at all costs.

Question 5: Do you agree that imbalances exist in the regulatory environment in the operation of OTT players? If so, what should be the framework to address these issues? How can the prevailing laws and regulations be applied to OTT players (who operate in the virtual world) and compliance enforced? What could be the impact on the economy? Please comment with justifications.

Answer: Not sure that there even is a proper law in India which is useful in this context yet. Only laws that most people including me are draconian laws which are meant to stifle freedom of speech like 66-A. Telecom laws which were meant to “regulate” services like voice, telegraph, radio etc. can’t be modified to properly address issues of internet.

The regulatory environment, if any should learn from the success story of Indian mobile sector, but should be more flexible and liberal to make sure that India takes advantage of  opportunities offered by internet instead of stifling innovation in the name of regulations and laws.

Question 6: How should the security concerns be addressed with regard to OTT players providing communication services? What security conditions such as maintaining data records, logs etc. need to be mandated for such OTT players? And, how can compliance with these conditions be ensured if the applications of such OTT players reside outside the country? Please comment with justifications.

Answer: Not sure. Every new technology will bring in new set of security related challenges like mobile phones did to the world of landline phones. While security issues are important, progress should not be held hostage. In current world, specially internet connected one, physical boundaries play little role. Restrictions if any can be easily circumvented by knowledgeable people and novices alike. Don’t put any incentive for people to break the law, make it easy to use internet and it will grow.

Question 7: How should the OTT players offering app services ensure security, safety and privacy of the consumer? How should they ensure protection of consumer interest? Please comment with justifications.

Answer: From point 4, OTTs who provide good service will become popular while others will die out. Google even with it’s huge infrastructure couldn’t prevent Orkut from closing down. Companies need a revenue stream but it should not involve collection or sale of private or identifiable data of users. Users should not be treated as identifiable individuals or ethnic groups.

Question 8: In what manner can the proposals for a regulatory framework for OTTs in India draw from those of ETNO, referred to in para 4.23 or the best practices summarised in para 4.29? And, what practices should be proscribed by regulatory fiat? Please comment with justifications.

Answer: The details mentioned seem to be highly counterproductive and the regulations proposed are almost the same as being demanded by TSPs. Like mentioned in point 3, TSPs are scared of losing their business or profit margins to a brand new technology which provides a greater degree of freedom, convenience and value to consumers.  Role of TSPs was and still is a  connecting medium between OTTs and consumers and they are getting paid by latter for this.  TSP revenues should be generated from their role as a NEUTRAL connecting medium, not a broker.

Question 9: What are your views on net-neutrality in the Indian context? How should the various principles discussed in para 5.47 be dealt with? Please comment with justifications.

Answer: Net neutrality should be non-negotiable and TSPs should not be allowed to take money for OTTs or provide discriminatory  treatment to any protocol or service. For users, TSPs should declare their data policies and it should be verifiable by regulatory independent bodies as well as the users themselves. Purpose of TSPs is to provide a medium between users and service providers and it should remain as such. They should not be allowed to take bribes from either party as they are demanding now. TSPs which are found to be violating these guidelines should be penalised.

Question 10: What forms of discrimination or traffic management practices are reasonable and consistent with a pragmatic approach? What should or can be permitted? Please comment with justifications.

Answer: None. Interests of consumers are much more important, not only for a good market but also for overall growth of the sector and country as a whole. TSPs should not be allowed to form cartels which they do to control prices. The pricing structure which is implemented on voice traffic is fairly good, not perfect but it works. data traffic should not be treated differently.  Nothing that I can think of or being presented is justifiable. Data should not be discriminated or managed according to it’s content.

Question 11: Should the TSPs be mandated to publish various traffic management techniques used for different OTT applications? Is this a sufficient condition to ensure transparency and a fair regulatory regime?

Answer: Different OTTs have different protocols of communication.  If  details about traffic management techniques used for different OTT applications are made public, it should help to make sure that TSPs are not doing any throttling or discrimination in any hidden way.

Question 12: How should a conducive and balanced environment be created such that TSPs are able to invest in network infrastructure and CAPs are able to innovate and grow? Who should bear the network upgradation costs? Please comment with justifications

Answer: TSPs should concern themselves with providing a good, efficient infrastructure only and they should bear the costs like it’s supposed to. Government can oversee regulations and implementation of rules.

Question 13: Should TSPs be allowed to implement non-price based discrimination of services? If so, under what circumstances are such practices acceptable? What restrictions, if any, need to be placed so that such measures are not abused? What measures should be adopted to ensure transparency to consumers? Please comment with justifications.

Answer: No. Not acceptable. See point 4. Any discrimination, whether based on price, speed or quality of service will be good only for large corporations while act as barrier for small players and innovation. Progress and innovation are more important than profit margins of TSPs.

Question 14: Is there a justification for allowing differential pricing for data access and OTT communication services? If so, what changes need to be brought about in the present tariff and regulatory framework for telecommunication services in the country? Please comment with justifications.

Answer: No. See points 4, 13.

Question 15: Should OTT communication service players be treated as Bulk User of Telecom Services (BuTS)? How should the framework be structured to prevent any discrimination and protect stakeholder interest? Please comment with justification.

Answer: No. See point 4, 13.Charging OTTs or customers with differential pricing is just the same thing.

Question 16: What framework should be adopted to encourage India-specific OTT apps? Please comment with justifications.

Answer: India doesn’t even have good quality web hosting companies located in India due to weak infrastructure and pain in the neck regulations. When rest of the world is enjoying streaming TV via services like Netflix and Hulu, we still find it hard to watch Youtube videos. India specific websites comparable to Facebook, Google will work when:

  • There is good internet infrastructure in which data costs (Rupees per MB) should be reasonable according to Indian incomes.Right now, our voice tariffs are among lowest in world  but most uneconomical for data.
  • Local languages are encouraged. A vast majority of Indians don’t know English and incentives to encourage innovations in usage of local Indian languages will help in increasing the reach of internet in India.
Rest is dependent on education, creation of helpful business environment which is beyond the scope of this discussion.

Question 17: If the OTT communication service players are to be licensed, should they be categorised as ASP or CSP? If so, what should be the framework? Please comment with justifications.

Answer: They should not be licensed. From the relevant section “The TSPs contend that unless there is a revenue flow, they do not have an incentive to maintain or upgrade the network”

This is just a scare tactic. Revenue flow is coming from the users who are paying TSPs to access OTTs. If there are no OTT’s, customers will have no incentive to pay TSPs for the bandwidth either. Similarly, if TSPs decide to ignore innovation and upgrades, customers will not pay them. This is a net loss to customers, OTTs and to TSPs.

Question 18: Is there a need to regulate subscription charges for OTT communication services? Please comment with justifications.

Answer: OTTs are free to charge anything as long as there is a level playing field and they are not able to form cartels.

Question 19: What steps should be taken by the Government for regulation of non-communication OTT players? Please comment with justifications.

Answer: There is no pressing need for any such regulation. See point 4.

Question 20: Are there any other issues that have a bearing on the subject discussed ?

Answer: From point 16, India needs a better communications infrastructure for connectivity within the country as well as with rest of the world. We need more undersea cables controlled by different telecom operators connected to different countries unlike present conditions where we have very few which are controlled by a few TSPs. Last mile connectivity needs to be improved too. As of now, only a few big cities have good last mile connectivity with multiple options of TSPs. Smaller towns and villages need more investments.