Skip to content

Commit

Permalink
Update hardware and software to v0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustavo Casanova committed Oct 7, 2019
1 parent f20376e commit 84b3b53
Show file tree
Hide file tree
Showing 7 changed files with 294 additions and 82 deletions.
2 changes: 1 addition & 1 deletion software/victoria-control/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"terminal.integrated.env.windows": {
"PATH": "C:\\Users\\casanovg\\.platformio\\penv\\Scripts;C:\\Users\\casanovg\\.platformio\\penv;C:\\Python27\\;C:\\Python27\\Scripts;C:\\ProgramData\\Boxstarter;C:\\WinAVR-20100110\\bin;C:\\WinAVR-20100110\\utils\\bin;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files\\Microsoft SQL Server\\130\\Tools\\Binn\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\MinGW\\bin;C:\\Program Files\\PuTTY\\;C:\\Program Files\\LLVM\\bin;C:\\Program Files\\nodejs\\;C:\\ProgramData\\chocolatey\\bin;C:\\Program Files (x86)\\IVI Foundation\\VISA\\WinNT\\Bin\\;C:\\Program Files\\IVI Foundation\\VISA\\Win64\\Bin\\;C:\\Program Files (x86)\\IVI Foundation\\VISA\\WinNT\\Bin;%SystemRoot%\\system32;%SystemRoot%;%SystemRoot%\\System32\\Wbem;%SYSTEMROOT%\\System32\\WindowsPowerShell\\v1.0\\;%SYSTEMROOT%\\System32\\OpenSSH\\;C:\\Ruby25-x64\\bin;C:\\Users\\casanovg\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\casanovg\\AppData\\Local\\atom\\bin;C:\\Users\\casanovg\\AppData\\Local\\Programs\\Microsoft VS Code\\bin;C:\\Users\\casanovg\\AppData\\Roaming\\npm;C:\\Users\\casanovg\\AppData\\Local\\Programs\\Git\\cmd;C:\\Users\\casanovg\\AppData\\Local\\Microsoft\\WindowsApps;;C:\\Python27\\;C:\\Python27\\Scripts;C:\\ProgramData\\Boxstarter;C:\\WinAVR-20100110\\bin;C:\\WinAVR-20100110\\utils\\bin;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files\\Microsoft SQL Server\\130\\Tools\\Binn\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\MinGW\\bin;C:\\Program Files\\PuTTY\\;C:\\Program Files\\LLVM\\bin;C:\\Program Files\\nodejs\\;C:\\ProgramData\\chocolatey\\bin;C:\\Program Files (x86)\\IVI Foundation\\VISA\\WinNT\\Bin\\;C:\\Program Files\\IVI Foundation\\VISA\\Win64\\Bin\\;C:\\Program Files (x86)\\IVI Foundation\\VISA\\WinNT\\Bin;%SystemRoot%\\system32;%SystemRoot%;%SystemRoot%\\System32\\Wbem;%SYSTEMROOT%\\System32\\WindowsPowerShell\\v1.0\\;%SYSTEMROOT%\\System32\\OpenSSH\\;C:\\Ruby25-x64\\bin;C:\\Users\\casanovg\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\casanovg\\AppData\\Local\\atom\\bin;C:\\Users\\casanovg\\AppData\\Local\\Programs\\Microsoft VS Code\\bin;C:\\Users\\casanovg\\AppData\\Roaming\\npm;C:\\Users\\casanovg\\AppData\\Local\\Programs\\Git\\cmd;C:\\Users\\casanovg\\AppData\\Local\\Microsoft\\WindowsApps;",
"PATH": "C:\\Users\\casanovg\\.platformio\\penv\\Scripts;C:\\Users\\casanovg\\.platformio\\penv;C:\\WinAVR-20100110\\bin;C:\\WinAVR-20100110\\utils\\bin;C:\\Program Files (x86)\\NVIDIA Corporation\\PhysX\\Common;C:\\Program Files (x86)\\Intel\\iCLS Client\\;C:\\Program Files\\Intel\\iCLS Client\\;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\IPT;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\IPT;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Program Files\\Microsoft VS Code\\bin;C:\\Program Files\\Git\\cmd;C:\\Users\\casanovg\\AppData\\Local\\Microsoft\\WindowsApps;;C:\\WinAVR-20100110\\bin;C:\\WinAVR-20100110\\utils\\bin;C:\\Program Files (x86)\\NVIDIA Corporation\\PhysX\\Common;C:\\Program Files (x86)\\Intel\\iCLS Client\\;C:\\Program Files\\Intel\\iCLS Client\\;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\IPT;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\IPT;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Program Files\\Microsoft VS Code\\bin;C:\\Program Files\\Git\\cmd;C:\\Users\\casanovg\\AppData\\Local\\Microsoft\\WindowsApps;",
"PLATFORMIO_CALLER": "vscode"
}
}
16 changes: 11 additions & 5 deletions software/victoria-control/include/delays.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* ........................................................
* File: delays.h (non-blocking delays) for ATmega328
* ........................................................
* Version: 0.5 "Juan" / 2019-08-19
* Version: 0.6 "Juan" / 2019-09-22
* [email protected]
* ........................................................
*/
Expand All @@ -23,12 +23,18 @@
#define DLY_L_IGNITING_4 100 /* Igniting_4 step long delay */
#define DLY_L_IGNITING_5 300 /* Igniting_5 step long delay */
#define DLY_L_IGNITING_6 500 /* Igniting_6 step long delay */
#define DLY_L_DHW_ON_DUTY_1 500 /* On_DHW_Duty_1 step long delay */
#define DLY_L_DHW_ON_DUTY_1 100 /* On_DHW_Duty_1 step long delay */
#define DLY_L_DHW_ON_DUTY_LOOP 3000 /* On_DHW_Duty loop long delay */
#define DLY_L_CH_ON_DUTY_1 500 /* On_CH_Duty_1 step long delay */
#define DLY_L_CH_ON_DUTY_LOOP 3000 /* On_DHW_Duty loop long delay */
#define DLY_WATER_PUMP_OFF 1800000 /* Delay until the water pump shuts down when there are no CH requests */
/* Time: 900000 / 60 / 1000 = 15 min aprox, 1800000 = 30 min aprox */
#define DLY_DEBOUNCE 1000 /* Debounce delay for electromechanical switches */
#define DLY_L_FLAME_MODULATION 9000 /* Modulation cycle: used in 1/3 parts */
#define DLY_WATER_PUMP_OFF 600000 /* Delay until the water pump shuts down when there are no CH requests */
/* Time: 600000 / 60 / 1000 = 15 min aprox */
/* Time: 900000 / 60 / 1000 = 15 min aprox */
/* Time: 1800000 / 60 / 1000 = 30 min aprox */
#define DLY_DEBOUNCE_CH_REQ 1000 /* Debounce delay for CH request thermostat switch */
#define DLY_DEBOUNCE_AIRFLOW 10 /* Debounce delay for airflow sensor switch */
#define DLY_FLAME_OFF 100 /* Delay before checking if the flame is off after closing gas */
#define DLY_AIRFLOW_OFF 2000 /* Delay before checking if the airflow sensor switches off when the fan gets turned off */

