Yogurt making machine powered by Arduino

DIY

Everyone knows that yogurt is a very better-for-you product, plus it’s delicious. There is a short story under the cut about how I decided to create a yogurt maker, some pictures and a sketch.

Wandering in the vast expanses of the Internet I came across such an interesting thing as a yogurt maker. My wife likes yogurt and fairly often buys it. Having read the specialized website, I was inspired. I was inspired by the very thought of easily making yogurt at home, plus it will be more health-giving than the store-brought one. Having read a few reviews and comparisons, my wife and I decided to buy “Moulinex YG230 YOGURTEO”. But oops, we couldn’t find where to buy it in our town. We were just going to place an order when it dawned upon me. What is a yogurt maker? Roughly speaking, it’s a device for keeping some definite temperature during some definite time. If it is that simple, why not make it myself? Of course! There is an arduino being on the shelf for half a year already. Guilty as charged, please forgive me, guru of microcontrollers, but I am far from it. I had neither necessity nor time to study microcontrollers programming, so I bought an arduino, just for the fun of it, twinkled a LED, put it on the shelf and forgot about it. And now I have a chance to explain to my wife “why I buy all this trash if it’s on the shelf anyway”.

Apart from the arduino I also needed a thermal sensor DS18B20 and a solid state relay. I think there’s no use in describing how to unite all of them – it has been discussed more than once on habrhabr.ru and other field-oriented websites. I will provide just the sketch:


#include <OneWire.h>

OneWire ds(10);
byte addr[8];
int active = true, ssrPin = 4, ledPin = 5;
float millisecondsPerGradus, currentTemperature, cookingTemperature = 36.0;
unsigned long totalWorkTime = 28800000; // 8 * 60 * 60 * 1000

void setup(void) {
  Serial.begin(9600);
  pinMode(ssrPin,OUTPUT);
  pinMode(ledPin,OUTPUT);
  while (true) {
    if (!ds.search(addr)) ds.reset_search();
    else break;
    delay(250);
  }
  //preheating
  digitalWrite(ssrPin, HIGH);
  delay(10000);
  digitalWrite(ssrPin, LOW);
  delay(1000);
  // measurement for how many milliseconds the water temperature changes by one degree
  thermometer();
  float startTemperature = currentTemperature;
  digitalWrite(ssrPin, HIGH);
  delay(30000);
  digitalWrite(ssrPin, LOW);
  delay(1000);
  thermometer();
  millisecondsPerGradus = 1000.0 / ((currentTemperature - startTemperature) / 30.0);
}

float thermometer(void) {
  byte data[9];
  while (true) {
    ds.reset();
    ds.select(addr);
    ds.write(0x44,1);
    delay(1000);
    ds.reset();
    ds.select(addr);
    ds.write(0xBE);
    for (byte i = 0; i < 9; i++) data[i] = ds.read();
    currentTemperature = (float)((data[1] << 8) | data[0]) / 16.0;
    if (currentTemperature != 85.00) break;
  }
  //Serial.println(currentTemperature);
}

void loop(void) {
  if (!active) {
    delay(5000);
    return;
  }
  if (millis() > totalWorkTime) {
    // finish with the heating and notify the LED
    digitalWrite(ledPin, HIGH);
    active = false;
    return;
  }
  thermometer();
  unsigned long delayTime;
  if (currentTemperature >= cookingTemperature) {
    delay(1000);
    return;
  }
  else if (currentTemperature > cookingTemperature - 2.0){
    //if the temperature is close to necessary, slow down the process of heating
    delayTime = millisecondsPerGradus * ((cookingTemperature - currentTemperature)/3.0);
  }
  else {
    //otherwise heat it by one degree
    delayTime = millisecondsPerGradus;
  }
  digitalWrite(ssrPin, HIGH);
  delay(delayTime);
  digitalWrite(ssrPin, LOW);
  delay(1000);
}

Temperature and time were sorted out experimentally, many yogurt jars were damaged. Eventually I decided that it should be made during eight hours (left it overnight) at the temperature of 96.8 F. It is mentioned everywhere that the temperature should be 100.4-104 F. But at such temperature after eight hours yogurt went sour (flaked), and after five hours (before flaking), as it seemed to me, yogurt didn’t brew and was thick but not really delicious. By the way, I was pleasantly surprised by the accuracy of DS18B20. I compared it with a mercury thermometer – just 0.52-0.78 F.

When its ready, LED notifies you (but it’s an arduino, it has to twinkle a LED in any project of any difficulty).

Now with photos:

A Relay with a heater for the weak boiler is a thing! Relay doesn’t get warm, but in order not to lose the heater – I placed relay with it.

A boiler, a thermal sensor and a “mixer” to keep water at the same temperature in any part of the jar. Of course, the shop front would never compare with “Moulinex YG230 YOGURTEO” but it’s a hand-made with improvised means, using whatever was available.

I buy milk with a high fat content (if you use milk with a low fat content, yogurt will be a bit fluid. You can buy ferment at the drugstore, but I prefer yogurts with bifidus bacteria like “Activia”, two tea spoons are enough for this jar.

Ready-made yogurt. Even the spoon stands! Well, almost stands.

Serving variant. Yogurt making machine powered by Arduino

Wishing you all the best!

P.S.: Surprise your girlfriend, give her a home-made yogurt for breakfast. They say, the best present is a hand-made one. Yogurt isn’t enough for a present of course, but your girlfriend will appreciate your care and kindness.

Comments

874

Ropes — Fast Strings

Most of us work with strings one way or another. There’s no way to avoid them — when writing code, you’re doomed to concatinate strings every day, split them into parts and access certain characters by index. We are used to the fact that strings are fixed-length arrays of characters, which leads to certain limitations when working with them. For instance, we cannot quickly concatenate two strings. To do this, we will at first need to allocate the required amount of memory, and then copy there the data from the concatenated strings.