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.
We have a be nice policy.
Please be positive and constructive.