![]() |
![]() |
|
|
#1 |
|
New Member
Join Date: Mar 2009
Location: Leicester
Posts: 3
|
A draughts sorter (there's useful!) constructed from fischertechnic parts, with a homebrew reflective IR sensor to detect and identify draughts, controlled by a Picaxe-18X on a Picaxe project board (lurking under the red platform at the left-hand side).
![]() I've been buying fischertechnik bits on eBay, and I fancied building something with a conveyor belt. There's a video of the thing in action here: http://www.youtube.com/watch?v=kxGT2cTRUIY Code:
'Draughts Sorter 'DJW/exartemarte Jan 2010 'Constants symbol min_red_level = 50 'Lower threshhold of IR light reflected from red platform symbol max_red_level = 100 'Upper threshhold of IR light reflected from red platform '(Reflected IR light is measured on platform at base of chute) '(Below lower threshhold > black draught) '(Above upper threshhold > white draught) '(Within threshholds > no draught) symbol black_delay = 10 'No of conveyor belt clicks before pushing black draught off belt symbol white_delay = 22 'No of conveyor belt clicks before pushing white draught off belt 'Variables symbol light_level = b0 'For ADC value (reflected light level) read from IR sensor symbol conveyor_count = b1 'For counting conveyor belt clicks while draught is on belt 'I/O Assignments symbol IR_sensor = 0 'Measures reflected IR to identify black/white/no draught symbol belt_counter = input1 'Microswitch clicked continuously as belt motor rotates symbol draught_push_sw = input2 'Limit switch for motor that pushes drafts onto belt symbol black_push_sw = input6 'Limit switch for motor that pushes draughts off belt into black box symbol white_push_sw = input7 'Limit switch for motor that pushes draughts off belt into white box 'Note: limit switches are off while pushing, on in rest position symbol IR_led = 0 'Illuminates draught platform at base of chute symbol belt_motor = 1 'Drives conveyor belt symbol draught_push_motor = 2 'Pushes draughts from base of chute onto conveyor belt symbol black_push_motor = 3 'Pushes draughts from conveyor belt into black draught box symbol white_push_motor = 4 'Pushes draughts from conveyor belt into white draught box init: gosub initialise 'make sure push motors are zeroed and IR source is on wait_for_draught: switch off belt_motor 'stop the conveyor while there are no draughts check_draught_colour: readadc IR_sensor,light_level 'get IR level reflected from platform at base of chute if light_level < min_red_level then black_draught 'if it's below red then it's a black draught if light_level > max_red_level then white_draught 'if it's above red then it's a white draught goto wait_for_draught 'if it's red then there's no draught black_draught: switch on belt_motor 'make sure the belt is moving gosub push_draught_onto_belt 'push the draught onto the belt conveyor_count = 0 'draught is now on belt do 'so zero the count gosub one_belt_count 'and count conveyor belt pulses loop until conveyor_count >= black_delay 'until they get to the required number gosub push_black_draught_off_belt 'then push draught off belt into box goto check_draught_colour 'all done, so go to check the next draught. white_draught: switch on belt_motor 'make sure the belt is moving gosub push_draught_onto_belt 'push the draught onto the belt conveyor_count = 0 'draught is now on belt do 'so zero the count gosub one_belt_count 'and count conveyor belt pulses loop until conveyor_count >= white_delay 'until they get to the required number gosub push_white_draught_off_belt 'then push draught off belt into box goto check_draught_colour 'all done, so go to check the next draught. one_belt_count: do loop until belt_counter is on 'wait until belt pulse switch goes on pause 10 'debounce do loop until belt_counter is off 'wait until belt pulse switch goes off again pause 10 'debounce conveyor_count = conveyor_count + 1 'then increment the count return 'and exit. push_draught_onto_belt: switch on draught_push_motor 'start pushing the draught off the platform onto the belt pause 200 'let the push motor get past the limit switch do loop until draught_push_sw is on 'wait until the switch goes on again (= push completed) switch off draught_push_motor 'then switch off the motor return 'and exit. push_black_draught_off_belt: switch on black_push_motor 'start the push motor pause 400 'wait until the motor gets past the limit switch do loop until black_push_sw is on 'wait until the push cycle is completed switch off black_push_motor 'then switch off the motor return 'and exit. push_white_draught_off_belt: switch on white_push_motor 'start the push motor pause 400 'wait until the motor gets past the limit switch do loop until white_push_sw is on 'wait until the push cycle is completed switch off white_push_motor 'then switch off the motor return 'and exit. initialise: 'make sure push motors are zeroed and IR source is on do while draught_push_sw is off switch on draught_push_motor loop switch off draught_push_motor do while black_push_sw is off switch on black_push_motor loop switch off black_push_motor do while white_push_sw is off switch on white_push_motor loop switch off white_push_motor switch on IR_led return |
|
|
|
|
|
#2 |
|
Senior Member
Join Date: Jan 1970
Location: UK
Posts: 2,558
|
Vary neat and hypnotic!
Next step will be to get it multitasking - adding them to the belt continuously, and taking them off when they get to the right place. Maybe more than one PICAXE? I love your 'pushing' mechanism! Andrew |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Jan 1970
Location: Middle England
Posts: 2,717
|
What an excellent project.
And, an excellent website. My congratulations. e |
|
|
|
|
|
#4 |
|
Technical Support
Join Date: Jan 1970
Location: UK
Posts: 13,555
|
Superb viewing. Excellent project.
|
|
|
|
|
|
#5 |
|
Senior Member
Join Date: Jan 1970
Location: Christchurch, New Zealand
Posts: 748
|
I love it. Great project. Well done.
![]()
__________________
I thought I was wrong once ........ but I was mistaken! |
|
|
|
|
|
#6 |
|
New Member
Join Date: Jan 2010
Location: Denmark
Posts: 1
|
absolutely brilliant..... weldone
|
|
|
|
|
|
#7 |
|
New Member
Join Date: Dec 2009
Location: UK
Posts: 11
|
Really good project. Probably still quicker to sort that number by hand though, haha.
Get multitasking sorted and make the number it can manage more and it'll be even better! Well done ![]()
__________________
Daniel Saul "No electronics engineer looks at a television remote without wondering what it would take to turn it into a stun gun." |
|
|
|
|
|
#8 |
|
New Member
Join Date: Mar 2009
Location: Leicester
Posts: 3
|
Thanks.
As it happens, I'm just documenting this for my fledgling website and thinking about version 2. I don't envisage any hardware changes, so it won't handle any more draughts (getting draughts sorted was never really a serious requirement!), but the sensing will be improved, I hope - less susceptible to ambient light - and it should be able to deal with more than one draught on the belt at a time (that's the tricky bit). Watch this space! |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|