playzing/doc/Card_dispenser.md
Cocktail Frank 4be9ddb561 Add doc for card dispenser and Arduino dispenser script
The Arduino dispenser script sends a single dispense signal every run

Add incomplete Python packaging configuration file
2026-07-05 13:24:42 -04:00

2.1 KiB

Card dispenser

The card dispenser is a Playzing-compatible peripheral device that can be set up to dispense a trading card when sent a signal from the Raspberry Pi GPIO pins.

Electronics

The dispenser comes with a button that dispenses one card per button press. The optocoupler replaces the button with the Raspberry Pi's GPIO, so the Pi can control the dispenser by sending a signal when a card should be dispensed.

  1. On the dispenser's circuit board are four switches that control the behavior of the dispense mechanism. To dispense one card per signal, switch #1 and #2 toward the bottom of the dispenser and #3 and #4 toward the top of the dispenser. This setting also stores signals received when a card has been dispensed but hasn't been taken yet. Once the card has been taken, the mechanism will dispense another card automatically.

  2. The top pin of the button wiring pins in the dispenser circuit board supplies 3.3V of constant power when the dispenser is powered on. Connect this pin to the OUT pin on the optocoupler.

  3. The bottom pin of the button wiring pins does not have a signal when the dispenser is powered on. Connect this pin to the GND pin on the optocoupler.

  4. Connect the control signal of the microcontroller to the + pin on the optocoupler. This project uses pin 37 of the Raspberry Pi GPIO as the control signal. There is also a test script that uses Arduino pin 3.

  5. Connect the ground pin of the microcontroller to the - pin on the optocoupler. This project uses pin 39 of the Raspberry Pi GPIO as ground. There is also a test script that uses Arduino pin 4 to simulate ground.

Programming

See trigger_test_pi.py for a standalone script that triggers the dispenser when GPIO pin 37 is wired to the optocoupler. There is also an Arduino version which can be used to test the dispenser with an Arduino connected to other devices besides the Playzing.