Has anyone tried to connect a coffee vending machine with a particle device, such as a Boron, to receive payments through an app? Vending machines have a main controller called Master Data Bus (MDB), which, apart from regulating the machine's services, connects with payment devices, such as coins, bills, credit card acceptors, etc.
My idea is to replace the traditional means of payment with the user having my app installed, where they already have the balance they will consume. The user will ask the machine for a coffee, they will receive it in Boron, and it will, in turn, send them the signal for the coffee or product to be delivered. Has anyone here done something like this? Do you have any recommendations?
I don't know of any implementation of MDB for Particle devices. One issue that you will encounter is that Gen 3 (nRF52) and Gen 4 (RTL872x) UARTs don't support 9-bit mode. The most commonly used I2C/SPI external UART, the SC16IS7xx also does not support 9-bit mode either.
I have some experience building vending machine peripherals like you describe. My first recommendation is to become familiar with the MDB specification. This spec is north american specific, I do know that some European machines may behave differently.
As Rick points out, the main challenge is that the MDB serial protocol is a bit strange.
Chapter 2 of the spec defines the protocol as an 11 bit byte operating at 9600 baud NRZ (non return to zero):
1 start bit
8 Data bits
1 Mode bit: this means different things if it is VMC -> peripheral or peripheral -> VMC
1 Stop bit
I dont know if there are any serial libraries that can generate this kind of byte format. You may have to build your own. The good news is that at 9600 baud it should be bit-bangable in software and usable with GPIO pins instead of a USART.
If you can get the byte format implemented, look at the session examples in section 2.5 to get a basic poll/ack sequence working. The peripheral you want to implement is a "Cashless Device". The specification for those commands is in Section 7. Pay attention to the state definitions there.
In general, the spec for Cashless Devices was written in the early 90s where most payment cards were stored value on the physical card itself. The concept of internet connectivity and authorization wasnt built into the spec. Keep that in mind if the workflow is a bit strange to you.
As far as hardware goes, look at section 4 for specifics. The TX/RX pins operate at 5v, so you will need a level shifter or some other kind of hardware to communicate from a Particle device. If you want to power the Boron from the MDB bus harness itself, you will likely need additional hardware since the MDB bus supplies 34 VDC. See section 4.3.6 / section 4.4.
This information clarifies to me that it is not that simple, in fact I see that the MDB is an old protocol that was not designed for current media. I'm going to investigate the machine a little more in depth to understand how far I can go. Many thanks for this clarification!
I wonder if the machine also the ability to handle pulse inputs...?
We have been able to sidechain pulse compatible laundry machines and coin receivers, reading pulses using simple optocoupler w/current limiting resistor, and writing pulses with a small relay.