<?xml version="1.0" encoding="UTF-8" ?><!-- generator=Zoho Sites --><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><atom:link href="https://www.campuscomponent.com/blogs/tag/serial-communication/feed" rel="self" type="application/rss+xml"/><title>Campus - Blog #Serial communication</title><description>Campus - Blog #Serial communication</description><link>https://www.campuscomponent.com/blogs/tag/serial-communication</link><lastBuildDate>Fri, 03 Apr 2026 02:48:06 -0700</lastBuildDate><generator>http://zoho.com/sites/</generator><item><title><![CDATA[Understanding Serial Peripheral Interface Communication Protocol]]></title><link>https://www.campuscomponent.com/blogs/post/understanding-serial-peripheral-interface-communication-protocol</link><description><![CDATA[<img align="left" hspace="5" src="https://www.campuscomponent.com/Understanding Serial Peripheral Interface Communication Protocol.jpg"/>Simplify your understanding of Serial Peripheral Interface (SPI) communication protocol with this guide. This article offers a comprehensive understanding of SPI, its working principles, applications and integration in electronic systems.]]></description><content:encoded><![CDATA[
<div class="zpcontent-container blogpost-container "><div data-element-id="elm_VMYdRUrFSfmyCt7LMaokRA" data-element-type="section" class="zpsection "><style type="text/css"></style><div class="zpcontainer"><div data-element-id="elm_MgQkxFSJTyqcmftK4mx1Nw" data-element-type="row" class="zprow zpalign-items- zpjustify-content- "><style type="text/css"></style><div data-element-id="elm_-Td5wT6PSymSFuBh7feyPg" data-element-type="column" class="zpelem-col zpcol-12 zpcol-md-12 zpcol-sm-12 zpalign-self- "><style type="text/css"></style><div data-element-id="elm_re3hvr7PTNSFTtqp_q1pNQ" data-element-type="heading" class="zpelement zpelem-heading "><style> [data-element-id="elm_re3hvr7PTNSFTtqp_q1pNQ"].zpelem-heading { border-radius:1px; } </style><h2
 class="zpheading zpheading-align-center " data-editor="true"></h2></div>
