<?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: QuecPython</title>
    <description>The latest articles on DEV Community by QuecPython (@quecpython).</description>
    <link>https://dev.to/quecpython</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3863424%2Fc87ebe15-e9c2-4be7-872c-2ac9b21acfd4.png</url>
      <title>DEV Community: QuecPython</title>
      <link>https://dev.to/quecpython</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/quecpython"/>
    <language>en</language>
    <item>
      <title>QuecPython + sms: SMS Functionality</title>
      <dc:creator>QuecPython</dc:creator>
      <pubDate>Fri, 24 Apr 2026 12:35:41 +0000</pubDate>
      <link>https://dev.to/quecpython/quecpython-sms-sms-functionality-58e5</link>
      <guid>https://dev.to/quecpython/quecpython-sms-sms-functionality-58e5</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;Overview&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;With the encapsulation capability of QuecPython, developers can quickly implement SMS sending and receiving functions without dealing with complex AT commands. In the REPL interactive environment, SMS sending can be completed with just one line of code, making IoT communication development more efficient!&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Core Advantages&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Minimalist Call: Send SMS directly with sms.sendTextMsg("xxxxxxxxxxx", "HelloQuecPython!")&lt;/li&gt;
&lt;li&gt;Instant Send and Test: Real-time execution in the REPL environment for quick verification of SMS functions&lt;/li&gt;
&lt;li&gt;Full Support: Easily implement SMS sending, receiving, deletion and other operations&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Function Introduction&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Send SMS&lt;/strong&gt;
&lt;/h3&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;TEXT Message&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;This method is used to send TEXT type messages (empty SMS is not supported).&lt;/p&gt;

&lt;p&gt;sms.sendTextMsg(phoneNumber, msg, codeMode)&lt;/p&gt;

&lt;p&gt;For API details, please refer to sms.sendTextMsg.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;PDU Message&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;This method is used to send PDU type messages (empty SMS is not supported).&lt;/p&gt;

&lt;p&gt;sms.sendPduMsg(phoneNumber, msg, codeMode)&lt;/p&gt;

&lt;p&gt;For API details, please refer to sms.sendPduMsg.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Delete SMS&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;This method is used to delete the message at the specified index.&lt;/p&gt;

&lt;p&gt;sms.deleteMsg(index [, delmode])&lt;/p&gt;

&lt;p&gt;For API details, please refer to sms.deleteMsg.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Get SMS Quantity&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;This method is used to get the number of SMS messages.&lt;/p&gt;

&lt;p&gt;sms.getMsgNums()&lt;/p&gt;

&lt;p&gt;For API details, please refer to sms.getMsgNums.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Get SMS Content&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;TEXT Mode&lt;/p&gt;

&lt;p&gt;This method is used to get SMS content in TEXT mode.&lt;/p&gt;

&lt;p&gt;sms.searchTextMsg(index)&lt;/p&gt;

&lt;p&gt;For API details, please refer to sms.searchTextMsg.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;PDU Mode&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This method is used to get SMS content in PDU mode.&lt;/p&gt;

&lt;p&gt;sms.searchPduMsg(index)&lt;/p&gt;

&lt;p&gt;For API details, please refer to sms.searchPduMsg.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;SMS Decoding&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Length Decoding&lt;/p&gt;

&lt;p&gt;This method is used to get the length of the specified PDU SMS.&lt;/p&gt;

&lt;p&gt;sms.getPduLength(pduMsg)&lt;/p&gt;

&lt;p&gt;For API details, please refer to sms.getPduLength.&lt;/p&gt;

&lt;p&gt;Content Decoding&lt;/p&gt;

&lt;p&gt;This method is used for PDU decoding, which parses the PDU data read by the sms.searchPduMsg() interface.&lt;/p&gt;

&lt;p&gt;sms.decodePdu(pduMsg, pduLen)&lt;/p&gt;

&lt;p&gt;For API details, please refer to sms.decodePdu.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;## Application Example&lt;/strong&gt;&lt;br&gt;
Use the SMS function of the QuecPython series development board to send and receive SMS with a mobile phone.&lt;/p&gt;

&lt;p&gt;import sms&lt;/p&gt;

&lt;p&gt;sms.deleteMsg(1,4) # Delete all SMS messages&lt;/p&gt;

&lt;h1&gt;
  
  
  Fill in the correct phone number
&lt;/h1&gt;

&lt;p&gt;sms.sendTextMsg('xxxxxxxxxxx', 'Hello, world.', 'GSM') # Send SMS to the mobile phone&lt;/p&gt;

&lt;h1&gt;
  
  
  Get SMS content in TEXT mode
&lt;/h1&gt;

&lt;p&gt;sms.searchTextMsg(0) # Receive SMS sent by the mobile phone&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%2Fzwn9ysqxh786621n8e7e.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%2Fzwn9ysqxh786621n8e7e.png" alt=" " width="621" height="563"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>micropython</category>
      <category>sms</category>
    </item>
    <item>
      <title>QuecPython + GNSS: Implement Fast Positioning</title>
      <dc:creator>QuecPython</dc:creator>
      <pubDate>Fri, 24 Apr 2026 12:32:32 +0000</pubDate>
      <link>https://dev.to/quecpython/quecpython-gnss-implement-fast-positioning-12c1</link>
      <guid>https://dev.to/quecpython/quecpython-gnss-implement-fast-positioning-12c1</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;Overview&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;QuecPython, combined with a GNSS (Global Navigation Satellite System) module, provides an out-of-the-box positioning capability solution for IoT devices. This solution supports multi-constellation joint positioning including GPS, BeiDou, GLONASS and Galileo, and delivers a full-stack positioning solution from hardware access to cloud services for IoT developers.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Advantages and Features&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Multi-mode Positioning: Supports GNSS, LBS and Wi-Fi positioning functions&lt;br&gt;
Minimalist Development: Highly encapsulated API interfaces, no need to write underlying drivers&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Functional Overview&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;This article mainly describes how to use the built-in GNSS function of the QuecPython development board to obtain positioning information. The typical programming workflow is divided into the following parts:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;GNSS Initialization&lt;/li&gt;
&lt;li&gt;Positioning Data Acquisition&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;GNSS Initialization&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;This method is used to initialize the function of the module's built-in GNSS module.&lt;/p&gt;

&lt;p&gt;quecgnss.init()&lt;/p&gt;

&lt;p&gt;For API details, please refer to quecgnss.init.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Positioning Data Acquisition&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;This method is used to read GNSS positioning data.&lt;/p&gt;

&lt;p&gt;quecgnss.read(size)&lt;/p&gt;

&lt;p&gt;For API details, please refer to quecgnss.read.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Parameter Configuration&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;This method is used to set GNSS parameters, including satellite constellation, NMEA sentence type, whether to enable AGNSS and APFLASH, etc.&lt;/p&gt;

&lt;p&gt;quecgnss.configSet(config_type, config_value)&lt;/p&gt;

&lt;p&gt;For API details, please refer to quecgnss.configSet.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Sample Code&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;import quecgnss&lt;/p&gt;

&lt;h1&gt;
  
  
  Initialization
&lt;/h1&gt;

&lt;p&gt;quecgnss.init()&lt;/p&gt;

&lt;h1&gt;
  
  
  Read data
&lt;/h1&gt;

&lt;p&gt;data = quecgnss.read(4096)&lt;/p&gt;

&lt;h1&gt;
  
  
  Print data
&lt;/h1&gt;

&lt;p&gt;print(data[1].decode())&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Operation Result&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The following is an example of the operation result, which mainly introduces the content of the positioning data.&lt;/p&gt;

&lt;h1&gt;
  
  
  Operation Result
&lt;/h1&gt;

&lt;p&gt;167,169,170,,,,,,,,1.773,1.013,1.455*15&lt;/p&gt;

&lt;p&gt;$GPGSV,2,1,8,3,23,303,34,16,32,219,28,22,74,98,26,25,16,43,25*77&lt;/p&gt;

&lt;p&gt;$GPGSV,2,2,8,26,70,236,28,31,59,12,38,32,55,127,34,4,5,,21*49&lt;/p&gt;

&lt;p&gt;$BDGSV,2,1,8,163,51,192,32,166,70,11,31,167,52,197,32,169,59,334,31*61&lt;/p&gt;

&lt;p&gt;$BDGSV,2,2,8,170,40,205,31,161,5,,31,164,5,,27,165,5,,29*59&lt;/p&gt;

&lt;p&gt;$GNRMC,022326.000,A,3149.324624,N,11706.921702,E,0.000,261.541,180222,,E,A*38&lt;/p&gt;

&lt;p&gt;$GNGGA,022326.000,3149.324624,N,11706.921702,E,1,12,1.013,-8.580,M,0,M,,*47&lt;/p&gt;

&lt;p&gt;$GNGLL,3149.324624,N,11706.921702,E,022326.000,A,A*44&lt;/p&gt;

&lt;p&gt;$GNGSA,A,3,31,32,3,16,22,25,26,,,,,,1.773,1.013,1.455*1C&lt;/p&gt;

&lt;p&gt;$GNGSA,A,3,163,166,167,169,170,,,,,,,,1.773,1.013,1.455*15&lt;/p&gt;

&lt;p&gt;$GPGSV,2,1,8,3,23,303,34,16,32,219,27,22,74,98,26,25,16,43,25*78&lt;/p&gt;

&lt;p&gt;$GPGSV,2,2,8,26,70,236,28,31,59,12,37,32,55,127,34,4,5,,20*47&lt;/p&gt;

&lt;p&gt;$BDGSV,2,1,8,163,51,192,32,166,70,11,31,167,52,197,32,169,59,334,31*61&lt;/p&gt;

&lt;p&gt;$BDGSV,2,2,8,170,40,205,31,161,5,,31,164,5,,27,165,5,,29*59&lt;/p&gt;

&lt;p&gt;$GNRMC,022327.000,A,3149.324611,N,11706.921713,E,0.000,261.541,180222,,E,A*3F&lt;/p&gt;

&lt;p&gt;$GNGGA,022327.000,3149.324611,N,11706.921713,E,1,12,1.013,-8.577,M,0,M,,*48&lt;/p&gt;

&lt;p&gt;$GNGLL,3149.324611,N,11706.921713,E,022327.000,A,A*43&lt;/p&gt;

&lt;p&gt;...... # More data omitted&lt;/p&gt;

&lt;p&gt;$GNGSA,A,3,31,32,3,16,22,25,26,,,,,,1.837,1.120,1.456*11&lt;/p&gt;

&lt;p&gt;$GNGSA,A,3,163,166,167,169,170,,,,,,,,1.837,1.120,1.456*18&lt;/p&gt;

&lt;p&gt;$GPGSV,2,1,8,3,23,302,27,16,32,220,26,22,73,101,27,25,16,43,27*45&lt;/p&gt;

&lt;p&gt;$GPGSV,2,2,8,26,70,237,28,31,59,13,33,32,54,128,28,4,5,,24*44&lt;/p&gt;

&lt;p&gt;$BDGSV,2,1,8,163,51,192,33,166,71,11,35,167,52,198,33,169,59,334,34*6E&lt;/p&gt;

&lt;p&gt;$BDGSV,2,2,8,170,40,205,32,161,5,,33,164,5,,28,165,5,,30*5F&lt;/p&gt;

&lt;p&gt;$GNRMC,022507.000,A,3149.324768,N,11706.922344,E,0.000,261.541,180222,,E,A*31&lt;/p&gt;

&lt;p&gt;$GNGGA,022507.000,3149.324768,N,11706.922344,E,1,12,1.120,-8.794,M,0,M,,*48&lt;/p&gt;

