------------------------------------------------------------------------------ CoinCountB.c Written by Andreas Dreier (alias ®³) for CC8 (second entry) 05.02.2005 ------------------------------------------------------------------------------ This bot reuse parts from my first entry of CC8. It was my first idea to realize the given exercise. But it was to slow :-( So I build the other type of bot (CoinCountA) and send it first to CC8 committee. After I heard, that there was a elongation of CC8 deadline ... I reconstruct the bot CoinCountA and use two main parts for CoinCountB: Seperation unit with conveyor belt and sorting unit with collecting slots :-) CoinCountB used two different additional parts: Feeder unit and other type of scanning unit. It realized my first solution of given exercise. The main problem was to detect the coin type. All coins have nearly the same thickness and some of them had the same colour. The eseast way to detect the right coin was the diameter of the coin! But the difference between some of them was to less to detect it on the direct way. My idea was to expand this difference of diameter! I solve this, by using two straight line which are closer on the left side than on the right side. The coins entered this tow staight lines from right side and stoped after touching tho upper line and clamped between the two lines. By this way, every coin of European currency will stop at a different place. A light sinsor, wich is parallel to the lower line, moved from right to left and detected the right and left side of the coin. So I can detect with this two informations which kind of coin are detected :-) Next problem was to release the coin from this detection area. I solved this by the same way: The detection unit moved to left end of rail and lift up the upper line for releasing the coin :-) Please take a look to the pictures and videos, which are linked at the end of this documentation. This bot will count, detect and calculate a lot of coins. It detect all eight different coins of the European currency: EURO-Coins 1 ct = 0.01 € Coins of the following countries are supported: 2 ct = 0.02 € - Austria - Italy 5 ct = 0.05 € - Belgium - Luxembourg 10 ct = 0.10 € - Finland - Netherlands 20 ct = 0.20 € - France - Portugal 50 ct = 0.50 € - Germany - Spain 1 € = 1.00 € - Greece 2 € = 2.00 € - Ireland >>>>> 96 different coins :-) ------------------------------------------------------------------------------ How does it works? The process will seperated into 4 tasks: 1. Isolate the coins --> Isolation unit 2. Serve the coins --> Feeder unit 3. Scan the coins --> Scanner unit 4. Sort the coins --> Sorting unit +--------------------------+ | Isolation | | Coins unit | | | | | \ V / | +-------------------+ | \ / | | Feeder unit | | \ OOOOOO/ | | | | \ OOOO/ | | \ O / | | O O O O S2L | | S1 \ / | | MB-------------------------------------------- o ______|__________ >>> | conveyor belt | | MC| | +--------------------------+ | | | | | +-------------------+ +------------------+- | Scanner | | *._ unit | | "*._ | | "*._ | +--------------------------------------+ | O "'._ | | Sorting unit | >>> ----------------------------| | | | |1ct 2ct 10ct 5ct 20ct 1€ 50ct 2€ | | +--|--+ | +--------------------------------------+ | |S2 S3| | | | | | | | | | | | | | | | | | | ---| |------ | | | | | |O| |O| | | | | | | |O| | | M3| | |O| | | |O| |O| | | |O| | | |O| | +-----+ | |O| |O| |O| |O| |O| |O| |O| |O| +------------------+ +-+ +-+ +-+ +-+ +-+ +-+ +-+ +-+ ------------------------------------------------------------------------------ I have build a little machine, which realize this. The heart of this bot is the LEGO Mindstorms RCX. The machine consists of 3 motors, 1 rotation sensors and 2 light sensors. This devices are connected on the following scheme: +-----------------------+ Sensors: | +---+ +---+ +---+ | | |Lgt| |Lgt| |Rot| | S1 : Light sensor of feeder unit | |Fed| |Sen| |Sen| | | +---+ +---+ +---+ | S2 : Light sensor of sensor unit | 1 2 3 | | View Prgm | S3 : Rotation sensor for sensor unit | +-----------+ | | | -8888 X 8 | | Motors: | +-----------+ | | On-Off Run | MA : Motor for feeder unit | A B C | | +---+ +---+ +---+ | MB : Motor for conveyor belt | |Mot| |Mot| |Mot| | | |Fed| |con| |Sen| | MC : Motor for sensor unit | +---+ +---+ +---+ | +-----------------------+ ------------------------------------------------------------------------------ On which way will the bot count the coins? Short description: The conveyour belt will serialize the coins and fill the feeder unit. The Feeder unit will send coin by coin into the scanning unit where the RCX recognize the type of coin. On the last step the coin will released by the scanner unit and sorted into the slots of the sorter unit. Detail description: The program contains four background processes, which controlls the counting process of coins: P1 : Feeding of coins P2 : Displaying values of sensor values P3 : Displaying status of coin detector sensors P4 : Main control program P1: This background process delivers the coins from conveyor belt to feeder unit. If no coin is available at feeder unit, the motor of conveyor belt (MB) will be started. It stops, if there is recognized a coin at the light sensor (S1) at feeder unit. If there will be no coin delivered for MAX_WAIT_FOR_COIN from conveyor belt, the delivering process will stop. P2: I build this background process for debugging case. It shows the value of the selected Sensor. You can select the sensors by pressing the button VIEW at RCX: 0 - no refresh for sensor value (default) 1 - Display value of light sensor for feeder unit 2 - Display value of light sensor for scanning unit 3 - Display value of rotation sensor for scanning unit. P3: This background process shows the status of both light sensors. It shows, by setting quarters at the circle on RCX, if there is a coin at the sensor. The lower right quarter will symbolize the coin at sensor S1 - the lower left quarter shows, if there is a coin at sensor S2. P4: Main background process! This process controls the delivery of coins from feeder unit into scanner unit, scanning of coins and releasing into the sorter unit. This process will divided into several steps: 1. Initialize global variables 2. Fill the queue of feeder unit 3. While coins are available do: 3.1. Get next coin from feeder unit into scanning unit 3.2. Scan the coin - get the coin type, display result and release it 4. Calculate the total time for scanning process of all coins 5. Display the result within a endless loop ------------------------------------------------------------------------------ Additional functions: By pressing the button VIEW you can show the sensor values: 0 - no periodically update of display (normal function) 1 - show value of rotation sensor S1 (vertical position of sensor) 2 - show the raw value of sensor S2T and S2L 3 - show value of rotation sensor S3 (relative position to legt end) ------------------------------------------------------------------------------ Display update for a normal process: Init << Initialize the bot Repeat until coins are available SErvE << Serve next coin from feeder to scanner unit ScAn << Start of scan process 1 ct .. 2 EUR << Show the detected coin type #0.00€ << Show the actual total amount Repeat for all coins: xxxxx << Show the name of the coin ###0n << Show the number of the coin #0.00€ << Show the amount of the coin TOTAL << Start of displaying of total displaying ###0n << Show the total count of coins #0.00€ << Show total amount of all coins #0.00t << Show total time of scanning process End << End of Program (after pressing RUN button) ------------------------------------------------------------------------------ Electrical parts: 1 RCX 1 Rotation sensor 2 Light sensor 3 9V Power motor 71427c01 ------------------------------------------------------------------------------ Programming: brickOS 0.2.6 Why? Because brickOS is the best programming language For the RCX! Many thanks to Marcus L. Noga and all the people who developed brickOS! ------------------------------------------------------------------------------ Pictures of the TypeWriter: Album: http:festum.de/1000steine/myimages/CC8B Video: http:festum.de/1000steine/album/CC8B/CC8b_Action_seperator_unit.mov http:festum.de/1000steine/album/CC8B/CC8b_Action_feeder_unit_2.mov http:festum.de/1000steine/album/CC8B/CC8b_Action_scanner_unit.mov http:festum.de/1000steine/album/CC8B/CC8b_Action_sorter_unit.mov http:festum.de/1000steine/album/CC8B/CC8b_Action_sorter_unit.mov http:festum.de/1000steine/album/CC8B/CC8b_Feeder_unit_detail.mov http:festum.de/1000steine/album/CC8B/CC8b_Filling_feeder_unit.mov http:festum.de/1000steine/album/CC8B/CC8b_Filling_feeder_unit1.mov http:festum.de/1000steine/album/CC8B/CC8b_LCD_scanner_in_action.mov Photo: http:festum.de/1000steine/album/CC8B/TotalView1.jpg http:festum.de/1000steine/album/CC8B/SeperatorUnit.jpg http:festum.de/1000steine/album/CC8B/FeederUnit.jpg http:festum.de/1000steine/album/CC8B/ScannerUnit.jpg http:festum.de/1000steine/album/CC8B/SorterUnit.jpg http:festum.de/1000steine/album/CC8B/SeperationUnit1.jpg http:festum.de/1000steine/album/CC8B/SeperationUnit_coins.jpg http:festum.de/1000steine/album/CC8B/FeederUnit_backstage.jpg http:festum.de/1000steine/album/CC8B/FeederUnit_motor_sensor.jpg http:festum.de/1000steine/album/CC8B/FeederUnit_Step1.jpg http:festum.de/1000steine/album/CC8B/FeederUnit_Step2.jpg http:festum.de/1000steine/album/CC8B/FeederUnit_Step3.jpg http:festum.de/1000steine/album/CC8B/FeederUnit_Step4.jpg http:festum.de/1000steine/album/CC8B/ScannerUnit_DetailMotor1.jpg http:festum.de/1000steine/album/CC8B/ScannerUnit_DetailMotor2.jpg http:festum.de/1000steine/album/CC8B/Scanning_1_WaitForCoin.jpg http:festum.de/1000steine/album/CC8B/Scanning_2_CoinArrives.jpg http:festum.de/1000steine/album/CC8B/Scanning_3_ScanReady.jpg http:festum.de/1000steine/album/CC8B/Scanning_4_ReleaseCoin.jpg http:festum.de/1000steine/album/CC8B/SortingUnit1.jpg http:festum.de/1000steine/album/CC8B/SortingUnit_backstage.jpg ------------------------------------------------------------------------------ If you need more information about the bot or the programming ... please feel free to contact my by mail: andreas (at) dreier-privat (dot) de ------------------------------------------------------------------------------