Compare commits
3 commits
f965ba8fb2
...
36bf6b886a
Author | SHA1 | Date | |
---|---|---|---|
|
36bf6b886a | ||
|
760ed27d97 | ||
|
5c26492077 |
7 changed files with 143 additions and 8 deletions
BIN
3d/Surprising Inari-Allis-2.stl
Normal file
BIN
3d/Surprising Inari-Allis-2.stl
Normal file
Binary file not shown.
BIN
3d/Surprising Inari-Allis-3.stl
Normal file
BIN
3d/Surprising Inari-Allis-3.stl
Normal file
Binary file not shown.
BIN
3d/Surprising Inari-Allis-4.stl
Normal file
BIN
3d/Surprising Inari-Allis-4.stl
Normal file
Binary file not shown.
BIN
3d/Surprising Inari-Allis.stl
Normal file
BIN
3d/Surprising Inari-Allis.stl
Normal file
Binary file not shown.
25
README.md
25
README.md
|
@ -3,8 +3,31 @@
|
||||||
A tiny tank cooler.
|
A tiny tank cooler.
|
||||||
|
|
||||||
Used components:
|
Used components:
|
||||||
|
----------------
|
||||||
|
|
||||||
Arduino nano
|
Arduino nano (old bootloader)
|
||||||
PC fan 120mm 5V
|
PC fan 120mm 5V
|
||||||
PWM D4184 MOS breakout board
|
PWM D4184 MOS breakout board
|
||||||
USB-C connector
|
USB-C connector
|
||||||
|
|
||||||
|
Connections:
|
||||||
|
------------
|
||||||
|
|
||||||
|
USB-C D+ <-> Pin4 CH430 chip
|
||||||
|
USB-C D- <-> Pin5 CH430 chip
|
||||||
|
|
||||||
|
VIN <-> PWM board (+)
|
||||||
|
VIN <-> USB-C V+
|
||||||
|
|
||||||
|
GND <-> USB-C GND
|
||||||
|
GND <-> BMP280 breakout board GND
|
||||||
|
GND <-> PWM breakout board GND
|
||||||
|
|
||||||
|
D9 <-> PWM Pin of the breakout board
|
||||||
|
|
||||||
|
A4 <-> SCL pin of BMP280 breakout board
|
||||||
|
A5 <-> SDA pin of BMP280 breakout board
|
||||||
|
|
||||||
|
PWM board load <-> PC fan (+)
|
||||||
|
PWM board GNC <-> PC fan (-)
|
||||||
|
|
||||||
|
|
73
firmware/firmware.ino
Normal file
73
firmware/firmware.ino
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
|
||||||
|
#define FAN_PIN 9 // D9
|
||||||
|
#define L_LED_PIN 13 // D13
|
||||||
|
|
||||||
|
#define BMP280_I2C_ADDRESS 0x76 // BMP280 conneciton: D1 = SCL; D2 = SDA
|
||||||
|
|
||||||
|
// minimum value to start both fan's is 110
|
||||||
|
// without queeking noise is 255
|
||||||
|
#define FAN_ON_TEMP 26.0
|
||||||
|
#define FAN_OFF_MAX_TEMP 25.0
|
||||||
|
|
||||||
|
#define FAN_ON_STATE HIGH
|
||||||
|
#define FAN_OFF_STATE LOW
|
||||||
|
|
||||||
|
#define BMP280_CHECK_INTERVAL_MS 2000 // every 60000 = 60 seconds
|
||||||
|
|
||||||
|
float bmp280_temp = -99.9;
|
||||||
|
uint32_t bmp280_lastcheck_millis = BMP280_CHECK_INTERVAL_MS;
|
||||||
|
|
||||||
|
uint8_t fan_state = LOW;
|
||||||
|
|
||||||
|
float sensor_bmp280_temperature();
|
||||||
|
|
||||||
|
void setup()
|
||||||
|
{
|
||||||
|
// put your setup code here, to run once:
|
||||||
|
|
||||||
|
// setup serial
|
||||||
|
Serial.begin(115200);
|
||||||
|
Serial.println();
|
||||||
|
delay(1000);
|
||||||
|
|
||||||
|
// setup BMP280
|
||||||
|
Serial.println("Sensor BMP280 init status: " + String(sensor_bmp280_begin(BMP280_I2C_ADDRESS)));
|
||||||
|
bmp280_temp = sensor_bmp280_temperature();
|
||||||
|
|
||||||
|
// setup FAN Pin
|
||||||
|
pinMode(FAN_PIN, OUTPUT);
|
||||||
|
|
||||||
|
pinMode(L_LED_PIN, OUTPUT);
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop()
|
||||||
|
{
|
||||||
|
// put your main code here, to run repeatedly:
|
||||||
|
|
||||||
|
if ((bmp280_lastcheck_millis + BMP280_CHECK_INTERVAL_MS) <= millis())
|
||||||
|
{
|
||||||
|
bmp280_temp = sensor_bmp280_temperature();
|
||||||
|
Serial.println("Temperature: " + String(bmp280_temp) + "°C");
|
||||||
|
digitalWrite(L_LED_PIN, HIGH);
|
||||||
|
|
||||||
|
if (fan_state > 0 && bmp280_temp <= FAN_OFF_MAX_TEMP)
|
||||||
|
{
|
||||||
|
fan_state = FAN_OFF_STATE; // off
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bmp280_temp >= FAN_ON_TEMP)
|
||||||
|
{
|
||||||
|
fan_state = FAN_ON_STATE;
|
||||||
|
}
|
||||||
|
|
||||||
|
Serial.println("FAN state: " + String(fan_state));
|
||||||
|
|
||||||
|
digitalWrite(FAN_PIN, fan_state);
|
||||||
|
|
||||||
|
digitalWrite(L_LED_PIN, LOW);
|
||||||
|
|
||||||
|
bmp280_lastcheck_millis = millis();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
39
firmware/sensor_bmp280.ino
Normal file
39
firmware/sensor_bmp280.ino
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
|
||||||
|
#include <Adafruit_BMP280.h> // Install from library manager - sensor board info: https://www.bastelgarage.ch/bmp280-temperatur-luftdruck-sensor
|
||||||
|
|
||||||
|
Adafruit_BMP280 _sensor_bmp280;
|
||||||
|
Adafruit_Sensor *_sensor_bmp280_temp = _sensor_bmp280.getTemperatureSensor();
|
||||||
|
Adafruit_Sensor *_sensor_bmp280_pressure = _sensor_bmp280.getPressureSensor();
|
||||||
|
|
||||||
|
#define BPM280_TEMP_FACTOR 1.0
|
||||||
|
|
||||||
|
bool sensor_bmp280_begin(uint8_t addr) {
|
||||||
|
bool status = _sensor_bmp280.begin(addr);
|
||||||
|
|
||||||
|
if (status) {
|
||||||
|
Serial.println("BMP280 Connected");
|
||||||
|
|
||||||
|
_sensor_bmp280.setSampling(Adafruit_BMP280::MODE_NORMAL, /* Operating Mode. */
|
||||||
|
Adafruit_BMP280::SAMPLING_X2, /* Temp. oversampling */
|
||||||
|
Adafruit_BMP280::SAMPLING_X16, /* Pressure oversampling */
|
||||||
|
Adafruit_BMP280::FILTER_X16, /* Filtering. */
|
||||||
|
Adafruit_BMP280::STANDBY_MS_500); /* Standby time. */
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Serial.println("Could not find a valid BMP280 sensor, check wiring or try a different address!");
|
||||||
|
Serial.println("SensorID was: " + String(_sensor_bmp280.sensorID()));
|
||||||
|
Serial.println(" ID of 0xFF probably means a bad address, a BMP180 or BMP085");
|
||||||
|
Serial.println(" ID of 0x56-0x58 represents a BMP280,");
|
||||||
|
Serial.println(" ID of 0x60 represents a BME280,");
|
||||||
|
Serial.println(" ID of 0x61 represents a BME680.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
float sensor_bmp280_temperature() {
|
||||||
|
sensors_event_t temp_event, pressure_event;
|
||||||
|
_sensor_bmp280_temp->getEvent(&temp_event);
|
||||||
|
return temp_event.temperature * BPM280_TEMP_FACTOR;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue