<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: IgorIOT</title>
    <description>The latest articles on DEV Community by IgorIOT (@igoriot).</description>
    <link>https://dev.to/igoriot</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3760784%2F5e3fc0c5-4eab-49c7-ae85-78cba32d6280.jpeg</url>
      <title>DEV Community: IgorIOT</title>
      <link>https://dev.to/igoriot</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/igoriot"/>
    <language>en</language>
    <item>
      <title>Beyond Blink: Understanding PWM with Raspberry Pi and Java</title>
      <dc:creator>IgorIOT</dc:creator>
      <pubDate>Thu, 11 Jun 2026 10:06:14 +0000</pubDate>
      <link>https://dev.to/igoriot/beyond-blink-understanding-pwm-with-raspberry-pi-and-java-1k1</link>
      <guid>https://dev.to/igoriot/beyond-blink-understanding-pwm-with-raspberry-pi-and-java-1k1</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyxx5ae5ie1ye4poxzpwx.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyxx5ae5ie1ye4poxzpwx.jpg" alt=" " width="800" height="204"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Alright boss?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In the previous article, we learned how to turn an LED on and off using a Raspberry Pi GPIO pin. We wrote our first Pi4J application, explored digital outputs, and made an LED blink.&lt;/p&gt;

&lt;p&gt;But what if we want something in between?&lt;/p&gt;

&lt;p&gt;Can an LED be half on?&lt;/p&gt;

&lt;p&gt;Can we create smooth fading effects?&lt;/p&gt;

&lt;p&gt;Can we control motor speed, fan speed, or even generate analog-like voltages using only digital GPIO pins?&lt;/p&gt;

&lt;p&gt;The answer is &lt;strong&gt;PWM&lt;/strong&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  What Is PWM?
&lt;/h2&gt;

&lt;p&gt;PWM stands for &lt;strong&gt;Pulse Width Modulation&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Despite the intimidating name, the idea is surprisingly simple:&lt;/p&gt;

&lt;p&gt;Instead of changing the voltage, we rapidly switch the GPIO pin between ON and OFF.&lt;/p&gt;

&lt;p&gt;If we do this fast enough, the LED appears dimmer or brighter depending on how long it stays ON during each cycle.&lt;/p&gt;
&lt;h2&gt;
  
  
  The GPIO Problem
&lt;/h2&gt;

&lt;p&gt;A GPIO pin is digital.&lt;/p&gt;

&lt;p&gt;It only knows two states:&lt;/p&gt;

&lt;p&gt;LOW  = 0V&lt;br&gt;
HIGH = 3.3V&lt;/p&gt;

&lt;p&gt;There is no built-in way to output:&lt;/p&gt;

&lt;p&gt;1.65V&lt;br&gt;
2.1V&lt;br&gt;
0.8V&lt;/p&gt;

&lt;p&gt;At least not directly.&lt;/p&gt;

&lt;p&gt;So how do we create different brightness levels?&lt;/p&gt;
&lt;h2&gt;
  
  
  The PWM Trick
&lt;/h2&gt;

&lt;p&gt;Imagine a GPIO pin switching on and off repeatedly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;100% Duty Cycle&lt;/strong&gt;&lt;br&gt;
████████████████&lt;/p&gt;

&lt;p&gt;The signal is always ON.&lt;/p&gt;

&lt;p&gt;The LED is fully bright.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;50% Duty Cycle&lt;/strong&gt;&lt;br&gt;
████_&lt;strong&gt;&lt;em&gt;████&lt;/em&gt;&lt;/strong&gt;_&lt;/p&gt;

&lt;p&gt;The signal spends half of its time ON and half OFF.&lt;/p&gt;

&lt;p&gt;The LED appears approximately half as bright.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;25% Duty Cycle&lt;/strong&gt;&lt;br&gt;
██___&lt;strong&gt;&lt;em&gt;██&lt;/em&gt;&lt;/strong&gt;___&lt;/p&gt;

&lt;p&gt;The LED appears much dimmer.&lt;/p&gt;
&lt;h2&gt;
  
  
  Duty Cycle
&lt;/h2&gt;

&lt;p&gt;The most important PWM concept is the duty cycle.&lt;/p&gt;

&lt;p&gt;It represents the percentage of time the signal remains ON during a complete cycle.&lt;/p&gt;

&lt;p&gt;Examples:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flr4tibucr2o848ougv89.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flr4tibucr2o848ougv89.png" alt=" " width="585" height="225"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Table 01: Duty Cycle&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Mathematically:&lt;/p&gt;

&lt;p&gt;Duty Cycle = ON Time / Total Period × 100%&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmw0kveue89cnofcd9pkx.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmw0kveue89cnofcd9pkx.jpg" alt=" " width="711" height="664"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Frequency Matters
&lt;/h2&gt;

&lt;p&gt;PWM is defined by two parameters:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Duty Cycle&lt;/li&gt;
&lt;li&gt;Frequency&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Frequency tells us how many complete cycles occur every second.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;100 Hz&lt;/p&gt;

&lt;p&gt;means:&lt;/p&gt;

&lt;p&gt;100 cycles per second&lt;/p&gt;

&lt;p&gt;If the frequency is too low, visible flickering may occur.&lt;/p&gt;

&lt;p&gt;If the frequency is high enough, the LED appears continuously illuminated.&lt;/p&gt;

&lt;p&gt;A typical LED application often uses frequencies ranging from a few hundred Hertz to several kilohertz.&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/Cvep1SexvRk"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequency vs Resolution
&lt;/h2&gt;

&lt;p&gt;There is often a trade-off between PWM frequency and PWM resolution.&lt;/p&gt;

&lt;p&gt;In many systems:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;Higher&lt;/span&gt; &lt;span class="nc"&gt;Frequency&lt;/span&gt;
&lt;span class="err"&gt;↓&lt;/span&gt;
&lt;span class="nc"&gt;Lower&lt;/span&gt; &lt;span class="nc"&gt;Resolution&lt;/span&gt;
&lt;span class="n"&gt;or&lt;/span&gt;
&lt;span class="nc"&gt;Higher&lt;/span&gt; &lt;span class="nc"&gt;Resolution&lt;/span&gt;
&lt;span class="err"&gt;↓&lt;/span&gt;
&lt;span class="nc"&gt;Lower&lt;/span&gt; &lt;span class="nc"&gt;Maximum&lt;/span&gt; &lt;span class="nc"&gt;Frequency&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This happens because the hardware has a limited amount of time to represent each PWM cycle.&lt;/p&gt;

&lt;p&gt;As frequency increases, fewer timing steps are available.&lt;/p&gt;

&lt;p&gt;Understanding this trade-off becomes important in more advanced projects.&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/BySRB52AQ7c"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Hardware PWM vs Software PWM
&lt;/h2&gt;

&lt;p&gt;Not all PWM signals are generated the same way.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Software PWM&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="no"&gt;CPU&lt;/span&gt;
 &lt;span class="err"&gt;↓&lt;/span&gt;
&lt;span class="no"&gt;GPIO&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The CPU continuously generates the pulses.&lt;/p&gt;

&lt;p&gt;Advantages&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Works on many GPIO pins&lt;/li&gt;
&lt;li&gt;Easy to configure&lt;/li&gt;
&lt;li&gt;Flexible for simple projects&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Disadvantages&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Consumes CPU resources&lt;/li&gt;
&lt;li&gt;Less precise timing&lt;/li&gt;
&lt;li&gt;Accuracy may decrease at higher frequencies or under heavy system load&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Hardware PWM&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="no"&gt;PWM&lt;/span&gt; &lt;span class="nc"&gt;Controller&lt;/span&gt;
       &lt;span class="err"&gt;↓&lt;/span&gt;
     &lt;span class="no"&gt;GPIO&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Dedicated hardware generates the signal.&lt;/p&gt;

&lt;p&gt;Advantages&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Extremely accurate timing&lt;/li&gt;
&lt;li&gt;Minimal CPU usage&lt;/li&gt;
&lt;li&gt;Stable frequencies and duty cycles&lt;/li&gt;
&lt;li&gt;Ideal for LEDs, motors, audio generation, and other timing-sensitive applications&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Disadvantages&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Available only on specific GPIO pins&lt;/li&gt;
&lt;li&gt;Limited number of hardware PWM channels&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Key Difference&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The biggest difference is where the PWM signal is generated:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2sevklfvvbhpafynzyui.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2sevklfvvbhpafynzyui.png" alt=" " width="697" height="187"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Table 02: Software VS Hardware PWM&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;For most LED projects, both approaches work well. However, when accuracy, efficiency, or higher frequencies matter, Hardware PWM is usually the preferred choice.&lt;/p&gt;
&lt;h2&gt;
  
  
  Building the Circuit
&lt;/h2&gt;

&lt;p&gt;The circuit is identical to the one used in the Blink article.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="no"&gt;GPIO18&lt;/span&gt;
   &lt;span class="o"&gt;|&lt;/span&gt;
 &lt;span class="nc"&gt;Resistor&lt;/span&gt;
   &lt;span class="o"&gt;|&lt;/span&gt;
  &lt;span class="no"&gt;LED&lt;/span&gt;
   &lt;span class="o"&gt;|&lt;/span&gt;
  &lt;span class="no"&gt;GND&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;GPIO18 is a popular choice because it supports hardware PWM on Raspberry Pi.&lt;/p&gt;

&lt;h2&gt;
  
  
  PWM with Pi4J
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Software PWM&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Software PWM works on virtually any GPIO configured as an output.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;com.pi4j.Pi4J&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;com.pi4j.context.Context&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;com.pi4j.io.pwm.Pwm&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;com.pi4j.io.pwm.PwmType&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;SoftwarePwmExample&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;

   &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="kd"&gt;throws&lt;/span&gt; &lt;span class="nc"&gt;Exception&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;

       &lt;span class="nc"&gt;Context&lt;/span&gt; &lt;span class="n"&gt;pi4j&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Pi4J&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;newAutoContext&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;

       &lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;pwmConfig&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Pwm&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;newConfigBuilder&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pi4j&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
               &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"soft-pwm"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
               &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Software PWM LED"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
               &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;address&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;18&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;          &lt;span class="c1"&gt;// BCM GPIO18&lt;/span&gt;
               &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;pwmType&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;PwmType&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;SOFTWARE&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
               &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;provider&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"pigpio-pwm"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
               &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;initial&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
               &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;shutdown&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
               &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;build&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;

       &lt;span class="nc"&gt;Pwm&lt;/span&gt; &lt;span class="n"&gt;pwm&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pi4j&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;create&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pwmConfig&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

       &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;duty&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="n"&gt;duty&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="n"&gt;duty&lt;/span&gt;&lt;span class="o"&gt;++)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
           &lt;span class="n"&gt;pwm&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;duty&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
           &lt;span class="nc"&gt;Thread&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;sleep&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
       &lt;span class="o"&gt;}&lt;/span&gt;

       &lt;span class="n"&gt;pwm&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;off&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
       &lt;span class="n"&gt;pi4j&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;shutdown&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
   &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;What Happens Behind the Scenes?&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;Java&lt;/span&gt; &lt;span class="nc"&gt;Application&lt;/span&gt;
      &lt;span class="err"&gt;↓&lt;/span&gt;
      &lt;span class="no"&gt;CPU&lt;/span&gt; &lt;span class="n"&gt;generates&lt;/span&gt; &lt;span class="no"&gt;PWM&lt;/span&gt; &lt;span class="n"&gt;pulses&lt;/span&gt;
      &lt;span class="err"&gt;↓&lt;/span&gt;
     &lt;span class="no"&gt;GPIO18&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In Software PWM, the CPU is responsible for continuously toggling the GPIO pin on and off according to the configured duty cycle and frequency.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Hardware PWM&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Hardware PWM uses the Raspberry Pi's dedicated PWM controller.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;com.pi4j.Pi4J&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;com.pi4j.context.Context&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;com.pi4j.io.pwm.Pwm&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;com.pi4j.io.pwm.PwmType&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;HardwarePwmExample&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;

   &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="kd"&gt;throws&lt;/span&gt; &lt;span class="nc"&gt;Exception&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;

       &lt;span class="nc"&gt;Context&lt;/span&gt; &lt;span class="n"&gt;pi4j&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Pi4J&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;newAutoContext&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;

       &lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;pwmConfig&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Pwm&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;newConfigBuilder&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pi4j&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
               &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"hw-pwm"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
               &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Hardware PWM LED"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
               &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;address&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;18&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
               &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;pwmType&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;PwmType&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;HARDWARE&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
               &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;provider&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"pigpio-pwm"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
               &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;initial&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
               &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;shutdown&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
               &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;build&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;

       &lt;span class="nc"&gt;Pwm&lt;/span&gt; &lt;span class="n"&gt;pwm&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pi4j&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;create&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pwmConfig&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

       &lt;span class="n"&gt;pwm&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

       &lt;span class="nc"&gt;Thread&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;sleep&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5000&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

       &lt;span class="n"&gt;pwm&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;off&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
       &lt;span class="n"&gt;pi4j&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;shutdown&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
   &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What Happens Behind the Scenes?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;Java&lt;/span&gt; &lt;span class="nc"&gt;Application&lt;/span&gt;
      &lt;span class="err"&gt;↓&lt;/span&gt;
 &lt;span class="no"&gt;PWM&lt;/span&gt; &lt;span class="nc"&gt;Hardware&lt;/span&gt; &lt;span class="nc"&gt;Controller&lt;/span&gt;
      &lt;span class="err"&gt;↓&lt;/span&gt;
     &lt;span class="no"&gt;GPIO18&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In Hardware PWM, the Raspberry Pi's PWM peripheral generates the signal independently of the CPU.&lt;/p&gt;

&lt;p&gt;Once configured, the hardware continues producing precise PWM pulses even if the CPU is busy performing other tasks.&lt;/p&gt;

&lt;h2&gt;
  
  
  First PWM Example
&lt;/h2&gt;

&lt;p&gt;Let's set the LED to 50% brightness.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="n"&gt;pwm&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This means:&lt;/p&gt;

&lt;p&gt;50% Duty Cycle&lt;br&gt;
1000 Hz Frequency&lt;/p&gt;

&lt;p&gt;The LED now appears partially illuminated.&lt;/p&gt;
&lt;h2&gt;
  
  
  Creating a Fade Effect
&lt;/h2&gt;

&lt;p&gt;One of the most satisfying PWM demonstrations is a smooth fade.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;duty&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="n"&gt;duty&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="n"&gt;duty&lt;/span&gt;&lt;span class="o"&gt;++)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;pwm&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;duty&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="nc"&gt;Thread&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;sleep&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;duty&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="n"&gt;duty&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="n"&gt;duty&lt;/span&gt;&lt;span class="o"&gt;--)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;pwm&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;duty&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="nc"&gt;Thread&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;sleep&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The LED gradually brightens and then fades away.&lt;/p&gt;

&lt;p&gt;This effect is often called a breathing LED.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F143ercxkcns2yqyv6gnu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F143ercxkcns2yqyv6gnu.png" alt=" " width="800" height="275"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  PWM Doesn't Control Brightness. It Controls Energy.
&lt;/h2&gt;

&lt;p&gt;This is a subtle but important distinction.&lt;/p&gt;

&lt;p&gt;PWM doesn't directly tell an LED to become dimmer.&lt;/p&gt;

&lt;p&gt;Instead, it controls how much energy is delivered to the load over time.&lt;/p&gt;

&lt;p&gt;For an LED, that energy becomes perceived brightness.&lt;/p&gt;

&lt;p&gt;For a DC motor, it becomes speed.&lt;/p&gt;

&lt;p&gt;For a heating element, it becomes temperature.&lt;/p&gt;

&lt;p&gt;The same PWM technique is used in all three cases.&lt;/p&gt;

&lt;p&gt;Only the result changes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Every Dimmed LED Is Actually Blinking
&lt;/h2&gt;

&lt;p&gt;This surprises many beginners.&lt;/p&gt;

&lt;p&gt;A dim LED is not receiving "half voltage."&lt;/p&gt;

&lt;p&gt;It is actually turning completely ON and completely OFF hundreds or thousands of times per second.&lt;/p&gt;

&lt;p&gt;When you see a LED at 50% brightness, what is really happening is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="no"&gt;ON&lt;/span&gt;
&lt;span class="no"&gt;OFF&lt;/span&gt;
&lt;span class="no"&gt;ON&lt;/span&gt;
&lt;span class="no"&gt;OFF&lt;/span&gt;
&lt;span class="no"&gt;ON&lt;/span&gt;
&lt;span class="no"&gt;OFF&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Very fast.&lt;br&gt;
So a more accurate statement would be:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Every dimmed LED is actually blinking. It's just blinking too fast for us to notice.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The LED Is Never Half On&lt;/p&gt;

&lt;p&gt;This is one of the most common misconceptions.&lt;/p&gt;

&lt;p&gt;The apparent brightness comes from how our eyes perceive the rapid switching.&lt;/p&gt;
&lt;h2&gt;
  
  
  Persistence of Vision
&lt;/h2&gt;

&lt;p&gt;Human vision is not instantaneous.&lt;/p&gt;

&lt;p&gt;Our eyes and brains effectively average fast changes in light.&lt;/p&gt;

&lt;p&gt;If the LED switches thousands of times per second, we no longer perceive individual flashes.&lt;/p&gt;

&lt;p&gt;Instead, we see a stable brightness level.&lt;/p&gt;

&lt;p&gt;This phenomenon is called persistence of vision, and it is one of the reasons PWM works so well for LEDs.&lt;/p&gt;
&lt;h2&gt;
  
  
  PWM Is a Useful Lie
&lt;/h2&gt;

&lt;p&gt;One of the most interesting ways to think about PWM is as a "useful lie."&lt;/p&gt;

&lt;p&gt;The Raspberry Pi never outputs intermediate voltages through PWM.&lt;br&gt;
It only outputs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="no"&gt;V&lt;/span&gt;
&lt;span class="n"&gt;or&lt;/span&gt;
&lt;span class="mf"&gt;3.3&lt;/span&gt;&lt;span class="no"&gt;V&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Yet both humans and electronic circuits often behave as if intermediate voltages existed.&lt;/p&gt;

&lt;p&gt;PWM tricks our eyes.&lt;/p&gt;

&lt;p&gt;PWM tricks filters.&lt;/p&gt;

&lt;p&gt;PWM tricks motors.&lt;/p&gt;

&lt;p&gt;And that makes it incredibly useful.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding Raspberry Pi GPIO Limitations
&lt;/h2&gt;

&lt;p&gt;When working with PWM on a Raspberry Pi, it's important to remember that GPIO pins were never designed to be power outputs.&lt;/p&gt;

