Lesson goal: Read the temperature of and plot it in real time

Previous: Real time temperature plot | Home | Next: Real time light-level plot

As seen in the last lesson, you saw how to read voltages in from the Arduino from the LM35DZ, convert them to $^\circ$C and $^\circ$F, then plot them. Let's do the same here, but with a nicer looking plot. Let's also see how to make the x-axis into a real time (like seconds).

As you run this lesson, try to change the temperature (with ice, your warm breath, a match, pinch in your fingers, etc.) and watch the plot go up and down in response.

Move the mouse over a dotted box for more information.

Now you try. Go for it! Fix the analogread argument, and be sure that tempF gets computed as the temperature in $^\circ F$. Fix the graph_point line to plot time vs. temperature.

Type your code here:

See your results here:

See this lesson for the circuit needed. Note how we'll take 100 samples, and get the current number of seconds into variable t (t for "time"). After you complete the code, you'll have the temperature in $^\circ$F and $^\circ$C available. Fix the graph_point line to plot t (on the x-axis) vs. temperature, tempC or tempF (on the y-axis). Dismiss.
Show a friend, family member, or teacher what you've done!

Here is a share link to your code:

Does your code work? Want to run it on your iPhone?

Here's your code:

  1. Use [Control]-[C] (Windows) or [⌘]-[C] (MacOS) to copy your code.

  2. Paste it using [Control]-[V] (Windows) or [⌘]-[V] (MacOS) into this page

  3. Then click the "Use on iPhone" button that you'll see.