DigitalSandbox PicoBoard
Reporting Temperature
Using the temperature scale on the Digital Sandbox is pretty simple - it does require a little math, though. Looking at the datasheet on the temperature sensor on this board TMP36 can be daunting, but what we care about is this:
"The TMP36 is specified from −40°C to +125°C, provides a 750 mV output at 25°C, and operates to 125°C from a single 2.7 V supply." and "Both the TMP35 and TMP36 have an output scale factor of 10 mV/°C."
Translation
The TMP36 outputs a voltage that varies linearly with the temperature. Because it is linear, we can start with our favorite equation from Algebra I -- the general equation for a line:
The proportionality (ratio) between voltage and temperature is 10 mV/°C, but we want our slope in units of °C/mV. So, if we take the reciprocal of 10 mV/°C, this is 0.1 °C/mV. It's the same proportion, and it has the correct units. That's our slope!
The intercept point requires a little math. Using the information that says "provides a 750 mV output at 25°C," we can find the intercept point.
Final Equation
In Scratch
In Scratch, the voltage is scaled from 0 to 100. So -- let's see how this works:
Looking at this, I see a lot of decimals, multiplication by 1000's and divide by 100s. It seems like we should be able to simplify this. First, let's simplify the divide by 100 and multiply by 5000.
Next, multiply the 0.1 by the 50 and simplify to:
And, in Scratch -- this looks like: