Introduction: Temperature Sensitive Mighty Mjölnir

About: Im into all things mechanical with a touch of art and creativity. Just a piece of scrap metal fused with a spark of electricity in the binary world of computers.

This is the design of a smaller version of the hammer a.k.a Mjölnir wielded by Thor. I got the idea to make this while I came across some bigger models of the Mjölnir on the internet. Some of them were able to light up and others produce sound effects as well. Most of which I came across were metal and I must admit looked awesome and to get one you obviously had to buy it. I thought I'd make a 3D printed smaller version which can light up as well and to add a special touch by displaying different lighting patterns according to ambient temperature readings. Since it is smaller in size it would not take up much printing time and there aren't many parts to assemble. It can be worn as a pendant or you could just place it on your work desk as a paper weight which can also give you a sense of the variance in room temperatures.

The hammer houses five neopixels which are controlled by the seeed xiao samd21 module and is powered by a 3.7 V lipo battery. The 3D model was designed using Tinkercad and the DS18B20 temperature sensor was used with WS2812B neopixels for lighting. Hope you like it!

Supplies

  • WS2812B Neopixels x 5 (I used circular PCB with smd resistors) link
  • Seeed xiao samd21 x 1 link
  • 3.7 V 150mAh Lipo Battery x 1 link
  • DS18B20 Temperature sensor x 1 link
  • Slide on/off switch x 1 link
  • 4.7 KOhm resistor x 1 link
  • 28 AWG wires
  • Hot glue gun and hot glue sticks
  • Super Glue
  • 2.5M (15mm length) hex screw and nut x 2
  • Acrylic Paints (Black, Grey, Brown)
  • Female JST connectot x 1 link
  • Cord for pendant of your choice (I chose black with a diameter of 4mm)
  • LED Light Diffusing Sheet x 1 link

Step 1: Mjölnir Design

The hammer is assembled in ten parts namely the main body of the head, the front and back frames, the two side structures, the two side frames, the battery compartment cover, the handle and the tip of the handle. The structure of the hammer was designed using basic shapes to cut out and extrude. Some planes had to created at angles to make the necessary chamfers in the design. The scribble tool was used to create the patterns on the frames of the hammer head in addition to the cracked rocky structure on the main body of the hammer head. The outer rings on the handle of the hammer were created by cutting out an elongated spherical shape through a cylinder not all the way but to the amount needed to make a groove on the ring. The groove on the tip of the handle was also created using a similar way and then a torus shape was joined on the sides and finally cut in the center to make a ring shape to route the cord through. Some shapes were created in advance by using existing basic shapes and then used in the design to create the required cutouts such as the cutouts on the side structures (resembles a trapezium shapes) of the hammer head. Finally the text tool was used to cutout the text on the top of the battery cover.