&lt;p&gt;They are designed to be control signals.&lt;/p&gt;

&lt;p&gt;This distinction explains many of the limitations developers encounter when starting with electronics.&lt;/p&gt;

&lt;h2&gt;
  
  
  GPIO Pins Are Not Power Supplies
&lt;/h2&gt;

&lt;p&gt;A Raspberry Pi GPIO pin can output:&lt;/p&gt;

&lt;p&gt;LOW  = 0V&lt;/p&gt;

&lt;p&gt;HIGH = 3.3V&lt;/p&gt;

&lt;p&gt;However, that does not mean you can power arbitrary devices directly from a GPIO pin.&lt;/p&gt;

&lt;p&gt;GPIO pins are intended to provide signals, not significant amounts of current.&lt;/p&gt;

&lt;p&gt;Typical use cases include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;LEDs (with resistors)&lt;/li&gt;
&lt;li&gt;Logic inputs&lt;/li&gt;
&lt;li&gt;Sensors&lt;/li&gt;
&lt;li&gt;Transistors&lt;/li&gt;
&lt;li&gt;Driver circuits&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Not:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Motors&lt;/li&gt;
&lt;li&gt;High-power LEDs&lt;/li&gt;
&lt;li&gt;Relays&lt;/li&gt;
&lt;li&gt;Speakers&lt;/li&gt;
&lt;li&gt;Servos&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These devices usually require external power and dedicated drivers.&lt;/p&gt;

&lt;h2&gt;
  
  
  GPIO Pins Operate at 3.3V
&lt;/h2&gt;

&lt;p&gt;Unlike some microcontroller boards, Raspberry Pi GPIOs are not 5V tolerant.&lt;/p&gt;

&lt;p&gt;Applying 5V directly to a GPIO pin can permanently damage the processor.&lt;/p&gt;

&lt;p&gt;Always verify:&lt;/p&gt;

&lt;p&gt;Input Voltage ≤ 3.3V&lt;/p&gt;

&lt;p&gt;when connecting external electronics.&lt;/p&gt;

&lt;h2&gt;
  
  
  Current Limitations
&lt;/h2&gt;

&lt;p&gt;A GPIO pin can source or sink only a limited amount of current.&lt;/p&gt;

&lt;p&gt;A common rule of thumb is:&lt;/p&gt;

&lt;p&gt;≈16mA per GPIO&lt;/p&gt;

&lt;p&gt;≈50mA total across all GPIOs&lt;/p&gt;

&lt;p&gt;Always check the latest Raspberry Pi documentation for the exact specifications of your model.&lt;/p&gt;

&lt;p&gt;This is why LEDs should always use a resistor.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="no"&gt;GPIO&lt;/span&gt;
 &lt;span class="o"&gt;|&lt;/span&gt;
&lt;span class="mi"&gt;220&lt;/span&gt;&lt;span class="no"&gt;Ω&lt;/span&gt;
 &lt;span class="o"&gt;|&lt;/span&gt;
&lt;span class="no"&gt;LED&lt;/span&gt;
 &lt;span class="o"&gt;|&lt;/span&gt;
&lt;span class="no"&gt;GND&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The resistor protects both the LED and the GPIO pin.&lt;/p&gt;

&lt;h2&gt;
  
  
  PWM Limitations on Raspberry Pi
&lt;/h2&gt;

&lt;p&gt;PWM is powerful, but it has limitations.&lt;/p&gt;

&lt;p&gt;Understanding them helps explain why some projects work perfectly while others require additional hardware.&lt;/p&gt;

&lt;h2&gt;
  
  
  PWM Is Still Digital
&lt;/h2&gt;

&lt;p&gt;This is the most important limitation.&lt;/p&gt;

&lt;p&gt;PWM is not true analog output.&lt;/p&gt;

&lt;p&gt;Even at 50% duty cycle, the signal remains:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="no"&gt;V&lt;/span&gt;
&lt;span class="n"&gt;or&lt;/span&gt;
&lt;span class="mf"&gt;3.3&lt;/span&gt;&lt;span class="no"&gt;V&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;only.&lt;/p&gt;

&lt;p&gt;PWM merely changes the timing.&lt;/p&gt;

&lt;p&gt;Some devices are perfectly happy with this.&lt;/p&gt;

&lt;p&gt;Others require actual analog voltages.&lt;/p&gt;

&lt;h2&gt;
  
  
  Not Every GPIO Supports Hardware PWM
&lt;/h2&gt;

&lt;p&gt;One of the most common surprises for beginners.&lt;/p&gt;

&lt;p&gt;Many GPIO pins can be used for:&lt;/p&gt;

&lt;p&gt;Digital Input&lt;br&gt;
Digital Output&lt;/p&gt;

&lt;p&gt;but only a subset support hardware PWM.&lt;/p&gt;

&lt;p&gt;For example, GPIO18 is commonly used because it supports hardware PWM functionality.&lt;/p&gt;

&lt;p&gt;This means:&lt;/p&gt;

&lt;p&gt;GPIO18 ✓&lt;br&gt;
Random GPIO ? Maybe not&lt;/p&gt;

&lt;p&gt;Depending on the PWM provider and Raspberry Pi model, available PWM pins may vary.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://pinout.xyz/pinout/pwm" rel="noopener noreferrer"&gt;https://pinout.xyz/pinout/pwm&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7aon00m04ve0pk1de5z8.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7aon00m04ve0pk1de5z8.jpg" alt=" " width="799" height="480"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Limited Hardware PWM Channels
&lt;/h2&gt;

&lt;p&gt;The Raspberry Pi contains a small number of hardware PWM generators.&lt;/p&gt;

&lt;p&gt;Conceptually:&lt;/p&gt;

&lt;p&gt;PWM Generator #1&lt;br&gt;
PWM Generator #2&lt;/p&gt;

&lt;p&gt;Multiple GPIOs may share these generators.&lt;/p&gt;

&lt;p&gt;As a result, changing one PWM configuration can sometimes affect another pin using the same channel.&lt;/p&gt;

&lt;p&gt;This limitation becomes important in projects involving:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Multiple motors&lt;/li&gt;
&lt;li&gt;RGB LED strips&lt;/li&gt;
&lt;li&gt;Audio generation&lt;/li&gt;
&lt;li&gt;Robotics&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  PWM Cannot Source Significant Power
&lt;/h2&gt;

&lt;p&gt;A common misconception:&lt;/p&gt;

&lt;p&gt;PWM = More Power&lt;/p&gt;

&lt;p&gt;Not really.&lt;/p&gt;

&lt;p&gt;PWM changes average power delivered to a load.&lt;/p&gt;

&lt;p&gt;The GPIO pin itself still has the same current limitations.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="no"&gt;GPIO&lt;/span&gt; &lt;span class="no"&gt;PWM&lt;/span&gt;
   &lt;span class="o"&gt;|&lt;/span&gt;
&lt;span class="nc"&gt;Motor&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;is generally a bad idea.&lt;br&gt;
Instead:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="no"&gt;GPIO&lt;/span&gt; &lt;span class="no"&gt;PWM&lt;/span&gt;
   &lt;span class="o"&gt;|&lt;/span&gt;
&lt;span class="nc"&gt;Transistor&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="no"&gt;MOSFET&lt;/span&gt;
   &lt;span class="o"&gt;|&lt;/span&gt;
&lt;span class="nc"&gt;Motor&lt;/span&gt; &lt;span class="nc"&gt;Power&lt;/span&gt; &lt;span class="nc"&gt;Supply&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This allows PWM to control the motor while external circuitry handles the actual power.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why PWM Is So Efficient
&lt;/h2&gt;

&lt;p&gt;Before PWM became popular, many systems controlled power by wasting energy as heat.&lt;/p&gt;

&lt;p&gt;Imagine trying to dim an LED using a variable resistor.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;Power&lt;/span&gt;
&lt;span class="err"&gt;↓&lt;/span&gt;
&lt;span class="nc"&gt;Resistor&lt;/span&gt;
&lt;span class="err"&gt;↓&lt;/span&gt;
&lt;span class="nc"&gt;Heat&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A portion of the energy is simply lost.&lt;/p&gt;

&lt;p&gt;PWM works differently.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;Power&lt;/span&gt;
&lt;span class="err"&gt;↓&lt;/span&gt;
&lt;span class="nc"&gt;Load&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The signal is either fully ON or fully OFF.&lt;/p&gt;

&lt;p&gt;Very little energy is wasted.&lt;/p&gt;

&lt;p&gt;This is one of the reasons PWM is found in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Electric vehicles&lt;/li&gt;
&lt;li&gt;Drones&lt;/li&gt;
&lt;li&gt;Industrial automation&lt;/li&gt;
&lt;li&gt;LED lighting systems&lt;/li&gt;
&lt;li&gt;Computer cooling fans&lt;/li&gt;
&lt;li&gt;Switching power supplies&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Efficiency is one of PWM's greatest strengths.&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/Lyd8RQ2WS-I"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  PWM Is Everywhere
&lt;/h2&gt;

&lt;p&gt;PWM is far more important than controlling LEDs.&lt;/p&gt;

&lt;p&gt;The same technique is used in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Computer cooling fans&lt;/li&gt;
&lt;li&gt;DC motor speed control&lt;/li&gt;
&lt;li&gt;Servo motors&lt;/li&gt;
&lt;li&gt;LED lighting systems&lt;/li&gt;
&lt;li&gt;Audio synthesis&lt;/li&gt;
&lt;li&gt;Switching power supplies&lt;/li&gt;
&lt;li&gt;Industrial automation equipment&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once you understand PWM, you begin seeing it everywhere.&lt;/p&gt;

&lt;h2&gt;
  
  
  Experiment Time
&lt;/h2&gt;

&lt;p&gt;Try connecting a multimeter to the filtered output.&lt;/p&gt;

&lt;p&gt;Set the duty cycle to:&lt;/p&gt;

&lt;p&gt;0%&lt;br&gt;
25%&lt;br&gt;
50%&lt;br&gt;
75%&lt;br&gt;
100%&lt;/p&gt;

&lt;p&gt;Measure the voltage at each step.&lt;/p&gt;

&lt;p&gt;You should observe values close to:&lt;/p&gt;

&lt;p&gt;0.0V&lt;br&gt;
0.8V&lt;br&gt;
1.65V&lt;br&gt;
2.5V&lt;br&gt;
3.3V&lt;/p&gt;

&lt;p&gt;This simple experiment demonstrates one of the most powerful ideas in electronics:&lt;/p&gt;

&lt;p&gt;A digital signal can behave like an analog one.&lt;/p&gt;
&lt;h2&gt;
  
  
  The Smartphone Camera Experiment
&lt;/h2&gt;

&lt;p&gt;Want to prove that the LED is actually blinking?&lt;/p&gt;

&lt;p&gt;Point your smartphone camera at it.&lt;/p&gt;

&lt;p&gt;Depending on the PWM frequency, you may see:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Flickering&lt;/li&gt;
&lt;li&gt;Rolling bands&lt;/li&gt;
&lt;li&gt;Horizontal stripes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The camera sensor often captures the rapid switching that our eyes cannot detect.&lt;/p&gt;

&lt;p&gt;It's a simple experiment, but it makes PWM feel much more real.&lt;/p&gt;
&lt;h2&gt;
  
  
  A Fun Experiment
&lt;/h2&gt;

&lt;p&gt;Try running exactly the same fade effect using both Software PWM and Hardware PWM.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;duty&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="n"&gt;duty&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="n"&gt;duty&lt;/span&gt;&lt;span class="o"&gt;++)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
   &lt;span class="n"&gt;pwm&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;duty&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
   &lt;span class="nc"&gt;Thread&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;sleep&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;First, configure the PWM instance as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;pwmType&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;PwmType&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;SOFTWARE&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then run the same code again using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;pwmType&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;PwmType&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;HARDWARE&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At first glance, the LED will appear to behave exactly the same. Both versions will smoothly fade from dark to bright.&lt;/p&gt;

&lt;p&gt;So what's the difference?&lt;/p&gt;

&lt;p&gt;The answer is hidden behind the scenes.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The magic happens behind the scenes. In Software PWM, Java and the CPU generate every pulse. In Hardware PWM, a dedicated Raspberry Pi peripheral takes over the job and continues generating the signal even while your application is busy doing something else.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This distinction may not be visible when fading a single LED, but it becomes important in more demanding applications such as motor control, audio generation, robotics, or any project that requires precise timing.&lt;/p&gt;

&lt;p&gt;A useful way to think about it is:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Software PWM&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;Java&lt;/span&gt;
&lt;span class="err"&gt;↓&lt;/span&gt;
&lt;span class="no"&gt;CPU&lt;/span&gt;
&lt;span class="err"&gt;↓&lt;/span&gt;
&lt;span class="no"&gt;GPIO&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;versus&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Hardware PWM&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;Java&lt;/span&gt;
&lt;span class="err"&gt;↓&lt;/span&gt;
&lt;span class="no"&gt;PWM&lt;/span&gt; &lt;span class="nc"&gt;Controller&lt;/span&gt;
&lt;span class="err"&gt;↓&lt;/span&gt;
&lt;span class="no"&gt;GPIO&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the first case, the CPU is actively creating every pulse. In the second, the CPU simply configures the PWM controller and lets the hardware handle the rest.&lt;/p&gt;

&lt;p&gt;For a simple LED project, both approaches work great. But understanding this difference is an important step toward understanding how embedded systems manage timing, performance, and hardware resources.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Blink taught us how to control a GPIO pin.&lt;/p&gt;

&lt;p&gt;PWM teaches us how to control perception.&lt;/p&gt;

&lt;p&gt;By rapidly switching a digital signal on and off, we can create smooth brightness transitions, control motors, regulate power, and even generate analog-like voltages.&lt;/p&gt;

&lt;p&gt;What started as a blinking LED turns out to be one of the most important techniques in modern electronics.&lt;/p&gt;

&lt;p&gt;And this is only the beginning.&lt;/p&gt;

&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://osteele.github.io/pwm-explorer/" rel="noopener noreferrer"&gt;https://osteele.github.io/pwm-explorer/&lt;/a&gt;&lt;br&gt;
&lt;a href="https://en.wikipedia.org/wiki/Pulse-width_modulation" rel="noopener noreferrer"&gt;https://en.wikipedia.org/wiki/Pulse-width_modulation&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>LED Blink: Hello World</title>
      <dc:creator>IgorIOT</dc:creator>
      <pubDate>Tue, 09 Jun 2026 11:03:00 +0000</pubDate>
      <link>https://dev.to/igoriot/led-blink-hello-world-2o71</link>
      <guid>https://dev.to/igoriot/led-blink-hello-world-2o71</guid>
      <description>&lt;p&gt;&lt;em&gt;How’s the lad?&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;For decades, software developers have started their journey in a new programming language by writing a simple "&lt;strong&gt;Hello, World!&lt;/strong&gt;" application. In the world of electronics and physical computing, the equivalent tradition is even more visual: making an LED blink.&lt;/p&gt;

&lt;p&gt;While it may seem like a simple exercise, blinking an LED introduces some of the most fundamental concepts in embedded development. It demonstrates how software can interact with the physical world by controlling electronic components through the Raspberry Pi's GPIO (General Purpose Input/Output) pins.&lt;/p&gt;

&lt;p&gt;For Java developers, this is where Pi4J shines. Pi4J provides a modern and intuitive API that allows Java applications to communicate directly with Raspberry Pi hardware, making it possible to build IoT, automation, robotics, and monitoring projects without leaving the Java ecosystem.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F62dxmtvnn6qeneco6ppi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F62dxmtvnn6qeneco6ppi.png" alt=" " width="800" height="200"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this tutorial, we'll build our first Pi4J application and use it to control an LED connected to a Raspberry Pi. Along the way, you'll learn the basics of GPIO programming, understand how digital outputs work, and see how straightforward hardware control can be when using Java.&lt;/p&gt;

&lt;p&gt;By the end of this guide, you will be able to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Understand the role of GPIO pins on a Raspberry Pi&lt;/li&gt;
&lt;li&gt;Control hardware components from a Java application&lt;/li&gt;
&lt;li&gt;Create and configure a Pi4J project&lt;/li&gt;
&lt;li&gt;Turn a GPIO pin on and off programmatically&lt;/li&gt;
&lt;li&gt;Build your first physical computing project using Java and Pi4J&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What You'll Need
&lt;/h2&gt;

&lt;p&gt;Before we start writing code, let's gather the components required for this project.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Hardware&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Raspberry Pi&lt;/li&gt;
&lt;li&gt;LED&lt;/li&gt;
&lt;li&gt;220Ω or 330Ω resistor&lt;/li&gt;
&lt;li&gt;Breadboard&lt;/li&gt;
&lt;li&gt;Jumper wires&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Software&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Java Development Kit (JDK)&lt;/li&gt;
&lt;li&gt;Maven or Gradle&lt;/li&gt;
&lt;li&gt;Pi4J properly configured on your Raspberry Pi&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The circuit used in this tutorial is intentionally simple, making it perfect for learning the fundamentals of GPIO programming.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4i4j1u9s4r3ougxut3sp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4i4j1u9s4r3ougxut3sp.png" alt=" " width="799" height="289"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Before writing any code, it's helpful to understand the concept that makes Raspberry Pi hardware control possible: GPIO.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Is GPIO?
&lt;/h2&gt;

&lt;p&gt;GPIO stands for &lt;strong&gt;General Purpose Input/Output&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;These programmable pins allow software running on the Raspberry Pi to interact with external hardware components such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;LEDs&lt;/li&gt;
&lt;li&gt;Buttons&lt;/li&gt;
&lt;li&gt;Sensors&lt;/li&gt;
&lt;li&gt;Relays&lt;/li&gt;
&lt;li&gt;Motors&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each GPIO pin can be configured for different purposes depending on the application.&lt;/p&gt;

&lt;h2&gt;
  
  
  Input vs Output
&lt;/h2&gt;

&lt;p&gt;GPIO pins generally operate in one of two modes:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Input&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;An input pin reads signals coming from external devices.&lt;/p&gt;

&lt;p&gt;Examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Detecting a button press&lt;/li&gt;
&lt;li&gt;Reading a sensor value&lt;/li&gt;
&lt;li&gt;Monitoring a switch state&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Output&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;An output pin sends signals to external devices.&lt;/p&gt;

&lt;p&gt;Examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Turning on an LED&lt;/li&gt;
&lt;li&gt;Activating a relay&lt;/li&gt;
&lt;li&gt;Driving a buzzer&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In this tutorial, GPIO 17 will be configured as an output pin.&lt;/p&gt;

