Elijah ConradKalan Petrea
Published © GPL3+

Peltier Dehumidifier for 3D Printer Filament

A dehumidifier for your 3D printing dry box to keep your filament dry without the need for desiccant.

IntermediateFull instructions provided8 hours16,763
Peltier Dehumidifier for 3D Printer Filament

Things used in this project

Hardware components

Photon
Particle Photon
×1
Adafruit HTU21D-F Temperature & Humidity Sensor Breakout Board
×1
TEC1-12706 Peltier Module
×1
Thermal Paste
×1
12V Switching Power Supply
×1
CPU Cooler (Heat Sink)
×1
High Current Barrel Jack
×1
High Current Barrel Plug
×1
Texas Instruments 5V Linear Regulator
×2
Heat Sink
×1
N-Channel MOSFET
×2
SPST On-Off Rocker Switch
×1
1/8" ID x 3/16" OD Polyurethane Tubing
×1
#10-32 UNF to 1/8" Hose Barb
×1
90mm 12V Fan (2 wire)
×1
M3 Screws
×1

Software apps and online services

Particle Build Web IDE
ThingSpeak API

Hand tools and fabrication machines

Prusa i3 MK2.5 3D Printer
Bernzomatic Micro Torch
Wire Strippers
IWISS Crimping Tool (If you choose to use connectors)
2.5mm Hex Driver

Story

Read more

Custom parts and enclosures

Peltier Assembly Enclosure Parts

This .STEP file contains the Peltier assembly enclosure along with the electronics enclosure and pipe connectors.

Heatsink Clamp Bracket

The .STEP file for the bracket which is used to clamp the Peltier between the two heatsinks.

Heatsink Clamp Bracket (.STL)

The .STL for Heatsink clamping bracket.

Peltier Assembly Enclosure (.STL)

The .STL for the Peltier Assembly Enclosure.

Electronics Enclosure Box (.STL)

The .STL file for the electronics box enclosure which attaches to the side of the Peltier assembly enclosure.

Top Pipe Connector (.STL)

The .STL file for the connector piece that attaches to the top of the Peltier assembly enclosure.

Side Pipe Connector (.STL)

The .STL file for the connector piece that attaches to the side of the Peltier assembly enclosure.

Schematics

Dehumidifier Circuit (Breadboard View)

Dehumidifier Circuit (Schematic View)

Fritzing File

Code

Humidity and Temperature Measurement Decision Making Code

Arduino
This code tells the photon located inside the dry box to read the temperature and humidity from the HTU21D sensor and make a decision determining what power settings the Peltier control photon should be set to. Based on the targeted humidity level the photon will determine what power level the Peltier needs to be at to effectively reduce the humidity inside the dry box. Once the humidity inside the dry box reaches the "FreezingDewPointHumidity" the Peltier will need to be in power level 2 to cause frost to form on the Peltiers surface in order to remove additional water from the air. Once the humidity inside the dry box has reached the targeted humidity level the photon will tell the Peltier control photon to turn off the Peltier until the humidity increases in which the photon will tell the control photon to turn it back on again. The photon checks the humidity every five minutes to ensure the target humidity is being maintained. (Note: Make sure to come up with your own event names for the subscribe and publish functions and replace the default ones in the code or else you will have issues.)
#include <HTU21D.h>

HTU21D htu;

int PowerLevel = 0;
int PeltierState = 0;
const int TargetHum = 25;
const int FreezingDewPointHumidity = 40;
float Humidity;
float Temperature;
unsigned long LastTime = 0;
int main_fuction_CallTime = 300000;

void Peltier_onoff_Handler(String event, String data) {
    PeltierState = data.toInt();
}

void Peltier_power_level_Handler(String event, String data) {
    PowerLevel = data.toInt();

}

void setup() {
 htu.begin();
 Particle.subscribe("Gunner_P/MEGR_3171/Dehumidifier_Filament_Box/Peltier_state", Peltier_onoff_Handler);
 Particle.subscribe("Gunner_P/MEGR_3171/Dehumidifier_Filament_Box/Peltier_power", Peltier_power_level_Handler);
 Particle.publish("Elijah_C_MEGR_3171_Dehumidifier_Filament_Box_Project", String(0), 10);
 //LastResetTime = millis();
}

void main_function() {
    Humidity = htu.readHumidity();
    Temperature = htu.readTemperature();
    Particle.publish("3D Printer Filament Box", + "{ \"1\":\"" + String(Humidity) + "\"," + "\"2\":\"" + String(Temperature) + "\"," + "\"3\":\"" + String(PeltierState) + "\"," + "\"4\":\"" + String(PowerLevel) + "\" }", 10, PRIVATE);
    
    if (TargetHum < Humidity && PeltierState == 0) {
       
       Particle.publish("Elijah_C_MEGR_3171_Dehumidifier_Filament_Box_Project", String(1), 10);
       
       
       if (FreezingDewPointHumidity <= Humidity && PowerLevel != 1) {
           
           Particle.publish("Elijah_C_MEGR_3171_Peltier_Power_Level_Dehumidifier_Box", String(1), 10);
          
       }
       
       if (FreezingDewPointHumidity > Humidity && PowerLevel != 2) {
           
           Particle.publish("Elijah_C_MEGR_3171_Peltier_Power_Level_Dehumidifier_Box", String(2), 10);
           
       }
    }
    
    
    if (TargetHum > Humidity && PeltierState == 1) {
        
        Particle.publish("Elijah_C_MEGR_3171_Dehumidifier_Filament_Box_Project", String(0), 10);
        
    }
}

