Bitcoin mining- Should you be a miner?

bitcoin mining

In the previous article, I briefed about bitcoin and a little bit about bitcoin mining. In this, we will see how mining of bitcoin is done, what are the hardware, software and other essentials used in bitcoin mining.


What is bitcoin mining?

So far, we know that mining involves solving a cryptographic puzzle. After solving this puzzle, the block is added to blockchain. Few bitcoins are given to miner as reward for mining the block. We also mentioned that there are only 21 million bitcoins available and speculation is that last bitcoin will be mined only by year 2140. This is because, the reward for mining bitcoins half for every 210,000 blocks added to the blockchain. Around 14 million bitcoins have been mined by the end of 2017 and the rate of mining bitcoins will reduce as new blocks are added.

Continue reading “Bitcoin mining- Should you be a miner?”

BITCOIN- a brief introduction


Bitcoin is the buzz word today. Everybody is talking about it, buying, trading, investing and mining them. But, what exactly is a bitcoin and why is everyone interested in it? Is it any good? How different is it from other currencies? In this article, we will be discussing the same. At the time of writing this article, value of one bitcoin is $17044.99 and before 3 months it costs $3686. Price of a bitcoin is highly volatile.


What is bitcoin?

Bitcoin is the first cryptocurrency invented by Satoshi Nakamoto in the year 2009. A cryptocurrency is a digital currency which uses cryptography for securing the currency. It only exists electronically! Unlike actual currencies, cryptocurrencies are not backed by any government or central authorities. Which means the production, valuation and transfer of these currencies are not determined by any organization. Bitcoins are exchanged in a worldwide peer to peer network and the faith of these peers on bitcoin determines the value of bitcoin.

Continue reading “BITCOIN- a brief introduction”

Blink an led in arduino

Blink and led is the Very first program that we learn in any micro controller project. So let’s start with the same.

How to blink?

To blink an led is nothing but turning on an led and turning if off after a certain time interval. Now the question will be, How to set the time interval? In arduino, there is an inbuilt function which helps for setting time interval- delay(time_in_seconds). Using delay function, we can set a delay for particular time. At this time, the controller doesn’t perform any other task and wait for the delay function to complete its task. In this program, we set delay of one seconds.

Continue reading “Blink an led in arduino”

Variables and Constants in Arduino

In any programming we deal with a lot of data. Using variables, we can store these data for future reference and use inside the program. In this section we will discuss how to use a variable, declare  and types of variable.

A variable has a name, a value and a type. It can have different values at different instants of program but can neither have different name and type.

Declaration of Variable

Continue reading “Variables and Constants in Arduino”

Scam by software company

Disclaimer: This is not a degrading post. If this sounds to be one of them, consider it as such. Because i don’t give a damn about this anymore.

The story begins 3 months back when I receive a call from a company about a vacancy for android tutoring for freshly recruited employees in that company. I came to know about this company through my best friend. At that time he himself didn’t knew about the scam, though he warned me about some recent incidents surrounding the company.

Continue reading “Scam by software company”

How to use digital and analog pins in arduino?

As we discussed in last couple of posts, there are 13 digital input/output pins and 6 dedicated analog input pins in arduino Uno. An obvious question might rise in our mind. From where can we output analog data? Digital pins 3,5,6,9,10,11 are analog output pins. These pins can output both digital and analog data. Analog output is in the form of PWM signals.

What is a PWM signal?

PWM stands for Pulse Width Modulation. This technique uses digital signals to get analog outputs. A digital signal is nothing but ON or OFF state. ON state represents logic 1 and off state represents logic 0.  In arduino it is represented as HIGH and LOW respectively. A PWM signal is not truly analog in nature. By varying duty cycle, we produce varying analog values.

To understand PWM signal and concept of duty cycle, let us look at the square wave shown in the figure below.

This is a square wave with duty cycle = 50%

The above figure shows a square wave with 50%  duty cycle. This means that the signal is HIGH for half of the time period and LOW for rest half time period. If we vary duty cycle to 25%, we will get logic 1 for 25% of the total time period. This is how PWM signals are obtained. Using this technique we can produce values from 0 to 255 as analog outputs.

Mathematically, duty cycle = T on / (T on + T off)

Initialization of digital and analog pins

pinMode(pin, mode) command configures a specific pin in void setup() to behave either as an INPUT or OUTPUT.  An output pin can provide 40mA current to external devices which is enough to light up an LED but cannot drive devices that require large current. To connect such devices, we use special current driver circuits.

pin can be a variable name representing the pin number or the pin number itself (0 - 13).
mode can be either INPUT or OUTPUT.

Reading from and Writing on digital pins

digitalRead(pin) reads the value from a specified digital pin. The result can be either HIGH or LOW. Maximum voltage that can be given to the pin is 5V.

Syntax:      data_Input = digitalRead(pin);

digitalWrite(pin, value)  writes either logic level HIGH or LOW (Logic  1 or Logic 0 respectively) at specified digital pin. HIGH represents 5V whereas LOW represents 0V.

Syntax:     digitalWrite(pin, value); where value can be either HIGH or LOW

