Photo Interrupter - Item Counter
This project is a simple item counter using an infrared photo interrupter.
Equipment :
EB006 Programmer – Standard configuration with PIC 16F877A
EB002 - Screw Terminal Board
EB 005 - LCD Display Board
The sensor is a Sharp GP1A57HRJ00F Photo interrupter
Gap = 10mm
It is mounted on a Sparkfun PPBOB-09322 Break-Out Board
This has a 220-ohm resistor and the 3 connections on a small PCB
This assembly was mounted on a small Protoboard along with a reset switch
(This is configured in the same way as the switches on the EB007 switch board)
The sensor and BOB were obtained from Proto PIC in the UK
Program :
The program used here is a simple test routine to verify the hardware
The sensor is connected to ADC0.
With no objects between the Tx & Rx the output is high, when something passes through the gap the output goes lows.
This is read and the count value incremented by 1.
I have used an integer variable for Count, as it may well need to go passed 255
NOTE
In FC5 I have actually used an unsigned integer, this is because
1 It will never have to be a negative value
2 It allows a much bigger count value to be used.
The reset switch is connected to Port A bit 1.
A decision at the start of the loop checks the state of the bit.
Low – No action
High – Reset count to zero.
The version posted here is in Flowcode 4.
Operation :
By moving an object though the gate, the count will be seen to increase.
The speed of the objects through the gate and the delay statement may need adjustment to suit a specific application.
It will not detect transparent items.
The direction of travel through the gate does not have any effect on the reading (i.e. in from the top or the bottom)
I believe the sensor is fairly well insulated, but care should be taken if using it to count metal items.
Photo Interrupter Item Counter
Moderator: Benj
-
- Posts: 1314
- Joined: Sun Jan 15, 2012 3:15 pm
- Has thanked: 474 times
- Been thanked: 458 times
- Contact:
Re: Photo Interrupter Item Counter
hi john
nice read, i love using photointeruptors i used to use them to build simple fishing bite alarms, they are so versatile and used extensively in the photocopier industry from simple things like paper detection to timers and speed control(scanner position detection speed and movement control), one thing i would say is if you know anyone who services photocopiers see if they can get you a couple, as a variety are used from 5 to 24v and also positive and negative triggered, and a variety of mounting options the most common being two prongs on the front and 2 clips on the back, with a seperate 3 pin connector. they will be fine for counting metal parts as long as the connections are well insulated
nice read, i love using photointeruptors i used to use them to build simple fishing bite alarms, they are so versatile and used extensively in the photocopier industry from simple things like paper detection to timers and speed control(scanner position detection speed and movement control), one thing i would say is if you know anyone who services photocopiers see if they can get you a couple, as a variety are used from 5 to 24v and also positive and negative triggered, and a variety of mounting options the most common being two prongs on the front and 2 clips on the back, with a seperate 3 pin connector. they will be fine for counting metal parts as long as the connections are well insulated
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php
- JohnCrow
- Valued Contributor
- Posts: 1367
- Joined: Wed Sep 19, 2007 1:21 pm
- Location: Lincolnshire
- Has thanked: 364 times
- Been thanked: 716 times
- Contact:
Re: Photo Interrupter Item Counter
HI Dazz
Thanks for the comments.
This is the first time I've used one of these. I was ordering some other components and just spotted the PI on the website, so I ordered on to have a play with.
Just knocked up a simple test program today to try it out.
Thanks for the comments.
This is the first time I've used one of these. I was ordering some other components and just spotted the PI on the website, so I ordered on to have a play with.
Just knocked up a simple test program today to try it out.
1 in 10 people understand binary, the other one doesn't !