Make a new control board #2
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Given than fixing the original board is going to be too painful (#1), I will design a new board that I can easily debug and fix myself. The good thing is that I don't need to use a non-isolated power supply, so I don't need to risk shoking myself.
For now, I have more or less an idea of how it would fit together, but I need to find a way to test it before I make the final design.
There are too many digital inputs to use a ESP8266 which I have at hand, so I will try hooking directly an ATmega328p. This makes it cheap but also small with the drawback that it won't have WiFi.
Roughtly this is the plan:
Prototype 1: Dummy
Make a dummy circuit so that I can program the ATmega and debug that the firmware does what I want.
This is mostly done, I wrote a simple C firmware program that mimics a basic coffee machine. I would need to adjust it later to add more features, but for now it seems to work.
I'm running the ATmega with no external clock, which seems to be one of the hardest things of this project so far. I had to patch the Arduino bootloader so it works reliably at 8MHz with the internal clock and hook an external clock to program the fuses to switch to the internal clock (eww).
Prototype 2: Hook control signals, no power
For this version I want to hook all control cables to the coffee machine so that the ATmega reads the input from the real buttons and sensors of the machine. I will leave the 220 V port disconnected until I can check that it works fine.
I managed to use a floppy cable to extend the stupid JST connectors which don't fit in standard 2.54mm pitch pins. I guess you never have enough jumper cables. This is how it looks so far:
I still need to check continuity of all connections and make some room in the receiving end. I would also need to think how I hook the pull up resistors, as it seems they were in the control board instead of in the button board.
The idea is to be able to drive the machine with the MCU outside, so it is easy to debug. The water deposit will cover most of the space needed for debugging, but the long floppy cable seems to work fine.
Prototype 3: Hook relays to pump and heater
We need to be sure that we have galvanic isolation from the main AC, so we don't accidentally fry the controller (or me). I would need to solder some cables to some spare clips I have and find a way to
This prototype should be able to allow the water deposit to be installed, so we can begin to do some test runs. I need to calibrate the water sensor and the temperature thermistor. Is probably a good moment to also take measurements of the temperature on top of the heater, where the control board would be placed.
Prototype 4: Design PCB and place everything inside
Once I can get it to work reliably, I think we can place everything in a nice PCB. I have some stripboards but that would probably end up being messy.
Another approach is to let the control board be outside, which would be easy for debugging access, but would be more bulky. We can only expose the low power control signals as well as the galvanic insulated relay lines.
Another topic that I would need to consider is what we do with the 12V coil that controls the return of the lever that closes the water circuit. A potential path is to ignore it and let the user stop the lever when the time is up. This makes the power distribution much simpler as we only need a single 5V power supply, which is easy to get. We would we a boost converter to bump it, but I need to first measure how much power it draws. Another option migh be to replace it with a lower voltage coil (more turns?) or change the turns myself.
I'll decide this later.
Managed to get the power button, the red LED and the NTC connected to the control board. It seems to be working fine.
I manually connected the heater to the power line by directly connecting the AC line end to the heater. Then, I connected the plug briefly to the power line. It uses around 1.4 kW of power and it heats very fast.
I left it cool for some minutes and tried again with the control board reporting the temperature. Below 40 C I plugged it again and stopped as soon as the relay opened again at around 50 C. However, the temperature keeps rising for a long time, as it can be seen in this plot:
Hopefully it was under the fuse limits so I didn't burn anything, but I would need to change the temperature controller to handle the big swing. I would assume they could do PID with variable PWM so they can control better the temperature.
The test is also running without any water, so that might be better when I fill the deposit. In any case, we should be able to measure how fast the temperature is rising and stop before it is too late.
The relays should be able to handle the load, as they are designed to control up to 10 A at 250 VAC. The heater will use around 6 A so it should be fine. However, the PCB tracks underneath the relay pins are probably too thin. We may want to add some extra wires to help reduce the heat.
I would need to repeat the experiment after connecting the relay so I can dump the data with the state of the relay, the temperature and the current time.
I would consider the prototype 2 mostly done, so I can move on to the next one.
Hooked the relay common pin to the AC neutral line and the normally open (NO) pin to the heater. I repeated the same experiment but this time recording the time and state of the relay. When the temperature reaches 50 °C the relay opens again disconnecting the heater.
The temperature again rises too quickly and reaches 80 °C. I would need to add a check that detects this sudden rise in temperature because in the event that the heater runs dry, nothing will be able to detect that is dry until the pump is active and the flow meter sees that there is no water flowing.
We can simply keep a ring buffer with the last N temperature samples. If the difference is bigger than a threshold we abort and complain because it is likely running dry. We can only do this while below 50-60°C otherwise it would be too late and the overshoot will burn the thermal fuses.
Same experiment but with overheat protection enabled. At 34°C it already triggers the overheat protection and shuts down the heater. The temperature only rises up to 55 °C.
I would need to adjust the threshold to avoid triggering it with water. So far the heat relay seems to be able to handle the load just fine.
I think I can now move to the pump and hook it to the other relay. Then I can do a test run with water and see how that changes the heating curve.
Connected the pump to the relay and filled the water deposit. I primed the circuit by turning on the pump until water came on the other side. Then I turn on the heater, but the overheat protection kicked in and disconnected the heater:
I don't think we will be able to use the slope only to prevent overheating. We will need to slowly turn on and off the relay until we approach the brewing temperature. We can also charaterize the heating curve so we can do a controlled burn of a given time, knowing the overshoot will approach us to the target temperature. Then simply correct by small increments.
In any case, both the heater and pump relays are working as expected and I can place the water deposit with the cover open.