Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Arduino Based Product Counter with LCD IR and LDR Report
03-03-2012, 11:30 AM
Post: #1
Arduino Based Product Counter with LCD IR and LDR Report
The objective of this project is to develop a product
counter that can efficiently count the products and display in LCD. The project
is based on the mechanism of variation of voltage across a LDR when a product
or opaque body is placed between LDR and an IR transmitter. ATMEG 368
microcontroller based Arduino board keeps monitoring the change of voltage and
whenever there is a change above threshold( i.e. a product is placed in
between) the system increases the count and displays in LCD. Also the display
can be seen in PC through Serial Communication.



Attached File(s)
.docx  PRODUCT COUNTER.docx (Size: 1.14 MB / Downloads: 30)

Why pay internet charges for every device?
Try out WiFiGrassy for a day and share Internet Connection Effectively
Find all posts by this user
Add Thank You Quote this message in a reply
   

09-27-2012, 02:51 PM
Post: #2
RE: Arduino Based Product Counter with LCD IR and LDR Report
I'm very new to this, but from what I see (and my failure to get your code to compile in Arduino 1.0.1) I don't have the Header files you reference in your code?
( #include <LiquidCrystal.h> and #include "Timer.h")

where can I find this code?

other than it doesn't work for me, I like the idea and your explanation of theory and practice is good, thanks!

Find all posts by this user
Add Thank You Quote this message in a reply
   

09-27-2012, 04:00 PM
Post: #3
Complete code for Arduino based Product counter
    C Programming
#include <LiquidCrystal.h>
 
const int BACK_LIGHT = 13;          // Pin 13 will control the backlight
const char* MESSAGE = "Grasshopper";
char str[16]="Count=%d";
char data[16]="Analog Value:";
const int MESSAGE_LENGTH = 11;
const int DISPLAY_WIDTH = 16;
int count=0;
 
Timer t;
int pin = 13;
int val=0;
int STATE=-1;  //1 means ready for count 
 
int irEvent=-1;
// Connections:
// RS (LCD pin 4) to Arduino pin 12
// RW (LCD pin 5) to Arduino pin 11
// Enable (LCD pin 6) to Arduino pin 10
// LCD pin 15 to Arduino pin 13
// LCD pins d4, d5, d6, d7 to Arduino pins 5, 4, 3, 2
LiquidCrystal g_lcd(12, 11, 10, 6,5, 4, 3);
 
void setup()
{
    pinMode(BACK_LIGHT, OUTPUT);
    digitalWrite(BACK_LIGHT, HIGH); 	// Turn backlight on. 
			        	// Replace 'HIGH' with 'LOW' to turn it off.
    g_lcd.begin(16,2);                  	// Start with a blank screen
 
    Serial.begin(9600);
    g_lcd.clear();
    delay(10000);
}
 
void loop()
{
    //  g_lcd.clear();
    g_lcd.home();
 
      g_lcd.setCursor(0, 0);
      sprintf(str,"Count=%d",count);
      g_lcd.print(str);
 
 
 
      val=analogRead(0);
      if(val>900)
      {
        count++;
        delay(1000);
      }
      sprintf(data,"%s%d","Value=",val);
      g_lcd.setCursor(0, 1);
      g_lcd.print(data);
            /*
         for(i=0; i<5; i++)
        {
            g_lcd.setCursor(i, 0);
            g_lcd.print(str[s_nPosition + i]);
 
        }*/
        Serial.println("Here");
 
 
    delay(500);
}



Why pay internet charges for every device?
Try out WiFiGrassy for a day and share Internet Connection Effectively
Find all posts by this user
Add Thank You Quote this message in a reply
   

09-27-2012, 04:03 PM
Post: #4
RE: Arduino Based Product Counter with LCD IR and LDR Report
Hello Timer is an external library we build and by default it was added. You can compile without Timer.h. LiquidCrystal.h comes with arduino itself. I think the above code should run now.

In case it does not work, kindly post the exact compiler error. ( I hope that would not be required though Smile )


Why pay internet charges for every device?
Try out WiFiGrassy for a day and share Internet Connection Effectively
Find all posts by this user
Add Thank You Quote this message in a reply
   

Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)