#endif /* DELAYS_H_ */
6 changes: 3 additions & 3 deletions software/victoria-control/include/errors.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* ........................................................
* File: errors.h (error codes header) for ATmega328
* ........................................................
* Version: 0.5 "Juan" / 2019-08-19
* Version: 0.6 "Juan" / 2019-09-22
* [email protected]
* ........................................................
*/
Expand All @@ -20,13 +20,13 @@
#define ERROR_002 2
// E003: Airflow sensor out of sequence
#define ERROR_003 3
// E004: Exhaust fan not producing enough airflow or airflow-sensor failure
// E004: Exhaust fan not producing enough airflow or airflow-sensor failure (before ignition)
#define ERROR_004 4
// E005: Ignition timeout, flame not detected or unexpectedly extinguished
#define ERROR_005 5
// E006: Airflow sensor didn't turn off on time
#define ERROR_006 6
// E007: No pressure detected in the flue-exhaust duct, there is a fan or airflow sensor problem
// E007: No pressure detected in the flue-exhaust duct, there is a fan or airflow sensor failure (when the flame is lit)
#define ERROR_007 7
// E008: DHW sensor out of range: NTX thermistor failure or cable disconnected
#define ERROR_008 8
Expand Down
50 changes: 42 additions & 8 deletions software/victoria-control/include/victoria-control.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* ........................................................
* File: victoria-control.h (headers) for ATmega328
* ........................................................
* Version: 0.5 "Juan" / 2019-08-19
* Version: 0.6 "Juan" / 2019-09-22
* [email protected]
* ........................................................
*/
Expand All @@ -25,8 +25,8 @@
#define BAUDRATE 38400
#define BAUD_PRESCALER (((F_CPU / (BAUDRATE * 16UL))) - 1)

