I'm pretty sure Tiros is using the stock mechanical relay with his PID project. He basically built a heat meter from scratch, but only using a 5V micro controller and a cheap wifi board.
He's pretty tight lipped about his schematics and source code, however. I guess that is his prerogative.
Not really, its nothing proprietary.
Here's some details:
The Esp8266 I use is a micro controller with built in Wifi. It runs at 3.3 volts. The board has a linear regulator.
The Microchip part is the 12 bit spi A/D, it is not the controller. There also 2 quad op amps for buffering, along with some resistors and capacitors.
The Esp8266 is fully supported by the Arduino guys. You can even use the Arduino IDE.
I am using the BLYNK platform for IOT. I use a local Raspberry Pi Blynk server for lowest latency, and unlimited app resources (free energy).
I see your post says the transformer is only 250ma. I'm not sure my Gen1 has. Esp uses more than that iirc but I think only in surges, maybe a big cap would help. Maybe I am under powered. I didn't see any power issue on my scope.
As for the relay:
Basically the PID interrupt occurs ever 200msec, and it evaluates every 60 seconds. At the eval point it decides the power level for the next 60 seconds. If its too small, it saves the small bit and adds it to next eval. This way the relay doesn't get pulsed on too short of a time, and still preserves the smaller results.
To Wit:
////RELAY OUTPUT CODE: We are here at pid timer rate
////This code executes at pid timer speed, NOT AT PID COMPUTE SPEED!
//turn the output pin on/off based on pid output
//Limit minimum on/off time, per PID cycle
void outputToRelay(double output, int bNewPidCalc)
{
unsigned long RelayMillis;
static int iMakeUpMillis=0, iOweMillis=0;
if(output<0) output=0;
if(output>PWM_STEPS) output=PWM_STEPS;
RelayMillis=(unsigned long) (output+.5)*(PID_CYCLE_TIME/PWM_STEPS);
//RelayMillis=1000;
//RelayMillis=29000;
//RelayMillis=4500;
if(bNewPidCalc) {
iMakeUpMillis=iOweMillis;
//Serial.print("iOweMillis: ");Serial.print(iOweMillis);Serial.print(" iMakeUp: ");Serial.print(iMakeUpMillis);Serial.println();
}
RelayMillis+=iMakeUpMillis;
//A short turn skips this cycle and adds to next cycle
if(RelayMillis < RELAY_MIN_TIME && RelayMillis) {
iOweMillis=RelayMillis;
RelayMillis=0;
}
//A short turn off subtracts from next cycle
else if(RelayMillis > PID_CYCLE_TIME-RELAY_MIN_TIME && RelayMillis < PID_CYCLE_TIME) {
iOweMillis=RelayMillis-PID_CYCLE_TIME;
RelayMillis=PID_CYCLE_TIME;
}
else {
iOweMillis=0;
}
unsigned long now = millis();
if(now - windowStartTime>=WindowSize) { //time to shift the Relay Window
windowStartTime += WindowSize;
}
if(RelayMillis >= now - windowStartTime) HeatControl(1);
else HeatControl(0);
}
As for the sensor:
In my gen 1, the internal sensor is supplied with 5 volts from the MB regulator. With a suitable terminator, I can read that, but the output will be referenced to the 5 volt supply. Not the best situation for a ratio metric A/D. Better is to use an external probe. I use
Thermoworks, it comes with a nice little grate clip too.
Mine is hand wired. If you want to make a board up, I can help you out.