First working version

This commit is contained in:
Kai Lauterbach 2023-04-13 15:54:58 +02:00
parent 9aada47275
commit 98b997716f
6 changed files with 25 additions and 8 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1,7 +1,24 @@
Arduino Nano mit AtMega328p (old bootloader) einstellen in Arduino IDE einstellen.
@author Kai Lauterbach (klaute@web.de)
@date 13.4.2023
@version 1.0
@license GPLv3
A tiny tank cooler.
The fan is startet i case that the temperature reached 26°C and switched off in case it is down to 24.5°C again.
Used components:
Arduino Nano uses ATMega328p (old bootloader)
PC fan 120mm 5V
PWM D4184 MOS breakout board
USB-C connector
BMP280 breakout board
Connections between hardware:
D9 (Pin12) wird mit dem PWM-Eingang der PWM Platine verbunden, D9 (Pin12) wird mit dem PWM-Eingang der PWM Platine verbunden,
A4 SDA vom BMP280 A4 SDA vom BMP280
D1 SCK vom BMP280 A5 SCK vom BMP280

View file

@ -1,18 +1,18 @@
#define FAN_PIN 12 #define FAN_PIN 9 // D9
#define L_LED_PIN 13 #define L_LED_PIN 13 // D13
#define BMP280_I2C_ADDRESS 0x76 // BMP280 conneciton: D1 = SCL; D2 = SDA #define BMP280_I2C_ADDRESS 0x76 // BMP280 conneciton: D1 = SCL; D2 = SDA
// minimum value to start both fan's is 110 // minimum value to start both fan's is 110
// without queeking noise is 255 // without queeking noise is 255
#define FAN_ON_TEMP 26 #define FAN_ON_TEMP 26.0
#define FAN_OFF_MAX_TEMP 24 #define FAN_OFF_MAX_TEMP 24.5
#define FAN_ON_STATE HIGH #define FAN_ON_STATE HIGH
#define FAN_OFF_STATE LOW #define FAN_OFF_STATE LOW
#define BMP280_CHECK_INTERVAL_MS 60000 // every 60000 = 60 seconds #define BMP280_CHECK_INTERVAL_MS 2000 // every 60000 = 60 seconds
float bmp280_temp = -99.9; float bmp280_temp = -99.9;
uint32_t bmp280_lastcheck_millis = BMP280_CHECK_INTERVAL_MS; uint32_t bmp280_lastcheck_millis = BMP280_CHECK_INTERVAL_MS;
@ -60,7 +60,7 @@ void loop()
Serial.println("FAN state: " + String(fan_state)); Serial.println("FAN state: " + String(fan_state));
analogWrite(FAN_PIN, fan_state); digitalWrite(FAN_PIN, fan_state);
digitalWrite(L_LED_PIN, LOW); digitalWrite(L_LED_PIN, LOW);