I actually tried the 5vdc fixed input solution and it works. I'm posting the specifics (so far) so others can use/abuse as they see fit. There's a lot more for me to learn here and I look forward to playing around more. The hardware is as follows:
Lobotomized Frigidaire EFIC117-SS countertop ice maker
NOYITO AC to DC Isolated Power Supply Module AC 120V 110V - 245V to DC 12V 6A 72W Peak (Amazon)
Mini Nano V3.0 ATmega328P Microcontroller Board w/USB Cable for Arduino (Amazon)
ANMBEST Relay Module with Optocoupler High/Low Level Trigger for Arduino (5V Relay 6 Channel) (Amazon)
Boost Buck Converter, DROK DC 5.5-30V to 0.5-30V 5V 12V 24V Output Adjustable Power Supply Regulator Module, 4A 35W High Power Voltage Step Up Down Converter Board with Case LCD Display (Amazon)
//Button dfinitons
const int PWR_BTN = 6; //Power button (red))
const int SEL_BTN = 7; //Select button (orange)
//LED definitions
const int WATER_LED = 3; //Water low LED (blue)
const int ICE_LED = 4; //Ice LED (yellow)
const int PWR_LED = 5; //Power LED (green)
//Relay controls
const int BYPASS_VALVE = 2; //Compressor bypass (120VAC - Relay 1)
const int WATER_PUMP = 9; //Water pump (12VDC - Relay 6) and S LED
const int COMP_FAN = 10; //Compressor fan (12VDC - Relay 5)
const int BLOWER_FAN = 11; //Blower fan (12VDC - Relay 4)
const int COMPRESSOR = 12; //Compressor (120VAC - Relay 2) and L LED
//Water sensor pins
const int WATER_PWR = 8; //Water sensor power supply pin (white)
const int WATER_SIGNAL = A5; //Water signal positive (gray)
//Constants used in the program
const int MIN_PRESS_TIME = 250; //Minimum time to register a button press (milliseconds)
const int BYPASS_PRESS_TIME = 5000; //minimum time to initiate thaw cycle (milliseconds)
const int WATERLEVELLIMIT = 250; //Set minimum water level
const int LOOP_TIME = 1000; //Loop timer for the program (milliseconds)
const int THAW_TIME = 20000; //Thaw timer (milliseconds)
const int verboseStatus = HIGH; //Display status info flag (High = yes, LOW = no)
//Water sensor settings
int waterCounterLimit = 10; //Establish water check interval
int waterVal = 0; //Initilize water sensor value
int waterCounter = 0; //Initialize waterCounter
int waterLevel = LOW; //Set waterLevel flag
int lastSelBtnState = LOW; //Initialize button state
int currentSelBtnState; //Initialize button state
//Button press time variables
unsigned long pressedTime = 0; //Initialize button press time
unsigned long releasedTime = 0; //Initialize button release time
long pressDuration = 0; //Initialize button press duration time
//Power button and states
int lastPwrBtnState = HIGH; //The previous state from the power button pin
int currentPwrBtnState; //The current reading from the power button pin
int currentPwrState; //The current status of the power
int currentBlowerState = LOW; //The current status of the blower fan
int currentCompressorState = LOW; //The current status of the compressor
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(PWR_BTN, INPUT_PULLUP); //Set up power button to be normally high
pinMode(SEL_BTN, INPUT_PULLUP); //Set up the select button to be normally high
pinMode(PWR_LED, OUTPUT); //Set up the power LED for output
pinMode(ICE_LED, OUTPUT); //Set up the ice LED for output
pinMode(WATER_LED, OUTPUT); //Set up the water LED for output
pinMode(WATER_PUMP, OUTPUT); //Set up water pump relay output
pinMode(COMP_FAN, OUTPUT); //Set up compressor cooling fan output
pinMode(BLOWER_FAN, OUTPUT); //Set up blower fan output
pinMode(COMPRESSOR, OUTPUT); //Set up compressor output
pinMode(BYPASS_VALVE, OUTPUT); //Set up the bypass valve output
pinMode(WATER_PWR, OUTPUT); //Set up water sensor power
digitalWrite(WATER_PWR, LOW); //Turn off the water sensor
blinkLED(PWR_LED,2,200); //Blink the power LED twice at 200msec interval
digitalWrite(PWR_LED, LOW); //Turn off power LED
Serial.println("Initialized");
}
void loop() {
if (waterCounter == 0){
checkWaterLevel();
if (waterLevel){
digitalWrite(WATER_LED, LOW);
} else {
digitalWrite(WATER_LED, HIGH);
}
} //(waterConter == 0)
if (waterCounter < waterCounterLimit){
waterCounter ++;
} else if (waterCounter == waterCounterLimit) {
waterCounter = 0;
} //(waterCounter < waterCounterLimit)
if (verboseStatus){
Serial.print("Water counter: ");
Serial.println(waterCounter);
} //(verboseStatus)
checkPowerBtn();
checkSelectBtn();
delay (LOOP_TIME);
}
void checkPowerBtn(){
currentPwrBtnState = digitalRead(PWR_BTN);
if (lastPwrBtnState == HIGH && currentPwrBtnState == LOW) { //power button pressed
pressedTime = millis();
} else if(lastPwrBtnState == LOW && currentPwrBtnState == HIGH) { //power button released
releasedTime = millis();
pressDuration = releasedTime - pressedTime;
if (pressDuration > MIN_PRESS_TIME && currentPwrState == LOW) {
if (waterVal > WATERLEVELLIMIT) {
powerOn();
} //(waterVal > WATERLEVELLIMIT)
} else if(pressDuration >= MIN_PRESS_TIME && currentPwrState == HIGH) {
if (pressDuration >= BYPASS_PRESS_TIME) {
if (currentCompressorState == HIGH) {
Serial.println("Manually disable compressor");
digitalWrite(COMPRESSOR, LOW);
currentCompressorState = LOW;
} else {
Serial.println("Manually enable compressor");
digitalWrite(COMPRESSOR, HIGH);
currentCompressorState = HIGH;
}
} //(pressDuration >= BYPASS_PRESS_TIME)
if (pressDuration < BYPASS_PRESS_TIME) {
powerOff();
} //(pressDuration < BYPASS_PRESS_TIME)
} //else if (pressDuration >= MIN_PRESS_TIME && currentPwrState == HIGH)
} //else if(lastPwrBtnState == LOW && currentPwrBtnState == HIGH)
lastPwrBtnState = currentPwrBtnState;
} //checkPwrButton
void checkSelectBtn() {
currentSelBtnState = digitalRead(SEL_BTN);
if (currentPwrState == HIGH) {
if (lastSelBtnState == HIGH && currentSelBtnState == LOW) {
pressedTime = millis();
} else if(lastSelBtnState == LOW && currentSelBtnState == HIGH) {
releasedTime = millis();
pressDuration = releasedTime - pressedTime;
if (pressDuration >= MIN_PRESS_TIME) {
if (pressDuration >= BYPASS_PRESS_TIME) {
thawCycle();
} else {
if (currentBlowerState == HIGH) {
Serial.println("Manually turn off blower");
digitalWrite(BLOWER_FAN, LOW);
currentBlowerState = LOW;
} else {
Serial.println("Manually turn on blower");
digitalWrite(BLOWER_FAN, HIGH);
currentBlowerState = HIGH;
}
}
} //(pressDuration >= BYPASS_PRESS_TIME)
} //else if(lastSelBtnState == LOW && currentSelBtnState == HIGH)
} //(currentPwrState == HIGH)
lastSelBtnState = currentSelBtnState;
} //checkSelectBtn
void powerOn(){
Serial.println("Powering on");
blinkLED(PWR_LED,1,500); //Delay using LED blink
if (verboseStatus){
Serial.println("Turn on water pump and wait 10 seconds");
} //(verboseStatus)
digitalWrite(WATER_PUMP, HIGH);
blinkLED(PWR_LED,10,500); //Delay using LED blink
if (verboseStatus){
Serial.println("Turn on compressor fan and wait 1 second");
} //(verboseStatus)
digitalWrite(COMP_FAN, HIGH);
blinkLED(PWR_LED,1,500); //Delay using LED blink
if (verboseStatus){
Serial.println("Enable compressor and wait 6 seconds");
} //(verboseStatus)
digitalWrite(COMPRESSOR, HIGH);
currentCompressorState = HIGH;
blinkLED(PWR_LED,6,500); //Delay using LED blink
digitalWrite(BLOWER_FAN, HIGH);
currentBlowerState = HIGH;
digitalWrite(PWR_LED, HIGH);
currentPwrState = HIGH;
Serial.println("Power up complete");
waterCounter = 0;
} //powerOn
void powerOff(){
Serial.println("Powering off");
blinkLED(PWR_LED,1,500); //Delay using LED blink
if (verboseStatus){
Serial.println("Turn off compressor and delay 1 second");
} //(verboseStatus)
digitalWrite(COMPRESSOR, LOW);
currentCompressorState = LOW;
blinkLED(PWR_LED,1,500); //Delay using LED blink
if (verboseStatus){
Serial.println("Turn off blower fan and wait 3 seconds");
} //(verboseStatus)
digitalWrite(BLOWER_FAN, LOW);
currentBlowerState = LOW;
blinkLED(PWR_LED,3,500); //Delay using LED blink
digitalWrite(PWR_LED, HIGH);
if (verboseStatus){
Serial.println("Turn off water pump and wait 10 seconds");
} //(verboseStatus)
digitalWrite(WATER_PUMP, LOW);
blinkLED(PWR_LED,10,500); //Delay using LED blink
if (verboseStatus){
Serial.println("Turn off compressor fan");
} //(verboseStatus)
digitalWrite(COMP_FAN, LOW);
blinkLED(PWR_LED,3,200); //Delay using LED blink
digitalWrite(WATER_LED, LOW);
digitalWrite(PWR_LED, LOW);
currentPwrState = LOW;
Serial.println("Shutdown complete");
} //powerOff
void thawCycle(){
int tempBlowerState = currentBlowerState;
Serial.println("Thaw cycle");
if (tempBlowerState == HIGH){
if (verboseStatus){
Serial.println("Turn off blower fan and wait 1 seconds");
} //(verboseStatus)
digitalWrite(BLOWER_FAN, LOW);
currentBlowerState = LOW;
} //(currentBlowerState == HIGH)
blinkLED(ICE_LED,1,500); //Delay using LED blink
if (verboseStatus){
Serial.print("Turn on bypass valve for ");
Serial.print((THAW_TIME) / 1000);
Serial.println(" seconds");
} //(verboseStatus)
digitalWrite(ICE_LED, HIGH);
digitalWrite(BYPASS_VALVE, HIGH);
blinkLED(ICE_LED,20,500); //Delay using LED blink
// delay(THAW_TIME);
if (verboseStatus){
Serial.println("Turn off bypass valve and wait for 1 second");
} //(verboseStatus)
digitalWrite(BYPASS_VALVE, LOW);
blinkLED(ICE_LED,1,500); //Delay using LED blink
digitalWrite(ICE_LED, LOW);
if (tempBlowerState == HIGH) {
if (verboseStatus){
Serial.println("Turn on blower fan");
} //(verboseStatus)
digitalWrite(BLOWER_FAN, HIGH);
currentBlowerState = HIGH;
} //(blowerState == HIGH)
} //thawCycle
void checkWaterLevel(){
Serial.println("Check water level");
digitalWrite(WATER_PWR, HIGH); //Turn on the water sensor
waterVal = analogRead(WATER_SIGNAL); //Read the analog value from the sensor
digitalWrite(WATER_PWR, LOW); //Turn off the water sensor
if (waterVal > WATERLEVELLIMIT ) {
if (verboseStatus) {
Serial.print("Water level good at ");
Serial.println(waterVal);
} //(verboseStatus)
waterLevel = HIGH;
} else {
if (verboseStatus){
Serial.print("Water level below threshold of ");
Serial.println(WATERLEVELLIMIT);
} //(verboseStatus)
waterLevel = LOW;
} //(waterVal > WATERLEVELLIMIT )
} //checkWaterLevel
void blinkLED(int LEDPin,int reps, int blinkTime){ //reps = # of cycles to blink, blinkTime = on/off time in msec
if (verboseStatus){
Serial.print("Blinking pin")
}
for (int x=1; x<=reps; x++){
digitalWrite(LEDPin, LOW);
delay(blinkTime);
digitalWrite(LEDPin, HIGH);
delay(blinkTime);
} //(int x=1; x<=reps; x++)
} //blinkLED