Liz - Blitz City DIY
Published © CC BY-NC-SA

Jack: The 3D Printed, Blinking Jack-O'-Lantern

Just in time for Halloween, here's a project that's an electrified ode to the classic carved squash.

BeginnerFull instructions providedOver 1 day370
Jack: The 3D Printed, Blinking Jack-O'-Lantern

Things used in this project

Hardware components

Diffused Red 10mm LED
×2
Adafruit GEMMA M0
×1
Slide Switch
Slide Switch
×1
Adafruit Lithium Ion Polymer Battery - 3.7v 500mAh
×1

Software apps and online services

Fusion 360
Autodesk Fusion 360

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)

Story

Read more

Custom parts and enclosures

Fusion360 File

Live Fusion360 link

STL Files on Thingiverse

Download the .STL files for Jack on Thingiverse

Schematics

Circuit for Jack

Code

Circuit Python Code for Jack

Python
Controls the LEDs attached to the Gemma M0. The switch in the circuit allows the LEDs to either use PWM or just be statically on.
import time
import board
import pulseio
from digitalio import DigitalInOut, Direction, Pull

ledPWM = pulseio.PWMOut(board.D0, frequency=5000, duty_cycle=0)
switch = DigitalInOut(board.D1)
switch.direction = Direction.INPUT
switch.pull = Pull.UP

while True:
    if switch.value:
        for i in range(80):
            if i < 40:
                ledPWM.duty_cycle = int(i * 2 * 65535 / 80) 
            else:
                ledPWM.duty_cycle = 65535 - int((i - 40) * 2 * 65535 / 80)  
            time.sleep(0.01)
    else:
        ledPWM.duty_cycle = 65535
        time.sleep(0.01)

Credits

Liz - Blitz City DIY

Liz - Blitz City DIY

6 projects • 63 followers
\\ DIY-er on a quest to gather and share knowledge. She/her.

Comments