Advertisement
Guest User

Untitled

a guest
Feb 25th, 2020
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // user.h
  2. //---------
  3. // This file contains user definable compiler directives for aArtisanQ_PID
  4.  
  5. // *************************************************************************************
  6. // NOTE TO USERS: the following parameters should be
  7. // be reviewed to suit your preferences and hardware setup.
  8. // First, load and edit this sketch in the Arduino IDE.
  9. // Next compile the sketch and upload it to the Arduino.
  10.  
  11. #ifndef USER_H
  12. #define USER_H
  13.  
  14. ////////////////////
  15. // Roasting software
  16. // Comment out all if using TC4 stand alone
  17. //#define ROASTLOGGER
  18. #define ARTISAN
  19. //#define ANDROID
  20.  
  21. ////////////////////
  22. // Base configurations (leave only one uncommented)
  23. //#define CONFIG_PWM // slow PWM on OT1 (heater); fast PWM output (3.922kHz) on IO3 (DC fan); ZCD not required
  24. //#define CONFIG_PAC2 // phase angle control on OT1 (heater) and OT2 (fan); IO2 used to read the ZCD; IO3 undefined
  25. //#define CONFIG_PAC2_IO3HTR // phase angle control on OT1 (heater) and OT2 (fan); IO2 reads the req'd ZCD; IO3 reserved for fast PWM output for heater
  26. #define CONFIG_PAC3 // phase angle control on OT1 (heater) and OT2 (fan); IO3 reads the req'd ZCD; IO3 not available for output
  27. // end of base configurations
  28. /////////////////////////////
  29.  
  30. ////////////////////
  31. // Temperature Unit
  32. //#define CELSIUS // controls only the initial conditions.  Comment out for F.
  33.  
  34. ////////////////////
  35. // LCD Options
  36. // Comment out non required features
  37. #define LCD // if output on an LCD screen is desired
  38. //#define LCDAPTER // if the I2C LCDapter board is to be used
  39. //#define LCD_4x20 // if using a 4x20 LCD instead of a 2x16
  40.  
  41. // AC Power Options
  42. // Needed for PHASE_ANGLE_CONTROL option
  43. #define FREQ60 // 60Hz
  44. //#define FREQ50 // 50Hz
  45.  
  46. ////////////////////
  47. // Thermocouple Input Options
  48. // TC type is selectable by input channel
  49. // permissable options:  typeT, typeK, typeJ
  50. #define TC_TYPE1 typeK  // thermocouple on TC1
  51. #define TC_TYPE2 typeK  // thermocouple on TC2
  52. #define TC_TYPE3 typeK  // thermocouple on TC3
  53. #define TC_TYPE4 typeK  // thermocouple on TC4
  54.  
  55. ////////////////////
  56. // BAUD Rate for serial communication
  57. #define BAUD 19200 // useful for BT links
  58. //#define BAUD 115200  // default
  59.  
  60. ////////////////////
  61. // Analogue inputs (optional)
  62. // Comment out if not required
  63. //#define ANALOGUE1 // if potentiometer connected on ANLG1
  64. //#define ANALOGUE2 // if potentiometer connected on ANLG2
  65.  
  66. ////////////////////
  67. // Duty Cycle Adjustment Increment
  68. // Used for rounding/increment for analogue inputs and power UP/DOWN commands
  69. #define DUTY_STEP 5 // Use 1, 2, 4, 5, or 10.
  70.  
  71. ////////////////////
  72. // Physical input channel for RoR display on LCD
  73. // Corresponds to Thermocouple inputs T1-T4
  74. #define ROR_CHAN 1
  75.  
  76. ////////////////////
  77. // PID Control Options
  78. #define PID_CONTROL
  79. #define PID_CHAN 2 // physical channel for PID input (corresponding to thermocouple inputs T1-T4)
  80. #define CT 1000 // default cycle time for the PID, in ms
  81. #define PRO 5.00 // initial proportional parameter
  82. #define INT 0.15 // initial integral parameter
  83. #define DER 0.00 // initial derivative parameter
  84.  
  85. #define NUM_PROFILES 2 // number of profiles stored in EEPROM
  86.  
  87. ////////////////////
  88. // Heater and Fan Limits/Options
  89. #define MIN_OT1 0 // Set output % for lower limit for OT1.  0% power will always be available
  90. #define MAX_OT1 100 // Set output % for upper limit for OT1
  91.  
  92. #define MIN_OT2 0 // Set output % for lower limit for OT2.  0% power will always be available
  93. #define MAX_OT2 100 // Set output % for upper limit for OT2
  94.  
  95. #define MIN_IO3 0 // Set output % for lower limit for IO3.  0% power will always be available
  96. #define MAX_IO3 100  // Set output % for upper limit for IO3
  97.  
  98. // cut power to Heater if fan duty is less than HTR_CUTOFF_FAN_VAL (to protect heater in air roaster). Set to 0 for no cutoff
  99. #define HTR_CUTOFF_FAN_VAL 0 // default
  100. // #define HTR_CUTOFF_FAN_VAL 10  //optional value
  101.  
  102. #define FAN_AUTO_COOL 30 // Set fan output duty for auto cool when using PID;STOP command
  103.  
  104. ////////////////////
  105. // Command Echo
  106. //#define COMMAND_ECHO // Echo all serial commands to LCD for debugging
  107.  
  108. ////////////////////
  109. // Temperature Reading Filters
  110. #define BT_FILTER 10 // filtering level (percent) for BT
  111. #define ET_FILTER 10 // filtering level (percent) for ET
  112. #define AMB_FILTER 70 // 70% filtering on ambient sensor readings
  113.  
  114. // use RISE_FILTER to adjust the sensitivity of the RoR calculation
  115. // higher values will give a smoother RoR trace, but will also create more
  116. // lag in the RoR value.  A good starting point is 80%, but for air poppers
  117. // or other roasters where BT might be jumpy, then a higher value of RISE_FILTER
  118. // will be needed.  Theoretical max. is 99%, but watch out for the lag when
  119. // you get above 95%.
  120. #define RISE_FILTER 85 // heavy filtering on non-displayed BT for RoR calculations
  121. #define ROR_FILTER 80 // post-filtering for the computed RoR values
  122.  
  123. // Thermocouple inputs
  124. #define NC 4 // maximum number of physical channels on the TC4
  125.  
  126. ////////////////////
  127. // Calibration Values
  128. // default values for systems without calibration values stored in EEPROM
  129. #define CAL_GAIN 1.00 // you may substitute a known gain adjustment from calibration
  130. #define UV_OFFSET 0 // you may subsitute a known value for uV offset in ADC
  131. #define AMB_OFFSET 0.0 // you may substitute a known value for amb temp offset (Celsius)
  132.  
  133. ////////////////////
  134. // Time Base for slow PWM on OT1, OT2
  135. // When NOT using PHASE_ANGLE_CONTROL option
  136. // choose one of the following for the PWM time base for heater output on OT1 or OT2
  137. //#define TIME_BASE pwmN4sec  // recommended for Hottop D which has mechanical relay
  138. //#define TIME_BASE pwmN2sec
  139. #define TIME_BASE pwmN1Hz  // recommended for most electric heaters controlled by standard SSR
  140. //#define TIME_BASE pwmN2Hz
  141. //#define TIME_BASE pwmN4Hz
  142. //#define TIME_BASE pwmN8Hz
  143. //#define TIME_BASE 15 // should result in around 977 Hz (TODO these need testing)
  144. //#define TIME_BASE 7 // approx. 1.95kHz
  145. //#define TIME_BASE 6 // approx. 2.2kHz
  146. //#define TIME_BASE 3 // approx. 3.9kHz
  147.  
  148. ////////////////////
  149. // Debuging Options
  150. // Useful for debugging only -- leave inactive otherwise
  151. //#define MEMORY_CHK
  152.  
  153. // This turns on the "# xxxxxxx\n" acknowledgements after commands
  154. //#define ACKS_ON
  155.  
  156. ////////////////////
  157. // Output Pin Setup
  158. // phase angle control and integral cycle control outputs
  159. #define OT1 9 // OT1 is on pin D9
  160. #define OT2 10 // OT2 is on pin D10
  161. #define OT_PAC OT2 // phase angle control on OT2 (AC fan, usually)
  162. #define OT_ICC OT1 // integral cycle control on OT1 (AC heater, usually)
  163. #define LED_PIN 13
  164.  
  165. //////////////////////////////////////////////////////
  166. // Set up parameters for the base configurations
  167. #ifdef CONFIG_PWM // nothing special to configure -- this is the default
  168. #endif
  169.  
  170. #ifdef CONFIG_PAC2_IO3HTR
  171. #define PHASE_ANGLE_CONTROL // phase angle control for OT2(fan) and ICC control for OT1(heater)
  172. #define IO3_HTR_PAC // use PWM (3.922kHz) out on IO3 for heater in PHASE ANGLE CONTROL mode
  173. // zero cross detector (ZCD) connected to I/O2
  174. #define EXT_INT 0 // interrupt 0
  175. #define INT_PIN 2 // pin 2
  176. #endif
  177.  
  178. #ifdef CONFIG_PAC2
  179. #define PHASE_ANGLE_CONTROL // phase angle control for OT2(fan) and ICC control for OT1(heater)
  180. // zero cross detector (ZCD) connected to I/O2
  181. #define EXT_INT 0 // interrupt 0
  182. #define INT_PIN 2 // pin 2
  183. #endif
  184.  
  185. #ifdef CONFIG_PAC3
  186. #define PHASE_ANGLE_CONTROL // phase angle control for OT2(fan) and ICC control for OT1(heater)
  187. // zero cross detector (ZCD) connected to I/O3
  188. #define EXT_INT 1 // interrupt 1
  189. #define INT_PIN 3
  190. #endif
  191.  
  192. ////////////////////
  193. // Heater and Fan Duty Dispay Options
  194. // These should NOT need adjusting.  They control what gets streamed back to via serial
  195. // These have no effect on operation and only affect what gets displayed/logged by Artisan
  196. #ifdef PHASE_ANGLE_CONTROL
  197. #ifdef IO3_HTR_PAC // If using PWM on IO3 for a heater
  198. #define HEATER_DUTY levelIO3 // Heater output is assumed levelIO3 with heater connected to IO3
  199. #else // If using ICC control of a heater connected to OT1
  200. #define HEATER_DUTY levelOT1 // Heater output is assumed levelOT1 with heater connected to OT1
  201. #endif
  202. #define FAN_DUTY levelOT2 // Fan output is assumed levelOT2 for phase angle control mode on OT2
  203. #else // PWM Mode
  204. #define HEATER_DUTY levelOT1 // Heater output is assumed levelOT1 with heatre connected to OT1
  205. #define FAN_DUTY levelIO3 // Fan output is assumed levelIO3 for PWM control of fan connected to IO3
  206. #endif
  207.  
  208. ////////////////////
  209. // Phase Angle Control Options
  210. // When using PHASE_ANGLE_CONTROL option
  211. // Selct load type being switched by phase angle control (has no effect on the ICC output)
  212. #define TRIAC_MOTOR // inductive loads need a longer pulse width to fire at 100%
  213. //#define TRIAC_HEATER // enable this for resistive loads, like heaters
  214.  
  215. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement