Building a Simple Vending Machine

Building a Simple Vending Machine

Hi guys!

Long story short: Would like to build a simple box/locker type vending machine. I have zero experience with arduino or electromechanics & at this moment just trying to understand which components I will need for the project. But I did my homework.

Why do I have this idea? I have a hobby wood workshop and would like to sell my products indoors via vending machines and get paid via cashless terminal.

For me it's not hard to build a cabinet/locker with transparent doors in cells. Doors will open via Electric Magnetic - locks. But the hardware is a tricky part.

Regarding the code most probably will outsource some one.. But at this moment I would like to get the opinion of experienced members if I am on the right track.

So let's say my vending machine will have 16n doors.

I will need following components:

  • Arduino UNO (controller)
  • Matrix keyboard (so that customer could make a selection)
  • LCD display (so that customer, could see - the selection /m.b Thank You msg etc)
  • VPOS (cashless terminal - most probably Nayax with 3G as payment method)
  • Electric Magnetic Locks - 16pcs (to open a door / most probably i`ll need 12v ones)
  • MCP23017 port expansion chip (because there will be not enough I/O pins for all locks)

In order to connect the VPOS Nayax terminal to the controller I think I need a Multi-drop bus to RS-232 (MDB-RS232) usb converter - but i'm not sure.

As I understand MDB would be essential if I would like to connect bill validators or coin changers but in my case a cashless terminal could be connected through RS232, so m.b i just need a male head RS232 shield for the arduino.

Here's documentation with device cables from Nayax VPOS - Nayax VPOS Documentation.

One of the connection options is RS232 female head.

I tried to illustrate the all components (in example i showed MDB converter to connect Payment Terminal)

P.S I chose the one with a usb head since arduino uno already has one, only will need a USB type A to type B adapter.

Also most probably i will need an external power source for Electric Magnetic Locks - since arduino can supply only 5v and more or less bigger locks require 12v.

P.S Couldn't show it in Circuit (don't have enough experience yet, to understand where it should be placed)

Also i'm curious about the power supply I need so far.

24v power supply for Payment Terminal.

24v power supply for (MDB-RS232) usb converter.

12v power supply for Arduino itself since USB port will be busy with (MDB-RS232) usb converter. “but maybe it will be able to power itself through (MDB-RS232) usb converter”.

12v power supply for Electric Magnetic locks.

Any suggestions how I could fit all these into one outlet instead of 4.

Simplified logic of machine:

  • LCD display - constantly shows message “Please, select your product number”
  • When - Customer Selects a Door/Product number “Display shows - chosen product # and a message, please make a payment”
  • Controller sends signal to payment terminal - to charge “some value”
  • If payment was successful - we send a signal to unlock the selected lock.
  • At this moment LCD display shows a message for few seconds “Please, take your purchase & don't forget to close the door”

Also iˇll need a functionality to open/close via password all lockers one by one since there maybe not enough power to open them at once.

wrong connection for LCD

Looks wrong.

The OP may be thinking that she needs another I2C bus… in which case who knows?

@andreeleevi you do know that multiple devices can be connected to the SCL/SDA lines of the I2C bus, right? That's kinda the hole point of bus orientated communication.

a7

I appreciate any info. Again im newby and this my first try to draw a circuit in my life.

Anyway with a bit of googling i understood that your comment refers to complex lock wires. And that it could be avoided.

How it could look then?

Thank you - what would be the right way to connect lcd?

same as pin extension module

Thank you - now i understand that in order to connect chain of solenoid locks i should use "SCL/SDA lines of the I2C bus" but solenoid locks dont support I2C communication by default.

That means i will need a so called "I2C relay board" in my case 16 channel since there are 16 solenoid locks. Relay will be power supplied by 5v from Arduino board and solenoid locks will be power supplied via external 12v power supply. This means i dont need a pin extender "MCP23017"

Am i correct?

edit. sry, read it more carefully. An I2 C relay board is workable. Some would recommend solid state solutions like MOSFETs to switch the high currents. Then you'd use the MCP23017 outputs to drive the MOSFETs, so basically the code wouldn't even know.


It looks like the MCP23017 gets the information to control the locks over I2C now, so what it missing or perhaps implied but not depicted is something that takes the logical signals and turns them into power control.

So maybe if you could say what are these magnetic door lock solenoids and what controls them and where they get the juice to move the bolt.

a7

@andreeleevi welcome to the forum..
interesting project..

with the VPOS, im thinking you wouldn't need the keyboard or LCD, should be able to program the VPOS to handle all of the customer interactions on it's touchscreen..
the doc does not go into specifics, looks like there's a software package that goes with the VPOS..

Might want to see if they have a demo you can play with, see how much logic can be instilled into it first..

good luck.. ~q

Step 1: Learning Basics

Okey guys - I decided to step further. Got locally - Andruino Uno board & ELEGOO UNO R3 Super Starter Kit.

After couple of weeks i understand that my first diagram is a disaster

So far learned a bit about Andruino IDE / how to upload code and install libraries.

Did couple of lessons managed to connect LCD and first tries with Servo Motor.

LCD first tries video
Servo Motor first tries

Realized that it's not going to be simple and easy as I imagined, but without getting familiar, I have little chance to succeed with this idea.

Considering that I have zero experience, this is one milestone further.

Step 2: Buying Materials

So, what's next? Will try to do the project step by step.

Back in Estonia, it's hard to find parts and especially with reasonable pricing, so I'll need to make a couple of purchases from China and wait till they arrive - the sad part is that I still have no clear picture of what I need.

What I know so far that I'll need:

  • 12V Relay module (maybe 4-16 channels) - link to be able to control 12v solenoid locks
  • Solenoid locks: something like this - link

  • 12V Power Supply for Relay module (think 1-2 amps will be enough): link

    P.S - I would like the doors to be pushed to be open (so if someone has an idea on how to do that, I would appreciate the tip)

    It took me 16 wires to connect the LCD monitor (after Googling, I understood that there is a simpler way to do it with an I2C module, so definitely need that) - link

    Step 3: Buying Materials to Learn More about payment.

    Thought before I dive into connecting the Cashless Terminal, it would not be bad to play around with a Coin Acceptor (a much cheaper way).

    Found a video with a guide: https://www.youtube.com/watch?v=sfE7yqtd8TA

    And to repeat i will need these materials.

    Coin Acceptor: link

    DC socket: link

    PCB board: link

    PCB Male & Female header pins: link

    Believing I'll need extra jump wires, I will buy a pack of Female-Female / Male-Male / Female-Male jumpers: link

    Considering that I would like to connect a 16-channel relay to Arduino Uno, a 4x4 matrix keyboard, a small LCD display with an I2C module, and a coin acceptor with a 4-pin socket, I think I'll need a pin extender like the MCP23017: link

    And a couple of LED strips to light up the box:

    - LED Strip: [insert link here]

    Step 4: Investigating MDB solution to connect Cashless Terminal.

    This is a tricky part - there's not much easy to understand options to connect a cashless terminal to Arduino.

    Step 5: Train myself to build a Safe Box with materials I have so far.

    Will try to do a Password Protected Safe Box - https://www.youtube.com/watch?v=gv4ajA1G3L8

  • Sweet..
    try this search on the site you're ordering stuff from..
    "arduino terminal breakout block"
    easier to assemble than soldering headers on boards..
    If you're going to be moving the pos logic to Arduino, probably going to need a device with more memory, but start with small steps..
    curious, MDB, are you referring to an ms access db??
    that cashless terminal looked nice, what happened??

    good luck.. ~q

    Be aware that the Arduino UNO cannot operate as a USB host.

    @andreeleevi - keen to know if you have made any additional progress on this project?

    @andreeleevi Hello, I would like to do almost the same project. Can you tell me if you finally succeeded in your project ?.

    Best regards.

    I’m also trying to make pretty much the same thing. How did it workout? does anyone have a diagram of how to build this system and the components needed