Smart Candy Machine can sell you three different products 7up Pepsi and Twix. You can insert 4 different coins - 10 20 and 50 cent and 1euro. The amount is shown in the RCX. The exchange is also given. Enjoy it. Any comment - email@example.com
About this creation
This is one of my favourite creations and maybe the most complete (programming, building and having fun).
Iíll try to explain every step and each part of my work. However, if you donít understand something or if I havenít mentioned any point, ask me @ firstname.lastname@example.org. Itís also available for comments and suggestions!
1- It recognises 4 different coins!
2- It displays the price of each product after inserting the coins!
3- It sells 2 kinds of products: cans and snacks! (you can also choose 2 different drinks)
4- It gives the exchange choosing the best way not to waste coins!
5- It knows when there are no coins on a compartment and gives coins of less value of another compartment!
I can identify two parts of my machine: the one responsible for recognising coins and giving the exchange, where RCXís take place, and the other one responsible for giving the products.
1st Ė Coins compartment (amount and exchange)
This was the most difficult part to do but also the most interesting!
Iíve made a smooth platform and put a piece of an aluminium paper (kitchen stuff). Here, the coins move and are stopped by different clips on the top according to the size of the coin. When a coin stops, once it is conductor, a connection is done turning a light on with a specific voltage. This allows a light sensor to read different illuminations according to the coin which is inserted. I used 9v box of lego where we have 6 AA batteries so that I could get several voltages easily. Once stopped, the coin is pushed by a motor to the respective tube.
In front of the clips of each coin there is a section where the coins are stored in a tube to be given in the exchange. However, just 10 cent, 20 cent and 50 cent coins are given in the exchange because, normally, no one inserts more than an euro extra (subtracting the value of the product). When this happens, it will give 2 coins of 50 cent.
Iíve placed 2 light sensors in 2 tubes of coins: 50 cent and 20 cent. These light sensors will give the information about the presence of coins into the tubes. If there are no coins into them, the program will order the machine to give coins with less value to avoid not giving exchange. However, if the machine needs 10 cent and they are not really there, then there will be nothing to do :x .
I used 2 sensors to choose the product: one touch sensor in the middle to ask for a Twix and a rotation sensor to choose between 7up and Pepsi.
How did I put two buttons using one rotation sensor?
Iíve placed them like a differential system (similar of the ones used in cars): when one is pushed the other one stays unchanged and vice versa. The mechanisms allow it to get positive and negative rotations according to the button we press.
2nd Ė Products compartment
In this part, the mechanisms are the main point!
I opted to put Twixs above the structure that manages the cans. The Twixs box was easy to do, with simple mechanisms, making a spiral spin. The mechanism is: 8:24/8:24/8:24; rotating 27 times, the spiral will rotate once and will give a Twix.
To get the part of the cans working well, I had just one slot (with 2 motors to have more power). Thus, I had to find a way to give two different cans turning the motor to the right and to the left. I used a similar mechanism to the one of the buttons. Firstly, when the motor was on, the two sequences of caterpillars were moving in the opposite directions. With the differential system, when a can got to the back of the machine, it stopped and the other cans that were moving in the opposite direction kept moving until one was out of the compartment. When the motor worked to the other direction, the other drink was given. Actually, when there were no cans in one of the sequences of the caterpillars, the other drinks never got out of there because their weight stopped their caterpillars and made the other sequence of caterpillars run (without nothing to give).
To solve this problem, I broke the gears on their back so that they could not roll backwards. This way the cans donít need to go till the end of the platform to make the other drink get out and every drink will get out in all situations!
When the cans fall, they press a touch sensor that will stop the motor!
3rd - Program
1st RCX: 2 sensors to the buttons (touch and rotation) + 1 light sensor to recognise the coins; 1 motor to push the coins + 3 other motors to give Twix and drinks (2 motors in the same slot).
2nd RCX: 1 touch sensor to know when the cans fall + 2 light sensors to know when the tubes of coins are empty; 3 motors to give 3 different coins in the exchange.
Whenever a coin is recognised by the first RCX, it will send a message to the second so that it can add the respective value. When a button is pressed, a message will be sent to subtract a specific value. This allows the second RCX to know how much money it should give. After completing the task of giving the product, the first RCX order the second one to give the exchange.
When the buttons are pressed, it verifies the amount and decides what to do. If the amount is not enough, the RCX will display the value of what we are asking. In a normal situation it is always showing the amount.
Full marks for this one! Brilliant, love the ingenuity in the coin detection and the very professional front faÁade. What did you program it in? And why did you choose to have a seperate button for the twix selection? Particularly good use of the differential drives, the whole project is very impressive! Now add a heat pump to keep the snacks cool, since it's summer, ...wouldn't want a melted twix! :-P Well done - David