&lt;p&gt;$GNGLL,3149.324768,N,11706.922344,E,022507.000,A,A*4D&lt;/p&gt;

&lt;p&gt;$GNGSA,A,3,31,32,3,16,22,25,26,,,,,,1.837,1.120,1.455*12&lt;/p&gt;

&lt;p&gt;$GNGSA,A,3,163,166,167,169,170,,,,,,,,1.837,1.120,1.455*1B&lt;/p&gt;

&lt;p&gt;$GPGSV,2,1,8,3,23,302,26,16,32,220,26,22,73,101,27,25,16,43,26*45&lt;/p&gt;

&lt;p&gt;$GPGSV,2,2,8,26,70,237,28,31,59,13,32,32,54,128,28,4,5,,24*45&lt;/p&gt;

&lt;p&gt;$BDGSV,2,1,8,163,51,192,24,166,71,11,35,167,52,198,33,169,59,334,34*68&lt;/p&gt;

&lt;p&gt;$BDGSV,2,2,8,170,40,205,31,161,5,,33,164,5,,28,165,5,,30*5C&lt;/p&gt;

&lt;p&gt;$GNRMC,022508.000,A,3149.324754,N,11706.922338,E,0.002,261.541,180222,,E,A*38&lt;/p&gt;

&lt;p&gt;$GNGGA,022508.000,3149.324754,N,11706.922338,E,1,12,1.120,-8.750,M,0,M,,*4B&lt;/p&gt;

&lt;p&gt;$GNGLL,3149.324754,N,11706.922338,E,022508.000,A,A*46&lt;/p&gt;

&lt;p&gt;$GNGSA,A,3,31,3&lt;/p&gt;

&lt;h1&gt;
  
  
  Data Introduction
&lt;/h1&gt;

&lt;p&gt;NMEA Port Data Classification:&lt;/p&gt;

&lt;p&gt;$GPGGA Global Positioning System Fix Data&lt;/p&gt;

&lt;p&gt;$GPGSA GNSS DOP and Active Satellites&lt;/p&gt;

&lt;p&gt;$GPGSV GNSS Satellites in View&lt;/p&gt;

&lt;p&gt;$GPRMC Recommended Minimum Specific GNSS Data&lt;/p&gt;

&lt;p&gt;$GPVTG Course Over Ground and Ground Speed&lt;/p&gt;

&lt;p&gt;$GPDTM Datum Reference&lt;/p&gt;

&lt;p&gt;$GPGNS GNSS Fix Data&lt;/p&gt;

&lt;p&gt;NMEA Sentence Parsing:&lt;/p&gt;

&lt;p&gt;Basic format of the GSV sentence:&lt;/p&gt;

&lt;p&gt;$GPGSV,(1),(2),(3),(4),(5),(6),(7),...,(4),(5),(6),(7)*hh(CR)(LF)&lt;/p&gt;

&lt;p&gt;Field 1: Total number of GSV sentences&lt;/p&gt;

&lt;p&gt;Field 2: Sequence number of this GSV sentence&lt;/p&gt;

&lt;p&gt;Field 3: Total number of visible satellites (00~12, leading 0 will be transmitted)&lt;/p&gt;

&lt;p&gt;Field 4: Satellite PRN number (01~32, leading 0 will be transmitted)&lt;/p&gt;

&lt;p&gt;Field 5: Satellite elevation (00~90 degrees, leading 0 will be transmitted)&lt;/p&gt;

&lt;p&gt;Field 6: Satellite azimuth (000~359 degrees, leading 0 will be transmitted)&lt;/p&gt;

&lt;p&gt;Field 7: Signal-to-Noise Ratio (00~99dB, empty when no satellite is tracked) (commonly known as CN value)&lt;/p&gt;

&lt;p&gt;Basic format of the GGA sentence:&lt;/p&gt;

&lt;p&gt;$GPGGA,(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12)*hh(CR)(LF)&lt;/p&gt;

&lt;p&gt;Field 1: UTC time, in hhmmss.sss format (hours, minutes and seconds)&lt;/p&gt;

&lt;p&gt;Field 2: Latitude, in ddmm.mmmm format (degrees and minutes, padded with 0 if leading digits are insufficient)&lt;/p&gt;

&lt;p&gt;Field 3: Latitude hemisphere, N (North) or S (South)&lt;/p&gt;

&lt;p&gt;Field 4: Longitude, in dddmm.mmmm format (degrees and minutes, padded with 0 if leading digits are insufficient)&lt;/p&gt;

&lt;p&gt;Field 5: Longitude hemisphere, E (East) or W (West)&lt;/p&gt;

&lt;p&gt;Field 6: GPS status, 0=No fix, 1=Non-differential fix, 2=Differential fix, 3=Invalid PPS, 6=Estimating&lt;/p&gt;

&lt;p&gt;Field 7: Number of satellites in use (00 - 12, padded with 0 if leading digits are insufficient)&lt;/p&gt;

&lt;p&gt;Field 8: HDOP (Horizontal Dilution of Precision) (0.5 - 99.9)&lt;/p&gt;

&lt;p&gt;Field 9: Altitude above mean sea level (-9999.9 - 99999.9)&lt;/p&gt;

&lt;p&gt;Field 10: Unit of altitude, meters&lt;/p&gt;

&lt;p&gt;Field 11: Geoidal separation (Height of the geoid above the WGS84 ellipsoid)&lt;/p&gt;

&lt;p&gt;Field 12: Unit of geoidal separation, meters&lt;/p&gt;

&lt;p&gt;Basic format of the GSA sentence:&lt;/p&gt;

&lt;p&gt;$GPGSA,(1),(2),(3),(3),,,,,,,,,,(3),(4),(5),(6),(7)*hh(CR)(LF)&lt;/p&gt;

&lt;p&gt;Field 1: Positioning mode, A=Automatic 2D/3D, M=Manual 2D/3D&lt;/p&gt;

&lt;p&gt;Field 2: Fix type, 1=No fix, 2=2D fix, 3=3D fix&lt;/p&gt;

&lt;p&gt;Field 3: PRN (Pseudo Random Noise) code of the satellite in use (up to 12 entries, padded with 0 if leading digits are insufficient)&lt;/p&gt;

&lt;p&gt;Field 4: PDOP (Position Dilution of Precision) (0.0 - 500.0)&lt;/p&gt;

&lt;p&gt;Field 5: HDOP (Horizontal Dilution of Precision) (0.0 - 500.0)&lt;/p&gt;

&lt;p&gt;Field 6: VDOP (Vertical Dilution of Precision) (0.0 - 500.0)&lt;/p&gt;

&lt;p&gt;Field 7: Satellite system ID&lt;/p&gt;

&lt;p&gt;Basic format of the VTG sentence:&lt;/p&gt;

&lt;p&gt;$GPVTG,(1),(2),(3),(4),(5),(6),(7),(8),(9)*hh(CR)(LF)&lt;/p&gt;

&lt;p&gt;Field 1: Course over ground (000 - 359 degrees, padded with 0 if leading digits are insufficient)&lt;/p&gt;

&lt;p&gt;Field 2: T=True north reference&lt;/p&gt;

&lt;p&gt;Field 3: Course over ground (000 - 359 degrees, padded with 0 if leading digits are insufficient)&lt;/p&gt;

&lt;p&gt;Field 4: M=Magnetic north reference&lt;/p&gt;

&lt;p&gt;Field 5: Ground speed (0.00, padded with 0 if leading digits are insufficient)&lt;/p&gt;

&lt;p&gt;Field 6: N=Knots&lt;/p&gt;

&lt;p&gt;Field 7: Ground speed (0.00, padded with 0 if leading digits are insufficient)&lt;/p&gt;

&lt;p&gt;Field 8: K=Kilometers per hour (km/h)&lt;/p&gt;

&lt;p&gt;Field 9: Status indicator, E(Dead reckoning), A(Non-DGPS fix)&lt;/p&gt;

&lt;p&gt;Basic format of the RMC sentence:&lt;/p&gt;

&lt;p&gt;$GPRMC,(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13)*hh(CR)(LF)&lt;/p&gt;

&lt;p&gt;Field 1: UTC time, in hhmmss.sss format&lt;/p&gt;

&lt;p&gt;Field 2: Status, A=Valid fix, V=Invalid fix&lt;/p&gt;

&lt;p&gt;Field 3: Latitude, in ddmm.mmmm format (padded with 0 if leading digits are insufficient)&lt;/p&gt;

&lt;p&gt;Field 4: Latitude hemisphere, N (North) or S (South)&lt;/p&gt;

&lt;p&gt;Field 5: Longitude, in dddmm.mmmm format (padded with 0 if leading digits are insufficient)&lt;/p&gt;

&lt;p&gt;Field 6: Longitude hemisphere, E (East) or W (West)&lt;/p&gt;

&lt;p&gt;Field 7: Speed over ground, in Knots&lt;/p&gt;

&lt;p&gt;Field 8: Course over ground, in degrees&lt;/p&gt;

&lt;p&gt;Field 9: UTC date, in DDMMYY format&lt;/p&gt;

&lt;p&gt;Field 10: Magnetic variation (000 - 180 degrees, padded with 0 if leading digits are insufficient)&lt;/p&gt;

&lt;p&gt;Field 11: Magnetic variation direction, E=East, W=West&lt;/p&gt;

&lt;p&gt;Field 12: Status indicator, E(Dead reckoning), A(Non-DGPS fix)&lt;/p&gt;

&lt;p&gt;Field 13: Navigation status, V=Navigation status not available&lt;/p&gt;

&lt;p&gt;Basic format of the DTM sentence:&lt;/p&gt;

&lt;p&gt;$GNDTM,&amp;lt;1&amp;gt;,&amp;lt;2&amp;gt;,&amp;lt;3&amp;gt;,&amp;lt;4&amp;gt;,&amp;lt;5&amp;gt;,&amp;lt;6&amp;gt;,&amp;lt;7&amp;gt;,&amp;lt;8&amp;gt;*&amp;lt;9&amp;gt;(CR)(LF)&lt;/p&gt;

&lt;p&gt;&amp;lt;1&amp;gt; Local datum code (e.g. W84, P90)&lt;/p&gt;

&lt;p&gt;&amp;lt;2&amp;gt; Datum subcode (empty)&lt;/p&gt;

&lt;p&gt;&amp;lt;3&amp;gt; Latitude offset&lt;/p&gt;

&lt;p&gt;&amp;lt;4&amp;gt; Latitude hemisphere, N (North) or S (South)&lt;/p&gt;

&lt;p&gt;&amp;lt;5&amp;gt; Longitude offset&lt;/p&gt;

&lt;p&gt;&amp;lt;6&amp;gt; Longitude hemisphere, E (East) or W (West)&lt;/p&gt;

&lt;p&gt;&amp;lt;7&amp;gt; Altitude offset&lt;/p&gt;

&lt;p&gt;&amp;lt;8&amp;gt; Reference datum code (W84)&lt;/p&gt;

&lt;p&gt;&amp;lt;9&amp;gt; Checksum&lt;/p&gt;

&lt;p&gt;Basic format of the GNS sentence:&lt;/p&gt;

&lt;p&gt;$GNGNS,&amp;lt;1&amp;gt;,&amp;lt;2&amp;gt;,&amp;lt;3&amp;gt;,&amp;lt;4&amp;gt;,&amp;lt;5&amp;gt;,&amp;lt;6&amp;gt;,&amp;lt;7&amp;gt;,&amp;lt;8&amp;gt;.&amp;lt;9&amp;gt;,&amp;lt;10&amp;gt;,&amp;lt;11&amp;gt;,&amp;lt;12&amp;gt;,&amp;lt;13&amp;gt;,*&amp;lt;14&amp;gt;(CR)(LF)&lt;/p&gt;