&lt;h2&gt;
  
  
  HIGH and LOW States
&lt;/h2&gt;

&lt;p&gt;A digital GPIO output has two possible states:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5aumb0r08hi1z2bv66x7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5aumb0r08hi1z2bv66x7.png" alt=" " width="573" height="108"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Table 01:  High and Low states&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;By switching between HIGH and LOW, we can control the LED directly from our Java application.&lt;/p&gt;
&lt;h2&gt;
  
  
  Creating a Blink Effect
&lt;/h2&gt;

&lt;p&gt;Blinking an LED is simply a matter of repeatedly:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Setting the GPIO pin HIGH&lt;/li&gt;
&lt;li&gt;Waiting for a short period&lt;/li&gt;
&lt;li&gt;Setting the GPIO pin LOW&lt;/li&gt;
&lt;li&gt;Waiting again&lt;/li&gt;
&lt;li&gt;Repeating the process&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;When the application calls led.high(), Pi4J communicates with the underlying Raspberry Pi GPIO subsystem and sets the selected pin to 3.3V. Calling led.low() returns the pin to 0V, turning the LED off.&lt;/p&gt;

&lt;p&gt;This simple pattern forms the foundation for many more advanced hardware projects.&lt;/p&gt;
&lt;h2&gt;
  
  
  GPIO Numbering Explained
&lt;/h2&gt;

&lt;p&gt;One of the most common sources of confusion for beginners is the different numbering schemes used when referring to Raspberry Pi pins. Before connecting any hardware, it's important to understand the distinction between a pin's physical location and its GPIO identifier.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqqxxb2t5s5tyc7vrpb07.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqqxxb2t5s5tyc7vrpb07.jpg" alt=" " width="600" height="491"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Physical Pins vs GPIO Numbers
&lt;/h2&gt;

&lt;p&gt;The Raspberry Pi header contains 40 physical pins arranged in two rows. These pins are numbered sequentially from 1 to 40 based on their physical position on the board.&lt;/p&gt;

&lt;p&gt;However, not all of these pins are GPIO pins. Some provide power (3.3V or 5V), while others provide ground (GND).&lt;/p&gt;

&lt;p&gt;GPIO pins are identified using BCM (Broadcom) GPIO numbers, which refer to the numbering used internally by the Raspberry Pi's processor.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq0hrwl9d4jg5awui2b5m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq0hrwl9d4jg5awui2b5m.png" alt=" " width="568" height="239"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Table 02: Physical pin&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In this tutorial, we connect our LED to Physical Pin 11, which corresponds to GPIO 17.&lt;/p&gt;
&lt;h2&gt;
  
  
  Why This Matters
&lt;/h2&gt;

&lt;p&gt;When reading tutorials or examples online, you may encounter references such as:&lt;/p&gt;

&lt;p&gt;create(17)&lt;/p&gt;

&lt;p&gt;This does not refer to Physical Pin 17 on the header.&lt;/p&gt;

&lt;p&gt;Instead, it refers to GPIO 17 (BCM numbering), which is physically located on Pin 11.&lt;/p&gt;

&lt;p&gt;Mixing up these numbering schemes is one of the most common causes of wiring mistakes and can lead to circuits that simply do not work as expected.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A Practical Example&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;For this project:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The LED is connected to GPIO 17&lt;/li&gt;
&lt;li&gt;GPIO 17 is located on Physical Pin 11&lt;/li&gt;
&lt;li&gt;The LED's cathode is connected to a GND pin&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A common beginner mistake is to connect the LED to Physical Pin 17 because the code references GPIO 17. Physical Pin 17 is actually a 3.3V power pin, not GPIO 17.&lt;/p&gt;
&lt;h2&gt;
  
  
  BCM Numbering in Pi4J
&lt;/h2&gt;

&lt;p&gt;Pi4J uses the Raspberry Pi's GPIO identifiers rather than the physical header positions. When creating a digital output like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;led&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pi4j&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;dout&lt;/span&gt;&lt;span class="o"&gt;().&lt;/span&gt;&lt;span class="na"&gt;create&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;17&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Pi4J configures GPIO 17, not Physical Pin 17.&lt;/p&gt;

&lt;p&gt;For this reason, it is highly recommended to keep a Raspberry Pi GPIO pinout diagram nearby while building projects. Once you become familiar with the relationship between physical pins and BCM GPIO numbers, wiring circuits becomes much easier and less error-prone.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding the Circuit
&lt;/h2&gt;

&lt;p&gt;Although our circuit contains only a few components, understanding their purpose is important before we begin programming.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GPIO Connection&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In this example, we'll use GPIO 17 as a digital output.&lt;/p&gt;

&lt;p&gt;The wiring is straightforward:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Connect GPIO 17 to the resistor.&lt;/li&gt;
&lt;li&gt;Connect the resistor to the LED anode (+).&lt;/li&gt;
&lt;li&gt;Connect the LED cathode (-) to a GND pin.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;When GPIO 17 is set HIGH, the LED will turn on. When it is set LOW, the LED will turn off.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7gcerwladyltpc8ji6ha.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7gcerwladyltpc8ji6ha.png" alt=" " width="800" height="562"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  GPIO Safety Tip
&lt;/h2&gt;

&lt;p&gt;Raspberry Pi GPIO pins operate at 3.3V and are not 5V tolerant. Applying more than 3.3V to a GPIO pin can permanently damage the board. Always double-check your wiring before powering the circuit.&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating the Java Project
&lt;/h2&gt;

&lt;p&gt;With the hardware connected, we're ready to create our first Pi4J application.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Project Structure&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This example uses Maven, although Pi4J works equally well with Gradle.&lt;/p&gt;

&lt;p&gt;A minimal project structure looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="n"&gt;blink&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;led&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;
&lt;span class="err"&gt;├──&lt;/span&gt; &lt;span class="n"&gt;pom&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;xml&lt;/span&gt;
&lt;span class="err"&gt;└──&lt;/span&gt; &lt;span class="n"&gt;src&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;
    &lt;span class="err"&gt;└──&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;
        &lt;span class="err"&gt;└──&lt;/span&gt; &lt;span class="n"&gt;java&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;
            &lt;span class="err"&gt;└──&lt;/span&gt; &lt;span class="n"&gt;com&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;example&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;
                &lt;span class="err"&gt;└──&lt;/span&gt; &lt;span class="nc"&gt;BlinkLed&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;java&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Adding Pi4J Dependencies&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Add the required Pi4J dependencies to your pom.xml:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;dependencies&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;dependency&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;groupId&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;com&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;pi4j&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;groupId&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;artifactId&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;pi4j&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;core&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;artifactId&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;version&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="no"&gt;YOUR_PI4J_VERSION&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;version&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;dependency&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;

    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;dependency&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;groupId&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;com&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;pi4j&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;groupId&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;artifactId&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;pi4j&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;plugin&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;raspberrypi&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;artifactId&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;version&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="no"&gt;YOUR_PI4J_VERSION&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;version&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;dependency&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;

    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;dependency&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;groupId&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;com&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;pi4j&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;groupId&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;artifactId&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;pi4j&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;plugin&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;pigpio&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;artifactId&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;version&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="no"&gt;YOUR_PI4J_VERSION&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;version&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;dependency&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;dependencies&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Writing the Application&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Create a new class named BlinkLed.java and add the following code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;BlinkLed&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;

    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="kd"&gt;throws&lt;/span&gt; &lt;span class="nc"&gt;Exception&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;

        &lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;pi4j&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Pi4J&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;newAutoContext&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;

        &lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;led&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pi4j&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;dout&lt;/span&gt;&lt;span class="o"&gt;().&lt;/span&gt;&lt;span class="na"&gt;create&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;17&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

        &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;led&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;high&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
            &lt;span class="nc"&gt;Thread&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;sleep&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

            &lt;span class="n"&gt;led&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;low&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
            &lt;span class="nc"&gt;Thread&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;sleep&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Understanding the Code&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Creating the Pi4J Context&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;pi4j&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Pi4J&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;newAutoContext&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The context initializes Pi4J and loads the required providers for interacting with Raspberry Pi hardware.&lt;/p&gt;

&lt;p&gt;Configuring the GPIO Pin&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;led&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pi4j&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;dout&lt;/span&gt;&lt;span class="o"&gt;().&lt;/span&gt;&lt;span class="na"&gt;create&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;17&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This creates a digital output attached to GPIO 17.&lt;/p&gt;

&lt;p&gt;Turning the LED On&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="n"&gt;led&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;high&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Setting the pin HIGH outputs 3.3V and illuminates the LED.&lt;/p&gt;

&lt;p&gt;Turning the LED Off&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="n"&gt;led&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;low&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Setting the pin LOW removes the voltage and turns the LED off.&lt;/p&gt;

&lt;p&gt;Creating a Delay&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;Thread&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;sleep&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The application pauses for 500 milliseconds.&lt;/p&gt;

&lt;p&gt;Repeating the Process&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The loop continuously alternates between HIGH and LOW states, creating the blinking effect.&lt;/p&gt;

&lt;h2&gt;
  
  
  Clean Shutdown (Pi4J Best Practice)
&lt;/h2&gt;

&lt;p&gt;Properly shutting down the Pi4J context releases GPIO resources and ensures the application exits cleanly.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;Runtime&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getRuntime&lt;/span&gt;&lt;span class="o"&gt;().&lt;/span&gt;&lt;span class="na"&gt;addShutdownHook&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;
    &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;Thread&lt;/span&gt;&lt;span class="o"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;pi4j&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;shutdown&lt;/span&gt;&lt;span class="o"&gt;())&lt;/span&gt;
&lt;span class="o"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Running the Application
&lt;/h2&gt;

&lt;p&gt;Compile the project using Maven:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="n"&gt;mvn&lt;/span&gt; &lt;span class="n"&gt;clean&lt;/span&gt; &lt;span class="kn"&gt;package&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then execute the generated JAR:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="n"&gt;java&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;jar&lt;/span&gt; &lt;span class="n"&gt;target&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;blink&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;led&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;jar&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If everything is connected correctly, the LED should begin blinking at half-second intervals.&lt;/p&gt;

&lt;h2&gt;
  
  
  Troubleshooting
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;The LED Does Not Turn On&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Check the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;LED polarity is correct&lt;/li&gt;
&lt;li&gt;GPIO 17 is being used&lt;/li&gt;
&lt;li&gt;All jumper wires are firmly connected&lt;/li&gt;
&lt;li&gt;The resistor is properly placed in the circuit&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Permission Errors&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If Pi4J cannot access the GPIO hardware:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Verify your Pi4J installation&lt;/li&gt;
&lt;li&gt;Ensure the required providers are installed&lt;/li&gt;
&lt;li&gt;Confirm the application is running with appropriate permissions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Dependency Issues&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If Maven cannot resolve dependencies:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="n"&gt;mvn&lt;/span&gt; &lt;span class="nl"&gt;dependency:&lt;/span&gt;&lt;span class="n"&gt;tree&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Verify that all Pi4J artifacts are available and successfully downloaded.&lt;/p&gt;

&lt;p&gt;Stay tuned for upcoming Raspberry Pi and Pi4J projects.&lt;/p&gt;

&lt;p&gt;You can find the project on GitHub: &lt;a href="https://github.com/igfasouza/Pi4J-LED-Playground" rel="noopener noreferrer"&gt;Pi4J LED Playground&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://pinout.xyz/" rel="noopener noreferrer"&gt;https://pinout.xyz/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Remember to use the hashtag &lt;strong&gt;#JavaOnRaspberryPi&lt;/strong&gt; on Twitter to show the world Raspberry Pi with Java.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>The Ultimate Guide to LEDs for Raspberry Pi: Types, Colors, Resistors and Fun Facts</title>
      <dc:creator>IgorIOT</dc:creator>
      <pubDate>Sat, 06 Jun 2026 11:14:25 +0000</pubDate>
      <link>https://dev.to/igoriot/the-ultimate-guide-to-leds-for-raspberry-pi-types-colors-resistors-and-fun-facts-3oc2</link>
      <guid>https://dev.to/igoriot/the-ultimate-guide-to-leds-for-raspberry-pi-types-colors-resistors-and-fun-facts-3oc2</guid>
      <description>&lt;p&gt;&lt;em&gt;Story Horse?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;LEDs are everywhere.&lt;/p&gt;

&lt;p&gt;From the tiny status LEDs on a Raspberry Pi to massive displays in stadiums and modern smart lighting systems, LEDs have completely transformed the way we produce and use light.&lt;/p&gt;

&lt;p&gt;If you’re building projects with Raspberry Pi, Java, Pi4J, Arduino, or electronics in general, understanding LEDs is one of the most important skills you can learn.&lt;/p&gt;

&lt;p&gt;In this guide, we’ll explore how LEDs work, the different sizes and colors available, SMD LEDs, resistor calculations, brightness ratings, common beginner mistakes, and some fascinating facts about these amazing components.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is an LED?
&lt;/h2&gt;

&lt;p&gt;LED stands for Light Emitting Diode.&lt;/p&gt;

&lt;p&gt;An LED is a semiconductor device that emits light when an electrical current flows through it.&lt;/p&gt;

&lt;p&gt;Unlike traditional incandescent bulbs, which generate light by heating a filament, LEDs convert electrical energy into light much more efficiently.&lt;/p&gt;

&lt;p&gt;Because of their efficiency, low power consumption, and long lifespan, LEDs are used in countless applications, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Raspberry Pi projects&lt;/li&gt;
&lt;li&gt;Consumer electronics&lt;/li&gt;
&lt;li&gt;Automotive lighting&lt;/li&gt;
&lt;li&gt;Home lighting&lt;/li&gt;
&lt;li&gt;Traffic signals&lt;/li&gt;
&lt;li&gt;Industrial equipment&lt;/li&gt;
&lt;li&gt;Digital displays&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3vavfn7g1zzqm4vhi4kc.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3vavfn7g1zzqm4vhi4kc.jpg" alt=" " width="367" height="687"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Picture 01: Led anatomy&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/Light-emitting_diode#/media/File:LED,_5mm,_green_(en).svg" rel="noopener noreferrer"&gt;For more details&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How Does an LED Work?
&lt;/h2&gt;

&lt;p&gt;An LED is a type of diode, meaning it only allows current to flow in one direction.&lt;/p&gt;

&lt;p&gt;Every LED has two terminals:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Anode (+)&lt;/strong&gt; – positive terminal&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cathode (-)&lt;/strong&gt; – negative terminal&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When connected correctly, current flows through the LED and light is produced.&lt;/p&gt;

&lt;p&gt;If the LED is connected backwards, it will not light up.&lt;/p&gt;

&lt;p&gt;For traditional through-hole LEDs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The longer leg is usually the anode.&lt;/li&gt;
&lt;li&gt;The shorter leg is usually the cathode.&lt;/li&gt;
&lt;li&gt;The flat edge on the LED body typically indicates the cathode.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/O8M2z2hIbag"&gt;
  &lt;/iframe&gt;
&lt;br&gt;
&lt;em&gt;Video 01: How LED Works&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Common LED Colors and Forward Voltage
&lt;/h2&gt;

&lt;p&gt;Different LED colors require different forward voltages.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiomuxawtpd2ipzzefccp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiomuxawtpd2ipzzefccp.png" alt=" " width="554" height="311"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Table 01: Led colors&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This is why resistor calculations may differ depending on the LED color you are using.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F42bcmdx4cok27ubici4y.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F42bcmdx4cok27ubici4y.jpg" alt=" " width="411" height="686"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Picture 02: Led color&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Common LED Sizes
&lt;/h2&gt;

&lt;p&gt;The most popular LEDs used by hobbyists are through-hole LEDs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3 mm LEDs&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Small and compact.&lt;/p&gt;

&lt;p&gt;Commonly used for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Status indicators&lt;/li&gt;
&lt;li&gt;Small electronic projects&lt;/li&gt;
&lt;li&gt;Low-profile designs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;5 mm LEDs&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The most popular LED size.&lt;/p&gt;

&lt;p&gt;Commonly used for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Raspberry Pi projects&lt;/li&gt;
&lt;li&gt;Breadboard circuits&lt;/li&gt;
&lt;li&gt;Educational electronics kits&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;8 mm and 10 mm LEDs&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Larger LEDs with greater visibility.&lt;/p&gt;

&lt;p&gt;Commonly used for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Decorative lighting&lt;/li&gt;
&lt;li&gt;Signage&lt;/li&gt;
&lt;li&gt;High-visibility indicators&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The size refers to the diameter of the LED's lens and primarily affects its appearance, viewing angle, and perceived brightness rather than its electrical behavior. Smaller 3 mm LEDs are compact and ideal for indicator lights, while 5 mm LEDs are the most widely used due to their balance of size and visibility. Larger 10 mm LEDs offer increased visibility and are often chosen for projects where the LED needs to be seen from a greater distance. Regardless of size, LEDs should always be used with an appropriate current-limiting resistor, and their electrical specifications should be verified using the manufacturer's datasheet.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frbthxl48as5cka1romxz.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frbthxl48as5cka1romxz.jpg" alt=" " width="441" height="688"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Picture 03: Led sizes&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  LEDs in a variety of shapes
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa0rk6ukbtsqsf4cobd3w.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa0rk6ukbtsqsf4cobd3w.jpg" alt=" " width="800" height="600"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Picture 04: Formats&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What Does SMD Mean?
&lt;/h2&gt;

&lt;p&gt;SMD stands for Surface Mount Device.&lt;/p&gt;

&lt;p&gt;Unlike traditional LEDs that have wire leads passing through a circuit board, SMD LEDs are soldered directly onto the surface of a PCB.&lt;/p&gt;

&lt;p&gt;Because they are smaller and easier to manufacture in large quantities, SMD LEDs are found in nearly every modern electronic device.&lt;/p&gt;

&lt;p&gt;You can find SMD LEDs in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Smartphones&lt;/li&gt;
&lt;li&gt;TVs&lt;/li&gt;
&lt;li&gt;Computer monitors&lt;/li&gt;
&lt;li&gt;Raspberry Pi boards&lt;/li&gt;
&lt;li&gt;LED strips&lt;/li&gt;
&lt;li&gt;Smart lighting systems&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Popular examples include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;3528&lt;/li&gt;
&lt;li&gt;5050&lt;/li&gt;
&lt;li&gt;2835&lt;/li&gt;
&lt;li&gt;5730&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The numbers usually represent the physical dimensions of the LED package.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;5050 = 5.0 mm × 5.0 mm&lt;/li&gt;
&lt;li&gt;3528 = 3.5 mm × 2.8 mm&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F362bqe5wrf7vmvx16ydz.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F362bqe5wrf7vmvx16ydz.jpg" alt=" " width="422" height="685"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Picture 05: SMD&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  LED Brightness: Lumens, Millicandela and Viewing Angle
&lt;/h2&gt;

