------------------------------------------------------------------------------ CoinCountA.c Written by Andreas Dreier (alias ®³) for CC8 31.01.2005 ------------------------------------------------------------------------------ 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 3 tasks: 1. Isolate the coins --> Isolation unit 2. Sort the coins --> Sorting unit 3. Count the coins --> Detecting unit +--------------------------+ | Isolation | | Coins unit | | | | | \ V / | | \ / | | \ OOOOOO/ | | \ OOOO/ | +--------------------------------------+ | O O O O S2L | | Sorting unit | | MB----------------------------| | | conveyor belt | |1ct 2ct 10ct 5ct 20ct 1€ 50ct 2€ | +--------------------------+ +--------------------------------------+ | | | | | | | | | | | | | | | | | | | | |O| |O| | | | | | | |O| |O| | | |O| |O| | | |O| | | |O| |O| |O| |O| |O| |O| |O| |O| |O| +-+ +-+ +-+ +-+ +-+ +-+ +-+ +-+ +--|--+ +---| S2T |-----------------------------+ | |S1 S3| Detecting unit | +---|MA MC|-----------------------------+ +-----+ ------------------------------------------------------------------------------ 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, 2 rotation sensors, 1 light sensor and 1 touch sensor. This devices are connected on the following scheme: +-----------------------+ Sensors: | +---+ +---+ +---+ | | |Rot| |Lgt| |Rot| | S1 : Rotation sensor for left/right | |L/R| |Tou| |U/D| | | +---+ +---+ +---+ | S2L : Light sensor for coin detection | 1 2 3 | | View Prgm | S2T : Touch sensor for slot height detection | +-----------+ | | | -8888 X 8 | | S3 : Rotation sensor for up/down | +-----------+ | | On-Off Run | Motors: | A B C | | +---+ +---+ +---+ | MA : Motor for slot height detection unit | |Mot| |Mot| |Mot| | | |sen| |con| |L/R| | MB : Motor for conveyor belt | +---+ +---+ +---+ | +-----------------------+ MC : Motor for movement the detection unit ------------------------------------------------------------------------------ On which way will the bot count the coins? The bot doesn't "count" the coins - it will detect the height of the coins at the slot. On this way it can recognize all coins of a coin sort with one detection step! If it knows the height of the coin stack, it can calculate how much coins are in it :-) To reach this, the height of the stack must be realized with a very big exactness. This will be reached by direct combination of motor (MA) and rotation sensor (S3). After this a gear box with a worm will reduce the speed and maximize the resolution of stack detection. On this way, there are 8 ticks (half rotation of Motor) to recognize the height of the smallest coin. The touch sensor (S2T) is installed on the top of the detecting unit which is direct mounted with the sensing device. It respond at the least contact of the sensing device. The second rotation sensor (S1) detects the relative position from the left end of the detection unit. A motor (MC) at the base of the detection unit moved the whole unit with the RCX. The last sensor (S2L) is implemented between the isolation unit and the sor- ting unit. It detects every coin, which is released by the conveyor belt and spinning down into the sorting unit. The conveyor belt will driven by the third motor (MB). ------------------------------------------------------------------------------ Main steps of program: 1. Preparing RCX 1.1. Defining the sensors 1.2. Defining the background tasks 1.3. Move to initialisation position 1.4. Check the ground value 2. Sorting the coins 2.1. Start conveyor belt and wait for first coin 2.2. Wait until last coin was detected 5 seconds ago 3. Checking the stacks 3.1. Move to every slot and check the stack height 3.2. Display the result of the current slot 4. Show Result 4.1. Show for every slot: Coin-Type, Count of coins, amount of coins 4.2. Total sum of coins 4.3. Duration of detecting process 4.4. Repeat 4.1 - 4.4 until button RUN will pressed. 5. Reset the RCX 5.1. Stop all background processes 5.2. Reset the sensors ------------------------------------------------------------------------------ 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: <<----- start of scan-process Init << Initialize the bot StArt << Start of process COIn? << Wait for first coin LASt? << Wait for last coin LAST1 .. LAST5 << Time after last coin StOP << Stop sorting process Scan << Start scanning process SLot1 1 ct 0051_ 8n 0.08S << SLot2 2 ct 009F_ 16n 0.32S << For every slot display: SLot3 10 ct 0072_ 10n 2.00S << - slot number SLot4 5 ct 008A_ 14n 0.70S << - coin type SLot5 20 ct 00AE_ 14n 2.80S << - value of ground sensor SLot6 1 EUR 0109_ 19n 19.00S << - number of coins SLot7 50 ct 0062_ 7n 3.50S << - amount of coins at slot SLot8 2 EUR 0035_ 4n 8.00S << <<----- end of scan-process 1 ct 8n 0.05S << Display until RUN pressed: 2 ct 16n 0.20S << 10 ct 10n 0.70S << For every coin type: 5 ct 14n 0.40S << - coin type 20 ct 14n 2.00S << - number of coins 1 EUR 19n 6.00S << - amount of coins 50 ct 7n 3.00S << 2 EUR 4n 6.00S << 91n << Total number of coins 35.38T << Total amount of all coins 4.10t << Duration for scan process ------------------------------------------------------------------------------ Known problems and limitations: - The bot can only count estimate 32 - 36 coins of every kind Maximum number of coins are near 256 - 288. But I didn't test it, because I doesn't have so a great number of coins at home :-( - Unload of sorted coins is difficulty - I have to remove the slot unit and remove the coin stacks by hand :-( - If I had have 8 additional light sensors for every slot, the additional time for counting coins would be zero ... perhaps next time ;-) ------------------------------------------------------------------------------ Electrical parts: 1 RCX 2 Rotation sensor 1 Light sensor 1 Touch sensor 2 9V Power motor 71427c01 1 9V Power motor 47154c01 ------------------------------------------------------------------------------ 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/CC8A Video: http:festum.de/1000steine/album/CC8A/Init_Bot_001.mov 6244 KB http:festum.de/1000steine/album/CC8A/IsolationUnit.MOV 4405 KB http:festum.de/1000steine/album/CC8A/Sorting_backstage.MOV 4306 KB http:festum.de/1000steine/album/CC8A/Sorting_Front.MOV 3649 KB Photo: http:festum.de/1000steine/myimages/CC8A/Complete_CoinSorter_front http:festum.de/1000steine/myimages/CC8A/Complete_CoinSorter_backstage_001 http:festum.de/1000steine/myimages/CC8A/Detection_unit http:festum.de/1000steine/myimages/CC8A/Sorting_unit http:festum.de/1000steine/myimages/CC8A/Slot_unit http:festum.de/1000steine/myimages/CC8A/Bot_at_init_position http:festum.de/1000steine/myimages/CC8A/Coins_at_start_position_input http:festum.de/1000steine/myimages/CC8A/Coins_at_start_position_output http:festum.de/1000steine/myimages/CC8A/Conveyor_belt_init_position_001 http:festum.de/1000steine/myimages/CC8A/Coins_at_slot http:festum.de/1000steine/myimages/CC8A/Detection_unit_detail http:festum.de/1000steine/myimages/CC8A/Output_RCX http:festum.de/1000steine/myimages/CC8A/Slot_sensor_detail http:festum.de/1000steine/myimages/CC8A/Sorting_unit_detail http:festum.de/1000steine/myimages/CC8A/Sorting_unit_mask ------------------------------------------------------------------------------ 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 ------------------------------------------------------------------------------