&lt;p&gt;&amp;lt;1&amp;gt; UTC time: Fix time in hhmmss.ss format (000000.00~235959.99)&lt;/p&gt;

&lt;p&gt;&amp;lt;2&amp;gt; Latitude: in ddmm.mmmmm format (0000.00000~8959.9999)&lt;/p&gt;

&lt;p&gt;&amp;lt;3&amp;gt; Latitude hemisphere: N for North, S for South&lt;/p&gt;

&lt;p&gt;&amp;lt;4&amp;gt; Longitude: in dddmm.mmmmm format (0000.00000~17959.99999)&lt;/p&gt;

&lt;p&gt;&amp;lt;5&amp;gt; Longitude hemisphere: E for East, W for West&lt;/p&gt;

&lt;p&gt;&amp;lt;6&amp;gt; Positioning mode: N=No fix; A=Autonomous fix; D=Differential fix; P=Precise point positioning; R=RTK fixed; F=RTK float; E=Estimated; M=Manual input; S=Simulated&lt;/p&gt;

&lt;p&gt;&amp;lt;7&amp;gt; Number of satellites used in positioning (00-99)&lt;/p&gt;

&lt;p&gt;&amp;lt;8&amp;gt; HDOP (Horizontal Dilution of Precision) (0.5-99.9)&lt;/p&gt;

&lt;p&gt;&amp;lt;9&amp;gt; Altitude above mean sea level, unit: meters&lt;/p&gt;

&lt;p&gt;&amp;lt;10&amp;gt; Geoidal separation: Height of the geoid above the WGS84 ellipsoid&lt;/p&gt;

&lt;p&gt;&amp;lt;11&amp;gt; Age of differential data: Empty for GN-prefixed sentences&lt;/p&gt;

&lt;p&gt;&amp;lt;12&amp;gt; Base station ID: Empty for GN-prefixed sentences&lt;/p&gt;

&lt;p&gt;&amp;lt;13&amp;gt; Navigation status: C=Caution, S=Safe, U=Unsafe, V=Invalid&lt;/p&gt;

&lt;p&gt;&amp;lt;14&amp;gt; Checksum&lt;/p&gt;

</description>
      <category>python</category>
      <category>micropython</category>
      <category>gnss</category>
    </item>
    <item>
      <title>QuecPython + audio: Implement Audio Recording and Playback</title>
      <dc:creator>QuecPython</dc:creator>
      <pubDate>Fri, 24 Apr 2026 12:29:57 +0000</pubDate>
      <link>https://dev.to/quecpython/quecpython-audio-implement-audio-recording-and-playback-2a6e</link>
      <guid>https://dev.to/quecpython/quecpython-audio-implement-audio-recording-and-playback-2a6e</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;Overview&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;As a development framework designed specifically for the Internet of Things, QuecPython provides complete audio processing capabilities for embedded devices through highly encapsulated Python interfaces. This article mainly describes how to quickly implement audio function development with QuecPython.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Core Advantages&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;• Minimalist Development: Complete basic audio recording and playback with just 3 lines of code.&lt;/p&gt;

&lt;p&gt;• Quick Start: Get started rapidly without professional audio knowledge.&lt;/p&gt;

&lt;p&gt;• Complete Documentation: Supported by full technical documentation and sample code.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Main Functions&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;TTS - Text to Speech Playback&lt;/strong&gt;
&lt;/h3&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Create TTS Object&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;class audio.TTS(device)&lt;/p&gt;

&lt;p&gt;For parameter details, please refer to audio.TTS.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Speech Playback&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;This method is used to start speech playback.&lt;/p&gt;

&lt;p&gt;TTS.play(priority, breakin, mode, str)&lt;/p&gt;

&lt;p&gt;For API details, please refer to TTS.play.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Volume Setting&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;This method is used to set the playback volume. The volume value must be in the range [0 ~ 9], where 0 means mute.&lt;/p&gt;

&lt;p&gt;TTS.setVolume(vol)&lt;/p&gt;

&lt;p&gt;For API details, please refer to TTS.setVolume.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Playback Speed Setting&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;This method is used to set the TTS playback speed. The speed value must be in the range [0 ~ 9].&lt;/p&gt;

&lt;p&gt;TTS.setSpeed(speed)&lt;/p&gt;

&lt;p&gt;For API details, please refer to TTS.setSpeed.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Sample Code&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;import audio tts = audio.TTS(1) # Case: Task A is playing and allows interruption. When Task B with a higher priority arrives, Task A will be interrupted and Task B will be played directly tts.play(1, 1, 2, '111')  # Task A tts.play(2, 0, 2, '222')  # Task B&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Audio - Audio Playback&lt;/strong&gt;
&lt;/h3&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Create Audio Object&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;class audio.Audio(device)&lt;/p&gt;

&lt;p&gt;For parameter details, please refer to audio.Audio.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Set PA Pin&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;This method is used to configure the GPIO of the output PA. Refer to the schematic of the corresponding development board to set the PA pin, so that the SPK interface of the development board can output sound.&lt;/p&gt;

&lt;p&gt;Audio.set_pa(gpio,num)&lt;/p&gt;

&lt;p&gt;For API details, please refer to Audio.set_pa.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Audio Playback&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;This method is used to play audio files, supporting playback of files in mp3, amr and wav formats.&lt;/p&gt;

&lt;p&gt;Audio.play(priority, breakin, filename)&lt;/p&gt;

&lt;p&gt;For API details, please refer to Audio.play.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Volume Setting&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;This method is used to set the playback volume. The volume value must be in the range [0 ~ 11], where 0 means mute.&lt;/p&gt;

&lt;p&gt;Audio.setVolume(vol)&lt;/p&gt;

&lt;p&gt;For API details, please refer to Audio.setVolume.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Audio Stream Playback&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;This method is used for audio stream playback, supporting playback of audio streams in mp3, amr and wav formats.&lt;/p&gt;

&lt;p&gt;Audio.playStream(format, buf)&lt;/p&gt;

&lt;p&gt;For API details, please refer to Audio.playStream.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Sample Code&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;import audio from machine import Pin aud = audio.Audio(0) # Set PA pin aud.set_pa(Pin.GPIO15,2) # Play MP3 file aud.play(2, 1, 'U:/music.mp3')&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Record - Audio Recording&lt;/strong&gt;
&lt;/h3&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Create Record Object&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;class audio.Record(device)&lt;/p&gt;

&lt;p&gt;For parameter details, please refer to audio.Record.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Start Recording&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;This method is used to start audio recording.&lt;/p&gt;

&lt;p&gt;Record.start(file_name,seconds)&lt;/p&gt;

&lt;p&gt;For API details, please refer to Record.start.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Audio Stream Recording&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;This method is used to start audio stream recording.&lt;/p&gt;

&lt;p&gt;Note: While recording the audio stream, you must read the audio stream in a timely manner. A circular buffer is currently used, and failure to read in time will result in data loss.&lt;/p&gt;

&lt;p&gt;Record.stream_start(format, samplerate, time)&lt;/p&gt;

&lt;p&gt;For API details, please refer to Record.stream_start.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Sample Code&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;import audio record = audio.Record() record.start('recordfile.wav', 10)&lt;/p&gt;

</description>
      <category>python</category>
      <category>micropython</category>
      <category>audio</category>
    </item>
    <item>
      <title>QuecPython + camera: Implement QR Code/Barcode Scanning and Photo Capture</title>
      <dc:creator>QuecPython</dc:creator>
      <pubDate>Fri, 24 Apr 2026 12:22:56 +0000</pubDate>
      <link>https://dev.to/quecpython/quecpython-camera-implement-qr-codebarcode-scanning-and-photo-capture-45bf</link>
      <guid>https://dev.to/quecpython/quecpython-camera-implement-qr-codebarcode-scanning-and-photo-capture-45bf</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;Overview&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;With a QuecPython development board paired with a camera module, developers can easily implement code scanning (QR code/barcode recognition) and photo capture functions, which are applicable to scenarios such as smart access control, industrial inspection, and mobile payment.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Core Features&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Minimalist Development Experience: No need to write underlying drivers, complete photo capture with just 3 lines of code.&lt;/p&gt;

&lt;p&gt;Plug and Play: Supports common camera modules (such as GC032A).&lt;/p&gt;

&lt;p&gt;Cross-platform Compatibility: Code can be ported to other QuecPython development boards that support camera functions.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Working Mode&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Note: The LCD must be initialized before using the camera function.&lt;/p&gt;

&lt;p&gt;For the LCD initialization program, please refer to: &lt;a href="https://github.com/QuecPython/QuecPython_lib_bundles/tree/master/libraries/LCD" rel="noopener noreferrer"&gt;https://github.com/QuecPython/QuecPython_lib_bundles/tree/master/libraries/LCD&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Camera Preview&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Create Camera Preview Object&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%2Fqwrsmzbfbc3yu891t9v7.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%2Fqwrsmzbfbc3yu891t9v7.png" alt=" " width="626" height="28"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For parameter details, please refer to camera.camPreview.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Enable Camera Preview Function&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;This method is used to turn on the preview function of the camera.&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%2Fs4hd7rn3pft3pqsgvl0p.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%2Fs4hd7rn3pft3pqsgvl0p.png" alt=" " width="631" height="38"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Disable Camera Preview Function&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;This method is used to turn off the preview function of the camera.&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%2Fcjghst3nmqjbwqij7opp.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%2Fcjghst3nmqjbwqij7opp.png" alt=" " width="616" height="38"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For API details, please refer to camPreview.close.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Sample Code&lt;/strong&gt;
&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%2Ftdkl4qcmt4captxvhk94.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%2Ftdkl4qcmt4captxvhk94.png" alt=" " width="749" height="100"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Camera Code Scanning&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Create Camera Code Scanning Object&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%2F926vng6cgg7rf5tcinsm.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%2F926vng6cgg7rf5tcinsm.png" alt=" " width="611" height="58"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For parameter details, please refer to camera.camScandecode.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Enable Camera Code Scanning Function&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;This method is used to enable the code scanning function of the camera.&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%2Frlk9wtlrrlf7iwnys9np.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%2Frlk9wtlrrlf7iwnys9np.png" alt=" " width="601" height="38"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For API details, please refer to camScandecode.start.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Sample Code&lt;/strong&gt;
&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%2Fm9uu5j3uuwgue2o8d7my.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%2Fm9uu5j3uuwgue2o8d7my.png" alt=" " width="630" height="235"&gt;&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%2Fi46l6032dlkiup2w2b6k.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%2Fi46l6032dlkiup2w2b6k.png" alt=" " width="628" height="453"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Camera Photo Capture&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Create Camera Photo Capture Object&lt;/strong&gt;
&lt;/h3&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%2Fbf0xycb41w8waf8hvhr2.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%2Fbf0xycb41w8waf8hvhr2.png" alt=" " width="747" height="53"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For parameter details, please refer to camera.camCapture.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Enable Camera Photo Capture Function&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;This method is used to enable the photo capture function of the camera.&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%2F05t6qrpmfpfm19nrif2l.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%2F05t6qrpmfpfm19nrif2l.png" alt=" " width="751" height="50"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Start Photo Capture&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;This method is used to start photo capture and save the image 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%2Fpgbf6i0ddfkcts9fxb4w.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%2Fpgbf6i0ddfkcts9fxb4w.png" alt=" " width="759" height="55"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note: There is a typo camCapture in the original text, the standard API name is camCapture.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Sample Code&lt;/strong&gt;
&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%2F5xrl14izy6jt5iuovt9w.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%2F5xrl14izy6jt5iuovt9w.png" alt=" " width="747" height="115"&gt;&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%2Fwsoclo3l0781rxab8bs6.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%2Fwsoclo3l0781rxab8bs6.png" alt=" " width="756" height="557"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>micropython</category>
      <category>qrcode</category>
      <category>barcode</category>
    </item>
    <item>
      <title>QuecPython + USBNET: Implement USB Network Adapter Functionality</title>
      <dc:creator>QuecPython</dc:creator>
      <pubDate>Fri, 24 Apr 2026 12:14:42 +0000</pubDate>
      <link>https://dev.to/quecpython/quecpython-usbnet-implement-usb-network-adapter-functionality-1ocb</link>
      <guid>https://dev.to/quecpython/quecpython-usbnet-implement-usb-network-adapter-functionality-1ocb</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;USBNET Overview&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;USBNET (USB Networking) is a technology that enables network communication via a USB interface. It allows devices to emulate Ethernet over a USB connection (Ethernet over USB) or directly transmit network data through USB links. It is widely used in scenarios such as embedded devices, industrial control, virtual machines, and portable devices.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Core Features of USBNET&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;USB Interface Based: Implements network communication using the USB physical layer, eliminating the need for traditional network cables (such as RJ45).&lt;/p&gt;

