A theoretical study has been performed to examine the possibility of generating a radial electric field at the periphery of a tokamak plasma. A localized magnetic well can be produced by a ripple coil system and electron cyclotron resonance heating (ECRH) is used to increase the ripple trapped fraction of the electrons. The magnetic field ripple is arranged in such a way that the ripple trapped electrons then drift vertically, due to del B, towards the plasma centre. A semi-analytic kinetic analysis has been performed to estimate the ECRH-induced temperature anisotropy of the electrons, which is directly related to the ripple trapping fraction; and a numerical Monte Carlo guiding centre simulation has been performed to study the generation of the radial electric field by the del B injection of the ripple trapped electrons and the E x B detrapping of them. The present study suggests that about 23 kW of ECRH power in the CDX-U device and 10 MW in ITER may be able to create a large enough radial electric field for the H mode transition.