&lt;p&gt;One of the most confusing LED specifications for beginners is brightness.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Lumens (lm)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Lumens measure the total amount of visible light produced by a light source.&lt;/p&gt;

&lt;p&gt;The higher the lumen rating, the more light the LED produces overall.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Millicandela (mcd)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Millicandela measures light intensity in a specific direction.&lt;/p&gt;

&lt;p&gt;A high mcd value does not always mean the LED is brighter overall.&lt;/p&gt;

&lt;p&gt;Sometimes it simply means the light is concentrated into a narrow beam.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Viewing Angle&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The viewing angle describes how widely the light is distributed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fllqwohby9gzp8mwol9y0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fllqwohby9gzp8mwol9y0.png" alt=" " width="548" height="196"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Table 02: Viewing Angle&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;A narrow-angle LED often appears brighter because the light is concentrated into a smaller area.&lt;/p&gt;

&lt;h2&gt;
  
  
  Clear vs Diffused LEDs
&lt;/h2&gt;

&lt;p&gt;In addition to different sizes, LEDs are also available with different lens finishes, the most common being diffused and clear (transparent). Diffused LEDs have a frosted lens that scatters light in multiple directions, producing a softer and more uniform glow that is visible from a wider viewing angle. Clear LEDs, on the other hand, use a transparent lens that focuses the light more directly, often making them appear brighter when viewed head-on. Because of this focused beam, clear LEDs are commonly used when maximum brightness or visibility is desired, while diffused LEDs are often preferred for indicators and projects where an even distribution of light creates a more pleasing visual effect. The choice between the two is usually based on the desired appearance rather than electrical characteristics, as both types are connected and controlled in the same way.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Clear LEDs&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Characteristics:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Transparent lens&lt;/li&gt;
&lt;li&gt;Focused beam&lt;/li&gt;
&lt;li&gt;Higher apparent brightness&lt;/li&gt;
&lt;li&gt;Better for long-distance visibility&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Diffused LEDs&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Characteristics:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Frosted lens&lt;/li&gt;
&lt;li&gt;Softer light output&lt;/li&gt;
&lt;li&gt;Wider distribution&lt;/li&gt;
&lt;li&gt;Better for indicators and decorative projects&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For Raspberry Pi projects, diffused LEDs are often easier on the eyes.&lt;/p&gt;

&lt;h2&gt;
  
  
  RGB LEDs
&lt;/h2&gt;

&lt;p&gt;RGB LEDs combine three colors in a single package:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Red&lt;/li&gt;
&lt;li&gt;Green&lt;/li&gt;
&lt;li&gt;Blue&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By controlling the brightness of each color, thousands of color combinations can be created.&lt;/p&gt;

&lt;p&gt;RGB LEDs are commonly used in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Decorative lighting&lt;/li&gt;
&lt;li&gt;Gaming setups&lt;/li&gt;
&lt;li&gt;Smart home projects&lt;/li&gt;
&lt;li&gt;Raspberry Pi projects&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Examples include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Standard RGB LEDs&lt;/li&gt;
&lt;li&gt;WS2812B LEDs&lt;/li&gt;
&lt;li&gt;NeoPixels&lt;/li&gt;
&lt;li&gt;SK6812 LEDs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzwo0ylhek4lx7w8lsksk.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzwo0ylhek4lx7w8lsksk.jpg" alt=" " width="415" height="687"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Picture 06: Led types&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Do LEDs Need Resistors?
&lt;/h2&gt;

&lt;p&gt;One of the most common beginner mistakes is connecting an LED directly to a power source.&lt;/p&gt;

&lt;p&gt;Without a resistor, too much current can flow through the LED, causing permanent damage.&lt;/p&gt;

&lt;p&gt;A resistor limits the current to a safe value.&lt;br&gt;
The resistor value can be calculated using:&lt;/p&gt;

&lt;p&gt;R = (Vsupply − Vled) ÷ I&lt;/p&gt;

&lt;p&gt;Where:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Vsupply = power source voltage&lt;/li&gt;
&lt;li&gt;Vled = LED forward voltage&lt;/li&gt;
&lt;li&gt;I = desired current&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Supply Voltage = 5V&lt;/li&gt;
&lt;li&gt;Red LED Voltage = 2V&lt;/li&gt;
&lt;li&gt;Current = 20mA&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Result:&lt;/p&gt;

&lt;p&gt;150 Ω resistor&lt;/p&gt;

&lt;p&gt;In practice, hobbyists often use:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;220 Ω&lt;/li&gt;
&lt;li&gt;330 Ω&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Both values work well for most Raspberry Pi LED projects.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy4vwri2o2gyxiwywcvdx.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy4vwri2o2gyxiwywcvdx.jpg" alt=" " width="437" height="685"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Picture 07: Resistor&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/7d4ymjU9NqM"&gt;
  &lt;/iframe&gt;
&lt;br&gt;
&lt;em&gt;Video 02: LED Circuit Design&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://ledcalculator.net/" rel="noopener noreferrer"&gt;ledcalculator&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Recommended Resistors for Raspberry Pi
&lt;/h2&gt;

&lt;p&gt;Since Raspberry Pi GPIO pins operate at 3.3V, a 220 Ω resistor is often a safe and simple choice.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmez94n8tkylowgk1sb1q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmez94n8tkylowgk1sb1q.png" alt=" " width="576" height="238"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Table 03: Resistors&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Always verify the specifications of your LED before connecting it.&lt;/p&gt;

&lt;h2&gt;
  
  
  LED Polarity Tricks
&lt;/h2&gt;

&lt;p&gt;Not sure which side is positive or negative?&lt;/p&gt;

&lt;p&gt;Here are some easy ways to identify the cathode:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The shorter leg is usually the cathode&lt;/li&gt;
&lt;li&gt;The flat edge indicates the cathode&lt;/li&gt;
&lt;li&gt;The larger internal metal piece is usually connected to the cathode&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Always double-check before powering a circuit.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Do LEDs Come in Different Colors?
&lt;/h2&gt;

&lt;p&gt;Many people assume the color comes from a colored plastic lens.&lt;/p&gt;

&lt;p&gt;In reality, the color is determined by the semiconductor material used inside the LED.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqucaci7hue5c0pd3ia3z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqucaci7hue5c0pd3ia3z.png" alt=" " width="548" height="145"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Table 04: colors&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This is why different LED colors require different forward &lt;br&gt;
voltages.&lt;/p&gt;

&lt;h2&gt;
  
  
  Infrared and Ultraviolet LEDs
&lt;/h2&gt;

&lt;p&gt;Not all LEDs produce visible light.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Infrared LEDs (IR)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Infrared LEDs emit light outside the visible spectrum.&lt;/p&gt;

&lt;p&gt;Common applications:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;TV remote controls&lt;/li&gt;
&lt;li&gt;Security systems&lt;/li&gt;
&lt;li&gt;Motion sensors&lt;/li&gt;
&lt;li&gt;Communication devices&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Ultraviolet LEDs (UV)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;UV LEDs emit ultraviolet light.&lt;/p&gt;

&lt;p&gt;Common applications:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Currency validation&lt;/li&gt;
&lt;li&gt;Sterilization equipment&lt;/li&gt;
&lt;li&gt;Resin curing&lt;/li&gt;
&lt;li&gt;Scientific instruments&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Connecting Multiple LEDs
&lt;/h2&gt;

&lt;p&gt;When building larger projects, you may need multiple LEDs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Series Connection&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;LEDs are connected one after another.&lt;/p&gt;

&lt;p&gt;Advantages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Same current flows through all LEDs&lt;/li&gt;
&lt;li&gt;Efficient use of power&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Disadvantages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If one LED fails, the entire chain may stop working&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Parallel Connection&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;LEDs are connected side by side.&lt;/p&gt;

&lt;p&gt;Advantages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Individual LEDs operate independently&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Disadvantages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Current balancing becomes important&lt;/li&gt;
&lt;li&gt;Each branch may require its own resistor&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For many projects, series connections are preferred when possible.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvkxtszx9nv8rlslhn83a.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvkxtszx9nv8rlslhn83a.jpg" alt=" " width="446" height="685"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Picture 08: Series &amp;amp; Parallel&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How Much Power Does an LED Consume?
&lt;/h2&gt;

&lt;p&gt;LED power consumption depends on the type of LED.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpfgt2wc0lxhxb98jvy8t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpfgt2wc0lxhxb98jvy8t.png" alt=" " width="521" height="202"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Table 05: power consume&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Modern LEDs are often much more efficient than older designs.&lt;/p&gt;

&lt;h2&gt;
  
  
  LEDs and Raspberry Pi GPIO Limits
&lt;/h2&gt;

&lt;p&gt;When using LEDs with a Raspberry Pi, it is important to understand GPIO limitations.&lt;/p&gt;

&lt;p&gt;GPIO pins:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Operate at 3.3V&lt;/li&gt;
&lt;li&gt;Can only provide limited current&lt;/li&gt;
&lt;li&gt;Should not drive large loads directly&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For larger LED arrays, LED strips, or high-power LEDs, use:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Transistors&lt;/li&gt;
&lt;li&gt;MOSFETs&lt;/li&gt;
&lt;li&gt;Dedicated drivers&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This protects both the Raspberry Pi and your LEDs.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F05iaj49j8r7me0a67zb7.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F05iaj49j8r7me0a67zb7.jpg" alt=" " width="361" height="688"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Picture 09: Raspberry PI&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Special Types of LEDs
&lt;/h2&gt;

&lt;p&gt;Not all LEDs are simple indicator lights.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Flashing LEDs&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;These LEDs contain an internal circuit that automatically flashes the light.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Bi-Color LEDs&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Contain two colors inside a single package.&lt;/p&gt;

&lt;p&gt;Examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Red/Green&lt;/li&gt;
&lt;li&gt;Red/Yellow&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;RGB LEDs&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Contain three LEDs in one package and can create millions of colors.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5w5p56pghvt9r0rngpd8.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5w5p56pghvt9r0rngpd8.jpg" alt=" " width="440" height="685"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Picture 10: RGB&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Addressable LEDs&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Each LED can be controlled individually.&lt;/p&gt;

&lt;p&gt;Examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;WS2812B&lt;/li&gt;
&lt;li&gt;NeoPixel&lt;/li&gt;
&lt;li&gt;SK6812&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These are perfect for animations and visual effects.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;High-Power LEDs&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Standard LEDs typically consume around 20mA.&lt;/p&gt;

&lt;p&gt;High-power LEDs can operate at:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;1W&lt;/li&gt;
&lt;li&gt;3W&lt;/li&gt;
&lt;li&gt;5W&lt;/li&gt;
&lt;li&gt;10W&lt;/li&gt;
&lt;li&gt;50W or more&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These LEDs often require:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Heat sinks&lt;/li&gt;
&lt;li&gt;Constant-current drivers&lt;/li&gt;
&lt;li&gt;Thermal management&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Applications include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Floodlights&lt;/li&gt;
&lt;li&gt;Automotive lighting&lt;/li&gt;
&lt;li&gt;Industrial illumination&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Evolution of LEDs
&lt;/h2&gt;

&lt;p&gt;LED technology has evolved dramatically over the last few decades.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1962&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The first practical red LED was developed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1970s&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Yellow and green LEDs became available.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1990s&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Efficient blue LEDs were invented.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2000s&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;White LED lighting became commercially viable.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Today&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Smart RGB LEDs, addressable LED strips, and highly efficient lighting systems dominate the market.&lt;/p&gt;

&lt;h2&gt;
  
  
  LED Applications You Use Every Day
&lt;/h2&gt;

&lt;p&gt;You probably interact with LEDs hundreds of times per day.&lt;/p&gt;

&lt;p&gt;LEDs can be found in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;TVs&lt;/li&gt;
&lt;li&gt;Monitors&lt;/li&gt;
&lt;li&gt;Smartphones&lt;/li&gt;
&lt;li&gt;Cars&lt;/li&gt;
&lt;li&gt;Traffic lights&lt;/li&gt;
&lt;li&gt;Routers&lt;/li&gt;
&lt;li&gt;Raspberry Pi boards&lt;/li&gt;
&lt;li&gt;Keyboards&lt;/li&gt;
&lt;li&gt;Smart watches&lt;/li&gt;
&lt;li&gt;Home appliances&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Modern life would look very different without LEDs.&lt;/p&gt;

&lt;h2&gt;
  
  
  LED Myth Busting
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Myth: All LEDs Need 20mA&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;False.&lt;/p&gt;

&lt;p&gt;Many modern LEDs operate perfectly at lower currents.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Myth: Bigger LEDs Are Always Brighter&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;False.&lt;/p&gt;

&lt;p&gt;Brightness depends on efficiency, design, and viewing angle.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Myth: LEDs Never Burn Out&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;False.&lt;/p&gt;

&lt;p&gt;LEDs gradually degrade over time and eventually lose brightness.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fun LED Facts
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;LEDs Can Last Over 50,000 Hours&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A quality LED can operate continuously for years before failing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Blue LEDs Changed the World&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The invention of efficient blue LEDs made modern white LED lighting possible.&lt;/p&gt;

&lt;p&gt;This breakthrough earned the inventors the 2014 Nobel Prize in Physics.&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/AF8d72mA41M"&gt;
  &lt;/iframe&gt;
&lt;br&gt;
&lt;em&gt;Video 03: Why It Was Almost Impossible to Make the Blue LED&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;LEDs Are Extremely Efficient&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Modern LEDs convert much more energy into light than traditional incandescent bulbs.&lt;/p&gt;

&lt;p&gt;This results in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Lower power consumption&lt;/li&gt;
&lt;li&gt;Less heat generation&lt;/li&gt;
&lt;li&gt;Longer lifespan&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;LEDs Can Also Detect Light&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A little-known fact is that LEDs can act as primitive light sensors under certain conditions.&lt;/p&gt;

&lt;p&gt;While not as effective as photodiodes, they can detect changes in light levels.&lt;/p&gt;

&lt;h2&gt;
  
  
  Common Beginner Mistakes
&lt;/h2&gt;

&lt;p&gt;When starting with LEDs, avoid these common errors:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Connecting LEDs backwards&lt;/li&gt;
&lt;li&gt;Forgetting the resistor&lt;/li&gt;
&lt;li&gt;Using the wrong resistor value&lt;/li&gt;
&lt;li&gt;Exceeding Raspberry Pi GPIO current limits&lt;/li&gt;
&lt;li&gt;Miswiring RGB LEDs&lt;/li&gt;
&lt;li&gt;Assuming all LEDs have the same voltage requirements&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpt5ms0394xfoj1yuhwts.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpt5ms0394xfoj1yuhwts.jpg" alt=" " width="428" height="687"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Picture 11: Mistakes&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What’s Next?
&lt;/h2&gt;

&lt;p&gt;To help you continue experimenting, all of the code from this tutorial is available as part of the &lt;strong&gt;Pi4J LED Playground&lt;/strong&gt; project, a collection of LED-based examples designed to demonstrate different GPIO concepts and Pi4J features.&lt;/p&gt;

&lt;p&gt;The project serves as a hands-on playground where you can explore progressively more advanced scenarios, including different blinking patterns, multiple LEDs, traffic light simulations, animations, and other creative ways of interacting with Raspberry Pi hardware.&lt;/p&gt;

&lt;p&gt;Whether you're new to physical computing or looking to deepen your understanding of Pi4J, the playground provides a practical environment for learning through experimentation.&lt;/p&gt;

&lt;p&gt;You can find the project on GitHub: &lt;a href="https://github.com/igfasouza/Pi4J-LED-Playground" rel="noopener noreferrer"&gt;Pi4J LED Playground&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Feel free to clone the repository, modify the examples, and create your own LED effects. The best way to learn GPIO programming is by experimenting, and this project is designed to be a starting point for exactly that journey.&lt;/p&gt;

&lt;p&gt;Stay tuned for the upcoming &lt;strong&gt;Pi4J LED Playground&lt;/strong&gt; project series.&lt;/p&gt;

&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/Light-emitting_diode" rel="noopener noreferrer"&gt;https://en.wikipedia.org/wiki/Light-emitting_diode&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/LED_circuit" rel="noopener noreferrer"&gt;https://en.wikipedia.org/wiki/LED_circuit&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://ledcalculator.net/" rel="noopener noreferrer"&gt;https://ledcalculator.net/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.digikey.ie/en/resources/conversion-calculators/conversion-calculator-led-series-resistor" rel="noopener noreferrer"&gt;https://www.digikey.ie/en/resources/conversion-calculators/conversion-calculator-led-series-resistor&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.omnicalculator.com/physics/led" rel="noopener noreferrer"&gt;https://www.omnicalculator.com/physics/led&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://uk.rs-online.com/web/content/discovery/tools-and-calculators/led-resistor-calculator" rel="noopener noreferrer"&gt;https://uk.rs-online.com/web/content/discovery/tools-and-calculators/led-resistor-calculator&lt;/a&gt;&lt;/p&gt;

</description>
      <category>led</category>
      <category>raspberrypi</category>
      <category>learning</category>
      <category>pi4j</category>
    </item>
    <item>
      <title>Java on Raspberry Pi: Rediscovering Java Beyond the Enterprise</title>
      <dc:creator>IgorIOT</dc:creator>
      <pubDate>Tue, 02 Jun 2026 15:41:00 +0000</pubDate>
      <link>https://dev.to/igoriot/java-on-raspberry-pi-rediscovering-java-beyond-the-enterprise-5975</link>
      <guid>https://dev.to/igoriot/java-on-raspberry-pi-rediscovering-java-beyond-the-enterprise-5975</guid>
      <description>&lt;p&gt;When most people think about Java, they immediately picture enterprise applications, banking systems, massive backend services, or decades-old corporate software. While Java has earned its reputation in the enterprise world, that is only part of the story.&lt;/p&gt;

&lt;p&gt;Today, Java can run on devices as small as a Raspberry Pi, opening the door to hardware projects, edge computing, home automation, education, and hands-on learning experiences.&lt;/p&gt;

&lt;p&gt;Combining Java with Raspberry Pi creates a powerful platform for experimentation, learning, and building real-world solutions that go far beyond traditional enterprise development.&lt;/p&gt;

&lt;p&gt;Raspberry Pi teaches us about hardware. Java allows us to apply professional software engineering practices to that hardware. Together, they create a powerful platform for learning, prototyping, and building real-world IoT and edge computing solutions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Java Is More Than Enterprise Software
&lt;/h2&gt;

