Drop coin and get power is a project in which the user can prepay for the amount of electricity he requires. It is analogous to all the prepaid system available. The concept will be useful in hotels; PGs etc. were the customer usually has to pay a fixed amount even if he didn’t use electricity that much. Using this project the customer will be paying only for the consumed electricity. Here in this project the person has to drop coins as per his power requirement. The number of coins dropped will be displayed in the LCD. When load gets connected the power gets switched ‘ON’. The count starts decreasing simultaneously and as it reaches 0 the power supply is disconnected. A PIC microcontroller is used to control overall process. 

Block Diagram

block diagram

Components Required

  1. PIC  Microcontroller
  2. Coin Acceptor programmable
  3. Keypad
  4. LCD
  5. Relay
  6. Buzzer
  7. Current transformer


This embedded system has PIC (Peripheral Interface Controller) as the controlling unit. Here 16F887A is used. It is a 40 pin IC. In 16F877A ‘F’ stands for flash memory and ‘A’ stands for its variant.

Pin layout of 16F877A

The peripherals it has are:


  • 8k program memory.
  • 256 Bytes EEPROM.
  • 368 Bytes RAM.
  • 33 I/O pins.
  • 4 modes of oscillator.
  • 1 USART.
  • 3 Timers.
  • 1 MSSP.
  • 8 ADC inputs.
  • 2 Analog comparator.
  • 2 CCP.
  • 1 PSP.

To the UART of the microcontroller coin acceptor module- programmable 6 coin type is used. A coin acceptor is used for collecting the coins. It is programmed to detect 1, 2, 5 and 10 rupees coins. The user has to train the module by the respective manual provided with it. There is a button in side of the module were you can select the coin profile and train the module. Once trained it will be able to detect the coins inserted into it .It has inbuilt sensors which will detect coins.   The module will accept the required coins and will eject the unwanted coins. The user can insert any coins of different values or same into it. It can also be programmed so that user can specify the coin value to be inserted. The sensors inside the detector module will detect the coin through its thickness, diameter and fall time. It can also calculate the value of coins dropped. If the user wants to recharge for certain amount then that too can be achieved.

A LCD is connected to the microcontroller to display the values of the coins added 16X2 LCD is used.


It will display 16 characters in each row. It has 2 rows. To adjust the contrast a potentiometer is connected to 1, 2, 3 pins of the microcontroller. 29th pin of the microcontroller is connected to the register select pin of the LCD. It has two registers, when RS = 1 data register is selected and the data will be displayed on the LCD and when RS=0 command register is selected were other operations of LCD is selected. The 5th pin will be grounded as we will be writing to LCD. 6th pin is connected to 30th pin of microcontroller. Usually 29th and 30th pin are kept high for valid data transmission. From 7 to 14 they are 8-bit data pins which are connected to any port of the microcontroller.

Once the required amount of coins is inserted then the relay is energized through a driver circuit. Relay is an electromechanical switch. Here 5V SPDT relay is used. SPDT stands for single pole double throw. To interface with the microcontroller a driver circuit is required. The NPN transistor in the driver circuit will switch the relay from normally open to normally closed when it gets energized.

The relay will switch on the load and power is provided to that room. For the coin inserted the amount of power to be provided will be set by the microcontroller.  A current transformer will be connected to the output of the line to know the ac current consumed. The output of the current transformer will be given as input to the microcontroller. The power consumed will be calculated by the microcontroller. If the value reaches the set value the relay is disconnected and the load is turned off. Before disconnecting the load a warning message will be displayed along with a buzzer. If you want more power you can re-energize the relay by adding more coins into it.

Related Items