Mjölnir 2.0: IoT Smart Thor Hammer

by alemanja in Circuits > Sensors

819 Views, 2 Favorites, 0 Comments

Mjölnir 2.0: IoT Smart Thor Hammer

IMG_9149.jpg

Ever wondered if you're worthy to lift Thor’s hammer? In this project, I recreated Mjölnir using modern electronics: a Raspberry Pi Pico W, capacitive touch sensors, a hidden electromagnet, and motion-triggered sound effects. Connected to the cloud via Adafruit IO, this hammer judges your worthiness and even roars with thunder when you swing it!

Supplies

Electronics:

  1. Raspberry Pi Pico W
  2. MPR121 Capacitive Touch Sensor (STEMMA QT)
  3. ADXL345 Accelerometer
  4. MicroSD Card Reader
  5. Electromagnet
  6. P2N2222A NPN Transistor
  7. Speaker (small, powered by PWM)
  8. 1kΩ Resistor
  9. Micro USB cable
  10. USB battery pack
  11. MicroSD Card

Materials:

  1. 3D printed Thor hammer case (PLA)
  2. Metal plate or metal stand (for hammer to magnetically lock onto)
  3. Soldering tools and wires
  4. Breadboard and jumper wires
  5. Hot & epoxy glue (optional for securing internals)

3D Print the Hammer

3D Print the Hammer (Time Lapse)
IMG_9095.jpg
IMG_9149.jpg
I 3D printed a Thor hammer shell using PLA, designed to be hollow with room for a breadboard and wiring inside. The head holds the speaker, SD card, and control electronics. The handle is hollow to route the capacitive touch sensor wires. Time to print was about 20 hours.

🔌


Assemble Electronics on Breadboard

IMG_9170.jpg

I connected the Raspberry Pi Pico W to a breadboard, wiring in the SD card (SPI), MPR121 (I2C), ADXL345 (I2C), audio output pin (GP15), and an NPN transistor to control an external electromagnet. A 1kΩ resistor connects the base of the transistor to GP7. The electromagnet is powered from a 5V USB pack and shares GND with the Pico.

Mount Components Inside Hammer

IMG_9178.jpg
IMG_9179.jpg

The MPR121 touch sensor detects when someone grips the handle. If triggered, the Pico runs a random worthiness check and either unlocks the magnet (if worthy) or leaves it engaged. This lets the hammer feel "stuck to the ground" unless you're chosen!

Program the Pico W

First, I flashed CircuitPython onto the Raspberry Pi Pico W using the official UF2 file from circuitpython.org.

Then, I installed the following CircuitPython libraries into the /lib/ folder on the Pico:

  1. adafruit_minimqtt
  2. adafruit_mpr121
  3. adafruit_adxl34x
  4. sdcardio
  5. storage
  6. audiocore
  7. audiopwmio

After that, I uploaded my code.py file directly to the Pico's main directory.

https://github.com/alemanjavier/Mj-lnir.git

Setup Adafruit IO

I created a free Adafruit IO account and set up a new feed called worthy_feed.
Then I added that feed to a simple dashboard so I could see real-time updates every time the hammer judged someone "worthy" or "not worthy."
You can customize the display with icons or text blocks for dramatic effect during your demo!


Add Sound Files

I created a folder on the MicroSD card called /thor/ and added all of the following .wav sound files to it:

  1. worthy.wav
  2. notworthy.wav
  3. thundergod.wav
  4. hammer.wav
  5. odin.wav

These sounds are triggered based on either the touch interaction (worthiness test) or swing motion (motion detection via accelerometer).

Final Assembly & Testing

Demonstration of Thor Hammer.

I carefully routed all wires and sensors inside the hammer body, secured them with hot glue, and ensured the capacitive touch pads were in the handle.

I then ran tests:

  1. Touch detection: triggers worthiness logic and MQTT update
  2. Swing motion: triggers thunder/hammer/Odin sounds
  3. Magnet lock/unlock: releases hammer when worthy, holds it when not

Everything runs from a USB battery hidden inside. The hammer can be picked up only when the user is deemed worthy.