Last week (on a post that proved that even an evil genius can sometimes mess up simple math and set a post to fire 4 days early) was the introduction, today is some new findings.


If you follow the directions and treat this like an "Arduino Pro or Pro Mini (3.3 v, 8 MHz) w/ATMega 328", the Arduino compiler will tell you that there is a 30,780 byte maximum.  In my experience, the maximum is around 26,000 bytes.  Wyolum knew about this, and this is why they included a micro-SD card slot and card.  At one point, I tried creating a program that would tell the temperature and lines from the Zero Wing intro ("All Your Base Are Belong To Us!").  It didn't go well.

Temperature Sensing

The temperature sensor is very simple to use.  Recall in the last post, the sensor itself is populated, but a 0.1 uF capacitor (C8) is not.  The sensor might work without the capacitor, but it likely works better with it (at least I hope so, I populated the cap without testing and I have zero interest in removing it).

To read the analog pin and get it to a voltage, the following code works for me:

int ar=analogRead(7);
float vref=3.3;
float temp=ar*vref/1024.0;

Even though the Pro and Mini do not have 7 analog pins, the Arduino IDE and compiler not only do not complain about not having the pin, they compile it correctly without modifying any of the libraries (Good on ya, Arduino!).

Looking at the data sheet, there is a simple equation for the temperature:



V_{out} is the output voltage

T_{C} is the temperature coefficient

T_{A} is the Ambient Temperature

V_{0} is the voltage at 0°C

Per the documentation, I used V_{0}=0.5v and T_{C}=0.01V/C.  Using algebra (who says you'll never need it?), I used:


Which would give me the temperature in Centigrade, and after that,


In Arduino, that wen't like this:

// C to F

And it seemed to work correctly.  I was getting temperature readings of around 74 in my office, and it seems like that is correct.  The final code is below.

...and of course, I can't show all this code without the finished product:

It's a warm 75 in here today... and it does feel kinda warm in my office.

It's a warm 75 in here today... and it does feel kinda warm in my office.

By the time this post fires, I will have just returned from a transportation conference.  I hoped initially that I'd have more with this post, but it'll have to wait for next week's post.


Category: Arduino

About the Author

Andrew is the owner of this blog and enjoys computer programming, building things, and photography. He's a pretty busy guy, which explains why updates to this blog are so infrequent.

Comments are closed.

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

%d bloggers like this:

This is the new server