Bottle Temperature Feedback

Made by jvanderv

Found in DIoT 2018 1- Home Hack

I want to create a sensor system for my wife that tells her when the bottle of formula or breastmilk is at the right temperature. We have a bottle warmer, but depending on the volume and what temperature the bottle started at it is hard to know when it will be at the right temperature. I hope to make a sensor that inserts into the bottle and sends a text and indicates through an LED when it is at the right temperature.

0

Problem Statment

The temperature of breastmilk or formula is a touchy and complicated subject. Babies are used to the milk being at roughly the temperature of their Mom (98.6 degrees Fahrenheit). Some need it to be exact, others will take it at room temperature or up to 100 degrees F. Most bottle warming solutions use boiling water to heat the contents of the bottle by the user turning a timer knob and waiting. The problem is; some formula will start at room temperature, some milk is refrigerated or frozen, and the volume of milk can change each time. This becomes a guessing game for the caretaker and can lead to taking the bottle out of the warmer many times to test it on their wrist or hand. This process is frustrating and time-consuming.

0

Goal

My goal is to create a sensor and output device that allows temperature information of a bottle that is being warmed to be understood at a glance. Ideally, the user puts the bottle in the warmer with the sensor in the liquid and waits until the light turns green. Once it is green, they know the temperature is within a safe and acceptable range for the baby. This saves time and effort and allows them to tend to the baby or do other activities while the bottle warms.

0

Process

I started the process by researching some similar devices online and identifying some components that I would like to use. I found the sealed DS18B20 sensor in the maker kit and started building around that.

I used Daragh's tutorial on the DS18B20 as my starting point. This involved creating a circuit on the breadboard, as well as downloading some libraries for the code to pull from and writing some preliminary code. By the end of this step, I had my sensor working and was able to see the temperature in Fahrenheit and Celsius register as cloud variables.

Next, I added the RGB LED to my breadboard and added the appropriate resistors and jumpers. It took me quite a long time to get it working and wrote some code to test it, instructing it to constantly power on with a white light. I couldn't get it to work and after many attempts, I accidentally switched leads and the LED lit up red. I realized that I might have the wrong type of LED and swapped it out. Finally, I had success. I then copied the code from Daragh's workshop and ran the light through the different colors to make sure it worked.

I then, with the help of my classmate Mark Davidson, wrote some if and if else statements to set the LED to Blue for temperatures less than 95 F (too cold), Green for 95 to 105 F (just right), and red for over 105 F (too hot). Finally, I added a switch and some code to make it light yellow when pressed and print the temperature to the serial log. This was added in case the perfect temperature was found and the user wanted to check it.

0

Outcome

The project was successful overall. The breadboard is wired up successfully and the temperature sensor works and writes the correct colors. The pushbutton works as intended, printing the temperature and lighting the LED yellow when pushed. When turned on, the light glows blue and continues to do so until the temperature sensor reaches 95 degrees Fahrenheit. The LED turns green at this stage and will stay that way while within the 95-105 F range. If the temperature range is exceeded, the light turns red. This product creates an easy, at-a-glance solution for caretakers of babies that want to heat the bottle and don't want to check on it constantly.

0
// This #include statement was automatically added by the Spark IDE.
#include "OneWire.h"

// This #include statement was automatically added by the Spark IDE.
#include "spark-dallas-temperature.h"

#include <math.h>

int redPin = D1;    // RED pin of the LED to PWM pin **A0**
int greenPin = D2;  // GREEN pin of the LED to PWM pin **D0**
int bluePin = D3;   // BLUE pin of the LED to PWM pin **D1**
int redValue = 255; // Full brightness for an ANODE RGB LED is 0, and off 255
int greenValue = 255; // Full brightness for an ANODE RGB LED is 0, and off 255
int blueValue = 255; // Full brightness for an ANODE RGB LED is 0, and off 255</td>

int buttonPin = D4;
// -----------------
// Read temperature
// -----------------

// Data wire is plugged into port 0 on the Arduino
// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(D0 );

// Pass our oneWire reference to Dallas Temperature.
DallasTemperature dallas(&oneWire);

// Create a variable that will store the temperature value
double temperature = 0.0;
double temperatureF = 0.0;

void setup()
{
  // Register a Particle variable here
  Particle.variable("temperature", &temperature, DOUBLE);
  Particle.variable("temperatureF", &temperatureF, DOUBLE);

  // setup the library
  dallas.begin();

  // Set up our RGB LED pins for output
pinMode( redPin, OUTPUT);
pinMode( greenPin, OUTPUT);
pinMode( bluePin, OUTPUT);

pinMode(buttonPin, INPUT_PULLUP);


  Serial.begin( 9600 );
  Serial.println( "My program is starting up ");


}
void setRGBColor( int r, int g, int b ){
  redValue = r;
  greenValue = g;
  blueValue = b;
  analogWrite(redPin, 255 - redValue);
  analogWrite(greenPin, 255 - greenValue);
  analogWrite(bluePin, 255 - blueValue);
}

void loop()
{
  int buttonState = digitalRead(buttonPin);
  if(buttonState == LOW ){
  setRGBColor(255,255,0);
  }

  delay(2000);

  dallas.requestTemperatures();

  // get the temperature in Celcius
  float tempC = dallas.getTempCByIndex(0);
  // convert to double
  temperature = (double)tempC;

  // convert to Fahrenheit
  float tempF = DallasTemperature::toFahrenheit( tempC );
  // convert to double
  temperatureF = (double)tempF;
   if( digitalRead( buttonPin ) == LOW ){ Serial.println( temperatureF );
   }
   if( digitalRead( buttonPin )== LOW){ Particle.publish( String ( temperatureF ));
     delay(500);
   }

  // Serial.print("The temperature in F is:");
  // Serial.println( temperatureF );

  if(temperatureF < 95.0){
    setRGBColor(0,0,255);
  }else if(temperatureF >= 75.0 && temperatureF <= 105.0){
    setRGBColor(0,255,0);
  }else{
    setRGBColor(255,0,0);
  }




  delay(500);

}
Click to Expand
0

Bill of Materials:

  • Photon Particle
  • Breadboard
  • (12) jumper wires
  • (3) 220 Ohm resistors
  • (1) 1k Ohm resistor
  • (1) RGB LED
  • (1) S1 pushbutton switch
  • (1) DS18B20 sealed temperature sensor
  • (1) Ping Pong ball
0
babybottlevid
John Vanderveen - https://youtu.be/XlIqCQEUd5k
0

Reflection

If I were to refine this project I would first try to see if I can eliminate anything from the breadboard, or at least clean it up. I would then look at the code and do the same. I am not sure my pushbutton yellow light/printing temperature is elegant, so I would like to revisit that. Finally, I would look into an automatic start for the warmer and a text notification implementation in the code. Ideally, all of this would be built into a warmer itself, rather than an external system.

I am very happy with the solution overall, however, and am proud that I was able to create this. I would like to build on this project in my further projects and add to it.

x
Share this Project

Courses

49713 Designing for the Internet of Things

· 25 members

A hands-on introductory course exploring the Internet of Things and connected product experiences.


About

I want to create a sensor system for my wife that tells her when the bottle of formula or breastmilk is at the right temperature. We have a bottle warmer, but depending on the volume and what temperature the bottle started at it is hard to know when it will be at the right temperature. I hope to make a sensor that inserts into the bottle and sends a text and indicates through an LED when it is at the right temperature.

Created

January 24th, 2018