&lt;p&gt;Java's enterprise success has sometimes created the misconception that it only belongs in large organizations.&lt;/p&gt;

&lt;p&gt;In reality, modern Java offers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Excellent support for Linux and ARM architectures.&lt;/li&gt;
&lt;li&gt;High performance and low resource consumption.&lt;/li&gt;
&lt;li&gt;Modern frameworks such as Spring Boot, Quarkus, and Micronaut.&lt;/li&gt;
&lt;li&gt;Strong support for IoT and edge computing.&lt;/li&gt;
&lt;li&gt;Access to hardware through mature libraries.&lt;/li&gt;
&lt;li&gt;One of the largest developer ecosystems in the world.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The Raspberry Pi highlights a different side of Java—one focused on creativity, experimentation, and direct interaction with the physical world.&lt;/p&gt;

&lt;p&gt;Instead of building another web application, you can build systems that sense, react, and interact with their environment.&lt;/p&gt;

&lt;h2&gt;
  
  
  Java at the Edge
&lt;/h2&gt;

&lt;p&gt;One of the most exciting technology trends today is Edge Computing.&lt;/p&gt;

&lt;p&gt;Traditionally, devices send data to cloud services where processing and decision-making occur. Edge computing shifts part of that processing closer to where the data is generated.&lt;/p&gt;

&lt;p&gt;A Raspberry Pi running Java can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Process sensor data locally.&lt;/li&gt;
&lt;li&gt;Apply business rules before sending information to the cloud.&lt;/li&gt;
&lt;li&gt;Reduce network traffic.&lt;/li&gt;
&lt;li&gt;Lower latency.&lt;/li&gt;
&lt;li&gt;Continue operating when connectivity is limited.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Imagine a Raspberry Pi connected to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Temperature sensors&lt;/li&gt;
&lt;li&gt;Cameras&lt;/li&gt;
&lt;li&gt;Industrial equipment&lt;/li&gt;
&lt;li&gt;Smart home devices&lt;/li&gt;
&lt;li&gt;Environmental monitoring systems&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Instead of continuously streaming raw data to the cloud, Java applications can analyze, filter, and react locally.&lt;/p&gt;

&lt;p&gt;This approach makes systems faster, more efficient, and more resilient.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reducing Cloud Costs
&lt;/h2&gt;

&lt;p&gt;Cloud platforms provide incredible capabilities, but they are not free.&lt;/p&gt;

&lt;p&gt;Many hobby projects, prototypes, educational environments, and even small business solutions do not require cloud infrastructure for every component.&lt;/p&gt;

&lt;p&gt;A Raspberry Pi can host:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;REST APIs&lt;/li&gt;
&lt;li&gt;Local dashboards&lt;/li&gt;
&lt;li&gt;MQTT brokers&lt;/li&gt;
&lt;li&gt;Databases&lt;/li&gt;
&lt;li&gt;Monitoring tools&lt;/li&gt;
&lt;li&gt;Automation services&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Running these workloads locally can reduce:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Hosting costs&lt;/li&gt;
&lt;li&gt;Data transfer costs&lt;/li&gt;
&lt;li&gt;Infrastructure complexity&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For developers who want to experiment without constantly spinning up cloud resources, a Raspberry Pi becomes an affordable personal server.&lt;/p&gt;

&lt;h2&gt;
  
  
  A Backup When the Cloud Is Unavailable
&lt;/h2&gt;

&lt;p&gt;Cloud outages are rare, but they happen.&lt;/p&gt;

&lt;p&gt;Internet connectivity issues happen even more frequently.&lt;/p&gt;

&lt;p&gt;A Raspberry Pi running Java can serve as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A local cache&lt;/li&gt;
&lt;li&gt;A backup processing node&lt;/li&gt;
&lt;li&gt;An offline data collector&lt;/li&gt;
&lt;li&gt;A temporary synchronization point&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In hybrid architectures, edge devices can continue collecting and processing information while disconnected and synchronize once connectivity returns.&lt;/p&gt;

&lt;p&gt;This provides a level of resilience that cloud-only solutions often cannot achieve.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flbdy4z2klvrhhal86utc.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flbdy4z2klvrhhal86utc.jpg" alt=" " width="799" height="322"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Pi4J: Bringing Java to the Physical World
&lt;/h2&gt;

&lt;p&gt;One of the key technologies that makes Java on Raspberry Pi so powerful is Pi4J.&lt;/p&gt;

&lt;p&gt;Pi4J is an open-source library that provides a bridge between Java applications and Raspberry Pi hardware.&lt;/p&gt;

&lt;p&gt;Without Pi4J, interacting with GPIO pins, sensors, LEDs, buttons, relays, and other hardware components would require significantly more low-level programming.&lt;/p&gt;

&lt;p&gt;Pi4J allows Java developers to work with hardware using familiar Java APIs.&lt;/p&gt;

&lt;p&gt;For example, a Java application can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Turn LEDs on and off&lt;/li&gt;
&lt;li&gt;Read button presses&lt;/li&gt;
&lt;li&gt;Collect data from sensors&lt;/li&gt;
&lt;li&gt;Control motors&lt;/li&gt;
&lt;li&gt;Interact with displays&lt;/li&gt;
&lt;li&gt;Communicate with external electronic devices&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All while using standard Java programming practices.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Pi4J Matters
&lt;/h2&gt;

&lt;p&gt;Pi4J is important because it removes one of the biggest barriers to hardware development: complexity.&lt;/p&gt;

&lt;p&gt;Java developers can focus on solving problems and building applications rather than learning low-level hardware interfaces from scratch.&lt;/p&gt;

&lt;p&gt;Pi4J brings several advantages:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Familiar Development Experience&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Developers can continue using:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;IntelliJ IDEA&lt;/li&gt;
&lt;li&gt;Maven&lt;/li&gt;
&lt;li&gt;Gradle&lt;/li&gt;
&lt;li&gt;JUnit&lt;/li&gt;
&lt;li&gt;Spring Boot&lt;/li&gt;
&lt;li&gt;Modern Java features&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;while interacting with physical hardware.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Strong Abstraction Layer&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Pi4J hides much of the complexity of GPIO access and hardware communication behind well-designed Java APIs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Hardware Meets Software Engineering&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Many hardware projects start as simple prototypes but eventually grow into larger systems.&lt;/p&gt;

&lt;p&gt;Java's strengths in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Architecture&lt;/li&gt;
&lt;li&gt;Testing&lt;/li&gt;
&lt;li&gt;Maintainability&lt;/li&gt;
&lt;li&gt;Scalability&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;allow developers to build projects that can evolve from hobby experiments into production-grade solutions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding Pi4J: The Bridge Between Java and Raspberry Pi Hardware
&lt;/h2&gt;

&lt;p&gt;At its core, Pi4J acts as a bridge between Java applications and the physical hardware available on a Raspberry Pi.&lt;/p&gt;

&lt;p&gt;The Raspberry Pi exposes several hardware interfaces such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;GPIO (General Purpose Input/Output)&lt;/li&gt;
&lt;li&gt;I²C&lt;/li&gt;
&lt;li&gt;SPI&lt;/li&gt;
&lt;li&gt;PWM&lt;/li&gt;
&lt;li&gt;UART/Serial&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These interfaces are how sensors, LEDs, displays, motors, and other electronic components communicate with the board.&lt;/p&gt;

&lt;p&gt;Accessing these interfaces directly from Java would require dealing with low-level Linux APIs, native libraries, memory management, and hardware-specific details. Pi4J abstracts this complexity and provides a modern object-oriented API that feels natural to Java developers.&lt;/p&gt;

&lt;h2&gt;
  
  
  How Pi4J Works
&lt;/h2&gt;

&lt;p&gt;The architecture is surprisingly elegant.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="err"&gt;┌────────────────────┐&lt;/span&gt;
&lt;span class="err"&gt;│&lt;/span&gt;   &lt;span class="nc"&gt;Java&lt;/span&gt; &lt;span class="nc"&gt;Application&lt;/span&gt; &lt;span class="err"&gt;│&lt;/span&gt;
&lt;span class="err"&gt;└──────────┬─────────┘&lt;/span&gt;
           &lt;span class="err"&gt;│&lt;/span&gt;
           &lt;span class="err"&gt;▼&lt;/span&gt;
&lt;span class="err"&gt;┌────────────────────┐&lt;/span&gt;
&lt;span class="err"&gt;│&lt;/span&gt;       &lt;span class="nc"&gt;Pi4J&lt;/span&gt; &lt;span class="no"&gt;API&lt;/span&gt;     &lt;span class="err"&gt;│&lt;/span&gt;
&lt;span class="err"&gt;└──────────┬─────────┘&lt;/span&gt;
           &lt;span class="err"&gt;│&lt;/span&gt;
           &lt;span class="err"&gt;▼&lt;/span&gt;
&lt;span class="err"&gt;┌────────────────────┐&lt;/span&gt;
&lt;span class="err"&gt;│&lt;/span&gt; &lt;span class="nc"&gt;Pi4J&lt;/span&gt; &lt;span class="nc"&gt;Providers&lt;/span&gt;     &lt;span class="err"&gt;│&lt;/span&gt;
&lt;span class="err"&gt;│&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="no"&gt;FFM&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;LinuxFS&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;etc&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="err"&gt;│&lt;/span&gt;
&lt;span class="err"&gt;└──────────┬─────────┘&lt;/span&gt;
           &lt;span class="err"&gt;│&lt;/span&gt;
           &lt;span class="err"&gt;▼&lt;/span&gt;
&lt;span class="err"&gt;┌────────────────────┐&lt;/span&gt;
&lt;span class="err"&gt;│&lt;/span&gt; &lt;span class="nc"&gt;Linux&lt;/span&gt; &lt;span class="nc"&gt;Kernel&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="no"&gt;GPIO&lt;/span&gt;&lt;span class="err"&gt;│&lt;/span&gt;
&lt;span class="err"&gt;└──────────┬─────────┘&lt;/span&gt;
           &lt;span class="err"&gt;│&lt;/span&gt;
           &lt;span class="err"&gt;▼&lt;/span&gt;
&lt;span class="err"&gt;┌────────────────────┐&lt;/span&gt;
&lt;span class="err"&gt;│&lt;/span&gt; &lt;span class="nc"&gt;Physical&lt;/span&gt; &lt;span class="nc"&gt;Hardware&lt;/span&gt;  &lt;span class="err"&gt;│&lt;/span&gt;
&lt;span class="err"&gt;└────────────────────┘&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When your Java code changes the state of a GPIO pin, Pi4J translates that request through one of its providers and ultimately interacts with the Linux subsystem controlling the Raspberry Pi hardware. Pi4J supports multiple providers and I/O types, including GPIO, I²C, SPI, PWM, and Serial communication.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Pi4J Context
&lt;/h2&gt;

&lt;p&gt;One of the key concepts in modern Pi4J is the Context.&lt;/p&gt;

&lt;p&gt;Think of it as the runtime environment responsible for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Managing hardware resources.&lt;/li&gt;
&lt;li&gt;Loading providers.&lt;/li&gt;
&lt;li&gt;Creating I/O instances.&lt;/li&gt;
&lt;li&gt;Cleaning up resources during shutdown.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Most applications start by creating a context:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;pi4j&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Pi4J&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;newAutoContext&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The framework automatically detects the available hardware and loads the appropriate providers. &lt;/p&gt;

&lt;h2&gt;
  
  
  Learning Through Real-World Projects
&lt;/h2&gt;

&lt;p&gt;One of the biggest challenges when learning software development is making concepts feel tangible.&lt;/p&gt;

&lt;p&gt;Many tutorials focus on console applications that print text to the screen.&lt;/p&gt;

&lt;p&gt;While useful, they often fail to demonstrate how software interacts with the real world.&lt;/p&gt;

&lt;p&gt;With Raspberry Pi and Java, developers can build projects such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Smart home systems&lt;/li&gt;
&lt;li&gt;Weather stations&lt;/li&gt;
&lt;li&gt;Greenhouse monitoring&lt;/li&gt;
&lt;li&gt;Security systems&lt;/li&gt;
&lt;li&gt;IoT gateways&lt;/li&gt;
&lt;li&gt;Robotics controllers&lt;/li&gt;
&lt;li&gt;Energy monitoring platforms&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Seeing software produce a physical outcome creates a much stronger learning experience.&lt;/p&gt;

&lt;h2&gt;
  
  
  Java in Education
&lt;/h2&gt;

&lt;p&gt;Java has long been one of the most important programming languages in education.&lt;/p&gt;

&lt;p&gt;Many universities teach Java because it introduces students to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Object-oriented programming&lt;/li&gt;
&lt;li&gt;Software design principles&lt;/li&gt;
&lt;li&gt;Data structures&lt;/li&gt;
&lt;li&gt;Algorithms&lt;/li&gt;
&lt;li&gt;Concurrent programming&lt;/li&gt;
&lt;li&gt;Large-scale application development&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Adding Raspberry Pi to the equation makes Java education even more engaging.&lt;/p&gt;

&lt;p&gt;Students can learn programming concepts while simultaneously exploring:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Electronics&lt;/li&gt;
&lt;li&gt;Sensors&lt;/li&gt;
&lt;li&gt;Networking&lt;/li&gt;
&lt;li&gt;Linux&lt;/li&gt;
&lt;li&gt;IoT&lt;/li&gt;
&lt;li&gt;Distributed systems&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Instead of building abstract examples, students can create projects that interact with the physical world.&lt;/p&gt;

&lt;p&gt;For educators, this creates opportunities for multidisciplinary learning that combines software engineering with engineering, science, and technology education.&lt;/p&gt;

&lt;p&gt;A simple Java program that reads a sensor or controls an LED can often spark more curiosity than a traditional classroom exercise.&lt;/p&gt;

&lt;h2&gt;
  
  
  Your Personal Learning Lab
&lt;/h2&gt;

&lt;p&gt;Not everyone has access to enterprise environments or expensive infrastructure.&lt;/p&gt;

&lt;p&gt;A Raspberry Pi provides:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A real Linux environment&lt;/li&gt;
&lt;li&gt;Low power consumption&lt;/li&gt;
&lt;li&gt;Low hardware costs&lt;/li&gt;
&lt;li&gt;24/7 availability&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It can become a personal lab for learning:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Modern Java&lt;/li&gt;
&lt;li&gt;Spring Boot&lt;/li&gt;
&lt;li&gt;Quarkus&lt;/li&gt;
&lt;li&gt;Docker&lt;/li&gt;
&lt;li&gt;MQTT&lt;/li&gt;
&lt;li&gt;Databases&lt;/li&gt;
&lt;li&gt;Monitoring and observability&lt;/li&gt;
&lt;li&gt;Edge computing&lt;/li&gt;
&lt;li&gt;IoT architectures&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All from a device that fits in your hand.&lt;/p&gt;

&lt;h2&gt;
  
  
  Java Can Be Fun
&lt;/h2&gt;

&lt;p&gt;Perhaps the most overlooked aspect of Java is that it can be fun.&lt;/p&gt;

&lt;p&gt;The language is often associated with serious business applications, but there is something uniquely rewarding about writing Java code and seeing a physical device respond.&lt;/p&gt;

&lt;p&gt;A few lines of code can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Turn on a light&lt;/li&gt;
&lt;li&gt;Move a motor&lt;/li&gt;
&lt;li&gt;Read environmental data&lt;/li&gt;
&lt;li&gt;Trigger an alarm&lt;/li&gt;
&lt;li&gt;Control a robot&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Suddenly, Java is no longer just running in a server rack somewhere—it is interacting with the real world.&lt;/p&gt;

&lt;p&gt;And that changes how many developers see the platform.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Java's enterprise roots are a strength, but they do not define its limits.&lt;/p&gt;

&lt;p&gt;Running Java on a Raspberry Pi demonstrates how versatile the platform has become. It can power edge computing solutions, reduce cloud costs, provide resilience during outages, serve as an educational platform, and enable exciting hardware projects through libraries like Pi4J.&lt;/p&gt;

&lt;p&gt;Most importantly, it reminds us that Java is not only about enterprise systems.&lt;/p&gt;

&lt;p&gt;It is also about exploration, experimentation, learning, and building things that interact with the world around us.&lt;/p&gt;

&lt;p&gt;Whether you are a student, educator, hobbyist, IoT enthusiast, or experienced software engineer, a Raspberry Pi can help you discover a side of Java that is practical, modern, and surprisingly fun.&lt;/p&gt;

&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://pimylifeup.com/raspberry-pi-java/" rel="noopener noreferrer"&gt;https://pimylifeup.com/raspberry-pi-java/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://raspberrytips.com/java-coding-on-raspberry-pi/" rel="noopener noreferrer"&gt;https://raspberrytips.com/java-coding-on-raspberry-pi/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>iot</category>
      <category>java</category>
      <category>learning</category>
      <category>programming</category>
    </item>
    <item>
      <title>What is a Raspberry Pi HAT?</title>
      <dc:creator>IgorIOT</dc:creator>
      <pubDate>Sun, 31 May 2026 11:18:18 +0000</pubDate>
      <link>https://dev.to/igoriot/what-is-a-raspberry-pi-hat-1c8d</link>
      <guid>https://dev.to/igoriot/what-is-a-raspberry-pi-hat-1c8d</guid>
      <description>&lt;p&gt;&lt;em&gt;How’s the lad?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Thanks to their GPIO headers, most Pi computers can connect to devices called HATs, which stands for Hardware Attached on Top. HATs are incredible add-ons to the Raspberry Pi that increase its functionality in a huge number of ways.&lt;/p&gt;

&lt;p&gt;In short, it’s an additional card that you plug into your Raspberry Pi to bring new features. Generally, it uses the GPIO ports to connect the two cards together. The Raspberry Pi recognizes the HAT thanks to an EEPROM module on the board that identifies the HAT model.&lt;br&gt;
The Raspberry Pi is an awesome platform for learning and experimentation. We can learn to code, build robots, monitor the location of the International Space Station, and so much more. But to make the most of the Pi, it helps to have the right HAT. There are hundreds of extensions that you can find for your Raspberry and there are several manufacturers for these Hats.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is the HAT Specification?
&lt;/h2&gt;

