Boyuan DengKj Dix
Published © GPL3+

The Hot Box

A portable oven cheaper than anything you can find!

IntermediateFull instructions provided10 hours19
The Hot Box

Things used in this project

Hardware components

Rotary potentiometer (generic)
Rotary potentiometer (generic)
×1
7 Segment LED Display, InfoVue
7 Segment LED Display, InfoVue
4x display in Grove kit
×1
DHT11 Temperature & Humidity Sensor (4 pins)
DHT11 Temperature & Humidity Sensor (4 pins)
×1
Grove - Relay
Seeed Studio Grove - Relay
×1
Slide Switch
Slide Switch
×1
EK-TM4C123GXL TM4C Tiva LaunchPad
Texas Instruments EK-TM4C123GXL TM4C Tiva LaunchPad
×1
Grove Starter Kit for LaunchPad
Seeed Studio Grove Starter Kit for LaunchPad
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Custom parts and enclosures

Electronics Enclosure

Hot Box

Schematics

Block Diagram

Code

The Hot Box control programme

Arduino
The programme reads in setting temperature and actual temperature, turn on and off relay accordingly, and display setting temperature and actual temperature on display.
#include "DHT.h"
#include "TM1637.h"

// Constants are defined here
#define CLK 39
#define DIO 38
#define ROTARY_ANGLE_P 24
#define TEMP_HUMID_P 25
#define RELAY_PIN 37
#define TEMP_MIN 10
#define TEMP_MAX 95

volatile int rotary_input = 0;
volatile float now_setting = 0;
volatile int now_temperature = 0;
int8_t s_bits[2] = {0};
int8_t n_bits[2] = {0};

DHT dht(TEMP_HUMID_P, DHT22);
TM1637 tm1637(CLK, DIO);

void setup() {
  // Pin setup
  pinMode(ROTARY_ANGLE_P, INPUT);
  pinMode(TEMP_HUMID_P, INPUT);
  pinMode(RELAY_PIN, OUTPUT);
  // Class initializations
  dht.begin();
  tm1637.init();
  tm1637.set(BRIGHT_TYPICAL);
  tm1637.point(POINT_ON);
}

void loop() {
  // Read temperature setting from the potentiometer
  rotary_input = 4096-analogRead(ROTARY_ANGLE_P);
  now_setting = TEMP_MIN+(((float)rotary_input * ((TEMP_MAX+1)-TEMP_MIN)) / 4096);
  // Read actual temperature from the temperature-humidity sensor
  now_temperature = dht.readTemperature();
  // Turn switch on and off based on whether actual termperature is higher or
  // lower than setting termperature
  if (now_temperature < now_setting)
  {
   digitalWrite(RELAY_PIN, HIGH);
  } else if (now_temperature > now_setting )
  {
   digitalWrite(RELAY_PIN, LOW);
  }
  // Display setting and current temperature on the display
  s_bits[0] = (int)now_setting % 10;
  now_setting /= 10;
  s_bits[1] = (int)now_setting % 10;

  n_bits[0] = (int)now_temperature % 10;
  now_temperature /= 10;
  n_bits[1] = (int)now_temperature % 10;

  tm1637.display(1, s_bits[0]);
  tm1637.display(0, s_bits[1]);

  tm1637.display(3, n_bits[0]);
  tm1637.display(2, n_bits[1]);
  delay(1000);
}

Untitled file

BatchFile
No preview (download only).

Credits

Boyuan Deng
2 projects • 0 followers
Kj Dix
3 projects • 0 followers

Comments