Tag Archives: bager

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.

Memory

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}=T_{C}*T_{A}+V_{0}$$

Where:

$$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:

$$T_{A}=\frac{V_{out}-V_{0}}{T_{C}}$$

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

$$T_{F}=\frac{9*T_{C}}{5}+32$$

In Arduino, that wen’t like this:

temp=temp-0.5;
temp=temp/0.01;
// C to F
temp=(9*temp)/5+32;

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.

-73-


Category: Arduino

This is the new server