Overview
Welcome to the Adafruit guide on creating a stunning Badger Mountain themed art piece! In this guide, we'll show you how to bring your artistic vision to life using the powerful Feather RP2040 microcontroller, along with an array of components including audio jacks, buttons, and LED strips.
At the heart of this project lies the Feather RP2040 microcontroller, a versatile and powerful board that serves as the brain of your creation. Powered by the RP2040 microchip, this board offers ample computing power and a rich set of features to fuel your creativity. With the Feather RP2040, you can seamlessly integrate various components such as audio jacks, allowing your art piece to play soothing melodies or ambient sounds, enhancing the overall experience for your audience.
But that's not all! Incorporating buttons into your design enables viewers to interact with your artwork, triggering different animations or effects at the touch of a button. Whether it's changing colors or activating special sequences, the possibilities are endless with the Feather RP2040.
From tranquil sunset hues to vibrant auroras dancing across the sky, the LED strips offer a kaleidoscope of colors and patterns to mesmerize your audience.
In this guide, we'll walk you through the process of setting up your Feather RP2040, integrating audio jacks and buttons, and controlling LED strips to bring your Badger Mountain themed art piece to fruition. Get ready to embark on a journey of creativity and innovation as we illuminate the beauty of Badger Mountain through art and technology. Let's get started!
Below is a wiring diagram illustrating the setup for your Badger Mountain themed art piece using 8 buttons, 1 audio jack, and 1 LED strip separated into pixel subsets:
- Feather RP2040: The central microcontroller that powers and controls the entire setup.
- Audio Jack: Connected to the Feather RP2040 to enable sound output for your art piece.
- LED Strip: Connected to the Feather RP2040, this strip is divided into pixel subsets that can be controlled individually or collectively to create dynamic lighting effects.
- Buttons (8 total): These buttons are connected to the Feather RP2040 and serve as input devices for user interaction. Each button can trigger different animations or effects in your art piece.
The Feather RP2040 serves as the hub, controlling the audio output, button inputs, and LED strip lighting. Each component is wired to the Feather RP2040 according to its specific pin requirements.
You can refer to the documentation of each component and the Feather RP2040 to identify the appropriate pins for wiring. Additionally, you'll need to write code that interfaces with each component to achieve the desired functionality of your Badger Mountain themed art piece.
Once you've finished setting up your Feather RP2040 with CircuitPython, you can access the code and necessary libraries.
To do this, click on the link below. It will download to your computer as a zipped folder you can then transfer onto your microcontroller.
This section is where you import the neccessary colors, animation, sound items and regular microcontroller imports.
print("flop") import time import board from audiocore import WaveFile import audiomixer import digitalio from audiopwmio import PWMAudioOut as AudioOut import neopixel from adafruit_led_animation.animation.solid import Solid from adafruit_led_animation.animation.blink import Blink from adafruit_led_animation.animation.pulse import Pulse from adafruit_led_animation.animation.comet import Comet from adafruit_led_animation.animation.colorcycle import ColorCycle from adafruit_led_animation.animation.SparklePulse import SparklePulse from adafruit_led_animation.animation.chase import Chase from adafruit_led_animation.animation.sparkle import Sparkle from adafruit_led_animation.color import RED, ORANGE, YELLOW, GREEN, TEAL, CYAN, BLUE, PURPLE, MAGENTA, WHITE, BLACK, GOLD, PINK, AQUA, JADE, AMBER, OLD_LACE from adafruit_led_animation.helper import PixelSubset
This section is where we set up different pixel subsets, organize animation, and set up lists for different pins.
pixel_pin = board.MISO pixel_num = 83 pixels = neopixel.NeoPixel(pixel_pin, pixel_num, brightness=0.3, auto_write=False) sign = PixelSubset(pixels, 0, 21) boot = PixelSubset(pixels, 21, 29) rock = PixelSubset(pixels, 29, 60) lupine = PixelSubset(pixels, 60, 68) cloud = PixelSubset(pixels, 68, 83) signanimation = Blink(sign, speed=0.5, color=RED) bootanimation = Pulse(boot, speed=0.01, color=ORANGE, period=1) rockanimation = Sparkle(rock, speed=0.05, color=OLD_LACE, num_sparkles=10) lupineanimation = Comet(lupine, speed=0.01, color=GREEN, tail_length=10, bounce=False) cloudanimation = Chase(cloud, speed=0.5, color=BLUE, size=4, spacing=3) buttonpins = [board.D5,board.D9,board.D11,board.D13,board.D25,board.A1,board.A3,board.SDA] ledpins = [board.D4,board.D6,board.D10,board.D12,board.D24,board.A0,board.A2,board.SCL] beats = ["1.wav", "2.wav", "3.wav", "4.wav", "5.wav", "6.wav", "7.wav","8.wav"] animations = [signanimation, cloudanimation, rockanimation, None, bootanimation, lupineanimation, None, None] buttons = [] leds = []
Finally this section is for setting up the WavFile sound mixer so we are able to layer multiple sounds on at the same time along with the actions when a button is pressed.
for pin in buttonpins: button = digitalio.DigitalInOut(pin) button.direction = digitalio.Direction.INPUT button.pull = digitalio.Pull.UP buttons.append(button) for pin in ledpins: led = digitalio.DigitalInOut(pin) led.direction = digitalio.Direction.OUTPUT led.value = False leds.append(led) audio = AudioOut(board.SCK) path = "sounds.2040/" num_voices = len(beats) mixer = audiomixer.Mixer( voice_count=num_voices, sample_rate=44100, channel_count=1, bits_per_sample=16, samples_signed=True ) audio.play(mixer) for i in range(len(beats)): wave_file = open(path + beats[i], "rb") wave = WaveFile(wave_file) mixer.voice[i].play(wave, loop=True) mixer.voice[i].level = 0.0 time.sleep(1.0) while True: for button in buttons: if not button.value: # pressed? i = buttons.index(button) mixer.voice[i].level = 1.0 wave_file = open(path + beats[i], "rb") wave = WaveFile(wave_file) mixer.voice[i].play(wave, loop=True) time.sleep(3) leds[i].value = True if animations[i] is not None: animations[i].animate(show = True) if button.value: i = buttons.index(button) mixer.voice[i].level = 0.0 leds[i].value = False if animations[i] is not None: animations[i].fill(BLACK)
Our FLL team harnessed the power of the Tinkercad 3D printing app to bring our hiking masterpiece to life, demonstrating the incredible versatility and functionality of this innovative tool. Through Tinkercad, we meticulously crafted four essential 3D prints, each playing a pivotal role in the seamless construction of our project. Two prints discreetly supported the background canvas, showcasing the app's ability to execute intricate designs with precision. Another print ingeniously connected the aluminum poles, ensuring the stability of the canvas structure. The final two prints, though hidden from plain view, were the unsung heroes – responsible for securely housing buttons, managing wires, and housing the button box with the embedded speaker. Tinkercad's user-friendly interface and powerful capabilities empowered our team to not only realize our vision but also to engineer a robust and visually appealing solution for our hiking masterpiece.