Simultaneous seed counting?
techstudent
Posts: 21
I am working on a seed monitor for a 12 row air corn planter, the seeds come at a rate of approx 20 per second at each row(depending on ground speed), and this is happening simultaneously at all 12 rows, The monitor should detect and display at each row if there are doubles (time between seeds is to small) and skips (if the time between seeds is to much). The other thing I want to monitor is a total count of seeds at each row for comparison purposes, to detect if a row becomes partially plugged and would have a lower count than the rest. (this count could be periodically be reset, as the purpose is just to compare to surrounding rows, and if one is lagging it should be evident after a few thousand seeds or so)
For hardware the seed sensor on the planter is Normally low (0V) and when a seed goes past, it outputs a small high pulse (5V). Thus far I am thinking of using some sort of a flip-flop arrangement to store a high when a seed goes past until the propeller scans the 12 inputs and resets the flip-flops. Also I would like to display the info on a flat screen monitor as there is not a lot of space in the tractor cab. (info on selecting a cheap rugged flat screen for use with the prop ? The monitor should be big enough to glance at while driving..)
I am pretty good with the BS2 but am fairly new to the propeller, so take it easy on me but any info on programming/hardware would be appreciated…
For hardware the seed sensor on the planter is Normally low (0V) and when a seed goes past, it outputs a small high pulse (5V). Thus far I am thinking of using some sort of a flip-flop arrangement to store a high when a seed goes past until the propeller scans the 12 inputs and resets the flip-flops. Also I would like to display the info on a flat screen monitor as there is not a lot of space in the tractor cab. (info on selecting a cheap rugged flat screen for use with the prop ? The monitor should be big enough to glance at while driving..)
I am pretty good with the BS2 but am fairly new to the propeller, so take it easy on me but any info on programming/hardware would be appreciated…
Comments
-Phil
Any info/comments are much appreciated...
''techstudent
The Propeller has 8 CPU's each CPU has 2 hardware counters..
Not that you need the speed 20HZ is really slow..
Look at the CTRA instructions maybe just what you need with a little input signal conditioning..as they are very fast.
The CTRA is a set and forget function ..
cheers ron mel oz
This is a skeleton of what I'm thinking of. The key thing is that the code needs to sit waiting at the WAITPNE 99% or more of the time. Otherwise there'll be lots of jitter in the measurements.
My two bits,
Marty
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Lunch cures all problems! have you had lunch?
Post Edited (Lawson) : 2/12/2008 2:39:26 AM GMT
I have measured the pulse width, and found that it is irregular, as the planter has an optical sensor, so it depends on the size and orientation of the seed as it goes through the sensor, so the pulse stays high state from about 4ms to 14ms (the time it takes for the seed to cross the sensor)..
The other possibility that has been mentioned is to use the WAITPNE with respect to the CNT as in the example above, also a very intriguing idea, as it would not require signal conditioning because it is waiting for a change of state. But I am wondering why spin would only suffice for 2 or 3 channels? Is this because while the cog is busy with the spin code it is temporarily distracted from monitoring inputs? Would it be possible to set a separate cog just to monitor WAITPNE, while a different cog does the computational work of seeing which pins have changed and updating according variables so that it would be possible to monitor all 12 inputs?
Thanks for all the brainstorming, any info/comments are much appreciated...
''techstudent
1. WAITCNT for next interval.
2. Increment Time.
3. Read current pin state.
4. XOR with previous state so see if any pins changed.
5. ANDN result of XOR with current state to see if any pins changed from high to low.
6. For each pin changing from high to low:
7. ······Increment count for that pin.
8. ······Record Time for that pin.
9. ······Compare Time with previous Time for that pin and record a skip or double, if necessary.
10. For each pin not changing from high to low:
11. ······Check time interval since last seed to make sure feeder isn't jammed.
12. Set previous pin state to current pin state.
13. Go To 1.
-Phil
In the object library there is a object by Jeff Martin ( Parallax engineer) it is for counting signals from Encoders. (a + b phase)
The way I understand how that works is that if you modify his code slightly in the lookup table you should be able
to get some results by using that object.. it is called encoder spin or similar..
As I said that objects as it is will NOT do what you want exactly it needs some slight modifications..
But it monitors a whole of inputs simultaneously.. similar to what Phil P explains in his post..
cheers Ron Mel OZ.
Phil, thanks for the outline, that is what I was looking for, I do understand the logic, though I am not of a software background and don't know much about Assembly, but now that I've got a propeller I have a good excuse to take the time and learn..
OzStamp, I found that object "Quadrature Encoder" I think that is the one you were referring to, it looks like it has many similarities to what I want to do, but I have much learning to do before I can fully digest the code enough to modify it for my purposes..
Fred, to account for ground speed I will use a hall effect sensor with 6 magnets mounted on the hub, so it won't be a direct comparison in time from the previous seed, but will have to factor in the ground speed (20 seeds per second is at 4mph which is avg planting speed in avg conditions)
I have done a lot with the BS2, but finally got a propeller proto board about a month ago, I have a machine shop, and a small plastics molding business, so I haven't had as much time on the propeller as I would like, but today I got it hooked up to the TV and was playing around with the graphics demo... wow what fun!! initially I was thinking of just using text and number for interface, but I may add some bar graphs and things as it looks pretty simple to figure out..
As always thanks for all the inputs.....
''techstudent