<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Nerd Corner</title>
	<atom:link href="https://nerd-corner.com/feed/" rel="self" type="application/rss+xml" />
	<link>https://nerd-corner.com/</link>
	<description>Craft your dreams!</description>
	<lastBuildDate>Tue, 19 Aug 2025 16:23:11 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.2</generator>

<image>
	<url>https://nerd-corner.com/wp-content/uploads/2019/10/cropped-LogoNerdCorner-2-32x32.png</url>
	<title>Nerd Corner</title>
	<link>https://nerd-corner.com/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>DIY solar panel mount for 2W panels</title>
		<link>https://nerd-corner.com/diy-solar-panel-mount-for-2w-panels/</link>
					<comments>https://nerd-corner.com/diy-solar-panel-mount-for-2w-panels/#respond</comments>
		
		<dc:creator><![CDATA[Nerds]]></dc:creator>
		<pubDate>Sun, 22 Jun 2025 17:57:13 +0000</pubDate>
				<category><![CDATA[Handcrafted]]></category>
		<category><![CDATA[SolidWorks]]></category>
		<category><![CDATA[2W solar panel]]></category>
		<category><![CDATA[3D print]]></category>
		<category><![CDATA[CAD]]></category>
		<category><![CDATA[CAD design]]></category>
		<category><![CDATA[case]]></category>
		<category><![CDATA[DIY]]></category>
		<category><![CDATA[guide]]></category>
		<category><![CDATA[mount]]></category>
		<category><![CDATA[mounting system]]></category>
		<category><![CDATA[Solar panel]]></category>
		<category><![CDATA[Solid Works]]></category>
		<category><![CDATA[Step by step guide]]></category>
		<category><![CDATA[STL]]></category>
		<guid isPermaLink="false">https://nerd-corner.com/de/?p=1727</guid>

					<description><![CDATA[<p>Often you don&#8217;t need a large power source to reliably charge an 18650 battery. Unfortunately, suitable, small solar panels are difficult to find &#8211; many &#8230; </p>
<p>The post <a href="https://nerd-corner.com/diy-solar-panel-mount-for-2w-panels/">DIY solar panel mount for 2W panels</a> appeared first on <a href="https://nerd-corner.com">Nerd Corner</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Often you don&#8217;t need a large power source to reliably charge an 18650 battery. Unfortunately, suitable, small solar panels are difficult to find &#8211; many are polycrystalline, have no housing or are merely laminated and fitted with simple eyelets for fastening. However, this is rarely ideal for stable and weatherproof outdoor installation. If you want a clean, durable installation, you need a robust housing with an adjustable bracket. For my outdoor applications, an output of around 1.5 watts is usually sufficient &#8211; a monocrystalline 2-watt panel with a corresponding solar panel mount is exactly the right choice.<i></i></p>
<p data-start="155" data-end="778"><img fetchpriority="high" decoding="async" class="zoooom aligncenter wp-image-1714" src="https://nerd-corner.com/wp-content/uploads/2025/06/solarpanel-stand.jpg" alt="" width="716" height="800" srcset="https://nerd-corner.com/wp-content/uploads/2025/06/solarpanel-stand.jpg 1393w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanel-stand-268x300.jpg 268w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanel-stand-916x1024.jpg 916w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanel-stand-768x858.jpg 768w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanel-stand-1374x1536.jpg 1374w" sizes="(max-width: 716px) 100vw, 716px" /></p>
<p data-start="155" data-end="778"><em><strong>This might also be interesting for you: </strong><a href="https://nerd-corner.com/diy-powerbank-with-voltage-regulator-and-voltmeter/">Do it yourself powerbank with voltage regulator and voltmeter</a></em></p>
<h2>Planning and choice of material</h2>
<p>Before I start building, I first think about where the solar panels should be mounted: One on the garden shed, two on the balcony railing and one on the weather station mast.</p>
<p>The garden shed has a straight wooden wall, which makes a flat bracket necessary. The balcony railing and the mast, on the other hand, each have a diameter of 30 mm &#8211; a bracket with a rounding is required here. So I currently need two different types of mounting.</p>
<p>I use a monocrystalline 2-watt module with an output voltage of around 6 V as the solar panel (see Figure 1.0.1). For the electrical connection to the panel, I opted for a standard 5.5×2.1 mm hollow socket (see Fig. 1.0.2). Cables and screws are not included in the illustration as they may vary depending on the application. The panels are available in packs of five or ten from various online retailers. Their dimensions are 120 × 110 mm (length × width), whereby the height can vary between 1.3 mm and 1.8 mm.<i></i></p>
<p><img decoding="async" class="aligncenter wp-image-1713 zoooom" src="https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter1.jpg" alt="" width="2276" height="1330" srcset="https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter1.jpg 2279w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter1-300x175.jpg 300w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter1-1024x598.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter1-768x449.jpg 768w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter1-1536x898.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter1-2048x1197.jpg 2048w" sizes="(max-width: 2276px) 100vw, 2276px" /></p>
<h2>Construction of the housing</h2>
<p>The central component for the solar panel mount is the frame. It provides both the stability and the sealing function of the housing. The frame must be torsion-resistant, be able to accommodate all the necessary threads and still remain compact. The solar panel is pressed into its seat from behind with strips so that it is tightly sealed at the front.<br />
Several screws are required to create an even contact pressure (see Figure 2.0.1).</p>
<p>There is a cover on the back (Fig. 2.0.2), which is reinforced in an X shape for stability. This cover also accommodates the hollow bushing (5.5 × 2.1 mm), which is later attached with a small bridge. One of the four pressure bars that press the panel into the frame can be seen in Figure 2.0.3. The joint holder (Fig. 2.0.4) is used to attach the panel to railings or walls. This serves as a holder for the retaining lever, which holds the housing securely in place and allows flexible alignment.</p>
<h2 data-start="175" data-end="204"><img decoding="async" class="aligncenter wp-image-1712 zoooom" style="font-family: 'Source Sans Pro', Graphik, -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif; font-size: 1.125rem;" src="https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter2.jpg" alt="" width="2265" height="1320" srcset="https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter2.jpg 2277w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter2-300x175.jpg 300w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter2-1024x597.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter2-768x448.jpg 768w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter2-1536x895.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter2-2048x1194.jpg 2048w" sizes="(max-width: 2265px) 100vw, 2265px" /></h2>
<p>Figure 2.1.1 shows the holding arm for railing attachment with a 30 mm diameter at the end. The counterpart for the holder can be seen in Fig. 2.1.2. The bridge (Fig. 2.1.3) for attaching the hollow bushing to the cover.</p>
<p><img loading="lazy" decoding="async" class="zoooom aligncenter wp-image-1711" src="https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter2-1.jpg" alt="Solarpanelhalterung CAD Teile" width="2276" height="1330" srcset="https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter2-1.jpg 2279w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter2-1-300x175.jpg 300w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter2-1-1024x598.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter2-1-768x449.jpg 768w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter2-1-1536x898.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter2-1-2048x1197.jpg 2048w" sizes="auto, (max-width: 2276px) 100vw, 2276px" /></p>
<h2>3D printing of the components</h2>
<p>For 3D printing, I chose the following print orientations for the Prusa MK4 (see Figures 3.0.1 and 3.0.2).<br />
Particularly important: The bar must of course be printed four times, as it is used on all four sides of the solar panel.</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1710 zoooom" src="https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter3.jpg" alt="" width="2265" height="1320" srcset="https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter3.jpg 2277w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter3-300x175.jpg 300w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter3-1024x597.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter3-768x448.jpg 768w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter3-1536x895.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter3-2048x1194.jpg 2048w" sizes="auto, (max-width: 2265px) 100vw, 2265px" /></p>
<h3>Thread cutting</h3>
<p>Now let&#8217;s move on to my favorite activity: thread cutting. Admittedly, there is a lot to do in the frame (see Figure 3.1.1): The green markings indicate 12× M3 threads, the yellow ones 4× M3 threads.</p>
<p>There is an alternative version of the frame for those who are not the biggest fans of thread cutting. This is equipped with slots to accommodate normal M3 nuts. The matching file is called: Deckel110x120_V1-2.stl (see Figure 3.1.3).<br />
The recesses for the nuts are also clearly visible in Figures 3.1.4 and 3.1.5.</p>
<p>On the back cover (Figure 3.1.2), however, the cutting of threads can hardly be avoided: 3× M3 threads and 2× M2 threads are required here.<br />
Alternatively, self-tapping screws can also be used &#8211; this saves tools and time.</p>
<h3 data-start="162" data-end="406"><img loading="lazy" decoding="async" class="aligncenter wp-image-1709 zoooom" style="font-family: 'Source Sans Pro', Graphik, -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif; font-size: 1.125rem;" src="https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter3-1.jpg" alt="" width="2276" height="1330" srcset="https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter3-1.jpg 2279w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter3-1-300x175.jpg 300w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter3-1-1024x598.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter3-1-768x449.jpg 768w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter3-1-1536x898.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter3-1-2048x1197.jpg 2048w" sizes="auto, (max-width: 2276px) 100vw, 2276px" /></h3>
<h2>Soldering and assembly</h2>
<p>Once all 3D printed parts have been cleaned and threaded, the solar panel can be connected and soldered.</p>
<h3>Electrical connections</h3>
<p>The first hurdle is to find out where the positive pole is located on the panel.<br />
There are only two soldering lugs on the back of the solar panel, but no labeling &#8211; so: plus or minus? To determine this quickly and clearly, we need a multimeter. If we set it to measure direct voltage (DC), it helps us to recognize the polarity.</p>
<p>Figure 4.0.1: The red wire (positive) of the multimeter is connected to one of the soldering lugs, the black wire (negative) to the other. If a minus sign appears in front of the measured value on the display, this means that the red wire is connected to the negative terminal &#8211; i.e. the opposite tab is the positive terminal of the solar panel.</p>
<p>Figure 4.0.2 shows the reverse configuration: the red wire is connected to the positive pole of the panel, the black wire to the negative pole. In this case, no minus sign appears in the display &#8211; the polarity is correct,<br />
and we now know for sure where the positive pole of the solar panel is.</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1708 zoooom" src="https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter4.jpg" alt="" width="2265" height="1320" srcset="https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter4.jpg 2277w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter4-300x175.jpg 300w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter4-1024x597.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter4-768x448.jpg 768w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter4-1536x895.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter4-2048x1194.jpg 2048w" sizes="auto, (max-width: 2265px) 100vw, 2265px" /></p>
<p>The hollow socket is now soldered to the solar panel. Figure 4.1.1 clearly shows which connections need to be connected.<br />
Figure 4.1.2 shows the finished soldering in the installed state.</p>
<p>I have also soldered a diode to the positive pole of the hollow socket (see Fig. 4.1.3).<br />
This protects against reverse current: if the connected load does not have its own protective diode, the solar panel would draw energy from the battery in the dark &#8211; and unintentionally work as a heater.</p>
<p>A typical example:<br />
If a charge controller does not have an integrated diode, the battery can discharge the panel backwards in the absence of sunlight.</p>
<p>The installation direction of the diode is crucial so that the current can only flow in one direction.</p>
<p data-start="79" data-end="137"><img loading="lazy" decoding="async" class="aligncenter wp-image-1707 zoooom" style="font-size: 1.125rem;" src="https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter4-1.jpg" alt="" width="2276" height="1330" srcset="https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter4-1.jpg 2279w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter4-1-300x175.jpg 300w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter4-1-1024x598.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter4-1-768x449.jpg 768w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter4-1-1536x898.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter4-1-2048x1197.jpg 2048w" sizes="auto, (max-width: 2276px) 100vw, 2276px" /></p>
<h3>Mounting the hollow bushing and inserting the panel</h3>
<p>The installation of the soldered hollow bushing on the retaining bridge is shown in Figure 4.2.1.<br />
The hollow bushing is pushed into the large opening of the retaining bridge until the thread protrudes on the other side. The nut is then placed on the thread and tightened &#8211; the result is shown in Figure 4.2.2. The solar panel is now inserted into the retaining seat of the frame (see Figure 4.2.3, red frame).<br />
If you want to increase the tightness, you can apply some elastic adhesive evenly to the seat before inserting the panel. Once the solar panel is correctly seated, the first strip is placed in position and lightly tightened with a screw in the middle (see Figure 4.2.4, magenta circle). A side view is shown in Figure 4.2.5 to illustrate this.</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1706 zoooom" src="https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter4-2.jpg" alt="" width="2264" height="1320" srcset="https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter4-2.jpg 2278w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter4-2-300x175.jpg 300w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter4-2-1024x597.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter4-2-768x448.jpg 768w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter4-2-1536x895.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter4-2-2048x1194.jpg 2048w" sizes="auto, (max-width: 2264px) 100vw, 2264px" /></p>
<h3>Fastening the slats and screwing</h3>
<p>The remaining slats are attached one by one with the screw in the middle (see figure 4.3.1). Then insert the remaining screws, but do not tighten them yet (see figure 4.3.2). When the solar panel is evenly positioned, first tighten the middle screws of each strip.<br />
Then tighten all the remaining screws and retighten them after a short time. If the solar panel still has some play, you can place some shims between the solar panel and the rail until it is firmly in place. Figure 4.3.3 shows how the hollow bushing and retaining bridge are attached to the inside of the back cover.<br />
Finally, the back cover is screwed onto the frame with four screws (see Fig. 4.3.4).</p>
<h3 data-start="62" data-end="294"><img loading="lazy" decoding="async" class="aligncenter wp-image-1705 zoooom" style="font-family: 'Source Sans Pro', Graphik, -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif; font-size: 1.125rem;" src="https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter4-3.jpg" alt="" width="2276" height="1330" srcset="https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter4-3.jpg 2279w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter4-3-300x175.jpg 300w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter4-3-1024x598.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter4-3-768x449.jpg 768w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter4-3-1536x898.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter4-3-2048x1197.jpg 2048w" sizes="auto, (max-width: 2276px) 100vw, 2276px" /></h3>
<p>Only a few steps are required to complete the bracket:<br />
First, the M6 nut is pressed into the joint bracket (see figure 4.4.1).<br />
The holder for the railing is then attached to the joint holder with an M6 screw (see Figure 4.4.2).<br />
The joint holder is now screwed to the back cover with three M3 screws.<br />
Do not forget: The M3 nuts must be pressed into the counterholder that will later be used for mounting on the railing (see figure 4.4.4).</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1704 zoooom" src="https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter4-4.jpg" alt="" width="2264" height="1320" srcset="https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter4-4.jpg 2278w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter4-4-300x175.jpg 300w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter4-4-1024x597.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter4-4-768x448.jpg 768w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter4-4-1536x895.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter4-4-2048x1194.jpg 2048w" sizes="auto, (max-width: 2264px) 100vw, 2264px" /></p>
<h2>Exploded view of the solar panel mount</h2>
<p>For a better overview, there is an exploded view of the solar panel holder in Figure 4.5.1.</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1703 zoooom" src="https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter4-5.jpg" alt="" width="2264" height="1320" srcset="https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter4-5.jpg 2278w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter4-5-300x175.jpg 300w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter4-5-1024x597.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter4-5-768x448.jpg 768w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter4-5-1536x895.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2025/06/solarpanelhalter4-5-2048x1194.jpg 2048w" sizes="auto, (max-width: 2264px) 100vw, 2264px" /></p>
<h3 data-start="73" data-end="322">Note</h3>
<p data-start="73" data-end="322">Of course, there are also alternative mounting options. For instance, in a garden flower bed, plants may grow over time and gradually shade the solar panel. In this case, a holder with an aluminum rod and ground spike can be used (see Fig. 5.0.1).</p>
<p data-start="324" data-end="477">On a balcony, the panel can be attached via flower boxes that cover the railing; here too, a holder with an aluminum rod is available (see Fig. 5.0.2).</p>
<p data-start="479" data-end="578">Additionally, a holder designed for mounting on a wall or post is also provided (see Fig. 5.0.3).</p>
<p><img decoding="async" src="https://elepla.de/images/Powerbank/2W_Solarpanel_Halterrahmen/5-0.jpg" alt="5 0" /></p>
<p data-start="72" data-end="154">Furthermore, I plan to design a solar panel holder with a built-in USB-C output.</p>
<p data-start="156" data-end="444">The solar panel is an excellent addition for powering my small devices and outdoor sensors – and this holds true even in winter! Depending on your needs, you can either assemble the cables yourself or purchase them ready-made. In any case, the rule of thumb is: the shorter, the better.</p>
<p data-start="446" data-end="559">Have fun building your own version – or perhaps this project has inspired you to create something entirely new.</p>
<h2>Files for Download</h2>
<ul>
<li><a href="https://www.thingiverse.com/thing:6835041">Housing for the solar panel mount</a></li>
</ul>
<p>The post <a href="https://nerd-corner.com/diy-solar-panel-mount-for-2w-panels/">DIY solar panel mount for 2W panels</a> appeared first on <a href="https://nerd-corner.com">Nerd Corner</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://nerd-corner.com/diy-solar-panel-mount-for-2w-panels/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Deployment of a WebApp with Kubernetes and Caddy</title>
		<link>https://nerd-corner.com/deployment-of-a-webapp-with-kubernetes-and-caddy/</link>
					<comments>https://nerd-corner.com/deployment-of-a-webapp-with-kubernetes-and-caddy/#respond</comments>
		
		<dc:creator><![CDATA[Nerds]]></dc:creator>
		<pubDate>Sun, 16 Feb 2025 18:31:48 +0000</pubDate>
				<category><![CDATA[Angular]]></category>
		<category><![CDATA[App development]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[angular]]></category>
		<category><![CDATA[Caddy]]></category>
		<category><![CDATA[Caddy Server]]></category>
		<category><![CDATA[Cluster]]></category>
		<category><![CDATA[ClusterIP]]></category>
		<category><![CDATA[ConfigMap]]></category>
		<category><![CDATA[Container]]></category>
		<category><![CDATA[Deployment]]></category>
		<category><![CDATA[Docker]]></category>
		<category><![CDATA[Domain]]></category>
		<category><![CDATA[Domain Registration]]></category>
		<category><![CDATA[Hetzner]]></category>
		<category><![CDATA[Images]]></category>
		<category><![CDATA[Ingress]]></category>
		<category><![CDATA[Ingress Controller]]></category>
		<category><![CDATA[ip addres]]></category>
		<category><![CDATA[K3s]]></category>
		<category><![CDATA[Kubectl]]></category>
		<category><![CDATA[Kubernetes]]></category>
		<category><![CDATA[LoadBalancer]]></category>
		<category><![CDATA[mySql]]></category>
		<category><![CDATA[Nest.js]]></category>
		<category><![CDATA[Node Port]]></category>
		<category><![CDATA[Pods]]></category>
		<category><![CDATA[Redis]]></category>
		<category><![CDATA[Reverse Proxy]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[Service]]></category>
		<category><![CDATA[Step by step guide]]></category>
		<category><![CDATA[Traefik]]></category>
		<guid isPermaLink="false">https://nerd-corner.com/de/?p=1695</guid>

					<description><![CDATA[<p>After describing how to create production-ready Docker images and upload them to Docker Hub in the last article, it is now time to make these &#8230; </p>
<p>The post <a href="https://nerd-corner.com/deployment-of-a-webapp-with-kubernetes-and-caddy/">Deployment of a WebApp with Kubernetes and Caddy</a> appeared first on <a href="https://nerd-corner.com">Nerd Corner</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>After describing how to create production-ready Docker images and upload them to Docker Hub in the last article, it is now time to make these images available on a server. The aim is to make the web application accessible to everyone via a dedicated domain. To do this, we use a virtual private server (VPS) from Hetzner and deploy Kubernetes (k3s) with Caddy as a reverse proxy.</p>
<p><strong><em>You might also be interested in this: </em></strong><a href="https://nerd-corner.com/create-docker-images-and-upload-them-to-docker-hub/"><em>Create Docker images and upload them to Dockerhub</em></a></p>
<h2>Set up a VPS with Hetzner</h2>
<p>Hetzner often offers referral links with credit benefits for new customers. Of course, you can also use other providers, but Hetzner is attractively priced and offers solid services.</p>
<h3>What is a VPS?</h3>
<p>A Virtual Private Server (VPS) is a virtual server that is operated on a physical machine and acts as an independent server. It offers more control than classic shared hosting and is a cost-effective alternative to dedicated servers. Access is usually via SSH (Secure Shell), which allows us to control the server via the command line.</p>
<h3>SSH access to the VPS</h3>
<p>Once a VPS has been created, it is usually managed via a secure shell (SSH). SSH is a protocol that enables encrypted connections to remote servers. The following command is used to connect to the server:</p>
<p data-start="1137" data-end="1384"><span style="background-color: #e9ebec; color: #222222; font-family: Monaco, Consolas, 'Andale Mono', 'DejaVu Sans Mono', monospace; font-size: 15px;">ssh root@&lt;IP-Server&gt;</span></p>
<p>If an SSH key has been stored, authentication can be carried out using public key authentication, which is more secure than a password.</p>
<h3>Create a server at Hetzner</h3>
<ol>
<li>After logging into the Hetzner Cloud, we navigate to “Projects” and create a new project.</li>
<li>Select “Add server” and can configure an instance.</li>
<li>The cheapest model is often sufficient to start with. However, I recommend activating the option for an IPv4 address, as purely IPv6-based setups often cause compatibility problems.</li>
</ol>
<h3>Setting up a domain</h3>
<p>To access the application later under your own domain, you must register a domain and link it to the server.</p>
<h3>Apply for a domain at Hetzner</h3>
<ol>
<li>Register a new domain or add an existing domain in the Hetzner ConsoleH.</li>
<li>To manage DNS entries, we need to activate DNS access.</li>
</ol>
<h3>Set name servers</h3>
<p>The following name servers should be used:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">helium.ns.hetzner.de. 
hydrogen.ns.hetzner.com. 
oxygen.ns.hetzner.com.</pre>
<p>These new name servers offer better performance and flexibility compared to the old Hetzner name servers:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">ns1.first-ns.de.
robotns2.second-ns.de.
robotns3.second-ns.com.</pre>
<p>However, both nameserver variants are possible! The DNS changes take some time. However, we can use tools such as MXToolbox to check whether the changes have already taken place.</p>
<h3>Connect the domain to the server</h3>
<p>Now the IP address of the server must be linked to the domain:</p>
<ol>
<li>Switch to DNS zones in the Hetzner Cloud.</li>
<li>Select the registered domain.</li>
<li>Create a new A-Record and enter the IPv4 address of the server.</li>
<li>If available, remove the IPv6 record (AAAA) to avoid compatibility problems.</li>
</ol>
<p>You can also use <a href="http://mxtoolbox.com">MXToolbox</a> to check whether the DNS changes have already been applied.</p>
<h2>Set up Kubernetes</h2>
<p>Kubernetes is a powerful orchestration tool for containers. I use k3s, a lean Kubernetes variant that is particularly suitable for smaller environments.</p>
<h3>Install K3s on the server</h3>
<p>Connect to the server via SSH and install k3s with the following command:</p>
<pre><code class="language-sh">curl -sfL https://get.k3s.io | sh - </code></pre>
<p>The script installs k3s and starts the Kubernetes service. After installation, k3s can be checked with the following command:</p>
<pre><code class="language-sh">kubectl get nodes
</code></pre>
<p>k3s comes with its own kubectl version, so that no separate installation is necessary.</p>
<h3>Create YAML files for FE, BE, MySQL and Redis</h3>
<p>To deploy our application, we need YAML files for:</p>
<ul>
<li>Frontend (Angular)</li>
<li>Backend (NestJS)</li>
<li>Database (MySQL)</li>
<li>Session-Management (Redis)</li>
</ul>
<p>A deployment file for the backend could look like this:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">apiVersion: apps/v1
kind: Deployment
metadata:
  name: backend
spec:
  replicas: 1
  selector:
    matchLabels:
      app: backend
  template:
    metadata:
      labels:
        app: backend
    spec:
      containers:
        - name: backend
          image: dockerhub-user/backend:latest
          ports:
            - containerPort: 3000
---
apiVersion: v1
kind: Service
metadata:
  name: backend-service
spec:
  selector:
    app: backend
  ports:
    - protocol: TCP
      port: 80
      targetPort: 3000
  type: ClusterIP
</pre>
<h3>What are deployments and services?</h3>
<ul>
<li>Deployments manage the provision and scaling of containers.</li>
<li>Services ensure a stable network connection between containers.</li>
<li>ClusterIP means that the service is only accessible within the Kubernetes cluster.</li>
</ul>
<h3>Set up Caddy as a reverse proxy</h3>
<p>A reverse proxy is required to ensure that incoming traffic is distributed correctly. K3s comes with Traefik by default, but I opted for a simpler solution: Caddy. I was really surprised how little guidance or documentation there is on Caddy in combination with Kubernetes.</p>
<h3>Why Kubernetes with Caddy?</h3>
<ul>
<li>Automatic Let&#8217;s Encrypt SSL certificates</li>
<li>Simple configuration via Caddyfile</li>
<li>Built-in load balancer</li>
</ul>
<h3>Remove Traefik</h3>
<pre><code class="language-sh">kubectl delete helmrelease traefik -n kube-system
</code></pre>
<h3>Create Caddy Deployment</h3>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">apiVersion: apps/v1
kind: Deployment
metadata:
  name: caddy
spec:
  replicas: 1
  selector:
    matchLabels:
      app: caddy
  template:
    metadata:
      labels:
        app: caddy
    spec:
      containers:
        - name: caddy
          image: caddy
          volumeMounts:
            - name: caddy-config
              mountPath: /etc/caddy/Caddyfile
      volumes:
        - name: caddy-config
          configMap:
            name: caddy-config
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: caddy-config
data:
  Caddyfile: |

    example.com {
        reverse_proxy backend-service:3000
    }

---
apiVersion: v1
kind: Service
metadata:
  name: caddy-service
spec:
  type: LoadBalancer
  selector:
    app: caddy
  ports:
    - port: 80
      targetPort: 80
    - port: 443
      targetPort: 443</pre>
<p>Important: Since Let&#8217;s Encrypt has a rate limit, tests should first be carried out with staging certificates!</p>
<h2>Conclusion</h2>
<p>After these steps, the application is now running in a Kubernetes cluster on a Hetzner VPS and can be accessed via its own domain. The next step would be to set up an automatic CI/CD pipeline to deploy new versions without manual effort.</p>
<p>The post <a href="https://nerd-corner.com/deployment-of-a-webapp-with-kubernetes-and-caddy/">Deployment of a WebApp with Kubernetes and Caddy</a> appeared first on <a href="https://nerd-corner.com">Nerd Corner</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://nerd-corner.com/deployment-of-a-webapp-with-kubernetes-and-caddy/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Create Docker images and upload them to Docker Hub</title>
		<link>https://nerd-corner.com/create-docker-images-and-upload-them-to-docker-hub/</link>
					<comments>https://nerd-corner.com/create-docker-images-and-upload-them-to-docker-hub/#respond</comments>
		
		<dc:creator><![CDATA[Nerds]]></dc:creator>
		<pubDate>Thu, 16 Jan 2025 18:16:16 +0000</pubDate>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[angular]]></category>
		<category><![CDATA[Backend]]></category>
		<category><![CDATA[Backend Server]]></category>
		<category><![CDATA[Docker]]></category>
		<category><![CDATA[Docker Hub]]></category>
		<category><![CDATA[Docker Images]]></category>
		<category><![CDATA[Docker Repository]]></category>
		<category><![CDATA[frontend]]></category>
		<category><![CDATA[google cloud mysql]]></category>
		<category><![CDATA[guide]]></category>
		<category><![CDATA[Images]]></category>
		<category><![CDATA[Kubernetes]]></category>
		<category><![CDATA[mySql]]></category>
		<category><![CDATA[Nest]]></category>
		<category><![CDATA[Nest.js]]></category>
		<category><![CDATA[Redis]]></category>
		<category><![CDATA[redis session management]]></category>
		<category><![CDATA[redis session management nest.js]]></category>
		<category><![CDATA[Repository]]></category>
		<category><![CDATA[Step by step guide]]></category>
		<guid isPermaLink="false">https://nerd-corner.com/de/?p=1691</guid>

					<description><![CDATA[<p>In this article, I will show you how to create production-ready Docker images for a web application with Angular, NestJS, MySQL and Redis and then &#8230; </p>
<p>The post <a href="https://nerd-corner.com/create-docker-images-and-upload-them-to-docker-hub/">Create Docker images and upload them to Docker Hub</a> appeared first on <a href="https://nerd-corner.com">Nerd Corner</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>In this article, I will show you how to create production-ready Docker images for a web application with Angular, NestJS, MySQL and Redis and then publish them on Docker Hub. The prerequisite is an installed Docker environment.</p>
<p><em><strong>You might also be interested in this: </strong><a href="https://nerd-corner.com/lessons-learned-hosting-nestjs-app-on-vercel/">Hosting NestJS on Vercel</a></em></p>
<h2>Creation of the Docker Compose Yml</h2>
<p>With Docker Compose, all components of an application can be defined via a single configuration file and built or started together.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">version: '3.8'

services:
  frontend:
    build: ./frontend
    ports:
      - "80:80"
    depends_on:
      - backend

  backend:
    build: ./backend
    ports:
      - "3000:3000"
    depends_on:
      - mysql
      - redis
    environment:
      - DATABASE_URL=mysql://user:password@mysql:3306/db
      - SESSION_STORE=redis://redis:6379

  mysql:
    image: mysql:8.0
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_DATABASE: db
    ports:
      - "3306:3306"

  redis:
    image: redis:latest
    ports:
      - "6379:6379"</pre>
<h2>Creating the env file</h2>
<p>To manage environment variables centrally, we create an .env file:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">DATABASE_URL=mysql://user:password@mysql:3306/db 
SESSION_STORE=redis://redis:6379</pre>
<p>Important: All ENV variables used in the code must also appear in docker-compose.yml!</p>
<h2>Docker image for the frontend</h2>
<p>The Angular frontend must be built for production. Here is an example Dockerfile:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">FROM node:20 AS build
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm install
COPY . .
RUN npm run build --prod

FROM nginx:alpine
COPY --from=build /app/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/nginx.conf</pre>
<p>Since we are dependent on nginx for the build, we also need a corresponding config file:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">server {
  listen 80;
  server_name _;

  location / {
    root /usr/share/nginx/html;
    index index.html;
    try_files $uri $uri/ /index.html;
  }
}</pre>
<h2>Docker image for the backend</h2>
<p>The NestJS backend also needs to be built. Here is an optimized Dockerfile.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic"># Build stage
FROM node:20 AS build
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm install
COPY . .
RUN npm run build

# Production stage
FROM node:20-alpine
WORKDIR /app

COPY --from=build /app/dist ./dist
COPY package.json package-lock.json ./
RUN npm install --only=production
CMD ["node", "dist/main.js"]</pre>
<h2>Building the app with Docker Compose</h2>
<p>Once all the Dockerfiles have been configured, the images can now be built. The whole thing is really easy with Docker compose.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">docker compose up -d --build</pre>
<p>The images are then ready, the containers are built and the app can be tested locally! The last step is to upload the images to DockerHub so that they can be used more easily later for deployment on a server.</p>
<h2>Uploading to Docker Hub</h2>
<p>Uploading is explained step by step below:</p>
<ol>
<li>Create an account on <a href="https://www.docker.com/products/docker-hub/">Dockerhub</a></li>
<li>Create a repository for the frontend and backend (1 private repo is currently free)</li>
<li>Build the images and tag them:
<pre class="EnlighterJSRAW" data-enlighter-language="generic">docker tag &lt;image-id&gt; dockerAccountName/frontend:latest
docker tag &lt;image-id&gt; dockerAccountName/backend:latest</pre>
</li>
<li>Sign up and push the images:
<pre class="EnlighterJSRAW" data-enlighter-language="generic">docker login
docker push dockerAccountName/frontend:latest
docker push dockerAccountName/backend:latest</pre>
</li>
</ol>
<h2>Outlook: Deployment with Kubernetes</h2>
<p>Now that the images are on Docker Hub, nothing stands in the way of deployment. I have opted for a Kubernetes cluster on a Hetzner VPS. <a href="https://nerd-corner.com/deployment-of-a-webapp-with-kubernetes-and-caddy/">More information here</a>.</p>
<p>The post <a href="https://nerd-corner.com/create-docker-images-and-upload-them-to-docker-hub/">Create Docker images and upload them to Docker Hub</a> appeared first on <a href="https://nerd-corner.com">Nerd Corner</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://nerd-corner.com/create-docker-images-and-upload-them-to-docker-hub/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>DIY keypad lock &#8211; 3D printing and code</title>
		<link>https://nerd-corner.com/diy-keypad-lock-3d-printing-and-code/</link>
					<comments>https://nerd-corner.com/diy-keypad-lock-3d-printing-and-code/#respond</comments>
		
		<dc:creator><![CDATA[Nerds]]></dc:creator>
		<pubDate>Tue, 17 Dec 2024 20:44:05 +0000</pubDate>
				<category><![CDATA[Arduino projects]]></category>
		<category><![CDATA[Handcrafted]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[SolidWorks]]></category>
		<category><![CDATA[3D print]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[barrel jack]]></category>
		<category><![CDATA[CAD]]></category>
		<category><![CDATA[CAD design]]></category>
		<category><![CDATA[case]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[DIY]]></category>
		<category><![CDATA[housing]]></category>
		<category><![CDATA[jumper cable]]></category>
		<category><![CDATA[keypad]]></category>
		<category><![CDATA[led]]></category>
		<category><![CDATA[lock]]></category>
		<category><![CDATA[precise]]></category>
		<category><![CDATA[Solid Works]]></category>
		<category><![CDATA[user guide]]></category>
		<guid isPermaLink="false">https://nerd-corner.com/de/?p=1677</guid>

					<description><![CDATA[<p>A cupboard that should always be locked and five people who need to access it &#8211; a classic challenge. The obvious solutions? Five keys in &#8230; </p>
<p>The post <a href="https://nerd-corner.com/diy-keypad-lock-3d-printing-and-code/">DIY keypad lock &#8211; 3D printing and code</a> appeared first on <a href="https://nerd-corner.com">Nerd Corner</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>A cupboard that should always be locked and five people who need to access it &#8211; a classic challenge. The obvious solutions? Five keys in circulation or a single person who manages the key so that you have to borrow it every time. But we&#8217;ve all been there: the key ends up lying in the cupboard, under the carpet or behind the flower pot.</p>
<p>But wouldn&#8217;t it be much more practical to do away with physical keys altogether? Nowadays, there are numerous ways to open a lock: Fingerprint scanners, facial recognition, NFC, numeric codes, dials &#8211; or, of course, brute force methods such as explosives and brute force. But if you are looking for an inexpensive, non-violent and simple solution, the keypad lock comes into focus.</p>
<p>Surprisingly, there are hardly any really good DIY solutions for hobbyists on the Internet. So I tackle it myself &#8211; my first keypad lock, which I simply call “Version 1”.</p>
<p><em><strong>This might also be interesting for you: </strong><a href="https://nerd-corner.com/diy-powerbank-with-voltage-regulator-and-voltmeter/">Do it yourself powerbank with voltage regulator and voltmeter</a></em></p>
<h2>Construction of the housing</h2>
<p>The initial focus is on the housing and the keypad holder. The first question that always arises is: How big should it be? The answer depends on several factors:</p>
<ul>
<li>Which components are required? Each component takes up space and influences the design.</li>
<li>How much space do the components take up? A compact design is advantageous, but must not restrict functionality.</li>
<li>What are the haptics and operability like? The keypad should be comfortable to use without being too cramped or impractical.</li>
</ul>
<p>These considerations form the basis for the housing design &#8211; because good planning saves time and nerves later on.</p>
<h3>What will be inside the housing?</h3>
<p>The central component is, of course, the membrane keypad (1.0.1). It has the following dimensions:</p>
<ul>
<li>Width: 69 mm</li>
<li>Length: 76 mm</li>
<li>Thickness: 0.6 mm (or 0.95 mm above the keys)</li>
</ul>
<p>The keypad also has a ribbon cable with DuPont sockets for connection to a microcontroller. The cable itself is 85 mm long and 17.78 mm wide.</p>
<p>The control center of the lock is the Nano (1.0.2). To accommodate it neatly in the housing and to make the cable connections as convenient as possible, I opted for a Nano expansion board with screw terminals (1.0.4).</p>
<p>A hollow socket (5.5 x 2.1 mm, 1.0.4) is used for the emergency power supply so that the lock continues to function even in the event of a power failure.</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1671 zoooom" src="https://nerd-corner.com/wp-content/uploads/2024/12/1-0-1.jpg" alt="tastenfeldschloss Bauteile" width="2310" height="1324" srcset="https://nerd-corner.com/wp-content/uploads/2024/12/1-0-1.jpg 2318w, https://nerd-corner.com/wp-content/uploads/2024/12/1-0-1-300x172.jpg 300w, https://nerd-corner.com/wp-content/uploads/2024/12/1-0-1-1024x587.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2024/12/1-0-1-768x440.jpg 768w, https://nerd-corner.com/wp-content/uploads/2024/12/1-0-1-1536x881.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2024/12/1-0-1-2048x1174.jpg 2048w" sizes="auto, (max-width: 2310px) 100vw, 2310px" /></p>
<p>The pin and socket connectors (1.1.1) serve as the central power distribution and are later soldered to the breadboard (1.1.2). Jumper cables (1.1.3) are used to ensure that all components are reliably connected. Depending on the position of the components, different lengths are required &#8211; in this case 10 cm and 20 cm.</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1670 zoooom" src="https://nerd-corner.com/wp-content/uploads/2024/12/1-1.jpg" alt="" width="2310" height="1327" srcset="https://nerd-corner.com/wp-content/uploads/2024/12/1-1.jpg 2321w, https://nerd-corner.com/wp-content/uploads/2024/12/1-1-300x172.jpg 300w, https://nerd-corner.com/wp-content/uploads/2024/12/1-1-1024x588.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2024/12/1-1-768x441.jpg 768w, https://nerd-corner.com/wp-content/uploads/2024/12/1-1-1536x882.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2024/12/1-1-2048x1176.jpg 2048w" sizes="auto, (max-width: 2310px) 100vw, 2310px" /></p>
<p>For the status display of the keypad lock, I use Neo Pixel addressable LEDs of type WS2812b (1.2.1). These can be used to control different colors and effects to visually display the current status of the lock.</p>
<p>I will go into the positioning of the screws in more detail later.</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1669 zoooom" src="https://nerd-corner.com/wp-content/uploads/2024/12/1-2.jpg" alt="" width="2320" height="1324" srcset="https://nerd-corner.com/wp-content/uploads/2024/12/1-2.jpg 2331w, https://nerd-corner.com/wp-content/uploads/2024/12/1-2-300x171.jpg 300w, https://nerd-corner.com/wp-content/uploads/2024/12/1-2-1024x584.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2024/12/1-2-768x438.jpg 768w, https://nerd-corner.com/wp-content/uploads/2024/12/1-2-1536x876.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2024/12/1-2-2048x1169.jpg 2048w, https://nerd-corner.com/wp-content/uploads/2024/12/1-2-1400x800.jpg 1400w" sizes="auto, (max-width: 2320px) 100vw, 2320px" /></p>
<p>Now that the components have been determined, I can think about the size of the housing. This is not only determined by the installed elements, but above all by the usability and feel.</p>
<p>We encounter keypads every day &#8211; on ATMs, telephones, door lock systems and, of course, smartphones. The decision for the depth of the housing is based on a positive memory of my penultimate workplace: the keypad lock at the entrance was raised and easily accessible from both sides. You could operate it comfortably with your right or left thumb, and the rounded corners provided a pleasant feel when you put your hand on it.</p>
<h2>Keypad lock Housing design</h2>
<p>This results in a depth of 45 mm (2.0.3). For better ergonomics, the corners have a radius of 15 mm (R15) and the surrounding upper edges have a radius of 10 mm (R10). I am aware that these roundings slightly reduce the interior space, but the comfort and appearance outweigh this disadvantage.</p>
<p>The width and height of the housing are determined by the components to be installed. The space for the cabling must also be taken into account. Particularly important: When installed, the Nano should still be accessible with a standard USB mini cable, for example to be able to install new programs.</p>
<h3>Mounting and fastening</h3>
<ul>
<li>Four M3 threads (2.0.1) on the inside allow the support plate to be screwed on.</li>
<li>In addition, there are four mounting points with Ø4.2 mm holes for attaching the housing to a door, cover or wall.</li>
<li>The housing has a window (2.0.2) measuring 60 × 67 mm, which is intended for the keypad. This is later filled with the carrier plate.</li>
<li>Retaining columns with M2 threads and the opening for the hollow socket (1.0.4) are marked with orange ellipses (2.0.1, 2.0.3).</li>
<li>The next picture (2.0.4) shows the external dimensions: 110 mm wide and 117 mm high.</li>
<li>In addition, an aperture or slot 50 mm long is required for the LED cover (2.0.5).</li>
</ul>
<p>For the wall thickness of the housing, I have provided 2 mm throughout &#8211; stable enough for the intended purpose.</p>
<p>With the housing construction completed, we can now continue with the other components.</p>
<h3 data-start="1513" data-end="1546"><img loading="lazy" decoding="async" class="aligncenter wp-image-1668 zoooom" style="font-family: 'Source Sans Pro', Graphik, -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif; font-size: 1.125rem;" src="https://nerd-corner.com/wp-content/uploads/2024/12/2-0-1.jpg" alt="Tastenfeldschloss Gehäuse" width="2310" height="1330" srcset="https://nerd-corner.com/wp-content/uploads/2024/12/2-0-1.jpg 2316w, https://nerd-corner.com/wp-content/uploads/2024/12/2-0-1-300x173.jpg 300w, https://nerd-corner.com/wp-content/uploads/2024/12/2-0-1-1024x589.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2024/12/2-0-1-768x442.jpg 768w, https://nerd-corner.com/wp-content/uploads/2024/12/2-0-1-1536x884.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2024/12/2-0-1-2048x1179.jpg 2048w" sizes="auto, (max-width: 2310px) 100vw, 2310px" /></h3>
<h3>The support plate &#8211; the central mounting element</h3>
<p>The next important component is the carrier plate. The name is self-explanatory: With the exception of the hollow bushing, all components are attached here. This system offers several advantages over direct mounting in the housing:</p>
<p><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Easy mounting outside the housing &#8211; More space and better handling when wiring.<br />
<img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Modularity &#8211; different carrier plates with different components are possible.<br />
<img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Simple enclosure design &#8211; The enclosure design remains simpler and more flexible.<br />
<img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Easy replacement &#8211; Components can be replaced or extended more easily.</p>
<p>But there is another decisive advantage for the keypad lock in particular:</p>
<p>The keypad is glued directly into a designated recess in the carrier plate (2.1.1). The carrier plate and keypad are then inserted into the housing from behind and fixed in place with M3 screws. The frame of the window in the housing completely covers the edge and the cables.</p>
<p><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f512.png" alt="🔒" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Safety aspect: The window is dimensioned in such a way that the edge and the cables remain concealed, but the buttons are fully visible and operable. This means that the keypad cannot be removed without destroying it &#8211; an important protective mechanism against tampering.</p>
<h3>Fastening the components to the carrier plate</h3>
<p>There are various mounting options for the electronics on the back (2.1.2) of the carrier plate:</p>
<p><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f7e1.png" alt="🟡" class="wp-smiley" style="height: 1em; max-height: 1em;" /> M3 thread for the nano adapter (2.1.3) &#8211; As nano adapters on the Internet often have different hole spacings, there is an additional fastening thread on the right-hand side (2.1.2) for flexible adjustment. If the holes still do not fit exactly, they can be carefully widened &#8211; but without damaging the adapter&#8217;s conductor tracks.</p>
<p><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f534.png" alt="🔴" class="wp-smiley" style="height: 1em; max-height: 1em;" /> M2 thread for the Nano R3 ATMEGA168P (2.1.4) &#8211; An alternative, cost-effective solution instead of a Nano R3 with adapter.</p>
<p><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f535.png" alt="🔵" class="wp-smiley" style="height: 1em; max-height: 1em;" /> M2 thread for the breadboard (20×80 mm, 1.1.2, 2.1.5) &#8211; This is used for power distribution and connects all power supply lines neatly at a central point.</p>
<h3 data-start="1487" data-end="1545"><img loading="lazy" decoding="async" class="aligncenter wp-image-1667 zoooom" style="font-family: 'Source Sans Pro', Graphik, -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif; font-size: 1.125rem;" src="https://nerd-corner.com/wp-content/uploads/2024/12/2-1-1.jpg" alt="" width="2310" height="1329" srcset="https://nerd-corner.com/wp-content/uploads/2024/12/2-1-1.jpg 2317w, https://nerd-corner.com/wp-content/uploads/2024/12/2-1-1-300x173.jpg 300w, https://nerd-corner.com/wp-content/uploads/2024/12/2-1-1-1024x589.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2024/12/2-1-1-768x442.jpg 768w, https://nerd-corner.com/wp-content/uploads/2024/12/2-1-1-1536x884.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2024/12/2-1-1-2048x1178.jpg 2048w" sizes="auto, (max-width: 2310px) 100vw, 2310px" /></h3>
<h3>The LED cover and its attachment</h3>
<p>The LED cover (2.2.1) has been designed so that it is clicked into the slot (2.0.5) of the housing from the rear. The radius on the outside of the LED cover corresponds to the housing radius, creating a smooth transition and allowing the cover to blend in seamlessly.</p>
<p>I don&#8217;t need to redesign the mounting bridge (front 2.2.2, back 2.2.3) as I have already used it successfully in other projects.</p>
<h3>Mounting the LEDs</h3>
<p>Now it remains to mount the three WS2812b LEDs (1.2.1). I will explain why exactly three LEDs are needed later in the programming section of this article.</p>
<p>The development of the LED holder (SMD50, 2.2.4) was more complex than expected. Of course, you could simply glue, clamp or hot glue the LED strips &#8211; but that seemed too unprofessional to me.</p>
<p>I therefore invested a lot of time and effort in designing a perfect holder. The result can be seen in picture 2.2.5.</p>
<p><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f4cc.png" alt="📌" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Further information:</p>
<p data-start="1181" data-end="1300"><a href="https://nerd-corner.com/click-and-clamp-system-smd5050-bracket/">For details on the construction, there is a separate article on NerdCorner.</a></p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1666 zoooom" src="https://nerd-corner.com/wp-content/uploads/2024/12/2-2-1.jpg" alt="" width="2310" height="1330" srcset="https://nerd-corner.com/wp-content/uploads/2024/12/2-2-1.jpg 2316w, https://nerd-corner.com/wp-content/uploads/2024/12/2-2-1-300x173.jpg 300w, https://nerd-corner.com/wp-content/uploads/2024/12/2-2-1-1024x589.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2024/12/2-2-1-768x442.jpg 768w, https://nerd-corner.com/wp-content/uploads/2024/12/2-2-1-1536x884.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2024/12/2-2-1-2048x1179.jpg 2048w" sizes="auto, (max-width: 2310px) 100vw, 2310px" /></p>
<h2>3D printing of the components</h2>
<p>Once the design has been completed, the parts must now be printed.</p>
<p><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f4cc.png" alt="📌" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Material selection for the individual components:</p>
<ul>
<li>Housing (3.0.1): Printed with ABS filament, consisting of front and back.</li>
<li>Carrier plate (3.0.2): made from PLA filament.</li>
<li>LED cover (3.0.3): produced upright in the printer, printed with PLA+ in the color “natural”.</li>
<li>LED terminals (3.0.4): also made of PLA+, manufactured in the same process as the LED cover.</li>
<li>Bridge for the hollow socket: printed from PLA filament, analogous to the carrier plate.</li>
</ul>
<p>With these materials, the mechanical and thermal properties of the components are optimally matched to their respective applications.</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1665 zoooom" src="https://nerd-corner.com/wp-content/uploads/2024/12/3-0-1.jpg" alt="" width="2310" height="1329" srcset="https://nerd-corner.com/wp-content/uploads/2024/12/3-0-1.jpg 2317w, https://nerd-corner.com/wp-content/uploads/2024/12/3-0-1-300x173.jpg 300w, https://nerd-corner.com/wp-content/uploads/2024/12/3-0-1-1024x589.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2024/12/3-0-1-768x442.jpg 768w, https://nerd-corner.com/wp-content/uploads/2024/12/3-0-1-1536x884.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2024/12/3-0-1-2048x1178.jpg 2048w" sizes="auto, (max-width: 2310px) 100vw, 2310px" /></p>
<h2>Post-processing of the components</h2>
<p>After printing, both the printed parts and some purchased parts need to be processed.</p>
<p>1&#x20e3; Cleaning the 3D printed parts</p>
<ul>
<li>Removal of support material and protruding print residues.</li>
</ul>
<p>2&#x20e3; Cutting the thread<br />
Housing (4.0.1):</p>
<ul>
<li>Four M3 threads (Attention: blind holes! Proceed carefully when cutting so as not to push the base outwards).</li>
<li>Two M2 threads (4.0.2).</li>
<li>Support plate (4.0.3):
<ul>
<li>The M2 threads marked in blue must be cut in any case.</li>
<li>When using a nano adapter with screw terminals (2.1.4), the M2 threads marked in red must also be cut.</li>
</ul>
</li>
</ul>
<p>3&#x20e3; Shortening the perforated grid plate</p>
<ul>
<li>The perforated grid plate (4.0.4) must be shortened to 8 to a maximum of 10 perforated grids.<br />
Important: The mounting holes should be retained (see 4.0.5).</li>
</ul>
<p>4&#x20e3; Shortening the pin header</p>
<ul>
<li>Shorten the pin header to eight pins using a side cutter (4.0.6).</li>
</ul>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1664 zoooom" src="https://nerd-corner.com/wp-content/uploads/2024/12/4-0-2.jpg" alt="" width="2310" height="1394" srcset="https://nerd-corner.com/wp-content/uploads/2024/12/4-0-2.jpg 2316w, https://nerd-corner.com/wp-content/uploads/2024/12/4-0-2-300x181.jpg 300w, https://nerd-corner.com/wp-content/uploads/2024/12/4-0-2-1024x618.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2024/12/4-0-2-768x464.jpg 768w, https://nerd-corner.com/wp-content/uploads/2024/12/4-0-2-1536x927.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2024/12/4-0-2-2048x1236.jpg 2048w" sizes="auto, (max-width: 2310px) 100vw, 2310px" /></p>
<h3>Soldering the components</h3>
<p>Now it&#8217;s time to solder the parts. First we concentrate on the power supply board:</p>
<p>1&#x20e3; Soldering the power supply board</p>
<ul>
<li>Perforated grid plate (4.0.5): Soldering the base strip (1.1.1) and the pin strip (4.0.6).</li>
<li>Pin strip (4.1.2): A two-row pin and skirting board is soldered on. We connect the two rows on the back with solder.</li>
<li>The rows differ in male and female as well as in the colors: red for plus and black for minus. This makes it easier to connect the power supply.</li>
</ul>
<p>2&#x20e3; Soldering the WS2812B LEDs</p>
<ul>
<li>Soldering the connections of the WS2812B LED strip (4.1.3).</li>
</ul>
<p>3&#x20e3; Soldering the hollow socket</p>
<ul>
<li>Finally, the hollow socket (1.0.4) is soldered (4.1.4).</li>
<li>Detailed instructions <a href="https://nerd-corner.com/using-a-barrel-jack-as-a-switch/">on soldering the hollow socket can be found</a> in a separate article. It is important to know the exact procedure in order to avoid mistakes.</li>
</ul>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1663 zoooom" src="https://nerd-corner.com/wp-content/uploads/2024/12/4-1-2.jpg" alt="" width="2310" height="1329" srcset="https://nerd-corner.com/wp-content/uploads/2024/12/4-1-2.jpg 2317w, https://nerd-corner.com/wp-content/uploads/2024/12/4-1-2-300x173.jpg 300w, https://nerd-corner.com/wp-content/uploads/2024/12/4-1-2-1024x589.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2024/12/4-1-2-768x442.jpg 768w, https://nerd-corner.com/wp-content/uploads/2024/12/4-1-2-1536x884.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2024/12/4-1-2-2048x1178.jpg 2048w" sizes="auto, (max-width: 2310px) 100vw, 2310px" /></p>
<h2 data-start="75" data-end="118">Assembling the keypad lock</h2>
<p data-start="75" data-end="118">1&#x20e3; Installing the LED cover</p>
<ul>
<li data-start="75" data-end="118">First click the LED cover (2.2.1) into the housing.</li>
<li data-start="75" data-end="118">Glue the LED cover in the intended places as shown in pictures 5.0.1 and 5.0.2.</li>
</ul>
<p>2&#x20e3; Plug in the Nano R3</p>
<ul>
<li data-start="75" data-end="118">Insert the Nano R3 (1.0.2) into the Nano adapter (5.0.3) of your choice.</li>
</ul>
<p>3&#x20e3; Installing the Nano adapter</p>
<ul>
<li data-start="75" data-end="118">Screw the Nano adapter (1.0.3) with the inserted Nano R3 (1.0.2) to the back of the carrier plate (4.0.3).</li>
<li data-start="75" data-end="118">Use the M3 threads on the carrier plate and the screws (1.2.2), as shown in pictures 5.0.4 and 5.0.5.</li>
</ul>
<p>4&#x20e3; Attaching the power supply</p>
<ul>
<li data-start="75" data-end="118">Attach the power supply (4.1.2) to the back of the carrier plate (4.0.3) using the screws (1.2.4).</li>
<li data-start="75" data-end="118">See figure 5.0.6.</li>
</ul>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1662 zoooom" src="https://nerd-corner.com/wp-content/uploads/2024/12/5-0-1.jpg" alt="" width="2310" height="1330" srcset="https://nerd-corner.com/wp-content/uploads/2024/12/5-0-1.jpg 2316w, https://nerd-corner.com/wp-content/uploads/2024/12/5-0-1-300x173.jpg 300w, https://nerd-corner.com/wp-content/uploads/2024/12/5-0-1-1024x589.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2024/12/5-0-1-768x442.jpg 768w, https://nerd-corner.com/wp-content/uploads/2024/12/5-0-1-1536x884.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2024/12/5-0-1-2048x1179.jpg 2048w" sizes="auto, (max-width: 2310px) 100vw, 2310px" /></p>
<h3 data-start="75" data-end="127">Mounting the keypad on the support plate</h3>
<p>1&#x20e3; Selecting the screw length</p>
<ul>
<li data-start="75" data-end="127">Make sure to select the correct screw length as shown in Figure 5.1.1.</li>
<li data-start="75" data-end="127">Screws must not be too long, otherwise they will protrude from the adhesive surface when the keypad is attached and the keypad cannot be glued on cleanly.</li>
</ul>
<p>2&#x20e3; Preparing the keypad</p>
<ul>
<li data-start="75" data-end="127">Remove the protective film from the keypad (1.0.1).</li>
<li data-start="75" data-end="127">To remove the film, use a carpet knife to carefully get between the adhesive layer and the protective film at one corner (see 5.1.2).</li>
<li data-start="75" data-end="127">Once you have reached the corner, peel off the entire protective film (see 5.1.3).</li>
</ul>
<p>3&#x20e3; Stick on the keypad</p>
<ul>
<li data-start="75" data-end="127">Insert the keypad (1.0.1) into the recess on the front of the carrier plate (2.1.1) and press it firmly into place.</li>
<li data-start="75" data-end="127">The keypad must be completely recessed and must not protrude over the edge (see 5.1.4).</li>
<li data-start="75" data-end="127">Make sure that the cables are also in the recess (see 5.1.5).</li>
</ul>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1661 zoooom" src="https://nerd-corner.com/wp-content/uploads/2024/12/5-1-1.jpg" alt="" width="2340" height="1327" srcset="https://nerd-corner.com/wp-content/uploads/2024/12/5-1-1.jpg 2350w, https://nerd-corner.com/wp-content/uploads/2024/12/5-1-1-300x170.jpg 300w, https://nerd-corner.com/wp-content/uploads/2024/12/5-1-1-1024x581.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2024/12/5-1-1-768x436.jpg 768w, https://nerd-corner.com/wp-content/uploads/2024/12/5-1-1-1536x871.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2024/12/5-1-1-2048x1162.jpg 2048w" sizes="auto, (max-width: 2340px) 100vw, 2340px" /></p>
<h3 data-start="64" data-end="123">Wiring the keypad to the Arduino Nano R3</h3>
<p>1&#x20e3; Using jumper cables</p>
<ul>
<li data-start="64" data-end="123">Jumper cables (10 cm long, male-male) are used to connect the keypad to the Arduino Nano R3 (see 5.2.1).</li>
</ul>
<p>2&#x20e3; Connecting the cables</p>
<ul>
<li data-start="64" data-end="123">Make sure that you do not twist the cables, but only bend them.</li>
<li data-start="64" data-end="123">The left cable is connected to D2 of the Arduino and the right cable to D8.</li>
<li data-start="64" data-end="123">There are seven cables in total, which occupy the connections D2 to D8 (see 5.2.3).</li>
</ul>
<p>3&#x20e3; Use pin headers</p>
<ul>
<li data-start="64" data-end="123">As the pitch of the Arduino adapter and the keypad do not match, you can use pin strips to make the connection.</li>
</ul>
<p>4&#x20e3; Fastening the LED terminals</p>
<ul>
<li data-start="64" data-end="123">The clips (3.0.4) for the WS2812B LEDs are clicked onto the LEDs.</li>
<li data-start="64" data-end="123">It is best to do this on a flat surface (see 5.2.4).</li>
</ul>
<p>5&#x20e3; Attaching the LED strip</p>
<ul>
<li data-start="64" data-end="123">The WS2812B strip is now pushed onto the center of the top of the carrier plate (see 5.2.5 Front and 5.2.6 Rear).</li>
</ul>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1660 zoooom" src="https://nerd-corner.com/wp-content/uploads/2024/12/5-2.jpg" alt="" width="2310" height="1330" srcset="https://nerd-corner.com/wp-content/uploads/2024/12/5-2.jpg 2316w, https://nerd-corner.com/wp-content/uploads/2024/12/5-2-300x173.jpg 300w, https://nerd-corner.com/wp-content/uploads/2024/12/5-2-1024x589.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2024/12/5-2-768x442.jpg 768w, https://nerd-corner.com/wp-content/uploads/2024/12/5-2-1536x884.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2024/12/5-2-2048x1179.jpg 2048w" sizes="auto, (max-width: 2310px) 100vw, 2310px" /></p>
<h3>Assembling the carrier plate and housing</h3>
<p>1&#x20e3; Screwing the support plate to the housing (5.3.1)</p>
<ul>
<li>Make sure that you use M3 screws that are not too long. Otherwise, they could push a bump into the front of the housing when tightened.</li>
<li>The alignment of the carrier plate in the housing is important: the LED strip should be on the same side as the LED cover.</li>
<li>After screwing, the keypad should be lightly pressed against the inner frame of the housing (see 5.3.2 and 5.3.3).</li>
</ul>
<p>2&#x20e3; Pre-assembly of the hollow socket for the emergency power supply</p>
<ul>
<li>For the emergency power supply, you must pre-assemble the hollow socket and screw it to the housing.</li>
<li>The hollow socket with bridge and nut is shown in Figure 5.3.4.</li>
<li>Insert the hollow bush into the round recess of the bridge.</li>
<li>Lock the hollow bushing with the nut on the other side of the bridge.</li>
</ul>
<p>3&#x20e3; Fastening the hollow bush in the housing</p>
<ul>
<li>The hollow bush with the bridge is then screwed to the retaining pillars provided in the housing using M2 screws (see 5.3.5 and 5.3.6).</li>
</ul>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1659 zoooom" src="https://nerd-corner.com/wp-content/uploads/2024/12/5-3.jpg" alt="" width="2310" height="1329" srcset="https://nerd-corner.com/wp-content/uploads/2024/12/5-3.jpg 2317w, https://nerd-corner.com/wp-content/uploads/2024/12/5-3-300x173.jpg 300w, https://nerd-corner.com/wp-content/uploads/2024/12/5-3-1024x589.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2024/12/5-3-768x442.jpg 768w, https://nerd-corner.com/wp-content/uploads/2024/12/5-3-1536x884.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2024/12/5-3-2048x1178.jpg 2048w" sizes="auto, (max-width: 2310px) 100vw, 2310px" /></p>
<h3>Connecting the cables and completing the power supply</h3>
<p>1&#x20e3; Connecting the control cable for the servo motor</p>
<ul>
<li>The control cable for the servo motor is connected to pin D9 of the Nano R3 (5.4.1).</li>
</ul>
<p>2&#x20e3; Connecting the power supply for the Nano R3</p>
<ul>
<li>The power supply for the Nano R3 is connected to the GND pin and the VIN pin of the Nano R3 (5.4.2).</li>
</ul>
<p>3&#x20e3; Connecting the control cable for the WS2812B</p>
<ul>
<li>The control cable for the WS2812B LED strip is connected to pin D10 of the Nano R3 (5.4.3).</li>
</ul>
<p>4&#x20e3; Wiring of the power distributor</p>
<ul>
<li>All remaining cables must be connected to the power distributor:
<ul>
<li>Servo motor connection</li>
<li>Arduino Nano R3</li>
<li>WS2812B LED strip</li>
<li>Hollow socket All connections are made with plus and minus (see 5.4.4 and 5.4.5).</li>
</ul>
</li>
</ul>
<p>5&#x20e3; Using different colors and connection types for the wiring</p>
<ul>
<li>It helps to use different cable colors:
<ul>
<li>Red for plus</li>
<li>Black for minus</li>
</ul>
</li>
<li>The power distributor has different connection types:
<ul>
<li>Male for plus</li>
<li>Female for minus</li>
</ul>
</li>
</ul>
<p>6&#x20e3; Note on the hollow socket</p>
<ul>
<li><a href="https://nerd-corner.com/using-a-barrel-jack-as-a-switch/">There is a separate article on wiring and connecting the hollow socket, which you should definitely read</a></li>
</ul>
<p>7&#x20e3; Attaching the connector housings for the servo motor and power supply</p>
<ul>
<li>A three-pin plug is required for the servo motor connection.</li>
<li>A two-pin plug is required for the external power supply.</li>
</ul>
<p><a href="https://nerd-corner.com/3d-printed-dupont-connector-for-jumper-cable/">Further details on the construction process and the download links for connector housings can be found here.</a></p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1658 zoooom" src="https://nerd-corner.com/wp-content/uploads/2024/12/5-4.jpg" alt="" width="2310" height="1330" srcset="https://nerd-corner.com/wp-content/uploads/2024/12/5-4.jpg 2316w, https://nerd-corner.com/wp-content/uploads/2024/12/5-4-300x173.jpg 300w, https://nerd-corner.com/wp-content/uploads/2024/12/5-4-1024x589.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2024/12/5-4-768x442.jpg 768w, https://nerd-corner.com/wp-content/uploads/2024/12/5-4-1536x884.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2024/12/5-4-2048x1179.jpg 2048w" sizes="auto, (max-width: 2310px) 100vw, 2310px" /></p>
<p>Figure 5.5.1 shows the entire cabling again.</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1657 zoooom" src="https://nerd-corner.com/wp-content/uploads/2024/12/5-5.jpg" alt="fritzing keypad lock" width="2310" height="1330" srcset="https://nerd-corner.com/wp-content/uploads/2024/12/5-5.jpg 2316w, https://nerd-corner.com/wp-content/uploads/2024/12/5-5-300x173.jpg 300w, https://nerd-corner.com/wp-content/uploads/2024/12/5-5-1024x589.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2024/12/5-5-768x442.jpg 768w, https://nerd-corner.com/wp-content/uploads/2024/12/5-5-1536x884.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2024/12/5-5-2048x1179.jpg 2048w" sizes="auto, (max-width: 2310px) 100vw, 2310px" /></p>
<h2>Arduino code</h2>
<p>After the intensive work with the hardware and the 3D printer, we now turn our attention to the strategy and programming of the keypad lock. Why is a strategy important for a keypad lock? A well thought-out sequence of actions &#8211; i.e. the order in which the keypad lock is operated, which events result from certain actions and which goal is being pursued &#8211; forms the basis for functional control. This guideline is therefore also crucial for programming the keypad lock: it determines what should happen when and which hardware is used. The aim is to create a logical and comprehensible sequence of events, which in this case can also be understood visually.</p>
<p>Example 1:<br />
The keypad lock should display how many digits have already been entered. (See Figures 7.0.1 to 7.0.4)</p>
<p>Example 2:<br />
The keypad lock should indicate whether the password entered is correct after pressing a specific key. (See figure 7.0.5)</p>
<p>Example 3:<br />
The keypad lock should indicate if something has been entered incorrectly, such as an incorrect password or too many keystrokes. (See figure 7.0.8)</p>
<p>Example 4:<br />
The keypad lock should display the current status. (See Figures 7.0.5 to 7.0.7)</p>
<p>Now let&#8217;s move on to programming the keypad lock, which differs from conventional programs on the Internet in a few respects. To begin with, the three necessary libraries are included: &lt;Keypad.h&gt; for the keypad, &lt;Adafruit_NeoPixel.h&gt; for the WS2812B LEDs and &lt;Servo.h&gt; for the servo motor (Figure 6.0.1). In the following section, the pin assignment for the LEDs is defined, whereby pin D10 is used and the number of LEDs and the color scheme are determined. The brightness of the LEDs is also defined &#8211; this value can be adjusted depending on the location, with higher values providing more brightness (values from 0 to 255). (See figure 6.0.2) The third section is dedicated to the description of the keypad used, including the number of rows and columns and the assignment of the buttons. (See figure 6.0.3).</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1656 zoooom" src="https://nerd-corner.com/wp-content/uploads/2024/12/6-0-1.jpg" alt="" width="2310" height="1330" srcset="https://nerd-corner.com/wp-content/uploads/2024/12/6-0-1.jpg 2316w, https://nerd-corner.com/wp-content/uploads/2024/12/6-0-1-300x173.jpg 300w, https://nerd-corner.com/wp-content/uploads/2024/12/6-0-1-1024x589.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2024/12/6-0-1-768x442.jpg 768w, https://nerd-corner.com/wp-content/uploads/2024/12/6-0-1-1536x884.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2024/12/6-0-1-2048x1179.jpg 2048w" sizes="auto, (max-width: 2310px) 100vw, 2310px" /></p>
<p>In the fourth section, the servomotor is configured by defining the degree range it can cover and the speed at which it should move (see Figure 6.1.1). This is followed by the section for entering the password. Here you have the option of changing the default password 1516 to set a new four-digit password. The program will only work correctly if a four-digit code is entered. In this section, the control pin for the servo motor is also set to D9 (see Figure 6.1.2). The following section is dedicated to defining the colors for the various events.</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1655 zoooom" src="https://nerd-corner.com/wp-content/uploads/2024/12/6-1-1.jpg" alt="" width="2310" height="1330" srcset="https://nerd-corner.com/wp-content/uploads/2024/12/6-1-1.jpg 2316w, https://nerd-corner.com/wp-content/uploads/2024/12/6-1-1-300x173.jpg 300w, https://nerd-corner.com/wp-content/uploads/2024/12/6-1-1-1024x589.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2024/12/6-1-1-768x442.jpg 768w, https://nerd-corner.com/wp-content/uploads/2024/12/6-1-1-1536x884.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2024/12/6-1-1-2048x1179.jpg 2048w" sizes="auto, (max-width: 2310px) 100vw, 2310px" /></p>
<p>The last two sections explain the behavior of the keypad lock during certain actions. This description is of course only a rough overview of the program. In a future article for keypad lock version 2, we will explain the program in more detail and more comprehensively.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="c">//==========================================Librarys==============================================================
#include &lt;Keypad.h&gt;
#include &lt;Adafruit_NeoPixel.h&gt;
#include &lt;Servo.h&gt;
//========================================Neo-Pixel==============================================================
#define LED_PIN 10
#define LED_COUNT 3
Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
int led_strength = 75; //controlls Brighttness (0 - 255)
//========================================Keypad=================================================================
const byte rows = 4;
const byte cols = 3;
char keys[rows][cols] = {
 {'1', '2', '3'},
 {'4', '5', '6'},
 {'7', '8', '9'},
 {'*', '0', '#'}
};
byte rowPins[rows] = {8, 7, 6, 5};
byte colPins[cols] = {4, 3, 2};
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, rows, cols );
//=========================================Servo============================================================
Servo lock;
int pos = 0;
int servo_angle = 180;
int servo_speed = 15;
//======================================Password===============================================================
String input;
const String password = "1516"; //Set Password
int n = 1;

 

void setup() {
 input.reserve(password.length() +2);
 strip.begin();
 strip.show();
 lock.attach(9); //motor pin
}

void loop() {
//-------------------colours------------------------------------------------------------------- 
 uint32_t blue = strip.Color(0, 0, led_strength);
 uint32_t green = strip.Color(0, led_strength, 0);
 uint32_t red = strip.Color(led_strength, 0, 0);
 uint32_t orange = strip.Color(led_strength, led_strength/2, 0);

 char key = keypad.getKey();

if (key != NO_KEY) {
//-------------------------End conditions------------------------------------------------------
 if (key == '#') {
 if (input == password) {
 //unlock
 strip.clear();
 strip.fill(green, 0, LED_COUNT);
 strip.show();
 for (pos = 0; pos &lt;= servo_angle; pos += 1) {
 lock.write(pos);
 delay(servo_speed );
 }
 while (1 == 1)
 { char key = keypad.getKey();
 strip.clear();
 strip.fill(orange, 0, LED_COUNT);
 strip.show();
 if (key == '*')
 {
 strip.clear();
 strip.fill(green, 0, LED_COUNT);
 strip.show();
 break;
 }
 }

 for (pos = servo_angle; pos &gt;= 0; pos -= 1) {
 lock.write(pos);
 delay(servo_speed );
 }
 n = 1;
 input = "";
 delay (1000);
 strip.clear();
 strip.show();
 } else {
 //wrong password
 strip.clear();
 strip.fill(red, 0, LED_COUNT);
 strip.show();
 n = 1;
 input = "";
 delay (1000);
 strip.clear();
 strip.show();
 }
 }
 else if (n == password.length() + 1) {
 //Input too long
 strip.clear();
 strip.fill(red, 0, LED_COUNT);
 strip.show();
 n = 1;
 input = "";
 delay (1000);
 strip.clear();
 strip.show();
 }
//----------------------------------Buttons------------------------------------------
 else {
 input += key;
 if (n == password.length() ) {
 strip.clear();
 strip.fill(blue, 0, LED_COUNT); 
 strip.show();
 n++;
 }
 else {

 strip.clear();
 strip.setPixelColor(n-1, blue);
 strip.show();
 n++;
 }
 }
 }

}</pre>
<h2>Function</h2>
<p>Operating the keypad lock is very intuitive. As soon as the first button is pressed, the right-hand LED lights up blue (7.0.1). When the second button is pressed, the middle LED turns blue (7.0.2). After the third button is pressed, the left-hand LED lights up blue (7.0.3). Finally, with the fourth button, all three LEDs light up blue (7.0.4). When these three LEDs light up blue, the user knows that the # button must be pressed.</p>
<p>If the # button is pressed, the password is checked. If the password is correct, all three LEDs light up green at the same time and the servomotor is activated (7.0.5). The green light remains on as long as the servomotor has not yet reached its end position (open). As soon as the servomotor reaches the end position (open), the LEDs change from green to orange (7.0.6). The orange color remains until the user presses the * button.</p>
<p>After pressing the * button, the LEDs change back to green (7.0.7) and remain in this color until the servomotor has reached the end position (closed). If this is the case, the LEDs go out and the keypad lock is ready for new entries.</p>
<p>However, if the password is incorrect after pressing the # button in step 7.0.4, all three LEDs light up red (7.0.8). The red light is also displayed if more than four buttons, apart from the # button, are pressed.</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1654 zoooom" src="https://nerd-corner.com/wp-content/uploads/2024/12/7-0-1.jpg" alt="keypad lock step by step guide" width="2310" height="1329" srcset="https://nerd-corner.com/wp-content/uploads/2024/12/7-0-1.jpg 2317w, https://nerd-corner.com/wp-content/uploads/2024/12/7-0-1-300x173.jpg 300w, https://nerd-corner.com/wp-content/uploads/2024/12/7-0-1-1024x589.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2024/12/7-0-1-768x442.jpg 768w, https://nerd-corner.com/wp-content/uploads/2024/12/7-0-1-1536x884.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2024/12/7-0-1-2048x1178.jpg 2048w" sizes="auto, (max-width: 2310px) 100vw, 2310px" /></p>
<h2>Door mounting</h2>
<p>Of course, this variant is not intended for use on an ordinary door, where you simply walk through and the door closes by itself. The reason for this is that the lock remains open until the * button is pressed. But how can you press the * button when you are on the other side of the keypad lock, behind the wall? A delay in the program could help, but who knows how long it takes to pass through the door and close it behind you? A much more sensible solution would be to implement an additional switch that is placed on the other side of the door. When pressed, this switch would lead directly to point 7.0.6 and open the lock so that the door can be opened from the inside without having to enter a password.</p>
<p>But that&#8217;s for the future. Now we come to mounting the keypad lock on a door. I have provided four holes on the back of the housing for this purpose. These holes have a recess on the inside for conventional hexagon nuts M4 DIN 934. The corresponding holes can be seen in Figure 8.0.1 (rear view) and Figure 8.0.2 (front view), whereby the housing is shown slightly transparent for better visualization. Installing the nuts is very simple: After ensuring that all support material has been removed, the nut is pressed into the recess provided from behind. Press-in nuts should not be used as they are unnecessarily expensive.</p>
<p>I have developed a drilling template for fixing to the wall or door (Fig. 8.0.3). This template contains a hole with a diameter of 4 mm at each of the four corners. The distance between the holes corresponds to the distance between the holes on the housing. The template can be easily fixed to the surface of the door, for example with adhesive tape (Fig. 8.0.4). This saves you the tedious task of marking out the drill holes and avoids errors.</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1653 zoooom" src="https://nerd-corner.com/wp-content/uploads/2024/12/8-0-1.jpg" alt="" width="2310" height="1330" srcset="https://nerd-corner.com/wp-content/uploads/2024/12/8-0-1.jpg 2316w, https://nerd-corner.com/wp-content/uploads/2024/12/8-0-1-300x173.jpg 300w, https://nerd-corner.com/wp-content/uploads/2024/12/8-0-1-1024x589.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2024/12/8-0-1-768x442.jpg 768w, https://nerd-corner.com/wp-content/uploads/2024/12/8-0-1-1536x884.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2024/12/8-0-1-2048x1179.jpg 2048w" sizes="auto, (max-width: 2310px) 100vw, 2310px" /></p>
<p>Figure 8.1.1 shows the drilled mounting holes from the front, marked by magenta-colored circles. Thanks to the drilling template, these holes are the correct distance apart. If the position slips slightly during drilling or is not exactly correct, this is not a problem. In this case, you can simply drill the mounting holes slightly larger to align the keypad lock precisely when screwing it on. In addition, two holes can be seen in yellow circles in this picture, which are unfortunately slightly broken out at the edge. These holes are intended for the servo cable and the power supply. Once the holes had been drilled, I fitted the keypad lock and fed the cables through the holes provided on the back of the door (Fig. 8.1.2).</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1652 zoooom" src="https://nerd-corner.com/wp-content/uploads/2024/12/8-1.jpg" alt="" width="2310" height="1330" srcset="https://nerd-corner.com/wp-content/uploads/2024/12/8-1.jpg 2316w, https://nerd-corner.com/wp-content/uploads/2024/12/8-1-300x173.jpg 300w, https://nerd-corner.com/wp-content/uploads/2024/12/8-1-1024x589.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2024/12/8-1-768x442.jpg 768w, https://nerd-corner.com/wp-content/uploads/2024/12/8-1-1536x884.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2024/12/8-1-2048x1179.jpg 2048w" sizes="auto, (max-width: 2310px) 100vw, 2310px" /></p>
<p>The entire assembly of the keypad lock is shown on the front side of the door in Image 8.2.1. If you are not satisfied with this mounting solution, don&#8217;t worry: As a final step, I have designed a back cover that allows the keypad lock to be mounted on a wall or frame (Image 8.2.2). To do this, simply place the housing of the keypad lock onto the back cover and secure it from behind using M4 countersunk screws (marked by magenta circles in Image 8.2.2). After that, the entire construction is mounted on the wall, for which two tabs with two holes each are available (yellow circles in Image 8.2.2).</p>
<p>It is also important to remember to add one or more openings in the housing for the servo and power supply cables. Additionally, the security risk should be considered, as an unauthorized person could potentially unscrew the keypad lock using the accessible screws.</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1651 zoooom" src="https://nerd-corner.com/wp-content/uploads/2024/12/8-2.jpg" alt="" width="2310" height="1330" srcset="https://nerd-corner.com/wp-content/uploads/2024/12/8-2.jpg 2316w, https://nerd-corner.com/wp-content/uploads/2024/12/8-2-300x173.jpg 300w, https://nerd-corner.com/wp-content/uploads/2024/12/8-2-1024x589.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2024/12/8-2-768x442.jpg 768w, https://nerd-corner.com/wp-content/uploads/2024/12/8-2-1536x884.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2024/12/8-2-2048x1179.jpg 2048w" sizes="auto, (max-width: 2310px) 100vw, 2310px" /></p>
<h3>Locking Mechanism</h3>
<p>If you&#8217;re still missing a real locking mechanism that goes beyond just a servo connection, you can look forward to the &#8220;Locking Unit,&#8221; which is already in development and will be featured in future versions of the keypad lock.</p>
<p>The development of the keypad lock was an exciting yet challenging task. Some key features of <strong>VERSION 1</strong> of the keypad lock are particularly noteworthy:</p>
<ul>
<li><strong>Compatibility with various Arduino Nano models and adapters</strong> – Ensures flexibility in hardware selection.</li>
<li><strong>Visual feedback</strong> – Users are directly informed about number input and the status of the keypad lock.</li>
<li><strong>Emergency power supply via barrel jack</strong> – Guarantees reliable operation in case of power failures.</li>
<li><strong>Stable software</strong> – Developed to ensure reliable functionality.</li>
<li><strong>Optimized ergonomics for both left- and right-handed users</strong> – Designed for comfortable use by all users.</li>
</ul>
<h2>Files for Download</h2>
<ul>
<li><a href="https://www.thingiverse.com/thing:6840254">Keypad lock housing</a></li>
</ul>
<p>The post <a href="https://nerd-corner.com/diy-keypad-lock-3d-printing-and-code/">DIY keypad lock &#8211; 3D printing and code</a> appeared first on <a href="https://nerd-corner.com">Nerd Corner</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://nerd-corner.com/diy-keypad-lock-3d-printing-and-code/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Lessons Learned: Hosting NestJS App on Vercel</title>
		<link>https://nerd-corner.com/lessons-learned-hosting-nestjs-app-on-vercel/</link>
					<comments>https://nerd-corner.com/lessons-learned-hosting-nestjs-app-on-vercel/#respond</comments>
		
		<dc:creator><![CDATA[Nerds]]></dc:creator>
		<pubDate>Thu, 14 Nov 2024 07:19:52 +0000</pubDate>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[angular]]></category>
		<category><![CDATA[config]]></category>
		<category><![CDATA[cookie-sessions]]></category>
		<category><![CDATA[CORS error]]></category>
		<category><![CDATA[Cors error nest]]></category>
		<category><![CDATA[database config]]></category>
		<category><![CDATA[database hosting]]></category>
		<category><![CDATA[express]]></category>
		<category><![CDATA[express-sessions]]></category>
		<category><![CDATA[express.js]]></category>
		<category><![CDATA[google cloud]]></category>
		<category><![CDATA[google cloud mysql]]></category>
		<category><![CDATA[Hosting]]></category>
		<category><![CDATA[internal server error vercel]]></category>
		<category><![CDATA[internal server error vercel nest]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[Lessons Learned]]></category>
		<category><![CDATA[mySql]]></category>
		<category><![CDATA[Nest]]></category>
		<category><![CDATA[Nest hosting issues]]></category>
		<category><![CDATA[NestJs]]></category>
		<category><![CDATA[Redis]]></category>
		<category><![CDATA[redis session management]]></category>
		<category><![CDATA[redis session management nest.js]]></category>
		<category><![CDATA[session management]]></category>
		<category><![CDATA[Step by step guide]]></category>
		<category><![CDATA[typescript]]></category>
		<category><![CDATA[Vercel]]></category>
		<category><![CDATA[vercel.json]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[with credentials]]></category>
		<guid isPermaLink="false">https://nerd-corner.com/?p=1621</guid>

					<description><![CDATA[<p>After spending hours getting my NestJS app up and running on Vercel, I figured it was time to document what I learned—not only to save &#8230; </p>
<p>The post <a href="https://nerd-corner.com/lessons-learned-hosting-nestjs-app-on-vercel/">Lessons Learned: Hosting NestJS App on Vercel</a> appeared first on <a href="https://nerd-corner.com">Nerd Corner</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>After spending hours getting my NestJS app up and running on Vercel, I figured it was time to document what I learned—not only to save myself time in the future, but hopefully to help others avoid some of the pitfalls I ran into. Here’s a breakdown of what worked, what didn’t, and how I finally got everything running smoothly.</p>
<p><em><strong>This might also be interesting for you:</strong> <a href="https://nerd-corner.com/import-swagger-in-node-typescript-project/" target="_blank" rel="noopener">Adding Swagger to Node Server</a></em></p>
<h3>Step 1: Setting Up NestJS Vercel hosting</h3>
<p>First things first, getting the basic setup to deploy on Vercel. Vercel is awesome for serverless, but working with NestJS needed a few tweaks. The main thing is to set up a <code>vercel.json</code> configuration file, which tells Vercel exactly how to handle your app.</p>
<p>Here’s the configuration I ended up with:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="json" data-enlighter-theme="beyond">{
  "version": 2,
  "builds": [
    {
      "src": "src/main.ts",
      "use": "@vercel/node"
    }
  ],
  "routes": [
    {
      "src": "/(.*)",
      "dest": "src/main.ts",
      "methods": [
        "GET",
        "POST",
        "PUT",
        "PATCH",
        "OPTIONS",
        "DELETE",
        "HEAD",
        "CONNECT",
        "TRACE"
      ]
    }
  ]
}
</pre>
<p>I deployed it to Vercel and got the following error:</p>
<pre>This Serverless Function has crashed. Your connection is working correctly. 
Vercel is working correctly. 500: INTERNAL_SERVER_ERROR 
Code: FUNCTION_INVOCATION_FAILED ID: bom1::sgk4v-1711014022883-1e9ed54f4c37</pre>
<p>Looking in the logs, I noticed the database connection was an issue and in addition got the following log message:</p>
<pre>No exports found in module "/var/task/app-name/src/main.js".
Did you forget to export a function or a server?</pre>
<p>Turned out I could ignore the second part of the error message and just focus on the database connection.</p>
<h3>Step 2: Configuring the Database</h3>
<p>For my app, I used a mysql database with multiple schemas. I tried several free offers, but they were not compatible with the multiple schemas approach. Therefore I ended up with hosting it on Google Cloud. I scaled it down to a price of 0.01$ per hour and used the 300$ newbie offer.</p>
<p>Allowing Vercel to connect required setting the IP to <code>0.0.0.0/0</code> in Google Cloud’s configuration, making the database accessible from any IP address. <strong>Important note</strong>: make sure you test locally before deploying to Vercel, or you’ll be dealing with errors like these:</p>
<h3>Step 3: Dealing with CORS</h3>
<p>CORS caused also some headaches. Make sure you allow <code>OPTIONS</code> for CORS preflight requests, as Vercel needed explicit permission for cross-origin requests. I ended up adding a lot of headers to make sure requests were allowed:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="typescript" data-enlighter-theme="beyond">app.enableCors({
    origin: 'domain-name',
    credentials: true,
    methods: 'GET,HEAD,PUT,PATCH,POST,DELETE,OPTIONS',
    allowedHeaders: [
      'Origin',
      'X-Requested-With',
      'Content-Type',
      'Accept',
      'Authorization',
    ],
  });</pre>
<h3>Step 4: Switching to <code>express-session</code> and Redis for Session Management</h3>
<p>One of the trickiest parts was getting sessions to work. I started with the <code>cookie-session</code> library, but Vercel completely ignore it. After digging into the docs and some trial and error, I switched to <code>express-session</code>, which is more popular and works nicer with Vercel’s serverless environment.</p>
<p>For some reason the import syntax has to be exactly like this:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="typescript" data-enlighter-theme="beyond">import session = require('express-session');</pre>
<p>I also had to configure the session middleware with <code>trust proxy</code> enabled, since Vercel proxies requests. Here’s what the final setup looked like:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="typescript" data-enlighter-theme="beyond">const expressApp = app.getHttpAdapter().getInstance();
expressApp.set('trust proxy', true);</pre>
<p><span style="font-size: 1.125rem;">Also s</span>etting <code>secure: true</code> and <code>sameSite: 'none'</code> was essential to ensure cookies work across HTTPS and cross-origin requests!</p>
<p>Keep in mind, with Vercel, multiple serverless instances can handle requests simultaneously, which caused session conflicts. To fix this, I connected my session storage to a Redis instance. Luckily this was super easy.</p>
<p><a href="https://redis.io/">Redis</a> keeps session data consistent, avoiding conflicts across requests, especially under load. The code I ended up with:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="typescript" data-enlighter-theme="beyond">const expressApp = app.getHttpAdapter().getInstance();
expressApp.set('trust proxy', true);

const redisClient = createClient({
    password: process.env.REDIS_PASSWORD,
    socket: {
      host: process.env.REDIS_HOST,
      port: parseInt(process.env.REDIS_PORT, 10),
    },
  });

  redisClient
    .connect()
    .catch((err) =&gt;
      console.log('Could not establish a connection with Redis: ' + err),
    );

  redisClient.on('error', (err) =&gt; console.log('Redis error: ' + err));
  redisClient.on('connect', () =&gt;
    console.log('Connected to Redis successfully'),
  );

  app.use(
    session({
      store: new RedisStore({ client: redisClient }),
      secret: process.env.COOKIE_SECRET,
      cookie: {
        secure: process.env.NODE_ENV !== 'development',
        sameSite: process.env.NODE_ENV === 'development' ? 'lax' : 'none',
        maxAge: 86400000,
      },
    }),
  );</pre>
<p><span style="font-family: 'Roboto Condensed', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif; font-size: 1.75rem;">Step 5: Add </span><code>withCredentials</code><span style="font-family: 'Roboto Condensed', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif; font-size: 1.75rem;"> in the Frontend</span></p>
<p>This step is just a side note: For session cookies to work between the frontend and backend, <code>withCredentials</code> need to be set to <code>true</code> on my frontend’s HTTP requests. This allows cookies to be included in cross-origin requests, which is important when the frontend and backend are hosted separately. I had to make sure Angular’s HTTP client had this setting enabled.</p>
<h3>Step 6: Include font</h3>
<p>To include font files in your NestJS project, you can use the <code>compilerOptions</code> in the <code>nest-cli.json</code> file to define assets for build output, like specifying <code>"include": "**/*.ttf"</code> and <code>"outDir": "dist/src"</code>.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="json" data-enlighter-title="nest-cli.json" data-enlighter-theme="beyond">{
  "$schema": "https://json.schemastore.org/nest-cli",
  "collection": "@nestjs/schematics",
  "sourceRoot": "src",
  "compilerOptions": {
    "assets": [
      {
        "include": "**/*.ttf",
        "outDir": "dist/src"
      }
    ],
    "deleteOutDir": true
  }
}</pre>
<p>After the build, ensure the fonts are correctly referenced in your code using <code>path.resolve</code>, e.g., <code>path.resolve(__dirname, '../fonts/Roboto-Regular.ttf')</code>. This approach ensures the font files are bundled with the build and accessible during runtime.</p>
<h3>Final Thoughts to NestJS Vercel hosting</h3>
<p>Deploying my NestJS app on Vercel was a true roller coaster. Sometimes, I felt like I was on the verge of getting everything working perfectly, only to be hit with new errors that sent me back to troubleshooting mode. There were moments of frustration—especially around the session handling and CORS issues. But each solution brought a new high, and every error fixed felt like a little victory.</p>
<p>Now, with everything finally working smoothly, I can say it feels awesome. Seeing my app live and functioning the way I envisioned is worth all the headaches. It’s a huge relief, but even more, it’s deeply satisfying to know I’ve overcome each hurdle and can look back on what I learned. I hope this guide can save others some of those low points and help them reach that “it just works” moment a little faster!</p>
<p>The post <a href="https://nerd-corner.com/lessons-learned-hosting-nestjs-app-on-vercel/">Lessons Learned: Hosting NestJS App on Vercel</a> appeared first on <a href="https://nerd-corner.com">Nerd Corner</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://nerd-corner.com/lessons-learned-hosting-nestjs-app-on-vercel/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Mini Digital Voltmeter</title>
		<link>https://nerd-corner.com/mini-digital-voltmeter/</link>
					<comments>https://nerd-corner.com/mini-digital-voltmeter/#respond</comments>
		
		<dc:creator><![CDATA[Nerds]]></dc:creator>
		<pubDate>Wed, 09 Oct 2024 15:02:19 +0000</pubDate>
				<category><![CDATA[Handcrafted]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[3D print]]></category>
		<category><![CDATA[CAD]]></category>
		<category><![CDATA[CAD design]]></category>
		<category><![CDATA[case]]></category>
		<category><![CDATA[digital mini voltmeter]]></category>
		<category><![CDATA[DIY]]></category>
		<category><![CDATA[housing]]></category>
		<category><![CDATA[mini voltmeter]]></category>
		<category><![CDATA[Step by step guide]]></category>
		<category><![CDATA[Voltmeter]]></category>
		<guid isPermaLink="false">https://nerd-corner.com/de/?p=1607</guid>

					<description><![CDATA[<p>If you want to measure voltage with a voltmeter or multimeter, you normally need two hands. But usually you only have one hand free. You &#8230; </p>
<p>The post <a href="https://nerd-corner.com/mini-digital-voltmeter/">Mini Digital Voltmeter</a> appeared first on <a href="https://nerd-corner.com">Nerd Corner</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>If you want to measure voltage with a voltmeter or multimeter, you normally need two hands. But usually you only have one hand free. You can of course use crocodile clips or similar to help you, but this is usually awkward. Especially in experimental setups, you often have to measure the voltage at different points to analyze the behavior of the circuit.</p>
<p>The solution to my problem is the mini-voltmeter, which I have used many times in various projects in the past. The accuracy of the mini-voltmeter is usually sufficient and my projects tend to be in the low-voltage range. In addition, the mini voltmeters are relatively inexpensive and you can get them everywhere.</p>
<p>I also use USB multimeters to measure voltage and current, which save the values at the same time. Figure 1.0 shows some USB multimeters that can handle more or less voltage. Some devices are very expensive and the maximum number of amperes that can be measured also varies. If you only want to measure voltage and don&#8217;t have much of a budget, my project is just right for you.</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1601 zoooom" src="https://nerd-corner.com/wp-content/uploads/2024/10/voltmeter-1.jpg" alt="different volt meters" width="2310" height="1371" srcset="https://nerd-corner.com/wp-content/uploads/2024/10/voltmeter-1.jpg 2319w, https://nerd-corner.com/wp-content/uploads/2024/10/voltmeter-1-300x178.jpg 300w, https://nerd-corner.com/wp-content/uploads/2024/10/voltmeter-1-1024x608.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2024/10/voltmeter-1-768x456.jpg 768w, https://nerd-corner.com/wp-content/uploads/2024/10/voltmeter-1-1536x911.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2024/10/voltmeter-1-2048x1215.jpg 2048w, https://nerd-corner.com/wp-content/uploads/2024/10/voltmeter-1-445x265.jpg 445w" sizes="auto, (max-width: 2310px) 100vw, 2310px" /></p>
<p><em><strong>This might also interest you:</strong> <a href="https://nerd-corner.com/diy-powerbank-with-voltage-regulator-and-voltmeter/">Do it yourself power bank with voltage regulator and voltmeter</a></em></p>
<h2>List of components</h2>
<ul>
<li>Mini voltmeter DSN-DUM-368 /or DSN-DMU-368k (Figure 2.0.1)</li>
<li>Hollow socket 5.5&#215;2.1 (Figure 2.0.2)</li>
<li>Hollow plug 5.5&#215;2.1 (image 2.0.3)</li>
<li>USB micro adapter board optional (picture 2.0.4)</li>
<li>M2 x 10 countersunk head screw 6x (without picture)</li>
<li>M2 x 4 cylinder head screw 2x optional (without picture)</li>
<li>Cable 0.5mm² (without picture)</li>
</ul>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1600 zoooom" src="https://nerd-corner.com/wp-content/uploads/2024/10/voltmeter-2.jpg" alt="list of components" width="2310" height="1371" srcset="https://nerd-corner.com/wp-content/uploads/2024/10/voltmeter-2.jpg 2319w, https://nerd-corner.com/wp-content/uploads/2024/10/voltmeter-2-300x178.jpg 300w, https://nerd-corner.com/wp-content/uploads/2024/10/voltmeter-2-1024x608.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2024/10/voltmeter-2-768x456.jpg 768w, https://nerd-corner.com/wp-content/uploads/2024/10/voltmeter-2-1536x911.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2024/10/voltmeter-2-2048x1215.jpg 2048w, https://nerd-corner.com/wp-content/uploads/2024/10/voltmeter-2-445x265.jpg 445w" sizes="auto, (max-width: 2310px) 100vw, 2310px" /></p>
<p>As can be seen in Fig. 3.0, there are two different types of mini voltmeters. The one with two cables (Figure 3.0.1) and the one with three cables (Figure 3.0.2).<br />
The main difference is that with the mini-voltmeter with two cables, the supply voltage is the same as the voltage to be measured (Figure 3.0.1).</p>
<p>However, there is a problem with this variant. If the voltage is below 4.7V, the mini-voltmeter will no longer work as it requires a supply voltage of at least 4.7V. So if you want to measure a voltage below 4.7V, you need a supply voltage above 4.7V and a separate cable to measure the voltage (Fig. 3.0.2).</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1599 zoooom" src="https://nerd-corner.com/wp-content/uploads/2024/10/Voltmeter-3.jpg" alt="" width="2310" height="1371" srcset="https://nerd-corner.com/wp-content/uploads/2024/10/Voltmeter-3.jpg 2319w, https://nerd-corner.com/wp-content/uploads/2024/10/Voltmeter-3-300x178.jpg 300w, https://nerd-corner.com/wp-content/uploads/2024/10/Voltmeter-3-1024x608.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2024/10/Voltmeter-3-768x456.jpg 768w, https://nerd-corner.com/wp-content/uploads/2024/10/Voltmeter-3-1536x911.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2024/10/Voltmeter-3-2048x1215.jpg 2048w, https://nerd-corner.com/wp-content/uploads/2024/10/Voltmeter-3-445x265.jpg 445w" sizes="auto, (max-width: 2310px) 100vw, 2310px" /></p>
<p>You can also convert a mini-voltmeter with three cables into a mini-voltmeter with two cables. You only need to solder a bridge between +Ub and input at jumper-1 (Figure 3.1.1). Jumpers two to four are used for fine adjustment of the mini-voltmeter (Fig. 3.1.1), in some cases the step widths are printed on as in Fig. 3.0.1.<br />
How such a mini-voltmeter is constructed in detail is documented <a style="font-size: 1.125rem;" href="https://chinese-electronics-products-tested.blogspot.com/p/dsn-dvm-368-digital-voltmeter-tested.html" target="_blank" rel="noopener">here </a><span style="font-size: 1.125rem;">or </span><a style="font-size: 1.125rem;" href="https://chinese-electronics-products-tested.blogspot.com/p/dsn-dvm-368-digital-voltmeter-tested.html" target="_blank" rel="noopener">here </a><span style="font-size: 1.125rem;">for example.</span></p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1598 zoooom" src="https://nerd-corner.com/wp-content/uploads/2024/10/voltmeter-3.1.jpg" alt="" width="2310" height="1371" srcset="https://nerd-corner.com/wp-content/uploads/2024/10/voltmeter-3.1.jpg 2319w, https://nerd-corner.com/wp-content/uploads/2024/10/voltmeter-3.1-300x178.jpg 300w, https://nerd-corner.com/wp-content/uploads/2024/10/voltmeter-3.1-1024x608.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2024/10/voltmeter-3.1-768x456.jpg 768w, https://nerd-corner.com/wp-content/uploads/2024/10/voltmeter-3.1-1536x911.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2024/10/voltmeter-3.1-2048x1215.jpg 2048w, https://nerd-corner.com/wp-content/uploads/2024/10/voltmeter-3.1-445x265.jpg 445w" sizes="auto, (max-width: 2310px) 100vw, 2310px" /></p>
<h2>Construction</h2>
<p>Because of these two different types, I have decided to construct two housings. Let&#8217;s start with the variant for the two-cable mini-voltmeter. In the past, I have installed mini-voltmeters in enclosures several times and in doing so have become familiar with the challenges of dimensional accuracy and the diversity of variants from different manufacturers. Despite supposedly standardized components, you often have to reckon with slight deviations in the dimensions. It is therefore important to take larger tolerances into account in the design.</p>
<p>One of the housings I designed was intended for the LM2587 step-up module (Figure 3.2.1). This housing seemed suitable for modification to meet the new requirements. It already contains holders for the hollow plug (2.0.3) and the hollow socket (2.0.2) that I want to use. There is also already a recess in the cover for the mini voltmeter (2.0.1). I am largely satisfied with the dimensions (Figure 3.2.2), apart from the length. What bothers me, however, is the position of the voltmeter in the lid &#8211; it should be placed more centrally, i.e. closer to the middle.</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1597 zoooom" src="https://nerd-corner.com/wp-content/uploads/2024/10/3-2.jpg" alt="" width="2310" height="1371" srcset="https://nerd-corner.com/wp-content/uploads/2024/10/3-2.jpg 2319w, https://nerd-corner.com/wp-content/uploads/2024/10/3-2-300x178.jpg 300w, https://nerd-corner.com/wp-content/uploads/2024/10/3-2-1024x608.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2024/10/3-2-768x456.jpg 768w, https://nerd-corner.com/wp-content/uploads/2024/10/3-2-1536x911.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2024/10/3-2-2048x1215.jpg 2048w, https://nerd-corner.com/wp-content/uploads/2024/10/3-2-445x265.jpg 445w" sizes="auto, (max-width: 2310px) 100vw, 2310px" /></p>
<p>First I start with the modification of the lid. I&#8217;m happy with the width and height, but the housing is too long. I therefore shorten the cover on the side where the hollow socket (2.0.2) is attached. This does not affect the holder of the hollow plug, as this is already perfectly matched to the plug. When shortening, care must be taken to ensure that the internal components do not touch and that there is sufficient space for the cabling. However, you should not overdo it with the reduction in size, as stability and feel are also important factors in a design.</p>
<p>After weighing up all the factors, I shorten the length of the housing or cover to 63.5 mm, and the position of the mini-voltmeter is now centered on the cover (Figure 4.0.1). I have removed the hole for adjusting the LM2587S (marked in white) and the ventilation slots, as no adjustment is required and no ventilation is necessary due to the low heat development.</p>
<p>In picture 4.0.2 (marked in red) you can see that I have changed the recesses or pockets, as some mini voltmeters have a flat surface instead of tabs (picture 4.0.3).</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1596 zoooom" src="https://nerd-corner.com/wp-content/uploads/2024/10/4-0-1.jpg" alt="" width="2310" height="1371" srcset="https://nerd-corner.com/wp-content/uploads/2024/10/4-0-1.jpg 2319w, https://nerd-corner.com/wp-content/uploads/2024/10/4-0-1-300x178.jpg 300w, https://nerd-corner.com/wp-content/uploads/2024/10/4-0-1-1024x608.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2024/10/4-0-1-768x456.jpg 768w, https://nerd-corner.com/wp-content/uploads/2024/10/4-0-1-1536x911.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2024/10/4-0-1-2048x1215.jpg 2048w, https://nerd-corner.com/wp-content/uploads/2024/10/4-0-1-445x265.jpg 445w" sizes="auto, (max-width: 2310px) 100vw, 2310px" /></p>
<p>In the next step, I shorten the housing to 63.5 mm, similar to the cover. I also remove the mounting pillars for the <a href="https://nerd-corner.com/improved-lm2587s-voltage-converter-step-up-modul-dc-dc/">LM2587S</a> module, as shown in Figure 4.1.1. On the side of the hollow socket, I remove the recess and move the hole pattern 1 mm upwards, towards the cover (Fig. 4.1.2). Finally, the lettering is corrected to VOLT METER.</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1595 zoooom" src="https://nerd-corner.com/wp-content/uploads/2024/10/4-1-1.jpg" alt="" width="2310" height="1371" srcset="https://nerd-corner.com/wp-content/uploads/2024/10/4-1-1.jpg 2319w, https://nerd-corner.com/wp-content/uploads/2024/10/4-1-1-300x178.jpg 300w, https://nerd-corner.com/wp-content/uploads/2024/10/4-1-1-1024x608.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2024/10/4-1-1-768x456.jpg 768w, https://nerd-corner.com/wp-content/uploads/2024/10/4-1-1-1536x911.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2024/10/4-1-1-2048x1215.jpg 2048w, https://nerd-corner.com/wp-content/uploads/2024/10/4-1-1-445x265.jpg 445w" sizes="auto, (max-width: 2310px) 100vw, 2310px" /></p>
<h2>3D print of the first variant</h2>
<p>Let&#8217;s move on to printing the parts for our variant 1 with two cables. We only need three parts for this variant:</p>
<ul>
<li>Housing Fig. 5.0.1</li>
<li>Cover Fig. 5.0.2</li>
<li>Hollow socket holder Fig. 5.0.3</li>
</ul>
<p>There are no special requirements for printing these parts and no special material is needed. In this case, I used inexpensive PLA from a reliable manufacturer. The printing was done on a Prusa MK4 with the usual standard settings.</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1594 zoooom" src="https://nerd-corner.com/wp-content/uploads/2024/10/5-0.jpg" alt="" width="2310" height="1371" srcset="https://nerd-corner.com/wp-content/uploads/2024/10/5-0.jpg 2319w, https://nerd-corner.com/wp-content/uploads/2024/10/5-0-300x178.jpg 300w, https://nerd-corner.com/wp-content/uploads/2024/10/5-0-1024x608.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2024/10/5-0-768x456.jpg 768w, https://nerd-corner.com/wp-content/uploads/2024/10/5-0-1536x911.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2024/10/5-0-2048x1215.jpg 2048w, https://nerd-corner.com/wp-content/uploads/2024/10/5-0-445x265.jpg 445w" sizes="auto, (max-width: 2310px) 100vw, 2310px" /></p>
<p>When reworking the printed parts for variant one, only four M2 threads need to be cut into the housing (Fig. 6.0.1) and two M2 threads on the mounting bridge for the hollow bushing (Fig. 6.0.2). Two M2 threads must also be cut in the cover (Figure 6.0.3). Alternatively, self-tapping screws can be used or the parts can be partially glued.</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1593 zoooom" src="https://nerd-corner.com/wp-content/uploads/2024/10/6-0.jpg" alt="" width="2310" height="1371" srcset="https://nerd-corner.com/wp-content/uploads/2024/10/6-0.jpg 2319w, https://nerd-corner.com/wp-content/uploads/2024/10/6-0-300x178.jpg 300w, https://nerd-corner.com/wp-content/uploads/2024/10/6-0-1024x608.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2024/10/6-0-768x456.jpg 768w, https://nerd-corner.com/wp-content/uploads/2024/10/6-0-1536x911.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2024/10/6-0-2048x1215.jpg 2048w, https://nerd-corner.com/wp-content/uploads/2024/10/6-0-445x265.jpg 445w" sizes="auto, (max-width: 2310px) 100vw, 2310px" /></p>
<h2>Soldering and wiring the first variant</h2>
<p>Once all the parts for variant one have been printed and processed, the hollow socket is soldered to the cables. The positive and negative poles to which the cables are soldered are marked in Figure 6.1.1 (Figure 6.1.2). The cables of the hollow socket and the mini voltmeter are then screwed into the hollow plug (Fig. 6.1.3). Whether the cables are twisted or soldered at the ends is a matter of taste. I always connect the cables of the mini-voltmeter to the current output. Figure 6.1.4 shows the complete inner workings soldered and wired. To stabilize the solder joints on the mini-voltmeter, I reinforced them with a small drop of hot glue. Finally, the hollow socket is inserted into the back of the housing and the hollow plug is pushed into the recess provided (Fig. 6.1.5).</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1592 zoooom" src="https://nerd-corner.com/wp-content/uploads/2024/10/6-1.jpg" alt="" width="2310" height="1371" srcset="https://nerd-corner.com/wp-content/uploads/2024/10/6-1.jpg 2319w, https://nerd-corner.com/wp-content/uploads/2024/10/6-1-300x178.jpg 300w, https://nerd-corner.com/wp-content/uploads/2024/10/6-1-1024x608.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2024/10/6-1-768x456.jpg 768w, https://nerd-corner.com/wp-content/uploads/2024/10/6-1-1536x911.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2024/10/6-1-2048x1215.jpg 2048w, https://nerd-corner.com/wp-content/uploads/2024/10/6-1-445x265.jpg 445w" sizes="auto, (max-width: 2310px) 100vw, 2310px" /></p>
<p>In the penultimate step, I push the mini-voltmeter into the cut-out provided in the cover and secure it by screwing or gluing it in place (Fig. 6.2.1). The cover is then screwed to the housing (Figure 6.2.2). Finally, carry out a function test (Figure 6.2.3).</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1591 zoooom" src="https://nerd-corner.com/wp-content/uploads/2024/10/6-2.jpg" alt="" width="2310" height="1371" srcset="https://nerd-corner.com/wp-content/uploads/2024/10/6-2.jpg 2319w, https://nerd-corner.com/wp-content/uploads/2024/10/6-2-300x178.jpg 300w, https://nerd-corner.com/wp-content/uploads/2024/10/6-2-1024x608.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2024/10/6-2-768x456.jpg 768w, https://nerd-corner.com/wp-content/uploads/2024/10/6-2-1536x911.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2024/10/6-2-2048x1215.jpg 2048w, https://nerd-corner.com/wp-content/uploads/2024/10/6-2-445x265.jpg 445w" sizes="auto, (max-width: 2310px) 100vw, 2310px" /></p>
<h2>Construction of the second variant</h2>
<p>If you do not want to measure or display the voltage below 4.7 V with the mini-voltmeter, you can stop at this point. However, as I mentioned at the beginning, it is possible to operate these mini-voltmeters with three cables. This option is available if jumper1 (Figure 3.1.1) is not set or not bridged. As the mini-voltmeter requires a minimum supply voltage of 4.7 V in order to function, we need a second voltage source that is above this limit.</p>
<p>In variant one of the housing, however, there is only one input, which is why a second current input is required. As I don&#8217;t want to change the dimensions of the housing and there is hardly any space for a second hollow socket, an alternative solution is needed. The solution is a micro-USB board (Figure 2.0.4), which is flat and based on the widely used micro-USB standard.</p>
<p>The question now arises as to where the second connection should be positioned. A side connection would take up too much space, e.g. on a table, as the cable would protrude upwards or downwards at a 90° angle. For me, the best solution is to place the USB port on the same side as the hollow socket.</p>
<p>The next question concerns the mounting of the micro USB board: should it be attached directly to the housing or simply glued on? After careful consideration, I decided to mount the board on the retaining bridge of the hollow socket (Figures 5.0.3, 6.0.2 and 7.0.1). In picture 7.0.2 you can see how I attached a plate to the holder bridge. This plate has two M2 threaded holes (marked in white) for attaching the micro USB board and two cut-outs for cables and solder.</p>
<p>On the housing (Figure 7.0.3), the drilling pattern (marked red) must be moved 1.5 mm towards the cover to create space for the slot of the micro USB connector. The slot (marked yellow) is positioned below the hollow socket.</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1590" style="font-size: 1.125rem;" src="https://nerd-corner.com/wp-content/uploads/2024/10/7-0.jpg" alt="" width="2310" height="1371" srcset="https://nerd-corner.com/wp-content/uploads/2024/10/7-0.jpg 2319w, https://nerd-corner.com/wp-content/uploads/2024/10/7-0-300x178.jpg 300w, https://nerd-corner.com/wp-content/uploads/2024/10/7-0-1024x608.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2024/10/7-0-768x456.jpg 768w, https://nerd-corner.com/wp-content/uploads/2024/10/7-0-1536x911.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2024/10/7-0-2048x1215.jpg 2048w, https://nerd-corner.com/wp-content/uploads/2024/10/7-0-445x265.jpg 445w" sizes="auto, (max-width: 2310px) 100vw, 2310px" /></p>
<p>Printing is relatively quick. We need the housing with USB slot (Fig. 8.0.1), the cover (Fig. 8.0.2) and the new holder for the hollow socket and USB board (Fig. 8.0.3).</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1589 zoooom" src="https://nerd-corner.com/wp-content/uploads/2024/10/8-0.jpg" alt="" width="2310" height="1371" srcset="https://nerd-corner.com/wp-content/uploads/2024/10/8-0.jpg 2319w, https://nerd-corner.com/wp-content/uploads/2024/10/8-0-300x178.jpg 300w, https://nerd-corner.com/wp-content/uploads/2024/10/8-0-1024x608.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2024/10/8-0-768x456.jpg 768w, https://nerd-corner.com/wp-content/uploads/2024/10/8-0-1536x911.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2024/10/8-0-2048x1215.jpg 2048w, https://nerd-corner.com/wp-content/uploads/2024/10/8-0-445x265.jpg 445w" sizes="auto, (max-width: 2310px) 100vw, 2310px" /></p>
<p>In the post-processing of the printed parts for variant “two”, the thread must now be cut. M2 4x on the housing (Fig. 9.0.1) and 4x M2 mounting bridge for the hollow socket and USB board (Fig. 9.0.2). Two M2 threads must also be cut on the cover (Fig. 9.0.3).</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1588 zoooom" src="https://nerd-corner.com/wp-content/uploads/2024/10/9-0.jpg" alt="" width="2310" height="1374" srcset="https://nerd-corner.com/wp-content/uploads/2024/10/9-0.jpg 2319w, https://nerd-corner.com/wp-content/uploads/2024/10/9-0-300x178.jpg 300w, https://nerd-corner.com/wp-content/uploads/2024/10/9-0-1024x609.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2024/10/9-0-768x457.jpg 768w, https://nerd-corner.com/wp-content/uploads/2024/10/9-0-1536x913.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2024/10/9-0-2048x1218.jpg 2048w, https://nerd-corner.com/wp-content/uploads/2024/10/9-0-890x530.jpg 890w, https://nerd-corner.com/wp-content/uploads/2024/10/9-0-445x265.jpg 445w" sizes="auto, (max-width: 2310px) 100vw, 2310px" /></p>
<h2>Soldering and screwing the second variant</h2>
<p>The parts must now be soldered and screwed together, as in variant one (Fig. 6.1). It should be noted that there is now an additional cable and the wiring is different to variant one. The mini-voltmeter is now powered externally via the micro-USB connection. The negative pole is routed from the hollow socket (9.1.3) to the USB board (9.1.1), then to the mini-voltmeter (9.1.2) and finally to the hollow plug (9.1.4).</p>
<p>The positive cable for the power supply of the mini-voltmeter (9.1.2) goes from the positive pole of the micro USB (9.1.1) directly to the positive pole of the mini-voltmeter (9.1.2). The main power cable runs from the positive pole of the hollow socket (9.1.3) to the positive pole of the hollow plug (9.1.4). The test lead runs directly from the mini-voltmeter (9.1.2) to the positive pole of the hollow plug (9.1.4).</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1587 zoooom" src="https://nerd-corner.com/wp-content/uploads/2024/10/9-1.jpg" alt="" width="2310" height="1371" srcset="https://nerd-corner.com/wp-content/uploads/2024/10/9-1.jpg 2319w, https://nerd-corner.com/wp-content/uploads/2024/10/9-1-300x178.jpg 300w, https://nerd-corner.com/wp-content/uploads/2024/10/9-1-1024x608.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2024/10/9-1-768x456.jpg 768w, https://nerd-corner.com/wp-content/uploads/2024/10/9-1-1536x911.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2024/10/9-1-2048x1215.jpg 2048w, https://nerd-corner.com/wp-content/uploads/2024/10/9-1-445x265.jpg 445w" sizes="auto, (max-width: 2310px) 100vw, 2310px" /></p>
<p>Figure 9.2.1 shows how to screw the USB board (9.1.1) to the hollow socket holder (9.0.2). Figure 9.2.2 shows the hollow socket 9.1.3 and the USB board 9.1.1 completely soldered, screwed to the hollow socket holder and then fixed again with hot glue. The result can be seen in picture 9.2.1.</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1586 zoooom" src="https://nerd-corner.com/wp-content/uploads/2024/10/9-2.jpg" alt="" width="2310" height="1371" srcset="https://nerd-corner.com/wp-content/uploads/2024/10/9-2.jpg 2319w, https://nerd-corner.com/wp-content/uploads/2024/10/9-2-300x178.jpg 300w, https://nerd-corner.com/wp-content/uploads/2024/10/9-2-1024x608.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2024/10/9-2-768x456.jpg 768w, https://nerd-corner.com/wp-content/uploads/2024/10/9-2-1536x911.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2024/10/9-2-2048x1215.jpg 2048w, https://nerd-corner.com/wp-content/uploads/2024/10/9-2-445x265.jpg 445w" sizes="auto, (max-width: 2310px) 100vw, 2310px" /></p>
<p>After successfully soldering and gluing, I assemble the mini-voltmeter variant “two”. First, I insert the retaining bridge for the hollow socket and USB board into the back of the housing and screw it in from the outside (Fig. 9.3.1).</p>
<p>The hollow plug is then inserted into the recess provided and pressed down to the bottom (Fig. 9.3.2). Now press the mini-voltmeter into the cover and either screw or glue it in place (Fig. 9.3.3). Finally, the cover is fitted and screwed on with the M2 screws (Fig. 9.3.4).</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1585 zoooom" src="https://nerd-corner.com/wp-content/uploads/2024/10/9-3.jpg" alt="" width="2310" height="1371" srcset="https://nerd-corner.com/wp-content/uploads/2024/10/9-3.jpg 2319w, https://nerd-corner.com/wp-content/uploads/2024/10/9-3-300x178.jpg 300w, https://nerd-corner.com/wp-content/uploads/2024/10/9-3-1024x608.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2024/10/9-3-768x456.jpg 768w, https://nerd-corner.com/wp-content/uploads/2024/10/9-3-1536x911.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2024/10/9-3-2048x1215.jpg 2048w, https://nerd-corner.com/wp-content/uploads/2024/10/9-3-445x265.jpg 445w" sizes="auto, (max-width: 2310px) 100vw, 2310px" /></p>
<h2>Function test</h2>
<p>Now it&#8217;s time for the essential function test. For this we need a micro USB power supply unit and a 12V power supply unit with a 5.5&#215;2.1 mm hollow plug. First, I connect the micro USB power supply, which supplies 5V, to the housing. The display of the mini-voltmeter lights up and shows zero (Figure 9.4.1). This is the expected result, as there is still no voltage on the line to be measured. Only when I connect the 12V power supply unit with hollow plug does the mini-voltmeter correctly display 12V (Fig. 9.4.2).</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1603 zoooom" src="https://nerd-corner.com/wp-content/uploads/2024/10/9-4.jpg" alt="DIY voltmeter" width="2310" height="1371" srcset="https://nerd-corner.com/wp-content/uploads/2024/10/9-4.jpg 2319w, https://nerd-corner.com/wp-content/uploads/2024/10/9-4-300x178.jpg 300w, https://nerd-corner.com/wp-content/uploads/2024/10/9-4-1024x608.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2024/10/9-4-768x456.jpg 768w, https://nerd-corner.com/wp-content/uploads/2024/10/9-4-1536x911.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2024/10/9-4-2048x1215.jpg 2048w, https://nerd-corner.com/wp-content/uploads/2024/10/9-4-445x265.jpg 445w" sizes="auto, (max-width: 2310px) 100vw, 2310px" /></p>
<p>Everything works perfectly and adds value for me in the workshop.</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1602 size-full" src="https://nerd-corner.com/wp-content/uploads/2024/10/Mini_Voltmeter.gif" alt="mini digital voltmeter" width="781" height="492" /></p>
<p>&nbsp;</p>
<h2>Files to download</h2>
<ul>
<li><a href="https://www.thingiverse.com/thing:6531794">Mini digital voltmeter</a></li>
</ul>
<p>The post <a href="https://nerd-corner.com/mini-digital-voltmeter/">Mini Digital Voltmeter</a> appeared first on <a href="https://nerd-corner.com">Nerd Corner</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://nerd-corner.com/mini-digital-voltmeter/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Dupont Connector V1.1</title>
		<link>https://nerd-corner.com/dupont-connector-v1-1/</link>
					<comments>https://nerd-corner.com/dupont-connector-v1-1/#respond</comments>
		
		<dc:creator><![CDATA[Nerds]]></dc:creator>
		<pubDate>Wed, 14 Aug 2024 09:10:06 +0000</pubDate>
				<category><![CDATA[Handcrafted]]></category>
		<category><![CDATA[SolidWorks]]></category>
		<category><![CDATA[3D print]]></category>
		<category><![CDATA[CAD]]></category>
		<category><![CDATA[CAD design]]></category>
		<category><![CDATA[case]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[DIY]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[housing]]></category>
		<category><![CDATA[precise]]></category>
		<category><![CDATA[Solid Works]]></category>
		<guid isPermaLink="false">https://nerd-corner.com/de/?p=1619</guid>

					<description><![CDATA[<p>In response to the extremely positive feedback on my quick connectors (Dupont connectors), I realized that their original purpose of only being used in the &#8230; </p>
<p>The post <a href="https://nerd-corner.com/dupont-connector-v1-1/">Dupont Connector V1.1</a> appeared first on <a href="https://nerd-corner.com">Nerd Corner</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>In response to the extremely positive feedback on my quick connectors (Dupont connectors), I realized that their original purpose of only being used in the development environment has been extended to permanent use on various devices. Many people also expressed the wish to be able to mount the connectors permanently or screw them on. I have now fulfilled this wish.</p>
<p><em><strong>You may also be interested in:</strong> <a href="https://nerd-corner.com/3d-printed-dupont-connector-for-jumper-cable/">3D printed Dupont connector for jumper cables</a></em></p>
<h2>Implementation of the Dupont connector</h2>
<p>As with any new development or modification of an existing part, a number of decisions had to be made, but in this case not many were necessary.</p>
<ul>
<li><strong>Number of fixing lugs:</strong> two or four</li>
<li><strong>Diameter of the fixing holes:</strong> 2.2 mm</li>
<li><strong>Cover removable after fastening:</strong> yes</li>
</ul>
<p>With the number of fixing lugs, it is clear that a single lug will cause the housing to rotate around the screw if it is not tightened firmly enough. When the connection is inserted or removed, the housing tries to rotate around the screw. With two or more tabs, insertion and removal can be achieved without any problems, even if the screws are not fully tightened.</p>
<p>The diameter of the fixing holes has been set at 2.2 mm for M2 screws. Larger screws would make the lugs larger than the connector housing itself, and two M2 screws already provide sufficient holding force.</p>
<p>The decision as to whether the cover should still be removable after the connector had been attached was inevitable. As the clamping tabs of the cover protrude from the base of the housing, the fastening tabs had to be raised above the base anyway. If the lugs were flush with the base of the housing, the lid could rise by around 0.3 mm when the screws were tightened. Why were the fixing lugs not attached directly to the lid? The lid is not stable enough to support the side tabs. The distance between the surface and the base of the housing is 1.1 mm when screwed on, which is sufficient to remove the lid without any problems.</p>
<p>Regarding the fixing holes with a diameter of 2.2 mm: The hole spacing is always a multiple of 2.54 mm, which makes sense as the DuPont plugs also have a width and height of 2.54 mm. The hole spacing increases in proportion to the number of pins on the housing. A positive side effect: These distances also match the holes of a breadboard. In Figure 1.0.1 I have mounted two 4-pin connectors on a breadboard. For the attachment, I used the matching holes at the distance of the 4-pin connectors and cut threads with an M2 tap. As you can see, the screws hold perfectly without the need for a nut.</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1614 zoooom" src="https://nerd-corner.com/wp-content/uploads/2024/10/1_1.jpg" alt="Dupont Steckverbindung" width="2310" height="1355" srcset="https://nerd-corner.com/wp-content/uploads/2024/10/1_1.jpg 2316w, https://nerd-corner.com/wp-content/uploads/2024/10/1_1-300x176.jpg 300w, https://nerd-corner.com/wp-content/uploads/2024/10/1_1-1024x601.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2024/10/1_1-768x451.jpg 768w, https://nerd-corner.com/wp-content/uploads/2024/10/1_1-1536x901.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2024/10/1_1-2048x1202.jpg 2048w" sizes="auto, (max-width: 2310px) 100vw, 2310px" /></p>
<p>Yes, that&#8217;s almost it for this time &#8211; we&#8217;re actually finished now, but two things are still important to me. Firstly, I would like to talk about the versatility of the connectors. I&#8217;ve been using them for four years and am constantly discovering new ways to use them flexibly. Below are some examples with version one, which is identical to version 1.1 except for the screw-on option.</p>
<p>Figure 2.0.1 shows a 10-PIN connector with a 200 mm jumper cable. Figure 2.0.2 shows the difference between a 10-PIN connector with a 100 mm jumper cable and one with a 200 mm jumper cable.</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1613 zoooom" src="https://nerd-corner.com/wp-content/uploads/2024/10/2.jpg" alt="Dupont connector" width="2310" height="1355" srcset="https://nerd-corner.com/wp-content/uploads/2024/10/2.jpg 2316w, https://nerd-corner.com/wp-content/uploads/2024/10/2-300x176.jpg 300w, https://nerd-corner.com/wp-content/uploads/2024/10/2-1024x601.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2024/10/2-768x451.jpg 768w, https://nerd-corner.com/wp-content/uploads/2024/10/2-1536x901.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2024/10/2-2048x1202.jpg 2048w" sizes="auto, (max-width: 2310px) 100vw, 2310px" /></p>
<p>Figure 2.1.1 shows a 9-PIN connector on one side and three different connectors on the opposite side. Figure 2.1.2 shows this side enlarged. Here you can see the three connectors: a 4-PIN connector, next to it a 3-PIN connector and on the far left a 2-PIN connector. If you add up the pins of the three connectors, you get the nine pins as on the other side.</p>
<p>You have probably noticed that the DuPont plugs of the three connections are different. On the 4-PIN connector, all pins are male, i.e. pins. In contrast, all pins on the middle 3-PIN connector are female, i.e. sockets. The 2-PIN connector, which combines a male and a female connector, is particularly interesting. What is it all about? Here I would like to demonstrate the flexibility of Nerd-Corner&#8217;s tool-free connector system. As with the 2-PIN plug, these plugs can be used to install reverse polarity protection: The pin is the positive pole, the socket is the negative pole. The reverse is true for the mating connector, which means that the connection cannot be plugged in incorrectly!</p>
<p>The 2-PIN plug is the simplest example, but this principle can be applied to all plugs so that more complex protection systems can also be set up.</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1612 zoooom" src="https://nerd-corner.com/wp-content/uploads/2024/10/2-1.jpg" alt="dupont steckverbindung" width="2310" height="1355" srcset="https://nerd-corner.com/wp-content/uploads/2024/10/2-1.jpg 2316w, https://nerd-corner.com/wp-content/uploads/2024/10/2-1-300x176.jpg 300w, https://nerd-corner.com/wp-content/uploads/2024/10/2-1-1024x601.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2024/10/2-1-768x451.jpg 768w, https://nerd-corner.com/wp-content/uploads/2024/10/2-1-1536x901.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2024/10/2-1-2048x1202.jpg 2048w" sizes="auto, (max-width: 2310px) 100vw, 2310px" /></p>
<p>The structure in Figure 2.2.1 shows another way of creating a wiring harness. There is a 10-PIN connector on the left-hand side and a 5-PIN connector on the far right, connected by a 200 mm jumper cable. The orange 3-PIN connector is connected to the 10-PIN connector via a 400 mm jumper cable, as is the 2-PIN connector, but with a 500 mm jumper cable. This solution offers unlimited flexibility across the entire connector family and is completely tool-free.</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1611 zoooom" src="https://nerd-corner.com/wp-content/uploads/2024/10/2-2.jpg" alt="dupont connector" width="2310" height="1355" srcset="https://nerd-corner.com/wp-content/uploads/2024/10/2-2.jpg 2316w, https://nerd-corner.com/wp-content/uploads/2024/10/2-2-300x176.jpg 300w, https://nerd-corner.com/wp-content/uploads/2024/10/2-2-1024x601.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2024/10/2-2-768x451.jpg 768w, https://nerd-corner.com/wp-content/uploads/2024/10/2-2-1536x901.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2024/10/2-2-2048x1202.jpg 2048w" sizes="auto, (max-width: 2310px) 100vw, 2310px" /></p>
<h2>Assembling the Dupont connector</h2>
<p>I keep getting requests to build connector housings for 15 or 22 pins. Unfortunately, this is not impossible with this system, but it is a major challenge. The effort involved is disproportionate to the benefit &#8211; at least for me. I actually wanted to stop at the 6-PIN version, as the assembly requires a lot of fine motor skills and the holding force of the tabs decreases. I was able to solve the problem of the holding force from the 7-PIN version onwards by using a third tab, but this made assembly very difficult.</p>
<p>However, there is usually a solution, as can be seen in picture series 3.0.</p>
<p>In picture 3.0.1 you can see that a female connector comes into play, as we are using male (pin) cables here. A pin header could be used instead for female cables.</p>
<p>The procedure for assembling with male cables (pins) is as follows:</p>
<ol>
<li>Push the cables into the socket strip.</li>
<li>Press the inserted DuPont housings lightly into the base of the connector and press the cables into the recesses provided (see Fig. 3.0.1).</li>
<li>Press the DuPont housings fully into the base of the housing and push them towards the internal stop strip. Then pull the cables backwards one by one &#8211; the socket strip should not be removed (Fig. 3.0.2).</li>
<li>As soon as the DuPont plugs are fixed in the housing, the cover is fitted and snapped into place (Fig. 3.0.3).</li>
<li>Finally, the socket strip is removed and the assembly is complete (Fig. 3.0.4).</li>
</ol>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1610 zoooom" src="https://nerd-corner.com/wp-content/uploads/2024/10/3.jpg" alt="Dupont Stecker" width="2310" height="1355" srcset="https://nerd-corner.com/wp-content/uploads/2024/10/3.jpg 2316w, https://nerd-corner.com/wp-content/uploads/2024/10/3-300x176.jpg 300w, https://nerd-corner.com/wp-content/uploads/2024/10/3-1024x601.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2024/10/3-768x451.jpg 768w, https://nerd-corner.com/wp-content/uploads/2024/10/3-1536x901.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2024/10/3-2048x1202.jpg 2048w" sizes="auto, (max-width: 2310px) 100vw, 2310px" /></p>
<h2>Files to download</h2>
<ul>
<li><a href="https://www.thingiverse.com/thing:6515743" target="_blank" rel="noopener">Dupont Connector 3PIN</a></li>
</ul>
<p>&nbsp;</p>
<p>The post <a href="https://nerd-corner.com/dupont-connector-v1-1/">Dupont Connector V1.1</a> appeared first on <a href="https://nerd-corner.com">Nerd Corner</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://nerd-corner.com/dupont-connector-v1-1/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Using a barrel jack as a switch</title>
		<link>https://nerd-corner.com/using-a-barrel-jack-as-a-switch/</link>
					<comments>https://nerd-corner.com/using-a-barrel-jack-as-a-switch/#respond</comments>
		
		<dc:creator><![CDATA[Nerds]]></dc:creator>
		<pubDate>Tue, 18 Jun 2024 17:11:28 +0000</pubDate>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[3D print]]></category>
		<category><![CDATA[barrel jack]]></category>
		<category><![CDATA[CAD design]]></category>
		<category><![CDATA[case]]></category>
		<category><![CDATA[DIY]]></category>
		<category><![CDATA[guide]]></category>
		<category><![CDATA[housing]]></category>
		<category><![CDATA[Powerbank]]></category>
		<category><![CDATA[Step by step guide]]></category>
		<category><![CDATA[switch]]></category>
		<category><![CDATA[user guide]]></category>
		<category><![CDATA[Voltmeter]]></category>
		<guid isPermaLink="false">https://nerd-corner.com/de/?p=1577</guid>

					<description><![CDATA[<p>In many everyday devices, such as battery-operated radios, lamps, torches and especially laptops, a barrel jack is used for the power supply. In these cases, &#8230; </p>
<p>The post <a href="https://nerd-corner.com/using-a-barrel-jack-as-a-switch/">Using a barrel jack as a switch</a> appeared first on <a href="https://nerd-corner.com">Nerd Corner</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>In many everyday devices, such as battery-operated radios, lamps, torches and especially laptops, a barrel jack is used for the power supply. In these cases, the barrel jack often serves as a switch: as soon as a plug is inserted, the power supply from the battery, rechargeable battery or other source is interrupted and the device is supplied with power directly from the plug, thus saving the battery. The primary circuit is disconnected purely mechanically.</p>
<p><em><strong>This might also be interesting for you: </strong><a href="https://nerd-corner.com/diy-powerbank-with-voltage-regulator-and-voltmeter/">Do it yourself powerbank with voltage regulator and voltmeter</a></em></p>
<h2>List of components</h2>
<p>To demonstrate the function, I have decided on a small test setup. I need the following for my test setup:</p>
<ul>
<li>Barrel jack 5,5 x 2,1 (1.0.1)</li>
<li>Voltmeter (1.0.2)</li>
<li>5V power supply unit (1.0.3)</li>
<li>Barrel jack holder (1.0.4)</li>
<li>Barrel jack Bridge(1.0.5)</li>
<li>Some cables (1.0.6)</li>
</ul>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1569 zoooom" src="https://nerd-corner.com/wp-content/uploads/2024/06/1-0.jpg" alt="Hohlbuchse komponenten" width="2280" height="1332" srcset="https://nerd-corner.com/wp-content/uploads/2024/06/1-0.jpg 2291w, https://nerd-corner.com/wp-content/uploads/2024/06/1-0-300x175.jpg 300w, https://nerd-corner.com/wp-content/uploads/2024/06/1-0-1024x598.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2024/06/1-0-768x449.jpg 768w, https://nerd-corner.com/wp-content/uploads/2024/06/1-0-1536x897.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2024/06/1-0-2048x1196.jpg 2048w" sizes="auto, (max-width: 2280px) 100vw, 2280px" /></p>
<h2>Assembly instructions for bracket and bridge</h2>
<p>The first step is to print the holder (1.0.4) and the bridge (1.0.5) with the 3D printer. After cleaning the printed parts, I cut two M2 threads into the holder (see 2.0.1). If you prefer to work with self-tapping screws, you can skip this step. The barrel jack is then pushed into the large hole in the bridge (2.0.2) and screwed tight with the nut on the front of the bridge (2.0.3). Fitting the bridge to the bracket is also very simple: Slide the bridge with the recesses on the right and left over the two cylinder surfaces on the bracket (2.0.4) and secure it with M2 screws (2.0.5). The bracket and bridge with the barrel jack fitted form a very stable unit that can absorb large forces. If everything is fitted correctly, the barrel jack should not protrude, but should be recessed by 0.3 to 0.5 mm.</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1574 zoooom" src="https://nerd-corner.com/wp-content/uploads/2024/06/2-0.jpg" alt="jack socket hohlstecker" width="2280" height="1332" srcset="https://nerd-corner.com/wp-content/uploads/2024/06/2-0.jpg 2291w, https://nerd-corner.com/wp-content/uploads/2024/06/2-0-300x175.jpg 300w, https://nerd-corner.com/wp-content/uploads/2024/06/2-0-1024x598.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2024/06/2-0-768x449.jpg 768w, https://nerd-corner.com/wp-content/uploads/2024/06/2-0-1536x897.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2024/06/2-0-2048x1196.jpg 2048w" sizes="auto, (max-width: 2280px) 100vw, 2280px" /></p>
<h2>Wiring and soldering the barrel jack</h2>
<p>Now we come to the core of this article: wiring and soldering the barrel jack. I use pre-assembled plugs and sockets that already contain crimped cables and a strain relief. The colour coding of the cables is also practical, as red stands for plus and black for minus (3.0.1).</p>
<p>The barrel jack with switching function usually has three solder lugs. The negative pole is always switched, i.e. in figure 3.0.2 this corresponds to number two. The negative pole of the primary power supply, e.g. battery or accumulator, is also soldered on here. Solder lug number one is intended for the common positive terminal; all positive connections are soldered here. The negative pole to the consumers in the device is soldered to soldering lug number three. Figure 3.0.3 shows the complete soldering of the barrel jack.</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1573" src="https://nerd-corner.com/wp-content/uploads/2024/06/3-0.jpg" alt="jack socket hohlstecker" width="2280" height="1332" srcset="https://nerd-corner.com/wp-content/uploads/2024/06/3-0.jpg 2291w, https://nerd-corner.com/wp-content/uploads/2024/06/3-0-300x175.jpg 300w, https://nerd-corner.com/wp-content/uploads/2024/06/3-0-1024x598.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2024/06/3-0-768x449.jpg 768w, https://nerd-corner.com/wp-content/uploads/2024/06/3-0-1536x897.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2024/06/3-0-2048x1196.jpg 2048w" sizes="auto, (max-width: 2280px) 100vw, 2280px" /></p>
<h2>Assembly and connection</h2>
<p>After successful soldering, you can now continue with the rest of the test setup. Firstly, the holder with the soldered barrel jack is screwed onto a wooden plate (4.0.1). The two mini-voltmeters are then attached to the wooden plate (4.0.2). The mini voltmeters are a creation of Nerd Corner. <a href="https://nerd-corner.com/diy-powerbank-with-voltage-regulator-and-voltmeter/">If you are interested in such housings, you can read the corresponding article and download the STL files at the following link.</a></p>
<p>Now I connect the cables soldered to the barrel jack to the mini-voltmeters (see Figure 4.0.2, pink frame). Next, I connect the primary power source to my 5V power supply and switch it on (see Figure 4.0.3, yellow frame). After switching on the power supply, a voltage is present at both mini voltmeters: 5.35 volts at the supply (red circle) and 5.28 volts at the load (green circle).</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1572 zoooom" src="https://nerd-corner.com/wp-content/uploads/2024/06/4-0.jpg" alt="jack socket hohlstecker" width="2280" height="1332" srcset="https://nerd-corner.com/wp-content/uploads/2024/06/4-0.jpg 2291w, https://nerd-corner.com/wp-content/uploads/2024/06/4-0-300x175.jpg 300w, https://nerd-corner.com/wp-content/uploads/2024/06/4-0-1024x598.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2024/06/4-0-768x449.jpg 768w, https://nerd-corner.com/wp-content/uploads/2024/06/4-0-1536x897.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2024/06/4-0-2048x1196.jpg 2048w" sizes="auto, (max-width: 2280px) 100vw, 2280px" /></p>
<h2>Integration of the second power source</h2>
<p>As the current flows cleanly via the barrel jack to the consumer, the second power source now comes into play. I operate this with 12 V in order to have a clear difference to the primary power supply. Figure 4.1.1 shows the second power supply with 12.2 volts (turquoise frame).</p>
<p>Now I plug the second power supply with 12 volts into the barrel jack (Figure 4.1.2, blue frame). After a short delay, the value on the consumer&#8217;s mini-voltmeter changes to 12 volts (green frame). Nothing has changed on the primary power supply; it remains plugged in and switched on (red frame). The value is still 5.34 volts, which is 0.01 volts lower than before the second power supply was plugged in, but this is due to the fluctuations of the 5V power supply.</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1571 zoooom" src="https://nerd-corner.com/wp-content/uploads/2024/06/4-1.jpg" alt="jack socket hohlstecker" width="2280" height="1332" srcset="https://nerd-corner.com/wp-content/uploads/2024/06/4-1.jpg 2291w, https://nerd-corner.com/wp-content/uploads/2024/06/4-1-300x175.jpg 300w, https://nerd-corner.com/wp-content/uploads/2024/06/4-1-1024x598.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2024/06/4-1-768x449.jpg 768w, https://nerd-corner.com/wp-content/uploads/2024/06/4-1-1536x897.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2024/06/4-1-2048x1196.jpg 2048w" sizes="auto, (max-width: 2280px) 100vw, 2280px" /></p>
<p>As a final step, I remove the 5 volt power supply unit from the primary circuit to check whether there really is no voltage on the primary circuit. Figure 4.2.1 in the yellow frame remains dark and so the test was successful!</p>
<p><img loading="lazy" decoding="async" class="zoooom aligncenter wp-image-1570" src="https://nerd-corner.com/wp-content/uploads/2024/06/4-2.jpg" alt="barrel jack switch hohlstecker" width="2280" height="1332" srcset="https://nerd-corner.com/wp-content/uploads/2024/06/4-2.jpg 2291w, https://nerd-corner.com/wp-content/uploads/2024/06/4-2-300x175.jpg 300w, https://nerd-corner.com/wp-content/uploads/2024/06/4-2-1024x598.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2024/06/4-2-768x449.jpg 768w, https://nerd-corner.com/wp-content/uploads/2024/06/4-2-1536x897.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2024/06/4-2-2048x1196.jpg 2048w" sizes="auto, (max-width: 2280px) 100vw, 2280px" /></p>
<p>&nbsp;</p>
<h2>Files for Downloading</h2>
<ul>
<li><a href="https://www.thingiverse.com/thing:6313994">Barrel jack holder and bridge</a></li>
</ul>
<p>The post <a href="https://nerd-corner.com/using-a-barrel-jack-as-a-switch/">Using a barrel jack as a switch</a> appeared first on <a href="https://nerd-corner.com">Nerd Corner</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://nerd-corner.com/using-a-barrel-jack-as-a-switch/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>WeMos D1 R2 &#8211; Host entire website with html, css &#038; js</title>
		<link>https://nerd-corner.com/wemos-d1-r2-host-entire-website-with-html-css-js/</link>
					<comments>https://nerd-corner.com/wemos-d1-r2-host-entire-website-with-html-css-js/#respond</comments>
		
		<dc:creator><![CDATA[Nerds]]></dc:creator>
		<pubDate>Wed, 06 Mar 2024 12:18:52 +0000</pubDate>
				<category><![CDATA[Arduino projects]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Arduino with Wifi]]></category>
		<category><![CDATA[C programming]]></category>
		<category><![CDATA[communication technique]]></category>
		<category><![CDATA[control Arduino with browser]]></category>
		<category><![CDATA[data transfer]]></category>
		<category><![CDATA[entire website]]></category>
		<category><![CDATA[ESP8266]]></category>
		<category><![CDATA[ESP8266 with mDNS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[JS]]></category>
		<category><![CDATA[led]]></category>
		<category><![CDATA[local network]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[Step by step guide]]></category>
		<category><![CDATA[Webserver]]></category>
		<category><![CDATA[website hosting]]></category>
		<category><![CDATA[WeMos]]></category>
		<category><![CDATA[WeMos D1]]></category>
		<category><![CDATA[WeMos D1 in Arduino IDE]]></category>
		<category><![CDATA[WeMos D1 mini]]></category>
		<category><![CDATA[WeMos D1 R2]]></category>
		<category><![CDATA[WeMOS D1 Webserver]]></category>
		<category><![CDATA[WIFI]]></category>
		<guid isPermaLink="false">https://nerd-corner.com/de/?p=1547</guid>

					<description><![CDATA[<p>The first part of the WeMos series explained the setup and Wi-Fi integration. Building on this, this article describes step by step how to host &#8230; </p>
<p>The post <a href="https://nerd-corner.com/wemos-d1-r2-host-entire-website-with-html-css-js/">WeMos D1 R2 &#8211; Host entire website with html, css &#038; js</a> appeared first on <a href="https://nerd-corner.com">Nerd Corner</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>The first part of the WeMos series explained the setup and Wi-Fi integration. Building on this, this article describes step by step how to host a complete website with HTML pages, CSS styling and JavaScript functions on a WeMos. The whole thing is pretty simple and incredibly helpful! I can&#8217;t believe how hard it is to find proper instructions for this important function anywhere on the internet.</p>
<p>I often see blog articles where the HTML code is embedded in the Arduino file. You can do this for a mini demonstration, but it&#8217;s complete rubbish for everyday use. It is far too confusing and as soon as the project grows it is no longer usable.</p>
<p>The proper alternative is to set up a folder called &#8220;data&#8221; and store the web pages in this folder as html files. In addition, the styling is saved as a CSS file and functions can even be executed via a JavaScript file. So everything is 1:1 like on a normal web server!</p>
<p><em><strong>This might also be interesting for you:</strong> <a href="https://nerd-corner.com/wemos-d1-r2-setup-and-wifi-integration/">WeMos D1 R2 first steps and Wifi integration</a></em></p>
<h2>List of components</h2>
<ul>
<li>Arduino IDE (development environment)</li>
<li>WeMos D1 R2</li>
</ul>
<h2>The setup of the file system (officially SPIFFS) needs to be done once and is very easy:</h2>
<p><a href="https://nerd-corner.com/wemos-d1-r2-setup-and-wifi-integration/">(First you should have completed the basic setup from the first part!)</a></p>
<ol>
<li>Download a copy of the file &#8220;ESP8266FS-0.2.0.zip&#8221; from GitHub and unzip it</li>
<li>Place the file esp8266fs.jar in the Arduino tool directory. The path looks like this: [home_dir]\Arduino\tools\ESP8266FS\tool\esp8266fs.jar (See picture) I had to create the path part tools\ESP8266FS\tool\ in the Arduino folder myself.<img loading="lazy" decoding="async" class="zoooom aligncenter wp-image-1531" src="https://nerd-corner.com/wp-content/uploads/2024/03/Screenshot-file-path-esp8266fs.jar-.png" alt="Screenshot file path esp8266fs.jar" width="1080" height="335" srcset="https://nerd-corner.com/wp-content/uploads/2024/03/Screenshot-file-path-esp8266fs.jar-.png 1190w, https://nerd-corner.com/wp-content/uploads/2024/03/Screenshot-file-path-esp8266fs.jar--300x93.png 300w, https://nerd-corner.com/wp-content/uploads/2024/03/Screenshot-file-path-esp8266fs.jar--1024x318.png 1024w, https://nerd-corner.com/wp-content/uploads/2024/03/Screenshot-file-path-esp8266fs.jar--768x238.png 768w" sizes="auto, (max-width: 1080px) 100vw, 1080px" /></li>
<li>Restart the Arduino IDE.</li>
</ol>
<p>That&#8217;s it already! You can now see the new item &#8220;ESP8266 Sketch Data Upload&#8221; in the Arduino IDE under Tools.</p>
<h2>How can I use the new file system now?</h2>
<ol>
<li>Create an additional folder with the name &#8220;data&#8221; in your current WeMos project folder. As shown in the following image</li>
</ol>
<p><img loading="lazy" decoding="async" class="zoooom aligncenter wp-image-1528" src="https://nerd-corner.com/wp-content/uploads/2024/03/Wemos-data-folder.png" alt="Wemos data folder" width="1040" height="324" srcset="https://nerd-corner.com/wp-content/uploads/2024/03/Wemos-data-folder.png 1146w, https://nerd-corner.com/wp-content/uploads/2024/03/Wemos-data-folder-300x93.png 300w, https://nerd-corner.com/wp-content/uploads/2024/03/Wemos-data-folder-1024x319.png 1024w, https://nerd-corner.com/wp-content/uploads/2024/03/Wemos-data-folder-768x239.png 768w" sizes="auto, (max-width: 1040px) 100vw, 1040px" /></p>
<ol start="2">
<li>Place the files you want to upload in the &#8216;data&#8217; directory</li>
<li>In the Arduino IDE, select the WeMos in the &#8216;Tools&#8217; menu and select a size for &#8216;Flash Size&#8217;</li>
<li>Close the dialogue box for the serial monitor!</li>
<li>Select the &#8216;ESP8266 Sketch Data Upload&#8217; option from the &#8216;Tools&#8217; menu.</li>
</ol>
<p><img loading="lazy" decoding="async" class="zoooom aligncenter wp-image-1529" src="https://nerd-corner.com/wp-content/uploads/2024/03/data-folder-upload.png" alt="Data folder upload" width="805" height="518" srcset="https://nerd-corner.com/wp-content/uploads/2024/03/data-folder-upload.png 851w, https://nerd-corner.com/wp-content/uploads/2024/03/data-folder-upload-300x193.png 300w, https://nerd-corner.com/wp-content/uploads/2024/03/data-folder-upload-768x495.png 768w" sizes="auto, (max-width: 805px) 100vw, 805px" /></p>
<p>As soon as the upload is complete, the message window of the Arduino IDE shows 100% upload.</p>
<h2>WeMos example programme for switching the OnBoard LED on and off</h2>
<p>Similar to the first part, the web server will control the OnBoard LED. The code from the first part also serves as the basis. The revised code looks like this:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="cpp" data-enlighter-theme="atomic" data-enlighter-title="D1_webserver_filesystem">#include &lt;ESP8266WiFi.h&gt;
#include &lt;ESP8266WebServer.h&gt;
#include &lt;ESP8266mDNS.h&gt;

ESP8266WebServer server(80);

void setup() {
  Serial.begin(115200); //Baudrate
  Serial.println("ESP starts");

  WiFi.begin("NerdCornerWiFi","NerdCornerPassword");


  Serial.print("Connecting...");

  while(WiFi.status()!=WL_CONNECTED){ //Loop which makes a point every 500ms until the connection process has finished

    delay(500);
    Serial.print(".");
  }
  Serial.println();

  Serial.print("Connected! IP-Address: ");
  Serial.println(WiFi.localIP()); //Displaying the IP Address

  if (MDNS.begin("nerd-corner")) {
    Serial.println("DNS started, available with: ");
    Serial.println("http://nerd-corner.local/");
  }

  server.serveStatic("/", SPIFFS, "/", "max-age=86400");
  SPIFFS.begin();

  server.onNotFound([](){ 
    server.send(404, "text/plain", "Landing page not found! Don't forget to name your landing page 'index.html'!");  
  });
 
  server.on("/led", HTTP_POST, []() {    
     
    const String ledState = server.arg("ledstate");
    if(ledState=="on"){
      switchLedOn();
    }
    else if(ledState=="off"){
      switchLedOff();
    }
    server.send(200, "text/json", "{\"result\":\"ok\"}");
  });

  server.begin();
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
  server.handleClient();
  MDNS.update();

}

void switchLedOff(){ 
  digitalWrite(LED_BUILTIN, HIGH);   // turn the D1 LED off 
}

void switchLedOn(){ 
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED on 
}</pre>
<p>I would like to point out a few special features. For example, we have added the following:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="cpp" data-enlighter-theme="atomic">server.serveStatic("/", SPIFFS, "/", "max-age=86400"); 
SPIFFS.begin();</pre>
<p>Without these two lines, access to the files in the &#8220;data&#8221; folder would not be possible. Please note that the name &#8220;index.html&#8221; is set as the default for the landing page. However, you can change this if you really want to.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="cpp" data-enlighter-theme="atomic">server.on("/led", HTTP_POST, []() {    
     
    const String ledState = server.arg("ledstate");
    if(ledState=="on"){
      switchLedOn();
    }
    else if(ledState=="off"){
      switchLedOff();
      }
      server.send(200, "text/json", "{\"result\":\"ok\"}");
  });</pre>
<p>The &#8220;/led&#8221; endpoint receives the commands from the web server. If the command is &#8220;on&#8221;, the LED is switched on and if &#8220;off&#8221;, the LED is switched off.</p>
<h2>Wemos website for switching the WeMos OnBoard LED on and off</h2>
<p>The example website has a very simple structure. It primarily consists of 2 buttons for switching the LED on and off.</p>
<p><img loading="lazy" decoding="async" class="zoooom aligncenter wp-image-1536" src="https://nerd-corner.com/wp-content/uploads/2024/03/Webseite-Wemos-Control.jpeg" alt="Website Wemos control LED" width="875" height="1946" srcset="https://nerd-corner.com/wp-content/uploads/2024/03/Webseite-Wemos-Control.jpeg 921w, https://nerd-corner.com/wp-content/uploads/2024/03/Webseite-Wemos-Control-135x300.jpeg 135w, https://nerd-corner.com/wp-content/uploads/2024/03/Webseite-Wemos-Control-461x1024.jpeg 461w, https://nerd-corner.com/wp-content/uploads/2024/03/Webseite-Wemos-Control-768x1708.jpeg 768w, https://nerd-corner.com/wp-content/uploads/2024/03/Webseite-Wemos-Control-691x1536.jpeg 691w" sizes="auto, (max-width: 875px) 100vw, 875px" /></p>
<p>The folder structure of the website is very clearly organised. There is a main page with the name &#8220;index.html&#8221;. This name is common worldwide for the main pages and is also automatically recognised by WeMos. There is also a &#8220;CSS&#8221; folder for styling and a &#8220;JS&#8221; folder for functions.</p>
<p><img loading="lazy" decoding="async" class="zoooom aligncenter wp-image-1537" src="https://nerd-corner.com/wp-content/uploads/2024/03/Screenshot-data-file-system.png" alt="Screenshot esp8266 data file system" width="1045" height="347" srcset="https://nerd-corner.com/wp-content/uploads/2024/03/Screenshot-data-file-system.png 1152w, https://nerd-corner.com/wp-content/uploads/2024/03/Screenshot-data-file-system-300x100.png 300w, https://nerd-corner.com/wp-content/uploads/2024/03/Screenshot-data-file-system-1024x340.png 1024w, https://nerd-corner.com/wp-content/uploads/2024/03/Screenshot-data-file-system-768x255.png 768w" sizes="auto, (max-width: 1045px) 100vw, 1045px" /></p>
<p>We link the styles in the header area of the website. There is a standard bootstrap, which automatically makes everything a bit nicer, and a custom styles file with my own customisations. The functions of the website are also linked in the header area. I use the jQuery standard to send requests from the website to the WeMos. My own custom functions are in the &#8220;index.js&#8221;.</p>
<p>Please note that the jQuery file must be included BEFORE your own file, otherwise no jQuery commands can be used in your own code! The custom functions are then used by the buttons. The HTML code of the page looks as follows:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="html" data-enlighter-theme="atomic">&lt;!DOCTYPE html&gt;
&lt;html lang="en"&gt;&lt;/html&gt;
&lt;html&gt;
  &lt;head&gt;
    &lt;meta charset="utf-8" /&gt;
    &lt;meta
      name="viewport"
      content="width=device-width, initial-scale=1, shrink-to-fit=no"
    /&gt;
    &lt;script type="text/javascript" src="js/jquery-3.5.1.min.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript" src="./js/index.js"&gt;&lt;/script&gt;
    &lt;link rel="stylesheet" href="css/bootstrap.min.css" /&gt;
    &lt;link rel="stylesheet" href="css/custom-style.css" /&gt;
    &lt;title&gt;D1 Webserver&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;h1&gt;D1 Webserver with filesystem&lt;/h1&gt;
    &lt;p&gt;
      This is an example for a WeMos Webserver with a filesystem. You can easily
      create webpages with html, css and js!
    &lt;/p&gt;

    &lt;h3&gt;Example to turn on and off the built in LED&lt;/h3&gt;
    &lt;button class="button-style" onclick="changeLEDState('on')"&gt;Turn on&lt;/button&gt;
    &lt;button class="button-style" onclick="changeLEDState('off')"&gt;
      Turn off
    &lt;/button&gt;

    &lt;h3&gt;Example to demo a JS function&lt;/h3&gt;
    &lt;button class="button-style" onclick="showAlert()"&gt;Show alert&lt;/button&gt;
  &lt;/body&gt;
&lt;/html&gt;
</pre>
<p>Special attention is paid to the JavaScript function &#8220;changeLEDState(value)&#8221;</p>
<pre class="EnlighterJSRAW" data-enlighter-language="js" data-enlighter-theme="atomic">function changeLEDState(value) {
  $.post("/led", { ledstate: value });
}</pre>
<p>Because jQuery is used for communication with the WeMos, a simple dollar sign with the corresponding request command is sufficient. A value is also sent with this POST request, which is either &#8220;on&#8221; or &#8220;off&#8221; to switch the LED on and off.</p>
<p>The web page can be downloaded as a zip file below.</p>
<h2>Files to download</h2>
<ul>
<li><a  data-e-Disable-Page-Transition="true" class="download-link" title="" href="https://nerd-corner.com/download/1540/?tmstv=1755620680" rel="nofollow" id="download-link-1540" data-redirect="false" >
	Wemos example webserver to control OnBoard LED</a>
</li>
</ul>
<p>The post <a href="https://nerd-corner.com/wemos-d1-r2-host-entire-website-with-html-css-js/">WeMos D1 R2 &#8211; Host entire website with html, css &#038; js</a> appeared first on <a href="https://nerd-corner.com">Nerd Corner</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://nerd-corner.com/wemos-d1-r2-host-entire-website-with-html-css-js/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Click and clamp system &#8211; SMD5050 bracket</title>
		<link>https://nerd-corner.com/click-and-clamp-system-smd5050-bracket/</link>
					<comments>https://nerd-corner.com/click-and-clamp-system-smd5050-bracket/#respond</comments>
		
		<dc:creator><![CDATA[Nerds]]></dc:creator>
		<pubDate>Tue, 27 Feb 2024 18:50:16 +0000</pubDate>
				<category><![CDATA[Handcrafted]]></category>
		<category><![CDATA[SolidWorks]]></category>
		<category><![CDATA[3D]]></category>
		<category><![CDATA[3D print]]></category>
		<category><![CDATA[bracket]]></category>
		<category><![CDATA[CAD]]></category>
		<category><![CDATA[CAD design]]></category>
		<category><![CDATA[clamp]]></category>
		<category><![CDATA[DIY]]></category>
		<category><![CDATA[led]]></category>
		<category><![CDATA[led strip]]></category>
		<category><![CDATA[RGB LED]]></category>
		<category><![CDATA[RGB led strip]]></category>
		<category><![CDATA[SMD5050]]></category>
		<category><![CDATA[SMD5050 bracket]]></category>
		<category><![CDATA[Solid Works]]></category>
		<guid isPermaLink="false">https://nerd-corner.com/de/?p=1521</guid>

					<description><![CDATA[<p>Who has ever had trouble with the adhesive on an LED strip? Nobody? Well, in my opinion, you have. Here comes the remedy! I call &#8230; </p>
<p>The post <a href="https://nerd-corner.com/click-and-clamp-system-smd5050-bracket/">Click and clamp system &#8211; SMD5050 bracket</a> appeared first on <a href="https://nerd-corner.com">Nerd Corner</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Who has ever had trouble with the adhesive on an LED strip? Nobody? Well, in my opinion, you have. Here comes the remedy! I call it the SMD5050 LED strip bracket.</p>
<p><em><strong>This might also be interesting for you:</strong> <a href="https://nerd-corner.com/magnetic-clamp-for-neodym-magnets/">Magnetic clamp for strong neodym magnets</a></em></p>
<h2>Production of the LED strips</h2>
<p>You also need to know how such LED STRIPS are manufactured, the misconception that the strips are fitted on an endless belt and cut as required is wrong. The strips are stretched 500mm long in a placement machine and fitted with the LEDs. The number of LEDs depends on how many LEDs are needed per metre. There are strips with 30/60/144 LEDs per metre. The 500mm strips are then soldered together at the ends to the required length.</p>
<p><img loading="lazy" decoding="async" class="size-full wp-image-1515 aligncenter" src="https://nerd-corner.com/wp-content/uploads/2024/02/SMD5050-Klammer.gif" alt="SMD5050 Klammer" width="539" height="261" /></p>
<h2>Realisation of the SMD5050 bracket</h2>
<p>As always, I first look for all available LED strips from my collection that contain an SMD5050. It was important to have all the variants from the different manufacturers. This way you can find the best possible middle way to apply the function (i.e. the clamping) to as many variants as possible.</p>
<p>The idea was not to glue the strip to the back, but to clamp the LEDs to the outer surfaces. Figure 1.0 shows some of the numerous variants for SMD5050</p>
<ul>
<li>1.0.1 WS2812B strip with 30 LEDs per metre</li>
<li>1.0.2 WS2812B strip with 60 LEDs per metre</li>
<li>1.0.3 WS2812B strip with 144 LEDs per metre</li>
<li>1.0.4 Sk6812 strips with the same subdivisions as above</li>
<li>1.0.5 Cold white strip with 60 LEDs per metre</li>
</ul>
<p><img decoding="async" class="aligncenter zoooom" src="https://elepla.de/images/LED_Klammer/1-0.jpg" alt="1 0" /></p>
<p>The next step is to measure and compare the outer dimensions of the SMD5050. As the name SMD5050 implies, the numbers 5050 stand for the mass of 5mm on the outer lines (5050 is equal to 5mm long and 5mm wide). To my astonishment, the SMDs are only a hundredth of a millimetre apart. This means that the deviations are marginal (2.0.1, 2.0.2) and negligible for the design.</p>
<p>The situation is different with the height of the LEDs, where the differences are somewhat more striking (2.0.3, 2.0.4 and 2.0.5). But the biggest difference lies in the soldering with more or less solder. The differences are now known and can be taken into account in the design.</p>
<p><img decoding="async" class="aligncenter zoooom" src="https://elepla.de/images/LED_Klammer/2-0.jpg" alt="2 0" /></p>
<p>The solder joints and external resistors cause the most problems. The solder joints are often very different, sometimes slightly thicker and sometimes protruding beyond the side edge. The resistors are also positioned in different places depending on the strip.</p>
<p>First I draw the retaining clip (3.0.1) to which the LED will later be attached. Next, I design the holding frame for the SMD5050, which will later be used to clamp the LED (3.0.2). In picture 3.0.3 I add so-called recesses. I measured these recesses in the frame for the various LED strips.</p>
<p>After these three main steps, I print the first prototype with my favourite material and favourite printer. After the first attempts to clamp the LED, I was very confident that it would work in the end. Of course, you have to keep an eye on the stability of the clamp when removing the material.</p>
<p>The development is based on my previous experience. It&#8217;s a balancing act between holding force, stability and printability. The number of printed prototypes, in this case fifteen, says only a little about the work that has been done. Fifteen attempts is rather few. I was lucky with the basic concept and that the idea was the right one.</p>
<p>In pictures 3.0.4 and 3.0.5 you can see the changes to 3.0.3 in the dimensions and shapes, such as the addition of bevelled edges.</p>
<p><img loading="lazy" decoding="async" class="zoooom aligncenter" src="https://elepla.de/images/LED_Klammer/3-0.jpg" alt="clamp LED strip bracket " width="2305" height="1379" /></p>
<h2>Manufacturing the clamp in the 3D printer</h2>
<p>The CAD development is now complete. The next step is the printing process. A number of factors need to be taken into account, such as the correct calibration of the 3D printer. If you print a housing with a lid on a poorly calibrated or uncalibrated 3D printer with the same settings and material, it will always fit together. The dimensions are not correct but the covers of the housing and lid are the same and therefore it still fits.</p>
<p>The situation is different when an externally produced component such as the SMD5050 comes into play. Then the dimensions must match within a certain tolerance range. If you don&#8217;t want to calibrate your 3D printer, you can adjust the dimensions using the slicer. Every slicer offers a so-called scaling function. The next factor is related to the size of the clamp, as the clamp is very small, the nozzle cooling must be set to 100%. Nozzle cooling is actually the wrong term, as it is not the nozzle that should be cooled, but the filament that emerges. With small components, the hot nozzle passes the workpiece again more quickly so that it cannot cool down properly. As a result, the filament runs and cannot hold the desired shape.</p>
<p>The printing direction should also not be underestimated. With our clamps, the printing direction should be sideways, i.e. printed horizontally (4.0.1).</p>
<p><img decoding="async" class="aligncenter zoooom" src="https://elepla.de/images/LED_Klammer/4-0.jpg" alt="4 0" /></p>
<h2>Mounting the SMD5050 LED strip bracket</h2>
<p>To mount the clip, it is advisable to place the individual LED or strip on a flat surface and then press the clip on from above. The LEDs are very stable and can withstand a lot. If you have any doubts about the holding power of the connection, you can of course add some glue. It is also not necessary to clamp every LED to the strip, it is sufficient to clamp every third or fourth LED.</p>
<p>I have designed different types of clamps that can be screwed, clamped and, of course, glued. However, there is one restriction. The clamp can only be attached in two directions. I had to make the compromise in the design that only two sides are suitable for clipping. This means you can&#8217;t turn and attach the clip every 90 degrees, but only 180 degrees. In short, the soldering points must always be to the right and left of the clip and not at the top and bottom. (see pictures 5.0 &#8211; 5.1)</p>
<p>Application examples for the LED strip bracket</p>
<ul>
<li>5.0.1, 5.0.2 WS2812B 60 LED/m</li>
<li>5.0.3 RGW on circuit board</li>
<li>5.0.4 WS2812B 144 LED/m (only every second LED can be clipped)</li>
<li>5.1.1 SK6812 soldered to carrier plate clamped</li>
<li>5.1.2 WS2812B soldered three pieces</li>
<li>5.1.3 RGW</li>
<li>5.1.4 CW with side clips right and left</li>
</ul>
<p><img decoding="async" class="aligncenter zoooom" src="https://elepla.de/images/LED_Klammer/5-0.jpg" alt="5 0" /></p>
<p><img loading="lazy" decoding="async" class="zoooom aligncenter" src="https://elepla.de/images/LED_Klammer/5-1.jpg" alt="LED strip bracket " width="2305" height="1379" /></p>
<h2>Download files</h2>
<ul>
<li><a href="https://www.thingiverse.com/thing:6236390">Bracket for SMD5050</a></li>
</ul>
<p>The post <a href="https://nerd-corner.com/click-and-clamp-system-smd5050-bracket/">Click and clamp system &#8211; SMD5050 bracket</a> appeared first on <a href="https://nerd-corner.com">Nerd Corner</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://nerd-corner.com/click-and-clamp-system-smd5050-bracket/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
