VISITOR IN & OUT COUNTER WITH CLOUDX MICROCONTROLLER

In this project, we create a system that counts the number of incoming and outgoing individuals in a Hall and also keeps track of the total number of people in that place. it is a simple project.

Step 1: COMPONENT NEEDED

  • CLOUDX MICROCONTROLLER
  • CLOUDX SOFTCARD
  • LCD (16x2)
  • JUMPER WIRE
  • 10K RESISTOR
  • 2 PUSH BUTTON
  • GREEN & RED LED
  • VARIABLE RESISTOR

YOU CAN GET YOUR COMPONENT HERE

Step 2: CONNECTION

LCD connection: we re going to use data 4 - data 7 pin, register select pin, enable pin.

connect RS pin to pin1 of the Microcontroller

connect EN pin to pin2 of the Microcontroller

connect D4 pin to pin3 of the Microcontroller

connect D5 pin to pin4 of the Microcontroller

connect D6 pin to pin5 of the Microcontroller

connect D7 pin to pin6 of the Microcontroller

connect Vss and led negative pin to GND

connect Vdd and led positive pin to 5v

connect the variable resistor middle pin to VE(contrast V),and the other pin to 5v and GND.

BUTTON CONNECTION: we are using pullDown resistor for BUTTON.

Connect one side pin of the button to 10k resistor and pin7 (for the visitor in entrance, you can use motion sensor, instead of button if you like.) and the other side of the button to 5v, and the other side of the 10k resistor to GND.

Do the same for (visitor out entrance )connect it to pin8.

I use red led to indicate visitor out and green led for visitor in.

connect green led to pin9 and red led to pin10.

if you have any issue with the connection you can talk to me through here

Step 3: CODING

Copy this code to your CloudX IDE

#include <CloudX\M633.h>
#include <CloudX\Lcd.h>

#define VISTORIN pin7 // connect VISITOR IN Button(sensor) to pin 7
#define VISTOROUT pin8 // connect VISITOR OUT Button(sensor) to pin 8 #define greenLED pin9 // connect Green LED to pin 9 #define redLED pin10 // connect Red LED to pin 10 #define Capacity 2000 // set maximum number of persons the Hall can contain char in[4] ; char out[4] ; char total[4]; signed int incount, outcount, totalcount; unsigned char i;
setup(){
 //setup here
 pin7Mode = INPUT;
 pin8Mode = INPUT;
 pin9Mode = OUTPUT;
 pin10Mode = OUTPUT;
 greenLED = LOW;
 redLED = LOW;
 Lcd_setting(1,2,3,4,5,6);
 Lcd_cmd(clear);
 Lcd_cmd(cursorOff);
 Lcd_writeText(1,1,"Visitor IN & OUT");
 Lcd_writeText(2,6,"Counter");
 delayMs(2000);
 Lcd_cmd(clear);
loop(){
//Program here
 if(VISTOROUT is HIGH){ //do this if a person leaves the hall
 redLED = HIGH; //turn on Red LED
 delayMs(200);
 outcount++;
 if (incount 9999) outcount = 0;
 out[0] = (outcount/1000)+ 48;//get 1st character of item in the out array
 out[1] = ((outcount%1000)/100)+ 48; //get second character of value
 out[2] = ((outcount%100)/10)+ 48; //get third character of value
 out[3] = ((outcount%100)%10)+ 48; //get fourth character of value
 redLED = LOW; //turn off Red LED
 }
 if(VISTORIN is HIGH){ //do this if a person enters the hall
 greenLED = HIGH;
 delayMs(200);
 incount++;
 if(incount > 9999) incount = 0;
 in[0] = (incount/1000)+ 48;
 in[1] = ((incount%1000)/100)+ 48;
 in[2] = ((incount%100)/10)+ 48;
 in[3] = (incount%10)+ 48;
 greenLED = LOW;
 }
 totalcount = incount - outcount; //calculate number of persons in Hall
if (totalcount <= 0) totalcount=0; //control totalcount not to go below zero
 total[0] = (totalcount/1000)+ 48;
 total[1] = ((totalcount%1000)/100)+ 48;
 total[2] = ((totalcount%100)/10)+ 48;
 total[3] = (totalcount%10)+ 48;
 Lcd_writeText(1,1,"IN:");
 Lcd_writeText(1,4, in); //display content inside in array
 Lcd_writeText(1,9,"OUT:");
 Lcd_writeText(1,13, out); //display content inside out array
 Lcd_writeText(2,1, "TOTAL: ");
 Lcd_writeText(2,8, total); //display content inside toetal array
}
}

Step 4: SHARE WITH US

Share your Achievement with us here

Share

    Recommendations

    • Optics Contest

      Optics Contest
    • Make it Glow Contest 2018

      Make it Glow Contest 2018
    • Plastics Contest

      Plastics Contest

    Discussions