&lt;p&gt;High-Speed Transmission: Supports USB 2.0 (480 Mbps), USB 3.0 (5 Gbps), and even USB4 (40 Gbps).&lt;/p&gt;

&lt;p&gt;Low Latency: Delivers lower latency than wireless networks (Wi-Fi), making it suitable for real-time data transmission.&lt;/p&gt;

&lt;p&gt;Plug and Play: Supports hot swapping, with automatic device recognition and network configuration upon connection.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Common Working Types of USBNET&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;ECM Mode (Ethernet Control Model)&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Protocol: Standard USB protocol with strong compatibility (natively supported by Linux/Android/macOS).&lt;/p&gt;

&lt;p&gt;Applicable Scenarios: Embedded Linux devices, industrial controllers.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;RNDIS Mode (Remote NDIS)&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Protocol: Microsoft-led USB network protocol, natively supported by Windows by default.&lt;/p&gt;

&lt;p&gt;Applicable Scenarios: Windows device debugging (e.g., Android USB network tethering).&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;NCM Mode (Network Control Model)&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Protocol: USB-IF standard protocol, more efficient than ECM.&lt;/p&gt;

&lt;p&gt;Applicable Scenarios: 5G modules, high-performance embedded devices.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Functional Overview&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;This article mainly describes how to implement the USBNET function with a QuecPython development board and provide network access for connected devices. The typical programming workflow is divided into the following parts:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Import the USBNET package&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Set the working type of the USB network adapter&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Enable the USB network adapter&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Import the USBNET Package&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;First, import the USBNET package from misc.&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%2Fkcfl7a41h9dwr3kflx31.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%2Fkcfl7a41h9dwr3kflx31.png" alt=" " width="741" height="42"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Set the Working Type&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;This method is used to set the working type of the USB network adapter.&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%2Fly0tvwvm05skhatkzfjz.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%2Fly0tvwvm05skhatkzfjz.png" alt=" " width="737" height="46"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For API details, please refer to USBNET.set_worktype.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Enable the USB Network Adapter&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;This method is used to turn on the USB network adapter function.&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%2Few4sd637hkrftfgv6w0s.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%2Few4sd637hkrftfgv6w0s.png" alt=" " width="745" height="43"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For API details, please refer to USBNET.open.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Application Example&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Taking the EC600MCNLE QuecPython development board as an example, this example creates a USB network adapter to provide network access for a PC. The sample code is as follows:&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%2Fpazmhguphkbq6psqh17j.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%2Fpazmhguphkbq6psqh17j.png" alt=" " width="643" height="651"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After entering the above code via QPYcom, the USB network adapter is enabled. When you check the network connection interface on the PC, you will see an additional available network.&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%2F5ry7fccklrbfnjinyy4k.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%2F5ry7fccklrbfnjinyy4k.png" alt=" " width="650" height="254"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Open Command Prompt (cmd) and enter ipconfig, you can see that the basic network information has been obtained. At this point, if you disable all other network interfaces and only keep the USB network adapter interface, the computer can still access the Internet normally.&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%2Fihl2zfylnicah7wgujxv.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%2Fihl2zfylnicah7wgujxv.png" alt=" " width="618" height="167"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can then access web pages through your computer's browser. For example, enter &lt;a href="https://python.quectel.com" rel="noopener noreferrer"&gt;https://python.quectel.com&lt;/a&gt; in the browser address bar to access the site normally.&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%2Fg4oddtpf7rflk3artxi0.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%2Fg4oddtpf7rflk3artxi0.png" alt=" " width="604" height="294"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>micropython</category>
      <category>iot</category>
      <category>usb</category>
    </item>
    <item>
      <title>QuecPython + WLAN: Wireless Network Control</title>
      <dc:creator>QuecPython</dc:creator>
      <pubDate>Fri, 24 Apr 2026 12:07:54 +0000</pubDate>
      <link>https://dev.to/quecpython/quecpython-wlan-wireless-network-control-b5h</link>
      <guid>https://dev.to/quecpython/quecpython-wlan-wireless-network-control-b5h</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;WLAN Overview&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;WLAN (Wireless Local Area Network) is a network technology that enables interconnection between devices through wireless signals (such as Wi-Fi). It allows computers, smartphones, IoT devices and other terminals to access a local area network or the Internet without using physical cables.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Core Features of WLAN&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;• Wireless Transmission: Uses radio waves (2.4GHz/5GHz/6GHz frequency bands) instead of network cables, supporting device mobility.&lt;/p&gt;

&lt;p&gt;• Standardized Protocols: Based on the IEEE 802.11 series of standards (such as 802.11ac, 802.11ax).&lt;/p&gt;

&lt;p&gt;• Flexible Deployment: No wiring required, suitable for scenarios including homes, enterprises, and public places.&lt;/p&gt;

&lt;p&gt;• Shared Bandwidth: All devices share the same wireless channel, and the available bandwidth is affected by the access point (AP) and environmental interference.&lt;/p&gt;

&lt;p&gt;• Security Mechanisms: Supports WPA3 and WPA2 encryption to prevent unauthorized access.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Functional Overview&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;This article mainly describes how to use the QuecPython development board to connect to a Wi-Fi hotspot and create a Wi-Fi hotspot. The typical programming workflow is divided into the following parts:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Station Mode: Connect to a Wi-Fi hotspot&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Create a Wi-Fi network interface object&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Connect to the target hotspot&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;AP Mode: Create a Wi-Fi hotspot&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Create a Wi-Fi network interface object&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Set the hotspot name and password&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Activate the network interface&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Station Mode&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Create a Wi-Fi Network Interface Object&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Initialize the Wi-Fi network interface information and return the Wi-Fi network interface object.&lt;/p&gt;

&lt;p&gt;class network.WLAN(mode)&lt;/p&gt;

&lt;p&gt;For parameter details, please refer to the constructor.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Connect to a Hotspot&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;This method is used to connect to the specified wireless network. It only supports Station mode, and supports both blocking and non-blocking connection modes, with a default blocking connection and a 15s timeout period.&lt;/p&gt;

&lt;p&gt;If the ssid and password are not specified, the device will automatically connect to the last successfully connected AP.&lt;/p&gt;

&lt;p&gt;WLAN.connect([ssid, password, bssid, timeout])&lt;/p&gt;

&lt;p&gt;For API details, please refer to WLAN.connect.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;AP Mode&lt;/strong&gt;
&lt;/h2&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Create a Wi-Fi Network Interface Object&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Initialize the Wi-Fi network interface information and return the Wi-Fi network interface object.&lt;/p&gt;

&lt;p&gt;class network.WLAN(mode)&lt;/p&gt;

&lt;p&gt;For parameter details, please refer to the constructor.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Set Configuration Parameters&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;This method is used to set the name and password of the hotspot.&lt;/p&gt;

&lt;p&gt;WLAN.config(ap_ssid = "SSID", ap_password = "PASSWD")&lt;/p&gt;

&lt;p&gt;For API details, please refer to WLAN.config.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Activate the Network Interface&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;This method is used to activate the network interface and trigger the startup of the hotspot.&lt;/p&gt;

&lt;p&gt;WLAN.active(enable)&lt;/p&gt;

&lt;p&gt;For API details, please refer to WLAN.active.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Application Example&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;This example uses the FCM360W QuecPython development board to connect to a hotspot, the sample code is as follows:&lt;/p&gt;

&lt;p&gt;import network&lt;/p&gt;

&lt;p&gt;Create a Wi-Fi network interface and set it to STATION modenic = network.WLAN(network.STA_MODE)&lt;/p&gt;

&lt;p&gt;Define Wi-Fi event callback functiondef wifi_event_cb(event):&lt;/p&gt;

&lt;p&gt;Print event informationprint("- Event:\r\n ", event)&lt;/p&gt;

&lt;p&gt;When the IP address is obtained, print IP address related informationif event['id'] == 3305:print("- Got IP:\r\n ", nic.ifconfig())&lt;/p&gt;

&lt;p&gt;Set the event callback&lt;br&gt;
 functionnic.config(event_callback = wifi_event_cb)&lt;/p&gt;

&lt;p&gt;Connect to the hotspotnic.connect(ssid = "QuecPython", password = "12345678")&lt;/p&gt;

&lt;p&gt;The code execution result is as follows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Connecting to QuecPython &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Event:    {'msg': None, 'type': 3300, 'id': 3301} &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Event:    {'msg': {'password': '12345678', 'ssid': 'QuecPython', 'rssi': -62, 'channel': 1, 'bssid': 'a4:00:e2:ef:f7:80', 'auth': 4, 'cipher': 4}, 'type': 3300, 'id': 3302} &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Event:    {'msg': ('10.66.117.73', '255.255.252.0', '10.66.116.1', '0.0.0.0', '0.0.0.0'), 'type': 3300, 'id': 3305} &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Got IP:    ('10.66.117.73', '255.255.252.0', '10.66.116.1', '211.138.180.2', '114.114.114.114')&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>python</category>
      <category>micropython</category>
      <category>iot</category>
      <category>wlan</category>
    </item>
    <item>
      <title>QuecPython + 1-Wire: IoT Device Communication Guide + Application Examples</title>
      <dc:creator>QuecPython</dc:creator>
      <pubDate>Fri, 24 Apr 2026 12:02:30 +0000</pubDate>
      <link>https://dev.to/quecpython/quecpython-1-wire-iot-device-communication-guide-application-examples-53a7</link>
      <guid>https://dev.to/quecpython/quecpython-1-wire-iot-device-communication-guide-application-examples-53a7</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;1-Wire Overview&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;1-Wire is a master-slave serial communication protocol developed by Dallas Semiconductor (USA), primarily designed to enable communication between microcontrollers and 1-Wire devices. Unlike SPI and I2C serial data communication methods, 1-Wire uses a single signal line to achieve bidirectional data transmission. This design greatly simplifies hardware connections and reduces system cost and complexity.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Introduction to 1-Wire Communication Timing&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The basic time slots of 1-Wire are divided into three phases: initialization, write 0 &amp;amp; 1, and read 0 &amp;amp; 1(this article uses the time slots of the DS18B20 temperature sensor as an example).&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Initialization&lt;/strong&gt;