void loop() { 
    if (millis() - LastTime >= main_fuction_CallTime) {
        main_function();
        LastTime = millis();
    }
}

Peltier Control Code

Arduino
This code controls the Peltier device and fan. The photon receives if the Peltier should be on or off and what power level the Peltier should operate at. The photon controls the fan speed based on what power level the Peltier is running at and the fan speed constants chosen by the user. (Note: Make sure to come up with your own event names for the subscribe and publish functions and replace the default ones in the code or else you will have issues.)
/* Program description*/


// User Configuration
const float Power_Level_1 = 90;          //Low power level in percent supplied to the Peltier module that will not cause the dehumidifier to ice up
const float Power_Level_2 = 100;         //Supplies maximum power to the Peltier module but may cause the dehumidifier to ice up
const float Fan_Speed_1 = 40;            //Fan speed in percent for power level 1 above
const float Fan_Speed_2 = 60;            //Fan speed in percent for power level 2 avove
const char Peltier_MOSFET_Pin = D0;      //Pin that will control the Peltier MOSFET (Must be digital PWM)
const char Fan_MOSFET_Pin = D2;          //Pin that will control the fan MOSFET (Must be digital PWM if anything other than 100 is used for the fan speeds)
const int Fan_PWM_Frequency = 20;        //Frequency of the PWM signal that will be sent to the Fan
const int Peltier_PWM_Frequency = 500;   //Frequency of the PWM signal that will be sent to the Peltier module

// Program Variables
bool request_Peltier_on = false;
float Peltier_power_level = (Power_Level_1/100)*255;
int Peltier_current_state = 0;
float Peltier_current_power_level = Peltier_power_level;
float fan_speed = (Fan_Speed_1/100)*255;
unsigned long last_millis = 0;
int update_interval = 60000;


// Recieved Data Handlers
void on_off_request_handler(String event, String data) {
    request_Peltier_on = data.toInt();
    Particle.publish("Gunner_P/MEGR_3171/Dehumidifier_Filament_Box/Peltier_state", String(request_Peltier_on), 10);
}

void Peltier_power_handler(String event, String data) {
    if (data.toInt() == 1) {
        Peltier_power_level = (Power_Level_1/100)*255;
        fan_speed = (Fan_Speed_1/100)*255;
        Particle.publish("Gunner_P/MEGR_3171/Dehumidifier_Filament_Box/Peltier_power", String(1), 10);
    }
    if (data.toInt() == 2) {
        Peltier_power_level = (Power_Level_2/100)*255;
        fan_speed = (Fan_Speed_2/100)*255;
        Particle.publish("Gunner_P/MEGR_3171/Dehumidifier_Filament_Box/Peltier_power", String(2), 10);
    }
}


// Dehumidifier Manager
void dehumidifier_manager() {
    if (request_Peltier_on && Peltier_current_state == 0) {
        analogWrite(Peltier_MOSFET_Pin, Peltier_power_level, Peltier_PWM_Frequency);
        Peltier_current_power_level = Peltier_power_level;
        analogWrite(Fan_MOSFET_Pin, 255, Fan_PWM_Frequency);
        delay(200);
        analogWrite(Fan_MOSFET_Pin, fan_speed, Fan_PWM_Frequency);
        Peltier_current_state = 1;
    }
    if (!request_Peltier_on && Peltier_current_state == 1) {
        analogWrite(Peltier_MOSFET_Pin, 0);
        analogWrite(Fan_MOSFET_Pin, 0);
        Peltier_current_state = 0;
    }
    if (Peltier_current_state == 1 && Peltier_current_power_level != Peltier_power_level) {
        analogWrite(Peltier_MOSFET_Pin, Peltier_power_level, Peltier_PWM_Frequency);
        Peltier_current_power_level = Peltier_power_level;
        analogWrite(Fan_MOSFET_Pin, 255, Fan_PWM_Frequency);
        delay(200);
        analogWrite(Fan_MOSFET_Pin, fan_speed, Fan_PWM_Frequency);
    }
}


// Setup
void setup() {
    pinMode(Peltier_MOSFET_Pin, OUTPUT);
    pinMode(Fan_MOSFET_Pin, OUTPUT);
    Particle.subscribe("Elijah_C_MEGR_3171_Dehumidifier_Filament_Box_Project", on_off_request_handler);
    Particle.subscribe("Elijah_C_MEGR_3171_Peltier_Power_Level_Dehumidifier_Box", Peltier_power_handler);
    Particle.publish("Gunner_P/MEGR_3171/Dehumidifier_Filament_Box/Peltier_state", String(request_Peltier_on), 10);
}


// Loop
void loop() {
    if (millis() - last_millis >= update_interval); {
        dehumidifier_manager();
        last_millis = millis();
    }
}

Credits

Elijah Conrad

Elijah Conrad

1 project • 0 followers
Kalan Petrea

Kalan Petrea

1 project • 0 followers

Comments