&lt;p&gt;The HAT (Hardware Attached on Top) specification was introduced by the Raspberry Pi Foundation in 2014 alongside the Raspberry Pi Model B+. Its goal was to create a standard for expansion boards, ensuring that accessories from different manufacturers would work consistently across Raspberry Pi models.&lt;br&gt;
Before the specification existed, expansion boards often required manual configuration and users had to determine which GPIO pins were being used. The HAT standard simplified this process and improved interoperability.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4s90hk7cft52ya2c9xsh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4s90hk7cft52ya2c9xsh.png" alt=" " width="500" height="366"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Picture 1: Raspberry Pi Hat&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Compatibility and standard
&lt;/h2&gt;

&lt;p&gt;HATs follow an official specification defined by the Raspberry Pi Foundation, which includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A fixed GPIO pin layout&lt;/li&gt;
&lt;li&gt;An EEPROM chip for automatic identification&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This allows many HATs to work in a true “plug and play” manner.&lt;/p&gt;

&lt;p&gt;The EEPROM stores information such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Manufacturer name&lt;/li&gt;
&lt;li&gt;Product name&lt;/li&gt;
&lt;li&gt;Product version&lt;/li&gt;
&lt;li&gt;GPIO configuration&lt;/li&gt;
&lt;li&gt;Device Tree overlays&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When the Raspberry Pi boots, it can read this information and automatically configure the hardware.&lt;/p&gt;

&lt;p&gt;This enables a much more plug-and-play experience compared to generic GPIO add-ons.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkc20t4xj4u8sl6n7da81.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkc20t4xj4u8sl6n7da81.gif" alt=" " width="800" height="640"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Picture 2: Place the hat on the GPIO pins&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Standardized Physical Design
&lt;/h2&gt;

&lt;p&gt;The specification defines:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The location of the 40-pin GPIO connector&lt;/li&gt;
&lt;li&gt;Board dimensions&lt;/li&gt;
&lt;li&gt;Mounting hole positions&lt;/li&gt;
&lt;li&gt;Mechanical clearances&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This ensures that HATs fit correctly on compatible Raspberry Pi models.&lt;/p&gt;

&lt;h2&gt;
  
  
  Hat VS pHat
&lt;/h2&gt;

&lt;p&gt;In the ecosystem of the Raspberry Pi, the difference between a HAT (Hardware Attached on Top) and a pHAT (“partial HAT”) mainly comes down to size and compliance with the official standard. A HAT is a full-sized expansion board that follows the specifications defined by the Raspberry Pi Foundation, including the use of an EEPROM chip for automatic identification and configuration, ensuring plug-and-play compatibility. In contrast, a pHAT is a smaller, more compact board that still connects to the GPIO pins but does not necessarily follow all the official requirements—especially the EEPROM feature. While HATs are typically more standardized and robust for complex applications, pHATs are often simpler, cheaper, and ideal for lightweight or space-constrained projects.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg0v8kd2hrx6w878e5oje.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg0v8kd2hrx6w878e5oje.png" alt=" " width="392" height="594"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Picture 3: Hat formats&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  GPIO Usage Declaration
&lt;/h2&gt;

&lt;p&gt;A HAT should clearly declare which GPIO pins it uses.&lt;/p&gt;

&lt;p&gt;This helps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Prevent hardware conflicts&lt;/li&gt;
&lt;li&gt;Enable automatic configuration&lt;/li&gt;
&lt;li&gt;Improve compatibility with other add-ons&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Device Tree Integration
&lt;/h2&gt;

&lt;p&gt;Modern Raspberry Pi systems use Device Tree overlays to describe attached hardware.&lt;/p&gt;

&lt;p&gt;A compliant HAT can provide overlay information through its EEPROM, allowing the operating system to automatically load the correct drivers and configuration settings.&lt;/p&gt;

&lt;p&gt;For the user, this often means:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Attach the HAT.&lt;/li&gt;
&lt;li&gt;Boot the Raspberry Pi.&lt;/li&gt;
&lt;li&gt;Start using the hardware.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Without manually editing configuration files.&lt;/p&gt;

&lt;h2&gt;
  
  
  Power requirements
&lt;/h2&gt;

&lt;p&gt;Not all HATs use the same amount of power:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Some are powered directly by the Raspberry Pi&lt;/li&gt;
&lt;li&gt;Others require an external power supply (e.g., motor drivers or large displays)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Software and drivers
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Many HATs need specific libraries or drivers&lt;/li&gt;
&lt;li&gt;Some are auto-detected, while others require manual setup and configuration&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Difference between HATs and generic add-ons
&lt;/h2&gt;

&lt;p&gt;Not every board that fits on top is a true HAT:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A real HAT follows the official standard&lt;/li&gt;
&lt;li&gt;Other boards may be referred to as add-ons or expansion boards&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Physical limitations
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Stacking HATs can block access to ports or connectors&lt;/li&gt;
&lt;li&gt;Some projects use stacking headers to allow multiple boards to be used together&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Although multiple HATs can sometimes be stacked together using extended headers, conflicts may occur when two boards attempt to use the same GPIO pins, I²C addresses, SPI buses, or power resources. Always check the documentation before combining multiple expansion boards.&lt;/p&gt;

&lt;h2&gt;
  
  
  Interesting Fact
&lt;/h2&gt;

&lt;p&gt;The EEPROM does not contain the software driver itself. Instead, it stores metadata and configuration information that tells the Raspberry Pi which Device Tree overlay should be loaded and how the GPIO resources should be configured.&lt;/p&gt;

&lt;h2&gt;
  
  
  Manufacturer list
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;This is not an exhaustive list.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;4tronix&lt;br&gt;
Adafruit&lt;br&gt;
Pimoroni&lt;br&gt;
SparkFun&lt;br&gt;
The Pi Hut&lt;br&gt;
Waveshare&lt;/p&gt;

&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://pip-assets.raspberrypi.com/categories/1215-raspberry-pi-hat/documents/RP-008281-DS-1-hat-plus-specification.pdf" rel="noopener noreferrer"&gt;Raspberry Pi HAT+ Specification&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/raspberrypi/hats" rel="noopener noreferrer"&gt;Hats&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/raspberrypi/utils/tree/master/eeptools" rel="noopener noreferrer"&gt;eeptools&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://magpi.raspberrypi.org/articles/best-raspberry-pi-hats" rel="noopener noreferrer"&gt;The 10 best Raspberry Pi HATs&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://pinout.xyz" rel="noopener noreferrer"&gt;pinout&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Remember to use the hashtag #JavaOnRaspberryPi on Twitter to show the world Raspberry Pi with Java.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>iot</category>
      <category>learning</category>
    </item>
    <item>
      <title>Pi Lightsaber Lab</title>
      <dc:creator>IgorIOT</dc:creator>
      <pubDate>Sun, 10 May 2026 21:27:41 +0000</pubDate>
      <link>https://dev.to/igoriot/pi-lightsaber-lab-3oba</link>
      <guid>https://dev.to/igoriot/pi-lightsaber-lab-3oba</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmbztdaq6wj0svun8rfoo.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmbztdaq6wj0svun8rfoo.jpg" alt=" " width="784" height="1168"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What’s the crack jack?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Build your own Lightsaber with Raspberry Pi and Java. May the Force (and GPIO) be with you!&lt;/p&gt;

&lt;p&gt;A fun Star Wars-inspired project using a bright LED and a transparent straw to simulate a real lightsaber. It also features a blaster shot mode. Fully controlled with Java on a Raspberry Pi.&lt;/p&gt;

&lt;p&gt;This blog is an example of how a single simple LED and a bit of creativity can be used to build fun and interesting projects. Beyond the visual effects, these experiments are a great way to introduce basic programming, electronics, and even physics concepts in a playful and engaging way. Projects like this are perfect for educational activities with children, helping them learn through hands-on experience while exploring light, circuits, coding, and creativity at the same time. Happy Start Wars week.&lt;/p&gt;

&lt;p&gt;A long time ago, in a workshop not so far away, a simple LED became the beginning of an intergalactic experiment. With a Raspberry Pi, a few lines of Java code, and a bit of imagination, ordinary electronic components can be transformed into glowing sci-fi creations inspired by the worlds of space adventures and futuristic technology. Welcome to Pi Lightsaber Lab, a place where coding, electronics, creativity, and learning come together to bring light into the galaxy.&lt;/p&gt;

&lt;h2&gt;
  
  
  Materials:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Raspberry Pi (any model)&lt;/li&gt;
&lt;li&gt;Bright LED (preferably strong green or red)&lt;/li&gt;
&lt;li&gt;Large transparent straw (milkshake size or acrylic tube for light diffusion)&lt;/li&gt;
&lt;li&gt;220Ω or 330Ω resistor&lt;/li&gt;
&lt;li&gt;Jumper wires and breadboard (optional)&lt;/li&gt;
&lt;li&gt;Black tape (optional)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  LEDs
&lt;/h2&gt;

&lt;p&gt;3mm and 5mm LEDs are among the most common types used in electronics projects. The numbers refer to the diameter of the LED casing. A 3mm LED is smaller and works well in compact projects or when space is limited, while a 5mm LED is larger, brighter, and easier to notice from a distance. Because of their size and higher light output, 5mm LEDs are often preferred for visual effects, indicators, and beginner-friendly Arduino experiments. Both types work similarly electrically and can be controlled in the same way using Arduino digital or PWM pins. For this example, I used a 5mm LED.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyh98wgrrd0oay4zboq0k.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyh98wgrrd0oay4zboq0k.jpg" alt=" " width="723" height="686"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Frosted vs clear LEDs
&lt;/h2&gt;

&lt;p&gt;LEDs are available in both frosted (diffused) and clear versions, and each type produces a different lighting effect. Clear LEDs focus the light in a narrow and intense beam, making them brighter in a specific direction. Frosted LEDs, on the other hand, spread the light more evenly, creating a softer and more uniform glow. For projects such as light blades, ambient effects, or decorative lighting, frosted LEDs are often preferred because they help distribute the light smoothly through transparent materials like acrylic tubes or plastic straws.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fppq1aykdv2ovkntewtoo.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fppq1aykdv2ovkntewtoo.jpg" alt=" " width="800" height="380"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the image above, the top LED is a frosted LED, while the bottom one is a clear LED. The difference between them becomes more noticeable when using the green color, as the frosted LED spreads the light more evenly and creates a softer glow. With the red color, the distinction is less visible because red light naturally diffuses differently and appears softer even in clear LEDs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Hardware Assembly:
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Connect the LED: Long leg (+) to a GPIO pin (e.g., GPIO 17), short leg (-) to GND through the resistor.&lt;/li&gt;
&lt;li&gt;Insert the LED into the bottom of the transparent straw. The straw works great as a light diffuser, creating a nice "blade" effect.&lt;/li&gt;
&lt;li&gt;Wrap the base with black tape to simulate the hilt.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Project Modes:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Lightsaber Mode&lt;/strong&gt;: Steady glow with subtle flicker.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Blaster Mode&lt;/strong&gt;: Rapid bright flashes simulating starship laser fire.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Lightsaber&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frc3faua0or08c9vmlyfh.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frc3faua0or08c9vmlyfh.jpg" alt=" " width="662" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I zoomed in on the photo to enhance the lighting effect, which creates a visual appearance similar to Kylo Ren’s lightsaber from Star Wars. The intense glow and the light diffusion around the blade help produce a more cinematic and dramatic sci-fi look.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Funn1a40q78gcrekq1mba.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Funn1a40q78gcrekq1mba.jpg" alt=" " width="780" height="473"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Blaster&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqk31icz8dbdqgiijx3qy.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqk31icz8dbdqgiijx3qy.jpg" alt=" " width="800" height="421"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Java Code with Pi4J
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;com.pi4j.Pi4J&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;com.pi4j.io.gpio.digital.DigitalOutput&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;com.pi4j.io.gpio.digital.DigitalState&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;java.util.concurrent.TimeUnit&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;PiLightsaber&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;

    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="kd"&gt;throws&lt;/span&gt; &lt;span class="nc"&gt;Exception&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;pi4j&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Pi4J&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;newAutoContext&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;

        &lt;span class="c1"&gt;// GPIO 17 (BCM)&lt;/span&gt;
        &lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;ledConfig&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;DigitalOutput&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;newConfigBuilder&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pi4j&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
                &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"lightsaber-led"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
                &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Lightsaber LED"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
                &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;address&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;17&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
                &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;shutdown&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;DigitalState&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;LOW&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
                &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;initial&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;DigitalState&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;LOW&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
                &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;provider&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"pigpio-digital-output"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

        &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;led&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pi4j&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;create&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ledConfig&lt;/span&gt;&lt;span class="o"&gt;))&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;" Pi Lightsaber Lab Activated! May the Force be with you."&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

            &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
                &lt;span class="n"&gt;lightsaberMode&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;led&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

                &lt;span class="c1"&gt;// Random chance to fire blaster shots&lt;/span&gt;
                &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Math&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;random&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mf"&gt;0.65&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
                    &lt;span class="n"&gt;blasterShot&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;led&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
                &lt;span class="o"&gt;}&lt;/span&gt;

                &lt;span class="nc"&gt;TimeUnit&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;MILLISECONDS&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;sleep&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;80&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
            &lt;span class="o"&gt;}&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;lightsaberMode&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;DigitalOutput&lt;/span&gt; &lt;span class="n"&gt;led&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="kd"&gt;throws&lt;/span&gt; &lt;span class="nc"&gt;InterruptedException&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;led&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;high&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
        &lt;span class="nc"&gt;TimeUnit&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;MILLISECONDS&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;sleep&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;40&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="o"&gt;)(&lt;/span&gt;&lt;span class="nc"&gt;Math&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;random&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;40&lt;/span&gt;&lt;span class="o"&gt;));&lt;/span&gt; &lt;span class="c1"&gt;// subtle flicker&lt;/span&gt;
        &lt;span class="n"&gt;led&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;low&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
        &lt;span class="nc"&gt;TimeUnit&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;MILLISECONDS&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;sleep&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;blasterShot&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;DigitalOutput&lt;/span&gt; &lt;span class="n"&gt;led&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="kd"&gt;throws&lt;/span&gt; &lt;span class="nc"&gt;InterruptedException&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;" Pew! Pew! Blaster shot fired!"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;led&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;high&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
            &lt;span class="nc"&gt;TimeUnit&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;MILLISECONDS&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;sleep&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;35&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
            &lt;span class="n"&gt;led&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;low&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
            &lt;span class="nc"&gt;TimeUnit&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;MILLISECONDS&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;sleep&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;25&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;May your code shine as bright as a lightsaber, and may your creativity travel farther than the stars. Every great maker's journey begins with a single spark, sometimes just one LED, a few lines of code, and the curiosity to build something amazing. Keep experimenting, keep learning, and remember: the force of innovation is always with those who dare to create.&lt;/p&gt;

&lt;p&gt;The original idea for this project was not mine. A long time ago, I saw a similar concept on Twitter, and it stayed in my mind as a fun and creative way to combine electronics, light effects, and education. This project is my own interpretation and experiment inspired by that idea. Full credit and inspiration go to &lt;a href="https://www.browndoggadgets.com/" rel="noopener noreferrer"&gt;Brown Dog Gadgets&lt;/a&gt; and their amazing educational maker projects.&lt;/p&gt;

</description>
      <category>iot</category>
      <category>java</category>
      <category>showdev</category>
      <category>sideprojects</category>
    </item>
    <item>
      <title>What is a Raspberry Pi? A Complete Beginner’s Guide</title>
      <dc:creator>IgorIOT</dc:creator>
      <pubDate>Fri, 24 Apr 2026 14:25:46 +0000</pubDate>
      <link>https://dev.to/igoriot/what-is-a-raspberry-pi-a-complete-beginners-guide-67b</link>
      <guid>https://dev.to/igoriot/what-is-a-raspberry-pi-a-complete-beginners-guide-67b</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faqlncfeibvft38jmw23d.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faqlncfeibvft38jmw23d.jpg" alt=" " width="755" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How’s the craic?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you’ve ever heard the term Raspberry Pi and wondered what it actually is, you’re not alone.&lt;/p&gt;

&lt;p&gt;Despite the playful name, the Raspberry Pi is a serious piece of technology that has changed how people learn programming, build hardware projects, and explore computing.&lt;/p&gt;

&lt;p&gt;I remember the first time I heard the term Raspberry Pi.&lt;/p&gt;

&lt;p&gt;I thought it was  some weird AI gadget or maybe a tiny Arduino clone and turns out… it’s none of those.&lt;/p&gt;

&lt;p&gt;In this guide, you’ll learn what a Raspberry Pi is, how it works, and what you can do with it, even if you’re a complete beginner.&lt;/p&gt;

&lt;h2&gt;
  
  
  🧠 What is a Raspberry Pi?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fly3t0ltjhjyc9cfjdkgr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fly3t0ltjhjyc9cfjdkgr.png" alt=" " width="800" height="423"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A Raspberry Pi is a small, affordable, single-board computer designed to help people learn programming and build digital projects.&lt;/p&gt;

&lt;p&gt;It is roughly the size of a credit card but works like a full computer.&lt;/p&gt;

&lt;p&gt;You can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Connect it to a monitor and keyboard&lt;/li&gt;
&lt;li&gt;Install an operating system (usually Linux-based)&lt;/li&gt;
&lt;li&gt;Run software like a normal PC&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;👉 In simple terms:&lt;/p&gt;

&lt;p&gt;A Raspberry Pi is a tiny computer you can program, modify, and use for electronics projects.&lt;/p&gt;

&lt;h2&gt;
  
  
  💥 The moment it clicked for me
&lt;/h2&gt;

&lt;p&gt;The first time I powered one on, I expected something limited.&lt;br&gt;
Instead, I got:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a full desktop environment&lt;/li&gt;
&lt;li&gt;a terminal&lt;/li&gt;
&lt;li&gt;Wi-Fi connectivity&lt;/li&gt;
&lt;li&gt;and the ability to SSH into it like a server&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And suddenly I realized:&lt;/p&gt;

&lt;p&gt;“This isn’t just hardware. This is a playground for engineers.”&lt;/p&gt;

&lt;h2&gt;
  
  
  ⚙️ How Does a Raspberry Pi Work?
&lt;/h2&gt;

&lt;p&gt;A Raspberry Pi includes all the basic components of a computer:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;CPU (processor)&lt;/li&gt;
&lt;li&gt;RAM (memory)&lt;/li&gt;
&lt;li&gt;USB ports&lt;/li&gt;
&lt;li&gt;HDMI output&lt;/li&gt;
&lt;li&gt;Wi-Fi / Bluetooth (on most models)&lt;/li&gt;
&lt;li&gt;Storage via microSD card&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Instead of a traditional hard drive, the Raspberry Pi runs its operating system from a microSD card.&lt;/p&gt;