&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%2Fjo7dbj1xi7obntrj2bes.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%2Fjo7dbj1xi7obntrj2bes.png" alt=" " width="800" height="290"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;All communication with the DS18B20 starts with an initialization sequence, which consists of a reset pulse issued by the host, followed by a presence pulse sent by the DS18B20. When the DS18B20 responds to the reset and sends a presence pulse, it signals to the host that it is connected to the bus and ready for operation.&lt;/p&gt;

&lt;p&gt;Specific Process: The bus master transmits (TX) a reset pulse by pulling the 1-Wire bus low for a minimum of 480μs. The bus master then releases the bus and enters receive mode (RX). After the bus is released, the pull-up resistor pulls the 1-Wire bus high. When the DS18B20 detects this rising edge, it waits 15μs to 60μs, then sends a presence pulse by pulling the 1-Wire bus low for 60μs to 240μs.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Write 0 &amp;amp; 1&lt;/strong&gt;
&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%2Fv3mrqpgwp9bwpva3dz9b.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%2Fv3mrqpgwp9bwpva3dz9b.png" alt=" " width="800" height="286"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;All write time slots must have a minimum duration of 60μs, with a minimum recovery time of 1μs between each write slot. Both types of write slots are initiated by the host pulling the 1-Wire bus low.&lt;/p&gt;

&lt;p&gt;Write 0: To generate a "write 0" slot, after pulling the 1-Wire bus low, the bus master must continue to hold the bus low for the entire duration of the slot (a minimum of 60μs).&lt;/p&gt;

&lt;p&gt;Write 1: To generate a "write 1" slot, after pulling the 1-Wire bus low, the bus master must release the 1-Wire bus within 15μs. After the bus is released, the pull-up resistor pulls the bus high.&lt;/p&gt;

&lt;p&gt;Specific Process: The DS18B20 samples the 1-Wire bus within a 15μs to 60μs window after the host initiates the write slot. If the bus is high during the sampling window, a 1 is written to the DS18B20. If the bus is low, a 0 is written to the DS18B20.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Read 0 &amp;amp; 1&lt;/strong&gt;
&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%2Fhtge3f80439wazd1mxl7.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%2Fhtge3f80439wazd1mxl7.png" alt=" " width="800" height="339"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;All read time slots must have a minimum duration of 60μs, with a minimum recovery time of 1μs between slots. A read slot is initiated by the host pulling the 1-Wire bus low for a minimum of 1μs and then releasing the bus. After the host initiates the read slot, the DS18B20 will start transmitting 1 or 0 on the bus. The DS18B20 can only send data to the host when the host issues a read slot.&lt;/p&gt;

&lt;p&gt;Read 0: The DS18B20 will release the bus at the end of the read slot, and the bus will be pulled back to the high-level idle state by the pull-up resistor.&lt;/p&gt;

&lt;p&gt;Read 1: The DS18B20 keeps the bus at a high level.&lt;/p&gt;

&lt;p&gt;Specific Process: The output data from the DS18B20 is valid within 15μs after the falling edge that initiates the read slot. Therefore, the host must release the bus and then sample the bus status within 15μs after the start of the slot.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Functional Overview&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;This section mainly describes how to use the functions and data types of the 1-Wire driver to establish communication between QuecPython series modules and the DS18B20 sensor. The typical programming workflow is divided into the following parts:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Object Creation&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Reset&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Data Transmission&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Data Reading&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Object Creation&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;When creating a 1-Wire object, you need to set the GPIO connected to the DQ pin.&lt;/p&gt;

&lt;p&gt;class machine.OneWire(GPIO)&lt;/p&gt;

&lt;p&gt;For parameter details, please refer to the constructor.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reset&lt;/strong&gt;&lt;br&gt;
This method is used to reset the bus and detect whether the device responds. This interface must be called first before calling the read and write interfaces.&lt;/p&gt;

&lt;p&gt;OneWire.reset()&lt;/p&gt;

&lt;p&gt;For API details, please refer to machine.OneWire.reset.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data Transmission&lt;/strong&gt;&lt;br&gt;
This method is used for the host to write data to the slave, and the data to be written is of bytes type.&lt;/p&gt;

&lt;p&gt;OneWire.write(data)&lt;/p&gt;

&lt;p&gt;For API details, please refer to machine.OneWire.write.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data Reading&lt;/strong&gt;&lt;br&gt;
The data read by this method is the raw data of the DS18B20, which needs to be converted into the actual temperature according to the data format of the DS18B20.&lt;/p&gt;

&lt;p&gt;OneWire.read(len)&lt;/p&gt;

&lt;p&gt;For API details, please refer to machine.OneWire.read.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Application Example: DS18B20 Temperature Sensor&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The DS18B20 is a widely used digital temperature sensor produced by Dallas Semiconductor. It internally integrates modules including a temperature sensor, temperature conversion circuit, non-volatile memory, configuration register, and 1-Wire interface circuit. Through the 1-Wire interface circuit, the DS18B20 communicates with the external host to realize data transmission and command reception.&lt;/p&gt;

&lt;p&gt;Basic Commands:&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%2F119egdm8xldbnjwyikwm.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%2F119egdm8xldbnjwyikwm.png" alt=" " width="800" height="431"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;CCh: Skip ROM (when only one DS18B20 sensor is connected, 0xCC can be sent to skip ROM matching)&lt;/li&gt;
&lt;li&gt;44h: Start temperature conversion&lt;/li&gt;
&lt;li&gt;4Eh: Write scratchpad register&lt;/li&gt;
&lt;li&gt;BEh: Read scratchpad register (a total of 9 registers can be read, the first 2 are temperature values)&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%2Fosxgjyni0mp0buh4ocg5.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%2Fosxgjyni0mp0buh4ocg5.png" alt=" " width="800" height="357"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The temperature value obtained by the DS18B20 is in the following format and requires conversion:&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%2F62f4h8l9i11ee8jde7sn.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%2F62f4h8l9i11ee8jde7sn.png" alt=" " width="800" height="180"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Complete Communication Flow&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Reset and initialization&lt;/li&gt;
&lt;li&gt; Host sends [0xcc, 0x44] to start DS18B20 temperature conversion&lt;/li&gt;
&lt;li&gt;Reset again&lt;/li&gt;
&lt;li&gt;Host sends [0xcc, 0xbe] to read the temperature value from the scratchpad register&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Sample Code for Obtaining DS18B20 Temperature Value&lt;/strong&gt;
&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%2Fhlefitvpbe4j8c89euq4.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%2Fhlefitvpbe4j8c89euq4.png" alt=" " width="722" height="677"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;FAQ&lt;/strong&gt;
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Reset Initialization Failure&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This may be caused by a hardware connection issue. Check the hardware connections to ensure that the GPIO used to create the object is consistent with the pin on the development board connected to the DQ pin of the DS18B20, and that the ground (GND) is also correctly connected. The DS18B20 sensor is damaged, resulting in communication failure.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Normal Transceiving but Erroneous Data&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This may be caused by an inconsistent level between the host GPIO and the slave DQ pin. For example, if the host level is 3.3V and the slave level is 1.8V, the high level of the slaveis 1.8V. The host generally recognizes a level higher than 1.65V as high level, which is prone to misjudgment.&lt;/p&gt;

</description>
      <category>python</category>
      <category>micropython</category>
      <category>1wire</category>
      <category>iot</category>
    </item>
    <item>
      <title>VSCode Plugin User Guide</title>
      <dc:creator>QuecPython</dc:creator>
      <pubDate>Fri, 24 Apr 2026 11:53:06 +0000</pubDate>
      <link>https://dev.to/quecpython/vscode-plugin-user-guide-56j3</link>
      <guid>https://dev.to/quecpython/vscode-plugin-user-guide-56j3</guid>
      <description>&lt;p&gt;To facilitate developers using VSCode for QuecPython development, the QuecPython team has introduced a VSCode plugin called QuecPython.&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%2Feo20i7r5w4eb7kcv8klv.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%2Feo20i7r5w4eb7kcv8klv.png" alt=" " width="713" height="388"&gt;&lt;/a&gt;&lt;br&gt;
The plugin currently supports the following features:&lt;/p&gt;

&lt;p&gt;• Firmware flashing&lt;/p&gt;

&lt;p&gt;• REPL command interaction&lt;/p&gt;

&lt;p&gt;• File transfer&lt;/p&gt;

&lt;p&gt;• Filesystem directory tree&lt;/p&gt;

&lt;p&gt;• Run specific script files&lt;/p&gt;

&lt;p&gt;It currently all QuecPython series modules.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Plugin Installation&lt;/strong&gt;
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Click on the Extensions icon in the primary sidebar .&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Type QuecPython in the plugin search box.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Find the QuecPython plugin in the search list, click the install button to complete the plugin installation.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&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%2F6zyxc0dwv8e1di6mgndv.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%2F6zyxc0dwv8e1di6mgndv.png" alt=" " width="717" height="512"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Plugin Usage Guide&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Before you start, make sure you have downloaded the appropriate QuecPython firmware package for your module. Click here to view how to download firmware packages.&lt;/p&gt;

&lt;p&gt;The following steps are demonstrated based on the U-235 development board.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Firmware Flashing&lt;/strong&gt;
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Access the Firmware Flashing Interface on the Primary Sidebar&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;There are two methods:&lt;/p&gt;

&lt;p&gt;– Click on the QuecPython plugin icon on the primary sidebar .&lt;/p&gt;

&lt;p&gt;– Use the shortcut Ctrl+Shift+P to open the command palette, type &amp;gt; QuecPython in it, and select QuecPython: Focus on Firmware Manager View from the options, as shown below:&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%2Fk0zh6c7zxe3x2dyeo1yq.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%2Fk0zh6c7zxe3x2dyeo1yq.png" alt=" " width="717" height="301"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The firmware flashing interface on the primary sidebar is shown in the following image:&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%2Frwp1ogil771b5k399ld5.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%2Frwp1ogil771b5k399ld5.png" alt=" " width="707" height="688"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Select Firmware&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Click the Select Firmware button  on the firmware flashing interface, and choose the firmware package for the U-235 development board module.&lt;/p&gt;

&lt;p&gt;The path to the firmware package will be displayed on the interface:&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%2Fdh6zr8zzegy407jshfjq.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%2Fdh6zr8zzegy407jshfjq.png" alt=" " width="699" height="484"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Flash Firmware&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;i. Click the Flash button  on the firmware flashing interface.&lt;/p&gt;

&lt;p&gt;ii. In the pop-up confirmation window, click the Yes button &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%2Feaoyzgvswzbms7jdt0u5.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%2Feaoyzgvswzbms7jdt0u5.png" alt=" " width="713" height="290"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now you can see the firmware flashing progress bar in the lower right corner of the VSCode interface:&lt;/p&gt;

&lt;p&gt;When the progress bar shows Flashing Firmware: 8/8 100%, the firmware flashing is complete, and the module will restart.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;REPL Command Interaction&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Before starting the REPL command interaction for QuecPython, it is necessary to flash the firmware that supports QuecPython functionality.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Find the command to connect to the terminal in the command palette&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Use the shortcut Ctrl+Shift+P to open the command palette. Enter &amp;gt; QuecPython in the palette and select QuecPython: Connect to COM Port from the options, as shown below:&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%2Fy1sdel2i03k8pf9vwkqz.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%2Fy1sdel2i03k8pf9vwkqz.png" alt=" " width="712" height="288"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;connect to Terminal&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Follow the instructions in the image below:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Once the operation is completed, the module will be connected to the terminal in VSCode.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;At the same time, the terminal window will pop up with the content as shown in the image below:&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%2F0p3thlvb6c1cdopxdymd.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%2F0p3thlvb6c1cdopxdymd.png" alt=" " width="711" height="263"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;REPL Command Interaction&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;After pressing Enter in the terminal, you will see the QuecPython command prompt &amp;gt;&amp;gt;&amp;gt;.&lt;/p&gt;

