How to make a Tachometer for bicycle

To make a tachometer for bicycle tachometer we will be using Arduino and reed switch as the main component. We will design the tachometer to Display Speed and also temperature. Following are the list of components required.

Parts list:

  • Arduino
  • Bicycle with reed switch
  • LCD display 16×2
  • thermometer DS18B20
  • Servo
  • resistor 1.2k Ω , 4.7k Ω
  • potentiometer 10 kΩ
  • Miscellaneous – 9V battery, cables, switch, button
  • Enclosure
  • breadboard

Note that you can omit the Servo if you do not want to display speed in graphical way.

You may refer my earlier post on how to connect LCD display, measure temperature using DS18b20 sensor and how to control servo using Arduino

How to connect 16*2 LCD display Arduino UNO

How to Measure temperature with Arduino and DS18B20 sensor?

Servo Motor Control using Arduino

Step 1: Connecting the LCD display

  • VSS –> GND Arduino
  • VDP –> 5V Arduino
  • VO –> output potentiometer (potentiometer VCC -> 5V Arduino, potentiometer GND -> Arduino GND).
  • RS –> pin 12 Arduino
  • RW –> GND Arduino
  • E –> pin 11 Arduino
  • D4 –> pin 5 Arduino
  • D5 –> pin 4 Arduino
  • D6 –> pin 3 Arduino
  • D7 –> pin 2 Arduino
  • A –> 5V Arduino with 1.2 k resistor
  • K –> GND Arduino

Step 2: Connecting the Servo

  • VCC –> 5V Arduino
  • mass –> GND Arduino
  • Data –> pin 6 Arduino

Step 3: Connecting the Thermometer

  • VCC –> 5V Arduino
  • mass –> GND Arduino
  • Data –> pin 1 Arduino

data and power is connected via a 4.7 kΩresistor

Step 4: Sensor on wheel (reed switch)

  • one end -> 5V Arduino
  • second end -> A0 Arduino and resistor 1.2 kΩ

The other end of the resistor to ground in the Arduino

Step 5: Connect the Button

  • one end –> 5V Arduino
  • second end –> A1 Arduino

If you have a different wheel diameter you have to change it. You can calculate it with this formula:

circuit = π*d*2,54 (d=diameter of your wheel, I multiplied it by 2.54 to get the result in meters).

 #include  < Servo.h>
 #include <LiquidCrystal.h>
 #include <OneWire.h>
 #include <DallasTemperature.h>

#define ONE_WIRE_BUS 1
 OneWire oneWire(ONE_WIRE_BUS);
 DallasTemperature sensors(&oneWire);

