A quick hack to speed up drying my racing gloves between sessions. I'd previously just placed them over the shifter and hand brake. They dried a lot faster when the ceiling fan was on, so I decided to make use of an old 12V, 50mm computer fan (42mm hole spacing) to speed up the process. It's silent running at 5V, but still provides enough air flow to speed up drying.
So I didn't have to remember to turn it off, I added a Raspberry Pi Pico as a programmable timer and a transistor to switch the 5V power to the fan. A momentary switch (https://www.adafruit.com/product/1009) triggers the Pico to start/restart the fan timer.
The pieces above and below the fan are connected using M4 screws, two of which are inaccessible once the controller box is glued in place. If I ever need to take it apart I'll just break the controller box off the bottom and reprint the two parts. The control box cover is attached with M3 screws.
The python code to run it is trivial. Didn't bother giving it a UI - as it's plugged into the PC it is easy to change the delay by editing the code.
from machine import Pin
from time import time" length of time fan should be turned on "
delay = 20 * 60button = Pin(15, Pin.IN, Pin.PULL_UP)
fan = Pin(16, Pin.OUT)" turn off fan "
fan.off()" init seconds value "
secs = time()while True:
if not button.value():
secs = time() + delay
fan.on()
if secs < time():
fan.off()
Edited 2023-07-24
Decided I wanted to be able to tell if it was on, so I added a 3.5mm LED. Uses the same signal that turns on the fan. Also got tired of restarting the python code (no idea why it stopped occasionally) and rewrote it in C++ for Arduino.
A handy bit of code if you use the Pico is:
#include "pico.h"
#include "pico/time.h"
#include "pico/bootrom.h"reset_usb_boot(1<<PICO_DEFAULT_LED_PIN,0);
which lets you put the Pico into the bootloader without having to open your case and press the button while power cycling. I call it on a long (5 sec) button press.
/*
Run a fan on button pressed for defined period of time
*/
#include "pico.h"
#include "pico/time.h"
#include "pico/bootrom.h"const unsigned long runTime = 30 * 60 * 1000; // thirty minutes
const unsigned long resetDelay = 5 * 1000; // reset if button held 5 secondsunsigned long offTime;
bool fanOn = false;const int buttonPin = 15; // the number of the pushbutton pin
const int fanPin = 16; // the number of the LED pinvoid setup() {
// initialize the LED pin as an output:
pinMode(fanPin, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT_PULLUP);
// turn off fan
digitalWrite(fanPin, LOW);
}void loop() {
// check if the pushbutton is pressed
unsigned long time;
if (digitalRead(buttonPin) == LOW) {
time = millis() + resetDelay;
while (digitalRead(buttonPin) == LOW) { // wait for button release
if (millis() > time)
reset_usb_boot(1<<PICO_DEFAULT_LED_PIN,0); // reset to bootloader mode
}
// set time to turn off fan
offTime = millis() + runTime;
// turn fan on:
digitalWrite(fanPin, HIGH);
fanOn = true;
}
if (fanOn && offTime < millis()) { // time elapsed, turn off fan
#if defined(DEBUG)
Serial.println("Turning off fan");
#endif
digitalWrite(fanPin, LOW);
fanOn = false;
}
}
The author marked this model as their own original creation.