Talking to a Vending Machine MDB With Two Arduinos





Introduction: Talking to a Vending Machine MDB With Two Arduinos

Vending machine parts all talk to each other on a computer bus known as MDB.  I've written some code to help you plug in and listen to their conversation in real time.  You will need physical access to the vending machine.

Why bother?  Many hackspaces have vending machines now.  With this I hope that more hackspaces can start to poke their machines to do interesting things - take bitcoin, give a discount for a secret knock.... whatever you want.

Grab everything on github

You'll need to build the circuit described in the github project, two arduinos, a USB cable, and your PC with Arduino software.

Step 1: Build the Circuit

The MDB 4.2 spec details the safe way to connect and listen/talk to the vending machine.

The github project has a schematic created by the members of the Nottingham Hackspace.  It's really helpful that they added a way to power the arduinos from the 34 volt rail in the vending machine.  They also figured out a lot of the original low level trickery.  Mad props to them.

Follow these references and build yourself a circuit like you see here.  Since this photo was taken I've secured the second arduino to the board.

The black 30 pin connector is part of the MDB cable.  Two optoisolators prevent either side of the sytem from damaging the other.

Step 2: Install the Code

Grab the firmware on github, if you didn't already.

Upload "near_MDB" to the arduino next to the circuit board.

Upload "near PC" to the arduino near your computer.

Step 3: Run!

Connect near MDB pin 10 to near PC pin 11.

Connect near MDB pin 11 to near PC pin 10.

Connect near PC to your computer with the USB cable.

Open Arduino and connect to the near PC machine.  It should say "Hello from near PC".

Turn on your vending machine (if it isn't already).  Messages should begin to flow.  Read, learn, and enjoy!

Step 4: Final Thoughts

If you liked this tutorial please visit my blog and share with your friends.



  • Epilog Challenge 9

    Epilog Challenge 9
  • Paper Contest 2018

    Paper Contest 2018
  • Gluten Free Challenge

    Gluten Free Challenge

We have a be nice policy.
Please be positive and constructive.




it wass nice if you said: if you want the documentation A-Z costs you 10 USD. or 1000 USD. but don't trick me

Hi I am trying to do this project but when i went through the schematic diagram there are two capacitors with a ? next to it and no values can you give the values of the capacitor needed please.

Thanks for your help

Did you ever find out the value for those two capacitors? Thanks for your help!

Hi aggrav8d,

Congratulations for this post, I am very interested to do this project, I am starting to use arduino and I think I can do it, just looking for the circuit diagram and I can´t find it, how can I download it?

Hi, may be here it works...

I try to use your files from github, but have some problems.
First of all, am I to connect To_Nanode_Rx to NearMDB Arduino Rx (D0) and To_Nanode_Tx to NearMDB Arduino Tx (D1) &
Should there be answer from NearMDB Arduino (A1) on serial port monitor of NearPC Arduino (A2) even when MDB is not connected?

Sorry for dumb questions, I just neeed a kick to start)

is it possible that you could supply a component list for the parts you used. I switched our drink machine to rfid, and everyone wants me to switch over the vending machine

the coin machine is one of these(pictures), i want comunicate one whit a pc.


Hi, I want to connect a coin changer mdb to pc, can i try whit your code whit the two arduinos or i need change some lines??

thanks for your time and your help