Mjolnir (Temperature Sensitive Thor's Hammer)

Step 2: Design Description

The main body of the hammer head has 45 degree inclined stands for the front and back for placing the neopixels. The side stands just parallel allowing for maximum lighting. Apart from the four neopixels on all four sides, one is place on the bottom facing the hole which leads to the hammer handle. This allows for illumination of the base of the hammer head.

The battery leads are routed from the slot on the top of the hammer head structure and the battery cover is screwed on top of the battery compartment. The handle of the hammer in a hollow structure thus allowing for the wires from the DS18B20 temperature placed on the bottom tip of the hammer handle to reach to the hammer head where the micro-controller is housed.

All assembly parts are super glued together except for the battery cover which needs to be removed for charging the battery.

Step 3: Assembly Instructions Part I

Once you've downloaded and printed all the parts, its time for assembly. Be careful when removing any support structures inside the hammer head and not to damage any light stands. You can start off by soldering wires to the leads of the DS18B20 and then hot gluing the sensor to the end tip of the hammer handle. Be sure to put some heat shrink on the leads to avoid them shorting and then route the wires all the way up the hollow handle of the hammer. Once in place you can super glue the hammer end tip to the handle. You can then route in the temperature sensor wires through the hole at the base of the hammer head structure and super glue the hammer handle to the hammer head structure. There will be a circular cutout on the bottom of the hammer head structure for ease of aligning of the hammer head and hammer handle.

Next you will need to solder wire leads to digital pin 2, digital pin 3, 3.3V pin and GND pins of the seeed xiao module. You should also solder wires to the VIN and GND pins on the bottom of the micro controller. You can use the VIN and GND pins on the bottom of seeed xiao to supply a voltage between 3.7 to 5V via a small Lipo battery which we will be doing here. You would then need to hot glue the seeed xiao module in the allocated space. The seeed xiao module is enclosed on one side of the hammer head and glued in place with the USB C port accessible through the cutout slot at the bottom.

From here on we can start to wire up the neopixels and the temperature sensor to the seeed xiao module. The discharge leads from the battery should connect to the VIN and GND on the bottom side of the seeed xiao.

Step 4: Battery Assembly

The 3.7V 150mAh Lipo battery is small and has the capacity to power the needs for this project. The charging and discharge wire leads are connected in parallel and the charge wires are soldered to female JST connectors and tucked inside the battery compartment. The discharge wires are routed into the hammer head structure to power the seeed xiao and the neopixels. The small slide switch is soldered to a piece of a perf board and then glued to the battery cover with the switch protruding out from the cover allowing for easy access to switch on and off the hammer.

The battery cover fits on tip of battery compartment and gets screwed into the nut encased on top. The nut needs to be heated and then pressed into the hole so that it is firmly seated in. This way you could screw in the hex screw to from top of the battery cover and unscrew to access the charging cable inside the battery compartment.

Step 5: Electronics

The DOUT pin of the first WS2812B neopixels connect to the DIN pin on the next neopixels and is chained up like so. The DIN pin of the first neopixel coonects to the digital pin of the microcontroller in this case is digital pin 2. All ground pins are connected in parallel to the GND pin on the microcontroller and the VCC pins on the neopixels are connected in parallel to the 3.3V pin on the microcontroller. Make sure to connect to 3.3 V and NOT 5V pins as we supply the seeed xiao with 3.7V we won't be able to utilize the 5V pin.

The power pins on the DS18B20 also connect similarly, 3.3V to VCC and GND to GND on the microcontroller. The signal pin need to be pulled up high by connecting to 4.7k ohm resistor and then to the 3.3V on the microcontroller. It is connected to the digital pin 3 on the microcontroller. Please refer to schematic diagram for a clear image of the connections.

Step 6: Assembly Instructions Part II

Once the electronics are sorted out and all the connections are made, you can super glue the side frames. After doing so then you can glue in the LED light diffusing sheets after cutting to the appropriate dimesions on the front and back of the hammer head structure. The diffusing sheets are also glued in on the cutouts of the side frames and the top tip of the hammer handle where the bottom neopixel lights up.

Once done with this you can use the acrylic paints to paint the hammer. I've used grey, black and brown colors. You could also print the parts in different colored filament or even leave it in white for a better glow experience.

Step 7: Programming

We will be programming the seeed xiao module using the Arduino IDE. You will have to add the board to the Arduino IDE. Here is a great article on how to add the seeed xiao board to the arduino IDE. Once you've added the board you can then download two libraries, one to control the neopixels and the other to interface with the DS18B20 tempearature sensor. First download the FastLed zip library. Then on the tools menu go to Sketch->Include library->Add Zip Library and then select the downloaded zip library and its done.

To install the library to read the temperature values navigate to Sketch -> Include Library -> Manage Libraries and wait for the Library Manager to download the library index and update the list of installed libraries. Type in DS18B20 and a list of libraries will appear of which you should select the Dallas Temperature by Miles Burton and select install. Now youe done with installing the libraries. We can begin to write the code. I should also mention FastLed libraries comes with a lot of examples and you can try any one of them by confguring the data pin to 2 and number of LEDs to 5. You can get some really nice effects.

As for our program we will be getting the readings from the temperature sensor and then depending on the values display different colors. It is a fairly straight forward piece of code. If you have any inquiries feel free to ask.

#include <OneWire.h>
#include <DallasTemperature.h>
#include <FastLED.h>

// Temperature sensor Pin
#define ONE_WIRE_BUS 3

// Neopixel definitions
#define NUM_LEDS 5
#define DATA_PIN 2
#define BRIGHTNESS  255


CRGB leds[NUM_LEDS];

// Setup a oneWire instance to communicate with any OneWire device
OneWire oneWire(ONE_WIRE_BUS);  

// Pass oneWire reference to DallasTemperature library
DallasTemperature sensors(&oneWire);

void setup(void)
{
  sensors.begin();  // Start up the library
  Serial.begin(9600);
  FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
  FastLED.setBrightness(  BRIGHTNESS );
  on_start();  // Light Animation on startup
}

void loop(void)
{
  get_temperature();

  // Dim the specific colored lights according to temperature readings to give an idea of the ambient temperatyure.
  for (int i = 0; i<=255; i++){
    FastLED.setBrightness(i);
    FastLED.delay(10);
  }
  FastLED.delay(100);
  for (int i = 255; i>0; i--){
    FastLED.setBrightness(i);
    FastLED.delay(10);
  }
  FastLED,delay(100);

}

void get_temperature(){
  sensors.requestTemperatures();
  float temp_reading = sensors.getTempCByIndex(0); // Get temperature reading and store in a variable
  if (temp_reading <= 0){
    for (int i = 0; i<5; i++){
        leds[i] = 0x1137d4; // Blue
        FastLED.show();
      }
  }
  else if (temp_reading > 0 && temp_reading <= 10){
    for (int i = 0; i<5; i++){
        leds[i] = 0x11c8d4; // Cyan
        FastLED.show();
      }
  }
  else if (temp_reading > 10 && temp_reading <= 20){
    for (int i = 0; i<5; i++){
        leds[i] = 0x25ef65; // Green
        FastLED.show();
      }
  }
  else if (temp_reading > 20 && temp_reading <= 26){
    for (int i = 0; i<5; i++){
        leds[i] = 0xeeef25; // Yellow
        FastLED.show();
      }

  }
  else if (temp_reading > 26 && temp_reading <= 30){
    for (int i = 0; i<5; i++){
        leds[i] = 0xef8325; // Orange
        FastLED.show();
      }
  }
  else if (temp_reading > 30 && temp_reading <= 35){
    for (int i = 0; i<5; i++){
        leds[i] = 0xef25c0; // Purple
        FastLED.show();
      }
  }
  else{
    for (int i = 0; i<5; i++){
        leds[i] = 0xef2525; // Red
        FastLED.show();
      }
  }

}

void on_start(){
  for (int i = 0; i<=255; i++){
    FastLED.setBrightness(i);
    leds[0] = 0xffc100;
    FastLED.show();
    FastLED.delay(5);
  }
  FastLED.delay(10);
  for (int i = 255; i>0; i--){
    FastLED.setBrightness(i);
    leds[0] = 0xffc100;
    FastLED.show();
    FastLED.delay(5);
  }
  FastLED.delay(10);


  for (int i = 0; i<=255; i++){
    FastLED.setBrightness(i);
    leds[0] = 0xff9a00;
    FastLED.show();
    FastLED.delay(5);
  }
  FastLED.delay(100);
  for (int i = 255; i>0; i--){
      FastLED.setBrightness(i);
      leds[0] = 0xff9a00;
      FastLED.show();
      FastLED.delay(5);
    }
    FastLED.delay(10);


  for (int i = 0; i<=255; i++){
    FastLED.setBrightness(i);
    leds[0] = 0xff7400;
    FastLED.show();
    FastLED.delay(5);
  }
  FastLED.delay(10);
 for (int i = 255; i>0; i--){
    FastLED.setBrightness(i);
    leds[0] = 0xff7400;
    FastLED.show();
    FastLED.delay(5);
  }
  FastLED.delay(10);


  for (int i = 0; i<=255; i++){
    FastLED.setBrightness(i);
    leds[0] = 0xff4d00;
    FastLED.show();
    FastLED.delay(5);
  }
  FastLED.delay(10);
 for (int i = 255; i>0; i--){
    FastLED.setBrightness(i);
    leds[0] = 0xff4d00;
    FastLED.show();
    FastLED.delay(5);
  }
  FastLED.delay(10);


  for (int i = 0; i<=255; i++){
    FastLED.setBrightness(i);
    leds[0] = 0xff0000;
    FastLED.show();
    FastLED.delay(5);
  }

  FastLED.delay(100);

  for (int j = 0; j<10; j++){
    for (int i = 0; i<5; i++){
      leds[i] = 0x8c1044;
      FastLED.show();
      FastLED.delay(5);
    }
    FastLED.delay(20);
    for (int i = 0; i<5; i++){
        leds[i] = 0xbc131f;
        FastLED.show();
        FastLED.delay(5);
      }
      FastLED.delay(20);
    for (int i = 0; i<5; i++){
        leds[i] = 0xfbbd3c;
        FastLED.show();
        FastLED.delay(5);
      }
      FastLED.delay(20);
    for (int i = 0; i<5; i++){
        leds[i] = 0x21675e;
        FastLED.show();
        FastLED.delay(5);
      }
      FastLED.delay(20);

    for (int i = 0; i<5; i++){
        leds[i] = 0x0fbabd;
        FastLED.show();
        FastLED.delay(5);
      }
      FastLED.delay(20);
  }

}

Step 8: Conclusion

This a fairly easy build and aesthetically very pleasing. This was my first time to use Tinkercad to design so there was a bit of a learning and getting to know period. It's actually very easy to model simple designs in a fast and efficient way using Tinkercad. Having said that if you would want to further detail the design you could use Fusion360.

During the wiring process you might have to manage the wires and tuck them inside without blocking the lighting from the neopixels. Other than that you don't actually need to keep it very neat as it will not be seen once all the parts are assembled and closed up. You could also use threaded inserts for the battery cover assembly area instead of nuts, but since I didnt have any threaded inserts at that time I used nuts instead.

This is a small version of the Mjolnir and looks nice worn as a pendant or as a paper weight on you desk showing ambient temperature refelected as different colors of lighting. Thank you for reading till the end and I hope you liked this instructable.