Hackster is hosting Hackster Holidays, Ep. 5: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 5 on Friday!
Alok Seth
Created July 14, 2016 © LGPL

The Portable All Season Clothes Dryer

An all season dryer that is not just portable but can also be used to dry other things like food, spices etc.

IntermediateFull instructions provided3 hours70
The Portable All Season Clothes Dryer

Things used in this project

Hardware components

FRDM Board
NXP FRDM Board
I have used a frdm-k82f board
×1
Relay (generic)
Check these here https://goo.gl/zuaZXt http://goo.gl/lcFoQv
×1
Hair Dryer
You can buy one here https://goo.gl/gPok6P http://goo.gl/mG5sqp https://goo.gl/4nRUku http://goo.gl/wsae6X
×1
Multimeter
Check these here https://goo.gl/q7LjkB http://goo.gl/vppmir http://goo.gl/VSVlau http://goo.gl/ow3E62
×1
Line tester
Check these here http://goo.gl/VSVlau https://goo.gl/CRfvaw http://goo.gl/mHg8s4
×1
breadboard wire
Check these here https://goo.gl/ILajyc http://goo.gl/1j0DsY http://goo.gl/PZtjyt
×1
A stand or Support to hold the Dryer
r
×1

Story

Read more

Schematics

MY DIY Portable Clothes Dryer

Dry your clothes spices and almost anything you like with my all purpose clothes dryer

DIY Clothes Dryer Easy Build Layout

Build a portable clothes dryer.
Dry your clothes spices and almost anything you like with my all purpose clothes dryer

Code

main.c

C/C++
 /* Copyright (c) Alok Seth 13 July 2016 Code for FlexIO freedom board That Drives my Clothes Dryer */
#include <stdio.h>
#include "fsl_debug_console.h"
#include "fsl_common.h"
#include "fsl_rtc.h"
#include "board.h"

#include "pin_mux.h"
#include "clock_config.h"

#define Low  0
#define High 1
/*******************************************************************************
 * Definitions
 ******************************************************************************/


/*******************************************************************************
 * Prototypes
 ******************************************************************************/
void BOARD_SetRtcClockSource(void);
/*!
 * @brief Set the alarm which will be trigerred x secs later. The alarm trigger
 *        will print a notification on the console.
 *
 * @param offsetSec  Offset seconds is set for alarm.
 */

static void CommandSeconds(void);

/*!
 * @brief Get the current date time.
 *
 */



/*******************************************************************************
 * Variables
 ******************************************************************************/
static volatile uint8_t g_AlarmPending = 0U;
static volatile bool g_SecsFlag = false;



static char g_StrNewline[] = "\r\n";


/*******************************************************************************
 * Code
 ******************************************************************************/

void BOARD_SetRtcClockSource(void)
{
    /* Enable the RTC 32KHz oscillator */
    RTC->CR |= RTC_CR_OSCE_MASK;
}

uint32_t seconds_value = 0 ;
static void CommandSeconds(void)
{
    uint32_t count = 0U;
    rtc_datetime_t date;
    char sourceBuff[] = "\r10:10:00";

    g_SecsFlag = false;
    while (count < seconds_value)
    {
        /* If seconds interrupt ocurred, print new time */
        if (g_SecsFlag)
        {
            /* Build up the word */
            g_SecsFlag = false;
            count++;
            RTC_GetDatetime(RTC, &date);

            sourceBuff[1] = ((date.hour / 10) + 0x30);
            sourceBuff[2] = ((date.hour % 10) + 0x30);
            sourceBuff[3] = ':';
            sourceBuff[4] = ((date.minute / 10) + 0x30);
            sourceBuff[5] = ((date.minute % 10) + 0x30);
            sourceBuff[6] = ':';
            sourceBuff[7] = ((date.second / 10) + 0x30);
            sourceBuff[8] = ((date.second % 10) + 0x30);
            /* Print the time */
            PRINTF(sourceBuff);
        }
    }
    /* Disable Sec interrupt */
    RTC_DisableInterrupts(RTC, kRTC_SecondsInterruptEnable);
    PRINTF(g_StrNewline);
}



