This project generates a random number in between 0 to 100 when a push button is pressed. This is a simple project and you may not find any serious applications in embedded projects. The project work is just a demonstration.

Circuit Principle of Random Number Generator using 8051 

Random number generator is a physical device which generates a number randomly in a certain limit when a button is pressed. In this project LCD (liquid crystal display) displays the number randomly when push button (which is connected P3.0) is pressed. In this, the counter is incremented from 0 to 99 at a high speed. If you press the button, then the LCD displays the current count value. As the count is incrementing at a high speed, the 8051 Microcontroller selects a random number when button is pressed.

Circuit Diagram Random Number Generator using 8051 Microcontroller

Components Required

AT89C51 (8051 Microcontroller) 8051 Programmer  Programming cable 5V Power Supply 16×2 Alphanumeric LCD 2 Ceramic Capacitors – 33pF 11.0592 MHz Crystal Push Button – 3 Electrolytic Capacitor – 10μF, 16V 10KΩ Resistor (1/4 watt) – 2 330Ω Resistor (1/4 watt) – 2 POT – 10KΩ 1KΩ X 8 Resistor Pack Connecting Wires 

Circuit Design of Random Number Generator using 8051 

The circuit is uses 8051 microcontroller, 16×2 alphanumeric LCD display, push buttons and a few passive components. The main component in this circuit is the AT89C51 Microcontroller. In the above circuit, two push buttons are connected to P3.0 and P3.1, where one push button (Random – P3.0) will generate the random number while the other pusg button (RST – P3.1) will reset the count. The LCD data pins are connected PORT2 of the microcontroller and control pins RS, RW, En are connected to P2.0, GND and P2.1 respectively. Here, the LCD is connected in 8 bit mode and that is why we need to use all the data pins of LCD. A 10KΩ Resistor, a 10μF capacitor and a push button will provide the reset circuit to the 8051 microcontroller. Two 33pF Capacitors along with a 11.0592 MHz Quarts Crystal are used to provide the oscillator to the 8051 microcontroller. Here, a 10KΩ potentiometer, which is connected to the VEE pin of LCD, is used to control the contrast of LCD. By adjusting the resistance of pot we can vary the contrast or brightness. NOTE: If you want to reduce the data lines of LCD, you can use 4 bit mode.

How to Write the Program?

Now let us see how to write the program for Random number generator using 8051 microcontroller. Initially, take a count variable of type integer and initialize the LCD in 8 bit mode. Now take an infinite while loop to repeat the program forever. Within this infinite WHILE loop take, increment the value of the integer until the button is pressed (by using another while loop).  Increment the count up to 99 and when the count reaches 100 (the upper limit), make the count to 0 and repeat the process. If you want extend the upper limit of random number generator, change the value in loop. Once the button is pressed, the count stops and the current count value is displayed on the LCD. In this program, if you want to extend the upper limit of random number generator you can make little changes in program. As we are using LCD it is possible to extend the upper limit of random number generator, whereas it is not possible to extend the upper limit if you use 2 seven segment displays (you have to increase the number of 7-Segment displays as well). 

CODE

Random Number Generator using 8051 – Circuit Simulation Video

How to Operate Random Number Generator Circuit using 8051?

Random Number Generator using 8051 Circuit Applications

This project is used in the applications where we need to generate Random number Used in noise generators Project is used as an alternative for the traditional dice while playing the games like monopoly, snake ladder.

Random Number Generator using 8051 Project Output Video

eninthala5@gmail.com I need code for this project as I am doing this project for my college, I tried to write code but its not working. If you can help me out then I will be thankful. I am trying to make same project I tried with LCD and 7 segment display. This is my mini project which i have to submit in my college before 4th april 2016 and today is 26th march 2016. So I need the code as soon as possible so that i can work on it further. Kindly, provide me the code Sir. Comment * Name * Email * Website

Δ

Random Number Generator using 8051 Microcontroller   Circuit  Code - 66Random Number Generator using 8051 Microcontroller   Circuit  Code - 62Random Number Generator using 8051 Microcontroller   Circuit  Code - 95Random Number Generator using 8051 Microcontroller   Circuit  Code - 33Random Number Generator using 8051 Microcontroller   Circuit  Code - 80Random Number Generator using 8051 Microcontroller   Circuit  Code - 73Random Number Generator using 8051 Microcontroller   Circuit  Code - 58Random Number Generator using 8051 Microcontroller   Circuit  Code - 3Random Number Generator using 8051 Microcontroller   Circuit  Code - 25Random Number Generator using 8051 Microcontroller   Circuit  Code - 59Random Number Generator using 8051 Microcontroller   Circuit  Code - 71Random Number Generator using 8051 Microcontroller   Circuit  Code - 22