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");
```

## 7 Responses

4.5

If you Americans would convert to Celsius like the rest of us no one would need Fahrenheit!

Fahrenheit is stupid.

Agreed. Those dumb americans need to ditch that stone age stuff.

Best thing the USA could do is just switch to Celsius!

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!

0.5