/*!
 * @brief Override the RTC IRQ handler.
 */
void RTC_IRQHandler(void)
{
    if (RTC_GetStatusFlags(RTC) & kRTC_AlarmFlag)
    {
        g_AlarmPending = 1U;

        /* Clear alarm flag */
        RTC_ClearStatusFlags(RTC, kRTC_AlarmInterruptEnable);
    }
}

/*!
 * @brief Override the RTC Second IRQ handler.
 */
void RTC_Seconds_IRQHandler(void)
{
    g_SecsFlag = true;
}

/*!
 * @brief Main function
 */
int main(void)
{

    rtc_config_t rtcConfig;
    rtc_datetime_t date;

    /* Board pin, clock, debug console initialize */
    BOARD_InitPins();
    BOARD_BootClockRUN();
    BOARD_InitDebugConsole();


    /*Hey let us set the output pin 1 is output 0 is Input */
    gpio_pin_config_t pin_config = {kGPIO_DigitalOutput,1,};
   /* I am using PortB pin 16U or PTB16 as in image as the output pin */
    GPIO_PinInit(GPIOB, 16U, &pin_config);
    /* This is the extreme corner Pin of the FRDM-K82F board and by setting it for my app I leave plenty of space to connect more leads for further addition of
     * more features */
    /* Initialize the  RTC that would drive our dryer */

    RTC_GetDefaultConfig(&rtcConfig);
    RTC_Init(RTC, &rtcConfig);
    /* Select RTC clock source */
    BOARD_SetRtcClockSource();

    /* Set a start date time and start RTC. You can set any date here I made it 2016 as its the year of this build and 19th may is my birthday.Hr/Min/Sec as 00 would
     * look cool on the console or if I were to later attach a LCD to keep a track of the total run time of the Dryer
     */
    date.year = 2016U;
    date.month = 05U;
    date.day = 19U;
    date.hour = 00U;
    date.minute = 00U;
    date.second = 00U;

    /* RTC time counter needs to be stopped before setting the date & time in the TSR register (read it in one of the manuals)*/
    RTC_StopTimer(RTC);

    RTC_SetDatetime(RTC, &date);

    /* Enable at the NVIC */
    EnableIRQ(RTC_IRQn);
    EnableIRQ(RTC_Seconds_IRQn);

    /* Start the RTC time counter */
    RTC_StartTimer(RTC);


    while (1)
    {

            	GPIO_WritePinOutput (GPIOB, 16U, High);
                RTC_EnableInterrupts(RTC, kRTC_SecondsInterruptEnable);
                seconds_value = 45 ;
                CommandSeconds(); // this function makes the Dryer run for 45 seconds


                GPIO_WritePinOutput (GPIOB, 16U, Low);
                RTC_EnableInterrupts(RTC, kRTC_SecondsInterruptEnable);
                seconds_value = 90 ; // to set the value of timer for cooling off the dryer
                CommandSeconds(); // this function enables the dryer blower to be switched off for 90 seconds so that it may cool down

    }
}

pin_mux.c

C/C++
 /* Copyright (c) Alok Seth 13 July 2016 Code for FlexIO freedom board That Drives my Clothes Dryer */

#include "fsl_port.h"
#include "pin_mux.h"
#include "fsl_common.h"

/*******************************************************************************
 * Code
 ******************************************************************************/

void BOARD_InitPins(void)
{
    /* Initialize LPUART4 pins below */
    /* Ungate the port clock */
    CLOCK_EnableClock(kCLOCK_PortC);
    /* Affects PORTC_PCR14 register */
    PORT_SetPinMux(PORTC, 14U, kPORT_MuxAlt3);
    /* Affects PORTC_PCR15 register */
    PORT_SetPinMux(PORTC, 15U, kPORT_MuxAlt3);
    // Setting the output Pin
    CLOCK_EnableClock(kCLOCK_PortB);
        PORT_SetPinMux(PORTB, 16U, kPORT_MuxAsGpio);

        // Sets PTB16 ie Port B Pin 11 as GPIO pin
}

Credits

Alok Seth

Alok Seth

3 projects • 1 follower

Comments