Skip to main content

Vending Machine Guide

L
Written by Luvelo Support
Updated over 7 months ago

This operation and troubleshooting information is for VEND-01, VEND-02, and VEND-03 of style pictured below.

Design Overview

Overview Video

Raspberry Pi Pinout & Header board

The header board is a custom board that sits on top of the Raspberry Pi pins to allow for easy connection to the keypad, screen, and relays.

Raspberry Pi Pinout

Header board:

Custom Circuit Board Pinout Table: Going down the left and right side of the image above.

LEFT SIDE

RIGTH SIDE

Pin Function

RPi Pin #

RPi Function

Pin Function

RPi Pin #

RPi Function

Relay -

N/A

N/A

Not Connected

N/A

N/A

Relay 6

40

GPIO21

Keypad 6

33

GPIO13

Relay 5

38

GPIO20

Not Connected

N/A

N/A

Relay 4

36

GPIO16

Keypad 5

29

GPIO05

Relay 3

32

GPIO12

Keypad 4

15

GPIO22

Relay 2

26

GPIO07

Keypad 3

13

GPIO27

Relay 1

22

GPIO25

Keypad 2

11

GPIO17

Relay C

18

GPIO24

Keypad 1

7

GPIO04

Relay B

16

GPIO23

Screen SCL

5

SCA1

Relay +

4

5V

Screen SDA

3

SDA1

Relay A

12

GPIO18

Screen +

2

5V

Relay +

4

5V

Screen -

N/A

N/A

Relay -

N/A

N/A

Vending Machine Coils Overview

Here's a representative picture of the back of the coil. So as the coil spins, the switch is activated, and then when it gets back to the flat side, it's deactivated.

We use this on the negative pole of the motor. We always apply the negative connection to the Normally Open contact of the switch. Then we use the output of the LETTER relays on the Normally Closed contact of the switch.
Standard operation then follows this flow:

Vending Machine Wiring Diagram

Vending Machine Motor Activation Explanation

Troubleshooting

What to check if a row is always activating with other rows:

There are two main reasons a non-commanded row might spin with a commanded row.

  1. The "spring" never returned to it's "home" position

  2. A relay is effectively "stuck on" this can occur if a relay fails, the control board fails or is commanding incorrectly, or some wiring is disconnected or shorted together.

Troubleshooting Steps:

  1. Check the home position issue by commanding the same slot multiple times to see if it always stops at the same position. Then we can adjust the length of timer 1 and timer 2 in the code calibration until close enough.

    1. If Timer 1 is too short - coil will only spin 1/4 of the way or less

    2. If Timer 1 is too long - coil will complete more than one rotation

    3. If Timer 2 is too short - coil will not complete a full rotation

    4. If Timer 2 is too long - coil will do a single rotation, but then machine will say "Please Wait" for a long time till this relay clicks off.

  2. Check to see if the control board has control wire stuck on

    1. The big relay board switches ground. so if pin out of rasperry pi is high (3-5V) then its off. If its low (0V) then its commanding it on. The single relay used for A is the opposite (3-5V is on, 0V is off)

    2. I think there’s little lights that light up on the relay board when the control board is trying to activate the relay. With the machine turned on, you should be able to see if the light by relay in question is on or off. The right side of the relay board with all the colored wires is basically one per relay, and then a ground. If you can see which one is ground, then they just go in order. You can unplug the relay in question and see if the light turns off. You can also measure the voltage across output pins to try to troubleshoot.

  3. Check if a relay is stuck on with a multimeter:

    1. With the machine off, the NO and C pins should not be connected, and the C and NC should be connected. These pins are on the left side of the relay board, see the pictures above for reference.

  4. Pull the drawers out and check that the switch isn't always activated. you should see that when on flat side, button should not be contacted. You can also check connections with a multimeter to make sure normally open and normally closed are as expected.

  5. Check other machine wiring - use wiring diagram and videos above that explain how the wiring works and check any wiring coming out of relays and in the back of the drawers where they "plug in"

How-to run test script:

From Mac, open "Terminal" app.

Type and hit enter: change number depending on which machine you're trying to test on:

when prompted for password, type password "tlc" then click enter.

tlc

Type and hit enter:

sh startupScriptTest.sh

from there, you will be prompted to enter letters & numbers to activate relays. Enter '0' to deactivate all letters or numbers. You can only activate one letter and one number at a time. To quit the program, enter Q for the letter.

Type and hit enter to restart the machine and restart normal vending machine code:

sudo reboot

Extra Pictures

Did this answer your question?