Magic Band Reader
2022-12-20 | By Adafruit Industries
License: See Original Project LED Strips RFID / NFC
Courtesy of Adafruit
Guide by Ruiz Brothers
Overview
You can build your own Disney magic band scanner with Adafruit Feather RP2040 and CircuitPython.
This project uses the RFID Wiz Kit to scan your Disney magic bands to animate a strip NeoPixels and plays your favorite sound effects.
Prerequisite Guides
Take a moment to review the guides.
- Feather RP2040
- CircuitPython LED animations
- Controlling Devices with Wiz Kit RFID
- MAX98357 I2S Amplifier
Parts
- RFID Wiz Kit by Smooth Technology
- Adafruit NeoPixel LED Side Light Strip - Black 120 LED
- Adafruit Feather RP2040
- Mini Oval Speaker - 8 Ohm 1 Watt
- Adafruit I2S 3W Class D Amplifier Breakout - MAX98357A
- Silicone Cover Stranded-Core Ribbon Cable - 10 Wire 1 Meter Long
- Black Nylon Machine Screw and Stand-off Set – M3 Thread
- 1 x STEMMA JST PH
- 1 x JST PH 2mm 3-Pin Socket
- 1 x Black Nylon Machine Screw and Stand-off Set
Circuit Diagram
The diagram below provides a visual reference for wiring of the components. This diagram was created using the software package Fritzing.
Adafruit Library for Fritzing
Use Adafruit's Fritzing parts library to create circuit diagrams for your projects. Download the library or just grab individual parts. Get the library and parts from GitHub - Adafruit Fritzing Parts.
Wired Connections
The Wiz Kit is powered by the 12V 2A power supply wall adapter. The Feather is powered by USB 5V 1A power supply wall adapter.
MAX98357A Amp
- LRC to D25 pin on Feather
- BCLK to D24 pin on Feather
- DIN to A3 pin on Feather
- VIN to 3.3V pin on Feather
- GND to GND pin on Feather
NeoPixel Strip
- 5V to USB pin on Feather
- GND to GND pin on Feather
- Din to D6 pin on Feather
Wiz Kit RFID
- 5V SIG pin to A1 pin on Feather
- GND pin to GND pin on Feather
Speaker
- Red wire to voltage input on MAX98357A
- Black wire to ground input on MAX98357A
Install CircuitPython
CircuitPython is a derivative of MicroPython designed to simplify experimentation and education on low-cost microcontrollers. It makes it easier than ever to get prototyping by requiring no upfront desktop software downloads. Simply copy and edit files on the CIRCUITPY drive to iterate.
CircuitPython Quickstart
Follow this step-by-step to quickly get CircuitPython running on your board.
Download the latest version of CircuitPython for this board via circuitpython.org
Click the link above to download the latest CircuitPython UF2 file.
Save it wherever is convenient for you.
To enter the bootloader, hold down the BOOT/BOOTSEL button (highlighted in red above), and while continuing to hold it (don't let go!), press and release the reset button (highlighted in blue above). Continue to hold the BOOT/BOOTSEL button until the RPI-RP2 drive appears!
If the drive does not appear, release all the buttons, and then repeat the process above.
You can also start with your board unplugged from USB, press and hold the BOOTSEL button (highlighted in red above), continue to hold it while plugging it into USB, and wait for the drive to appear before releasing the button.
A lot of people end up using charge-only USB cables and it is very frustrating! Make sure you have a USB cable you know is good for data sync.
You will see a new disk drive appear called RPI-RP2.
Drag the adafruit_circuitpython_etc.uf2 file to RPI-RP2.
The RPI-RP2 drive will disappear, and a new disk drive called CIRCUITPY will appear.
That's it, you're done! :)
Safe Mode
You want to edit your code.py or modify the files on your CIRCUITPY drive but find that you can't. Perhaps your board has gotten into a state where CIRCUITPY is read-only. You may have turned off the CIRCUITPY drive altogether. Whatever the reason, safe mode can help.
Safe mode in CircuitPython does not run any user code on startup and disables auto-reload. This means a few things. First, safe mode bypasses any code in boot.py (where you can set CIRCUITPY read-only or turn it off completely). Second, it does not run the code in code.py. And finally, it does not automatically soft-reload when data is written to the CIRCUITPY drive.
Therefore, whatever you may have done to put your board in a non-interactive state, safe mode gives you the opportunity to correct it without losing all of the data on the CIRCUITPY drive.
Entering Safe Mode in CircuitPython 6.x
This section explains entering safe mode on CircuitPython 6.x.
To enter safe mode when using CircuitPython 6.x, plug in your board or hit reset (highlighted in red above). Immediately after the board starts up or resets, it waits 700ms. On some boards, the onboard status LED (highlighted in green above) will turn solid yellow during this time. If you press reset during that 700ms, the board will start up in safe mode. It can be difficult to react to the yellow LED, so you may want to think of it simply as a slow double click of the reset button. (Remember, a fast double click of reset enters the bootloader.)
Entering Safe Mode in CircuitPython 7.x
This section explains entering safe mode on CircuitPython 7.x.
To enter safe mode when using CircuitPython 7.x, plug in your board or hit reset (highlighted in red above). Immediately after the board starts up or resets, it waits 1000ms. On some boards, the onboard status LED (highlighted in green above) will blink yellow during that time. If you press reset during that 1000ms, the board will start up in safe mode. It can be difficult to react to the yellow LED, so you may want to think of it simply as a slow double click of the reset button. (Remember, a fast double click of reset enters the bootloader.)
In Safe Mode
Once you've entered safe mode successfully in CircuitPython 6.x, the LED will pulse yellow.
If you successfully enter safe mode on CircuitPython 7.x, the LED will intermittently blink yellow three times.
If you connect to the serial console, you'll find the following message.
Auto-reload is off.
Running in safe mode! Not running saved code.
CircuitPython is in safe mode because you pressed the reset button during boot. Press again to exit safe mode.
Press any key to enter the REPL. Use CTRL-D to reload.
You can now edit the contents of the CIRCUITPY drive. Remember, your code will not run until you press the reset button, or unplug and plug in your board, to get out of safe mode.
Flash Resetting UF2
If your board ever gets into a really weird state and doesn't even show up as a disk drive when installing CircuitPython, try loading this 'nuke' UF2 which will do a 'deep clean' on your Flash Memory. You will lose all the files on the board, but at least you'll be able to revive it! After loading this UF2, follow the steps above to re-install CircuitPython.
Download flash erasing "nuke" UF2
Coding the Magic Band Reader
Once you've finished setting up your Feather RP2040 with CircuitPython, you can access the code and necessary libraries by downloading the Project Bundle.
To do this, click on the Download Project Bundle button in the window below. It will download as a zipped folder.
# SPDX-FileCopyrightText: 2022 Noe Ruiz for Adafruit Industries
# SPDX-License-Identifier: MIT
# Magic Band Reader with Wiz Kit RFID
import random
import board
import digitalio
import audiobusio
from audiocore import WaveFile
import neopixel
from adafruit_led_animation.animation.chase import Chase
from adafruit_led_animation.animation.solid import Solid
from adafruit_led_animation.color import (
GREEN,
BLACK,
)
# Setup button switch
button = digitalio.DigitalInOut(board.A1)
button.switch_to_input(pull=digitalio.Pull.DOWN)
# LRC is word_select, BCLK is bit_clock, DIN is data_pin.
# Feather RP2040
audio = audiobusio.I2SOut(bit_clock=board.D24, word_select=board.D25, data=board.A3)
# Make the neopixel object
pixels = neopixel.NeoPixel(board.D6, 24, brightness=.4)
# Setup the LED animations
chase = Chase(pixels, speed=0.02, color=GREEN, size=4, spacing=24)
solid = Solid(pixels, color=BLACK)
#Fuction for playing audio
def play_wav(name):
print("playing", name)
wave_file = open('sounds/' + name + '.wav', 'rb')
wave = WaveFile(wave_file)
audio.play(wave)
#List of audio files
sounds = [
'chime',
'excellent',
'foolish',
'hello',
'operational',
'startours'
]
while True:
print("Waiting for button press to continue!")
while button.value:
solid.animate()
play_wav(random.choice(sounds))
while audio.playing:
chase.animate()
print("Done!")
Upload the Code and Libraries to the Feather RP2040
After downloading the Project Bundle, plug your Feather into the computer's USB port with a known good USB data+power cable. You should see a new flash drive appear in the computer's File Explorer or Finder (depending on your operating system) called CIRCUITPY. Unzip the folder and copy the following items to the Feather RP20402's CIRCUITPY drive.
- code.py
- lib directory
- wav directory
Your Feather RP2040 CIRCUITPY drive should look like this after copying the lib folder, wav folder and the code.py file.
Training a Tag
Training a tag on the RFID WIZ couldn't be easier. Simply hold the tag over the red reader board and press the "Train" button.
You'll see the Status light flash green, and you'll see the green LED by the Relay light up as well. This will stay lit until you remove the tag. The green LED displays the state of the relay and 5v logic output. You'll also hear the click of the relay when it changes state.
You can repeat this process with multiple tags. Training up to 20 tags has been tested with stability. Upwards of 40 should be possible but attempt at your own risk
CAD Files
CAD Parts List
STL files for 3D printing are oriented to print "as-is" on FDM style machines. Parts are designed to 3D print without any support material. Original design source may be downloaded using the links below:
- Back Cover.stl
- Base Bottom Cover.stl
- Base Frame.stl
- Base Top Cover.stl
- Case.stl
- Face Diffuser.stl
- Face Mickey Outline.stl
- Face Mickey.stl
- Face Outer Ring.stl
- NeoRing.stl
- PCB mount.stl
- Pole.stl
- RFID-standoff.stl
CAD Assembly
The Feather, amplifier and Wiz Kit board are secured to the PCB mount. The PCB mount is secured to the base bottom cover. The base bottom cover snap fits onto the base frame.
The base frame snap fits into the base top cover. The base top cover is secured to the pole. The pole is secured to the case. The NeoPixel strip is press fitted into the NeoRing holder.
The NeoRing holder is press fitted into the case. The RFID module is secured to 3D printed standoffs. The 3D printed standoffs are secured to the back cover. The back cover is press fitted onto the case.
The face diffuser is press fitted into the case. The mickey face out and out ring are press fitted into the face diffuser. The speaker is attached to the face diffuser with the adhesive.
Build Volume
The parts require a 3D printer with a minimum build volume.
- 114mm (X) x 114mm (Y) x 50mm (Z)
Faceplate Diffuser
The Face Diffuser.stl part should be printed in translucent filament. This will allow the NeoPixel LEDs to shine through and illuminate the features.
Design Source Files
The project assembly was designed in Fusion 360. This can be downloaded in different formats like STEP, STL and more. Electronic components like Adafruit's boards, displays, connectors and more can be downloaded from the Adafruit CAD parts GitHub Repo.
Wiring
NeoPixel Strip
Remove the NeoPixel strip from the reel to get it ready for wiring.
Cut NeoPixel Strip
Cut a section of the strip with 31 NeoPixel LEDs using flush diagonal cutters.
Remove the stock cable from the pads of the first NeoPixel LED.
Remove the silicone sheathing from the NeoPixel strip section.
NeoPixel Cable
The 3-pin STEMMA JST cable is used to connect the NeoPixel strip to the Feather.
Use the silicone cover ribbon cable to extend the length of wire so the cable is 10in(254mm) long.
Connect Cable to NeoPixel
Solder the three wires from the STEMMA JST cable to the pads on the first NeoPixel LED.
Red wire to 5V pad, black wire to GND pad and white wire to the DATA IN pad.
Wired NeoPixel Strip
Double check the wires are properly soldered to the pads on the first NeoPixel LED.
NeoPixel Cable for Feather
The 3-pin JST socket cable will be soldered to the Feather.
Cut the three wires from the cable so they're about 2in (50mm) in length.
RFID Cable for Feather
The stock 2-pin cable is included with the RFID Wiz Kit.
Cut the two wires so they're about 2in (50mm) in length.
Speaker Wire Extension
The speaker wire will need to be extended in order to reach the amplifier.
Use the silicone ribbon cable to increase the length of wire so they're about 10in (254mm) in length.
Use pieces of heat shrink tubing to insulate the exposed wire.
Wires for Amplifier
Use the silicone ribbon cable to create a 5-pin short cable.
Measure the length of wire to about 2in(50mm) long.
Solder the wires to the pins on the amplifier.
Cables for Feather
Get the cables for the Feather ready to solder.
Connect NeoPixel Cable to Feather
Solder the red wire to the USB pin on Feather. Solder the black wire to a ground pin on the Feather. Solder the white wire to D6 (GP08) pin.
Connect Amplifier to Feather
Make the following connections to the Feather.
- LRC to 25 pin on Feather
- BCLK to 24 pin on Feather
- DIN to A3 pin on Feather
- VIN to 3V pin on Feather
- GND to GND pin on Feather
Connect RFID cable to Feather
Solder the red wire to pin A1 on Feather. Solder the black wire to the ground pin on Feather.
Soldered Feather
Take a moment to check all of the wires have been properly soldered to the Feather.
Assembly
Install NeoPixel Strip to Holder
Insert the NeoPixel strip into the 3D printed ring holder.
Press the cable through the slit on the inside of the holder.
NeoPixel Holder
The NeoPixel strip is held in place with the cable going out through the center of the holder.
Hardware for PCB Mount
Use 4x 6mm long M-F hex standoffs for the PCB mount.
Install Standoffs to PCB Mount
Use a M3 screw tap to create threads in the four built-in standoffs on the PCB mount.
Insert and fasten the standoffs into the built-in standoffs.
Reference the photo for correct orientation.
M3 Standoffs for PCB Mount
Double check the M3 standoffs have been properly installed to the built-in standoffs in the PCB mount.
Hardware for Feather
Use the following hardware to attach the Feather to the PCB mount.
- 4x 10mm long M2.5 screws
- 8x M2.5 hex nuts
Install Screws to Feather
Insert the M2.5 screws through the mounting holes on the Feather.
Fasten the M2.5 hex nuts onto the threads of the screws to secure them in place.
Install Feather to PCB mount
Orient the Feather with the USB-C port facing the correct direction.
Insert the threads of the screws through the mounting holes on the PCB mount.
Secure Feather to PCB Mount
Insert and fasten the M2.5 hex nuts to secure the Feather to the PCB mount.
Hardware for Amplifier
Use 2x M2.5 x 8mm long screws and 2x M2.5 hex nuts for securing the amplifier to the PCB mount.
Secure Amplifier to PCB mount
Place the amplifier over the mounting holes.
Insert and fasten M2.5 screws through the mounting holes.
Use the M2.5 hex nuts to secure the amplifier to the PCB mount.
Assembled PCB mount
Double check the PCB mount has been properly assembled.
Hardware for RFID board
Use 4x M3 x 4mm long screws to secure the RFID board to the PCB mount.
Install RFID board to PCB mount
Orient the RFID board with the PCB mount and place it over standoffs with the mounting holes lined up.
Secure RFID to PCB mount
Insert and fasten the M3 screws to secure the RFID board to the PCB mount.
Connect Cable to RFID board
Plug in the 2-pin cable from the Feather to the 2-pin JST port on the RFID board.
Hardware for RFID module
Use 4x M3x6mm metal screws to secure the RFID module to the back cover.
Secure Standoffs to Cover
Insert and fasten the M3 screws to the back cover to secure the two 3D printed standoffs.
Secure RFID module to Standoffs
Place the RFID module over the standoffs and line up the mounting holes.
Insert and fasten two M3 x 6mm long metal screws to secure the RFID module.
Secured RFID Module
Double check the RFID module is properly secured to the back cover.
Attach Pole and Cover
Use two M3 x 6mm metal screws to secure the 3D printed pole to the case top cover.
Secure Pole to Case
Use two M3 x 10mm long metal screws to secure the 3D printed hole to the case.
Line up the pole’s mounting tabs with the mounting holes on the case.
Press fit the pole into the cavity on the case.
Secure Case to Pole
Insert and fasten the two M3 x 10mm long metal screws through the mounting holes in the case.
Insert and fasten the two M3 hex nuts to secure the case to the pole.
Assembled Case and Pole
Take a moment to check the three parts are properly secured together.
Mickey Face Plate
Get the various pieces ready to install together to make the Mickey face plate.
Assemble Face Plate
Press fit the various pieces together to assemble the Mickey face plate.
Install Face Plate
The Mickey face plate is press fitted into the case.
Press the edges of face plate into the recess of the case so it's flush with the top surface.
Install Speaker
Peel off the protective backing from the front of the speaker to reveal the sticky adhesive.
Place the speaker over the three holes on the face plate.
Press the speaker onto the surface of the face plate to secure it in place.
Install NeoPixel Holder
Get the NeoPixel holder ready to install into the case.
Begin installing the holder into the case.
Secured NeoPixel Holder
Press the NeoPixel holder into the case until it sits flush.
Insert and thread the various cables through the pole and out through the other end.
Installing RFID module
Insert the ribbon cable from the RFID module through the pole and out the other end.
Install Back Cover
Orient the back cover with the case.
Press fit the back cover into the case.
Assembled Case
Double check the back cover is secured to the case.
Install Base Frame
The base frame is press fitted onto the pole cover.
Orient the base frame with the case so the side with the cut outs are facing the up with the case cover.
Connect RFID Cable
Plug in the ribbon cable from the RFID module to the Wiz Kit dev board.
Connect NeoPixel to Feather
Plug in the 3-pin JST cable from the NeoPixel strip to the accompanying cable on the Feather.
Speaker Wire Connect
Insert the two wires from the speaker to the screw block terminal on the amplifier.
Use a screwdriver to secure the speaker wires.
Hardware for Base Bottom Cover
Use 4x M3 x 10mm long metal screws to secure the PCB mount to the base bottom cover.
Installing PCB mount
Orient the PCB mount with the base bottom cover so the mounting holes are lined up with the standoffs.
Secure PCB mount
Insert and fasten the M3 screws to secure the PCB mount to the base bottom cover.
PCB mount
Double check the PCB mount is properly secured to the base bottom cover.
Install Base Bottom Cover
Carefully fit the excess wiring into the pole and base frame.
Secured Base Bottom Cover
Press fit the base bottom cover into the base frame.
The USB port and DC jack should be oriented with the cutouts in the base frame.
Final Build
Congratulations on your build!
Use
Train your bands with the RFID Wiz board per the instructions on this guide web page.
Once your magic band has been trained with the Wiz Kit board, bring the magic band close to the Mickey face plate to trigger the NeoPixels and sound effect.
Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.
Visit TechForum