Modular Vending Machine

This is a 3D printed modular vending machine.

Each module comprises of 3 parts: a back piece with the motor mount, the middle section and the tray to catch the dispensed chocolate. These modules attach together using M3 x 8mm bolts to form a tray.

The legs also comprise of 3 parts: the feet - which support the bottom tray, the extenders - which is required for each additional tray you add, and the handle - which attaches to the top and adds rigidity to the structure.

These modules can be mounted in any configuration, such as 2x2, 2x4, 1x8, 3x3 etc.

The coils are made with 3mm aluminium and have a diameter of 55mm. These can be made to any dimensions depending on the items being dispensed.

The vending machine can be controlled via an App or Alexa using Wi-Fi switches. See the instructions below for more details.

Downloads

STL files for 3D Printing: Thingiverse

Parts Required

Assembly (for 4 modules)

(2x) 5M x 3mm Aluminium wire - AMAZON

(8x) M3 x 40mm Bolt - AMAZON

(16x) M3 x 30mm - AMAZON

(22x) M3 x 8mm - AMAZON

M3 Washers - AMAZON

M3 Nuts - AMAZON

Electronics

(4x) Nema 17 Stepper motor - AMAZON

(1x) Arduino - AMAZON

Stepper Motor Drivers - AMAZON

Wi-Fi Switches - AMAZON

Wi-Fi 4-way switches - AMAZON

Gallery

Build Instructions

20180920_143716.jpg

Step 1

Using 3mm aluminium wire and a 50mm cylinder (I used a hairspray can), wrap the wire around to make a coil. Bend one end to the center to attach to the motors.

20180921_195631.jpg

Step 2

Print the parts for the module. Attach the back section to the middle section using M3 x 40mm bolts and M3 nuts. Attach the tray to the middle section using M3 x 30mm bolts. Attach a Nema 17 stepper motor using M3 x 6mm bolts. Connect the coil to the motor using the adapter and glue in place using a hot glue gun. Ensure the coil rotates freely in the module.

 

20180921_192751.jpg

 Step 3

Connect multiple modules together to form a tray using M3 x 8mm bolts and M3 nuts. Attach the feet to the bottom tray and add connector pieces for as many trays as you wish to stack. Add a handle to each side. Finally add the electronics (see below).

 



 

Electronics

To control the motors you will need to wire them to A4988 stepper drivers or EasyDrivers. You can then connect these to an Arduino or Raspberry Pi.

You can connect Wi-Fi switches to connect Alexa to Arduino. You can use individual smart remotes or multiple channel controllers but both require stepping down the voltage from mains to 5V.

 
Picture1.png
 
 
Picture2.png
 
 

Code

Below is the code for an Arduino connected to 2 Sonoff WiFi switches connected in the above configuration.

int dir1 = 7; //stepper 1 direction int dir2 = 5; //stepper 2 direction int step1 = 6; //stepper 1 step int step2 = 4; //stepper 2 step int enable = 3; //stepper enables int input1 = 9; int input2 = 8; bool start1 = true; bool start2 = true;  void setup()  {   pinMode(9, 0); //set up input 1   pinMode(8, 0); //set up input 2   pinMode(dir1, 1); //set up stepper motors   pinMode(dir2, 1);   pinMode(step1, 1);   pinMode(step2, 1);   pinMode(enable, 1);   digitalWrite(enable, 1); } void rotate(int motor) {   digitalWrite(enable, 0);   for (int i = 0; i < 200; i++) {     if (motor == 1) {digitalWrite(dir1, 1);} else {     digitalWrite(step1, 1);     delay(1);     digitalWrite(step1, 0);     delay(1);   }   digitalWrite(enable, 1); } void rotate2() {   digitalWrite(enable, 0);   for (int i = 0; i < 200; i++) {     digitalWrite(dir2, 1);     digitalWrite(step2, 1);     delay(1);     digitalWrite(step2, 0);     delay(1);   }   digitalWrite(enable, 1); }   void loop() {   if (digitalRead(9) == 1 && start1) {     rotate();     start1 = false;   } else if (!digitalRead(9)) {     start1 = true;   }      if (digitalRead(8) == 1 && start2) {     rotate2();        start2 = false;   } else if (!digitalRead(8)) {     start2 = true;   }        }