-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcirc10.html
301 lines (290 loc) · 13.2 KB
/
circ10.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
<!doctype html>
<html class="no-js" lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>ardx:circ-10[.:wcrs:.]</title>
<meta name="description" content="Arduino Experimenters Kit Analog Temperature Sensor circuit">
<!-- #include «head.html» -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<!--[if IE]><link rel="shortcut icon" href="favicon.ico"><![endif]-->
<link rel="apple-touch-icon" href="apple-touch-icon.png">
<link rel="icon" href="favicon.png">
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/main.css">
<script src="js/vendor/modernizr-2.8.3.min.js"></script>
</head>
<body>
<!--[if lt IE 8]>
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]-->
<!-- #include «topnav.html» -->
<nav id="topnav">
<a id="logo" href="https://wcrsyyc.github.io/"><img
src="img/wcrs_logo.png" alt="logo"></a>
<h2><a href="index.html">WCRS</a></h2>
<ul>
<li><a href="https://github.com/WCRSyyc/ardx">about</a> |</li>
<li><a href="https://github.com/WCRSyyc/ardx/issues">contact</a> |</li>
<li><a href="https://github.com/WCRSyyc/ardx/wiki">wiki</a></li>
</ul>
<hr>
<p><!-- current message text --></p>
</nav>
<!-- #include «sidebar.html» -->
<nav id="sidebar">
<section id="menu">
<ul>
<li><h2>PRODUCTS</h2>
<ul>
<li><a href="https://github.com/WCRSyyc/ardx/"><h3>(WCRS)</h3>ARDX additions</a>
<ul>
<li><a href="preface.html">
<h4>ABOUT</h4>A Few Words</a></li>
<!-- <li><a href="assembling.html">
<h4>ASSMB</h4>Putting It Together</a></li> -->
<li><a href="starthere.html">
<h4>START</h4>Startup Links</a></li>
<li><a href="programming.html">
<h4>PROG</h4>Programming Primer</a></li>
<li><a href="electronics.html">
<h4>ELEC</h4>Electronics Primer</a></li>
<li><a href="fritzing.html">
<h4>FRITZING</h4>Fritzing with ARDX</a></li>
<li><a href="circ01.html">
<h4>CIRC-01</h4>Blinking LED</a></li>
<li><a href="circ02.html">
<h4>CIRC-02</h4>Multiple LEDs</a></li>
<li><a href="circ03.html">
<h4>CIRC-03</h4>Transistors & Motors</a></li>
<li><a href="circ04.html">
<h4>CIRC-04</h4>Servos</a></li>
<li><a href="circ05.html">
<h4>CIRC-05</h4>74HC595 Shift Registers</a></li>
<li><a href="circ06.html">
<h4>CIRC-06</h4>Piezo Speaker</a></li>
<li><a href="circ07.html">
<h4>CIRC-07</h4>Pushbuttons</a></li>
<li><a href="circ08.html">
<h4>CIRC-08</h4>Potentiometers</a></li>
<li><a href="circ09.html">
<h4>CIRC-09</h4>Photo-Resistors</a></li>
<li><a href="circ10.html">
<h4>CIRC-10</h4>Temperature</a></li>
<li><a href="circ11.html">
<h4>CIRC-11</h4>Relays</a></li>
<li><a href="circ12.html">
<h4>CIRC-12</h4>RGB LED blink</a></li>
<li><a href="circ15.html">
<h4>CIRC-15</h4>Dice Simulator</a></li>
</ul>
</li>
<li><a href="https://github.com/WCRSyyc/ardx/"><h3>(WCRS)</h3>Python ARDX</a>
<ul>
<!-- <li><a href="preface.html">
<h4>ABOUT</h4>A Few Words</a></li> -->
<!-- <li><a href="assembling.html">
<h4>ASSMB</h4>Putting It Together</a></li> -->
<!-- <li><a href="starthere.html">
<h4>START</h4>Startup Links</a></li> -->
<!-- <li><a href="programming.html">
<h4>PROG</h4>Programming Primer</a></li> -->
<li><a href="electronics.html">
<h4>ELEC</h4>Electronics Primer</a></li>
<li><a href="fritzing.html">
<h4>FRITZING</h4>Fritzing with ARDX</a></li>
<li><a href="ArdxPythonHowTo.html">
<h4>GUIDE</h4>Python Guide</a></li>
<!--
<li><a href="circ01p.html">
<h4>CIRC-01</h4>Blinking LED</a></li>
<li><a href="circ02p.html">
<h4>CIRC-02</h4>Multiple LEDs</a></li>
<li><a href="circ03p.html">
<h4>CIRC-03</h4>Transistors & Motors</a></li>
<li><a href="circ04p.html">
<h4>CIRC-04</h4>Servos</a></li>
<li><a href="circ05p.html">
<h4>CIRC-05</h4>74HC595 Shift Registers</a></li>
<li><a href="circ06p.html">
<h4>CIRC-06</h4>Piezo Speaker</a></li>
<li><a href="circ07p.html">
<h4>CIRC-07</h4>Pushbuttons</a></li>
<li><a href="circ08p.html">
<h4>CIRC-08</h4>Potentiometers</a></li>
<li><a href="circ09p.html">
<h4>CIRC-09</h4>Photo-Resistors</a></li>
<li><a href="circ10p.html">
<h4>CIRC-10</h4>Temperature</a></li>
<li><a href="circ11p.html">
<h4>CIRC-11</h4>Relays</a></li>
<li><a href="circ12p.html">
<h4>CIRC-12</h4>RGB LED blink</a></li>
<li><a href="circ15p.html">
<h4>CIRC-15</h4>Dice Simulator</a></li> -->
</ul>
</li>
<li><a href="http://www.oomlout.com/a/products/ardx/"><h3>(ARDX)</h3>arduino / netduino experimenter´s kit</a>
</li>
</ul>
</li>
</ul>
</section>
<section>
<h3><a rel="license" href="http://creativecommons.org/licenses/by/4.0/">
<img alt="Creative Commons License"
src="img/80x15.png"></a></h3>
This work is licensed under a <a rel="license"
href="http://creativecommons.org/licenses/by/4.0/">Creative Commons
Attribution 4.0 International License</a>.
</section>
</nav>
<main id="circ-10">
<header>
<h1>CIRC<br/>10</h1>
<h2>.:Temperature:.<br/>.:TMP36 Precision Temperature Sensor:.</h2>
<img src="img/experiments/circ/CIRC-10-square-100.jpg" width="100" height="100" alt="TMP36">
</header>
<h2>(ARDX) .:Arduino Experimentation Kit:. (ARDX)</h2>
<section>
<h2>What We´re Doing</h2>
<p>What´s the next phenomena we will measure with our Arduino? Temperature. To do this we'll use a rather complicated IC (integrated circuit) hidden in a package identical to our P2N2222AG transistors. It has three pin's, ground, signal and +5 volts, and is easy to use. It outputs 10 millivolts per degree centigrade on the signal pin (to allow measuring temperatures below freezing there is a 500 mV offset eg. 25 degrees C = 750 mV, 0 degrees C = 500mV). To convert this from the digital value to degrees, we will use some of the Arduino's math abilities. Then to display it we'll use one of the IDE's rather powerful features, the debug window. We'll output the value over a serial connection to display on the screen. Let's get to it.</p>
<p>One extra note, this circuit uses the Arduino IDE's serial monitor. To open this, first upload the program then click the button which looks like a square with an antennae.</p>
</section>
<section id="circuit">
<h2>The Circuit</h2>
<div id="CIRC-theparts">
<h3>The Parts</h3>
<table>
<tr>
<td><img src="img/parts/CIRC-10-3dsheet-60.png"
width="60" height="36" alt="circuit 10 breadboard sheet 3d view"/></td>
<td>CIRC-10<br/>Breadboard Sheet<br/>x1</td>
<td><img src="img/parts/HEAD-02-60.png"
width="60" height="36" alt="2 pin header"/></td>
<td>2 Pin Header<br/>x4</td>
<td><img src="img/parts/IC-TMP36-60.png"
width="60" height="36" alt="TMP36 temperature sensor"/></td>
<td>TMP36<br/>Temperature Sensor<br/>x1</td>
<td><img src="img/parts/WIRE-01-60.png"
width="60" height="36" alt="wire"/></td>
<td>Wire</td>
</tr>
</table>
</div>
<span class="bb-svg-container"><svg
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="5 12 60 60"
preserveAspectRatio="xMaxYMin meet">
<image height="100" width="100"
xlink:href="img/experiments/CIRC10-bb.svg"/>
</svg></span>
<div>
<h3>Schematic</h3>
<span class="sch-svg-container"><svg
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="66.5 35 28 28"
preserveAspectRatio="xMidYMin meet">
<image height="100" width="100"
xlink:href="img/experiments/CIRC10-sch.svg" />
</svg></span>
</div>
<div>
<h3>Resources</h3>
<h4>.:download:.</h4>
<p>Breadboard layout sheet<br/>
<a href="img/experiments/CIRC10-sheet-OOML.pdf">http://ardx.org/BBLS10</a>
</p>
<p>Fritzing diagram<br/><a href="fritzing/CIRC10.fzz">
https://wcrsyyc.github.io/ardx/fritzing/CIRC10.fzz</a></p>
<h4>.:view:.</h4>
<p>assembly video<br/>
<a href="https://www.youtube.com/watch?v=7T3Bp1qMyYs">http://ardx.org/VIDE10</a>
</p>
<p>TMP36 Datasheet<br/>
<a href="https://www.analog.com/media/en/technical-documentation/data-sheets/TMP35_36_37.pdf">http://ardx.org/TMP36</a>
</p>
</div>
</section>
<section id="code">
<h2>Code <span>(no need to type everything in just)</span></h2>
<p>Download the Code from ( <a
href="code/CIRC10-code.txt">http://ardx.org/CODE10</a> )<br/>
(and then copy the text and paste it into an empty Arduino Sketch)</p>
<pre>/* ---------------------------------------------------------
* | Arduino Experimentation Kit Example Code |
* | CIRC-10 .: Temperature :. (TMP36 Temperature Sensor) |
* ---------------------------------------------------------
*
* A simple program to output the current temperature to the IDE's debug window
*
* For more details on this circuit:
* https://learn.adafruit.com/tmp36-temperature-sensor/using-a-temp-sensor
*/
//TMP36 Pin Variables
int temperaturePin = 0; //the analog pin the TMP36's Vout (sense) pin is connected to
//the resolution is 10 mV / degree centigrade
//(500 mV offset) to make negative temperatures an option
/*
* setup() - this function runs once when you turn your Arduino on
* We initialize the serial connection with the computer
*/
void setup()
{
Serial.begin(9600); //Start the serial connection with the copmuter
//to view the result open the serial monitor
//last button beneath the file bar (looks like a box with an antenae)
}
void loop() // run over and over again
{
float temperature = getVoltage(temperaturePin); //getting the voltage reading from the temperature sensor
temperature = (temperature - .5) * 100; //converting from 10 mv per degree with 500 mV offset
//to degrees ((voltage - 500mV) times 100)
Serial.println(temperature); //printing the result
delay(1000); //waiting a second
}
/*
* getVoltage() - returns the voltage on the analog input defined by pin
*/
float getVoltage(int pin){
return (analogRead(pin) * .004882814); //converting from a 0 to 1023 digital range
// to 0 to 5 volts (each 1 reading equals ~ 5 millivolts)
}</pre>
</section>
<section id="CIRC-notworking">
<h2>Not Working? <span>3 things to try</span></h2>
<div>
<h3>Nothing Seems to Happen</h3>
<p>This program has no outward indication it is working. To see the results you must open the Arduino IDE's serial monitor.<br/>
(instructions on previous page)</p>
</div>
<div>
<h3>Gibberish is Displayed</h3>
<p>This happens because the serial monitor is receiving data at a different speed than expected. To fix this, click the pull-down box that reads "*** baud" and change it to "9600 baud".</p>
</div>
<div>
<h3>Temperature Value is Unchanging</h3>
<p>Try pinching the sensor with your fingers to heat it up or pressing a bag of ice against it to cool it down.</p>
</div>
</section>
<section id="CIRC-makingBetter">
<h2>Making it Better?</h2>
<h3>Outputting voltage:</h3>
<p>This is a simple matter of changing one line. Our sensor outputs 10mv per degree centigrade so to get voltage we simply display the result of <code>getVoltage()</code>.</p>
<p>delete the line <code>temperature = (temperature - .5) * 100;</code></p>
<h3>Outputting degrees Fahrenheit:</h3>
<p>Again this is a simple change requiring only math. To go from degrees C ----> degrees F we use the formula <code>( F = C * 1.8) + 32 )</code>. Add the line</p><pre> temperature = (((temperature - .5) * 100)*1.8) + 32;</pre>
<p>before <code>Serial.println(temperature);</code></p>
<h3>More informative output:</h3>
<p>Lets add a message to the serial output to make what is appearing in the Serial Monitor more informative. To do this first revert to the original code then change:<br/> <code>Serial.println(temperature);</code> ----><pre><code> Serial.print(temperature);</code>
Serial.println(" degrees centigrade");</pre>
<p>The change to the first line means when we next output it will appear on the same line, then we add the informative text and a new line.</p>
<h3>Changing the serial speed:</h3>
<p>If you ever wish to output a lot of data over the serial line, time is of the essence. We are currently transmitting at 9600 baud but much faster speeds are possible. To change this, change the line:<br/> <code>Serial.begin(9600);</code> ----> <code>Serial.begin(115200);</code><br/>Upload the sketch, turn on the serial monitor, then change the speed from 9600 baud to 115200 baud in the pull down menu. You are now transmitting data 12 times faster.</p>
</section>
</main>
<footer>.:Welcome to the Bottom:.</footer>
</body>
</html>