int led = 13; // LED connected to digital pin 13 
void setup() {
 pinMode(led, OUTPUT); // sets the digital pin as output 
 pinMode(12,INPUT); // sets the digital pin as output 

void loop() {
 int dataInput = digitalRead(12);
 digitalWrite(led, HIGH);

Reading and Writing analog values

Unlike digital pins,  we don not need to declare as INPUT or OUTPUT in void setup().

analogWrite(pin, value) writes an analog value to the pin. The pin will generate a sauare wave of specified duty cycle. The frequency of the PWM signal is approximately 490 Hz. Pins 3, 5, 6, 9, 10 and 11 are PWM channels and analogWrite operation works only on these pins.  The value for PWM can be specified as a variable or constant with value range between 0 – 255. If the value is 0, 0 volt output will be present at the output pin. If the value is 255, constant 5 volts will be present at the output pin.  Value present at the output pin can be calculated using the equation

output_voltage = ( 5 * value / 255 ), where value ranges from 0 – 255.

analogRead(pin) reads the value from the specific analog pin. It has 10 bit resolution because it has 6 channel 10 bit ADC (analog to digital converter) . 10 bit resolution means, it will map the voltage levels 0 – 5V into integer values between 0 – 1023 ( 210 -1) . This means that it can take readings of 0.0049 volts per unit (5 volts / 1024).

Here we will take input from a variable resistor connected to an analog input pin and pass the input to an LED connected to PWM output pin

int LED = 11;
int DataInput; 

void setup() {
//No initialization is necessary as it is dealing with analog

void loop() {
DataInput = analogRead(A0);
DataInput = DataInput / 4; //converting values 0 - 1023 to 0 -255
analogWrite(LED, DataInput);



Basics of Arduino Programming that you need to know before you start coding

As we have discussed in previous blog post, arduino programming is based on C language. Logical and relational operators function same as C. Language used in arduino are more readable than C. If you want to learn about arduino uno board, click here.

What are the rules to follow while writing code?

An arduino code has two main sections of code.

  1. void setup()
  2. void loop()

In void setup(), we write those lines of codes that we want to run only once. Line of codes which we use to initialize a pin, setting up baud rate and so on.

In void loop(), we write lines of codes that we want to execute infinitely. Setting a pin high or low, transmitting data etc.

If functions are used in the program, we generally write below void loop() function.

“If you are writing arduino program for first time, don’t get scared  by seeing the sample code. Most of the lines are comments that are included for readability and understanding what the line of code does.”

Arduino Programming Sample Code
Sample code in arduino IDE

Syntax for Arduino Programming

  • Most of the commands follow camelCase.
  • Use semi-colons (” ; “) to terminate a line of code.
  • Example: delay(10);
  • HIGH represents logic 1 and LOW represents logic 0.
  • Example: digitalWrite(13,HIGH);
  • Initialize all digital pins in void setup() and initialization of analog input pins (A0-A5) are not required. Use pinMode to initialize the pins.
  • Example: pinMode(13,OUTPUT);
  • To write to a digital pin, use digitalWrite and to read from a digital pin, use digitalRead.
  • digitalWrite(13,LOW);  // setting logic 0 to pin 13
  • digitalRead(12);  // reading from digital pin 12
  • To read analog data from analog pins, we use analogRead.
  • analogRead(A0); //reading from A0 pin
  • AnalogWrite writes analog value to the specified pin. Analog values are nothing but PWM signals. Pin numbers 3,5,6,9,10,11 are the 6 PWM pins in arduino Uno. AnalogWrite can only be used with these pins.
  • analogWrite(9, 254);  //This is for demonstration and not original code
  • Use variable names instead of pin numbers to improve readability and avoid confusion during programming.
  • const int ledPin = 2;
    // There are lines of code in between
  • It is always a good practice to add comments on important line of codes. If your comment fits in one line, we can use // in front of the comment. For multiple line comments, we should write comments between /* —— */
  • // This is an example of single line comment
/* This is an example of multiple line comment. This method can be used for single line comments too */

Are we ready to start arduino programming?

Well, we are almost ready.

These are some basic syntax rules that we should follow while coding. We will be discussing some of the rules in detail  in upcoming posts for better understanding.

Arduino Uno- The board where we all start to learn Arduino!

Arduino Uno is the most commonly used boards. It is the best board to start coding with arduino.  Arduino Uno is micro controller board based on Atmega 328P. Uno means “one” in Italian. Uno board is the first USB Arduino board, and is the reference model for the Arduino platform.

Working voltage of Uno is between 6 to 20 volts. We recommend to use between 7 to 12 volts. By using more than this limit can overheat the voltage regulator and damage the board. If we use less than 7 volts, then the 5 volt power pin will have less than 5 volts. Power is supplied to arduino either from usb port of pc/laptop or from 12V power adapter.

Continue reading “Arduino Uno- The board where we all start to learn Arduino!”

Arduino- where you start developing your first digital device


Arduino is an open source platform. It helps a beginner to step into the new world of electronics projects. Novice or a professional embedded system designer, arduino finds its use.  Arduino develops micro-controller based kits that are used to develop electronic devices. First development board was released in 2005. There after it has created a revolution in itself. A question might rise in one’s mind,

“Why is Arduino so popular in this industry while there are numerous micro-controller boards available in the market?”


Continue reading “Arduino- where you start developing your first digital device”