fbpx

Most orders for IN STOCK items placed by 12PM CST M-F ship SAME DAY. Orders for custom items and prints may take additional time to process.

Arduino Celsius to Fahrenheit Conversion

In this tutorial we learn how to do do an Arduino Celsius to Fahrenheit conversion (and Fahrenheit to Celsius too!).  It’s a pretty simple operation and one that is asked quite often in the forums.

Understanding the Difference Between Celsius and Fahrenheit

So before we learn how to do an Arduino Celsius to Fahrenheit conversion, it is important to understand the difference between the two and what they both generally represent.

Celsius and Fahrenheit are both scales used to measure and communicate temperature. While they are both quite common, they are not the only ones.  There is also the Kelvin scale for example.

Fahrenheit

The Fahrenheit scale was created in 1724 by Dutch–German–Polish physicist Daniel Gabriel Daniel Gabriel Fahrenheit. Its units are  represented by the °F symbol.  The Fahrenheit scale represents the freezing point of water at 32° F for example, while the boiling point of water would be represented by 212° F. The temperature of the human body would be ~98.6° F. The United States of America is basically the last holdout country to use this temperature scale.

Celsius

The Celsius scale, also sometimes called the Centigrade scale was created in 1742 by Swedish astronomer Anders Celsius. It’s units are represented by the °C symbol. While it works very similar the previously discussed scale, its also very different.  The Celsius scale represents the freezing point of water at 0° C, while the boiling point is represented at 100° C.   This places the human body temperature at roughly 37° C.  Most all countries around the world have moved to the Celsius scale as their official measurement and communications method of temperature.

Arduino Celsius to Fahrenheit Conversion

Now let’s move on to converting Celsius to Fahrenheit and vice-versa. It’s not that hard to do now that we know the basic differences between the two temperature scales.

Celsius to Fahrenheit Formula

To convert Celsius to Fahrenheit you multiply C by 1.8 and then subtract 32. The formula on paper for converting Celsius to Fahrenheit looks like this:

(TempCelsius X 1.8) + 32

So let’s take this and convert 0° Celsius to Fahrenheit and see what we get. The formula would look like the following: (0 X 1.8)+32.  The answer of course is 32.  If we wanted to convert 37° Celsius to Fahrenheit we would do: (37 X 1.8)+32.  Resulting in a the answer 98.6° F!

RELATED: Using DHT11 Temperature Sensors on the Arduino

The Arduino Celsius to Fahrenheit code for your sketch would look like this:

float TempF = 0;
TempF = (TempC*1.8)+32;
Serial.print(TempC);
Serial.println("° C");

Fahrenheit to Celsius Formula

Now that we’ve figured out the Arduino Celsius to Fahrenheit conversion, let’s reverse the process and convert Fahrenheit to Celsius! To convert temperatures in Fahrenheit to Celsius, subtract 32 and multiply by .5556 (or 5/9 in fraction format). The formula on paper looks like this:

(TempFahrenheit-32) X .5556

Let’s do the reverse of our earlier conversions.  Let’s convert 32° F to Celsius.  The formula would be (32-32)X .5556.  This of course equals 0° C!  Perfect.  For the human body temperature of 98.6° F, the formula would be: (98.6-32)X .5556. Of course, this is 37° C!  It works!

To do this in your Arduino Sketch, it would look like this:

float TempF = 98.6;
float TempC = 0;
TempC = (TempF-32)*.5556;
Serial.print(TempF);
Serial.println("° F");




Upgrade to Premium

If you like our content maybe consider upgrading to Premium. You’ll get access to

  • Free access to all plans
  • Member only videos
  • Early access to content
  • Ad free Experience
  • Discounts on store merch
  • Direct hotline contact form

7 Responses

  1. Looks like an error, in the paragraph headed:

    Celsius to Fahrenheit Conversion
    To convert Celsius to Fahrenheit you multiply C by 1.8 “and then subtract 32.”

    this should be “and then add 32.”

    The actual code you have provided is correct.

    This is one of the first Google hits for this question, so it might as well be ~perfect~. Thanks!

Leave a Reply