<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
<title>Technoblogy</title>
<link>http://www.technoblogy.com/show?KVM</link>
<description><![CDATA[Electronics and microcontroller projects]]></description>
<pubDate>Fri, 13 Nov 2026 00:00:00 GMT</pubDate>
<lastBuildDate>Fri, 13 Nov 2026 00:00:00 GMT</lastBuildDate>
<language>en</language>
<image>
<url>http://www.technoblogy.com/pictures/KVM/icon-72.png</url>
<title>Technoblogy</title>
<link>http://www.technoblogy.com/show?KVM</link>
<width>72</width>
<height>72</height>
</image>
<generator>CL-HTTP RSS</generator>
<docs>http://blogs.law.harvard.edu/tech/rss</docs>
<item>
<title>Simple ePaper Character Display</title>
<description><![CDATA[<p>This is a simple character display based on a Waveshare 400x300 Red/Black/White ePaper display controlled by a Raspberry Pi Pico. To minimise the amount of RAM needed by the application the program treats the display as a character terminal, with graphics characters for drawing simple diagrams and flowcharts:</p>
<p class="center"><img src="http://www.technoblogy.com/pictures/kvm/epaperdisplaypaella.jpg" alt="ePaperDisplayPaella.jpg" width="705" height="460" /></p>
<p style="text-align: center;"><em>The Simple ePaper Character Display, based on a Waveshare 400x300 Red/Black/White ePaper display, used for a Recipe Book application.</em></p>
<p>I designed this for a digital Recipe Book, but the project isn't limited to this, and you could use it for any application that needs low power but doesn't need fast screen updates, such as a home automation information display, weather station, news display, or network activity display.</p>
<h3 id="introduction">Introduction</h3>
<p>This project started with the idea of converting all my handwritten recipes to a simple home display device that could sit on the kitchen counter, and display a recipe on demand. The Waveshare 400x300 Red/Black/White ePaper display seemed ideal as it has a high enough resolution for this application, and the display is persistent, so the device can be portable and battery powered without problems.</p>
<p>To make prototyping the project easier I bought the version of the Waveshare 400x300 Red/Black/White ePaper display that allows you to plug a Raspberry Pi Pico into a carrier on the back of the display, but eventually I plan to drive it from an AVR processor. I got my display from The Pi Hut in the UK&nbsp;<sup id="cite_ref1"><a href="#cite_note1">[1]</a></sup>. It's also available direct from Waveshare&nbsp;<sup id="cite_ref2"><a href="#cite_note2">[2]</a></sup>.</p>
<p>The usual way to drive ePaper displays is to allocate a RAM buffer on the processor being used to drive the display. You then perform graphics operations on the RAM buffer, which is then transferred to the display to update the displayed image.</p>
<p>However, a 400x300 Red/Black/White display requires a 15Kbytes buffer for each colour, making a total of 30Kbytes, which is a substantial overhead for many smaller processors. For example, the AVR DA series processors have a maximum of 16Kbytes of RAM, and so would be unable to drive such a display.</p>
<p>I was therefore interested in trying the different approach of having a character display of 66x33 characters based on a 6x8 pixel character set. The display buffer would then only need to be 66x33=2178 bytes. The program will convert the character definitions into pixels on the fly, as they are written to the display. This also makes it easier to design the recipe pages, as they can be written as a series of C literal strings.</p>
<h4 id="specification">Specification</h4>
<p>Here's the specification of my prototype:</p>
<ul>
<li>66 x 33 character display, with character graphics capable of displaying boxes and connecting lines.</li>
<li>Black or red characters on a paper-white background, using the top bit of the characters to identify red characters.</li>
<li>Double-size characters, using the same character set with smoothing, for headings.</li>
<li>A full screen refresh time of 15 seconds.</li>
<li>A self-contained program in a single file with no additional libraries required, apart from the Arduino core.</li>
</ul>
<h3 id="recipe-book-application">Recipe Book application</h3>
<p>My original motivation for designing the ePaper Character Display was to build a digital Recipe Book.</p>
<h4 id="my-flowchartstyle-recipe-design">My flowchart-style recipe design</h4>
<p>I've developed a style for writing recipes designed to make cooking easier. I found that when following a recipe in a typical cookery book it would often say something like: Fry the garlic until brown, then add one onion, finely chopped. At this point I would be frantically chopping the onion while the garlic burned.</p>
<p>My solution is to write out recipes with boxes showing all the ingredients you need to prepare in advance. The boxes are linked by lines showing the procedure and timing. The ePaper Recipe Book implements this flowchart-style recipe design.</p>
<h4 id="defining-a-recipe">Defining a recipe</h4>
<p>Here's the definition of the sample recipe shown at the start of the article:</p>
<pre>uint8_t Terminal[ROWS][COLUMNS+1] = {
  { "  _P_a_e_l_l_a_ _w_i_t_h_ _c_h_i_c_k_e_n_ _a_n_d_ _s_e_a_f_o_o_d  " },
  { "                                                                  " },
  { "                             Serves 2                             " },
  { "                                                                  " },
  { "|-----------------------------| |----------------|                " },
  { "| 6 saffron threads           | |                | Add:           " },
  { "|-----------------------------| | |-----------------------------| " },
  { "               | Soak in        | | 250g tomatoes skinned and   | " },
  { "               | boiling water. | | chopped                     | " },
  { "|-----------------------------| | | 1/2 tsp paprika             | " }, // 10
  { "| 4 tbsp olive oil            | | | 450ml water                 | " },
  { "| 1/2 chicken in pieces       | | |-----------------------------| " },
  { "|-----------------------------| |                | Boil 5 mins.   " },
  { "               | Fry until      |                | Simmer 10 mins " },
  { "               | browned.       |                | covered.       " },
  { "               | Add:           |                | Add:           " },
  { "|-----------------------------| | |-----------------------------| " },
  { "| 60g chorizo slices          | | | 60g peas                    | " },
  { "| 1/2 red pepper sliced       | | | Prawns (if raw)             | " },
  { "| 1/2 green pepper sliced     | | |-----------------------------| " }, // 20
  { "|-----------------------------| |                | Simmer 10 mins " },
  { "               | Fry until      |                | covered.       " },
  { "               | caramelised.   |                | Season.        " },
  { "               | Add:           |                | Add:           " },
  { "|-----------------------------| | |-----------------------------| " },
  { "| 2 squid rings               | | | Prawns (if cooked)          | " },
  { "| 160g Bomba or paella rice.  | | |-----------------------------| " },
  { "|-----------------------------| |                | Cover with     " },
  { "               | Fry until      |                | cloth.         " },
  { "               | transparent.   |                | Leave 10 mins. " }, // 30
  { "               ------------------                | Serve!         " },
  { "                                                ---               " },
  { "                                                                  " }, // 33
};</pre>
<p>To make it easy to edit a recipe in the Arduino IDE the boxes and lines are drawn with '-' and '|' characters, and the double-size characters in the heading are defined with '_' characters. These are automatically converted to the correct characters by the program.</p>
<p>I've included several sample recipes with the program which can be read from flash memory to illustrate the Recipe Book.</p>
<h3 id="the-program">The program</h3>
<p>The program is based on the contributed Arduino example&nbsp;<strong>epd4in2b_V2</strong> on GitHub <sup id="cite_ref3"><a href="#cite_note3">[3]</a></sup>. The example is designed to cater for both old V1 displays and the current V2 displays; for simplicity I've removed the legacy code, so you need a V2 display to use my program.</p>
<h4 id="updating-the-display">Updating the display</h4>
<p>After initialising the display the procedure to update the display is effectively to send 300 rows of 50 bytes, where 50x8 bits gives the horizontal pixel resolution of 400:</p>
<pre>void loop() {
  for (int i = 0; i &lt; 2; i++) {
    int command = (i == 0) ? 0x24 : 0x26;
    SendCommand(command);
    for (int y=0; y&lt;300; y++) {
      for (int h=0; h&lt;50; h++) {
        uint8_t byte = Picture(i, h, y);
        SendData(byte);
      }
    }
   }
  DisplayFrame();
  delay(1000);
  Sleep();
}</pre>
<p>where the command 0x24 selects the black image plane, and 0x26 selects the red image plane. The function&nbsp;<strong>Picture(colour, h, y)</strong> returns the next row of 8 pixels in row <strong>y</strong> in the appropriate colour <strong>i</strong>.</p>
<p>The final <strong>Sleep()</strong> command turns off power to the display, to minimise wear to it.</p>
<h4 id="character-terminal">Character terminal</h4>
<p>My display driver uses a character display defined by the array <strong>Terminal[row][column]</strong>. With a character set using 6x8 pixel characters, and a leading of 9 pixels, there are 300/9 or 33 rows, and 400/6 or 66 columns.</p>
<p>So the definition of <strong>Picture(colour, h, y)</strong> could be written something like this for one of the colour planes:</p>
<pre>uint8_t Picture (uint8_t i, int h, int y) {
  uint8_t byte = 0;
  for (int bit=0; bit&lt;8; bit++) {
    int x = h*8 + bit;
    uint8_t row = y/LEADING;
    uint8_t col = x/CHARWIDTH;
    uint8_t c = Terminal[row][col];
    uint8_t pixel = (CharMap[(c &amp; 0x7f)-CHAR0][x%CHARWIDTH] &gt;&gt; (y%LEADING)) &amp; 1;
    byte = (byte&lt;&lt;1) | pixel;
  }
  return byte;
}</pre>
<p>For each pixel in a row of 8 pixels the program looks up the character in <strong>Terminal[row][column]</strong>, looks up the corresponding pixel in <strong>CharMap[character][col]</strong>, and then shifts that pixel into <strong>byte</strong>.</p>
<h4 id="red-characters">Red characters</h4>
<p>The program allows you to display any character in red by setting its top bit. This is implemented by the <strong>Red</strong> macro:</p>
<pre>#define RED             0x80
#define Red(c)          ((c) | RED)</pre>
<h4 id="doublesize-characters">Double-size characters</h4>
<p>The program allows you to display text in double-sized characters, produced by doubling the existing character definitions to 12x16.</p>
<p>To write text in double-size characters prefix each character with a '_' underscore character, and leave spaces on the next line to make room for the bottom half of each double-size character. For example:</p>
<pre>  { "  _S_p_a_g_h_e_t_t_i_ _w_i_t_h_ _p_a_n_c_e_t_t_a_ _a_n_d_ _p_e_a_s" },
  { "                                                                  " },</pre>
<p>The double-size characters should start in an even row; otherwise the characters will not display correctly.</p>
<p>Here's the code that performs the doubling:</p>
<pre>bool line1  = c == '_';
bool line2  = row&gt;0 &amp;&amp; Terminal[row-1][col] == '_';
bool line2a = row&gt;0 &amp;&amp; col&gt;0 &amp;&amp; Terminal[row-1][col-1] == '_';
uint8_t parity = 0;
if (line1 || line2 || big &gt; 0) {
  if (line1) {
    c = Terminal[row][col+1];
    big = CHARWIDTH;
    parity = (x/6) % 2;
  } else if (line2) {
    c = Terminal[row-1][col+1];
    big = CHARWIDTH;
    parity = (x/6) % 2;
  } else if (big &gt; 0) {
    if (line2a) c = Terminal[row-1][col];
    big--;
    parity = (x/6 + 1) % 2;
  }
  c = Red(c);
  pixel = Pixel2(c, x, y, parity);
}</pre>
<p>where <strong>Pixel2(c, x, y, parity)</strong> returns the pixel at (x , y) for character <strong>c</strong> in a double-size character:</p>
<pre>uint8_t Pixel2 (uint8_t c, int x, int y, uint8_t parity) {
  return (CharMap[(c &amp; 0x7f)-CHAR0][((x+6*parity)%(CHARWIDTH*2))/2]
    &gt;&gt; ((y%(LEADING*2))/2)) &amp; 1;
}</pre>
<p>The variable <strong>parity</strong> is 0 if the double-size text starts on an even column and 1 if it starts on an odd column.</p>
<p>Currently the program automatically displays double-size text in red.</p>
<h4 id="smoothing-doublesized-characters">Smoothing double-sized characters</h4>
<p>To make the double-sized characters look as smooth as a custom 12x16 character set, the routine incorporates automatic smoothing as described in my earlier article&nbsp;<a class="auto" href="http://www.technoblogy.com/show?3AJ7">Smooth Big Text</a>.</p>
<p>The smoothing works by checking whether one of the following two situations A or B occur anywhere in the&nbsp;double-resolution&nbsp;character:</p>
<p class="center"><img src="http://www.technoblogy.com/pictures/kvm/dotmatrixsmoothing.gif" alt="DotMatrixSmoothing.gif" width="459" height="106" /></p>
<p>If they do, two extra pixels are added as shown in the second diagrams.</p>
<p>Here's the code to add the smoothing:</p>
<pre>if (pixel == 0) {
  uint8_t xp = (x % (CHARWIDTH*2)) &amp; 1;
  uint8_t yp = (y % (LEADING*2)) &amp; 1;   
  int8_t dx = xp ? 1 : -1;
  int8_t dy = yp ? 1 : -1;
  if (Pixel2(c, x + dx, y, parity) == 1 &amp;&amp; Pixel2(c, x, y + dy, parity) == 1
    &amp;&amp; Pixel2(c, x + dx, y + dy, parity) == 0) pixel = 1;
}</pre>
<h4 id="graphics-boxes">Graphics boxes</h4>
<p>The program includes graphics characters to allow you to draw boxes, and horizontal or vertical connecting lines, for use in diagrams, flowcharts, and information displays.</p>
<p>To make drawing a diagram easier you can draw the boxes and connecting lines using '|' and '-' characters, and the program converts these into the appropriate box and line graphics characters. I used this to draw the recipes for my Recipe Book application.</p>
<p>Here's the code that does the conversion:</p>
<pre>if (c == '|' || c == '-') {
  bool left  = col&gt;0 &amp;&amp; Terminal[row][col-1] == '-';
  bool right = Terminal[row][col+1] == '-';
  bool above = row&gt;0 &amp; Terminal[row-1][col] == '|';
  bool below = Terminal[row+1][col] == '|';
  if (c == '|') {
    if (right &amp;&amp; left &amp;&amp; above &amp;&amp; below) c = Red(CROSS);
    else if (right) c = (above &amp;&amp; below) ? Red(TEERIGHT) 
      : above ? Red(BOTTOMLEFT) : Red(TOPLEFT);
    else if (left) c = (above &amp;&amp; below) ? Red(TEELEFT) 
      : above ? Red(BOTTOMRIGHT) : Red(TOPRIGHT);
    else c = Red(VERTICAL);
  } else {
    if (right &amp;&amp; left &amp;&amp; above &amp;&amp; below) c = Red(CROSS);
    else if (above) c = (right &amp;&amp; left) ? Red(TEEINVERTED) 
      : right ? Red(BOTTOMLEFT) : Red(BOTTOMRIGHT);
    else if (below) c = (right &amp;&amp; left) ? Red(TEE)   
      : right ? Red(TOPLEFT) : Red(TOPRIGHT);
    else if (right || left) c = Red(HORIZONTAL); // Don't translate a single '-'
  }
}</pre>
<p>It allows you to use either '|' or '-' for the corners of boxes, and it knows not to convert a '-' used on its own, such as to hyphenate a word. Also, I've made the boxes and lines displayed in red, but obviously that's optional.</p>
<p>Also, because the graphics characters are 6x8 and the leading is 9, there would be a gap between successive vertical graphics characters. The following code fills in the gaps to make the lines continuous:</p>
<pre>if ((c == Red(VERTICAL) || c == Red(TOPLEFT) || c == Red(TOPRIGHT) || c == Red(TEE)
  || c == Red(TEELEFT) || c == Red(TEERIGHT) || c == Red(CROSS))
  &amp;&amp; y%LEADING &gt; 7 &amp;&amp; (x%CHARWIDTH == 2 || x%CHARWIDTH == 3)) pixel = 1;</pre>
<p>Here's another example showing the use of the graphics characters:</p>
<p class="center"><img src="http://www.technoblogy.com/pictures/kvm/epaperdisplayspaghetti.jpg" alt="ePaperDisplaySpaghetti.jpg" width="705" height="460" /></p>
<p style="text-align: center;"><em>Another sample recipe from the recipe Book application,&nbsp;based on a <br />Waveshare 400x300 Red/Black/White ePaper display.</em></p>
<h3 id="running-the-program">Running the program</h3>
<h4 id="install-the-raspberry-pi-picorp2040-core">Install the Raspberry Pi Pico/RP2040 core</h4>
<ul>
<li>Add the following URL to the <strong>Additional Boards Manager URLs</strong> list in the Arduino IDE <strong>Preferences</strong> dialog box:</li>
</ul>
<pre style="margin-left: 18px; font-size: 11px;">https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json</pre>
<ul>
<li>In the Arduino IDE search for the <strong>Raspberry Pi&nbsp;</strong><strong>RP2040</strong>&nbsp;core in&nbsp;<strong>Boards Manager</strong> and install it.</li>
</ul>
<p style="margin-left: 18px;">I tested this with core version 5.0.0 which uses the new&nbsp;certified 200 Mhz clock.</p>
<ul>
<li>Select&nbsp;<strong>Raspberry Pi&nbsp;</strong><strong>RP2040&nbsp;</strong>from the <strong>Board</strong> menu, and <strong>Raspberry Pi Pico</strong> from the submenu.</li>
</ul>
<p>You can leave all the other options at their defaults.</p>
<ul>
<li>Mount the Raspberry Pi Pico to the back of the Waveshare ePaper display, and connect the USB port to the computer.</li>
<li>Select the&nbsp;<strong>Raspberry Pi Pico</strong>&nbsp;board from the <strong>Port</strong> menu.</li>
<li>Click <strong>Upload</strong> to upload the program.</li>
</ul>
<p>You should then see the demo recipe display appear after the 15s refresh time.</p>
<h3 id="resources">Resources</h3>
<p>Here's the full program of the ePaper Character Display: <a href="http://www.technoblogy.com/list?5T24">Simple ePaper Character Display Program</a>.</p>
<p>Three sample recipes:&nbsp;<a href="http://www.technoblogy.com/list?5T73">Recipe Book Examples</a>.</p>
<p>Also see the&nbsp;<a href="https://files.waveshare.com/wiki/Pico-ePaper-4.2-B/4.2inch%20e-Paper%20(B)%20V2.pdf" target="_blank">Datasheet for the ePaper 4.2 B (V2) display</a>&nbsp;on Waveshare.com.</p>
<h3 id="further-suggestions">Further suggestions</h3>
<ul>
<li>My next objective is to provide a menu of recipes, to allow you to step with the two buttons provided on the Waveshare board, using faster partial updating to highlight each recipe in turn and select one.</li>
<li>Eventually I plan to write a program that takes the recipe description in a structured text format, and then automatically converts it to an appropriate character representation for the display.</li>
<li>It should be relatively simple to modify this program to work with the Waveshare ePaper 4.2 400x300 4-greyscale display <sup id="cite_ref4"><a href="#cite_note4">[4]</a></sup>. Although this doesn't provide red text or graphics, it does have a faster 5s refresh rate.</li>
</ul><hr>
<ol>
<li id="cite_note1"><a href="#cite_ref1">^</a> <a href="https://thepihut.com/products/4-2-e-paper-display-module-for-raspberry-pi-pico-red-black-white-400x300" target="_blank">4.2" ePaper Display Module for Raspberry Pi Pico - Red/Black/White (400x300)</a>&nbsp;on The Pi Hut.</li>
<li id="cite_note2"><a href="#cite_ref2">^</a> <a href="https://www.waveshare.com/pico-epaper-4.2-b.htm" target="_blank">4.2" ePaper Display Module for Raspberry Pi Pico - Red/Black/White (400x300)</a>&nbsp;on Waveshare.com.</li>
<li id="cite_note3"><a href="#cite_ref3">^</a> <a href="https://github.com/waveshareteam/e-Paper/tree/master/Arduino/epd4in2b_V2" target="_blank">epd4in2b_V2</a> on the GitHub waveshareteam e-Paper repository.</li>
<li id="cite_note4"><a href="#cite_ref4">^</a> <a href="https://www.waveshare.com/pico-epaper-4.2.htm" target="_blank">4.2" ePaper Display Module for Raspberry Pi Pico - 4 greyscale (400x300)</a> on Waveshare.com.</li>
</ol>
]]></description>
<pubDate>Fri, 13 Nov 2026 00:00:00 GMT</pubDate>
<guid isPermaLink="true">http://www.technoblogy.com/show?5SRY</guid>
</item>
<item>
<title>Digital Signal Generator PCB</title>
<description><![CDATA[<p>This is a PCB version of my earlier digital signal generator that generates a crystal accurate square-wave signal from 2Hz to approximately 33.5MHz in precise steps of 2Hz. The frequency is continuously adjustable over this range using a rotary encoder, or you can enter an exact frequency using a numeric keypad, with the frequency displayed on an OLED display:</p>
<p class="center"><img src="http://www.technoblogy.com/pictures/kvm/digitalsignalgeneratorangled.jpg" alt="DigitalSignalGeneratorAngled.jpg" width="720" height="450" /></p>
<p style="text-align: center;"><em>The Digital Signal Generator,&nbsp;based on an AVR16EB28, generates a square wave of from&nbsp;2Hz</em><br /><em>to approximately 33.5MHz in precise steps of 2Hz.</em></p>
<p>The earlier version was built on a breadboard and based on an SPDIP version of the AVR32EB28 microcontroller. This version uses essentially the same circuit but with surface-mount components, including an SSOP version of the microcontroller. I've also added an on/off switch, a 3.3V regulator, and space for a LiPo battery to make the project completely self-contained.</p>
<p>For a description of the principles of operation see the previous article&nbsp;<a class="auto" href="http://www.technoblogy.com/show?5Q7F">Digital Signal Generator</a>.</p>
<h3 id="operation">Operation</h3>
<p>The Digital Signal Generator works as follows: you enter the frequency you want, in Hz, on the numeric keypad as a sequence of up to eight digits, and press *. The display then shows the actual frequency that will be generated, and generates the square waves on the outputs. You can then adjust the frequency up or down in steps using the rotary encoder. Initially the step size is 2Hz, but you can toggle the step size between 2Hz and 1000Hz by pressing the rotary encoder knob. Pressing # clears the current input and stops the output.</p>
<p>The signal generator has a range of 2Hz to 33554430Hz.&nbsp;The outputs are provided between WO0 and GND, and WO1 and GND. Because these are out of phase you can get a waveform of the same frequency but twice the amplitude between WO0 and WO1.</p>
<h3 id="the-circuit">The circuit</h3>
<p>Here's the circuit of the PCB version of the Digital Signal Generator:</p>
<p class="center"><img src="http://www.technoblogy.com/pictures/kvm/digitalsignalgeneratorpcb.gif" alt="DigitalSignalGeneratorPCB.gif" width="720" height="411" /></p>
<p style="text-align: center;"><em>The circuit of the Digital Signal Generator,&nbsp;based on an AVR16EB28</em><em>.</em></p>
<h4 id="power-supply">Power supply</h4>
<p>The circuit runs from a supply of 3.3V from a regulator. I suggest powering it from a 3.7V LiPo battery, and there's space on the PCB for a 150mAh battery and a 2-pin JST connector it can connect to. You can charge it using a Lipo charger such as Adafruit's Micro Lipo <sup id="cite_ref1"><a href="#cite_note1">[1]</a></sup>.</p>
<h4 id="rotary-encoder">Rotary encoder</h4>
<p>A variety of different rotary encoders will fit the PCB; the one I've specified in the parts list is available from Adafruit or its distributors, and includes a suitable knob.</p>
<h4 id="crystal-oscillator">Crystal oscillator</h4>
<p>The crystal I used is a&nbsp;4.194304MHz&nbsp;SMD type with an accuracy of 20ppm, and a load capacitance of 18pF&nbsp;<sup id="cite_ref2"><a href="#cite_note2">[2]</a></sup>.</p>
<p>Unlike the earlier ATmega processors the new AVR series don't support an external high-frequency crystal, so it's necessary to provide a crystal oscillator with its output connected to the EXTCLK input.</p>
<p>A novel feature of this circuit is that it uses the Event System to construct a crystal oscillator from two spare I/O pins. It defines PC3 as an inverted input, PC2 as an event output EVOUTC, and then links them internally using an event channel. The crystal is connected between PC3 and PC2, and the output PC2 is connected to the EXTCLK input on PA0.</p>
<p>Recent AVR processors allow you to configure digital inputs either in Schmitt Trigger mode (the default) or in TTL input mode. I tested the stability of this crystal oscillator in both modes, and with a range of different component values. With PC3 in Schmitt Trigger mode the oscillator only operated with a 1M&Omega; feedback resistor and if the load capacitors were omitted. In TTL mode&nbsp;the oscillator operated correctly with a range of capacitor values, from none to 30pF, with or without the feedback resistor. I've therefore recommended TTL input mode, a 1M&Omega; feedback resistor, and 18pF load capacitors.</p>
<p>Here's the parts list (click to expand):</p>
<details id="parts-list"> <summary>Parts list</summary>
<table class="new">
<tbody>
<tr>
<td><strong>Qty</strong></td>
<td><strong>Item</strong></td>
<td><strong>Value</strong></td>
<td><strong>Size</strong></td>
<td><strong>Typical parts</strong></td>
</tr>
<tr>
<td>1</td>
<td>SMD resistor</td>
<td>470&Omega;</td>
<td>0805</td>
<td><a href="https://uk.farnell.com/yageo/rc0805jr-07470rl/res-470r-5-0-125w-0805-thick-film/dp/9233962" target="_blank">Yageo RC0805JR-07470RL</a></td>
</tr>
<tr>
<td>1</td>
<td>SMD resistor</td>
<td>1k&Omega;</td>
<td>0805</td>
<td><a href="https://uk.farnell.com/yageo/rc0805jr-071kl/res-1k-5-0-125w-0805-thick-film/dp/9234004" target="_blank">Yageo&nbsp;RC0805JR-071KL</a></td>
</tr>
<tr>
<td>1</td>
<td>SMD resistor</td>
<td>3.3k&Omega;</td>
<td>0805</td>
<td><a href="https://uk.farnell.com/yageo/rc0805jr-073k3l/res-3k3-5-0-125w-0805-thick-film/dp/9234071" target="_blank">Yageo&nbsp;RC0805JR-073K3L</a></td>
</tr>
<tr>
<td>1</td>
<td>SMD resistor</td>
<td>4.7k&Omega;</td>
<td>0805</td>
<td><a href="https://uk.farnell.com/yageo/rc0805jr-074k7l/res-4k7-5-0-125w-0805-thick-film/dp/9234098" target="_blank">Yageo&nbsp;RC0805JR-074K7L</a></td>
</tr>
<tr>
<td>2</td>
<td>SMD resistor</td>
<td>6.8k&Omega;</td>
<td>0805</td>
<td><a href="https://uk.farnell.com/yageo/rc0805jr-076k8l/res-6k8-5-0-125w-0805-thick-film/dp/9234110" target="_blank">Yageo RC0805JR-076K8L</a></td>
</tr>
<tr>
<td>2</td>
<td>SMD resistor</td>
<td>22k&Omega;</td>
<td>0805</td>
<td><a href="https://uk.farnell.com/yageo/rc0805jr-0722kl/res-22k-5-0-125w-0805-thick-film/dp/9234179" target="_blank">Yageo RC0805JR-0722KL</a></td>
</tr>
<tr>
<td>2</td>
<td>SMD resistor</td>
<td>1M&Omega;</td>
<td>0805</td>
<td><a href="https://uk.farnell.com/yageo/rc0805jr-071ml/res-1m-5-0-125w-0805-thick-film/dp/9234373" target="_blank">Yageo RC0805JR-071ML</a></td>
</tr>
<tr>
<td>2</td>
<td>Ceramic capacitor</td>
<td>18pF</td>
<td>0805</td>
<td><a href="https://uk.farnell.com/yageo/cc0805jrnpo9bn180/cap-18pf-50v-mlcc-0805/dp/3764626" target="_blank">Yageo&nbsp;CC0805JRNPO9BN180</a></td>
</tr>
<tr>
<td>1</td>
<td>Ceramic capacitor</td>
<td>1&micro;F</td>
<td>0805</td>
<td><a href="https://uk.farnell.com/murata/gcm21br71e105ka56k/cap-aec-q200-1uf-25v-mlcc-0805/dp/3581287" target="_blank">Murata&nbsp;GCM21BR71E105KA56K</a></td>
</tr>
<tr>
<td>2</td>
<td>Ceramic capacitor</td>
<td>10&micro;F</td>
<td>0805</td>
<td><a href="https://uk.farnell.com/murata/grm21br61e106ka73l/cap-10-f-25v-10-x5r-0805/dp/1735530" target="_blank">Murata GRM21BR61E106KA73L</a></td>
</tr>
<tr>
<td>1</td>
<td>Crystal</td>
<td>4.194304MHz</td>
<td>12.5 x 4.6mm</td>
<td><a href="https://uk.farnell.com/qantek-technology-corporation/qcs4-194304f18b23m/crystal-4-194304mhz-18pf-12-5/dp/2508472" target="_blank">QCS4.194304F18B23M</a></td>
</tr>
<tr>
<td>1</td>
<td>Microcontroller</td>
<td>AVR16EB28</td>
<td>SSOP-28</td>
<td><a href="https://uk.farnell.com/microchip/avr16eb28-i-ss/mcu-8bit-20mhz-16kb-ssop-28/dp/4297889" target="_blank">AVR16EB28-I/SS</a></td>
</tr>
<tr>
<td>1</td>
<td>Voltage regulator</td>
<td>AP2112-3.3</td>
<td>SOT-23-5</td>
<td><a href="https://uk.farnell.com/diodes-inc/ap2112k-3-3trg1/ldo-fixed-3-3v-0-6a-sot-25-85deg/dp/3257429" target="_blank">AP2112K-3.3TRG1</a></td>
</tr>
<tr>
<td>12</td>
<td>Push buttons</td>
<td>Tactile</td>
<td>6 x 6mm</td>
<td><a href="https://uk.farnell.com/alcoswitch-te-connectivity/fsm4jh/switch-spno-0-05a/dp/1555982" target="_blank">FSM4JH</a></td>
</tr>
<tr>
<td>1</td>
<td>On/off switch</td>
<td>SPDT</td>
<td>0.1" pitch</td>
<td><a href="https://thepihut.com/products/breadboard-friendly-spdt-slide-switch" target="_blank">SPDT Slide Switch</a></td>
</tr>
<tr>
<td>1</td>
<td>Rotary Encoder</td>
<td>PEC11-4215F-S24</td>
<td>12mm</td>
<td><a href="https://www.adafruit.com/product/377" target="_blank">Rotary Encoder + Extras</a></td>
</tr>
<tr>
<td>1</td>
<td>I2C OLED Display</td>
<td>128x32</td>
<td>1.5 x 0.45"</td>
<td><a href="https://www.aliexpress.com/item/1005005653454828.html" target="_blank">0.91" 128x32 OLED SSD1306 Display Module White</a></td>
</tr>
<tr>
<td>1</td>
<td>LiPo Battery</td>
<td>150mAh</td>
<td>LP402025</td>
<td><a href="https://thepihut.com/products/150mah-3-7v-lipo-battery" target="_blank">150mAh 3.7V LiPo Battery</a></td>
</tr>
<tr>
<td>1</td>
<td>JST PH Connector</td>
<td>2-pin</td>
<td>2.0mm pitch</td>
<td><a href="https://www.adafruit.com/product/4422" target="_blank">2.0mm Pitch Connector Kit - JST PH Compatible</a></td>
</tr>
<tr>
<td>2</td>
<td>PCB</td>
<td>Double-sided</td>
<td>81.3 x 40.6mm</td>
<td>See below</td>
</tr>
</tbody>
</table>
</details>
<h3 id="construction">Construction</h3>
<p>I designed a PCB in Eagle and sent it to JLCPCB for production.</p>
<p class="center"><img src="http://www.technoblogy.com/pictures/kvm/digitalsignalgeneratorfront.jpg" alt="DigitalSignalGeneratorFront.jpg" width="700" height="340" /></p>
<p style="text-align: center;"><em>The front panel of the Digital Signal Generator, showing the OLED display, rotary encoder,<br /> and push button keypad</em><em>.</em></p>
<p>I soldered the surface-mount components using a Miniware MHP50-B5 50x50mm hotplate&nbsp;<sup id="cite_ref3"><a href="#cite_note3">[3]</a></sup>&nbsp;<sup id="cite_ref4"><a href="#cite_note4">[4]</a></sup>&nbsp;at 235&deg;C with&nbsp;Chip Quik SMD291AX10T3 solder paste. It's probably a good idea to test the board before adding the through-hole components because it will be easier to rework the board.</p>
<p>I then soldered the through-hole components, including the push buttons, rotary encoder, pin header, and display. I attached the display in position with a double-sided foam pad. Finally I secured the LiPo battery in position with double-sided sticky tape:</p>
<p class="center"><img src="http://www.technoblogy.com/pictures/kvm/digitalsignalgeneratorback.jpg" alt="DigitalSignalGeneratorBack.jpg" width="700" height="340" /></p>
<p style="text-align: center;"><em>The back of the completed Digital Signal Generator, showing the LiPo battery.</em></p>
<h4 id="back-panel">Back panel</h4>
<p>I've also given details of a plain PCB the same size for use as a back panel; you can attach the boards together using 12mm M2.5 threaded pillars and M2.5 screws <sup id="cite_ref5"><a href="#cite_note5">[5]</a></sup>.</p>
<p>I checked the output of the Digital Signal Generator over its range using my&nbsp;<a class="auto" href="http://www.technoblogy.com/show?20B4">100MHz Frequency Meter</a>.</p>
<h3 id="the-program">The program</h3>
<p>For an explanation of the program see the original article,&nbsp;<a class="auto" href="http://www.technoblogy.com/show?5Q7F">Digital Signal Generator</a>.</p>
<p>The only addition to the PCB version is the interrupt-service routine to handle the rotary encoder switch, which is used to toggle between a step size of 2Hz or 1000Hz. I used a pin on a separate port for the switch, PF1, so it could use a separate interrupt service routine:</p>
<pre>ISR (PORTF_PORT_vect) {
  Stepsize = 1002 - Stepsize;                             // Toggle between 2 &amp; 1000
  // Wait 255 cycles once button released for debounce
  uint8_t count = 0;
  while (count &lt; 255) {
    count++;
    if ((PORTF.IN &amp; PIN1_bm) == 0) count = 0;             // Still pressed
  }
  PORTF.INTFLAGS = PIN1_bm;                               // Clear interrupt flag
}</pre>
<h3 id="installing-the-program">Installing the program</h3>
<p>First install Spence Konde's DxCore from GitHub: see <a href="https://github.com/SpenceKonde/DxCore/blob/master/Installation.md" target="_blank">DxCore - Installation</a>. I used version 1.6.2.</p>
<p>Then, in the Arduino IDE:</p>
<ul>
<li>Choose the&nbsp;<strong>AVR EB-series (no bootloader)</strong>&nbsp;option under the&nbsp;<strong>DxCore</strong>&nbsp;heading on the&nbsp;<strong>Board</strong> menu.</li>
<li>Check that the subsequent options are set as follows (ignore any other options):</li>
</ul>
<p style="padding-left: 18px;"><strong>Board: "</strong><strong>AVR EB-series (no bootloader)</strong><strong>"</strong><br /><strong>Chip: "AVR16EB28"<br />Clock Speed: "20 MHz internal"<br /></strong></p>
<p style="padding-left: 18px;">You can leave the other options at their defaults, the first option on each submenu.</p>
<ul>
<li>Connect a UPDI programmer to the&nbsp;<strong>UPDI</strong>,<strong> GND</strong>, and<strong> VDD&nbsp;</strong>pins.</li>
</ul>
<p>The recommended way to upload the program is to use a 3.3V Serial board, such as the SparkFun FTDI Basic board&nbsp;<sup id="cite_ref6"><a href="#cite_note6">[6]</a></sup>&nbsp;connected with&nbsp;a Schottky diode as follows. You can substitute a 4.7k&Omega; resistor for the Schottky diode:</p>
<p class="center"><img src="http://www.technoblogy.com/pictures/kvm/serialupdiprogschottky3v.gif" alt="SerialUPDIProgSchottky3V.gif" width="395" height="147" /></p>
<ul>
<li>Set&nbsp;<strong>Programmer</strong>&nbsp;to the&nbsp;<strong>"SerialUPDI - Normal: 230400 baud (recommended)"</strong> option.</li>
<li>Select the USB port corresponding to the USB to Serial board in the <strong>Port</strong> menu.</li>
</ul>
<ul>
<li>Select <strong>Burn Bootloader</strong> to reset the fuses (in case they were changed for an earlier project).</li>
<li>Click <strong>Upload</strong> to upload the program to the AVR16EB28.</li>
</ul>
<h3 id="resources">Resources</h3>
<p>Here's the program for the Digital Signal Generator PCB:&nbsp;<a href="http://www.technoblogy.com/list?5RSP">Digital Signal Generator PCB Program</a>.</p>
<p>Get the Eagle or Gerber files for the PCBs here:&nbsp;<a href="https://github.com/technoblogy/digital-signal-generator" target="_blank">https://github.com/technoblogy/digital-signal-generator</a>.</p><hr>
<ol>
<li id="cite_note1"><a href="#cite_ref1">^</a> <a href="https://www.adafruit.com/product/1304" target="_blank">Micro Lipo - USB LiIon/LiPoly charger</a> on Adafruit.</li>
<li id="cite_note2"><a href="#cite_ref2">^</a> <a href="https://uk.farnell.com/qantek-technology-corporation/qcl4-194304f18b23b/crystal-4-194304mhz-18pf-hc-49us/dp/2508442" target="_blank">QCL4.194304F18B23B</a> on Farnell.</li>
<li id="cite_note3"><a href="#cite_ref3">^</a> <a href="https://www.adafruit.com/product/5903" target="_blank">MHP50-B5</a>&nbsp;on Adafruit.</li>
<li id="cite_note4"><a href="#cite_ref4">^</a> <a href="https://www.aliexpress.com/item/1005006299730562.html" target="_blank">MHP50-B5</a>&nbsp;on AliExpress.</li>
<li id="cite_note5"><a href="#cite_ref5">^</a> <a href="https://thepihut.com/products/adafruit-black-nylon-screw-and-stand-off-set-m2-5-thread" target="_blank">Black Nylon Screw and Stand-off Set &ndash; M2.5 Thread</a> on The Pi-Hut.</li>
<li id="cite_note6"><a href="#cite_ref6">^</a> <a href="https://www.sparkfun.com/sparkfun-ftdi-basic-breakout-3-3v.html" target="_blank">SparkFun FTDI Basic Breakout - 3.3V</a>&nbsp;on Sparkfun.</li>
</ol>
]]></description>
<pubDate>Sat, 05 Sep 2026 23:00:00 GMT</pubDate>
<guid isPermaLink="true">http://www.technoblogy.com/show?5QE2</guid>
</item>
<item>
<title>IR NeoPixel Controller Dongle</title>
<description><![CDATA[<p>This is a NeoPixel driver, controlled by an infrared remote control, that fits on a small USB dongle that plugs into a USB-C power adapter to power the LEDs:</p>
<p class="center"><img src="http://www.technoblogy.com/pictures/kvm/irneopixeldongle.jpg" alt="IRNeoPixelDongle.jpg" width="720" height="350" /></p>
<p style="text-align: center;"><em>The IR NeoPixel Controller, based on a Microchip AVR16DD20, plugs into a USB-C power adapter.</em></p>
<p>It will drive a chain of several high-power NeoPixel LEDs; for example, to provide controllable illumination in a room. The IR remote control lets you control the hue, saturation, and brightness of each RGB LED independently, or alternatively set them all to the same settings. You can also switch off and on all the lights, or animate the lights with slowly-changing hue.</p>
<p>A status LED on the board gives feedback about the settings, and the settings are stored in EEPROM, so if you disconnect and reconnect the power the LEDs remember their previous settings.</p>
<p>It's based on an AVR16DD20 and a TSOP6138 infrared receiver module, and is a PCB version of my earlier project&nbsp;<a class="auto" href="http://www.technoblogy.com/show?5H4W">IR NeoPixel Controller</a>.&nbsp;</p>
<h3 id="design">Design</h3>
<p>The circuit consists of four components: the NeoPixel LEDs, a USB-C power adapter, the NeoPixel driver, and the IR remote control receiver.</p>
<h4 id="highpower-neopixel-leds">High-power NeoPixel LEDs</h4>
<p>For the LEDs I chose Adafruit's 3 watt chainable NeoPixel LEDs, that use WS2811 NeoPixel-protocol controllers to drive a high-power RGB LED mounted on an aluminium heatsink <sup id="cite_ref1"><a href="#cite_note1">[1]</a></sup>. To use these leave the #<strong>define</strong> at the start of the program set to <strong>RGB</strong>.</p>
<p>Alternatively you can use the 4 watt RGBW versions <sup id="cite_ref2"><a href="#cite_note2">[2]</a></sup>, which are available in warm white, natural white, or cool white. To use these set the <strong>#define</strong> at the start of the program to <strong>RGBW.</strong></p>
<p><strong>Warning!</strong> These high-power NeoPixel LEDs are extremely bright. When using them for room illumination I recommend using a reflector to direct them at the ceiling, or a translucent globe light fitting <sup id="cite_ref3"><a href="#cite_note3">[3]</a></sup>.</p>
<p>The high-power LEDs should be mounted on a heatsink to avoid overheating at maximum brightness; they shouldn't get too hot to touch comfortably. I used a square 50 x 50 x 15mm black&nbsp;finned heatsink, available from eBay or AliExpress <sup id="cite_ref4"><a href="#cite_note4">[4]</a></sup>.</p>
<p>The IR NeoPixel Controller Dongle will also drive standard&nbsp;WS2812 or WS2812B&nbsp;NeoPixel LEDs daisy-chained together. To control more than nine LEDs change the value of <strong>NumPixels</strong> at the start of the program.</p>
<h4 id="power-adapter">Power adapter</h4>
<p>The IR NeoPixel Controller Dongle is designed to plug into a USB-C power adapter to derive the 5V supply it needs. I used the Apple A2344 20W power adapter which provides 5V at 3.0A, and is beautifully designed with folding prongs for UK power sockets:</p>
<p class="center"><img src="http://www.technoblogy.com/pictures/kvm/irneopixelusb.jpg" alt="IRNeoPixelUSB.jpg" width="720" height="250" /></p>
<p style="text-align: center;"><em>The IR NeoPixel Controller Dongle powered by an Apple USB-C power adapter,<br /> and controlling a high-power 3W NeoPixel RGB LED.</em></p>
<p>All USB-C power adapters provide 5V at at least 1.5A, so any make or model should be suitable.</p>
<h4 id="neopixel-driver">NeoPixel driver</h4>
<p>To drive the LED modules I used a version of my NeoPixel driver described in the earlier article&nbsp;<a class="auto" href="http://www.technoblogy.com/show?5CKL">NeoPixel Driver Program 3</a>. This uses a Timer/Counter in the AVR processor to generate the waveforms needed by the NeoPixel protocol, and the SPI peripheral to output them as a serial stream, rather than the software approach used by many other NeoPixel interfaces. It's capable of driving up to about 160 NeoPixel displays, subject to the power available from the power adapter, but by default the IR NeoPixel Controller Dongle program limits it to nine to match the number of buttons available on the IR remote.</p>
<h4 id="ir-remote-control-receiver">IR remote control receiver</h4>
<p>The IR remote control receiver&nbsp;is designed to work with remote controls that use the NEC protocol, like many low cost infrared remotes available from the Far East. The remote control I used is available from Adafruit <sup id="cite_ref5"><a href="#cite_note5">[5]</a></sup>, or their distributors such as The Pi-Hut in the UK&nbsp;<sup id="cite_ref6"><a href="#cite_note6">[6]</a></sup>. The NEC protocol is also used by the Apple Remote&nbsp;<sup id="cite_ref7"><a href="#cite_note7">[7]</a></sup>, so if you have one of those you could use it. If you want to use a different remote control you can find its key codes as described below: <a href="#finding-codes-for-ir-remote">Finding the codes for an IR remote</a>.</p>
<h3 id="using-the-ir-neopixel-controller">Using the IR NeoPixel Controller</h3>
<p>The following diagram shows the function of each key on the Adafruit remote control:</p>
<p class="center"><img src="http://www.technoblogy.com/pictures/kvm/adafruitremoteannotated.jpg" alt="AdafruitRemoteAnnotated.jpg" width="363" height="356" /></p>
<p>Initially all the LEDs will be off, at minimum brightness, the saturation will be at maximum, and the remote control will control the first LED.</p>
<ul>
<li>To control the LEDs individually press the corresponding number key, 1 to 9. To control all the LEDs as a global set press 0. The settings for the individual LEDs and the global set are stored separately.</li>
<li>To control the brightness press or hold down <img src="http://www.technoblogy.com/pictures/kvm/up.gif" alt="Up.gif" width="13" height="11" />&nbsp;or <img src="http://www.technoblogy.com/pictures/kvm/down.gif" alt="Down.gif" width="13" height="11" />. The status LED flashes when you reach minimum or maximum brightness.</li>
<li>To change the hue (colour) press or hold down <img src="http://www.technoblogy.com/pictures/kvm/left.gif" alt="Left.gif" width="11" height="13" />&nbsp;or <img src="http://www.technoblogy.com/pictures/kvm/right.gif" alt="Right.gif" width="11" height="13" />. The hue goes in the sequence: red, yellow, green, cyan, blue, magenta, and back to red.</li>
<li>To change the saturation press or hold down <strong>VOL-</strong> or <strong>VOL+</strong>. Reducing the saturation dilutes the colour with white.&nbsp;The status LED flashes when you reach minimum or maximum saturation.</li>
<li>To turn off all the NeoPixels press <strong>STOP</strong>. Press it again to revert to their previous settings.</li>
<li>To animate the hue press&nbsp;<img src="http://www.technoblogy.com/pictures/kvm/play.gif" alt="Play.gif" width="16" height="13" />. The hue will change slowly over a period of two minutes. Press <img src="http://www.technoblogy.com/pictures/kvm/play.gif" alt="Play.gif" width="16" height="13" />&nbsp;to turn off the animation. Adjusting the hue also cancels the animation.</li>
</ul>
<p>The settings are saved automatically every 10 seconds.</p>
<h3 id="the-circuit">The circuit</h3>
<p>Here's the circuit of the IR NeoPixel Controller PCB:</p>
<p class="center"><img src="http://www.technoblogy.com/pictures/kvm/irneopixelcontrollerpcb.gif" alt="IRNeoPixelControllerPCB.gif" width="606" height="327" /></p>
<p style="text-align: center;"><em>Circuit for the IR NeoPixel Controller Dongle.</em></p>
<h4 id="infrared-receiver">Infrared receiver</h4>
<p>The circuit uses an SMD version of the popular TSOP38238 38kHz infrared receiver module, the TSOP6138.</p>
<h4 id="microcontroller">Microcontroller</h4>
<p>To fit the circuit on a small PCB I switched from the 14-pin SOIC processor used in the breadboard version to a VQFN AVR16DD20. Despite having more pins this is substantially smaller; in fact it's one of the smallest processors Microchip manufacture, at only 3mm square. You could also use a VQFN AVR32DD20.</p>
<p>Here's the parts list (click to expand):</p>
<details id="parts-list"> <summary>Parts list</summary>
<table class="new">
<tbody>
<tr>
<td><strong>Qty</strong></td>
<td><strong>Item</strong></td>
<td><strong>Value</strong></td>
<td><strong>Size</strong></td>
<td><strong>Typical parts</strong></td>
</tr>
<tr>
<td>1</td>
<td>SMD resistor</td>
<td>220&Omega;</td>
<td>0805</td>
<td><a href="https://uk.farnell.com/yageo/rc0805jr-07220rl/res-220r-5-0-125w-0805-thick-film/dp/9233920" target="_blank">Yageo RC0805JR-07220RL</a></td>
</tr>
<tr>
<td>1</td>
<td>SMD resistor</td>
<td>330&Omega;</td>
<td>0805</td>
<td><a href="https://uk.farnell.com/yageo/rc0805jr-07330rl/res-330r-5-0-125w-0805-thick-film/dp/9233946" target="_blank">Yageo&nbsp;RC0805JR-07330RL</a></td>
</tr>
<tr>
<td>1</td>
<td>SMD resistor</td>
<td>470&Omega;</td>
<td>0805</td>
<td><a href="https://uk.farnell.com/yageo/rc0805jr-07470rl/res-470r-5-0-125w-0805-thick-film/dp/9233962" target="_blank">Yageo RC0805JR-07470RL</a></td>
</tr>
<tr>
<td>1</td>
<td>SMD resistor</td>
<td>5.1k&Omega;</td>
<td>0805</td>
<td><a href="https://uk.farnell.com/yageo/rc0805jr-075k1l/res-5k1-5-0-125w-0805-thick-film/dp/3496134" target="_blank">Yageo RC0805JR-075K1L</a></td>
</tr>
<tr>
<td>1</td>
<td>Ceramic capacitor</td>
<td>0.1&micro;F</td>
<td>0805</td>
<td><a href="https://uk.farnell.com/yageo/cc0805krx7r8bb104/cap-0-1-f-25v-10-x7r-0805/dp/644249" target="_blank">Yageo&nbsp;CC0805KRX7R8BB104</a></td>
</tr>
<tr>
<td>1</td>
<td>Ceramic capacitor</td>
<td>100&micro;F 10V</td>
<td>1210</td>
<td><a href="https://www.mouser.co.uk/en/ProductDetail/81-GRM32ER61A107ME0L" target="_blank">GRM32ER61A107ME20L</a></td>
</tr>
<tr>
<td>1</td>
<td>LED</td>
<td>Red</td>
<td>0805</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>1</td>
<td>Microcontroller</td>
<td>AVR16DD20</td>
<td>VQFN-20</td>
<td><a href="https://www.digikey.co.uk/en/products/detail/microchip-technology/AVR16DD20T-I-REB/21265867" target="_blank">AVR16DD20T-I/REB</a></td>
</tr>
<tr>
<td>1</td>
<td>IR receiver</td>
<td>TSOP6138</td>
<td>&nbsp;</td>
<td><a href="https://www.mouser.co.uk/en/ProductDetail/782-TSOP6138" target="_blank">TSOP6138</a></td>
</tr>
<tr>
<td>1</td>
<td>USB-C</td>
<td>SMD</td>
<td>Plug</td>
<td><a href="https://www.adafruit.com/product/4932" target="_blank">Edge-Launch USB Type C SMT Plug</a></td>
</tr>
<tr>
<td>1</td>
<td>Terminal Block *</td>
<td>3-way</td>
<td>0.1" Pitch</td>
<td><a href="https://www.digikey.co.uk/en/products/detail/gct/TBC05-03-1-G-G/26408859" target="_blank">TBC05-03-1-G-G</a></td>
</tr>
<tr>
<td>1</td>
<td>PCB</td>
<td>Double-sided</td>
<td>14.0 x 22.2mm</td>
<td>&nbsp;</td>
</tr>
</tbody>
</table>
<p>* Optional&nbsp;</p>
</details>
<h3 id="construction">Construction</h3>
<p>I designed a PCB in Eagle and sent it to PCBWay for production. There's a link at the end of the article if you want to make yourself some boards.</p>
<p>The VQFN package is very tricky to solder because the spacing of the pads is only 0.4mm. I recommend soldering it on its own, before adding the other components, as follows:</p>
<ul>
<li>Use a pin to make a thin worm of solder paste along the four rows of pads. I use Chip Quik SMD291AX10T3 solder paste. Time spent getting the line of solder paste thin and even saves time later sorting out solder bridges. Also put a dot of solder paste on the centre pad of the chip. Then drop the chip in place with a pair of tweezers, if necessary giving it a few taps to position it. I use Rhino SW-11 tweezers&nbsp;<sup id="cite_ref8"><a href="#cite_note8">[8]</a></sup>.</li>
<li>Melt the solder with a hot air gun or hotplate. I use a Miniware MHP50-B5 50x50mm hotplate <sup id="cite_ref9"><a href="#cite_note9">[9]</a></sup>&nbsp;<sup id="cite_ref10"><a href="#cite_note10">[10]</a></sup>&nbsp;at 235&deg;C.</li>
<li>When it has cooled down examine the result under a magnifying glass to check for any solder bridges. I use an Engineer illuminated PCB inspection loupe <sup id="cite_ref11"><a href="#cite_note11">[11]</a></sup>.</li>
</ul>
<p>Then add the remaining components. When placing the USB-C connector put a blob of solder paste on each of the eight square pads, as these anchor the connector to the board. I used a spare board to support the front of the USB-C connector on the hotplate.</p>
<h3 id="testing">Testing</h3>
<p>My recommended procedure for testing the board is as follows:</p>
<ul>
<li>Connect +5V and GND to the appropriate terminals at the base of the board while monitoring the current consumption. With a fresh AVR16DD20 the current should be about 1.2mA. Substantially more indicates a possible solder bridge. Substantially less probably indicates a poor connection to the VCC or GND pins on the&nbsp;AVR16DD20.</li>
<li>Connect a UPDI programmer to the +5V and GND terminals at the base of the board and the UPDI terminal at the edge of the board, and do <strong>Burn Bootloader</strong> as described below in <a href="#installing-the-program">Installing the program</a>. This checks that UPDI programming succeeds.</li>
<li>Upload the following test program which checks the connection to the Status LED and NeoPixel DI output, and the link between PA1 and PA6:</li>
</ul>
<pre>void setup() {
  pinMode(PIN_PC3, OUTPUT);
  pinMode(PIN_PD5, OUTPUT);
  pinMode(PIN_PA1, OUTPUT);
  pinMode(PIN_PA6, INPUT);
}

void loop() {
  digitalWrite(PIN_PA1, HIGH);
  digitalWrite(PIN_PD5, digitalRead(PIN_PA6));
  digitalWrite(PIN_PC3, HIGH);
  delay(1000);
  digitalWrite(PIN_PA1, LOW);
  digitalWrite(PIN_PD5, digitalRead(PIN_PA6));
  digitalWrite(PIN_PC3, LOW);
  delay(1000);
}</pre>
<p>The LED should flash, and the NeoPixel output DI should toggle between V<sub>CC</sub> and GND.</p>
<ul>
<li>Plug the USB-C connector into a USB-C breakout board <sup id="cite_ref12"><a href="#cite_note12">[12]</a></sup> and check for continuity between the USB GND pin and the &ndash; pin on the terminal block, and between the USB VBUS pin and the + pin on the terminal block.</li>
<li>Upload the IR NeoPixel Controller program, connect a NeoPixel,&nbsp;plug the USB-C connector into a USB-C power adapter, and check that you can control the NeoPixel with an IR remote control.</li>
</ul>
<p>I built three prototypes, and the most common problem I found was a pin on the microcontroller or USB-C connector not making contact with the corresponding pad. The solution is to put a small blob of solder paste on the edge of the pad, where it extends beyond the microcontroller, and then reflow it on the hotplate.</p>
<h3 id="the-program">The program</h3>
<p>The program is essentially the same as the breadboard version described in&nbsp;<a class="auto" href="http://www.technoblogy.com/show?5H4W">IR NeoPixel Controller</a>, but with the following changes to reflect the fact that it's based on the AVR16DD20 in a 20-pin VQFN package:</p>
<ul>
<li>The IR Receiver is now connected to PC2, so the statement to configure the pin-change interrupt needs to change to:</li>
</ul>
<pre style="margin-left: 18px;">PORTC.PIN2CTRL = PORT_PULLUPEN_bm | PORT_ISC_FALLING_gc;// Interrupt falling edge</pre>
<p style="padding-left: 18px;">The Interrupt Service Routine needs to change to PORTC_PORT_vect, and the interrupt flag is cleared with:</p>
<pre style="margin-left: 18px;">PORTC.INTFLAGS = PIN2_bm;                               // Clear interrupt flag</pre>
<ul>
<li>On the AVR16DD20 we can use the default positions of MOSI, MISO, SCK, and SS on PA4 to PA7, so the following statement isn't necessary:</li>
</ul>
<pre style="margin-left: 18px;">PORTMUX.SPIROUTEA = PORTMUX_SPI0_ALT4_gc;               // PD4, PD5, PD6, PD7</pre>
<p style="padding-left: 18px;">and the MISO pin is configured as an output with:</p>
<pre style="margin-left: 18px;">PORTA.DIRSET = PIN5_bm;                                 // MISO output</pre>
<ul>
<li>Now that MISO is on PA5 we have to use events CHANNEL0 to copy it to LUT1 IN2:</li>
</ul>
<pre style="margin-left: 18px;">EVSYS.CHANNEL0 = EVSYS_CHANNEL0_PORTA_PIN5_gc;          // Link PA5 ...
EVSYS.USERCCLLUT1A = EVSYS_USER_CHANNEL0_gc;            // ... to LUT1 EVENTA</pre>
<ul>
<li>We need to use events to copy PC1 to PA7, with:</li>
</ul>
<pre style="margin-left: 18px;">PORTMUX.EVSYSROUTEA = PORTMUX_EVOUTA_ALT1_gc;           // EVOUTA on PA7
EVSYS.CHANNEL3 = EVSYS_CHANNEL3_PORTC_PIN1_gc;          // Link PC1 ...
EVSYS.USEREVSYSEVOUTA = EVSYS_USER_CHANNEL3_gc;         // ... and PA7</pre>
<ul>
<li>The status indicator LED is on PD5 on this circuit, so it needs to be set as an output with:</li>
</ul>
<pre style="margin-left: 18px;">PORTD.DIRSET = PIN5_bm; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // PD5 Status output</pre>
<p style="padding-left: 18px;">and the routine to toggle it is:</p>
<pre style="margin-left: 18px;">void Status (bool on) {
  if (on) PORTD.OUTSET = PIN5_bm; else PORTD.OUTCLR = PIN5_bm;
} </pre>
<p>Otherwise the program is the same.</p>
<h3 id="installing-the-program">Installing the program</h3>
<p>First install Spence Konde's DxCore from GitHub: see <a href="https://github.com/SpenceKonde/DxCore/blob/master/Installation.md" target="_blank">DxCore - Installation</a>. I used version 1.5.11. Do not use DxCore 1.6.2; it will brick the chip <sup id="cite_ref13"><a href="#cite_note13">[13]</a></sup>.</p>
<p>Then, in the Arduino IDE:</p>
<ul>
<li>Choose the&nbsp;<strong>AVR DD-series (no bootloader)</strong>&nbsp;option under the&nbsp;<strong>DxCore</strong>&nbsp;heading on the&nbsp;<strong>Board</strong> menu.</li>
<li>Check that the subsequent options are set as follows (ignore any other options):</li>
</ul>
<p style="padding-left: 18px;"><strong>Board: "</strong><strong>AVR DD-series (no bootloader)</strong><strong>"</strong><br /><strong>Chip: "AVR16DD20"<br />Clock Speed: "24 MHz internal"<br /></strong></p>
<p style="padding-left: 18px;">You can leave the other options at their defaults, the first option on each submenu.</p>
<ul>
<li>Connect a UPDI programmer to the&nbsp;<strong>UPDI</strong> pin on the side of the PCB,&nbsp;and the&nbsp;<strong>GND</strong>&nbsp;and<strong> VDD&nbsp;</strong>pins on the terminal block.</li>
</ul>
<p>To program the processor the recommended option is to use a 5V or 3.3V USB to Serial board, such as the SparkFun FTDI Basic board&nbsp;<sup id="cite_ref14"><a href="#cite_note14">[14]</a></sup>, or a USB to Serial cable&nbsp;<sup id="cite_ref15"><a href="#cite_note15">[15]</a></sup>, connected with&nbsp;a Schottky diode as follows. You can substitute a 4.7k&Omega; resistor for the Schottky diode:</p>
<p class="center"><img src="http://www.technoblogy.com/pictures/kvm/serialupdiprogschottky.gif" alt="SerialUPDIProgSchottky.gif" width="395" height="147" /></p>
<ul>
<li>Set&nbsp;<strong>Programmer</strong>&nbsp;to the&nbsp;<strong>"SerialUPDI - Normal: 230400 baud (recommended)"</strong> option.</li>
<li>Select the USB port corresponding to the USB to Serial board in the <strong>Port</strong> menu.</li>
</ul>
<ul>
<li>Select <strong>Burn Bootloader</strong> to reset the fuses to their defaults.</li>
<li>Click <strong>Upload</strong> to upload the program to the AVR16DD20.</li>
</ul>
<h3 id="resources">Resources</h3>
<p>Here's the IR NeoPixel Controller Dongle program:&nbsp;<a href="http://www.technoblogy.com/list?5R1L">IR NeoPixel Controller Dongle Program</a>.</p>
<p>Get the Eagle or Gerber files for the PCB here:&nbsp;<a href="https://github.com/technoblogy/ir-neopixel-controller" target="_blank">https://github.com/technoblogy/ir-neopixel-controller</a>.</p>
<p>Or order boards from OSH Park here:&nbsp;<a href="https://oshpark.com/shared_projects/Ege9mGAa" target="_blank">IR NeoPixel Controller</a>.</p><hr>
<ol>
<li id="cite_note1"><a href="#cite_ref1">^</a> <a href="https://www.adafruit.com/product/4544" target="_blank">Ultra Bright 3 Watt Chainable NeoPixel LED </a>on Adafruit.</li>
<li id="cite_note2"><a href="#cite_ref2">^</a> <a href="https://www.adafruit.com/product/5408" target="_blank">Ultra Bright 4 Watt RGBW NeoPixel LED</a> on Adafruit.</li>
<li id="cite_note3"><a href="#cite_ref3">^</a> <a href="https://www.lightbulbs-direct.com/firstlight-sphere-traditional-style-15cm-flush-ceiling-light-in-white-and-opal-glass/" target="_blank">Firstlight Sphere 15cm Flush Ceiling Light</a> on Lightbulbs Direct.</li>
<li id="cite_note4"><a href="#cite_ref4">^</a> <a href="https://www.aliexpress.com/item/1005009131954149.html" target="_blank">High Quality 50*50*15MM New Aluminum Heatsink</a> on AliExpress.</li>
<li id="cite_note5"><a href="#cite_ref5">^</a> <a href="https://www.adafruit.com/product/389" target="_blank">Mini Remote Control</a>&nbsp;on Adafruit.</li>
<li id="cite_note6"><a href="#cite_ref6">^</a> <a href="https://thepihut.com/products/mini-remote-control" target="_blank">Mini IR Remote Control</a> on The Pi Hut.</li>
<li id="cite_note7"><a href="#cite_ref7">^</a> <a href="http://en.wikipedia.org/wiki/Apple_Remote" target="_blank">Apple Remote</a>&nbsp;on Wikipedia.</li>
<li id="cite_note8"><a href="#cite_ref8">^</a> <a href="https://www.adafruit.com/product/3096" target="_blank">Rhino SW-11 Tweezers</a>&nbsp;on Adafruit.</li>
<li id="cite_note9"><a href="#cite_ref9">^</a> <a href="https://www.adafruit.com/product/5903" target="_blank">MHP50-B5</a> on Adafruit.</li>
<li id="cite_note10"><a href="#cite_ref10">^</a> <a href="https://www.aliexpress.com/item/1005006299730562.html" target="_blank">MHP50-B5</a> on AliExpress.</li>
<li id="cite_note11"><a href="#cite_ref11">^</a> <a href="https://thepihut.com/products/engineer-sl-71-illuminated-pcb-inspection-loupe-10x" target="_blank">Engineer SL-71 Illuminated PCB Inspection Loupe</a> on The Pi Hut.</li>
<li id="cite_note12"><a href="#cite_ref12">^</a> <a href="https://www.adafruit.com/product/4090" target="_blank">USB Type C Breakout Board</a> on Adafruit.</li>
<li id="cite_note13"><a href="#cite_ref13">^</a> See <a href="https://github.com/SpenceKonde/DxCore/issues/629" target="_blank">GitHub Issue 629.</a></li>
<li id="cite_note14"><a href="#cite_ref14">^</a> <a href="https://www.sparkfun.com/products/9716" target="_blank">SparkFun FTDI Basic Breakout - 5V</a>&nbsp;on Sparkfun.</li>
<li id="cite_note15"><a href="#cite_ref15">^</a> <a href="https://www.adafruit.com/product/70" target="_blank">FTDI Serial TTL-232 USB Cable</a>&nbsp;on Adafruit.</li>
</ol>
]]></description>
<pubDate>Mon, 20 Jul 2026 23:00:00 GMT</pubDate>
<guid isPermaLink="true">http://www.technoblogy.com/show?5O8R</guid>
</item>
</channel>
</rss>
