Make a Device/Feature for Vending Machines




Introduction: Make a Device/Feature for Vending Machines

Want to add a feature to a vending machine? Maybe there's one at your local makerspace, maybe its in the mancave, or maybe you just want to make a feature for vending machines worldwide. If you have a desire to make a new feature for vending machines, read on!

From projects as big as putting a menacing AI Chatbot in charge of the machine, to things as small & simple as a Free-Vend button on your phone, any of these features have the same need to communicate with the vending machine. Easier said than done! What I will be showing you, is how to make a "blank" device that can connect vending machines and wifi/bluetooth. Think of it like a blank check, the power is there, you get to make it what you want it to be!

Step 1: What Is MDB?

If making a device that talks to vending machines, you need to speak their language. That language is 'MDB'. The full name is "MDB/ICP", which stands for "Multi Drop Bus / Internal Communication Protocol".

This is the most widely used standard for communication between devices in a vending machine, at least in the USA. Maintained and owned by NAMA (National Automatic Merchandising Association) and the EVA (European Vending Association), it was developed back in the early 90s and has standardized the way vending machines communicate, allowing parts for vending machines (bill acceptors, coin changers, etc.) to work in any vending of any make/model as long as that machine that supports the standard.

There are many machines that still use the older technology and haven't upgraded yet, so be sure the machines your device is intended for have MDB capabilities. Other than checking the manual for your specific machine, an easy indicator that your machine offers MDB capabilities, is the presence of a wiring harness with a 2x3 Molex Minifit Jr connector. I've included a picture of a female MDB plug (it's gendered by the metal contacts).

How does it work?

Now is the point to watch the "MDB Explained" video. I feel a bit bad using this guy's video to promote alternatives to to his products (he seems so friendly and excited), so if you got money, consider buying his MDB to USB products or hiring him to design you a custom product, rather than doing it yourself.

One note I will add, is the term "Multidrop Bus" is also a technical (non-vending) term, so if doing any internet searches for MDB, it would be best to use the full name "MDB/ICP", and/or maybe add the word "vending" in there.

The other two videos of his you can check out if you like, but I feel it is much shorter to explain in words:

  • MDB has a master & slave configuration, where the VMC is the master, and all peripherals are the slaves.

  • The VMC/Master, initiates and ends all communications, and periodically polls (checks on) peripherals/slaves.

  • ThePeripheral/Slave, listens to all communications coming from the VMC, and waits for a command to be addressed to it, before saying anything to the VMC/Master.

  • This way, only one peripheral is speaking to the VMC at any point in time, which is necessary in a Multidrop Configuration (technical term).

What peripheral options are there?

The MDB standard currently allows these devices:

  • Coin Changers (Takes change and gives change)
  • Bill Acceptors (Takes bills, and newer models can give bills)
  • Cashless Payment Devices (Accepts digital forms of payment)
    • Can be used for other reasons, such as accessing the machine's display and keypad, getting sales updates, or transferring files. If making a random feature, you should default on having it pose as this kind of peripheral due to the power it has over the machine.
  • Communications Gateways (For external data communication devices, DEX is the dominant auditing standard)
  • Universal Satellite Devices (In short, a vending mechanism/add-on that needs the host machine for payment acceptance)
  • Coin Hoppers (Bulk coin dispensing, like a change machine)

A few extra things to know:

  • UART, is a general/non-vending standard for transferring serial data. The format of serial data and the data rate can be configured. Most hardware has a UART circuit that can be configured to your needs.
    • The UART settings for MDB is 9600NRZ, 9-N-1
      • 9600 stands for a Baud Rate of 9600, aka 9600 bits per second, meaning each bit is 104uS long.
      • The NRZ stands for Non-Return-To-Zero, which, is implied/standard in most cases.
      • The 9 stands for 9 data bits, 8 is standard and 9 is unusual. More on this later.
      • The N stands for No parity checking.
      • The 1 stands for 1 stop bit.
  • RS232, there are a lot of MDB to RS232 Adapters. This is because RS232 is/was a popular standard that predates MDB, which is readily & commonly used with UART, making it easily adaptable to MDB. I recommend staying away from RS232 if there is no strong reason to use it. The market is flooded with it, and it's an outdated standard that usually is indicative that the designers using it are stuck in old (less efficient/performing) ways. The same goes for through hole circuitry, but that's a different topic.
  • USB, why don't they make USB adapters? Good question!
    • There is a single bidirectional data line in USB2.0. MDB/UART uses separate unidirectional Transmit and a Receive lines separately.
    • USB3.0 has a separate Transmit and Receive line, but it (as well as USB2.0) is differential signaled, where MDB/UART uses Single Ended signaling. I challenge someone to make a USB2.0 and/or USB-C, to MDB adapter, without using any integrated circuits (opamps allowed, shift registers only if 100% necessary), post it in the "I made it" section if you do.
    • For those wondering about USB to UART adapters you may have, the only two chips in existence that I am aware of supporting 9 bit UART, are both made by MaxLinear, and neither of them have been used in a USB to UART adapter. None of FTDI's chips support 9 bit UART, and even if we find the way to make it work, it'd be a bit extra work (software drivers, COM ports, etc.) when our initial priority is quick and easy, for that reason we use a development board instead.
  • EVA-DTS is a vending industry specific Data Standard, which you should pay attention to if making a product. It provides a uniform format for all vending related data. The DTS stands for "Data Transfer Standard".

The latest version of the MDB standard can be found here. If you choose a peripheral you want to make, briefly skim over the entire section for it to make yourself aware of all of the features/options it has.

Step 2: Tools Needed

You will be making a breadboard version of your MDB device, prior to making a custom version. Before starting, you'll need some tools.

The primary two sites to order parts, will be DigiKey, and Amazon. I choose Amazon assuming you have an amazon prime membership and/or this would be the preferable method when things can't be found on DigiKey. It would be best to get everything in a cart (or two) and hold off on ordering until you have the parts picked out from the next step too.

Tools Needed for the breadboard version:

  • Soldering Iron. Although you only need an iron for this Instructable, I recommend getting hot air capabilities, if not a full on SMD rework station. When I was a teen, I sold my fancy airsoft guns, and bought the rework station below, along with a bunch of other tools to get into electronics. I've used the rework station to reflow BGA connections in a few laptops and it has paid for itself in that way.
  • Solder. Don't forget the smoke is toxic and causes chronic health issues. DigikeyAmazon
  • Crimpers
  • Wire strippers. Any will do, but I highly recommend Ideal Industries' StripMaster. Due to the quality of them, one pair can't strip every wire gauge, so for uses outside of this Instructable, you will likely run into a need for a 2nd pair (or different sized inserts). Keep in mind we're using 20 gauge wire in this project.
  • Wire cutters (scissors or nail clippers work, just something to cut thin wire with)
  • A logic analyzer. Technically optional, but it helps debug communication software & verify hardware works.
    • I use the DSO203 Oscilloscope with 3rd party logic analyzer software, but there are cheap analyzers too. Unless you know you need a fancy one, just get a cheap one. Sigrok offers open source software that works with a variety of different devices.

Additional tools needed from then on:

  • A JTag emulator. JTAG was made to make it easy to quality check freshly assembled PCBs.
    • Be sure the emulator you purchase is compatible with the devices you are using in your design. This one is used for the ESP32. If ordering the ESP32 Programmer, look at the next step and consider ordering the ESP32 development board from there too, rather than DigiKey.
  • Solder stencil printer/applicator. I bought the CYBRES SP2421, but feel there may be better options I haven't found yet. As a bare minimum, add the spacers to your cart when ordering your stencil (from OSHPark).
  • Pick and Place machine (for repeatable automated assembly, more for small scale mass production)
  • 3D printer (if you have one), for testing out enclosure designs.
  • CNC Mill (if you have one)
    • Great for making one-off top-quality enclosures, or other things like molds for injection molding.
    • Great for making mechanical parts that connect your circuitry to the real world.
    • Very valuable (time-wise) for fabricating PCBs locally. For small circuitry you'd chemically etch traces, but still need a mill for Vias, board shapes/cutouts, panelization/depanelizing, etc.
  • PCB Design software (To design your PCB or alter my design)
    • EagleCAD (paired with Fusion360 for 3D modeling) is what I've always used since before it was purchased by AutoDesk. If you have a large or commercial design (disqualifying you from a free license) and don't have money for an upgraded license from AutoDesk, the free and open source but not as luxurious alternatives are KiCAD (paired with FreeCAD). KiCAD I feel is a steeper learning curve as well.

Step 3: Get Connected


It's smart to make your software and features before committing to developing permanent dedicated hardware. This minimizes the efforts put in if you discover your idea won't work, allows you to develop it as quickly as possible, and lets you easily add and remove hardware before your final design. So to start out we will just be creating a breadboard model. You may stray from this exact design if you like, but if you do, be sure to read the end of this step where I explain the thought behind each part.

Parts List:

Here are the shopping carts:


Watch the video for assembly instructions on the wiring harness, you can mute it if you find the audio super cringe worthy. When it gets to the part where you solder things to the breadboard, refer to this list for coordinates to place each connection on.

Solder all of the parts to the breadboard as shown in the video. I've included a 3d Model of the proto board (not 100% accurate aesthetically, but the idea is that the 3D model gives you something you can look at yourself in case the next part is confusing. You can upload the file here and view it.

The breadboard has letters on the Y axis and numbers on the X axis. We will use these to specify where each connection lands. For the upper and lower power bus, let U & L specify which one we are referring to. Also to specify positive or negative bus, we will append a P or N to the U or L. For example "UP3" would refer to the upper positive power bus' 3rd hole (as numbered). Furthermore, the addition of the letter R, indicates that the connection should be made on the reverse side of the board.

  • Jumpers
    • Green: J25R&J27R, H27R&B27R (solder the Isolator before this jumper)
    • Red: H8&H26
    • Yellow: LP24&A24, LP19&J19 (Do this jumper last)
    • White: D28R&G28R, D30R&G30R, UP30R&I30R, UP1&J1
    • Black: UN6&J6, LN19&19B
  • Resistors
    • R1 (680 Ohms) LP26R&G26R
    • R2(120 Ohms) H7R&C25R
    • R3 (680 Ohms) B26&B23
  • Capacitors (I don't have money to order them so don't have exact coordinates)
    • C1(50V 39uF) UP#R&UN#R (Any of the columns, just place near the higher number columns, closer to the regulator)
    • C2 (10V 680uF) LP#R&LN#R (Ideally within the columns 20-23)
  • Isolators
    • Using the suggested LTV-826 dual isolator, put pin 1 (the one with the dot) on E24, and pin 4 (same side of the isolator but 3 pins down, on E27. The other pins get soldered where they land on the pcb.
  • Regulators (All input pins on column 28, output pins on column 30)
    • One regulator on rows: A, C, E, F, H, J
    • Using a conductor with no insulation, solder all of the top fins together, starting from row A, once you've connected all 6 regulators, solder the end of the wire to UN30
  • MDB Wiring Harness
    • Green (MDB Line 6) = H25
    • Red (MDB Line 5) = A23
    • Blue (MDB Line 4) = J24
    • Black (MDB Line 2) = UN29
    • White (MDB Line 1) = I28
  • Pin Headers (when inserting the DevKitC, orient it so that the 5V pin lands on I1, and 3v3 pin lands on I19.
    • I1R-I19R, A1R-A19R

That's the end of this step! You should now have a wifi/bluetooth enabled development board that can be powered from, and communicate with vending machines.

Selection of parts:

This section is intended for those who want to do things a little differently. Maybe you have an Arduino, or a raspberry pi, or you happen to have a replacement part on hand for each part listed. What I'll do is walk you through how/why I picked each part/value.

First off, everything needs a power source.

  • While you could just power the device through the USB port of the development board, that poses a few issues. The last issue is the reason I don't use an external power supply such as a Wall Wart.
    1. You must keep a laptop plugged in to a relatively short & stationary USB cable.
    2. You can't really shut the machine all the way, which makes testing things harder.
    3. At least in my case, the idea was it is a wireless device.
    4. The better alternative is not a whole lot of effort.
  • I chose to use a linear regulator because it is cheap and quick. However, it must drop 34V down to 5V, take in up to 45V, and put out a decent amount of current. This limits the options a bit (limited options brought me to decide to include a surface mount device in the breadboard model), furthermore, our 34V to 5V scenario for MDB, this means we get 15% efficiency, which translates to a LOT of heat generation. The regulators actually have so much heat being generated, that the amount of current we can get out of them is severely limited by thermal properties. That said, I don't really imagine everyone has a junk computer lying around they can just rip a sizable heat sink off of, also this was hardly adequate cooling for the device just sitting there basically idle. Rather than resorting to an external power supply, or a more complex SMPS, I've decided to simply add more Linear Regulators in parallel, and submerge the device in Mineral Oil.
    • Mineral oil is nonconductive and can be used as a coolant. There are no available fancier forms of this, if you try contacting 3M about their Novec product line (higher thermal conductivity, fire retardant, etc.), you'll eventually find out there are strict environmental regulations and requirements that restrict access to that product. As for cooling, it is not the best coolant, but it has 10x better thermal conductivity than air. As for the plastic container that holds the liquid, depending on the plastic it's made of, it's likely either just as thermally conductive, or more conductive, so in short the only bottleneck for cooling is the surface area of the isolators, transferring the heat to the mineral oil. This is why heatsinks were added, especially considering the datasheet values (which were used to decide 6 Regulators = 1 Amp) are referring to the regulators being surface mounted to a 4 layer PCB with thermal vias and such. Why 1 amp? Development boards should need about a maximum of 1 Amp at any point in time, and much less during most operations. 1 Amp capability just ensures that power does not become a hidden cause of erratic behavior later on. Lastly, on mineral oil, the isolators are oriented so that convection naturally occurs, and the sides with the most surface area are where all the oil is flowing over.

Next, we need a processor.

  • I originally used Particle's Photon board for this project, it was suggested to me by a guy who wanted to use their web IDE with the device I was making, and at the time I knew nothing past arduino, so was impressed there was wifi AND it offered 9 bit UART, so I just agreed. If you have a reason to, you can use pretty much any arduino, they all seem to offer 9 bit UART. Raspberry pi doesn't seem to, but there is a bitbanging library or two for that. Bitbanging, to me, just seems like a lot of messing around for an inferior result. As you may have noticed, the ESP32 does not offer 9 bit UART, however, if you dive deep into the documentation, you may or may not find a few ways that you can work around it, such as manipulating the parity bit (easy when sending, hard when receiving). If you have a USB to UART cable/adapter, it may or may not be possible to adapt it to 9 bit UART. I've searched through all the datasheets of every bridge chip on digikey, and only two chips offer 9 bit uart, and they're made by MaxLinear (not FTDI), and I've not been able to find any USB cables/adapters that use their bridge chip in it, so, if you got a USB to UART adapter, it most likely doesn't support 9 bit UART. But like I said, that doesn't mean it can or can't be used with a 9 bit UART, it's just a lot more work and reading n stuff. Anyways, when I discovered the ESP32 module, I had intentions to use it in a custom PCB, and it stood out as very capable hardware that offered wifi and bluetooth at an unrivaled price (then I find out it's a really popular hobbyist thing too).
  • Why don't we just use a laptop's processor? It's simply just not the simplest/easiest/quickest option.

Lastly, the isolator

  • The isolator chosen has a maximum rise/fall time of 18uS and a typical
    rise/fall time of 3 & 4 uS respectively. This is a 1uS difference, which does not distort data communications and falls pretty close to the 1% timing accuracy the protocol specifies (1uS error out of 104uS). The 18uS of rise/fall time, being consistent/identical (also under 104uS), merely offsets/delays the data that amount of time without distorting it. The current transfer ratio happens to be at its peak around 15mA, and is reasonable to think it'll stay above 100% transfer in most situations, so for a quick prototype I choose this one. Also because I picked it by chance back when I didn't know this stuff mattered a lot.

Selection of part values:

Formula is R1 = Vp / 5mA. The 5mA is a generic/default current and can be adjusted. Particle's Photon board allows up to 25mA per IO pin, so this is a good value. Particle operates on 3.3V, so Vp = 3.3V, therefore the formula is R1 = 3.3V / 5mA = 660 Ohms. Adjusting this for the closest standard resistor value, we get 680 Ohms. Double checking the current that the higher resistance value results in ( I = 3.3V / 680Ohms ) , we get 4.9mA. Pin current is high enough that the range of values within the resistor's accuracy/tolerance doesn't need to be checked.

Formula for R2 = (Vp - Vf(max)) / (If * CTR(min)). The 2nd part (If * CTR(min)) represents transferred current, which must be 15mA or more. By selecting an isolator with a minimum current transfer ratio of at least 100% @ 10mA, we find that the CTR happens to be at its peak at about 15mA. This works, but is in no way a long term solution due to close tolerances, so we will have to find a new regulator in any serious designs. Plugging in the values of this regulator we get R2 = (3.3V - 1.4V) / (15mA * 1), the ratio I just called it 1 rather than trying to figure out whats on the graph, it's safe to go up to 20mA, keep in mind we limit excess current on the other side. Solving this equation we get 127 ohms, which if we round to the next lowest resistor value, we get 120 ohms. Double checking, this gives us a minimum of 15 milliamps on both sides.

Formula for R3 = (5V - Vf) / 10mA. The 10mA is a random/general value, and the isolator used works well with 5mA, to produce 5mA on the other side. We can draw up to 15mA, but will only draw 5mA. To do this, it's as simple as plugging the values into the equation. (5v - 1.4V) / 0.01A = 720. However this is a very close to the 680 ohms used in R1, so let's reduce the unique part count and just use that same value. Double checking of course, we only increase about 0.2mA so all is well.

Step 4: Get the Initial Code Configured and Uploaded

You'll need to install the ARduino IDE the Arduino-Core for the ESP32. If making a commercial device, I'd recommend switching to using Espressif's own IDE for the ESP32. It will be less buggy, perform better, and be sure to offer all possible features. They're still working on completing the port to Arduino.

Now you have to get the MDB code loaded onto your device, configure it for your device, and start adding all the fancy features you've thought up, linking it to the MDB code. For me, this meant downloading the 313 Page MDB v4.2 Manual and transcribing all the relevant pages into a program (Initially I just did this with the Cashles Payment Device but I'm working on adding the rest). Instead of doing all that, you can take a look at my code. This code has gone through a lot of changes since I last used it, and I nolonger have 24/7 access to a vending machine, so there may be a few bugs to work out. Finalizing this software is my next priority after publishing this instructable, so it may be taken care of by the time you get to this point, and even if not, it's still a LOT better to work out a few bugs than write the whole thing from scratch. Be sure to check that your hardware works, before assuming the code isn't working. Hook up a logic analyzer to the pins and compare what your device receives, to what it reads, and what your device should sent, to what it actually sends. I've included some pictures to help make it clear what you should see on a logic analyzer.

When you start working with my code, it should be easy if you follow along with it in the MDB manual as well. If you use it, be sure to submit any improvements/changes you make. This is my first program and still is the only program I've ever worked on. Also it's my first time using github, so sorry if it's a bit disorganized. Whether you use my code or go at it on your own (it's a LOT, I still have to dive into a larger EVA-DTS manual to link to the MDB code), this is the time to get your device communicating intelligently with the machine, then make your application and link it to the MDB code. Get your device's main functionality going. Add microphones, motors, whatever your feature needs and get all that set up too. Have your device's functionality & design finalized before moving on as it's harder and more expensive to make changes to custom circuitry.