&lt;p&gt;Enter the following code in the terminal:&lt;/p&gt;

&lt;p&gt;print("Hello, QuecPython!")&lt;/p&gt;

&lt;p&gt;After pressing Enter, you can see the execution result as shown in the following image:&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%2F09f4zow7vvhzyjxvafth.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%2F09f4zow7vvhzyjxvafth.png" alt=" " width="706" height="304"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, we have completed the simplest QuecPython REPL interaction.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;File Transfer&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The edited script file test.py needs to be imported into the module’s file system to run.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;In the editor page of the file to be transferred (i.e., test.py), right-click the mouse.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click on the QPY: Download File command to start file transfer.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&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%2F2m956x4vg6t83c1ycrxb.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%2F2m956x4vg6t83c1ycrxb.png" alt=" " width="622" height="808"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;During the file transfer process, a pop-up window appears in the bottom right corner of the VSCode interface, as shown below:&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%2Fovt3zpa68w7tvfyrf5yb.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%2Fovt3zpa68w7tvfyrf5yb.png" alt=" " width="635" height="128"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;File System Directory Tree&lt;/strong&gt;
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;After the file transfer is complete, click on the Explorer button  on the primary sidebar.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Once the Explorer interface is open, look at the bottom and find QPY: FILE SYSTEM (USR). It shows the directory tree of the module’s file system /usr.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The imported file test.py is shown in the following image:&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%2F9147v0zpe2idekv0qv30.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%2F9147v0zpe2idekv0qv30.png" alt=" " width="629" height="241"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Run Script File&lt;/strong&gt;
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Select the script file test.py in the directory tree.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Right-click on the script file test.py and choose Run Script to execute the script file.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&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%2Fwtvoqc6ly46kc7z6op4a.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%2Fwtvoqc6ly46kc7z6op4a.png" alt=" " width="639" height="364"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the terminal window, you can see the script periodically outputting the string "Hello, QuecPython!".&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%2Fd0kcmytqmnvbrscqczab.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%2Fd0kcmytqmnvbrscqczab.png" alt=" " width="634" height="157"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Package Manager&lt;/strong&gt;
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;From QuecPython menu -&amp;gt; Quick Access -&amp;gt; Quectel -&amp;gt; Projects + Components&lt;/li&gt;
&lt;/ol&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%2Fuh6w41djar1wtef0zhy0.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%2Fuh6w41djar1wtef0zhy0.png" alt=" " width="537" height="846"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;List of Projects + Components will show in the panel&lt;/li&gt;
&lt;/ol&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%2Fnmtoh5k1kynlkkx3s6nl.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%2Fnmtoh5k1kynlkkx3s6nl.png" alt=" " width="796" height="429"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>micropython</category>
      <category>vscode</category>
      <category>plugin</category>
    </item>
    <item>
      <title>ADC- Analog-to-Digital Converter</title>
      <dc:creator>QuecPython</dc:creator>
      <pubDate>Fri, 17 Apr 2026 10:37:48 +0000</pubDate>
      <link>https://dev.to/quecpython/adc-analog-to-digital-converter-2407</link>
      <guid>https://dev.to/quecpython/adc-analog-to-digital-converter-2407</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;ADC Principles and Common Applications&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Analog signals are signals that have a continuous mathematical form in the time domain, with signal values continuously varying at different time points. They convey information about continuously changing physical quantities such as temperature, humidity, pressure, length, current, and more. Different types of data need to be converted into corresponding analog signals for transmission.&lt;/p&gt;

&lt;p&gt;Digital signals, on the other hand, are signals where both the independent and dependent variables are discrete. They can be understood as signals that are discrete both in the time domain and in amplitude, meaning they are not continuous. Digital signals are stored and processed in computers using binary representation.&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%2Faldhorz1s2sbaxy2932u.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%2Faldhorz1s2sbaxy2932u.png" alt=" " width="711" height="480"&gt;&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%2Fw13lffdaov1udw7wakw8.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%2Fw13lffdaov1udw7wakw8.png" alt=" " width="692" height="468"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Using a processor with a working voltage of 3.3V as an example, it generates rectangular wave electrical signals during its operation, which are either 0V (logic 0) or 3.3V (logic 1). In the physical world, a voltage signal of 1V cannot be directly recognized by the CPU; it must be converted into a digital signal by a device called an ADC before it can be recognized by the CPU.&lt;/p&gt;

&lt;p&gt;ADC, short for Analog-to-Digital Converter, plays the role of transforming analog signals that computers cannot directly recognize in the physical world into binary digital signals that can be recognized by the CPU.&lt;/p&gt;

&lt;p&gt;The basic working principle of ADC involves sampling and quantization. First, ADC samples the analog signal, which means it measures the value of the analog signal at regular time intervals. Then, the sampled analog signal is quantized, which means it is discretized into a series of discrete numerical values. These numerical values are typically represented in binary.&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%2Fcl4mrnoyllmpym1b6pyn.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%2Fcl4mrnoyllmpym1b6pyn.png" alt=" " width="707" height="415"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The resolution of an ADC represents its ability to quantify analog signals with precision. It refers to the number of discrete values that the ADC can represent. Resolution is typically measured in bits, such as 8-bit, 10-bit, 12-bit, and so on. For example, an 8-bit ADC can divide the input range into 2^8 (256) different discrete levels, while a 12-bit ADC can divide it into 2^12 (4096) discrete levels. Higher resolution means that the ADC can more accurately quantify analog signals.&lt;/p&gt;

&lt;p&gt;The sampling rate of an ADC is the number of times it samples per second. A higher sampling rate results in a more faithful representation of the original analog signal. According to the Nyquist Sampling Theorem, the sampling rate must be at least twice the maximum frequency of the signal being measured to avoid distortion in the sampled waveform. In practical applications, the sampling frequency is often much higher, sometimes even up to 10 times or more the maximum frequency of the signal being sampled.&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%2Ftqswhr89adx3fnhdypfa.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%2Ftqswhr89adx3fnhdypfa.png" alt=" " width="765" height="583"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The input voltage range of an ADC (Analog-to-Digital Converter) refers to the range of analog signal voltages it can accept. It is typically expressed in voltage units, such as 0V to 5V or -5V to +5V. Ensuring that the input signal does not exceed the ADC’s input range is crucial to avoid signal distortion or damage.&lt;/p&gt;

&lt;p&gt;ADCs can be triggered in two main ways: software-triggered and hardware-triggered. In software triggering, the ADC starts the conversion immediately when a conversion command is issued in software. In hardware triggering, the ADC waits for a specified external event to occur before starting the conversion. The choice of triggering method depends on the specific application and requirements.&lt;/p&gt;

&lt;p&gt;ADCs find wide-ranging applications in various fields, including data acquisition, sensor interfacing, audio processing, communication systems, and more. They are essential components for converting analog signals into digital format, allowing analog signals to interact with and be processed by digital systems.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;ADC Descriptions for Various Platforms&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;ADCs are typically located on the PMU (Power Management Unit) and are part of the Analog IP. A typical structure diagram of the PMU is shown below:&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%2Fa10pgfpvqgsn5esdn5l6.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%2Fa10pgfpvqgsn5esdn5l6.png" alt=" " width="723" height="813"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Application Scenarios&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Light Sensor&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Materials Needed: EC600U module, light-dependent resistor (e.g., GL5528)&lt;/p&gt;

&lt;p&gt;Principle:&lt;/p&gt;

&lt;p&gt;The resistance of a light-dependent resistor (LDR) changes with varying light intensity.&lt;/p&gt;

&lt;p&gt;When the LDR is exposed to light, its resistance decreases.&lt;/p&gt;

&lt;p&gt;When the light intensity decreases or there is no light, the resistance of the LDR increases, which affects the voltage at the test point.&lt;/p&gt;

&lt;p&gt;By reading the ADC voltage values, you can calculate the resistance value of the LDR. Based on the relationship between the light intensity and the resistance of the LDR, you can determine the intensity of the light.&lt;/p&gt;

&lt;p&gt;The hardware circuit is as shown in the diagram below: R2 is the LDR, R1 is 10K (you can choose the value of R1 based on the specific parameters of the LDR), and the ADC port is the test point connected to the module’s ADC pin.&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%2F8gvv5tfb3tzydf3lyr14.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%2F8gvv5tfb3tzydf3lyr14.png" alt=" " width="697" height="827"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this example, you can observe the impact of different light levels on the LDR by printing the ADC-measured voltage values and the resistance values of the LDR.&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%2Fs124kbgx54qh8cum3wdk.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%2Fs124kbgx54qh8cum3wdk.png" alt=" " width="779" height="574"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;FAQ&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;ADC Voltage Range&lt;/strong&gt;
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;The input voltage for each ADC interface pin must not exceed its allowed voltage range. When the measured voltage is greater than the input voltage range, it should be first reduced by resistor division before connecting it to the module’s ADC pin.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In cases where the module’s VBAT is not powered, to avoid damaging the module, ADC interfaces should not be directly connected to any input voltage.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;ADC Bit Width&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;ADC bit width refers to how many bits are used to represent the ADC conversion result. A larger bit width results in higher resolution and more precise measurements. For example, if a 1V voltage is converted by a 10-bit ADC, each bit represents 1/1024V. The module’s ADC returns the processed voltage value.&lt;/p&gt;

</description>
      <category>python</category>
      <category>micropython</category>
      <category>embedded</category>
      <category>adc</category>
    </item>
    <item>
      <title>Network Configuration</title>
      <dc:creator>QuecPython</dc:creator>
      <pubDate>Fri, 17 Apr 2026 09:32:55 +0000</pubDate>
      <link>https://dev.to/quecpython/network-configuration-5g6</link>
      <guid>https://dev.to/quecpython/network-configuration-5g6</guid>
      <description>&lt;p&gt;This section introduces how to configure and connect to the network in the QuecPython solution. QuecPython supports multiple types of NICs, each with different usage methods. This chapter will introduce them one by one to facilitate the understanding of network configuration applications.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Network Configuration Introduction&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;QuecPython supports various types of NICs. How can we configure the NICs to enable them to communicate over the network? This introduces NIC configuration to help you quickly use NIC devices to connect to the network.&lt;/p&gt;

&lt;p&gt;QuecPython provides two ways to configure NICs:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;QuecPython APIs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Built-in web service.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Only cellular network modules cannot use the web service.&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%2Fo6c0u8dte4fd8mupy3m9.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%2Fo6c0u8dte4fd8mupy3m9.png" alt=" " width="722" height="469"&gt;&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%2F5gfnt38g06bws85yhfu3.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%2F5gfnt38g06bws85yhfu3.png" alt=" " width="731" height="555"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Cellular NIC&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Cellular NICs rely on the network operator. A module must be integrated with a SIM card and be in the coverage of the network operator’s base station to establish a network connection. QuecPython-supported cellular communication modules will automatically connect to the cellular network after power-on.&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%2Ffr4nk9g1ifuzumanqn70.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%2Ffr4nk9g1ifuzumanqn70.png" alt=" " width="665" height="346"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;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%2Fms2nlsrltqhs6zlhu7rr.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%2Fms2nlsrltqhs6zlhu7rr.png" alt=" " width="757" height="202"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Wi-Fi NIC&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Wi-Fi NICs have different application scenarios in different working modes. In station mode, the NIC needs to connect to a Wi-Fi hotspot (such as a router) to connect to the network. In AP mode, the Wi-Fi NIC serves as a hotspot, accepting connections from other Wi-Fi devices and providing network services to them.&lt;/p&gt;

