Thursday, 25 May 2017

Controller part 6 - autofill

All the functionality shown in the state diagram will be built into the programming of the microcontroller (an Arduino at least for now as it is so convenient). The extreme democratization of microcontrollers just makes having discrete industrial controllers a non-starter. I could purchase Arduinos and just hand solder a rat's nest of components for less than the cost of a single Gicar, never mind the $300+ PID and $100 pressurestat. Once the electronic design is finished, a custom PCB will reduce the cost even further (if one neglects the not insignificant work that will go into it :).

What is required for the autofill is essentially a comparator - a circuit that checks to see if a voltage level is above or below a certain threshold. The essence of the circuit is a switch that is grounded by the water when it touches the probe.



The switch in the diagram is analogous to the probe touching the water or not (and assumes that the boiler is physically connected to the same ground as the microcontroller). When the switch is open, the analog pin on the Arduino "sees" the full 5 volts. When the switch is closed, the value "seen" by the pin drops to (close to) zero. In reality,  as a result of the resistance of the water, the boiler, the probe etc., this value is not zero; thus the need for a comparator. But this is easy to implement on the microcontroller:

autoFillProbeValue = analogRead(autoFillProbePin);
if (autoFillProbeValue < 500)  {
      digitalWrite(autofillSolenoidPin, HIGH);
    }
  else {
    digitalWrite(autofillSolenoidPin, LOW);             
   }

The Arduino is an 8-bit device and the logic level is 5v, so values between 0 and 5v are mapped by the analog to digital convertor to values between 0 and 1023 (2 to the 8th power values). So anything lower than 500 will open the solenoid. By putting in a timer which counts while the pin is high, it is possible to trigger an alarm when the tap has been on for too long. When that alarm is triggered, the state machine switches off the solenoid and the heater and waits for a reset signal before it will do anything else.

As the probe is sitting in water in close proximity to a heating element that is powered by a 15amp 120v circuit, I also added a diode rated for the voltage in the line to the probe. I will have to consult a higher power to see if there are any other safety precautions that should be taken.

No comments:

Post a Comment