For those using different hardware that doesn't support 9 bit UART:

If you have opted to use something like a raspberry pi, or a USB to UART cable, this may be of interest. MDB requires 9 data bit communications. A lot of UART hardware does not support this. The ESP32 happens to be one of those such devices. Unsupported doesn't mean it's impossible, and after looking into the documentation on the ESP32, I see a few different ways we can make it happen. If using different hardware, these are a few options you could look into.

  • Sending Data
    • Manually calculating the desired parity setting for each bit prior to sending.
    • Manually Loading the registers with the data, AND the parity (unclear if this is doable on the ESP32)
    • Bitbanging (guaranteed but resource intensive)
  • Receiving Data
    • Receiving Data, and using the parity error interrupt/flag (if your hardware has it) to tell what the 9th data bit is. (This would require that data with a bad parity isn't just discarded)
    • Manually reading from the register bit by bit as each bit comes in. (More labor intensive)
    • Bitbanging (guaranteed but resource intensive)

It's not 100% clear what will work just by looking at the Technical Reference Manual (at least on the ESP32), as we're using the parity in ways it wasn't intended to be used, so there won't be documentation on how to use it this way. The only real ways to know what happens is to test some code out and see what works. One final note, is the ESP32 has an "Edge Change" register/interrupt, which provides us with a way to detect a Hard/Bus reset and have 100% MDB compliance. A Hard/Bus reset, is when the bus is pulled active for about 100mS or so, something that is not part of UART communications, so it is nice that the ESP32 happens to have this capability. However, the Hard/Bus reset, functionally, is unnecessary to support as the protocol specifies that all peripherals that don't respond to it, simply get an addressed (UART readable) reset command sent to them.

Step 5: Begin Prototyping

From here on out, you ought to know a lot more about electronics. Your project is likely to stray from this Instructable too at this point, so documentation from here on out will change from telling you how to do things (that'd be a whole different electronics/SMT topic), to mentioning notable things I Iearned as I was working on my own project. Hopefully there is helpful information somewhere in this step.

Prototyping to me, is researching all the parts and finding the lowest possible cost, replacing the parts in the schematic you were previously going to use. Also a whole lot of trial and error as you learn about designing and assembling custom circuits. You are trying to improve upon an already working design with changes to find the optimal balance of cheap and quality (then make sure the changes don't break the system). Every fraction of a penny adds up. Make sure you compare prices from more than one source (Octopart does a good job with this) and balance whether it's worth ordering from one source or multiple sources. I keep a spreadsheet/BOM in open office to organize the parts and all their prices. I'll include an example/template you can use. I used to include a link to each part where I found it at that price, but I think I stopped doing that for because it became tedious due to the rate I'd find a better part. EagleCAD I believe now has some sort of BOM program too. I'm sure a simple spreadsheet is less powerful, but less complicated at first too.

As your designs get smaller, the small details have a bigger impact. The thickness of your solder stencil, the shape/size of the footprints of your passives, mechanical stress (it'll start to crack ceramics and solder joints), etc. This document talks about a lot of it, I wish I had known of these things before I started. I try to use 0402 as the standard size for all my passives. One thing you have to keep in mind is assembly, can you reliably assemble the parts that size and that close together? Or do you have plans on HOW to solder a double sided design?

  • Read every single word in every datasheet, I've had a power IC not work correctly because I missed a footnote in a table of values.

  • Don't take shortcuts, they don't exist.

  • Look up fiducials for automated assembly.
  • Look up panelization if you want to make quite a few copies of it.

I recommend the ESP32 due to it offering decent power, wifi, bluetooth, and a few other small things all for $3.75 per module. While I'm not a fan of using modules, it's necessary for smaller projects where 10 grand or more in FCC licensing fees isn't an option. You can leverage the FCC certification of the ESP32 in your own design. If I'm not mistaken, all commercial electronics must get certified by the FCC, which is always going to cost at least a thousand or two for a pass or a fail. So consider buying a spectrum analyzer to do some pre-testing. Don't buy it until you need it xD I bought one and have never used it, just a big waste of money so far.

Consider implementing JTAG to have your PCB digitally inspect itself after assembly. As mentioned before, the ESP32 has its own programming tool.

Pay attention to the capabilities of the PCB fabrication service you choose. If you look at the pictures in this step, you'll see the difference between OSHPark (a general/bulk hobbyist service) and some Chinese company.

Pull out a caliper or something and make sure you know how big/small the parts are you're using. On this model shown (Proto2, my first PCB), I got the resistors and capacitors, and thought "they looked a LOT bigger on the screen" xD

"I hope you fail!" - Dave from EEVBlog in one of his videos. Failure, means you're learning, and boy did I do a lot of expensive learning.

I happen to have the Eagle files for this board (Proto2) still (uploaded).

Here's the OSH Park Order too.

Step 6: Try Again! and Again! and Again! (More Prototyping, and Lots of Learning)

You will fail, and you will try again! And you will fail again, and you will try again! (Board files available in each link) The last bit is what is important, you will try again! With each mistake/failure you will learn something new.

This prototype (proto 3 in the first two pictures), I switched to using more realistically hand-placeable passives. This went well, however, I neglected to look at other potential size issues, and came to the realization that I can't really hand place the Power IC, and it was also too small for OSHPark to be able to make a quality footprint for, with solder mask between the pads. At this point, rushed to make a working MVP (I had a guy anxious to use it, so there was a bit of pressure), I decided to simplify a bit.

Here is the OSHPark link to the Proto3 board.

Proto-4, shown in the 3rd-5th pictures, I went back to using a development board, to avoid the time and trouble associated with trying to make sure that module was soldered properly, and avoid the issues with the wifi I was expecting. I also switched to a simpler/larger power supply. Unfortunately, I neglected to read a footnote in the datasheet of this power supply (now that I was starting to want to rush through things) and it ended up not providing the right voltage 90% of the time. I believe I just decided to power it through the usb port, and the communications didn't work either! I don't really remember the exact cause but remember thinking I really overestimated optical isolators and just assumed each one is fast enough, however I think I may have just mixed up resistor values being in a rush and losing sleep. Back then, I lived with cats, which I was severely allergic to, I'd wake up and chug nyquil (daily) so the day was bearable, and a monster to counteract the nyquil, then go work a full day, then stay afterwards to work on this stuff (or work from home), skip sleep, inhale some adrenaline so I could breathe better (cats gave me some funky asthma on the daily) and stay awake more too. I made a lot of poor health choices in favor of gitt'n er done. Don't forget to sleep, sleep loss causes insomnia, which leads to decreased productivity. Don't forget to eat, obviously that decreases productivity. Don't forget to slow down and do things right, no shortcuts, or you're wasting your time and money (at best, you're learning what not to do).

Here is the OSHPark link to the Proto4 board.

At this point, I had had it and decided to go back and focus on making the device the way it ought to be, slow and steady. But not without one final low effort shot to get a ready to use reproducible prototype that I can mail to the guy I knew, and make him happy. Introducing Proto-5, the "too simple to fail" model, basically the same circuit as Proto-1, just a bit fancier. Used pin headers so that I'd not waste photon boards in the event a device breaks or doesn't work, also so a Electron (cell signal) board could be swapped in there easily. Whelp, was rushing it, forgot a connection or two, somehow it didn't work even after bridging the connection I forgot to make, seemed to be a power supply issue but I wasn't able to fix it by soldering on more capacitors. Rather than investigate the cause, being rushed, I just dropped it and moved on for once. Did all my crying internally, and kept moving forward.

Here is the OSHPark link to the Proto5 board.

Step 7: Get Your Final Design and Get It Production Ready

I finally went back and put a decent effort in on making a device using the Espressif's ESP32 module. The board was panelized for faster assembly (in the biggest size that fits in my toaster oven and solder stencil applicator), I re-researched the power supply options and came up with the same answer as Proto2&3, so made it using that small IC now that I had a pick and pace machine to help with assembly (although I don't think it's necessary anymore). I switched pcb fabricators for more precise capabilities and lower costs, went with a Chinese company (something I don't want to do again). In general, I got my act together and got a decent board made. So much failures and expenses over a circuit that's basically two isolators T-T.

The OSHPark link to Proto6 is here. << Although, I think I made some (minor/non-critical) changes after submitting this exact file. Notice the markings by the MDB connectors indicating the gender of connector that goes there, it's an easy way to avoid putting a connector on the wrong side. I can not make changes to this as I nolonger have a license to use Eagle anymore (also unemployed n bad stuff like that), but if you do, I recommend switching the isolator to use two TCP817 isolators instead of the LTV826S. Also add JTag while you're at it to the ESP32 (page 14, and find the headers that match those used on the ESP32 programmer to use for that. Feel free to increase the size of the passives used, and of course add any extra hardware you personally need. If you aren't making any changes to it, I recommend at least reviewing the design and making sure the BOM parts are indeed the ones that fit the PCB. This last design went through a lot of last minute changes and alterations. I can tell you that, the diode in the BOM is one I decided against, and the one I actually used is here.

If I haven't mentioned it yet, there are no surface mount Minifit Jr connectors, so edge mounting them the way I have is the most compact method of doing so. There is one connector that comes preloaded with pins in it which are adaptable as an edge mounted connector. For the other connector, you must insert crimped connections, and this as compact as it gets. If you match up the PCB thickness, and wire gauge, you ought to have it fit together pretty nicely like that. Keep in mind how these connectors affect the assembly process in mass production. I've contacted Molex about it and they say you need to order millions of units and stuff like that to have a new/custom connector made. Consider making your own if you think you can figure it out, and it's an issue to you too (not having a SMT connector).

The video referencing a CNC machine, is talking about one I was planning on saving up for (pocket nc), not the Shapeoko 3. These videos were years ago.

Good luck with your vending project, I hope this helps & you are successful.

PCB Contest

Runner Up in the
PCB Contest

Be the First to Share


    • Robots Contest

      Robots Contest
    • Organization Contest

      Organization Contest
    • Halloween Contest

      Halloween Contest



    8 months ago

    Hi, It is possible for you to publish the code?
    I am having a problem to find any reasonable code about MDB communication.


    1 year ago


    Thanks for the great article! could you please share me the source code?

    Thanks in advance.


    1 year ago

    Hey, I have a problem understanding a universal satellite device. Is it another vending machine?


    1 year ago

    could you please share the source code and the videos.



    Question 1 year ago


    Thanks for the great article! However, I found the youtube videos are in private.

    May I know if you mind updating the permission so I can follow your videos?



    2 years ago on Introduction

    Hi there, it's me in the video - and i have no problems that you refer to it !
    I am a big tinker/hobbyist fan myself - and happy to help out with knowledge, tips and support on non-commercial projects.

    There are always 2 kind of groups out there ..
    Those who tinker and play - (as i said i am part of that)
    Those professional users who need support, warranty, long term availability etc.

    Yes, our products cost money, but that covers development and support and creates jobs, which at the end allows a living for most of us.

    I'm inspired by your article, and will provide some more explainer videos :)


    Johannes Rietschel
    Small business owner,