&lt;p&gt;There are multiple ways to configure Wi-Fi NICs, such as directly entering the hotspot name and password, quick configuration, AP configuration and web page configuration. However, the ultimate goal is to successfully obtain the hotspot name and password. This chapter focuses on loading the Wi-Fi NIC and connecting to the hotspot directly. For other configuration methods, please refer to Wi-Fi NIC.&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%2Ft7xnb0nvp2r5gj2qcw2a.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%2Ft7xnb0nvp2r5gj2qcw2a.png" alt=" " width="710" height="637"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;General Wi-Fi NIC configuration&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%2Fzenre07ovuvpyibh75o7.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%2Fzenre07ovuvpyibh75o7.png" alt=" " width="727" height="314"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Ethernet NIC&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;In different application scenarios, Ethernet NICs have different operating modes: WAN mode and LAN mode.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;WAN Mode&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;In WAN mode, an Ethernet NIC serves as the WAN port to provide Internet access capability to the module, as shown in the following diagram.&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%2F7wm0y13qcc6sy858bgl0.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%2F7wm0y13qcc6sy858bgl0.png" alt=" " width="715" height="306"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this mode, you can get a dynamic IP address through DHCP or set a static IP address.&lt;br&gt;
Example of getting an IP address through DHCP:&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%2Fy679ucr8c6xvrpxftibj.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%2Fy679ucr8c6xvrpxftibj.png" alt=" " width="750" height="134"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Example of setting a static IP address:&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%2F6ha2nywjoh32ep1r3e6l.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%2F6ha2nywjoh32ep1r3e6l.png" alt=" " width="746" height="170"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;LAN Mode&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In LAN mode, an Ethernet NIC connects with another Ethernet device as a LAN port, thus providing Internet access capability for the device through 4G network, as shown in the following diagram.&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%2F99vvbd7l4ikktp0c4xmw.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%2F99vvbd7l4ikktp0c4xmw.png" alt=" " width="654" height="316"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this mode, the module will enable DHCP service by default to assign a dynamic IP address to the connected Ethernet device.&lt;/p&gt;

&lt;p&gt;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%2Fdsn5r7al7rd03otrkehh.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%2Fdsn5r7al7rd03otrkehh.png" alt=" " width="770" height="228"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;USB Network Adapter&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Currently, the USB network adapter is used when the USB port serves as a LAN port to transfer data through the 4G NIC for Internet access. Both ECM and RNDIS protocols are supported by USB network adapter. You can select one according to your needs. RNDIS can be directly loaded in Windows, while ECM can be directly loaded in Linux/Android/iOS systems.&lt;/p&gt;

&lt;p&gt;Cellular communication modules that support USB network adapter are connected to host devices that support ECM or RNDIS protocols via a USB port to provide Internet access for the host device through the 4G network, as shown in the following diagram.&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%2Fru6l72ye64tuz60ukj9i.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%2Fru6l72ye64tuz60ukj9i.png" alt=" " width="670" height="339"&gt;&lt;/a&gt;&lt;br&gt;
After calling set_worktype(USBNET_Type) to set the protocol type of the USB network adapter, call USBNET.open() to enable the USB network adapter.&lt;/p&gt;

&lt;p&gt;USBNET_Type description:&lt;/p&gt;

&lt;p&gt;• USBNET.Type_RNDIS: RNDIS protocol. Windows operating system supports RNDIS protocol by default.&lt;/p&gt;

&lt;p&gt;• USBNET.Type_ECM: ECM protocol. Linux, Android, iOS, macOS, and other operating systems support ECM protocol by default.&lt;/p&gt;

&lt;p&gt;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%2Fyje6i35iwisbnztrk7ny.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%2Fyje6i35iwisbnztrk7ny.png" alt=" " width="745" height="230"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>micropython</category>
      <category>iot</category>
      <category>network</category>
    </item>
    <item>
      <title>SPI</title>
      <dc:creator>QuecPython</dc:creator>
      <pubDate>Fri, 17 Apr 2026 09:25:51 +0000</pubDate>
      <link>https://dev.to/quecpython/spi-db4</link>
      <guid>https://dev.to/quecpython/spi-db4</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;SPI Overview&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;SPI, abbreviation of Serial Peripheral Interface, is defined by Motorola on its processors of MC68HCXX Series first. The SPI interface is mainly applicable to EEPROM, FLASH, real-time clock, AD converter, digital signal processor and digital signal decoder. SPI, as a high-speed, full-duplex, synchronous communication bus, imports the principle of “master” and “Slave” devices. In any explicit SPI communication, there will be a master device and one or more slave devices. The master device is responsible for starting and ending communication sessions. The cellular module is the master device in SPI communication by default, while the external device is the slave device. If you need the cellular module to be the slave device, please contact the manufacturer.&lt;/p&gt;

&lt;p&gt;A general SPI interface generally contains 4 communication lines:&lt;/p&gt;

&lt;p&gt;• SCK: Its main function is to transmit clock signals from the master device to the slave device and control the timing and rate of data exchange.&lt;/p&gt;

&lt;p&gt;• SS/CS: Chip select between the slave device and the master device, as a result, the selected slave device can be accessed by the master device;&lt;/p&gt;

&lt;p&gt;• SDO/MOSI: Also called Tx-Channel on the master device. As a data output port, it is mainly used for sending data in SPI device;&lt;/p&gt;

&lt;p&gt;• SDI/MISO: Also called Rx-Channel on the master device, As a data input port, it is mainly used for receiving data in SPI device;&lt;/p&gt;

&lt;p&gt;The SPI communication is full-duplex, which means the data can be transmitted in both directions simultaneously. For SPI, this is implemented via the MOSI (Master Out, Slave In) and MISO (Master In, Slave Out).&lt;/p&gt;

&lt;p&gt;In SPI, it owns a total of 4 working modes, which are determined by different configurations of clock polarity (CPOL) and phase (CPHA), see following table:&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%2Ft2k9m81yxb7wsb8d5rhd.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%2Ft2k9m81yxb7wsb8d5rhd.png" alt=" " width="747" height="171"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;SPI Applications on different platforms&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The BC25PA platform only supports SPI working modes 0 and 3, and other platforms support all working modes.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;SPI Bus Applications&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Interact with MCU#&lt;br&gt;
When interacting with the MCU, the cellular module acts as the Master device and the MCU acts as the Slave device. Before that, relevant corresponding protocol which defines the connotation of data read and written by cellular module clearly shall be provided by MCU side. At this time, the MCU side is similar to an ordinary SPI peripheral and needs to provide the reading and writing meaning of the register. When the cellular module writes a value into the register, the MCU can obtain the commands of the cellular module; meanwhile, the MCU can independently update the register (analog) value and wait for the cellular module to read and obtain the MCU data.&lt;/p&gt;

&lt;p&gt;Examples are as follows:：&lt;/p&gt;

&lt;p&gt;Virtual register table in MCU&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%2Fhadicaaeoids12cscu62.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%2Fhadicaaeoids12cscu62.png" alt=" " width="735" height="199"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The protocol is defined as follows：&lt;/p&gt;

&lt;p&gt;The cellular module sends: 0x7F (packet header) + 8-bit control segment (0: read command, 1: write command) + 8-bit register number + 8-bit data length + N bytes of data (That will be empty when reading the command)&lt;/p&gt;

&lt;p&gt;When the MCU receives the cellular module data and determines that the data is legal, the MCU will reply: 0x7E (packet header) + 8-bit register number + 8-bit data length + N bytes of data (That will be empty when reading the command)&lt;/p&gt;

&lt;p&gt;Example：&lt;/p&gt;

&lt;p&gt;Cellular module -&amp;gt; MCU: 0x7F 0x00 0x01 0x01 (read 1 data from register) MCU -&amp;gt; Cellular module: 0x7E 0x01 0x01 0x01 (MCU initialization is complete)&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;SPI LCD Display&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;It owns two methods to connect SPI LCD based on cellular modules, one is a dedicated LCD SPI interface and the other is general SPI. The connection lines between the cellular module and the LCD display are shown in the figure below:&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%2F5j9zssa2f57o515t879j.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%2F5j9zssa2f57o515t879j.png" alt=" " width="714" height="419"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The DOUT pin is used for serial data transmission. It is a bilateral data communication line between the LCD display and external device such as a controller or micro-controller.&lt;/p&gt;

&lt;p&gt;• The SCL/CLK pin is used for clock synchronization during serial data transmission. It provides the clock signal for data transmission for sake of ensuring the proper data synchronization and transmission.&lt;/p&gt;

&lt;p&gt;• The RS/DC pin is used to indicate the type of data sent to the LCD, i.e. data or command. When the RS/DC pin is low, it means a command is sent; when the RS pin is high, it means data is sent.&lt;/p&gt;

&lt;p&gt;• The RST pin is used to reset the LCD display to its initial state. When the RST pin receives a reset signal, the display will re-initialize and clear the previous status and data.&lt;/p&gt;

&lt;p&gt;• The CS pin is used to select or activate the LCD chip. When the CS pin is low, which indicates that the chip is aimed at communication or operation.&lt;/p&gt;

&lt;p&gt;When the LCD SPI pin connects to the LCD, the RS, RST and CS pins can only select as specified in the hardware manual. For example, in EC600U series, the CS pin, RST pin and RS pin will be 65, 64 and 63 respectively. See LCD SPI interface initialization as follows:&lt;/p&gt;

&lt;p&gt;lcd.lcd_init(lcd_init_data, lcd_width, lcd_hight, lcd_clk, data_line, line_num, lcd_type, lcd_invalid, lcd_display_on, lcd_display_off, lcd_set_brightness)&lt;/p&gt;

&lt;p&gt;When the general SPI pin connects to the LCD, the RS, RST and CS pins can be selected according to actual demand, but the pin number needs to be specified in initialization. See following contents in detail:&lt;/p&gt;

&lt;p&gt;lcd.lcd_init(lcd_init_data, lcd_width, lcd_hight, lcd_clk, data_line, line_num, lcd_type, lcd_invalid, lcd_display_on, lcd_display_off, lcd_set_brightness, lcd_interface, spi_port, spi_mode, cs_pin, dc_pin, rst_pin)&lt;/p&gt;

&lt;p&gt;Compared with LCD SPI pins, SPI mode, SPI port, CS, DC, and RST pins are added to the initialization parameters.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;MCP2515 CAN Controller&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Most CAN controllers in market use SPI bus communication, among which, the MCP2515 is the most widely used. Therefore, in this chapter, it will introduce how to use the Quecpython SPI module to communicate with MCP2515.&lt;/p&gt;

