When a redox reaction is carried out indirectly, the chemical energy is converted into electrical energy. A device in which chemical energy is converted into electrical energy is called an electrochemical cell. Electrochemical cells are also known as galvanic cells or voltaic cells.
Daniell cell is an example of voltaic cell. In order to understand the basic principle involved, it  is desirable to recall definitions of oxidation and reduction and to consider some oxidation reduction reactions taking place in beakers as well as in electrochemical cells.
It is defined as a process which involves loss of electrons by a substance. The substance which loses electrons is said to be oxidised.
It is defined as a process which involves gain of electrons by a substance. The substance which gains electrons is said to be reduced.
A substance cannot lose electrons unless another substance which can gain electrons is also present in its environment. In other words, oxidation can takes place only if reduction can also take place at the same time. This can be illustrated by taking examples below.

Zn-CuS04 Redox Reaction in a Beaker (Oxidation of Zn metal by Cu2+ ions)
When a zinc rod is placed in a solution of copper sulphate as shown in Fig. it is observed that:
The zinc strip starts dissolving forming Zn2+ ions in solution. This indicates that the oxidation of zinc metal to zinc ions takes place, which is represented as :
Zn(s) —–> Zn2+(aq) + 2e …(5.1)
Simultaneously, copper starts precipitating out from the solution, indicating the reduction of Cu2+ ions which are present in solution to copper metal. This may be represented as :
Cu2+(ag) + 2e —–> Cu(s) …(5.2)
The reactions (5.1) and (5.2) are known as half-reactions, i.e., oxidation half-reaction and reduction half-reaction.
The overall redox reaction is obtained by adding the two half-reactions (5.1) and (5.2) and is written as :
Zn(s) + Cu2+(aq) —–> Zn2+ (aq) + Cu(s).
The reaction is accompanied by evolution of heat, i.e., reaction is exothermic and thus ∆H is negative.
But if we try to immerse copper rod in a solution of zinc sulphate we shall observe hardly any change, concluding thereby that the reverse reaction is not possible. So zinc metal can be oxidised by Cu2+ ions but copper metal cannot be oxidised by Zn2+  ions.

Redox Reaction in an Electrochemical Cell
In an electrochemical cell, the redox reaction takes place indirectly. Here, the oxidation and reduction take place in different vessels and the electrons are transferred from the reducing agent (the substance oxidized) to the oxidizing agent (the substance reduced) through connecting wires. Hence in such cells, chemical energy is converted into electrical energy. A simple laboratory form of electrochemical cell involving Zn-CuS04 reaction is shown in Fig.
Zinc rod is placed in a dilute ZnS04 solution in one beaker and copper rod is dipped in a CuS04 solution (dilute). The two solutions are connected with each other through an inverted U-tube containing a solution of potassium sulphate. This U-tube which helps to connect the two solutions with each other is called salt bridge.
If the metal rods are not connected to each other or if the salt bridge is taken out, no current flows through the ammeter and no reaction takes place in the cell. But as soon as the connection is made as shown (Fig. 5.2), the current starts flowing as indicated by the ammeter reading and the chemical reaction takes place as :
Zn(s) + Cu2+ (aq) ————> Zn2+ (aq) + Cu(s)
The current continues to flow as long as the chemical reaction continues to take place. Electricity cannot flow from one point to another unless there is a potential difference between the two points. Hence, the flow of electricity from one electrode to another electrode in any cell indicates that the two electrodes have different potentials. The difference of potential which causes flow of current from one electrode (which is at a higher potential) to another electrode (which is at a lower potential) is called the electromotive force (emf). The emf of a cell can be measured by connecting the two electrodes to the two terminals of a voltmeter. The potential difference is then read directly from the instrument. The emf is also known as cell potential and is measured in units of volts.

Chemistry Lab ManualNCERT Solutions Class 12 Chemistry Sample Papers