#define CH_SETPOINT_HIGH 730 /* ADC-NTC CH temperature ~ 52°C */
#define CH_SETPOINT_LOW 830 /* ADC-NTC CH temperature ~ 42°C */
#define CH_SETPOINT_HIGH 241 /* ADC-NTC CH temperature ~ 55°C */
#define CH_SETPOINT_LOW 379 /* ADC-NTC CH temperature ~ 38°C */

#ifndef MAX_IGNITION_RETRIES
#define MAX_IGNITION_RETRIES 3 /* Number of ignition retries when no flame is detected */
Expand All @@ -37,7 +37,7 @@
#endif /* OVERHEAT_OVERRIDE */

#ifndef AIRFLOW_OVERRIDE
#define AIRFLOW_OVERRIDE true /* True: Flue airflow sensor override */
#define AIRFLOW_OVERRIDE false /* True: Flue airflow sensor override */
#endif /* AIRFLOW_OVERRIDE */

#ifndef FAST_FLAME_DETECTION
Expand Down Expand Up @@ -129,7 +129,8 @@
//#define CH_TEMP ADC7
#define ADC_MIN 0
#define ADC_MAX 1023
#define MAX_CH_TEMP_TOLERANCE 80
#define MAX_CH_TEMP_TOLERANCE 65

#define CH_TEMP_MASK 0x3FE

// Types
Expand All @@ -154,6 +155,8 @@ typedef enum inner_steps {
IGNITING_5 = 25,
IGNITING_6 = 26,
DHW_ON_DUTY_1 = 31,
DHW_ON_DUTY_2 = 32,
DHW_ON_DUTY_3 = 33,
CH_ON_DUTY_1 = 41,
CH_ON_DUTY_2 = 42
} InnerStep;
Expand All @@ -171,8 +174,6 @@ typedef enum input_flags {
typedef enum analog_inputs {
DHW_TEMPERATURE = 6,
CH_TEMPERATURE = 7,
//DHW_TEMPERATURE = 4, // Just for testing -> SDA in production
//CH_TEMPERATURE = 5, // Just for testing -> SCL in production
DHW_SETTING = 0,
CH_SETTING = 1,
SYSTEM_SETTING = 2
Expand Down Expand Up @@ -218,6 +219,11 @@ typedef struct sys_info {
uint32_t pump_delay; /* CH water pump auto-shutdown timer */
InnerStep ch_on_duty_step; /* CH inner step before handing over control to DHW */
} SysInfo;
typedef struct heat_power {
bool valve_3_state;
bool valve_2_state;
bool valve_1_state;
} HeatPower;
typedef struct debounce_sw {
uint16_t ch_request_deb; /* CH request switch debouncing delay */
uint16_t airflow_deb; /* Airflow sensor switch debouncing delay*/
Expand Down Expand Up @@ -249,7 +255,7 @@ void GasOff(SysInfo *);
void SystemRestart(void);

// Globals
const char __flash str_header_01[] = {" OPEN-BOILER v0.5 "};
const char __flash str_header_01[] = {" OPEN-BOILER v0.6 "};
const char __flash str_header_02[] = {"\"Juan, Sandra & Gustavo\" "};
const char __flash str_iflags[] = {"Inputs: "};
const char __flash str_oflags[] = {"Outputs: "};
Expand Down Expand Up @@ -291,4 +297,32 @@ const char __flash str_wptimer[] = {" CH water pump auto-shutdown timer: "};
#endif /* SHOW_PUMP_TIMER */
//const char __flash str_bug[] = {" FORCED BUG !!! "};

const bool __flash heat_modes[5][3][3] = {
{
{0, 0, 1},
{0, 0, 1},
{0, 0, 1}
},
{
{0, 1, 0},
{0, 0, 1},
{0, 0, 1}
},
{
{0, 1, 0},
{0, 1, 0},
{0, 0, 1}
},
{
{1, 0, 0},
{0, 0, 1},
{0, 0, 1}
},
{
{0, 1, 0},
{0, 1, 0},
{0, 1, 0}
}
};

#endif /* VICTORIA_CONTROL_H_ */
18 changes: 9 additions & 9 deletions software/victoria-control/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
[env:pro16MHzatmega328]
platform = atmelavr
framework = arduino
;board = pro16MHzatmega328
board = pro16MHzatmega328
; For Optiboot bootloader
;upload_speed = 115200

; Without bootloader (Programmer USBasp)
board = ATmega328P
board_build.f_cpu = 16000000L
upload_protocol = usbasp
upload_flags =
-B3
-Pusb

;upload_speed = 57600
; board = ATmega328P
; board_build.f_cpu = 16000000L
; upload_protocol = usbasp
; upload_flags =
; -B3
; -Pusb
Loading

0 comments on commit 84b3b53

Please sign in to comment.