Wednesday, July 24, 2013

Building a new firmware for the Senseo coffee machine



This is one of those projects that just takes forever to finish, I must've started this 6 months ago.

This part will describe all the hardware and various techniques used to figure out which signal goes where.

Why do this? It's an improvement on the original firmware and an exercise in consumer product design. My goals will be listed in the second part of this post.









Hardware requirements


To start any project you first need to figure out the inputs and the outputs:
- three buttons: power, 1 coffee, 2 coffees -> DIGITAL IN
- the power button has a small red LED circle around it -> DIGITAL OUT
- heater controlled via an SCR -> DIGITAL OUT
- NTC thermistor inside the heater is sampled through a voltage divider -> ANALOG IN
- water sensor is a hall type sensor that detects the floater position inside the water tank -> DIGITAL IN
- water pump is controlled via a small transistor -> DIGITAL OUT

So at least we know that we need some controller with 1 ADC and 7 GPIOs.

Hardware identification


Now we need to trace all the signals, we can either do this by hand with paper and pencil (like I did) or make an overlay from the front and back images like shown in the third picture:



This is from a different project, but you should get the idea. I found it actually takes more work than to do it the old-fashioned way:



All the digital inputs and output should be easy to handle, except for the fact that they work at 5V and I intend to use a 3.3V microcontroller. More on that later.

A word of warning



Just as a mention, don't do this on your (electrical) workbench, as seen on the left. There is still water left in the boiler canister causing it flow all over your sensitive stuff. And also over your electronics stuff.

It's better to do this in a water-resistant environment like kitchen or bathroom. Of course, if the project takes more and a day to finish it will not earn your significant-one's approval.

Another downside is the electrical danger provided by the bathroom (earth-referenced tiles) and kitchen (metallic earth-reference sink and cooking plate).

I managed to short the original board when the breakout header touched the sink. This is because the entire machine is referenced to mains/220V and does not contain an isolation device (transformer).

Analog interface


The hardest part of the puzzle to figure out is the temperature sensor datasheet. Just measuring it we can see it shows a resistance so it's a thermistor. The resistance decreases when the sensor is touched so we know it's an NTC.
We don't actually need a datasheet, we can build it the hard way: cooking plate, cooking pot, thermometer, multimeter, pen and paper.


We need to cook the water and measure both the water temperature and the NTC resistance and write that down. A graph also helps in figuring out how the sensor could perform between the points or outside its range. It can also show if you have large measurement aberrations.


There are two curves because the long one was taken while the temperature rose while the short one was taken while it decreased.
The hysteresis figure between 70 and 87 degrees Celsius was expected and needs to be watched cared for. This means that while measuring 1.1 kOhms we could be anywhere between 80 and 85 degrees.

We also need to watch out because the sensor will not show a resistance less than 0.8 kOhms while pressure is building inside the boiler, making this a risk for explosions. So I would venture to say that any value below 1k means that the heating element needs to be stopped immediately as its thermal inertia will continue heating the water for a few more seconds.

Digital interface and power


The power supply for the original board is a transformerless one, based on capacitive attenuation:

These are generally very low cost and take very little space. They are also highly unreliable and borderline unsafe. Below is just a selection of failed capacitors I've picked up over the years, as they are the first component to go:


The added danger comes from the fact that even though the circuit benefits from a 5 Volt supply the actual lines carry live voltage. Someone as clumsy as me is bound to get shocked quite a few times.

To bring the voltage down to 5.1V a Zener diode is used, clamping extra/excess voltage through it. So, in order to get 3.3V from the setup a different zener must be used. The TL431 chip would not work here as it's limited to 37V instead of the 220V we need.


For ease of interfacing I chose to use the existing conections going from the existing microcontroller to the various inputs and outputs. The tyristhor driving the heater is itself driven from a transistor, so no danger of high voltages coming back to the uC.
Once all the breakout wires are soldered it's time to plug in and test the new chip.

Oops, see that cooking plate there? And the metallic "third hand"? And bare wires? Suffice to say, the original (still working) board didn't survive for long.

From that point on, for prototyping, I actually used a separate, protected power supply. AA batteries work just fine. However, time will come when this thing will have to go live again.

2 comments:

  1. I have found here much useful information for myself. Many thanks to the editors for the info.

    Compact coffee maker

    ReplyDelete
  2. Hey, thanks for this article, it helped me when I was gathering information to see if what I wanted to do was possible.

    I wrote a post about controlling the Senseo with Arduino/Android and bluetooth :
    http://blog.godhateusall.com/2015/04/senseo-coffee-machine-controlled-by-arduino-and-android-over-bluetooth/

    Hope it could help someone one day !

    ReplyDelete