//LCD display pins
 LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
 //servo name
 Servo myservo;
 //definition of variables
  long previous, triptime, time, impulses;
  float speedometer, dist, aspeed;
  int servo;
  int screen=1;
  //If you have other diameter of wheel you need change it
  float circuit=2.0;
  double temperature;
  void setup() {

lcd.begin(16, 2);
   pinMode(A0, INPUT);
   pinMode(A1, INPUT);
   //servo definition and setting the tachometer to 0
   lcd.print("Bike tachometer");
   lcd.setCursor(5, 1);
   lcd.print("V 1.0");
   lcd.setCursor(0, 0);

void loop() {
    //if wheel turns
       //number of turns++
       //count turn time
     //count speed
     speedometer=(circuit / time)*3600.0;

    //display speed on tachometer
    void Tachometer(){
      //map speed 0-180 to servo
   servo = map(speedometer, 0, 72, 180, 0);
   //setup servo
     void Lcd(){
        //when button is clicked
         //displays speed
         lcd.setCursor(0, 1);
         lcd.setCursor(7, 1);
         //displays themperature
         lcd.setCursor(0, 1);
         lcd.setCursor(7, 1);
         lcd.print(" C");
           //displays averagr speed
         lcd.setCursor(0, 1);
         lcd.setCursor(8, 1);
         if(screen== 4){
           //diplays trip time
         lcd.setCursor(0, 1);
         lcd.setCursor(7, 1);
         lcd.setCursor(0, 0);
         //calculation of the distance
        //dislays distance

Cut the image below and stick on top of the enclosure. You need to position the servo at the Centre. Movement of the arm will indicate the speed in the tachometer for bicycle. To make it simple you can omit this part and just use the LCD to display the speed and distance only. Temperature display is also optional. May be you can add extra features one by one.


Home Automation using Arduino UNO

In this post we will be designing home automation using Arduino UNO and IR remote control device.

Components Required

  • Arduino UNO board
  • TSOP 1738 IR Remote Control Receiver
  • 1 KΩ Resistor X 4
  • 2N2222 NPN Transistor X 4
  • 1N4007 Diode X 4
  • 12 V Relay X 4 – relay board
  • Remote Control
  • Prototyping board (Bread board)
  • Connecting wires
  • 12 V Power supply

Here for remote control we will be using old TV remote.

Circuit diagram

How it works?

In this project, home automation system controls 4 different appliances with the help of a TV Remote. The working of the project is explained below.

The TSOP1738 IR Receiver Module has a built – in photo receiver, band pass filter and de-modulator. The output of the module can be readily read by a micro-controller. It supports a carrier frequency of 38 KHz. Hence, the carrier frequency of the source i.e. the remote control must be in the range of 38 KHz for it to demodulate.

First step is to decode the data from the remote control using TSOP1738 and Arduino UNO. For that, we need to use a special library called “IRremote”. Download this library from Arduino-IRremote and place it in the libraries folder of Arduino.

The next step is to decode the data of each key of the remote. For this, we will use some functions in the “IRremote” library. The following program will help us in decoding the data from each key of the remote.
NOTE: The following program is an example sketch from the “IRremote” library.

#include <IRremote.h>
int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup() {
void loop() {
 if (irrecv.decode(&results)) {
 Serial.println(results.value, HEX);
view raw

After decoding the keys, we will write the code for our final home automation system using Power key and numeric keys 1 to 4 to control 4 loads. Numeric keys will control individual loads i.e. key 1 can be used to turn ON or OFF load 1 and so on. Power key will turn ON or OFF all the loads at once.

In the code, we will compare the pressed key against the decoded values which we got earlier. If the key is matched, the corresponding load is turned ON. If the same key is pressed once again, the load is turned OFF. Similar operation is applicable for all the other keys.

Sample code

#include <IRremote.h>
const int RECV_PIN=11;
IRrecv irrecv(RECV_PIN);
decode_results results;
#define IN1 3
#define IN2 4
#define IN3 5
#define IN4 6
bool i=false;
bool j=false;
bool k=false;
bool l=false;
bool m=false;
void setup()
 pinMode(IN1, OUTPUT);
 pinMode(IN2, OUTPUT);
 pinMode(IN3, OUTPUT);
 pinMode(IN4, OUTPUT);
void loop() 
 if (irrecv.decode(&results)) 
 digitalWrite(IN1, i);
 digitalWrite(IN2, j);
 digitalWrite(IN3, k);
 digitalWrite(IN4, l)
 digitalWrite(IN1, m);
 digitalWrite(IN2, m);
 digitalWrite(IN3, m);
 digitalWrite(IN4, m);
 irrecv.resume(); // Receive the next value

How to set-up Wireless on your Raspberry Pi

Step 1: Configuring WLAN Connection

Connect you USB Wifi adapter to your Raspberry Pi. Also, ensure that you are already connected to Ethernet cable. Boot your Pi int GUI and open the terminal window. Either directly on the Pi or through SSH.

Next, check that the USB dongle is detected by your Raspberry Pi – enter the command lsusb and check the results. The Wi-Fi device should be listed as shown below:

On the desktop, double-click WiFi Config and select wlan0 as the adapter. On the Current Status tab click Scan and wait for the results. All nearby wireless networks will be listed in a new window.

Select the network you wish to connect to, enter the password in the PSK field and then click Connect. Within seconds, your Raspberry Pi should be connected relentlessly, and you can remove the Ethernet cable.

Step 2: Ensuring Wireless Adapter Connects At Start-up

When you re-boot or shut down and start your Pi again, wireless adapter will not automatically connect. Therefore, if you try to connect via SSH or VNC you will not be able to do so.

To resolve this problem, we will modify network interface file. follow the following steps in your terminal window.

sudo cp /etc/network/interfaces /etc/network/interfaces.old

This will copy the existing interfaces file, renaming it to interfaces.old. If any problem occur with the edits you make, the original can be renamed and restored.

Next, open the interfaces file in a text editor such as vi:

sudo vi /etc/network/interfaces

Update the section dedicated to your wireless device, replacing as mentioned below:

auto wlan0

allow-hotplug wlan0

iface wlan0 inet manual

wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

sudo shutdown -r now

After the change restart the Pi. Refer the screenshot below:

When the device reboots, the USB wireless dongle will automatically connect to the previously configured network!

How to get equalizer settings in Windows 10?

You are running windows media player 12 are trying to find out the equalizer settings. To get equalizer settings in Windows 10

Step 1 : Start windows media player

Step 2: Select skin as Revert.

On the menu  click on view -> Skin Chooser and select Revert as shown below

Now you have an equalizer as show below.


Windows media player with Revert skin.








How to Install Linux Bash shell on Windows 10

Latest windows update allows you to have a full Ubuntu-based Bash shell. This allows you to run the Bash shell and the exact same binaries that you would normally run on Ubuntu Linux.

To get started with bash make sure you are using correct version of Windows.

We would need Windows 10 creators update and a 64 bit version of the Windows 10.

Install Linux bash shell

To install Linix bash shell on windows follow the following steps.

Step 1 – Activate the developer mode

Update & Security > For Developers. Activate the “Developer Mode” as shown below:

enable developer mode

Step2: Enable the Windows Subsystem for Linux (Beta)

Next, open the Control Panel, click “Programs,” and click “Turn Windows Features on or Off” under Programs and Features. Enable the “Windows Subsystem for Linux (Beta)” option in the list here and click “OK.” After this it will ask you to reboot.

Step 3:

After your computer restarts, open windows command prompt and type bash as shown below. The first time you run the bash.exe file, it will prompt to accept the terms of service. The command will then download the “Bash on Ubuntu on Windows” application from the Windows Store. It will ask you to create a user account and password for use in the Bash environment.

What can you do with bash shell on windows?

  • You would be able to use standard Linux SSH utility and discard third party tool like putty.
  • You will be able to edit text with VIM from the command line, and manipulate text using Sed and Awk.
  • You can also, apt-get to manage their packages, and to install tens of thousands of Ubuntu binaries.
  • Basically its good utility for developer/administrators. These may not be very useful to general users. But if you are interested in learning Linux you can start it from here without going into the complexity to install LINUX.

Web server on raspberry pi – how to setup?


In this post I will let you know how to set up web server on raspberry pi. There are many web servers for raspberry pi. In out example we will be setting up apache web server. Apache is a popular web server application and we will install it on raspberry pi to server web pages

 Step 1 -Install APACHE

First install apache 2 package by using the following command in to the terminal

sudo apt-get install apache2 -y

 Step 2 – Test the Web Server

By default, Apache puts a test HTML file in the web folder. This default web page is served when you browse to http://localhost/ on the Pi itself, or ( IP address of Pi) from another computer on the network.

Browse to the default web page either on the Pi or from another computer on the network and you should see the following:


This means you have Apache working!

Step 3 – Changing the default Page

This default web page is just a HTML file on the filesystem. It is located at /var/www/index.html.

Navigate to this directory in the Terminal and have a look at what’s inside:

cd /var/www/html

ls -al

This will show you:


Step 4- Install Php

To allow your Apache server to process PHP files, you’ll need to install PHP5 and the PHP5 module for Apache. Type the following command to install these:

 sudo apt-get install php5 libapache2-mod-php5 -y

Now remove index.html file and add index.php with following content

<?php echo "hello world"; ?>
<?php echo date('Y-m-d H:i:s'); ?>
<?php phpinfo(); ?>

Now open the index.php page. You will get following:


You are now done setting up web server on raspberry pi which can server dynamic pages.

In the next post we will use this web server to post real time data from arduino/raspberry pi and also control different appliances from the web page.

How to install Linux on Windows 10 machine?


This blog will show you how to install Linux on Windows 10 machine without dual boot option and partitioning your hard drive. In this method we will be using a software called Virtualbox from Oracle. It will allow you to run other operating systems on top of your current OS.  You can use any version of Linux. I will be using Ubuntu 16.04.2.

Following are the high level steps required to install Linux on Windows 10.

Steps Required To Install Linux On Windows 10

Step 1 - Downloads

  • Download Oracle Virtualbox and virtual box extension pack and install from here.
  • Download Linux from here

Step 2 - Creating Ubuntu virtual machine within Oracle Virtual box. 

Install Virtualbox and create a Ubuntu virtual machine

  • Click on the "New" option on the toolbar
  • Enter a descriptive name into the "Name" box
    • Select Linux as the "Type"
    • Choose Ubuntu as the "Version".
    • Click "Next" to continue.

Choose a correct version of UBUNTU i.e 32 or 64 bit.
If VirtualBox is only showing 32 bit versions in the Version list make sure:
▪ Your Host OS is 64-bits
▪ Intel Virtualization Technology and VT-d are both enabled in the BIOS
▪ The Hyper-V platform is disabled in your Windows Feature list.

  • Allocate Memory to the virtual machine. For Ubuntu16.04.2 2 GB is sufficient but you can allocate more if you have sufficient memory.
  • Create a virtual hard drive. Select default VDI as the hard drive type. Also while selecting physical disk, you can select fixed size or dynamically allocated size. Note that there is no partitioning on your actual hard disk. All that happens is that a file is created on your computer which acts as the hard drive.

Step 3 - Install Ubuntu within Virtual box

Start the Virtual Machine. The first boot requires you to select a start-up disk. You can mount the iso file downloaded earlier. Follow step by step process of installing. I will not cover the details of installing here.

Step 4 - Install Vbox Guest edition(optional)
Download and install Virtualbox Guest Additions
Installing guest editions will help you scale Ubuntu properly in full screen mode.

How to connect 16*2 LCD display Arduino UNO

To Connect 16*2 LCD Display Arduino Uno we will use the previous project to capture temperature and display on console.

Parts required for the project:

  1. Arduino IDE to program the code and upload
  2. OneWire and DallasTemperatre library for the Arduino and DS18B20
  3. One DS18B20 digital temperature sensor
  4. Arduino UNO R3
  5. 16*2 LCD display
  6. Jumper wires
  7. Breadboard/PC/General purpose board
  8. Arduino UNO cable
  9. wires

Steps 1: Wiring Arduino and DS18B20

  • The wiring, of a 1-wire interface, is super simple.
  • The GND pin of the DS18B20 goes to GND on the Arduino. [black]
  • The Vdd pin of the DS18B20 goes to +5V on the Arduino. [red]
  • The Data pin of the DS18B20 goes to a (digital) pin of your choice on the Arduino, in this example I used Pin 7
  • Add a pull-up resistor of 4.7 KΩ. as shown in the schematic diagram. One end of resistor connecting Vdd and another end connecting data pin.

Step 2: Connecting the LCD display

  • VSS –> GND Arduino
  • VDP –> 5V Arduino
  • VO –> output potentiometer (potentiometer VCC -> 5V Arduino, potentiometer GND -> Arduino GND).
  • RS –> pin 12 Arduino
  • RW –> GND Arduino
  • E –> pin 11 Arduino
  • D4 –> pin 5 Arduino
  • D5 –> pin 4 Arduino
  • D6 –> pin 3 Arduino
  • D7 –> pin 2 Arduino
  • A –> 5V Arduino with 1.2 k resistor
  • K –> GND Arduino

 LCD display Arduino UNO breadboard diagram


Machine generated alternative text: fritzing


// Data wire is plugged into digital pin2
#define ONE_WIRE_BUS 7
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
//LCD display pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
double temperature;
void setup(void)
 //Serial.println("Temperature Demo");
 lcd.begin(16, 2);
 lcd.print("hello, WORLD");

void loop()
 sensors.requestTemperatures(); // send command to get temperatures
 temperature= sensors.getTempCByIndex(0);
 lcd.setCursor(0, 1);
 lcd.print("Temp: ");
 lcd.setCursor(7, 1);
 lcd.print(" C");

LCD display Arduino UNO Schematic

Screenshot of the Project output

LCD display Arduino UNO project screenshot