&lt;p&gt;Most users install:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Raspberry Pi OS (official system)&lt;/li&gt;
&lt;li&gt;Or other Linux distributions&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🔌 What is GPIO on Raspberry Pi?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhwt1gtzhw1b1nexupi2c.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhwt1gtzhw1b1nexupi2c.jpg" alt=" " width="800" height="463"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;One of the most powerful features of the Raspberry Pi is its GPIO pins (General Purpose Input/Output).&lt;/p&gt;

&lt;p&gt;These pins allow you to connect:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;LEDs&lt;/li&gt;
&lt;li&gt;Sensors&lt;/li&gt;
&lt;li&gt;Motors&lt;/li&gt;
&lt;li&gt;Buttons&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;👉 This is what makes Raspberry Pi popular for IoT and electronics projects.&lt;/p&gt;

&lt;p&gt;Unlike a normal computer, you can directly interact with physical hardware.&lt;/p&gt;

&lt;h2&gt;
  
  
  🚀 What Can You Do with a Raspberry Pi?
&lt;/h2&gt;

&lt;p&gt;This is where things get exciting.&lt;/p&gt;

&lt;p&gt;A Raspberry Pi can be used for hundreds of projects. Here are the most popular ones:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;🏠 Smart Home Projects&lt;/li&gt;
&lt;li&gt;📺 Media Center&lt;/li&gt;
&lt;li&gt;🌡️ IoT and Sensors&lt;/li&gt;
&lt;li&gt;📷 Security Systems&lt;/li&gt;
&lt;li&gt;💡 Learning Platform&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🧪 Popular Raspberry Pi Models
&lt;/h2&gt;

&lt;p&gt;There are several &lt;a href="https://raspberrytips.com/raspberry-pi-models/" rel="noopener noreferrer"&gt;versions&lt;/a&gt; of Raspberry Pi, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Raspberry Pi 4 – widely used and powerful&lt;/li&gt;
&lt;li&gt;Raspberry Pi 5 – latest generation with better performance&lt;/li&gt;
&lt;li&gt;Raspberry Pi Zero – ultra-small and low cost&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each model is suited for different levels of projects.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk1p2q7efcckntbnp84ci.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk1p2q7efcckntbnp84ci.png" alt=" " width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  🧑‍💻 Who Should Use Raspberry Pi?
&lt;/h2&gt;

&lt;p&gt;Raspberry Pi is perfect for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Beginners learning programming&lt;/li&gt;
&lt;li&gt;Students exploring computer science&lt;/li&gt;
&lt;li&gt;Engineers building IoT systems&lt;/li&gt;
&lt;li&gt;Hobbyists creating DIY electronics projects&lt;/li&gt;
&lt;li&gt;Developers experimenting with backend + hardware integration&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  ⚡ Why Raspberry Pi is So Popular
&lt;/h2&gt;

&lt;p&gt;Raspberry Pi has become extremely popular because:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It is very affordable (often under $100)&lt;/li&gt;
&lt;li&gt;It has a huge global community&lt;/li&gt;
&lt;li&gt;It supports many programming languages&lt;/li&gt;
&lt;li&gt;It combines software + hardware learning&lt;/li&gt;
&lt;li&gt;It is perfect for real-world experimentation&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🔥 First Project You Should Try
&lt;/h2&gt;

&lt;p&gt;If you're starting out, here are simple beginner projects:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Blink an LED using GPIO pins&lt;/li&gt;
&lt;li&gt;Build a simple web server&lt;/li&gt;
&lt;li&gt;Create a temperature sensor system&lt;/li&gt;
&lt;li&gt;Run a basic chatbot or script&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These projects help you understand both software and hardware fundamentals.&lt;/p&gt;

&lt;h2&gt;
  
  
  🏛️ Raspberry Pi Foundation (and what it actually does)
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3bd9mv8hc69uv5cwpci1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3bd9mv8hc69uv5cwpci1.png" alt=" " width="409" height="123"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Another common confusion is thinking that the Raspberry Pi Foundation builds only the Raspberry Pi hardware itself. While they are the creators of the Raspberry Pi, their mission goes far beyond manufacturing devices.&lt;/p&gt;

&lt;p&gt;The Raspberry Pi Foundation is a UK-based educational charity focused on improving access to computer science education worldwide. Their goal is to help people learn programming, digital skills, and computational thinking — especially students and beginners.&lt;/p&gt;

&lt;p&gt;👉 In other words:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The Foundation = education + open-source learning mission&lt;/li&gt;
&lt;li&gt;Raspberry Pi = one of the tools they created to support that mission&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So while they are closely related, the Foundation is not “just a hardware company” — it is primarily an education-driven organization.&lt;/p&gt;

&lt;h2&gt;
  
  
  Raspberry Jam community
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm0tem58mz31d6grt9ej4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm0tem58mz31d6grt9ej4.png" alt=" " width="582" height="402"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Raspberry Pi jams are social events held all over the world where people who are interested in Raspberry Pi come together to share their knowledge, learn new things, and meet other Pi enthusiasts. These events are generally attended by teachers, students, enthusiasts, developers, and hobbyists, and are organized either in person or by different organizations. However, I believe the initiative has become somewhat less active or has slowed down in recent years, with fewer events and less visibility compared to its earlier momentum.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.raspberrypi.org/blog/support-raspberry-jam-community/" rel="noopener noreferrer"&gt;Supporting and growing the Raspberry Jam community&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A very funny incident that happened to me.&lt;br&gt;
On the day I went to get my second COVID vaccine here in Dublin, the nurse noticed I was wearing a Raspberry Jam t-shirt. She didn’t really understand the reference and said, “Nice shirt—so is that your favorite jam?”&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7ttkibr7c3rvk6zqsbem.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7ttkibr7c3rvk6zqsbem.png" alt=" " width="800" height="504"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  ⚙️ Microcomputer vs Microcontroller (and why Raspberry Pi is NOT an Arduino)
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F28jzxomr4f93orzpq0rz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F28jzxomr4f93orzpq0rz.png" alt=" " width="800" height="384"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;One of the most common misconceptions is comparing Raspberry Pi to Arduino.&lt;/p&gt;

&lt;p&gt;They are actually very different things.&lt;/p&gt;

&lt;p&gt;A Raspberry Pi is a microcomputer, meaning it is essentially a full Linux-based computer. It has a CPU, RAM, storage (via microSD), and can run an operating system, multitask, and execute complex software like databases, web servers, and backend applications.&lt;/p&gt;

&lt;p&gt;An Arduino, on the other hand, is a microcontroller. It is designed for very specific, low-level tasks like reading sensors, controlling motors, or blinking LEDs. It does not run an operating system and executes a single program in a loop.&lt;/p&gt;

&lt;p&gt;👉 Simple way to think about it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Raspberry Pi = a small PC&lt;/li&gt;
&lt;li&gt;Arduino = a programmable electronic chip for hardware control&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This difference is important because Raspberry Pi sits between traditional software engineering and hardware, while Arduino is focused purely on embedded electronics.&lt;/p&gt;

&lt;p&gt;👉 In practice, Raspberry Pi is often used for high-level logic, while microcontrollers like Arduino handle real-time hardware control.&lt;/p&gt;

&lt;h2&gt;
  
  
  Raspberry Pi Pico (the microcontroller side of the ecosystem)
&lt;/h2&gt;

&lt;p&gt;Interestingly, the Raspberry Pi ecosystem also includes a completely different type of device: the Raspberry Pi Pico.&lt;/p&gt;

&lt;p&gt;Unlike the standard Raspberry Pi, the Pico is a microcontroller, not a microcomputer.&lt;/p&gt;

&lt;p&gt;It is based on the RP2040 chip and is designed for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;low-level hardware control&lt;/li&gt;
&lt;li&gt;real-time embedded systems&lt;/li&gt;
&lt;li&gt;ultra low-power applications&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;👉 Key difference:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Raspberry Pi (classic models) = microcomputer (runs Linux, multitasking)&lt;/li&gt;
&lt;li&gt;Raspberry Pi Pico = microcontroller (runs a single embedded program)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This means the Pico is actually much closer to an Arduino or ESP32 than it is to a traditional Raspberry Pi.&lt;/p&gt;

&lt;p&gt;So within the same ecosystem, you have:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Raspberry Pi → full computer for software + systems&lt;/li&gt;
&lt;li&gt;Raspberry Pi Pico → microcontroller for embedded hardware projects&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqdfvlmnddxf0fsl28jwj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqdfvlmnddxf0fsl28jwj.png" alt=" " width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  💸 A quick reality check: prices and controversies
&lt;/h2&gt;

&lt;p&gt;One important thing to mention is that Raspberry Pi is no longer as cheap as it used to be. In recent years, global memory (RAM) shortages and supply chain pressures have significantly increased component costs. As a result, many Raspberry Pi models have become noticeably more expensive than their original launch prices.&lt;/p&gt;

&lt;p&gt;👉 This means that while Raspberry Pi is still relatively affordable compared to traditional computers, it is no longer the ultra-low-cost device it once was. For some use cases, especially hobby projects, this price increase has pushed people to also consider alternatives like used mini PCs or other SBCs (single-board computers).&lt;/p&gt;

&lt;p&gt;Still, despite the price changes, Raspberry Pi remains extremely popular due to its ecosystem, community support, and versatility.&lt;/p&gt;

&lt;p&gt;During the COVID-19 pandemic, the project faced controversy due to a global shortage of silicon and electronic components, which significantly limited production and led to a prioritization of corporate and industrial clients over the hobbyist and educational community that had historically supported its growth. This decision sparked criticism, as many saw it as a shift away from the original mission of accessibility and the democratization of technology.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.howtogeek.com/the-raspberry-pis-15-year-reign-is-quietly-endingheres-why/" rel="noopener noreferrer"&gt;The Raspberry Pi's 15-year reign is quietly ending—here's why&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  🧠 Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Raspberry Pi is more than just a small computer.&lt;/p&gt;

&lt;p&gt;It is a powerful learning tool that bridges the gap between software development and hardware engineering.&lt;/p&gt;

&lt;p&gt;Whether you are a beginner or an experienced developer, Raspberry Pi gives you the freedom to experiment, build, and innovate.&lt;/p&gt;

&lt;p&gt;The Raspberry Pi isn’t impressive because of its specs. It’s impressive because it removes barriers. It says: “Here’s a full computer. Now go break things and learn.” And honestly? That’s how the best engineers are made.&lt;/p&gt;

&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://opensource.com/resources/raspberry-pi" rel="noopener noreferrer"&gt;https://opensource.com/resources/raspberry-pi&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://picockpit.com/raspberry-pi/what-is-a-raspberry-pi-and-what-can-i-do-with-it/" rel="noopener noreferrer"&gt;https://picockpit.com/raspberry-pi/what-is-a-raspberry-pi-and-what-can-i-do-with-it/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.nextpcb.com/blog/what-is-raspberry-pi-models-features-and-uses" rel="noopener noreferrer"&gt;https://www.nextpcb.com/blog/what-is-raspberry-pi-models-features-and-uses&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://all3dp.com/2/what-is-a-raspberry-pi/" rel="noopener noreferrer"&gt;https://all3dp.com/2/what-is-a-raspberry-pi/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.zdnet.com/article/what-is-the-raspberry-pi-4-everything-you-need-to-know-about-the-tiny-low-cost-computer/" rel="noopener noreferrer"&gt;https://www.zdnet.com/article/what-is-the-raspberry-pi-4-everything-you-need-to-know-about-the-tiny-low-cost-computer/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://nordvpn.com/blog/what-is-raspberry-pi/?srsltid=AfmBOoo3sr_06KYMWBUw2QZlvWUqCZ0ErgqPZgmqqS5XlIvRYVb_FBJt" rel="noopener noreferrer"&gt;https://nordvpn.com/blog/what-is-raspberry-pi/?srsltid=AfmBOoo3sr_06KYMWBUw2QZlvWUqCZ0ErgqPZgmqqS5XlIvRYVb_FBJt&lt;/a&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>iot</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Bringing Java Closer to Education: A Community-Driven Initiative</title>
      <dc:creator>IgorIOT</dc:creator>
      <pubDate>Wed, 22 Apr 2026 09:17:35 +0000</pubDate>
      <link>https://dev.to/igoriot/bringing-java-closer-to-education-a-community-driven-initiative-30hk</link>
      <guid>https://dev.to/igoriot/bringing-java-closer-to-education-a-community-driven-initiative-30hk</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc1wxahu339o5w82oiyt7.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc1wxahu339o5w82oiyt7.jpg" alt="AI-generated image depicting the role of Java in education 01" width="800" height="537"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Story Horse?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Java has long been one of the most powerful, stable, and widely-used programming languages in the world. Yet when it comes to education, especially for beginners, schools, and coding clubs, it has often been overlooked in favor of languages perceived as simpler or more modern.&lt;/p&gt;

&lt;p&gt;That’s changing now.&lt;/p&gt;

&lt;p&gt;A new community initiative called the &lt;strong&gt;Foojay Java in Education Catalog&lt;/strong&gt; is working to change perceptions and make high-quality Java learning resources much easier to find and use.&lt;/p&gt;

&lt;p&gt;The idea for this project was born from my own desire to give Java the recognition it deserves in the educational space. I started the Java Education Catalog initiative with the goal of creating a central hub for high-quality Java learning resources. Fortunately, the Foojay team loved the vision and fully embraced the idea, turning it into a true community-driven project with great visibility and support from the Java ecosystem.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdybwa24veps3opd9fv8a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdybwa24veps3opd9fv8a.png" alt="Foojay" width="800" height="254"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  One Place for All Java Learning Resources
&lt;/h2&gt;

&lt;p&gt;The initiative’s main goal is simple but powerful: bring together Java and education-related materials in one central, easy-to-access place.&lt;/p&gt;

&lt;p&gt;Instead of scattered tutorials, videos, books, and tools across the internet, the catalog creates a curated hub where students, teachers, coding club mentors, and self-learners can discover excellent Java educational content.&lt;/p&gt;

&lt;p&gt;You can explore the live catalog here:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://education.foojay.social/" rel="noopener noreferrer"&gt;https://education.foojay.social/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The project is fully open and community-driven. The GitHub repository that powers it is available at:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/foojayio/java-education-catalog" rel="noopener noreferrer"&gt;https://github.com/foojayio/java-education-catalog&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Everyone is invited to contribute great resources they know or create.&lt;/p&gt;

&lt;h2&gt;
  
  
  Challenging Outdated Perceptions
&lt;/h2&gt;

&lt;p&gt;At the same time, this initiative directly addresses some old myths about Java:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Java is no longer slow or overly verbose.&lt;/li&gt;
&lt;li&gt;Modern Java is clean, concise, productive, and genuinely enjoyable to write.&lt;/li&gt;
&lt;li&gt;It is an excellent language for learning programming fundamentals and object-oriented concepts properly.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The goal is to position Java as a strong, future-proof choice for beginners,  not just for enterprise, but for teaching core programming skills that last a lifetime.&lt;/p&gt;

&lt;h2&gt;
  
  
  Going Beyond the Catalog: Real-World Impact
&lt;/h2&gt;

&lt;p&gt;In parallel with building the catalog, there is active work to bring Java into physical computing and global coding clubs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Code Clubs and CoderDojo: Efforts are underway to introduce Java as a viable learning path in Code Clubs and CoderDojo communities worldwide. The aim is to make structured, high-quality Java materials naturally available to mentors and young learners.&lt;/li&gt;
&lt;li&gt;Raspberry Pi: In collaboration with the Pi4J team (the excellent Java library for Raspberry Pi), work is progressing to make the Java experience on the Raspberry Pi as smooth and beginner-friendly as Python. The vision is to lower the barriers so that running Java applications on physical hardware feels seamless.&lt;/li&gt;
&lt;li&gt;Astro Pi: The famous Astro Pi program currently sends only Python code to the International Space Station. I’m actively advocating for the inclusion of Java in this program. The dream? Soon we’ll be able to say that Java has been sent to space, and who knows, maybe even Jakarta EE running on the ISS one day.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why This Matters
&lt;/h2&gt;

&lt;p&gt;Java’s combination of readability, strong typing, vast ecosystem, and long-term stability makes it incredibly valuable for education. By making these resources visible and accessible, we can help more young people, and their teachers, discover the real power and joy of Java from the very beginning of their coding journey.&lt;/p&gt;

&lt;p&gt;This is not a top-down project. It belongs to the entire Java community. Whether you’re an educator, developer, content creator, or just someone who loves Java, your contributions are welcome and needed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fajvhdbukj9vbsluujz30.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fajvhdbukj9vbsluujz30.jpg" alt="AI-generated image depicting the role of Java in education 02" width="800" height="537"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Get Involved
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Visit the catalog: &lt;a href="//education.foojay.social"&gt;education.foojay.social&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Check the GitHub repository and contribute resources: &lt;a href="//github.com/foojayio/java-education-catalog"&gt;github.com/foojayio/java-education-catalog&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Read the original announcement: &lt;a href="https://foojay.io/today/bringing-java-closer-to-education-a-community-driven-initiative/" rel="noopener noreferrer"&gt;Bringing Java Closer to Education&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you believe Java deserves a stronger presence in education, join the movement. Let’s show the next generation that Java is not just enterprise-ready, it’s future-ready, beginner-friendly, and exciting.&lt;/p&gt;

&lt;p&gt;Together, we can grow Java where it matters most: at the beginning.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>java</category>
      <category>learning</category>
      <category>resources</category>
    </item>
    <item>
      <title>Stop Saying Java is Slow</title>
      <dc:creator>IgorIOT</dc:creator>
      <pubDate>Thu, 05 Mar 2026 16:59:33 +0000</pubDate>
      <link>https://dev.to/igoriot/stop-saying-java-is-slow-15nh</link>
      <guid>https://dev.to/igoriot/stop-saying-java-is-slow-15nh</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6yizkc08ck44nvucqo8c.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6yizkc08ck44nvucqo8c.jpg" alt=" " width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;How goes the battle?&lt;/p&gt;

&lt;h2&gt;
  
  
  Java 25 Performance: Faster Starts, Smarter Memory, Better GC
&lt;/h2&gt;

&lt;p&gt;Java 25 isn’t just another incremental release. It brings meaningful performance improvements that directly impact how fast your applications start, how much memory they consume, and how efficiently they manage garbage collection.&lt;/p&gt;

&lt;p&gt;Let’s break down what changed, and why it matters.&lt;/p&gt;

&lt;h2&gt;
  
  
  🚀 Faster Startup with the New AOT Cache
&lt;/h2&gt;

&lt;p&gt;One of the most exciting additions in Java 25 is the new Ahead-of-Time (AOT) cache.&lt;/p&gt;

