Early counting starts through Babbage and then counting numbers were invented, than manually people started count things. Now its digital era and we count things digitally. Previously in manually counting their are problems. One have to stand for hours to count people and vehicles passing through certain area, also he can lose data if his attention goes some where else. This project is best example of accuracy and reducing man power on extra stuff of counting.
Digital counter project requirements
- 8051 (89c51 or 89c52) microcontroller
- 16×2 lcd
- crystal (11.0592 Mhz)
- LDR (Light dependent resistor)
- Resistor 5K
- Bread board or PCB for circuit designing
- Power supply
- Potentiometer (For seeting led contrast)
- Connecting wires
Some tutorials related to the project. Like interfacing 16×2 lcd with 89c51 microcontroller, it working modes and operating commands. The tutorials will help you in understanding the code below.
Object/People counter with 89c52 microcontroller – Circuit Diagram
89c51 digital counter sensor
8051 microcontroller Object counter code
The code is simple first i included the necessary header file reg<51.h> . If you are coding in keil ide for 8051 microcontroller then this library is must to be included in your source code. Then checkconditions() function is initialized. This function is checking if the person is crossed through the path or not. Then single sbits are defined for enable , register select and read write pins of 16×2 lcd. pcount variable is initialized for connecting our logic circuit to Port-2 pin-0. Delay() function is generating some delay to be used where needed. lcdcmd() fuction is sending commands to lcd. lcddata() function is sending data to lcd. lcdint() is initializing the lcd. Then at last main function is defined.
When you are all done by making circuit and burning hex code in microcontroller now its time to see the result. Upon starting the program you will see text “DOOR COUNTER!!!” displayed on the first line of the 16×2 lcd. On second line there is nothing. Now move your finger and cut the light falling on the light dependent resistor. You will see number displayed on the screen and ever time you cut the light the number is incremented by one.
Filed Under: 8051 Microcontroller, Microcontroller Projects