Pages are not fully translated for the English language.

Latest posts

Vending machine

Vending machine

A thermal printer connected to a microprocessor impressed me once but the price was terrifying. I started a search for a cheaper one and found a really cheap one from China at 1/3 of the const. Thus, I made my first buy from a land so far away. It was quite easy to make the printer operational with a datasheet. It communicates over USART and can print bit maps and bar codes. During the buy I thought: why not to build a vending machine.

I started by the belts that are shifting the cookies. There were more possibilities to build this. The simplest one was to use 4 motors one for each belt. This was not interesting for me (I do not have four same motors anyway). The other possibility was to use 2 motor and two gearboxes (one for top belts, second for the bottom ones). I chose the solution with single XL motor and two gearboxes selecting the belts. Gears are changed by simple modeler servos.

The second build mechanism was the keyboard input to select the belt and another button to print a bill. The lego buttons push a matrix switch on the background. The remaining buttons are used for debugging. This construction was not so pleasant mainly due to 1.5 studs sizes etc.

Since the machines should not work free it was important to build some coin mechanism. My original idea was that the coin would push a button falling from above. Nevertheless it did not have necessary kinetic energy. I decided to use an optical sensor trough that the coin would pass. This solution was built in fear minutes and works just great. The coin entry is further blocked as soon as a coin is detected.

The last mechanism is a door accessing all the cookies. The door is opened using another servo. In the meantime a receipt is being print with a logo, all bought items and total price.

I had to cover the model partially using a paper since I do not possess so many lego parts. I am very happy about this creation and I hope you will like it too!

Pictures, schemes, videos

Click the image to show it in higher resolution

Source codes

Click the label to show the source code
VendingMachine.c: main file
VendingMachine.h: headers file

Back to Robotics STM32.