laser or InfraRed?
So, my Automated Chicken Coop is going well. In other posts on this forum i hhave discussed the automated doors and lighting with LED's etc.
These are running very well and are saving lots of time and effort.
My next upgrade will be to automated the feed.
I am quite keen to utilise either infrared or lasers to do the following.
Imagine if you will a storage container with two lasers/infrared sensors. One near the top the other near to the bottom.
When the bottom beam is open or unbroken then this will turn a servo, opening a butterfly valve to allow feed to drop. when the the top beam is broken and the feed has reached the required max then the valve closes.
This system is used on our boimass boiler to fill the hopper with wood chip before it gets dragged via an auger into the furnace side.
Any advice on which route to go down would be appreciated as would tips on the right components/tutorials etc.
My first thougts are to use a laser shining onto a photoresistor and calculate the differences in the values of the laser light hitting it and when its blocked by feed to define when the motor open and closes the valve.
I know there will be a multitude of different ways to acheive the same goal. I just think this way is quite aethestically pleasing.
Many thanks
Alex
I would go the infrared route to keep the mechanics simple. Using a laser, I can imagine what might be involved in creating a housing for the laser that may take up a lot of space and configuration vs. an led sized, simple IR emitter. IR would also eliminate any beam aiming except perhaps needing a tube to house the receiver to shield the receiver from the IR signal bouncing all over the hopper and have the receiver 'look' only at the transmitter. - Scotty
Recognize that a laser can be in the IR region - they come in various frequencies (we are most used to the visible ones like red and green, but high power CO2 IR lasers are often used for metal cutting etc.)
I suppose utilising the IR receiver and emmiter i could still code it in a similar way? would i need to know the specific frequency of the IR emmiter to have within the code or do they just send back HIGH or LOW signals?
Thinking about it a simple breakbeam configuration would suffice i think the distance is probable only gooing to be 10" between emitter and receiver so i don't think that will be a factor too much.
I think the other thing i'll need to be carefull of is the feed falling from the hopper breaking the beam beforre it's full.
MaverickAlex:
Would I need to know the specific frequency of the IR emitter to have within the code or do they just send back HIGH or LOW signals?
You don't need to have any reference to the frequency/wavelength in the code. That is irrelevant.
You do need to ensure that the emitter and detector both operate on same frequency/wavelength.
The HIGH/LOW signal comes from the detector, not the emitter.
thanks John, i suppose if i buy them as a pair they're not guaranteed to be the same frequencies. Aside from sticking them on an oscillation machine is there an easy way to find out they are on the same frequency.
When you purchase IR receivers, part of the spec is the frequency that they are set up for.
MaverickAlex:
thanks John, i suppose if i buy them as a pair they're not guaranteed to be the same frequencies. Aside from sticking them on an oscillation machine is there an easy way to find out they are on the same frequency.
They are often sold as matched pairs. If so all is well and good.
If not you might have to resort to looking at the datasheet of both devices.
The emitter will emit at a specific frequency/wavelength.
The detector will operate over a range of frequencies/wavelengths.
As long as the transmitted frequency is within the range of of the detector, then it should work satisfactorily.
I think the other thing i'll need to be carefull of is the feed falling from the hopper breaking the beam before it's full.
Perhaps it can be done incrementally:
Bottom beam unbroken?
Feed hopper for 5 seconds.
Ignore top beam detect during feed.
Feed off.
Is top beam broken?
If not, feed hopper for 5 seconds.
Ignore top beam during feed.
Feed off.
Repeat until:
Is top beam broken?
If yes, go to beginning.
One thing that you need to be aware of, is that over a period of time, dust from the foodstuff will accumulate on both the emitter and detector.
This may eventually cause the system to fail.
You aught to make sure that in your mechanical design, that you can easily clean the emitter and detector, using something such as a small paintbrush.
Unfortunately you can't see the degradation, as the IR is invisible.
Scotty that would seem a logical way to code it thanks.
John, thanks. i'll manufacture the housing so both the emitter and detector are removable for periodic cleaning.
I have odered a couple of pairs of the following:
ADA 2167
Sensing Distance: Approx 25cm / 10"
Power Voltage: 3.3 - 5.5VDC
Emitter Current Draw: 10mA @ 3.3V, 20mA @ 5V
Output Current Capability of receiver: 100mA sink
Transmitter/Receiver LED Angle: 10°
Response Time: <2 ms
Dimensions: 20mm x 10mm x 8mm / 0.8" x 0.4" x 0.3"
Cable Length: 234mm / 9.2"
Weight (of each half): ~3g
gpsmikey,unfortunately the datasheet is in chinese so i don't know if the frequency is on it or not, we'll see when they arrive.
Thanks again for your valued input.
Alex
I'd use cheap (red) laser diodes, as used in laser pointers. Then you have visual control over the beam, and can use a photo resistor as receiver. Visual control seems important to me, just to control (avoid) reflections reaching the receiver. It's hard to find out how reflective some surface or material (food) is, with invisible IR light.
These diodes don't require special circuitry, you simply power them by about 5V, that's all. If full brightness is not required, a resistor can be added to reduce the current, just like you would do with a LED.
I think laser is a bit over kill!, plus it would have a very small target area which means the dust will clog the beam or defrock it very quickly.
IR would be fine, IR source at one side, and a IR receiver at the other , only needs to be frequency modulated if you have multiple sensors in the same optical path.
DrDiettrich: I have ordered a small laser to test that possibility as well as the IR sensors mentioned above.
It will be interesting to see which method proves most reliable during testing.
I've got to struggle through the coding first which is always my worst part.
I'd like to be able to code it as Scotty mentions above but my skills aren't that advanced as yet.
here's where i am so far.
/* chicken feeder using two infrared detectors inside a hopper, when the lower beam
is unbroken the valve is opened by a stepper motor to release feed.
When the feed breaks the upper beam the stepper motor closes the valve.
*/
//Lets specify the pins to use.
// The Motor
const byte feedMotorOpen = 40; //pin to stop the motor
const byte feedMotorClose = 41; //pin to start the motor
const byte feedMotorEnable = 42; //pin to enable the motor via the L298N motor driver
// The infraRed Sensors
const byte topIRsensor = 43;
const byte bottomIRsensor = 44;
// declaring the variables
unsigned long feedTimerstate = 0;
unsigned long feedTimerbegin = 4000;
void setup() {
Serial.begin(9600); // initialize serial port hardware
// set the motors at the start of the program
pinMode(feedMotorOpen, OUTPUT);
pinMode(feedMotorClose, OUTPUT);
pinMode(feedMotorEnable, OUTPUT);
// set the IR detectors at the start of the program
pinMode(topIRsensor, INPUT);
digitalWrite(topIRsensor, HIGH);
pinMode(bottomIRsensor, INPUT);
digitalWrite(bottomIRsensor, HIGH);
}
// *****Functions*****
void openFeeder() {
if ((unsigned long)(millis() - feedTimerstate) >= feedTimerbegin) { //
feedTimerstate = millis();
if (digitalRead(bottomIRsensor) == HIGH && digitalRead(topIRsensor) == HIGH) {
digitalWrite (feedMotorOpen, HIGH);
}
else {
digitalWrite(feedMotorClose, HIGH);
}
}
}
void loop() {
openFeeder();
}
ignore the motor part as i haven't decided whether to go for a stepper or servo motor to control the butterfly valve yet.
Alex
For a laser dirt or powder is a very big problem as mentioned.
Same goes for ir, in this situation a large optical apature is desirable, either several detectors or optics, lenses or reflectors with glass windows, just like a torch in fact.
A note on coding:
I'd use ON and OFF for the motor states, instead of LOW and HIGH, just for clarity. You can #define these identifiers as suitable for your motor controller, on top of your code. Similarly for the sensors.
When the top beam is broken while filling, a single beam near the bottom would be sufficient. As soon as that beam is not broken, open the reservoir for a certain time, sufficient to fill the box (almost) entirely. The rest depends on what happens when the box is full. When this stops more food from falling into the box, everything is fine. Only when a full box prevents the valve from closing, means are required to prevent the box from filling up entirely.
Also watch how the box empties. When the outlet is in the middle, the food may form a cone that never uncovers the lower beam. Similarly for the top shape after filling the box.
Also consider to add some wiper mechanism, to remove dust from the sender and sensor.
What is the particle size of your feed.?
If it is small enough powder/ bulk sensing devices may be more suitable.
With a high water content capacitive sensing would appear to fit the bill.
You can make a capacitance meter with an arduino using no extra parts.
particle size is about 5mm x 5mm and although not particularly dusty i'm sure it will be enough to eventually be an issue.
I'm planning to house the sensors in brass tubes with glass ends. (I snap the globe from car sidelights and silicone them into the tube)
This makes the sensor easy to remove and clean (it's how ive done the photoresistor for the door opener)
Alex
When the top beam is broken while filling, a single beam near the bottom would be sufficient. As soon as that beam is not broken, open the reservoir for a certain time, sufficient to fill the box (almost) entirely. The rest depends on what happens when the box is full. When this stops more food from falling into the box, everything is fine. Only when a full box prevents the valve from closing, means are required to prevent the box from filling up entirely.
i had planned to install the top sensor far enough below the feed valve that it wouldnt overfill and cause an issue.
In my code how do i ignore the top sensor for a set period of 4000ms?