<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>TempSensor &amp;mdash; Paul Sutton</title>
    <link>https://personaljournal.ca/paulsutton/tag:TempSensor</link>
    <description>Personal Blog</description>
    <pubDate>Tue, 05 May 2026 14:56:37 +0000</pubDate>
    <item>
      <title>Code Club Electronics 12</title>
      <link>https://personaljournal.ca/paulsutton/code-club-electronics-12</link>
      <description>&lt;![CDATA[Code Club Electronics 12&#xA;&#xA;So the next project is to try and link the potentiometer value to a buzzer tone.  &#xA;&#xA;So, using some tutorial code for the buzzer here.  I have tried to modify to change the tone of the buzzer depending on the value from the potentiometer.&#xA;&#xA;// the setup function runs once when you press reset or power the board&#xA;&#xA;float floatMap(float x, float inmin, float inmax, float outmin, float outmax) {&#xA;  return (x - inmin) * (outmax - outmin) / (inmax - inmin) + outmin;&#xA;}&#xA;const int buzzer = 5;&#xA;&#xA;void setup() {&#xA;  // initialize digital pin LED_BUILTIN as an output.&#xA;  pinMode(buzzer, OUTPUT);&#xA;}&#xA;&#xA;// the loop function runs over and over again forever&#xA;void loop() {&#xA;  // read the input on analog pin A0:&#xA;  int analogValue = analogRead(A0);&#xA;  // Rescale to potentiometer&#39;s voltage (from 0V to 5V):&#xA;  float voltage = floatMap(analogValue, 0, 1023, 0, 5);&#xA;  tone(buzzer, 1000);   // 1khz tone to buzzer&#xA;  delay(analogValue);                       // wait for time period linked to pot input value&#xA;  tone(buzzer, 1000);    // 1khz tone to buzzer&#xA;&#xA;  //https://www.instructables.com/How-to-use-a-Buzzer-Arduino-Tutorial/&#xA;}&#xA;What I have now is a little buggy,   If I bind the actual pot value between 0 and 1023,  anything below 20hz is inaudible, so that the frequency is within the human hearing range (20hz - 20khz)&#xA;&#xA;Not quite sure what is going to work, sharing this as work in progress. &#xA;&#xA;Links&#xA;&#xA;Easy module shield&#xA;&#xA;Tags&#xA;&#xA;#Electronics,#Code,#Arduino,#Hacking.#TempSensor&#xA;&#xA;hr&#xD;&#xA;&#xD;&#xA;table&#xD;&#xA;thead&#xD;&#xA;trtda rel=&#34;me&#34; href=&#34;https://qoto.org/@zleap&#34;Mastodon/a/td&#xD;&#xA;tda href=&#34;https://wiki.ircnow.org/?n=Shelllabs.Intro&#34;ShellLabs/td&#xD;&#xA;tda href=&#34;https://joinmastodon.org/&#34;Join Mastodon/a/td/tr/thead/table&#xD;&#xA;center&#xD;&#xA;AI statement : b Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity.  Consent CANNOT be assumed, it has to be granted. /b&#xD;&#xA;/center&#xD;&#xA;&#xD;&#xA;a href=&#34;https://liberapay.com/PaulSutton/donate&#34;img alt=&#34;Donate using Liberapay&#34; src=&#34;https://liberapay.com/assets/widgets/donate.svg&#34;/a&#xD;&#xA;]]&gt;</description>
      <content:encoded><![CDATA[<p>Code Club Electronics 12</p>

<p>So the next project is to try and link the potentiometer value to a buzzer tone.</p>

<p>So, using some tutorial code for the buzzer <a href="https://www.instructables.com/How-to-use-a-Buzzer-Arduino-Tutorial/" rel="nofollow">here</a>.  I have tried to modify to change the tone of the buzzer depending on the value from the potentiometer.</p>

<pre><code>// the setup function runs once when you press reset or power the board

float floatMap(float x, float in_min, float in_max, float out_min, float out_max) {
  return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
const int buzzer = 5;


void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(buzzer, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  // read the input on analog pin A0:
  int analogValue = analogRead(A0);
  // Rescale to potentiometer&#39;s voltage (from 0V to 5V):
  float voltage = floatMap(analogValue, 0, 1023, 0, 5);
  tone(buzzer, 1000);   // 1khz tone to buzzer
  delay(analogValue);                       // wait for time period linked to pot input value
  tone(buzzer, 1000);    // 1khz tone to buzzer

  //https://www.instructables.com/How-to-use-a-Buzzer-Arduino-Tutorial/
}
</code></pre>

<p>What I have now is a little buggy,   If I bind the actual pot value between 0 and 1023,  anything below 20hz is inaudible, so that the frequency is within the human hearing range (20hz – 20khz)</p>

<p>Not quite sure what is going to work, sharing this as work in progress.</p>

<p><strong>Links</strong></p>
<ul><li><a href="http://www.getmicros.net/a-look-at-the-easy-module-shield-for-arduino.php" rel="nofollow">Easy module shield</a></li></ul>

<p><strong>Tags</strong></p>

<p><a href="/paulsutton/tag:Electronics" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Electronics</span></a>,<a href="/paulsutton/tag:Code" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Code</span></a>,<a href="/paulsutton/tag:Arduino" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Arduino</span></a>,<a href="/paulsutton/tag:Hacking" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Hacking</span></a>.<a href="/paulsutton/tag:TempSensor" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">TempSensor</span></a></p>

<hr>

<p><table>
<thead>
<tr><td><a href="https://qoto.org/@zleap" rel="nofollow">Mastodon</a></td>
<td><a href="https://wiki.ircnow.org/?n=Shelllabs.Intro" rel="nofollow">ShellLabs</td>
<td><a href="https://joinmastodon.org/" rel="nofollow">Join Mastodon</a></td></tr></thead></table>

AI statement : <b> Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity.  Consent CANNOT be assumed, it has to be granted. </b>
</p>

<p><a href="https://liberapay.com/PaulSutton/donate" rel="nofollow"><img alt="Donate using Liberapay" src="https://liberapay.com/assets/widgets/donate.svg"></a></p>
]]></content:encoded>
      <guid>https://personaljournal.ca/paulsutton/code-club-electronics-12</guid>
      <pubDate>Mon, 18 Dec 2023 15:46:32 +0000</pubDate>
    </item>
    <item>
      <title>Code Club Electronics 11</title>
      <link>https://personaljournal.ca/paulsutton/code-club-electronics-11</link>
      <description>&lt;![CDATA[Code Club Electronics 11&#xA;&#xA;I am now combining a LED blink routine, with reading the potentiometer value input. &#xA;&#xA;// the setup function runs once when you press reset or power the board&#xA;&#xA;float floatMap(float x, float inmin, float inmax, float outmin, float outmax) {&#xA;  return (x - inmin) * (outmax - outmin) / (inmax - inmin) + outmin;&#xA;}&#xA;&#xA;void setup() {&#xA;  // initialize digital pin LEDBUILTIN as an output.&#xA;  pinMode(LEDBUILTIN, OUTPUT);&#xA;}&#xA;&#xA;  &#xA;&#xA;// the loop function runs over and over again forever&#xA;void loop() {&#xA;  // read the input on analog pin A0:&#xA;  int analogValue = analogRead(A0);&#xA;  // Rescale to potentiometer&#39;s voltage (from 0V to 5V):&#xA;  float voltage = floatMap(analogValue, 0, 1023, 0, 5);&#xA;  digitalWrite(LEDBUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)&#xA;  delay(analogValue);                       // wait for a second&#xA;  digitalWrite(LEDBUILTIN, LOW);    // turn the LED off by making the voltage LOW&#xA;  delay(analogValue);                       // wait for a second&#xA;}&#xA;&#xA;Video&#xA;&#xA;iframe title=&#34;Arduino analogue 2 led&#34; width=&#34;560&#34; height=&#34;315&#34; src=&#34;https://diode.zone/videos/embed/003dbe2c-3710-41d9-a5e8-1dd8365999d4&#34; frameborder=&#34;0&#34; allowfullscreen=&#34;&#34; sandbox=&#34;allow-same-origin allow-scripts allow-popups&#34;/iframe&#xA;&#xA;Video illustrates how rotation of the potentiometer is reflected in the LED blink delay. &#xA;&#xA;Links&#xA;&#xA;Easy module shield&#xA;&#xA;Tags&#xA;&#xA;#Electronics,#Code,#Arduino,#Hacking.#TempSensor&#xA;&#xA;hr&#xD;&#xA;&#xD;&#xA;table&#xD;&#xA;thead&#xD;&#xA;trtda rel=&#34;me&#34; href=&#34;https://qoto.org/@zleap&#34;Mastodon/a/td&#xD;&#xA;tda href=&#34;https://wiki.ircnow.org/?n=Shelllabs.Intro&#34;ShellLabs/td&#xD;&#xA;tda href=&#34;https://joinmastodon.org/&#34;Join Mastodon/a/td/tr/thead/table&#xD;&#xA;center&#xD;&#xA;AI statement : b Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity.  Consent CANNOT be assumed, it has to be granted. /b&#xD;&#xA;/center&#xD;&#xA;&#xD;&#xA;a href=&#34;https://liberapay.com/PaulSutton/donate&#34;img alt=&#34;Donate using Liberapay&#34; src=&#34;https://liberapay.com/assets/widgets/donate.svg&#34;/a&#xD;&#xA;]]&gt;</description>
      <content:encoded><![CDATA[<p>Code Club Electronics 11</p>

<p>I am now combining a LED blink routine, with reading the potentiometer value input.</p>

<pre><code>// the setup function runs once when you press reset or power the board

float floatMap(float x, float in_min, float in_max, float out_min, float out_max) {
  return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}


void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
}


  

// the loop function runs over and over again forever
void loop() {
  // read the input on analog pin A0:
  int analogValue = analogRead(A0);
  // Rescale to potentiometer&#39;s voltage (from 0V to 5V):
  float voltage = floatMap(analogValue, 0, 1023, 0, 5);
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(analogValue);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  delay(analogValue);                       // wait for a second
}
</code></pre>

<p><strong>Video</strong></p>

<iframe title="Arduino analogue 2 led" width="560" height="315" src="https://diode.zone/videos/embed/003dbe2c-3710-41d9-a5e8-1dd8365999d4" frameborder="0" allowfullscreen=""></iframe>

<p>Video illustrates how rotation of the potentiometer is reflected in the LED blink delay.</p>

<p><strong>Links</strong></p>
<ul><li><a href="http://www.getmicros.net/a-look-at-the-easy-module-shield-for-arduino.php" rel="nofollow">Easy module shield</a></li></ul>

<p><strong>Tags</strong></p>

<p><a href="/paulsutton/tag:Electronics" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Electronics</span></a>,<a href="/paulsutton/tag:Code" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Code</span></a>,<a href="/paulsutton/tag:Arduino" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Arduino</span></a>,<a href="/paulsutton/tag:Hacking" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Hacking</span></a>.<a href="/paulsutton/tag:TempSensor" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">TempSensor</span></a></p>

<hr>

<p><table>
<thead>
<tr><td><a href="https://qoto.org/@zleap" rel="nofollow">Mastodon</a></td>
<td><a href="https://wiki.ircnow.org/?n=Shelllabs.Intro" rel="nofollow">ShellLabs</td>
<td><a href="https://joinmastodon.org/" rel="nofollow">Join Mastodon</a></td></tr></thead></table>

AI statement : <b> Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity.  Consent CANNOT be assumed, it has to be granted. </b>
</p>

<p><a href="https://liberapay.com/PaulSutton/donate" rel="nofollow"><img alt="Donate using Liberapay" src="https://liberapay.com/assets/widgets/donate.svg"></a></p>
]]></content:encoded>
      <guid>https://personaljournal.ca/paulsutton/code-club-electronics-11</guid>
      <pubDate>Sun, 17 Dec 2023 16:31:17 +0000</pubDate>
    </item>
    <item>
      <title>Code Club Electronics 10</title>
      <link>https://personaljournal.ca/paulsutton/code-club-electronics-10</link>
      <description>&lt;![CDATA[Code Club Electronics 10&#xA;&#xA;So following on from the previous post.  Still using the Easy module shield) I have found out how to read the analogue input from the potentiometer.   So far this gives a value and voltage. &#xA;&#xA;Arduino Tutorial&#xA;&#xA;/&#xA; Created by ArduinoGetStarted.com&#xA;  This example code is in the public domain&#xA;  Tutorial page: https://arduinogetstarted.com/tutorials/arduino-potentiometer&#xA; /&#xA;&#xA;float floatMap(float x, float inmin, float inmax, float outmin, float outmax) {&#xA;  return (x - inmin)  (outmax - outmin) / (inmax - inmin) + outmin;&#xA;}&#xA;&#xA;// the setup routine runs once when you press reset:&#xA;void setup() {&#xA;  // initialize serial communication at 9600 bits per second:&#xA;  Serial.begin(9600);&#xA;}&#xA;&#xA;// the loop routine runs over and over again forever:&#xA;void loop() {&#xA;  // read the input on analog pin A0:&#xA;  int analogValue = analogRead(A0);&#xA;  // Rescale to potentiometer&#39;s voltage (from 0V to 5V):&#xA;  float voltage = floatMap(analogValue, 0, 1023, 0, 5);&#xA;&#xA;  // print out the value you read:&#xA;  Serial.print(&#34;Analog: &#34;);&#xA;  Serial.print(analogValue);&#xA;  Serial.print(&#34;, Voltage: &#34;);&#xA;  Serial.println(voltage);&#xA;  delay(1000);&#xA;}&#xA;&#xA;So the two lines (the first is a comment) sets the program to read from A0&#xA;&#xA; // read the input on analog pin A0:&#xA;  int analogValue = analogRead(A0);&#xA;&#xA;With output looking like&#xA;&#xA; // read the input on analog pin A0:&#xA;  int analogValue = analogRead(A0);&#xA;&#xA;READING THE LIGHT SENSOR&#xA;&#xA;By changing this to&#xA;&#xA; // read the input on analog pin A1:&#xA;  int analogValue = analogRead(A1);&#xA;&#xA;It is possible to read the light sensor on the same board.&#xA;&#xA;/&#xA; Created by ArduinoGetStarted.com&#xA;  This example code is in the public domain&#xA;  Tutorial page: https://arduinogetstarted.com/tutorials/arduino-potentiometer&#xA; /&#xA;&#xA;float floatMap(float x, float inmin, float inmax, float outmin, float outmax) {&#xA;  return (x - inmin)  (outmax - outmin) / (inmax - inmin) + outmin;&#xA;}&#xA;&#xA;// the setup routine runs once when you press reset:&#xA;void setup() {&#xA;  // initialize serial communication at 9600 bits per second:&#xA;  Serial.begin(9600);&#xA;}&#xA;&#xA;// the loop routine runs over and over again forever:&#xA;void loop() {&#xA;  // read the input on analog pin A0:&#xA;  int analogValue = analogRead(A0);&#xA;  // Rescale to potentiometer&#39;s voltage (from 0V to 5V):&#xA;  float light = floatMap(analogValue, 0, 1023, 0, 5);&#xA;&#xA;  // print out the value you read:&#xA;  Serial.print(&#34;Analog: &#34;);&#xA;  Serial.print(analogValue);&#xA;  Serial.print(&#34;, Light: &#34;);&#xA;  Serial.println(light);&#xA;  delay(1000);&#xA;}&#xA;I have edited the lines above so that it reflects the fact we are now reading the light sensor.&#xA;&#xA;  float light = floatMap(analogValue, 0, 1023, 0, 5);&#xA;&#xA;  // print out the value you read:&#xA;  Serial.print(&#34;Analog: &#34;);&#xA;  Serial.print(analogValue);&#xA;  Serial.print(&#34;, Light: &#34;);&#xA;  Serial.println(light);&#xA;  delay(1000);&#xA;}&#xA;&#xA;You will need to change the other lines to suit, as some of the comments still refer to the potentiometer.&#xA;&#xA;Video&#xA;&#xA;iframe title=&#34;Arduino Analogue Read&#34; width=&#34;560&#34; height=&#34;315&#34; src=&#34;https://diode.zone/videos/embed/23beba61-a089-48b3-988c-7616051f460e&#34; frameborder=&#34;0&#34; allowfullscreen=&#34;&#34; sandbox=&#34;allow-same-origin allow-scripts allow-popups&#34;/iframe&#xA;&#xA;Video illustrates how rotation of the potentiometer is reflected in the output values. &#xA;&#xA;Links&#xA;&#xA;Easy module shield&#xA;&#xA;Tags&#xA;&#xA;#Electronics,#Code,#Arduino,#Hacking.#TempSensor&#xA;&#xA;hr&#xD;&#xA;&#xD;&#xA;table&#xD;&#xA;thead&#xD;&#xA;trtda rel=&#34;me&#34; href=&#34;https://qoto.org/@zleap&#34;Mastodon/a/td&#xD;&#xA;tda href=&#34;https://wiki.ircnow.org/?n=Shelllabs.Intro&#34;ShellLabs/td&#xD;&#xA;tda href=&#34;https://joinmastodon.org/&#34;Join Mastodon/a/td/tr/thead/table&#xD;&#xA;center&#xD;&#xA;AI statement : b Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity.  Consent CANNOT be assumed, it has to be granted. /b&#xD;&#xA;/center&#xD;&#xA;&#xD;&#xA;a href=&#34;https://liberapay.com/PaulSutton/donate&#34;img alt=&#34;Donate using Liberapay&#34; src=&#34;https://liberapay.com/assets/widgets/donate.svg&#34;/a&#xD;&#xA;]]&gt;</description>
      <content:encoded><![CDATA[<p>Code Club Electronics 10</p>

<p>So following on from the previous post.  Still using the Easy module shield) I have found out how to read the analogue input from the potentiometer.   So far this gives a value and voltage.</p>
<ul><li><a href="https://arduinogetstarted.com/tutorials/arduino-potentiometer" rel="nofollow">Arduino Tutorial</a></li></ul>

<pre><code>/*
 * Created by ArduinoGetStarted.com
 *
 * This example code is in the public domain
 *
 * Tutorial page: https://arduinogetstarted.com/tutorials/arduino-potentiometer
 */

float floatMap(float x, float in_min, float in_max, float out_min, float out_max) {
  return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}

// the setup routine runs once when you press reset:
void setup() {
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
}

// the loop routine runs over and over again forever:
void loop() {
  // read the input on analog pin A0:
  int analogValue = analogRead(A0);
  // Rescale to potentiometer&#39;s voltage (from 0V to 5V):
  float voltage = floatMap(analogValue, 0, 1023, 0, 5);

  // print out the value you read:
  Serial.print(&#34;Analog: &#34;);
  Serial.print(analogValue);
  Serial.print(&#34;, Voltage: &#34;);
  Serial.println(voltage);
  delay(1000);
}
</code></pre>

<p>So the two lines (the first is a comment) sets the program to read from A0</p>

<pre><code> // read the input on analog pin A0:
  int analogValue = analogRead(A0);
</code></pre>

<p>With output looking like</p>

<pre><code> // read the input on analog pin A0:
  int analogValue = analogRead(A0);
</code></pre>

<p><strong>READING THE LIGHT SENSOR</strong></p>

<p>By changing this to</p>

<pre><code> // read the input on analog pin A1:
  int analogValue = analogRead(A1);
</code></pre>

<p>It is possible to read the light sensor on the same board.</p>

<pre><code>/*
 * Created by ArduinoGetStarted.com
 *
 * This example code is in the public domain
 *
 * Tutorial page: https://arduinogetstarted.com/tutorials/arduino-potentiometer
 */

float floatMap(float x, float in_min, float in_max, float out_min, float out_max) {
  return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}

// the setup routine runs once when you press reset:
void setup() {
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
}

// the loop routine runs over and over again forever:
void loop() {
  // read the input on analog pin A0:
  int analogValue = analogRead(A0);
  // Rescale to potentiometer&#39;s voltage (from 0V to 5V):
  float light = floatMap(analogValue, 0, 1023, 0, 5);

  // print out the value you read:
  Serial.print(&#34;Analog: &#34;);
  Serial.print(analogValue);
  Serial.print(&#34;, Light: &#34;);
  Serial.println(light);
  delay(1000);
}
</code></pre>

<p>I have edited the lines above so that it reflects the fact we are now reading the light sensor.</p>

<pre><code>  float light = floatMap(analogValue, 0, 1023, 0, 5);

  // print out the value you read:
  Serial.print(&#34;Analog: &#34;);
  Serial.print(analogValue);
  Serial.print(&#34;, Light: &#34;);
  Serial.println(light);
  delay(1000);
}
</code></pre>

<p>You will need to change the other lines to suit, as some of the comments still refer to the potentiometer.</p>

<p><strong>Video</strong></p>

<iframe title="Arduino Analogue Read" width="560" height="315" src="https://diode.zone/videos/embed/23beba61-a089-48b3-988c-7616051f460e" frameborder="0" allowfullscreen=""></iframe>

<p>Video illustrates how rotation of the potentiometer is reflected in the output values.</p>

<p><strong>Links</strong></p>
<ul><li><a href="http://www.getmicros.net/a-look-at-the-easy-module-shield-for-arduino.php" rel="nofollow">Easy module shield</a></li></ul>

<p><strong>Tags</strong></p>

<p><a href="/paulsutton/tag:Electronics" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Electronics</span></a>,<a href="/paulsutton/tag:Code" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Code</span></a>,<a href="/paulsutton/tag:Arduino" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Arduino</span></a>,<a href="/paulsutton/tag:Hacking" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Hacking</span></a>.<a href="/paulsutton/tag:TempSensor" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">TempSensor</span></a></p>

<hr>

<p><table>
<thead>
<tr><td><a href="https://qoto.org/@zleap" rel="nofollow">Mastodon</a></td>
<td><a href="https://wiki.ircnow.org/?n=Shelllabs.Intro" rel="nofollow">ShellLabs</td>
<td><a href="https://joinmastodon.org/" rel="nofollow">Join Mastodon</a></td></tr></thead></table>

AI statement : <b> Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity.  Consent CANNOT be assumed, it has to be granted. </b>
</p>

<p><a href="https://liberapay.com/PaulSutton/donate" rel="nofollow"><img alt="Donate using Liberapay" src="https://liberapay.com/assets/widgets/donate.svg"></a></p>
]]></content:encoded>
      <guid>https://personaljournal.ca/paulsutton/code-club-electronics-10</guid>
      <pubDate>Sun, 17 Dec 2023 15:53:14 +0000</pubDate>
    </item>
    <item>
      <title>Code Club Electronics 9</title>
      <link>https://personaljournal.ca/paulsutton/code-club-electronics-9</link>
      <description>&lt;![CDATA[Code Club Electronics 9&#xA;&#xA;So following on from the previous post.  I had to look this up to remind myself how to specific a pin.  &#xA;&#xA;So my next project, was to try and get the DHT11 temperature and humidity module working.   I had a problem with the library for this, so looked at the code, used the section of this that used the LM35 temperature module (which can also be found on the Easy module shield)&#xA;&#xA;float tempC;&#xA;int tempPin = 2;&#xA;byte temperature = 0;&#xA;&#xA;void setup() &#xA;{&#xA;  Serial.begin(9600);&#xA;}&#xA;&#xA;void loop() &#xA;{&#xA;&#xA;  tempC = analogRead(tempPin);           //read the value from the sensor&#xA;  tempC = (5.0  tempC  100.0)/1024.0;  //convert the analog data to temperature&#xA;&#xA;  Serial.print(&#34;LM35 - Temperature: &#34;); &#xA;  Serial.print((byte)tempC);&#xA;  Serial.println(&#34; Celcius&#34;);&#xA;  delay(500); // delay 5 seconds&#xA;}&#xA;&#xA;So just switched to pin 2 above &#xA;&#xA;``&#xA;int tempPin = 2;&#xA;``&#xA;&#xA;And modified the code to give nicer output.  The Arduno IDE allows for both plotting of data on a graph and also just using the serial monitor. &#xA;&#xA;Output looks like this&#xA;&#xA;LM35 - Temperature: 18 C&#xA;LM35 - Temperature: 18 C&#xA;LM35 - Temperature: 18 *C&#xA;&#xA;Links&#xA;&#xA;Easy module shield&#xA;&#xA;Tags&#xA;&#xA;#Electronics,#Code,#Arduino,#Hacking.#TempSensor&#xA;&#xA;hr&#xD;&#xA;&#xD;&#xA;table&#xD;&#xA;thead&#xD;&#xA;trtda rel=&#34;me&#34; href=&#34;https://qoto.org/@zleap&#34;Mastodon/a/td&#xD;&#xA;tda href=&#34;https://wiki.ircnow.org/?n=Shelllabs.Intro&#34;ShellLabs/td&#xD;&#xA;tda href=&#34;https://joinmastodon.org/&#34;Join Mastodon/a/td/tr/thead/table&#xD;&#xA;center&#xD;&#xA;AI statement : b Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity.  Consent CANNOT be assumed, it has to be granted. /b&#xD;&#xA;/center&#xD;&#xA;&#xD;&#xA;a href=&#34;https://liberapay.com/PaulSutton/donate&#34;img alt=&#34;Donate using Liberapay&#34; src=&#34;https://liberapay.com/assets/widgets/donate.svg&#34;/a&#xD;&#xA;]]&gt;</description>
      <content:encoded><![CDATA[<p>Code Club Electronics 9</p>

<p>So following on from the previous post.  I had to look this up to remind myself how to specific a pin.</p>

<p>So my next project, was to try and get the DHT11 temperature and humidity module working.   I had a problem with the library for this, so looked at the code, used the section of this that used the LM35 temperature module (which can also be found on the Easy module shield)</p>

<pre><code>float tempC;
int tempPin = 2;
byte temperature = 0;

void setup() 
{
  Serial.begin(9600);
}

void loop() 
{

  tempC = analogRead(tempPin);           //read the value from the sensor
  tempC = (5.0 * tempC * 100.0)/1024.0;  //convert the analog data to temperature

  Serial.print(&#34;LM35 - Temperature: &#34;); 
  Serial.print((byte)tempC);
  Serial.println(&#34; Celcius&#34;);
  delay(500); // delay 5 seconds
}
</code></pre>

<p>So just switched to pin 2 above</p>

<p><code>
int tempPin = 2;
</code></p>

<p>And modified the code to give nicer output.  The Arduno IDE allows for both plotting of data on a graph and also just using the serial monitor.</p>

<p>Output looks like this</p>

<pre><code>LM35 - Temperature: 18 *C
LM35 - Temperature: 18 *C
LM35 - Temperature: 18 *C
</code></pre>

<p><strong>Links</strong></p>
<ul><li><a href="http://www.getmicros.net/a-look-at-the-easy-module-shield-for-arduino.php" rel="nofollow">Easy module shield</a></li></ul>

<p><strong>Tags</strong></p>

<p><a href="/paulsutton/tag:Electronics" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Electronics</span></a>,<a href="/paulsutton/tag:Code" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Code</span></a>,<a href="/paulsutton/tag:Arduino" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Arduino</span></a>,<a href="/paulsutton/tag:Hacking" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Hacking</span></a>.<a href="/paulsutton/tag:TempSensor" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">TempSensor</span></a></p>

<hr>

<p><table>
<thead>
<tr><td><a href="https://qoto.org/@zleap" rel="nofollow">Mastodon</a></td>
<td><a href="https://wiki.ircnow.org/?n=Shelllabs.Intro" rel="nofollow">ShellLabs</td>
<td><a href="https://joinmastodon.org/" rel="nofollow">Join Mastodon</a></td></tr></thead></table>

AI statement : <b> Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity.  Consent CANNOT be assumed, it has to be granted. </b>
</p>

<p><a href="https://liberapay.com/PaulSutton/donate" rel="nofollow"><img alt="Donate using Liberapay" src="https://liberapay.com/assets/widgets/donate.svg"></a></p>
]]></content:encoded>
      <guid>https://personaljournal.ca/paulsutton/code-club-electronics-9</guid>
      <pubDate>Sun, 17 Dec 2023 15:27:54 +0000</pubDate>
    </item>
  </channel>
</rss>