<div data-element-id="elm_xnefim--QZ2jze-EIXS6-A" data-element-type="text" class="zpelement zpelem-text "><style> [data-element-id="elm_xnefim--QZ2jze-EIXS6-A"].zpelem-text{ border-radius:1px; } </style><div class="zptext zptext-align-center " data-editor="true"><p style="text-align:justify;"><img src="/Understanding%20Serial%20Peripheral%20Interface%20Communication%20Protocol.jpg" style="width:1107.58px !important;height:707px !important;max-width:100% !important;" alt="Understanding Serial Peripheral Interface Communication Protocol"><span style="font-size:11pt;color:rgb(0, 0, 0);"><br></span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);"><br></span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">In this article we will learn in depth about the Serial Peripheral interface which is among the widely used communication protocol in Embedded and IOT world.</span></p><h2 style="text-align:justify;margin-bottom:6pt;"><span style="font-size:18px;font-weight:400;color:rgb(0, 0, 0);">What is Serial Peripheral Interface - SPI?</span></h2><p style="text-align:justify;"><span style="color:rgb(0, 0, 0);"><span style="font-size:11pt;">SPI is a synchronous serial communication protocol that enables communication between </span><a href="https://www.campuscomponent.com/categories/developement_board_programmers/2208614000002321147"><span style="font-size:11pt;">microcontrollers</span></a><span style="font-size:11pt;">, sensors, memory devices, and other peripheral devices. It allows for full-duplex communication, meaning data can be sent and received simultaneously.</span></span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">Serial Peripheral Interface (SPI) offers advantages such as high-speed data transfer, simplicity, and versatility.</span></p><p style="text-align:justify;"><span style="color:rgb(0, 0, 0);"><br></span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">The serial peripheral interface (SPI) is a communication interaction protocol used to send data between multiple IoT Devices. The Serial Peripheral Interface (SPI) offers data exchange among multiple devices through a master-slave configuration. In SPI the master device begins communication, by sending action bits to the slave devices. In SPI protocol one device serves as the master, with the rest acting as slaves. These modules operate synchronously and SPI ensures simultaneous transmission and reception of data at high speeds. SPI proves efficient for inter-device communication, offering higher data transfer rates compared to alternative interfaces. Its ability to handle bidirectional data flow concurrently enhances efficiency. However, SPI requires more signal lines compared to alternative protocols.</span></p><h2 style="text-align:justify;margin-bottom:6pt;"><span style="font-size:18px;font-weight:400;color:rgb(0, 0, 0);">Understanding SPI Communication</span></h2><div><span style="font-size:18px;font-weight:400;color:rgb(0, 0, 0);"><br></span></div><p><span style="font-size:11pt;"><span style="width:515px;"><img alt="Understanding Serial Peripheral Interface Communication Protocol" src="https://lh7-us.googleusercontent.com/jyvfxPNDGTMkwGRgBjrH6gNPAl916YfXQLvLLbdnT4XICNqrTzrJkJM8RhZtLf9uUmeLJyYEDkCEiJuy8Aa7hWKhpEa_SKjHxL2xfguBpVouBMoiVpQEm8-IAxc_NijBJnr20OunJ03n" width="515" height="148" style="width:644.24px !important;height:185px !important;max-width:100% !important;"></span></span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);"><br></span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">SPI typically involves one master device communicating with one or more slave devices over four signal lines:</span></p><p style="text-align:justify;"><span style="color:rgb(0, 0, 0);"><span style="font-size:11pt;font-weight:700;">MOSI (Master Out Slave In):</span><span style="font-size:11pt;"> This line carries data from the master to the slave.</span></span></p><p style="text-align:justify;"><span style="color:rgb(0, 0, 0);"><span style="font-size:11pt;font-weight:700;">MISO (Master In Slave Out):</span><span style="font-size:11pt;"> This line carries data from the slave to the master.</span></span></p><p style="text-align:justify;"><span style="color:rgb(0, 0, 0);"><span style="font-size:11pt;font-weight:700;">SCK (Serial Clock):</span><span style="font-size:11pt;"> This line carries the clock signal generated by the master to synchronize data transmission.</span></span></p><p style="text-align:justify;"><span style="color:rgb(0, 0, 0);"><span style="font-size:11pt;font-weight:700;">SS/CS (Slave Select/Chip Select):</span><span style="font-size:11pt;"> This line is used to select the slave device with which the master wants to communicate.</span></span></p><h2 style="text-align:justify;margin-bottom:6pt;"><span style="font-size:16pt;font-weight:400;color:rgb(0, 0, 0);">SPI Protocol Sequence</span></h2><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">The master initiates communication by asserting the Slave Select (SS/CS) line corresponding to the intended slave device.</span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">1. The master sends a clock signal (SCK) to synchronize data transmission.</span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);"><br></span></p><p><span style="font-size:11pt;"><span style="width:311px;"><img src="https://lh7-us.googleusercontent.com/SrV8fjxc5IMBDoe1UfQ4Tmh_qsT4LcKfWvC5m60x9J1u68UlR8Bp4VOyEzrU1AAwgD9Ek7r-eXbcnaUhjUSqWFYCn46PMIox3hrgdPsY_9bQoTd_ZK_T9BpKuyjfqnZpyT9xdJbxO5ll" width="311" height="80" style="width:404.36px !important;height:104px !important;max-width:100% !important;" alt="Understanding Serial Peripheral Interface Communication Protocol"></span></span></p><p style="text-align:left;"><span style="font-size:11pt;color:rgb(0, 0, 0);">2. The SS/CS pin gets switched low voltage state, which activates the connected slave</span></p><p style="text-align:left;"><span style="font-size:11pt;color:rgb(0, 0, 0);"><br></span></p><p><span style="font-size:11pt;"><span style="width:335px;"><img src="https://lh7-us.googleusercontent.com/IKlWF7AauwvPOBNwDfQBQLyrLoI_1U3JR2Tk-_EXP-rgvLkunc44vnkvSccVilZX7ut0HfU3JsEkbSKdriYmyXPkkI0UDBkAZceUqGiURcFx5X7JJGbH881sJ4SH_HFgvOyvzEk-09qd" width="335" height="86" style="width:413px !important;height:106px !important;max-width:100% !important;" alt="Understanding Serial Peripheral Interface Communication Protocol"></span></span></p><p style="text-align:left;"><span style="font-size:11pt;color:rgb(0, 0, 0);">3. The master transmits data to the slave bit by bit through the MOSI line, while the slave promptly reads each incoming bit:</span></p><p style="text-align:left;"><span style="font-size:11pt;color:rgb(0, 0, 0);"><br></span></p><p><span style="font-size:11pt;"><span style="width:385px;"><img src="https://lh7-us.googleusercontent.com/efFc_D09W-hj5g-ZeHphrS6FktpQ0whaUKJ6xygundQNu_BF4ua4ldw3jidxBci5fSvWIfZymYcvyr_pRYHfNY0p1IUz-LBgas5eI5dw_fUXXSgwgQDtj2QHD7UFE7NsE6U1g76bfl4y" width="385" height="99" style="width:423.9px !important;height:109px !important;max-width:100% !important;" alt="Understanding Serial Peripheral Interface Communication Protocol"></span></span></p><p style="text-align:left;"><span style="font-size:11pt;">&nbsp;</span></p><p style="text-align:left;"><span style="font-size:11pt;"><span style="color:rgb(0, 0, 0);">4. The slave sends data back to the master one bit at a time via the MISO line, with the master interpreting each received bit sequentially:</span>&nbsp;</span></p><p style="text-align:left;"><span style="font-size:11pt;">&nbsp;&nbsp; &nbsp;</span></p><p style="text-align:left;"><span style="color:inherit;"><span style="font-size:11pt;"><span style="width:404px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <img alt="Understanding Serial Peripheral Interface Communication Protocol" src="https://lh7-us.googleusercontent.com/ItHg8beVzGd0LYXweN3z62TEmweJifdvYG3--o3L_elPqzL3BtpYAtWem0bATwwRQhH7V-QA_3JIB9Ow4OOrTeyNxJC4c0oe5qNqKBCgGWCQjTLN7GZ9_3ZV9x1b_GHPTWkF9ssJgXy9" width="404" height="104" style="width:454.44px !important;height:117px !important;max-width:100% !important;"></span></span></span><span style="font-size:11pt;"><br></span></p><p style="text-align:left;"><span style="color:rgb(0, 0, 0);"><span style="font-size:11pt;"><br></span></span></p><p style="text-align:left;"><span style="color:rgb(0, 0, 0);"><span style="font-size:11pt;">Data is simultaneously transmitted from the master to the slave (MOSI) and from the slave to the master (MISO).&nbsp;</span><span style="font-size:11pt;">Upon receiving data, the slave processes it and responds accordingly.</span></span></p><p><span style="color:inherit;"><br></span></p><p style="text-align:left;"><span style="font-size:11pt;font-weight:700;color:rgb(0, 0, 0);">Let us now see the example of ESP32 SPI feature:</span></p><p style="text-align:left;"><span style="font-size:11pt;font-weight:700;color:rgb(0, 0, 0);"><br></span></p><p><span style="font-size:11pt;"><span style="width:247px;"><img alt="Espressif Systems ESP32 DevKitC 32D Development Board" src="https://lh7-us.googleusercontent.com/IvMvFd0Yo1lFd1KoBg8mBfv-W2gJk0dzbPojZD82oziYtkm2-Y9EXB1aYyFA1nI8rhr-nd33JKgr7mvfNE1E4HwzHnkz0s8LP4AVFZo-9sLotGvEWFH7zcx0t9Y4mNTRxrX6hMy4nAfb" width="247" height="308"></span></span></p><p style="text-align:left;"><span style="color:rgb(0, 0, 0);"><span style="font-size:11pt;"><br></span></span></p><p style="text-align:left;"><span style="color:rgb(0, 0, 0);"><span style="font-size:11pt;">The pin mapping of SPI for </span><a href="https://www.campuscomponent.com/products/espressif-esp32-devkitc-32d-development-board/2208614000001841024"><span style="font-size:11pt;">ESP32 board</span></a><span style="font-size:11pt;"> is as follows:</span></span></p><p style="text-align:left;"><span style="color:rgb(0, 0, 0);"><span style="font-size:11pt;"><br></span></span></p><div align="left"><table><colgroup><col width="66"><col width="98"><col width="98"><col width="98"><col width="98"></colgroup><tbody><tr><td style="vertical-align:middle;"><p><span style="font-size:11pt;font-weight:700;color:rgb(0, 0, 0);">SPI</span></p></td><td style="vertical-align:middle;"><p><span style="font-size:11pt;font-weight:700;color:rgb(0, 0, 0);">MOSI</span></p></td><td style="vertical-align:middle;"><p><span style="font-size:11pt;font-weight:700;color:rgb(0, 0, 0);">MISO</span></p></td><td style="vertical-align:middle;"><p><span style="font-size:11pt;font-weight:700;color:rgb(0, 0, 0);">SCLK</span></p></td><td style="vertical-align:middle;"><p><span style="font-size:11pt;font-weight:700;color:rgb(0, 0, 0);">CS</span></p></td></tr><tr><td style="vertical-align:middle;"><p><span style="font-size:11pt;font-weight:700;color:rgb(0, 0, 0);">VSPI</span></p></td><td style="vertical-align:middle;"><p><span style="font-size:11pt;color:rgb(0, 0, 0);">GPIO 23</span></p></td><td style="vertical-align:middle;"><p><span style="font-size:11pt;color:rgb(0, 0, 0);">GPIO 19</span></p></td><td style="vertical-align:middle;"><p><span style="font-size:11pt;color:rgb(0, 0, 0);">GPIO 18</span></p></td><td style="vertical-align:middle;"><p><span style="font-size:11pt;color:rgb(0, 0, 0);">GPIO 5</span></p></td></tr><tr><td style="vertical-align:middle;"><p><span style="font-size:11pt;font-weight:700;color:rgb(0, 0, 0);">HSPI</span></p></td><td style="vertical-align:middle;"><p><span style="font-size:11pt;color:rgb(0, 0, 0);">GPIO 13</span></p></td><td style="vertical-align:middle;"><p><span style="font-size:11pt;color:rgb(0, 0, 0);">GPIO 12</span></p></td><td style="vertical-align:middle;"><p><span style="font-size:11pt;color:rgb(0, 0, 0);">GPIO 14</span></p></td><td style="vertical-align:middle;"><p><span style="font-size:11pt;color:rgb(0, 0, 0);">GPIO 15</span></p></td></tr></tbody></table></div><p><span style="color:inherit;"><br></span></p><p style="text-align:left;"><span style="font-size:11pt;color:rgb(0, 0, 0);">To link multiple SPI devices, you can utilize the same ESP32 SPI bus provided that each peripheral employs a distinct CS (Chip Select) pin.</span></p><p style="text-align:left;"><span style="font-size:11pt;color:rgb(0, 0, 0);"><br></span></p><p><span style="font-size:11pt;"><span style="width:321px;"><img alt="SPI communication multiple peripherals same bus" src="https://lh7-us.googleusercontent.com/4A_vG9zX1FYaockCJgMFpKB2-LjTndn_X7eL-viqAvm54LzyFGnVW8PELfm9FSxHyP7qps7Sm0eOgxQIANT7A8qtyINl22UCOIxw8ZxLOwECiVpCdCkYLjGMtghlAZryLdQNi6zf0Lji" width="321" height="172" style="width:498.65px !important;height:267px !important;max-width:100% !important;"></span></span></p><p><span style="color:inherit;"><br></span></p><p style="text-align:justify;"><span style="color:rgb(0, 0, 0);"><span style="font-size:11pt;font-weight:700;">Sample ESP32 code to integrate BME280 (Pressure, Temperature, Humidity) SPI Sensor using </span><span style="font-size:11pt;">Adafruit_BME280&nbsp;library:</span></span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">/*</span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">&nbsp;Rui Santos</span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">&nbsp;Complete project details at https://RandomNerdTutorials.com/esp32-spi-communication-arduino/</span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">&nbsp;Based on the Adafruit_BME280_Library example: https://github.com/adafruit/Adafruit_BME280_Library/blob/master/examples/bme280test/bme280test.ino</span></p><p style="text-align:justify;"><span style="color:rgb(0, 0, 0);"><br></span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">&nbsp;Permission is hereby granted, free of charge, to any person obtaining a copy</span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">&nbsp;of this software and associated documentation files.</span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">&nbsp;</span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">&nbsp;The above copyright notice and this permission notice shall be included in all</span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">&nbsp;copies or substantial portions of the Software.</span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">*/</span></p><p style="text-align:justify;"><span style="color:rgb(0, 0, 0);"><br></span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">#include &lt;Wire.h&gt;</span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">#include &lt;Adafruit_Sensor.h&gt;</span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">#include &lt;Adafruit_BME280.h&gt;</span></p><p style="text-align:justify;"><span style="color:rgb(0, 0, 0);"><br></span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">#include &lt;SPI.h&gt;</span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">#define BME_SCK 25</span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">#define BME_MISO 32</span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">#define BME_MOSI 26</span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">#define BME_CS 33</span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">#define SEALEVELPRESSURE_HPA (1013.25)</span></p><p style="text-align:justify;"><span style="color:rgb(0, 0, 0);"><br></span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">//Adafruit_BME280 bme; // I2C</span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">//Adafruit_BME280 bme(BME_CS); // hardware SPI</span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">Adafruit_BME280 bme(BME_CS, BME_MOSI, BME_MISO, BME_SCK); // software SPI</span></p><p style="text-align:justify;"><span style="color:rgb(0, 0, 0);"><br></span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">unsigned long delayTime;</span></p><p style="text-align:justify;"><span style="color:rgb(0, 0, 0);"><br></span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">void setup() {</span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">&nbsp;Serial.begin(9600);</span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">&nbsp;Serial.println(F(&quot;BME280 test&quot;));</span></p><p style="text-align:justify;"><span style="color:rgb(0, 0, 0);"><br></span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">&nbsp;bool status;</span></p><p style="text-align:justify;"><span style="color:rgb(0, 0, 0);"><br></span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">&nbsp;// default settings</span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">&nbsp;// (you can also pass in a Wire library object like &amp;Wire2)</span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">&nbsp;status = bme.begin();&nbsp;</span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">&nbsp;if (!status) {</span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">&nbsp;Serial.println(&quot;Could not find a valid BME280 sensor, check wiring!&quot;);</span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">&nbsp;while (1);</span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">&nbsp;}</span></p><p style="text-align:justify;"><span style="color:rgb(0, 0, 0);"><br></span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">&nbsp;Serial.println(&quot;-- Default Test --&quot;);</span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">&nbsp;delayTime = 1000;</span></p><p style="text-align:justify;"><span style="color:rgb(0, 0, 0);"><br></span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">&nbsp;Serial.println();</span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">}</span></p><p style="text-align:justify;"><span style="color:rgb(0, 0, 0);"><br></span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">void loop() {&nbsp;</span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">&nbsp;printValues();</span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">&nbsp;delay(delayTime);</span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">}</span></p><p style="text-align:justify;"><span style="color:rgb(0, 0, 0);"><br></span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">void printValues() {</span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">&nbsp;Serial.print(&quot;Temperature = &quot;);</span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">&nbsp;Serial.print(bme.readTemperature());</span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">&nbsp;Serial.println(&quot; *C&quot;);</span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">&nbsp;</span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">&nbsp;// Convert temperature to Fahrenheit</span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">&nbsp;/*Serial.print(&quot;Temperature = &quot;);</span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">&nbsp;Serial.print(1.8 * bme.readTemperature() + 32);</span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">&nbsp;Serial.println(&quot; *F&quot;);*/</span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">&nbsp;</span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">&nbsp;Serial.print(&quot;Pressure = &quot;);</span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">&nbsp;Serial.print(bme.readPressure() / 100.0F);</span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">&nbsp;Serial.println(&quot; hPa&quot;);</span></p><p style="text-align:justify;"><span style="color:rgb(0, 0, 0);"><br></span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">&nbsp;Serial.print(&quot;Approx. Altitude = &quot;);</span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">&nbsp;Serial.print(bme.readAltitude(SEALEVELPRESSURE_HPA));</span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">&nbsp;Serial.println(&quot; m&quot;);</span></p><p style="text-align:justify;"><span style="color:rgb(0, 0, 0);"><br></span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">&nbsp;Serial.print(&quot;Humidity = &quot;);</span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">&nbsp;Serial.print(bme.readHumidity());</span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">&nbsp;Serial.println(&quot; %&quot;);</span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">&nbsp;Serial.println();</span></p><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">}</span></p><h2 style="text-align:justify;margin-bottom:6pt;"><span style="font-size:18px;font-weight:400;color:rgb(0, 0, 0);">Key Features of SPI</span></h2><p style="text-align:justify;"><span style="color:rgb(0, 0, 0);"><span style="font-size:11pt;font-weight:700;">Full-Duplex Communication:</span><span style="font-size:11pt;"> SPI allows simultaneous data transmission and reception between the master and slave devices.</span></span></p><p style="text-align:justify;"><span style="color:rgb(0, 0, 0);"><span style="font-size:11pt;font-weight:700;">Master-Slave Architecture:</span><span style="font-size:11pt;"> One master device controls the communication and initiates data transfer to one or more slave devices.</span></span></p><p style="text-align:justify;"><span style="color:rgb(0, 0, 0);"><span style="font-size:11pt;font-weight:700;">Synchronous Communication:</span><span style="font-size:11pt;"> Data transfer in SPI is synchronized with a clock signal generated by the master device.</span></span></p><p style="text-align:justify;"><span style="color:rgb(0, 0, 0);"><span style="font-size:11pt;font-weight:700;">Variable Data Frame Format:</span><span style="font-size:11pt;"> SPI supports variable data frame formats, allowing flexibility in data transmission.</span></span></p><p style="text-align:justify;"><span style="color:rgb(0, 0, 0);"><span style="font-size:11pt;font-weight:700;">High-Speed Communication:</span><span style="font-size:11pt;"> SPI operates at high speeds, making it suitable for applications requiring rapid data transfer.</span></span></p><h2 style="text-align:justify;margin-bottom:6pt;"><span style="font-size:18px;font-weight:400;color:rgb(0, 0, 0);">Advantages</span></h2><ul><li style="font-size:11pt;"><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">No need for start and stop bits, providing continuous streaming of data without interruptions.&nbsp;</span></p></li><li style="font-size:11pt;"><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">Higher data transfer rates compared to I2C (almost twice as fast).</span></p></li><li style="font-size:11pt;"><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">Absence of a complex slave addressing system, unlike I2C.&nbsp;</span></p></li><li style="font-size:11pt;"><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">Dedicated MISO and MOSI lines enabling simultaneous data transmission and reception.</span></p></li></ul><h2 style="text-align:justify;margin-bottom:6pt;"><span style="font-size:18px;font-weight:400;color:rgb(0, 0, 0);">Disadvantages</span></h2><ul><li style="font-size:11pt;"><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">Requires four wires for communication which increase the circuit size&nbsp;</span></p></li><li style="font-size:11pt;"><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">Lacks acknowledgment of successful data reception (unlike I2C).</span></p></li><li style="font-size:11pt;"><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">Absence of error-checking mechanisms such as parity bit in UART.</span></p></li></ul><h2 style="text-align:justify;margin-bottom:6pt;"><span style="font-size:18px;font-weight:400;color:rgb(0, 0, 0);">Applications of SPI</span></h2><ul><li style="font-size:11pt;"><p style="text-align:justify;"><span style="color:rgb(0, 0, 0);"><span style="font-size:11pt;">Interfacing with </span><a href="https://www.campuscomponent.com/categories/sensors/2208614000002321239"><span style="font-size:11pt;">sensors</span></a><span style="font-size:11pt;"> such as accelerometers, gyroscopes, and temperature sensors.</span></span></p></li><li style="font-size:11pt;"><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">Memory devices like EEPROMs, flash memory, and SD cards.</span></p></li><li style="font-size:11pt;"><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">Communication between microcontrollers and peripheral devices.</span></p></li><li style="font-size:11pt;"><p style="text-align:justify;"><span style="color:rgb(0, 0, 0);"><span style="font-size:11pt;">Display interfaces in TFT </span><a href="https://www.campuscomponent.com/categories/lcd_led_display/2208614000002321137"><span style="font-size:11pt;">LCD displays</span></a><span style="font-size:11pt;"> and </span><a href="https://www.campuscomponent.com/categories/oled_display/2208614000004758021"><span style="font-size:11pt;">OLED displays</span></a><span style="font-size:11pt;">.</span></span></p></li><li style="font-size:11pt;"><p style="text-align:justify;"><span style="color:rgb(0, 0, 0);"><span style="font-size:11pt;">Networking peripherals such as Ethernet controllers and </span><a href="https://www.campuscomponent.com/categories/wireless_module/2208614000002321087"><span style="font-size:11pt;">Wi-Fi modules</span></a><span style="font-size:11pt;">.</span></span></p></li></ul><h2 style="text-align:justify;margin-bottom:6pt;"><span style="font-size:18px;font-weight:400;color:rgb(0, 0, 0);">Conclusion</span></h2><p style="text-align:justify;"><span style="font-size:11pt;color:rgb(0, 0, 0);">Serial Peripheral Interface (SPI) is a versatile communication protocol widely used in embedded systems and IOT applications for its simplicity, high-speed data transfer, and flexibility. Understanding the fundamentals of SPI, its protocol sequence, applications, and best practices for implementation is essential for engineers and developers working on embedded systems projects. By mastering SPI communication, you can efficiently interface with a wide range of peripheral devices like displays, sensors, modules, microcontrollers and unleash the full potential of your embedded systems designs.</span></p><p style="text-align:justify;"><span style="color:rgb(0, 0, 0);"><br></span></p><p style="text-align:justify;"><span style="color:rgb(0, 0, 0);"><span style="font-size:11pt;">If you’re an Embedded Developer and looking to implement SPI protocol in your project then Campus Component is there for you to assist you integrating SPI successfully in your project. We are the </span><a href="https://www.campuscomponent.com/"><span style="font-size:11pt;">best electronics suppliers</span></a><span style="font-size:11pt;"> that supply all types of SPI devices with end to end support. Visit Campus Component now.</span></span></p></div>
</div><div data-element-id="elm_G7nGQ88BTNSDRybzT_HK5A" data-element-type="button" class="zpelement zpelem-button "><style> [data-element-id="elm_G7nGQ88BTNSDRybzT_HK5A"].zpelem-button{ border-radius:1px; } </style><div class="zpbutton-container zpbutton-align-center"><style type="text/css"></style><a role="button" class="zpbutton-wrapper zpbutton zpbutton-type-primary zpbutton-size-md zpbutton-style-none " href="https://www.campuscomponent.com/" target="_blank"><span class="zpbutton-content">Get Started Now</span></a></div>
</div></div></div></div></div></div> ]]></content:encoded><pubDate>Wed, 27 Mar 2024 12:42:10 +0000</pubDate></item><item><title><![CDATA[Smart Notice Board with ESP32-C6 & Dot Matrix LED Display]]></title><link>https://www.campuscomponent.com/blogs/post/smart-notice-board-with-esp32-c6-dot-matrix-led-display</link><description><![CDATA[<img align="left" hspace="5" src="https://www.campuscomponent.com/Smart Notice Board with ESP32-C6 - Dot Matrix LED Display.jpg"/>Transform your traditional notice board into a Smart Notice Board using ESP32-C6 and Dot Matrix LED display. Explore the project overview, material requirements, and code implementation. Get started now!]]></description><content:encoded><![CDATA[
<div class="zpcontent-container blogpost-container "><div data-element-id="elm_hkBu2sCFQDi6DfG_9X0jcw" data-element-type="section" class="zpsection "><style type="text/css"></style><div class="zpcontainer"><div data-element-id="elm_bwCVH92UTaal7wNphVSUXw" data-element-type="row" class="zprow zpalign-items- zpjustify-content- "><style type="text/css"></style><div data-element-id="elm_o8FF2VoiSiOsaaf4EpvEOQ" data-element-type="column" class="zpelem-col zpcol-12 zpcol-md-12 zpcol-sm-12 zpalign-self- "><style type="text/css"></style><div data-element-id="elm_xPLvyXszTkm5dW518lZC-A" data-element-type="heading" class="zpelement zpelem-heading "><style> [data-element-id="elm_xPLvyXszTkm5dW518lZC-A"].zpelem-heading { border-radius:1px; } </style><h2
 class="zpheading zpheading-align-center " data-editor="true"></h2></div>
