<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>electronics &amp;mdash; Paul Sutton</title>
    <link>https://paper.wf/paulsutton/tag:electronics</link>
    <description>Paul Sutton - personal blog </description>
    <pubDate>Thu, 07 May 2026 00:38:20 +0000</pubDate>
    <item>
      <title>Audio amp</title>
      <link>https://paper.wf/paulsutton/audio-amp</link>
      <description>&lt;![CDATA[Audio amp&#xA;&#xA;A few months ago, I found a circuit diagram to build a simple audio amplifier circuit with the LM386 chip.&#xA;&#xA;The circuit and further details can be found here, while my completed project is below.&#xA;&#xA;audio amp&#xA;&#xA;The project works, but seems a little crackly in places, So I need to investigate further.&#xA;&#xA;Tags&#xA;&#xA;#Electronics,#Project,#Audio,#Amplifier,#AudioAmplifier&#xA;&#xA;**A]]&gt;</description>
      <content:encoded><![CDATA[<p>Audio amp</p>

<p>A few months ago, I found a circuit diagram to build a simple audio amplifier circuit with the LM386 chip.</p>

<p>The circuit and further details can be <a href="https://www.circuitbasics.com/build-a-great-sounding-audio-amplifier-with-bass-boost-from-the-lm386/" rel="nofollow">found here,</a> while my completed project is below.</p>

<p><img src="https://salsa.debian.org/zleap-guest/blog-media/-/raw/master/audioamp.JPG" alt="audio amp"></p>

<p>The project works, but seems a little crackly in places, So I need to investigate further.</p>

<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:Project" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Project</span></a>,<a href="/paulsutton/tag:Audio" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Audio</span></a>,<a href="/paulsutton/tag:Amplifier" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Amplifier</span></a>,<a href="/paulsutton/tag:AudioAmplifier" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">AudioAmplifier</span></a></p>

<p>**A</p>
]]></content:encoded>
      <guid>https://paper.wf/paulsutton/audio-amp</guid>
      <pubDate>Thu, 29 Aug 2024 15:00:00 +0000</pubDate>
    </item>
    <item>
      <title>Code Club 20/1/2024 Write up</title>
      <link>https://paper.wf/paulsutton/code-club-20-1-2024-write-up</link>
      <description>&lt;![CDATA[Code Club 20/1/2024 Write up&#xA;&#xA;We seem to be heading off at a tangent with code club, however today we carried on with building a robot car, and another group were starting work on a 12 in 1 robot kit.&#xA;&#xA;Elsewhere, we installed Ubuntu on a netbook and had a look at the Sony Laptop, which now dual boots with Ubuntu and has all the various hardware drivers working.&#xA;&#xA;We do however want to get back to coding at Code Club and ensure STEM group is reserved for some of the project work. &#xA;&#xA;Next code club is on 3rd Feb 2024&#xA;&#xA;Tags&#xA;&#xA;#Code,#Coding,#CodeClub,#STEM,#Electronics]]&gt;</description>
      <content:encoded><![CDATA[<p>Code Club 20/1/2024 Write up</p>

<p>We seem to be heading off at a tangent with code club, however today we carried on with building a robot car, and another group were starting work on a 12 in 1 robot kit.</p>

<p>Elsewhere, we installed Ubuntu on a netbook and had a look at the Sony Laptop, which now dual boots with Ubuntu and has all the various hardware drivers working.</p>

<p>We do however want to get back to coding at Code Club and ensure STEM group is reserved for some of the project work.</p>

<p>Next code club is on 3rd Feb 2024</p>

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

<p><a href="/paulsutton/tag:Code" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Code</span></a>,<a href="/paulsutton/tag:Coding" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Coding</span></a>,<a href="/paulsutton/tag:CodeClub" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">CodeClub</span></a>,<a href="/paulsutton/tag:STEM" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">STEM</span></a>,<a href="/paulsutton/tag:Electronics" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Electronics</span></a></p>
]]></content:encoded>
      <guid>https://paper.wf/paulsutton/code-club-20-1-2024-write-up</guid>
      <pubDate>Sat, 20 Jan 2024 18:23:26 +0000</pubDate>
    </item>
    <item>
      <title>Code Club 20/1/2024</title>
      <link>https://paper.wf/paulsutton/code-club-20-1-2024</link>
      <description>&lt;![CDATA[Code Club 20/1/2024&#xA;&#xA;Usual code club on Saturday 10 - 12 at Paignton Library, we will be in the learning centre for the usual coding activities and in room 10 to carry on with the projects we are doing at the STEM  group (see previous post).  &#xA;&#xA;Tags&#xA;&#xA;#Code,#Coding,#CodeClub,#STEM,#Electronics]]&gt;</description>
      <content:encoded><![CDATA[<p>Code Club 20/1/2024</p>

<p>Usual code club on Saturday 10 – 12 at Paignton Library, we will be in the learning centre for the usual coding activities and in room 10 to carry on with the projects we are doing at the STEM  group (see previous post).</p>

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

<p><a href="/paulsutton/tag:Code" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Code</span></a>,<a href="/paulsutton/tag:Coding" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Coding</span></a>,<a href="/paulsutton/tag:CodeClub" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">CodeClub</span></a>,<a href="/paulsutton/tag:STEM" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">STEM</span></a>,<a href="/paulsutton/tag:Electronics" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Electronics</span></a></p>
]]></content:encoded>
      <guid>https://paper.wf/paulsutton/code-club-20-1-2024</guid>
      <pubDate>Mon, 15 Jan 2024 16:14:21 +0000</pubDate>
    </item>
    <item>
      <title>Code Club Electronics 19</title>
      <link>https://paper.wf/paulsutton/code-club-electronics-19</link>
      <description>&lt;![CDATA[Code Club Electronics 19&#xA;&#xA;I have built a basic potentiometer controlled motor,  this works quite well, just a little sensitve.  But should be fine for what I need this for. &#xA;&#xA;Video&#xA;&#xA;iframe title=&#34;Motor Control&#34; width=&#34;560&#34; height=&#34;315&#34; src=&#34;https://diode.zone/videos/embed/29601ff9-1730-4b12-b97f-5de264f0f919&#34; frameborder=&#34;0&#34; allowfullscreen=&#34;&#34; sandbox=&#34;allow-same-origin allow-scripts allow-popups&#34;/iframe&#xA;&#xA;Tags&#xA;&#xA;#Electronics,#Motor,#Speed,#Controller,#Potentiometer]]&gt;</description>
      <content:encoded><![CDATA[<p>Code Club Electronics 19</p>

<p>I have built a basic potentiometer controlled motor,  this works quite well, just a little sensitve.  But should be fine for what I need this for.</p>

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

<iframe title="Motor Control" width="560" height="315" src="https://diode.zone/videos/embed/29601ff9-1730-4b12-b97f-5de264f0f919" frameborder="0" allowfullscreen=""></iframe>

<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:Motor" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Motor</span></a>,<a href="/paulsutton/tag:Speed" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Speed</span></a>,<a href="/paulsutton/tag:Controller" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Controller</span></a>,<a href="/paulsutton/tag:Potentiometer" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Potentiometer</span></a></p>
]]></content:encoded>
      <guid>https://paper.wf/paulsutton/code-club-electronics-19</guid>
      <pubDate>Sun, 07 Jan 2024 07:00:00 +0000</pubDate>
    </item>
    <item>
      <title>Code Club Electronics 14</title>
      <link>https://paper.wf/paulsutton/code-club-electronics-14</link>
      <description>&lt;![CDATA[Code Club Electronics 14&#xA;&#xA;I want to build something for the science kit to make it easier to stir liquids.   I have found a project for a DC motor controlled by a potentiometer. that also uses an Arduino microcontroller.   This should be easy enough to build and attach a stirrer to.   This can be soldered up, battery attached, power switch may also be needed.&#xA;&#xA;Should then be easier to stir liquids for science experiments. &#xA;&#xA;Tags&#xA;&#xA;#Arduino,#Electronics,#Science,#Chemical,#Stirrer,#DC,#Motor,&#xA;Control]]&gt;</description>
      <content:encoded><![CDATA[<p>Code Club Electronics 14</p>

<p>I want to build something for the science kit to make it easier to stir liquids.   I have found a project for a <a href="https://circuitdigest.com/microcontroller-projects/dc-motor-speed-control-using-arduino-and-potentiometer" rel="nofollow">DC motor controlled by a potentiometer.</a> that also uses an Arduino microcontroller.   This should be easy enough to build and attach a stirrer to.   This can be soldered up, battery attached, power switch may also be needed.</p>

<p>Should then be easier to stir liquids for science experiments.</p>

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

<p><a href="/paulsutton/tag:Arduino" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Arduino</span></a>,<a href="/paulsutton/tag:Electronics" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Electronics</span></a>,<a href="/paulsutton/tag:Science" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Science</span></a>,<a href="/paulsutton/tag:Chemical" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Chemical</span></a>,<a href="/paulsutton/tag:Stirrer" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Stirrer</span></a>,<a href="/paulsutton/tag:DC" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">DC</span></a>,<a href="/paulsutton/tag:Motor" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Motor</span></a>,
<a href="/paulsutton/tag:Control" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Control</span></a></p>
]]></content:encoded>
      <guid>https://paper.wf/paulsutton/code-club-electronics-14</guid>
      <pubDate>Fri, 29 Dec 2023 19:15:37 +0000</pubDate>
    </item>
    <item>
      <title>Code Club Electronics 13</title>
      <link>https://paper.wf/paulsutton/code-club-electronics-13</link>
      <description>&lt;![CDATA[Code Club Electronics 13&#xA;&#xA;So further to my previous attempt, I have now made some progress with this.  New code is as follows&#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;  &#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, (voltage));   // 1khz tone to buzzer&#xA;  delay(analogValue);                       // wait for time period linked to pot input value&#xA;  tone(buzzer, (voltage));    // 1khz tone to buzzer&#xA;&#xA;  //https://www.instructables.com/How-to-use-a-Buzzer-Arduino-Tutorial/&#xA;}&#xA;&#xA;The main difference here is that I am binding the buzzer tone to the voltage&#xA;&#xA;  float voltage = floatMap(analogValue, 0, 1023, 0, 5);&#xA;  tone(buzzer, (voltage));   // 1khz tone to buzzer&#xA;  delay(analogValue);                       // wait for time period linked to pot input value&#xA;  tone(buzzer, (voltage));    // 1khz tone to buzzer&#xA;&#xA;This sort of works, but the frequency isn&#39;t very high.  &#xA;&#xA;Tags&#xA;&#xA;#Arduino,#Electronics]]&gt;</description>
      <content:encoded><![CDATA[<p>Code Club Electronics 13</p>

<p>So further to my previous attempt, I have now made some progress with this.  New code is as follows</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, (voltage));   // 1khz tone to buzzer
  delay(analogValue);                       // wait for time period linked to pot input value
  tone(buzzer, (voltage));    // 1khz tone to buzzer

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

<p>The main difference here is that I am binding the buzzer tone to the voltage</p>

<pre><code>  float voltage = floatMap(analogValue, 0, 1023, 0, 5);
  tone(buzzer, (voltage));   // 1khz tone to buzzer
  delay(analogValue);                       // wait for time period linked to pot input value
  tone(buzzer, (voltage));    // 1khz tone to buzzer
</code></pre>

<p>This sort of works, but the frequency isn&#39;t very high.</p>

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

<p><a href="/paulsutton/tag:Arduino" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Arduino</span></a>,<a href="/paulsutton/tag:Electronics" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Electronics</span></a></p>
]]></content:encoded>
      <guid>https://paper.wf/paulsutton/code-club-electronics-13</guid>
      <pubDate>Thu, 28 Dec 2023 07:00:00 +0000</pubDate>
    </item>
    <item>
      <title>Code Club Electronics 12</title>
      <link>https://paper.wf/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]]&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>
]]></content:encoded>
      <guid>https://paper.wf/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://paper.wf/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]]&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>
]]></content:encoded>
      <guid>https://paper.wf/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://paper.wf/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]]&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>
]]></content:encoded>
      <guid>https://paper.wf/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://paper.wf/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]]&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>
]]></content:encoded>
      <guid>https://paper.wf/paulsutton/code-club-electronics-9</guid>
      <pubDate>Sun, 17 Dec 2023 15:27:54 +0000</pubDate>
    </item>
  </channel>
</rss>