&lt;p&gt;Traditionally, when a Java application starts, the Just-In-Time (JIT) compiler kicks in and begins optimizing code as it runs. While this leads to excellent long-term performance, it adds overhead during startup.&lt;/p&gt;

&lt;p&gt;Java 25 changes that.&lt;/p&gt;

&lt;p&gt;With the AOT cache (introduced through JEPs 483 and 514), you can perform a “training run” of your application. During this run, the JVM observes which classes and methods are actually used. It then generates an optimized cache specifically for that execution profile.&lt;/p&gt;

&lt;p&gt;Later, when the application starts in production, the JVM loads this prebuilt cache directly into memory. The result? Much less JIT work at startup, and dramatically faster boot times.&lt;br&gt;
In large applications with many classes, startup times can improve by up to 50%.&lt;br&gt;
And it gets better.&lt;br&gt;
JEP 515 enhances the AOT cache by incorporating profiling data collected by the JIT itself. That means the cache isn’t just precompiled, it’s optimized based on real runtime behavior. Smarter data, better performance.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://openjdk.org/jeps/483" rel="noopener noreferrer"&gt;JEP 483&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://openjdk.org/jeps/514" rel="noopener noreferrer"&gt;JEP 514&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://openjdk.org/jeps/515" rel="noopener noreferrer"&gt;JEP 515&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  🧠 Smaller Object Headers, Lower Memory Usage
&lt;/h2&gt;

&lt;p&gt;Java 25 also takes aim at memory efficiency with Compact Object Headers (JEP 519).&lt;/p&gt;

&lt;p&gt;Every object in Java carries a header containing metadata used by the JVM. While small individually, these headers add up quickly in systems managing millions of objects.&lt;br&gt;
Java 25 optimizes and reduces the size of these headers, decreasing overall memory footprint.&lt;/p&gt;

&lt;p&gt;Why does this matter?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Applications consume less memory&lt;/li&gt;
&lt;li&gt;The Garbage Collector has less work to do&lt;/li&gt;
&lt;li&gt;Performance improves under memory pressure&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In extensive production testing across hundreds of services, memory usage dropped by up to 20% in some workloads. Processing time improved by up to 10%, and GC cycles were up to 15% less frequent.&lt;/p&gt;

&lt;p&gt;That’s not theoretical, that’s production-grade validation.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://openjdk.org/jeps/450" rel="noopener noreferrer"&gt;JEP 450&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://openjdk.org/jeps/519" rel="noopener noreferrer"&gt;JEP 519&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  ♻️ Garbage Collection Keeps Evolving
&lt;/h2&gt;

&lt;p&gt;Java has always offered multiple garbage collectors for different workloads. In Java 25, all major collectors receive meaningful upgrades.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Shenandoah Goes Generational&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Shenandoah is known for low-latency performance, minimizing pause times by performing most of its work concurrently with the application.&lt;/p&gt;

&lt;p&gt;With JEP 521, Shenandoah now supports a generational mode. Generational GC typically performs better because most objects die young — and now Shenandoah can take advantage of that reality.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;ZGC Embraces Generational Design&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;ZGC also moves forward with a generational implementation (JEP 474). In fact, the non-generational mode has been deprecated. Since generational approaches generally provide better performance characteristics, future innovation will focus there.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;G1 Gets Smarter About JNI&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;G1, still the default GC in Java 25, also improves through JEP 423. The focus here is reducing pause times during operations involving JNI (Java Native Interface).&lt;/p&gt;

&lt;p&gt;For applications interacting with native code, this means smoother performance and fewer unexpected delays.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://openjdk.org/jeps/423" rel="noopener noreferrer"&gt;JEP 423&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://openjdk.org/jeps/474" rel="noopener noreferrer"&gt;JEP 474&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://openjdk.org/jeps/521" rel="noopener noreferrer"&gt;JEP 521&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Big Picture
&lt;/h2&gt;

&lt;p&gt;Java 25 isn’t flashy, it’s practical.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Faster startup with AOT caching&lt;/li&gt;
&lt;li&gt;Lower memory usage with compact object headers&lt;/li&gt;
&lt;li&gt;Smarter, more efficient garbage collection&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These aren’t cosmetic changes. They directly impact cloud deployments, containerized applications, microservices, and large enterprise systems.&lt;/p&gt;

&lt;p&gt;Modern Java keeps evolving, and it’s becoming faster, leaner, and more production-optimized with every release.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffslgontypnsdmmkg6bg7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffslgontypnsdmmkg6bg7.png" alt=" " width="800" height="533"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Picture 01: Duke speedster inspired&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Java 25 represents a major leap forward in making the JVM more efficient and developer-friendly than ever before. With the new AOT caching system dramatically slashing startup times (up to 50% in many cases), Compact Object Headers shrinking memory usage by up to 20%, and meaningful refinements to G1, ZGC, and Shenandoah, the platform is now faster to launch, lighter on resources, and more responsive under load, all while maintaining the reliability and scalability Java is known for. Whether you’re building cloud-native microservices, real-time applications, or large-scale enterprise systems, these improvements mean less waiting, lower costs, and smoother performance right out of the gate. Java 25 isn’t just an incremental update, it’s a clear signal that the language continues to evolve to meet modern demands. Time to upgrade and experience the difference yourself!&lt;/p&gt;

&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://inside.java/2025/10/20/jdk-25-performance-improvements/" rel="noopener noreferrer"&gt;https://inside.java/2025/10/20/jdk-25-performance-improvements/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://gillius.org/blog/2025/10/java-25-framework-startup.html" rel="noopener noreferrer"&gt;https://gillius.org/blog/2025/10/java-25-framework-startup.html&lt;/a&gt;&lt;/p&gt;

</description>
      <category>java</category>
      <category>news</category>
      <category>performance</category>
      <category>programming</category>
    </item>
    <item>
      <title>Stop Saying Java Is Verbose</title>
      <dc:creator>IgorIOT</dc:creator>
      <pubDate>Sun, 15 Feb 2026 21:23:06 +0000</pubDate>
      <link>https://dev.to/igoriot/stop-saying-java-is-verbose-127i</link>
      <guid>https://dev.to/igoriot/stop-saying-java-is-verbose-127i</guid>
      <description>&lt;p&gt;How’s it going there?&lt;/p&gt;

&lt;p&gt;Whether you’re a student learning your first “Hello, World” or an experienced developer writing quick prototypes, Java 25 streamlines the experience. For decades, this was a barrier. Beginners had to learn about classes, static methods, arrays, String, System.out, packages, imports, the main keyword's meaning, and public access modifiers before they could even print text.&lt;/p&gt;

&lt;p&gt;But it is not Java 25 that brings it all; it's been a while since a lot of stuff has been happening. Let's see some of the evolution.&lt;/p&gt;

&lt;p&gt;In almost all of those JEP summaries, you can see this:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“Evolve the Java language so that students can write their first programs without needing to understand language features designed for large programs.”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Java 21 – Unnamed Classes and Instance Main Methods (JEP 445)
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://openjdk.org/jeps/445" rel="noopener noreferrer"&gt;https://openjdk.org/jeps/445&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Unnamed classes: Programs could omit the class declaration entirely; the compiler would wrap top-level methods into an unnamed class.&lt;/p&gt;

&lt;p&gt;Instance main methods introduced: You no longer need &lt;em&gt;public static void main(String[] args)&lt;/em&gt;. Instead, you can declare &lt;em&gt;void main()&lt;/em&gt; or &lt;em&gt;void main(String[] args)&lt;/em&gt; as an instance method inside a class.&lt;/p&gt;

&lt;h2&gt;
  
  
  Java 22 – Implicitly Declared Classes and Instance Main Methods (JEP 463)
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://openjdk.org/jeps/463" rel="noopener noreferrer"&gt;https://openjdk.org/jeps/463&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The “unnamed classes” concept was replaced in Java 22 with a more streamlined and intuitive model: implicitly declared classes, or implicit classes. Instead of requiring a special classification, the compiler now treats any top-level code without an explicit class declaration as belonging to a standard class automatically generated by the compiler. This class is given a host-determined name (the name of your .java file), is final, belongs to the unnamed package, extends Object, and cannot implement interfaces—yet functions like a regular class in behavior.&lt;/p&gt;

&lt;h2&gt;
  
  
  Java 23 – Implicitly Declared Classes and Instance Main Methods (JEP 477)
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://openjdk.org/jeps/477" rel="noopener noreferrer"&gt;https://openjdk.org/jeps/477&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;No need to reference System.out and wonder what it means. They introduced a new IO class with print/read features (print, println, readln), and the amazing part is that these methods are auto-imported, so you can directly write &lt;em&gt;println("Hello, World!");&lt;/em&gt;. In addition, all public classes in java.base are now auto-imported, making types like List, File, or BigDecimal usable with zero ceremony.&lt;/p&gt;

&lt;h2&gt;
  
  
  Java 24 – Simple Source Files and Instance Main Methods (JEP 495)
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://openjdk.org/jeps/495" rel="noopener noreferrer"&gt;https://openjdk.org/jeps/495&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It looks like nothing has been changed in the code feature here, but they decided to unify the feature under the name simple source files instead of implicit classes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Java 25 – Compact Source Files and Instance Main Methods (JEP 512)
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://openjdk.org/jeps/512" rel="noopener noreferrer"&gt;https://openjdk.org/jeps/512&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The static methods originally provided in java.io.IO (println, …) have been moved to java.lang.IO (and since everything in java.lang is imported by default, they are now more accessible).&lt;br&gt;
These operations are now based on System.out/System.in rather than the Console API. However, the static methods of the IO class are no longer implicitly imported into compact source files. This means that method calls must explicitly reference the class.&lt;/p&gt;

&lt;p&gt;Compact source files automatically access all public classes and interfaces from java.base module (i.e., import module java.base;).&lt;/p&gt;

&lt;h2&gt;
  
  
  Java 25 – Flexible Constructor Bodies (JEP 513)
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://openjdk.org/jeps/513" rel="noopener noreferrer"&gt;https://openjdk.org/jeps/513&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;One important part of this flow is constructor chaining. If a class has a parent class, Java ensures that the parent constructor runs before the child constructor logic. This guarantees that the object is built step by step, starting from the top of the inheritance hierarchy.&lt;/p&gt;

&lt;p&gt;This improves this situation because it allows certain statements to appear before #super() or #this() calls, making constructors more expressive and readable.&lt;/p&gt;

&lt;p&gt;This is not an exhaustive list, and I really suggest you go there and try out some examples of each one to really get a good understanding of those benefits.&lt;/p&gt;

&lt;h2&gt;
  
  
  VSCode Plugin
&lt;/h2&gt;

&lt;p&gt;Did you know that you can run a simple Hello World in one line of code without knowing anything?&lt;/p&gt;

&lt;p&gt;There's a nice &lt;a href="https://inside.java/2025/12/09/new-vscode-extension/" rel="noopener noreferrer"&gt;VSCode plugin&lt;/a&gt; that also introduces Interactive Java Notebooks (IJNB), which allow you to create notebooks that combine formatted text (Markdown), executable Java code, and execution results in any order.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Let's do a simple test;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You just need to install VSCode and install the plugin; that is it. If you don’t have Java on your machine, the plugin will ask you to auto-install it for you. Of course, choose Java 25.&lt;br&gt;
Open a new notebook, and that’s it: a Java Hello World in one line.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxkf37wis4lk9dun6fpp1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxkf37wis4lk9dun6fpp1.png" alt=" "&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Sample Code 1: Hello World in One Line&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Launching Simple Source-Code Programs
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://dev.java/learn/launch-simple-source-code-programs/" rel="noopener noreferrer"&gt;Another nice point here.&lt;/a&gt; This can be a great way to learn how to use Java or explore new features within the Java API, without having to go through the cruft of compiling and then executing code. A simple Java as a JavaScript.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F39wmkayrvx02z1r3lxlz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F39wmkayrvx02z1r3lxlz.png" alt=" "&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Sample Code 2: Hello World from Terminal&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;To really understand what’s happening under the hood here, I suggest using the &lt;a href="https://docs.oracle.com/en/java/javase/11/tools/javap.html" rel="noopener noreferrer"&gt;javap&lt;/a&gt; tool to disassemble the file.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flt6ox577ndy0isj8b8ca.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flt6ox577ndy0isj8b8ca.png" alt=" "&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Sample Code 3: Javap Disassemble the File Result&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The output shows that the Java compiler automatically generated a FileName class with the default constructor. This behavior shows that while the syntax has been simplified, the underlying Java class structure is still preserved. In short, the Java compiler writes the class for us with the class name named after the source file name.&lt;/p&gt;

&lt;p&gt;

  &lt;iframe src="https://www.youtube.com/embed/lGAYLVk5HaY"&gt;
  &lt;/iframe&gt;


&lt;br&gt;
&lt;em&gt;Video: Dan Vega Talking About Java Is Verbose Back in 2024&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Call to Action
&lt;/h2&gt;

&lt;p&gt;Go there and try to explore those things. Let me know what your thoughts are. Any JEP or anything else that I forgot to add in this list? I would love to hear from you.&lt;/p&gt;

&lt;p&gt;From now on, if you see anyone saying that Java is verbose, you can simply send this blog post link.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;The Java evolution shows a clear vision: making Java simpler for small programs, powerful for big ones.&lt;/p&gt;

&lt;p&gt;Java 25 marks a turning point. With compact source files and instance main methods, Java finally aligns with beginner expectations while preserving its scalability for enterprise use, a game-changing feature that dramatically reduces boilerplate code for simple programs. With those updates, Java finally offers a beginner-friendly way to write code without the overhead of explicit classes, public static void main, or import statements—making the language more accessible than ever.&lt;/p&gt;

&lt;p&gt;Remember, you can have an if-else in one line; you can use the "Ternary Operator", but this might translate into more difficult code to read and understand. So a lower number of lines does not necessarily mean better code. Sometimes being verbose is a good thing.&lt;/p&gt;

&lt;p&gt;There is much more to explore regarding Java in a single file, Java as scripts in terminal, and Java in a notebook.&lt;/p&gt;

&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://jdk.java.net/25/" rel="noopener noreferrer"&gt;All Java 25 info&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I really recommend this 2022 &lt;a href="https://openjdk.org/projects/amber/design-notes/on-ramp" rel="noopener noreferrer"&gt;blog&lt;/a&gt; from Brian Goetz that might be the beginning of the JEP 512 initiative&lt;/p&gt;

&lt;p&gt;&lt;a href="https://cr.openjdk.org/~gbierman/jep445/jep445-20230502/specs/unnamed-classes-instance-main-methods-jls.html" rel="noopener noreferrer"&gt;The Unnamed Classes Documentation&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://javapro.io/2025/11/27/behind-the-bytecode-exploring-java-features-with-javap-tool/" rel="noopener noreferrer"&gt;JavaP and More&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Did you know about “JEP 519: Compact Object Headers” that comes with the idea to reduce the object header size? Does this mean that we can say that Java is not slow anymore? Stay tuned here for the next blog “Stop Saying Java Is Slow.”&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>java</category>
      <category>learning</category>
      <category>programming</category>
    </item>
    <item>
      <title>Welcome to IgorIOT (a.k.a. I Go Riot)</title>
      <dc:creator>IgorIOT</dc:creator>
      <pubDate>Mon, 09 Feb 2026 00:19:33 +0000</pubDate>
      <link>https://dev.to/igoriot/welcome-to-igoriot-aka-i-go-riot-1kng</link>
      <guid>https://dev.to/igoriot/welcome-to-igoriot-aka-i-go-riot-1kng</guid>
      <description>&lt;p&gt;&lt;strong&gt;Hey everyone!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I’ve decided it’s time to start a new chapter. I’m officially relaunching my blog under a new name: IgorIOT; Yes, that’s “Igor I-O-T”, but also my playful way of saying “I Go Riot”.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why the change?
&lt;/h2&gt;

&lt;p&gt;My old blog &lt;a href="http://www.igfasouza.com/blog/" rel="noopener noreferrer"&gt;igfasouza.com/blog&lt;/a&gt; has been a place where I’ve explored everything from development to data engineering. Over the last couple of years, most of my public content, especially on social media, has focused on Apache Kafka and streaming platforms. &lt;/p&gt;

&lt;p&gt;This new blog will focus primarily on Java and Raspberry Pi, exploring how modern Java can be used in hands-on projects, learning environments, and real-world experiments with affordable hardware. &lt;/p&gt;

&lt;p&gt;As part of this change, I’ve also created a separate space dedicated exclusively to Apache Kafka, where I’ll continue publishing in-depth posts and sharing practical insights. That Kafka-focused space will be accompanied by its own &lt;a href="https://topicigor.substack.com/p/hello-world-welcome-to-topic-igor" rel="noopener noreferrer"&gt;newsletter&lt;/a&gt;, so readers interested in event-driven architectures and streaming platforms can follow that content independently.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is IgorIOT?
&lt;/h2&gt;

&lt;p&gt;IgorIOT is more than a name; It’s a blend of who I am as a developer and what excites me outside of work.&lt;br&gt;
While “IoT” is in the name (and yes, it also sounds like “I Go Riot”), this blog is not limited to just Internet of Things content. It’s a space where I explore the crossover between my professional experience and personal passions.&lt;/p&gt;

&lt;p&gt;In addition to technical content, this blog will also be a place where I share updates and ideas related to my initiative around Java in Education. The goal is to explore how Java can be made more accessible and engaging for students, educators, and coding communities, using modern tools and hands-on approaches. I’ll use this space to document progress, discuss challenges, and highlight community-driven efforts to bring Java closer to learning environments.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyvxprt8mrjp0xpp07sow.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyvxprt8mrjp0xpp07sow.jpg" alt=" " width="456" height="564"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With that, my &lt;a href="http://www.igfasouza.com/blog/" rel="noopener noreferrer"&gt;igfasouza blog&lt;/a&gt; will be taken offline soon. However, none of the content will be lost. I’ll be saving and maintaining all posts and materials in a &lt;a href="https://github.com/igfasouza" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt; repository. This way, the content will remain accessible, preserved, and open for anyone who wants to explore or reuse it in the future. I’ll share the GitHub link once everything is organized. I’m not sure yet if I’ll go all the way and set up a Hugo site on GitHub for the old blog, but at least the content will be preserved in some form.&lt;/p&gt;

&lt;p&gt;Thanks to everyone who has followed and supported the blog over the years!&lt;/p&gt;

</description>
      <category>iot</category>
      <category>java</category>
      <category>news</category>
      <category>sideprojects</category>
    </item>
  </channel>
</rss>