<div data-element-id="elm_7Mch3OUFT2CyKH970B1LLg" data-element-type="text" class="zpelement zpelem-text "><style> [data-element-id="elm_7Mch3OUFT2CyKH970B1LLg"].zpelem-text{ border-radius:1px; } </style><div class="zptext zptext-align-center " data-editor="true"><p style="text-align:justify;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<img src="/Smart%20Notice%20Board%20with%20ESP32-C6%20-%20Dot%20Matrix%20LED%20Display.jpg" style="width:995.02px !important;height:560px !important;max-width:100% !important;"><span style="font-size:12pt;color:rgb(0, 0, 0);"><br></span></p><p style="text-align:justify;"><span style="font-size:12pt;color:rgb(0, 0, 0);">In today's fast-paced world, communication is key. Traditional notice boards are getting a tech-savvy upgrade with the integration of ESP32-C6 and dot matrix LED displays. In this blog post, we'll create a Smart Notice Board that combines the power of ESP32-C6 with the dot matrix LED display. Get ready to transform your notice board into an intelligent, interactive board!</span></p><p style="text-align:justify;"><span style="color:rgb(0, 0, 0);"><br></span></p><p style="text-align:justify;"><span style="font-size:12pt;color:rgb(0, 0, 0);">The traditional methods of writing the notice on paper, and having a person deliver the information to the respective groups, are prone to errors. The person delivering could deliver it to the wrong group, or tamper with the information being sent, etc.</span></p><p style="text-align:justify;"><span style="font-size:12pt;color:rgb(0, 0, 0);">With the electronics industry moving at a fast pace, we are able to solve many such problems with digital replacements. Our project aims at eliminating the use of paper in offices, schools &amp; colleges, and other institutions which are used for the purpose of notice boards. It also minimizes the risk of errors, by replacing paper with Dot Matrix LED displays.</span></p><p style="text-align:justify;"><span style="color:rgb(0, 0, 0);"><br></span></p><p style="text-align:justify;"><span style="color:rgb(0, 0, 0);"><span style="font-size:12pt;">In this tutorial, we will understand how to make a Web Controlled </span><span style="font-size:12pt;font-weight:700;">Smart Notice Board</span><span style="font-size:12pt;"> with </span><span style="font-size:12pt;font-weight:700;">ESP32-C6</span><span style="font-size:12pt;"> &amp; </span><span style="font-size:12pt;font-weight:700;">Dot Matrix LED Display</span><span style="font-size:12pt;">.</span></span></p><h2 style="text-align:justify;margin-bottom:6pt;"><span style="font-size:16pt;font-weight:400;color:rgb(0, 0, 0);">Project Overview</span></h2><p style="text-align:justify;"><span style="font-size:12pt;color:rgb(0, 0, 0);">In this project, the ESP32-C6 WiFi Module can be interfaced with an 8-in-1 MAX7219 Dot Matrix LED Display. The ESP32-C6 connects to a WiFi Network and generates a Web page. We can access the web page using the local IP Address of ESP32-C6. Using the Web Dashboard, we can send any message and display it on Dot Matrix LED Display.</span></p><p><span style="color:inherit;"><span><br></span></span></p><p style="text-align:left;"><span style="font-size:12pt;font-weight:700;color:rgb(0, 0, 0);">Material Requirements:</span></p><p></p><div align="left"><table><colgroup><col width="12"><col width="519"><col width="7"></colgroup><tbody><tr><td style="vertical-align:top;"><p><span style="font-size:12pt;color:rgb(0, 0, 0);">1</span></p></td><td style="vertical-align:top;"><p><span style="font-size:12pt;color:rgb(0, 0, 0);">)</span><a href="https://www.campuscomponent.com/products/esp32-c6-wroom-1-n8-wi-3362-d/2208614000040080145"><span style="font-size:12pt;"> ESP32-C6 Module</span></a></p><p><span style="font-size:12pt;"><span style="width:199px;"><img src="https://lh7-us.googleusercontent.com/h_O0M2hyTsbmDl95fEOUJ1wbDXQ1j2Xh_XvuwoRwjZUqzc92cqxnVVROhgwUrCK_wdkImMrkuIXOPnXQWl52_wA4WJbRWQaHdEu9P_shjtDQ_M4fsaeGaMq3ppb8HS54a2EWascefALOaetK_ArdeQ" width="199" height="144" style="width:288.7px !important;height:209px !important;max-width:100% !important;" alt="ESP-32-C6-WROOM-1"></span></span></p></td><td style="vertical-align:top;"><br></td></tr><tr><td style="vertical-align:top;"><p><span style="font-size:12pt;color:rgb(0, 0, 0);">2</span></p></td><td style="vertical-align:top;"><p><span style="font-size:12pt;"><span style="color:rgb(0, 0, 0);">)</span></span><a href="https://www.campuscomponent.com/products/max7219-dot-matrix-module-for-arduino/2208614000001835920"><span style="font-size:12pt;">8-in-1 MAX7219 Dot Matrix LED Display</span></a></p><p><span style="font-size:12pt;"><span style="width:142px;"><img alt="8x1-LED-Matrix" src="https://lh7-us.googleusercontent.com/Dqz1VSn7hAAyg1I-I22dlXUI4hLHN-vQYpmtWUCb6SV2PsFQwCEawfAXZUNo86sKmgvD8jfXG-k42V3bfbyhZwAcE8GgsWdTKBUXs92w2GTWpqcaaqt643jKs8A123N7A-jwzITkYul5NZRjcVM-uA" width="142" height="106" style="width:230.44px !important;height:172px !important;max-width:100% !important;"></span></span></p><br></td><td style="vertical-align:top;"><br></td></tr><tr><td style="vertical-align:top;"><p><span style="font-size:12pt;color:rgb(0, 0, 0);">3</span></p></td><td style="vertical-align:top;"><p><span style="font-size:12pt;"><span style="color:rgb(0, 0, 0);">)</span></span><a href="https://www.campuscomponent.com/products/g620e643da/2208614000003458013"><span style="font-size:12pt;">Jumper Wires</span></a></p><p><span style="font-size:12pt;"><span style="width:234px;"><img src="https://lh7-us.googleusercontent.com/UF8iZiDQ8mI1zeH9VxZmUA-lYrKx4ELqSKN_F6FYIhzbmlELOSI7HJCfIpUcYk0S0xFxMoNcjaqSsfFNJnIH583W7uPMXq3XN6d_KN7IczHtMp3le2hCXzahPa-O3Cpt1RD_7Gu76Sn_st1KbUHzgw" width="234" height="175" style="width:278.22px !important;height:208px !important;max-width:100% !important;" alt="jumper wire "></span></span></p><br></td><td style="vertical-align:top;"><br></td></tr><tr><td style="vertical-align:top;"><p><span style="font-size:12pt;color:rgb(0, 0, 0);">4</span></p></td><td style="vertical-align:top;" class="zp-selected-cell"><p><span style="font-size:12pt;color:rgb(0, 0, 0);">) </span><a href="https://www.campuscomponent.com/products/400-points-solderless-breadboard-te-3219-d/2208614000036099356"><span style="font-size:12pt;">Breadboard</span></a></p><p><span style="font-size:12pt;"><span style="width:232px;"><img src="https://lh7-us.googleusercontent.com/97wCbqxTN1DngCWGbxEozLjMNtRZmYMOX8k3tJT-UEGjX8EXy3UK6LPmj5Q-_YAwqK3JxAK9DsW5EKKPk_0TOUM_JgVN51Rz1sZZko-g1cFe0ziDuStJKBMs-hGBYOiRKu-LngclCJLibX4wJoGcJg" width="232" height="228" alt="breadboard"></span></span></p><h3 style="margin-bottom:4pt;"><span style="color:rgb(0, 0, 0);font-size:14pt;text-align:center;">Lets Understand the Features of Dot Matrix LED Display</span><br></h3><ul><li style="font-size:12pt;"><p><span style="font-size:12pt;color:rgb(0, 0, 0);">LED matrices come in various styles: single color, dual color, multi-color, and RGB.</span></p></li><li style="font-size:12pt;"><p style="margin-bottom:10pt;"><span style="font-size:12pt;color:rgb(0, 0, 0);">They also come in various dimensions: 5 x 7, 8 x 8, 16 x 16, 8 x 32, 32 x 32, etc.</span></p></li></ul><p><span style="font-size:12pt;"><span style="width:404px;color:rgb(0, 0, 0);"><img src="https://lh7-us.googleusercontent.com/CzmNK65bRaeyLk8YtUBGjOS7le1l3s2gn-s74iYl0hcfSfaGW7vcfBytKNmi99eoO2CAqdpp6047vy_QIHGZtNXgb44nIfMTNH_zFVfnC4bixuCowz3VYZGpZgRJwhBwqnbzVJVr6kvAv8QUMx_i1w" width="404" height="164" style="width:495.02px !important;height:201px !important;max-width:100% !important;"></span></span></p><ul><li style="font-size:12pt;"><p><span style="font-size:12pt;color:rgb(0, 0, 0);">This specific 8×64 LED Matrix Display is a cluster of 8 single modules that are internally connected.</span></p></li><li style="font-size:12pt;"><p style="margin-bottom:10pt;"><span style="font-size:12pt;color:rgb(0, 0, 0);">These modules can be separated because each one has the same Maxim MAX7219 chip and the same power and data connection.</span></p></li></ul><h2 style="margin-bottom:6pt;"><span style="font-size:16pt;font-weight:400;color:rgb(0, 0, 0);">Smart Notice Board with ESP32-C6 &amp; Dot Matrix LED Display Interface</span></h2><p><span style="font-size:12pt;color:rgb(0, 0, 0);">Make the connections of ESP32-C6 with the DOT Matrix LED display as shown in the schematic below</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);"><br></span></p><p><span style="font-size:12pt;"><span style="width:515px;color:rgb(0, 0, 0);"><img src="https://lh7-us.googleusercontent.com/jlS6Rkl6GKmcvI6g2q-SbmhmfEK4vzNKy5gCpP77zAf69uaBbWyFAzVpIzHUfhNv3nif24oKW_lpU5YpadRzerjgiEsa2IU1ZJioWHdcFDSuFVCS3oqg7MJVxioelmpk4_ESSb6vBn7brINlPLZo1Q" width="515" height="282"></span></span></p><p><span style="font-size:12pt;font-weight:700;color:rgb(0, 0, 0);"><br></span></p><p><span style="font-size:12pt;font-weight:700;color:rgb(0, 0, 0);">Connecting the Dot Matrix Display to the NodeMCU:</span></p><ul><li style="font-size:12pt;"><p><span style="font-size:12pt;color:rgb(0, 0, 0);">Power:&nbsp;Connect the VCC pin of the Dot Matrix Display to the 3.3V pin of the NodeMCU.</span></p></li><li style="font-size:12pt;"><p style="margin-bottom:10pt;"><span style="font-size:12pt;color:rgb(0, 0, 0);">Ground:&nbsp;Connect the GND pin of the Dot Matrix Display to the GND pin of the NodeMCU.</span></p></li></ul><p><span style="font-size:12pt;font-weight:700;color:rgb(0, 0, 0);">SPI Interface:</span></p><ul><li style="font-size:12pt;"><p><span style="font-size:12pt;color:rgb(0, 0, 0);">Use the NodeMCU's default SPI GPIO pins.</span></p></li><li style="font-size:12pt;"><p><span style="font-size:12pt;color:rgb(0, 0, 0);">Connect the DIN pin of the MAX7219 to the NodeMCU D7 pin.</span></p></li><li style="font-size:12pt;"><p><span style="font-size:12pt;color:rgb(0, 0, 0);">Connect the CS pin of the MAX7219 to the NodeMCU D8 pin.</span></p></li><li style="font-size:12pt;"><p style="margin-bottom:10pt;"><span style="font-size:12pt;color:rgb(0, 0, 0);">Connect the CLK pin of the MAX7219 to the NodeMCU D5 pin.</span></p></li></ul><div><h2 style="margin-bottom:6pt;"><span style="font-size:16pt;font-weight:400;color:rgb(0, 0, 0);">Source Code/Program</span></h2><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;You will require this 2 Libraries to successfully run the project</span></p><ul><li style="font-size:12pt;"><p><span style="color:rgb(0, 0, 0);"><span style="font-size:12pt;">MD_MAX72xx Library:&nbsp;</span><a href="https://github.com/MajicDesigns/MD_MAX72XX"><span style="font-size:12pt;">Download</span></a></span></p></li><li style="font-size:12pt;"><p style="margin-bottom:10pt;"><span style="color:rgb(0, 0, 0);"><span style="font-size:12pt;">MD_Parola Library:&nbsp;</span><a href="https://github.com/MajicDesigns/MD_Parola"><span style="font-size:12pt;">Download</span></a></span></p></li></ul><p><span style="font-size:12pt;color:rgb(0, 0, 0);">Add this library to the Arduino IDE, and then call it in the main program. Upload the following code to the ESP32-C6 board.</span></p><h3 style="margin-bottom:4pt;"><span style="font-size:14pt;color:rgb(0, 0, 0);">Main Code</span></h3><p><span style="font-size:12pt;color:rgb(0, 0, 0);">#include &lt;ESP8266WiFi.h&gt;</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">#include &lt;MD_Parola.h&gt;</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">#include &lt;MD_MAX72xx.h&gt;</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">#include &lt;SPI.h&gt;</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">// Turn on debug statements to the serial output</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">#define&nbsp;DEBUG&nbsp;0</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">#if&nbsp;DEBUG</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">#define PRINT(s, x) { Serial.print(F(s)); Serial.print(x); }</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">#define PRINTS(x) Serial.print(F(x))</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">#define PRINTX(x) Serial.println(x, HEX)</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">#else</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">#define PRINT(s, x)</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">#define PRINTS(x)</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">#define PRINTX(x)</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">#endif</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;#define HARDWARE_TYPE MD_MAX72XX::FC16_HW</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">#define MAX_DEVICES 8</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">#define CS_PIN&nbsp;15 // or SS</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">// HARDWARE SPI</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">MD_Parola P = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">// WiFi login parameters - network name and password</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">const char* ssid = &quot;campus&quot;;</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">const char* password = &quot;component&quot;;</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">// WiFi Server object and parameters</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">WiFiServer server(80);</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">// Scrolling parameters</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">uint8_t frameDelay = 25;&nbsp;// default frame delay value</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">textEffect_t&nbsp;scrollEffect = PA_SCROLL_LEFT;</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">// Global message buffers shared by Wifi and Scrolling functions</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">#define BUF_SIZE&nbsp;512</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">char curMessage[BUF_SIZE];</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">char newMessage[BUF_SIZE];</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">bool newMessageAvailable = false;</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">const char WebResponse[] = &quot;HTTP/1.1 200 OK\nContent-Type: text/html\n\n&quot;;</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">const char WebPage[] =</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&quot;&lt;!DOCTYPE html&gt;&quot; \</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&quot;&lt;html&gt;&quot; \</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&quot;&lt;head&gt;&quot; \</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&quot;&lt;title&gt;MajicDesigns Test Page&lt;/title&gt;&quot; \</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&quot;&lt;script&gt;&quot; \</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&quot;strLine = \&quot;\&quot;;&quot; \</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&quot;function SendData()&quot; \</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&quot;{&quot; \</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&quot;&nbsp;nocache = \&quot;/&amp;nocache=\&quot; + Math.random() * 1000000;&quot; \</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&quot;&nbsp;var request = new XMLHttpRequest();&quot; \</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&quot;&nbsp;strLine = \&quot;&amp;MSG=\&quot; + document.getElementById(\&quot;data_form\&quot;).Message.value;&quot; \</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&quot;&nbsp;strLine = strLine + \&quot;/&amp;SD=\&quot; + document.getElementById(\&quot;data_form\&quot;).ScrollType.value;&quot; \</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&quot;&nbsp;strLine = strLine + \&quot;/&amp;I=\&quot; + document.getElementById(\&quot;data_form\&quot;).Invert.value;&quot; \</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&quot;&nbsp;strLine = strLine + \&quot;/&amp;SP=\&quot; + document.getElementById(\&quot;data_form\&quot;).Speed.value;&quot; \</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&quot;&nbsp;request.open(\&quot;GET\&quot;, strLine + nocache, false);&quot; \</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&quot;&nbsp;request.send(null);&quot; \</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&quot;}&quot; \</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&quot;&lt;/script&gt;&quot; \</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&quot;&lt;/head&gt;&quot; \</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&quot;&lt;body&gt;&quot; \</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&quot;&lt;p&gt;&lt;b&gt;Smart Notice Board&lt;/b&gt;&lt;/p&gt;&quot; \</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&quot;&lt;formdata_form\&quot;&quot; name=&quot;\&quot;frmText\&quot;&quot;&gt;&quot; \</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&quot;&lt;label&gt;Message:&lt;br&gt;&lt;input type=&quot;\&quot;text\&quot;&quot; name=&quot;\&quot;Messa&quot;ge\&quot; maxlength=&quot;\&quot;255\&quot;&quot;&gt;&lt;/label&gt;&quot; \</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&quot;&lt;br&gt;&lt;br&gt;&quot; \</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&quot;&lt;input type = \&quot;radio\&quot; name = \&quot;Invert\&quot; value = \&quot;0\&quot; checked&gt; Normal&quot; \</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&quot;&lt;input type = \&quot;radio\&quot; name = \&quot;Invert\&quot; value = \&quot;1\&quot;&gt; Inverse&quot; \</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&quot;&lt;br&gt;&quot; \</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&quot;&lt;input type = \&quot;radio\&quot; name = \&quot;ScrollType\&quot; value = \&quot;L\&quot; checked&gt; Left Scroll&quot; \</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&quot;&lt;input type = \&quot;radio\&quot; name = \&quot;ScrollType\&quot; value = \&quot;R\&quot;&gt; Right Scroll&quot; \</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&quot;&lt;br&gt;&lt;br&gt;&quot; \</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&quot;&lt;label&gt;Speed:&lt;br&gt;Fast&lt;input type=&quot;\&quot;ran&quot;ge\&quot; name=&quot;\&quot;Speed\&quot;min=\&quot;10\&quot;&quot; max=&quot;\&quot;200\&quot;&quot;&gt;Slow&quot;\</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&quot;&lt;br&gt;&quot; \</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&quot;&lt;/form&gt;&quot; \</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&quot;&lt;br&gt;&quot; \</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&quot;&lt;input type=&quot;\&quot;submit\&quot;&quot; value=&quot;\&quot;Send&quot; Data\&quot;SendData()\&quot;&quot;&gt;&quot; \</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&quot;&lt;/body&gt;&quot; \</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&quot;&lt;/html&gt;&quot;;</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">const char *err2Str(wl_status_t code)</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">{</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;switch (code)</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;{</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;case WL_IDLE_STATUS:&nbsp;return(&quot;IDLE&quot;);&nbsp; break; // WiFi is in process of changing between statuses</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;case WL_NO_SSID_AVAIL:&nbsp;return(&quot;NO_SSID_AVAIL&quot;);&nbsp;break; // case configured SSID cannot be reached</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;case WL_CONNECTED:&nbsp;return(&quot;CONNECTED&quot;);&nbsp;break; // successful connection is established</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;case WL_CONNECT_FAILED: return(&quot;CONNECT_FAILED&quot;); break; // password is incorrect</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;case WL_DISCONNECTED:&nbsp; return(&quot;CONNECT_FAILED&quot;); break; // module is not configured in station mode</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;default: return(&quot;??&quot;);</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;}</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">}</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">uint8_t htoi(char c)</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">{</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;c = toupper(c);</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;if ((c &gt;= '0') &amp;&amp; (c &lt;= '9')) return(c - '0');</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;if ((c &gt;= 'A') &amp;&amp; (c &lt;= 'F')) return(c - 'A' + 0xa);</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;return(0);</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">}</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">void getData(char *szMesg, uint16_t len)</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">// Message may contain data for:</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">// New text (/&amp;MSG=)</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">// Scroll direction (/&amp;SD=)</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">// Invert (/&amp;I=)</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">// Speed (/&amp;SP=)</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">{</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;char *pStart, *pEnd;&nbsp;// pointer to start and end of text</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;// check text message</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;pStart = strstr(szMesg, &quot;/&amp;MSG=&quot;);</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;if (pStart != NULL)</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;{</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;char *psz = newMessage;</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;pStart += 6;&nbsp;// skip to start of data</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;pEnd = strstr(pStart, &quot;/&amp;&quot;);</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;if (pEnd != NULL)</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;{</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;while (pStart != pEnd)</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;{</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;if ((*pStart == '%') &amp;&amp; isxdigit(*(pStart + 1)))</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;{</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;// replace %xx hex code with the ASCII character</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;char c = 0;</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;pStart++;</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;c += (htoi(*pStart++) &lt;&lt; 4);</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;c += htoi(*pStart++);</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;*psz++ = c;</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;}</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;else</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;*psz++ = *pStart++;</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;}</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;*psz = '\0'; // terminate the string</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;newMessageAvailable = (strlen(newMessage) != 0);</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;PRINT(&quot;\nNew Msg: &quot;, newMessage);</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;}</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;}</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;// check scroll direction</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;pStart = strstr(szMesg, &quot;/&amp;SD=&quot;);</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;if (pStart != NULL)</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;{</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;pStart += 5;&nbsp;// skip to start of data</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;PRINT(&quot;\nScroll direction: &quot;, *pStart);</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;scrollEffect = (*pStart == 'R' ? PA_SCROLL_RIGHT : PA_SCROLL_LEFT);</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;P.setTextEffect(scrollEffect, scrollEffect);</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;P.displayReset();</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;}</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;// check invert</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;pStart = strstr(szMesg, &quot;/&amp;I=&quot;);</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;if (pStart != NULL)</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;{</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;pStart += 4;&nbsp;// skip to start of data</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;PRINT(&quot;\nInvert mode: &quot;, *pStart);</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;P.setInvert(*pStart == '1');</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;}</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;// check speed</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;pStart = strstr(szMesg, &quot;/&amp;SP=&quot;);</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;if (pStart != NULL)</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;{</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;pStart += 5;&nbsp;// skip to start of data</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;int16_t speed = atoi(pStart);</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;PRINT(&quot;\nSpeed: &quot;, P.getSpeed());</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;P.setSpeed(speed);</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;frameDelay = speed;</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;}</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">}</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">void handleWiFi(void)</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">{</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;static enum { S_IDLE, S_WAIT_CONN, S_READ, S_EXTRACT, S_RESPONSE, S_DISCONN } state = S_IDLE;</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;static char szBuf[1024];</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;static uint16_t idxBuf = 0;</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;static WiFiClient client;</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;static uint32_t timeStart;</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;switch (state)</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;{</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;case S_IDLE:&nbsp; // initialise</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;PRINTS(&quot;\nS_IDLE&quot;);</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;idxBuf = 0;</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;state = S_WAIT_CONN;</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;break;</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;case S_WAIT_CONN:&nbsp; // waiting for connection</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;{</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;client = server.available();</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;if (!client) break;</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;if (!client.connected()) break;</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">#if DEBUG</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;char szTxt[20];</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;sprintf(szTxt, &quot;%03d:%03d:%03d:%03d&quot;, client.remoteIP()[0], client.remoteIP()[1], client.remoteIP()[2], client.remoteIP()[3]);</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;PRINT(&quot;\nNew client @ &quot;, szTxt);</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">#endif</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;timeStart = millis();</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;state = S_READ;</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;}</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;break;</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;case S_READ: // get the first line of data</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;PRINTS(&quot;\nS_READ &quot;);</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;while (client.available())</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;{</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;char c = client.read();</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;if ((c == '\r') || (c == '\n'))</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;{</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;szBuf[idxBuf] = '\0';</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;client.flush();</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;PRINT(&quot;\nRecv: &quot;, szBuf);</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;state = S_EXTRACT;</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;}</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;else</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;szBuf[idxBuf++] = (char)c;</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;}</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;if (millis() - timeStart &gt; 1000)</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;{</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;PRINTS(&quot;\nWait timeout&quot;);</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;state = S_DISCONN;</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;}</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;break;</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;case S_EXTRACT: // extract data</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;PRINTS(&quot;\nS_EXTRACT&quot;);</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;// Extract the string from the message if there is one</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;getData(szBuf, BUF_SIZE);</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;state = S_RESPONSE;</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;break;</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;case S_RESPONSE: // send the response to the client</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;PRINTS(&quot;\nS_RESPONSE&quot;);</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;// Return the response to the client (web page)</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;client.print(WebResponse);</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;client.print(WebPage);</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;state = S_DISCONN;</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;break;</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;case S_DISCONN: // disconnect client</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;PRINTS(&quot;\nS_DISCONN&quot;);</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;client.flush();</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;client.stop();</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;state = S_IDLE;</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;break;</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;default:&nbsp;state = S_IDLE;</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;}</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">}</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">void setup()</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">{</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;Serial.begin(57600);</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;PRINTS(&quot;\n[MD_Parola WiFi Message Display]\nType a message for the scrolling display from your internet browser&quot;);</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;P.begin();</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;P.setIntensity(0);</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;P.displayClear();</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;P.displaySuspend(false);</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;P.displayScroll(curMessage, PA_LEFT, scrollEffect, frameDelay);</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;curMessage[0] = newMessage[0] = '\0';</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;// Connect to and initialise WiFi network</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;PRINT(&quot;\nConnecting to &quot;, ssid);</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;WiFi.begin(ssid, password);</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;while (WiFi.status() != WL_CONNECTED)</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;{</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;PRINT(&quot;\n&quot;, err2Str(WiFi.status()));</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;delay(500);</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;}</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;PRINTS(&quot;\nWiFi connected&quot;);</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;// Start the server</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;server.begin();</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;PRINTS(&quot;\nServer started&quot;);</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;// Set up first message as the IP address</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;sprintf(curMessage, &quot;%03d:%03d:%03d:%03d&quot;, WiFi.localIP()[0], WiFi.localIP()[1], WiFi.localIP()[2], WiFi.localIP()[3]);</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;PRINT(&quot;\nAssigned IP &quot;, curMessage);</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">}</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">void loop()</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">{</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;handleWiFi();</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;if (P.displayAnimate())</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;{</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;if (newMessageAvailable)</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;{</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;strcpy(curMessage, newMessage);</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;newMessageAvailable = false;</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;}</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;P.displayReset();</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">&nbsp;}</span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">}</span></p><h2 style="margin-bottom:6pt;"><span style="font-size:16pt;font-weight:400;color:rgb(0, 0, 0);">Testing the ESP8266 Smart Notice Board</span></h2><p><span style="font-size:12pt;color:rgb(0, 0, 0);">After uploading the code, the ESP8266 will connect to the WiFi Network using the WiFi Credentials. The Dot Matrix LED Display will show the IP Address after a successful connection.&nbsp;</span></p><p style="color:inherit;"><span style="font-size:12pt;"><span style="width:624px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<img src="https://lh7-us.googleusercontent.com/-yMQp1PMznXduGon-vgALUK15lnxYv1Ei6iEs0VGLMBwMBJfW23e36Ek4DI0kMJuDnfm04TOx2dda7wvv7T-WAduB0qOPCck18qrSYJgFGllW7lJW2AVzY1_i_ikBwvQvQO6UtuFzEvYsawOMZPcXQ" width="624" height="182"></span></span></p><p style="color:inherit;"><span style="font-size:12pt;"><br></span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">Open your Web Browser and enter the IP Address. The browser will display the following page.</span></p><p style="color:inherit;"><span style="font-size:12pt;"><span style="width:624px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<img src="https://lh7-us.googleusercontent.com/ZA_NBpDkUK49cJmKBWQ97FxA8j5s4uGpFywB35M4XX3MkNeci6mueaKfttuWUI8jwORKjsk2W9RhcsQ02pMhSrKrrsy3w0yu6WssY0HIJSVHxCdwRc0BbX-szFJFmZHXHomz7Yk4_5AG_5f1E2zwKw" width="624" height="341"></span></span></p><p style="color:inherit;"><span style="font-size:12pt;"><br></span></p><p><span style="font-size:12pt;color:rgb(0, 0, 0);">From the Web Page enter any message that you want to display on DoT Matrix Display as a Notice. Then hit the send button. The Dot Matrix will show the new message in a few seconds.</span></p><p style="color:inherit;"><span style="font-size:12pt;"><span style="width:624px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<img src="https://lh7-us.googleusercontent.com/GwHRnRJtuds-kcx3QGTYqANuOUD_KGlBxJT4d6wuXK9RclLeNfVX8ARqMG1ESVfEN390I2i7efV_YlRmD8HMctRTzQrMXOYAtq4eluiW6PMGfhdzkBpRC3pN-a9qQ5wUWkKaIMbIvScn0OQ860AlYQ" width="624" height="202"></span></span></p><h2 style="margin-bottom:6pt;"><span style="font-size:16pt;font-weight:400;color:rgb(0, 0, 0);">Conclusion</span></h2><p><span style="font-size:12pt;color:rgb(0, 0, 0);">In conclusion, building a Smart Notice Board with ESP32-C6 and dot matrix LED display opens up new ways for dynamic communication. This tutorial empowers enthusiasts to work on this exciting project, combining hardware, programming, and creativity. Elevate your notice board game and embrace the future of interactive communication.&nbsp;</span></p><span style="color:rgb(0, 0, 0);"><br></span><p><span style="color:rgb(0, 0, 0);"><span style="font-size:12pt;">If you are looking for different types of DOT matrix, LED display or </span><a href="https://www.campuscomponent.com/categories/lcd_led_display/2208614000002321137"><span style="font-size:12pt;">LCD display</span></a><span style="font-size:12pt;"> and electronic components and different microcontrollers from Espressif, </span><a href="https://www.campuscomponent.com/brand-details/arduino"><span style="font-size:12pt;">Arduino</span></a><span style="font-size:12pt;">, and many more, reach out to </span><a href="https://www.campuscomponent.com/"><span style="font-size:12pt;">electronics components suppliers in india</span></a><span style="font-size:12pt;"> - Campus Component&nbsp;today!&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span></span></p></div></td><td style="vertical-align:top;"><br></td></tr></tbody></table></div>
</div></div><div data-element-id="elm_mey0XdRHSS62c4qNteKmQw" data-element-type="button" class="zpelement zpelem-button "><style> [data-element-id="elm_mey0XdRHSS62c4qNteKmQw"].zpelem-button{ border-radius:1px; } </style><div class="zpbutton-container zpbutton-align-center"><style type="text/css"></style><a role="button" class="zpbutton-wrapper zpbutton zpbutton-type-primary zpbutton-size-md zpbutton-style-none " href="https://www.campuscomponent.com/categories/wifi_module/2208614000002321101" target="_blank"><span class="zpbutton-content">Get Started Now</span></a></div>
</div></div></div></div></div></div> ]]></content:encoded><pubDate>Fri, 22 Dec 2023 06:36:14 +0000</pubDate></item></channel></rss>