ETHDenver Token Dispenser

ETHDenver Token Dispenser

At ETHDenver we wanted attendees to be able to interact with a physical currency derived from a virtual event currency.

I connected the vending machine over a pulse interface to a Raspberry PI running a docker image to read the balance of a blockchain account every 10 seconds. When the balanced increased, it dispensed the corresponding number of tokens.

GitHub - iainnash/ethdenver-iot-tokens: IOT Token Dispenser Code w/ ZKSync era
IOT Token Dispenser Code w/ ZKSync era. Contribute to iainnash/ethdenver-iot-tokens development by creating an account on GitHub.

The code is shown above. Interfacing with a machine that's 40 years old was actually pretty easy other than one issue: the number of tokens being dispensed where the machine didn't have enough time to fetch the token. The interface being write-only sadly the best fix was to increase the delay between pulses so the token vending machine was ready to dispense the tokens as needed. Ideally, the interface would be more complex to use a read line that would tell the controller once the dispenser was ready to dispense tokens.

To interface the physical device I used a simple mosfet to drive the control signal low. The interface into the machine was active low at 12v logic voltage – much higher than the Raspberry PI's interface voltage of 3.3v. In order to fix this mismatch, the Rasberry PI drove a mosfet to ground at 3.3v which then could properly sink the 12v coming from the coin dispenser.