&lt;p&gt;The MCP2515 connection diagram is as follows：&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%2F937ocs1ovzcgofv08bv1.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%2F937ocs1ovzcgofv08bv1.png" alt=" " width="715" height="344"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The following contents display the codes for the SPI interface used in the MCP2515 driver.&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%2F98psk7r7su5qlub7cp3b.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%2F98psk7r7su5qlub7cp3b.png" alt=" " width="738" height="687"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;SPI Bus FAQ and Error Investigation&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1.Hardware connection problem:&lt;/strong&gt; The SPI interface requires four lines (MISO, MOSI, SCLK and CS) for connection. If these lines are not connected correctly, it may cause communication failure.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2.Power and GND issues:&lt;/strong&gt; If the power and the GND of the SPI device are not connected correctly, it may also cause failed comminication.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3.SPI mode error:&lt;/strong&gt; SPI has four modes, which are determined by clock polarity and phase. If the SPI modes of the master and slave devices do not match, the communication error may occur.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4.Clock frequency is unduly high:&lt;/strong&gt; If the clock frequency of SPI is set unduly high, which exceeds the capability of the device, data transmission errors will appear.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5.Mismatch of data bits:&lt;/strong&gt; The SPI data is usually 8 or 16 bits. If the number of data bits sent and received do not match, data errors may occur as well.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6.Chip selection line control error:&lt;/strong&gt; In a system with multiple slave devices, if the chip select line is not controlled correctly, communication chaos may occur.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7.Level mismatch problem:&lt;/strong&gt; If the levels of the master device and the slave device (i.e., 3.3V and 5V) do not match, it may cause communication problems or device damage.&lt;/p&gt;

&lt;p&gt;**8.Device compatibility issues: **Since there is no official standard for SPI, the implementation of different devices may be varied， which may cause compatibility issues between devices.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;9.Line Noise and Interference:&lt;/strong&gt; If the SPI line is too long or there exists high-frequency noise in the environment, it may affect the SPI signal quality and cause communication errors.&lt;/p&gt;

</description>
      <category>python</category>
      <category>micropython</category>
      <category>iot</category>
      <category>spi</category>
    </item>
    <item>
      <title>IIC</title>
      <dc:creator>QuecPython</dc:creator>
      <pubDate>Fri, 17 Apr 2026 09:18:50 +0000</pubDate>
      <link>https://dev.to/quecpython/iic-36je</link>
      <guid>https://dev.to/quecpython/iic-36je</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;Briefing on IIC&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;IIC (Inter-Integrated Circuit) bus is a two-wire serial bus developed by PHILIPS. It’s used to connect micro-controller and its peripherals. IIC and I2C are the same thing, it’s just the name difference. The serial bus, composed by Serial Data (SDA) wire and Serial Clock (SCL) wire, is able to send and receive data. An IIC device can either be a master or a slave. Normally, a master would be paired with one or more slaves and responsible for starting and ending a communication session. At the time being, QuecPython cellular modules can be a master only.&lt;/p&gt;

&lt;p&gt;IIC Topology：&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%2F306w8ikb12uq0pl0hoi9.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%2F306w8ikb12uq0pl0hoi9.png" alt=" " width="719" height="296"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Data (SDA): To transmit data. Clock (SCL): To sync the data transmission.&lt;/p&gt;

&lt;p&gt;• Every device on the bus owns a unique address. As a result, the communication between micro-controller and devices can be implemented in accordance with the timing of the corresponding address.&lt;/p&gt;

&lt;p&gt;• As bidirectional lines, both SDA and SCL are connected to a positive supply voltage via a current-source or pull-up resistor. When the bus is idle, both lines are in high level.&lt;/p&gt;

&lt;p&gt;• The transmission rate over the bus is up to 100 kbit/s in the Standard-mode, up to 400 kbit/s in the Fast-mode, and up to 3.4 Mbit/s in the High-speed mode.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;IIC Communication Timing Introduction&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;• &lt;strong&gt;Idle Level:&lt;/strong&gt; SCL and SDA both are in high level.&lt;/p&gt;

&lt;p&gt;• &lt;strong&gt;START Condition:&lt;/strong&gt; A HIGH to LOW transition on the SDA line while SCL is HIGH (IDLE).&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%2Fp2yb6v6ruftwi0t2j3kh.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%2Fp2yb6v6ruftwi0t2j3kh.png" alt=" " width="649" height="456"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;• &lt;strong&gt;STOP Condition:&lt;/strong&gt; A LOW to HIGH transition on the SDA line while SCL is HIGH (IDLE).&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%2Fjjzce10lfreymwtno3zg.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%2Fjjzce10lfreymwtno3zg.png" alt=" " width="621" height="487"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Acknowledge Condition&lt;/strong&gt;: The acknowledge signal sent by the receiving end after it received valid data. After every byte (8 bits) of data, at the ninth clock, the transmitting end releases SDA line to receive acknowledge signal from the receiving end.&lt;/p&gt;

&lt;p&gt;If SDA is low, the Acknowledge (ACK) is valid and the transmission is successful. If SDA is high, it will be a Not Acknowledge (NACK) and indicates the transmission has failed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data Transmission&lt;/strong&gt;: Data bits are allowed to change while SCL is LOW. After each 8 bits of data is tramsmitted, the slave would pull down the SDA (ACK) or pull up the SDA (NACK).&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%2Fyqvig279q1tzej2hq11x.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%2Fyqvig279q1tzej2hq11x.png" alt=" " width="713" height="293"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Software Simulated IIC&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Software Simulated IIC simulates IIC protocol by controlling GPIO pin levels in software. If the hardware IIC are not enough or are multiplexed as other functions, it is available to use simulated IIC to implement IIC communication.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;IIC Function Illustration&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;This chapter will introduce how we can use IIC driver’s functionalities and data types to build communication between QuecPython series modules and other IIC devices. The typical programming workflow consists of following parts:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Create an object&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Send data&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Receive data&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For specific introduction on API, please refer to machine.IIC in detail.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Create an Object&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;It is mandatory to specify IIC channel and working mode when creating an IIC object.&lt;/p&gt;

&lt;p&gt;class machine.I2C(I2Cn, MODE)&lt;/p&gt;

&lt;p&gt;For the parameters introduction and pin relationships, please refer to machine.IIC&lt;/p&gt;

&lt;p&gt;When creating an object, please note following aspects.&lt;/p&gt;

&lt;p&gt;• In a project, only one object can be created for one channel. When communicating with multiple IIC peripherals via one channel of IIC, it is only necessary to create one IIC object in one of the peripheral drivers.&lt;/p&gt;

&lt;p&gt;• In standard mode, the IIC communication baud-rate is 100k. While In fast mode, it is 400k instead. Note that the baud-rate shall never exceed the maximum supported baudrate of IIC peripheral devices.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;end Data&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;I2C.write(slaveaddress, addr, addr_len, data, datalen)&lt;/p&gt;

&lt;p&gt;When sending data over IIC, a couple of points should be noted:&lt;/p&gt;

&lt;p&gt;• The slaveaddress is a 7-bit address. When the master sends the slave address, the address will be shifted 1 bit to the left. After that, when writing data to the slave, the Least Significant Bit (LSB) will be a zero supplemented. When reading data from the slave, the LSB will be a one supplemented instead. For example, an IIC peripheral device has an address of 0x23, the master should send 0x46 if it want to send data to the slave, otherwise 0x47 shall be sent to read data from the slave.&lt;/p&gt;

&lt;p&gt;• The addr_len refers to the address length of the register. You can get this information from the peripheral’s datasheet. Commonly used IIC peripherals usually have an register address length of 1 byte such as QMA7981 3-Axis Accelerometer.&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%2Fmzvbhl4rz8hbolmyy1iz.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%2Fmzvbhl4rz8hbolmyy1iz.png" alt=" " width="668" height="237"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Receive Data&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;I2C.read(slaveaddress, addr, addr_len, r_data, datalen, delay)&lt;/p&gt;

&lt;p&gt;When receiving data over IIC, a couple of points should be noted:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Buffer management&lt;/strong&gt;： It is vital to manage buffer correctly. If data is not read before being overwritten by new data, there might be a data loss. Therefore, ensure data are read and processed in time before it’s overwritten.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;The delay parameter&lt;/strong&gt;： After receiving commands from the slave, some IIC peripherals may need some delay before returning data correctly. So as a master, a delay is needed between sending command and reading data. See next figure.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&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%2Fjqhgvxs4hw8n3xduiusz.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%2Fjqhgvxs4hw8n3xduiusz.png" alt=" " width="689" height="194"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Application Examples&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;AHT10 Temperature amp; Humidity Sensor&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;The AHT10 sensor is equipped with a newly designed ASIC, an improved MEMS semiconductor capacitive humidity sensing element and a standard on-chip temperature sensing element. It can be used in a variety of application such as: HVAC, Dehumidifiers, Test and Inspection Equipment, Consumer Products, Automotive, Automation, Data Loggers, Weather Stations, Appliances, Humidity Conditioning, Medical, and other related temperature and humidity detection and control.&lt;/p&gt;

&lt;p&gt;AHT10 works by:&lt;/p&gt;

&lt;p&gt;• Powering up the sensor. The sensor will take up to 20ms (SCL will be at HIGH) to get into idle status after being powered, then the sensor is ready to take orders from the master (Cellular Module).&lt;/p&gt;

&lt;p&gt;• The master must communicate with AHT10 via IIC and the slave address of AHT10 is 0x38. After the master issues the initialization command (‘11100001’=Initialization, ‘10101100’=Measurement), it must wait for the measurement till the end. Basic commands are listed in the below table.&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%2Fhl845g5ow8jpy38jj75g.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%2Fhl845g5ow8jpy38jj75g.png" alt=" " width="740" height="334"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Below is a table regarding the return value of the sensor.&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%2F6l1pvcrbpe9su86vi7x9.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%2F6l1pvcrbpe9su86vi7x9.png" alt=" " width="738" height="559"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Issue the collect data command (0xAC) to trigger AHT10 to collect temp &amp;amp; humidity data. Sleep for at least 75ms to wait for the sensor and read collected data from AHT10 afterwards.&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%2Fnks0ywm1ppyaaegat6xi.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%2Fnks0ywm1ppyaaegat6xi.png" alt=" " width="769" height="290"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After acquiring the data form AHT10, a conversion should be made on the raw data to get desired information.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Relative Humidity (RH)&lt;/strong&gt; Can be calculated from the relative humidity signal SRH from SDA using the formula below&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%2F35lkv6j8ra8bto5p7b8x.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%2F35lkv6j8ra8bto5p7b8x.png" alt=" " width="662" height="173"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Temperature (T)T&lt;/strong&gt; can be calculated from the temperature signal ST using the formula below&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%2Fppgzh33wlulz311g9cci.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%2Fppgzh33wlulz311g9cci.png" alt=" " width="695" height="175"&gt;&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%2Fpdw7yae1t34r824o9yi9.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%2Fpdw7yae1t34r824o9yi9.png" alt=" " width="775" height="329"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;FAQ#&lt;br&gt;
IIC is a very simple and straightforward communication protocol. There isn’t much issue when it comes to practical use.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Fail to receive or send data&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This might be caused by something like wrong baud-rate and wrong HW connection. You may check as below.&lt;/p&gt;

&lt;p&gt;• Check if module IIC baud rate is above the peripheral limit.&lt;/p&gt;

&lt;p&gt;• Check hardware connection. Make sure SDA/SCL and GND lines are connected properly.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;It is normal to transmit/receive, however, the data are wrong&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;It could be:&lt;/p&gt;

&lt;p&gt;• Voltage level of SDA/SCL in master are different from that in slave. When the master uses 3.3V while the slave uses 1.8V, a level of 1.8V is considered HIGH by peripheral but controller would think a level higher than 1.65V is considered HIGH, resulting in confusion probably.&lt;/p&gt;

&lt;p&gt;• The pull-up resistors in IIC circuit are high enough to hinder its ability to pull up. This will stretch the rising edge as well as the falling edge, leding to error in master.&lt;/p&gt;

</description>
      <category>python</category>
      <category>micropython</category>
      <category>iic</category>
    </item>
  </channel>
</rss>
