Phone

    00852-6915 1330

The Kynix Blog

Stay Ahead with Expert Electronics Insights,
Industry Trends, and Innovative Tips

Resistors

How to Use a Multimeter to Test Electronic Relays?

Executive Summary: 2026 Relay Testing GuideTo properly test a relay in 2026, you primarily need a digital multimeter to measure coil resistance (typically 50–120 Ω) and contact continuity. This guide covers the complete diagnostic workflow for both electromechanical and solid-state relays (SSRs), ensuring you can safely troubleshoot automotive and industrial electronics without replacing functioning parts. What is a Relay and How Does It Work?A relay is an electrically operated switch that uses a low-voltage signal to control a high-power circuit. In its simplest electromechanical form, it consists of a coil, an armature, and contact points. When a low voltage (such as 12V in a car) energizes the coil, it creates a magnetic field that pulls the armature, switching the connection from one contact to another. This isolation protects sensitive control electronics from high-current loads.Understanding the terminal designations is critical for 2026 diagnostics:COM (Common): The moving armature connection.NC (Normally Closed): The circuit is connected when the relay is off.NO (Normally Open): The circuit connects only when the relay is energized.This mechanism allows a small dashboard switch to control high-amperage devices like headlights or fuel pumps without melting the wiring.Internal schematic of a standard electromechanical relay Video Tutorial: How to Test a Relay with a MultimeterVisual Guide: The following video demonstrates the 2026 industry-standard method for bench-testing an automotive relay using a digital multimeter. This "out-of-circuit" method is safer and more accurate than guessing based on symptoms alone.What Tools Are Required for Relay Diagnostics?The primary tool required is a Digital Multimeter (DMM) capable of measuring resistance (Ohms), DC Voltage, and Continuity. While older analog VOMs (Volt-Ohm-Milliammeters) exist, modern DMMs are preferred in 2026 for their auto-ranging capabilities and precision.Essential capabilities for testing include:Ohmmeter Mode: To check the health of the internal coil winding.Continuity Mode: To verify if the contacts are opening and closing correctly (often indicated by a beep).Diode Test Mode: Essential for relays with built-in flyback diodes used to suppress voltage spikes. Why are Relays Critical in Modern Electronics?Relays serve as the bridge between logic components (like ECUs) and power components. They are ubiquitous in 2026, found in everything from EV charging stations to smart home systems.Key applications include:High Amperage Control: Switching 30A+ circuits (like cooling fans) using milliamp-level signals.Cable Protection: Preventing high current from traveling through the dashboard, reducing the risk of electrical fires.Logic Operations: Performing simple logic functions, such as ensuring a radio turns off when a door opens. Safety Precautions Before TestingElectrical safety is paramount; incorrect testing can damage the vehicle's computer (ECU) or cause injury. Before handling relays, adhere to these 2026 safety standards:Consult the Service Manual: Modern vehicles have complex wiring. The owner's manual is insufficient; use a technical service manual or a reputable online database.Environment Safety: Never test relays near flammable vapors (gasoline fumes/hydrogen from batteries) as relays can arc (spark) during operation.Physical Handling: Do not drop relays. The internal mechanical armature is sensitive to shock. If a relay is dropped on concrete, consider it compromised.Avoid "Parts Cannon" Swapping: Do not swap a suspected bad relay with a critical relay (like the fuel pump or airbag relay) unless specifications match exactly. A short circuit could damage the good relay or the circuit it protects. Step-by-Step Guide: How To Test a Relay?Testing a relay involves verifying two distinct circuits: the control circuit (coil) and the load circuit (switch). Relays are mechanical devices with a finite lifespan (often rated for 100,000+ cycles), but they eventually fail due to carbon buildup on contacts or coil burnout.Below is the comprehensive workflow for validating a relay's function using a multimeter. Phase 1: Visual & Bench Inspection Step 1: Perform a Visual AssessmentExamine the relay casing. Look for signs of heat stress, such as melted plastic or charred pins. If the relay has a transparent case (common in industrial "ice cube" relays), look for black soot on the contacts. Some modern industrial relays feature a built-in LED status indicator; if the LED is lit but the load isn't running, the contact points are likely failed.Visual inspection reveals internal contact wear Step 2: Isolate the Power SourceAlways remove the relay from the circuit before testing to avoid false readings from other components. Ensure the vehicle or machine is powered down. Be aware of capacitors in related circuits that may retain charge.Always disconnect power before removing the relay Step 3: Identify the Pinout ConfigurationMost automotive relays follow the standard DIN numbering system printed on the side:85 & 86: Control Coil (Input)30: Common Feed (High Power)87: Normally Open (NO) Output87a: Normally Closed (NC) OutputConsult the datasheet if the relay is specialized or lacks markings.Standard DIN relay pinout schematic Phase 2: Testing Solid-State Relays (SSRs) Step 1: Check Output Terminals for ShortsUnlike mechanical relays, SSRs do not click. They typically fail in the "shorted" (closed) position. With no control power applied, use an ohmmeter across the AC output terminals. It should read OL (Open Loop) or infinite resistance. If it reads near zero ohms while disconnected, the internal TRIAC or MOSFET has shorted, and the relay must be replaced.Testing SSR output for internal shorts Step 2: Input Testing (Diode Mode)Use the Diode Test mode on your multimeter to check the control input (A1/A2). Since the input is effectively an LED (optocoupler), testing it like a diode can sometimes verify functionality. In one direction, you may see a voltage drop (e.g., 1.0V - 1.4V for stacked diodes), and OL in reverse. Note that some advanced 2026 SSRs have internal conditioning circuits that make this test difficult; bench testing with a voltage source is preferred.Verifying the input circuit using diode test mode Step 3: Thermal Management CheckHeat is the #1 killer of SSRs. If an SSR has failed, check the thermal paste and heatsink seating. Unlike mechanical relays, SSRs generate significant heat during operation (approx 1W per Amp). Ensure the replacement is properly mounted with thermal compound. Phase 3: Testing Mechanical (Coil) Relays Step 1: Identify Coil SpecsBefore applying power, verify the coil voltage (usually 12VDC for cars, 24VDC for trucks, or 120VAC for industrial). Applying 120V to a 12V coil will instantly destroy it. Step 2: Check for Suppression DiodesMany modern relays include a "flyback" diode across pins 85 and 86 to protect the ECU. Polarity matters here. If you reverse the test leads on a diode-protected relay, you may damage the diode or your test equipment power supply. Look for the diode symbol on the relay case.Flyback diode symbol indicating polarity sensitivity Step 3: Measure Coil Resistance (The Most Important Test)Set your multimeter to Ohms (Ω). Measure across the coil pins (usually 85 and 86). Pass Criteria: A healthy 12V automotive relay coil typically reads between 50Ω and 120Ω. Fail Criteria:0Ω - 5Ω: Shorted coil (will blow fuses).OL (Infinite): Broken coil wire (relay will not activate).Identifying Coil (85/86) vs Load (30/87) Terminals Step 4: Verify Resting State (Continuity)With no power applied:Pin 30 to 87a (NC): Should have Continuity (near 0Ω).Pin 30 to 87 (NO): Should be Open (OL).Testing the de-energized state (Pins 30 to 87 should be Open) Step 5: Energize the RelayConnect jumper wires from a 12V battery (or bench power supply) to pins 85 and 86. You should hear a distinct, sharp "click". Note: A click does not guarantee the relay is good; the contacts could still be burnt. Proceed to Step 6.Energizing the coil to listen for the mechanical "click" Step 6: Voltage Drop/Contact TestWhile the coil is energized (clicking):Measure resistance between Pin 30 and Pin 87.Result: It should read 0.5Ω or less. If it reads higher (e.g., 5Ω+), the contacts are pitted/carbonized and the relay is bad, even if it clicks. Alternative Method: Testing with a DC Power SupplyFor a more controlled test, use a variable DC power supply. Increase voltage slowly to the coil. A 12V relay should pull in (click) at around 8V (Pick-Up Voltage) and drop out (release) at around 1V-5V. If the relay requires full 12V or more to click, it is "lazy" and aging. This method is excellent for diagnosing intermittent failures in 2026 electronics. Diagnosing a Bad Relay Without Removal (Socket Testing)If you cannot remove the relay, or want to test the circuit wiring:Verify Control Power (Pin 86): With the switch ON, Multimeter (DC Volts) should read battery voltage at slot 86.Verify Ground (Pin 85): Multimeter (Continuity) should beep between slot 85 and chassis ground.Verify Load Power (Pin 30): Slot 30 should always have battery voltage (check fuse if missing).The "Bypass" Test: Use a fused jumper wire to jump slot 30 directly to slot 87. If the component (e.g., horn, fan) turns on, the component and wiring are good, pointing to a bad relay or control signal.Socket diagnostics logic flow How to Test a 5-Pin Changeover Relay5-pin relays are common in headlight and window motor circuits. They switch power between two different outputs (87 and 87a).Standard 5-pin configurationResting Test: Measure resistance between Pin 30 and 87a. It must be near 0Ω. Measure Pin 30 to 87; it must be OL (Open Loop).Active Test: Energize the coil (85/86). Now measure Pin 30 to 87. It must be near 0Ω. Pin 30 to 87a should switch to OL.Common Failure: Often the "Normally Open" side works, but the "Normally Closed" (87a) side fails due to oxidation from lack of use. Automotive Relay Diagnostics: A 2026 Field Guide Step 1: Gather Diagnostic ToolsPrepare a Digital Multimeter (DMM), fused jumper wires, and alligator clips. While test lights are traditional, DMMs are safer for modern computer-controlled vehicles to avoid drawing excessive current. Step 2: Locate the Relay BoxCheck the "Power Distribution Center" under the hood or the interior fuse panel. Refer to the diagram often printed on the underside of the fuse box cover.Typical relay block location Step 3: The "Swap Logic" MethodThe quickest field test: Find an identical relay in the box (e.g., swap the Horn relay with the AC Compressor relay if part numbers match). If the problem moves to the horn, the original relay was bad. Warning: Ensure the amperage ratings match exactly to avoid damaging the circuit. Step 4: Bench Test the ResistanceWith the relay removed, measure the control pins (85-86). Expect 50-120 Ohms. If you see "OL" or extreme heat discoloration, replace the unit immediately.Multimeter readout showing resistance check Frequently Asked Questions (2026 Update)Can I test a relay without a multimeter?Not reliably. You can swap the relay with a known good one (as described in the "Swap Logic" step), which is the only reliable method without tools. The "shake test" (listening for a rattle) works only if the internal armature is physically broken, which is rare compared to burnt contacts. Why can't I find the relay in my 2026 vehicle?Modern vehicles increasingly use PCB-mounted relays inside Smart Junction Boxes (SJBs) or Body Control Modules (BCMs). These are soldered directly to the board and are not user-serviceable. In these cases, the entire module often requires replacement or professional board-level repair. How much does a replacement relay cost?In 2026, a standard 4-pin or 5-pin automotive relay typically costs between $8 and $25. Specialized high-amp relays or solid-state versions can range from $50 to over $100. A basic digital multimeter for testing can be purchased for under $30. What is the difference between a relay and a switch?A switch is manually operated (by a human finger), while a relay is a switch operated by an electrical signal. A relay allows a small manual switch (like a headlight dial) to control a massive power flow safely and remotely. What is the correct resistance reading for a DC relay?For a standard 12V automotive relay, the coil resistance should be between 50Ω and 120Ω. Values significantly lower (e.g., 20Ω) indicate a short that may blow fuses, while infinite resistance (OL) indicates a broken internal wire.{ "@context": "https://schema.org", "@type": "Article", "headline": "How to Test a Relay with a Multimeter: The 2026 Diagnostic Guide", "datePublished": "2022-12-10", "dateModified": "2026-01-24", "description": "Learn the industry-standard methods for testing mechanical and solid-state relays using a multimeter. Updated for 2026 automotive and electronics standards.", "author": { "@type": "Organization", "name": "ApogeeWeb Electronics" }, "image": "https://www.apogeeweb.net/upload/pdf/20221210/Relay.png", "mainEntity": [ { "@type": "HowTo", "name": "How to Test a Relay with a Multimeter", "step": [ { "@type": "HowToStep", "name": "Visual Inspection", "text": "Check the relay casing for signs of melting, charring, or corrosion." }, { "@type": "HowToStep", "name": "Identify Pins", "text": "Locate pins 85/86 (Coil) and 30/87 (Switch) using the relay schematic or datasheet." }, { "@type": "HowToStep", "name": "Measure Coil Resistance", "text": "Set multimeter to Ohms. Measure between pins 85 and 86. Value should be 50-120 Ohms." }, { "@type": "HowToStep", "name": "Test Continuity", "text": "Energize pins 85 and 86 with a 12V power source (listen for a click). While energized, check for continuity (0 Ohms) between pins 30 and 87." } ], "tool": [ { "@type": "HowToTool", "name": "Digital Multimeter" }, { "@type": "HowToTool", "name": "Jumper Wires" }, { "@type": "HowToTool", "name": "12V Power Source" } ] }, { "@type": "FAQPage", "mainEntity": [ { "@type": "Question", "name": "Can I test a relay without a multimeter?", "acceptedAnswer": { "@type": "Answer", "text": "Not accurately. The only reliable tool-free method is swapping the suspect relay with a known good relay of the exact same part number." } }, { "@type": "Question", "name": "What should a relay coil read in Ohms?", "acceptedAnswer": { "@type": "Answer", "text": "A standard 12V automotive relay coil should read between 50 and 120 Ohms. Readings outside this range usually indicate a failure." } }, { "@type": "Question", "name": "How do I know if a solid state relay is bad?", "acceptedAnswer": { "@type": "Answer", "text": "Solid State Relays (SSRs) typically fail shorted (closed). If the relay output shows continuity (0 Ohms) when no input signal is applied, the SSR is defective." } } ] } ]}
Ivy On 2022-12-10   3081
IC Chips

SMD components standards

Catalog Resistors and Capacitors Electrolytic capacitors Transistor & diode packages Integrated circuit SMD packages Ball Grid Array Small Outline Packages Flat Packages     Surface Mount Technology (SMT) is a technique for mounting electrical components directly to the surface of a printed circuit board (PCB). The component that is mounted on the surface of the PCB using surface mount technology is called Surface Mount Device (SMD). SMT has essentially replaced the through-hole PCB manufacturing technology to reduce cost, and increase efficiency and productivity. Since the size of SMD components is very small, compared to through-hole components many more SMD components can be arranged in a given place. Selecting and knowing the right SMD component for your PCB is very necessary. SMD components have standard codes and sizes which as a PCB designer one should know. Kynix offers all sorts of SMD components for PCB manufacturing which can be found here. This article will help you choose the right SMD component from the Kynix library.   SMD components come in various packages and sizes to facilitate the automated manufacturing of PCBs. Most of the SMD components are standardized to make manufacturing easy. The most commonly used SMD components are capacitors and resistors. The standards of these components are set by Joint Electron Device Engineering Council.   There are different types of packages. When a new package is introduced in the industry, it is named after its initials such as Quad Flat Package (QFP). While some packages have no name, it creates confusion in the industry. Below we have discussed flat chip SMD resistors, capacitors, diodes & transistors, and IC packages. The size of the SMD chip for resistor, capacitors, and some of the diodes is given by a 4 digits code, which represents the dimension of the flat chip either in inches or in millimeters. In the US it is represented in inches while outside the US it is represented in mm. The first two digits represent the length (L) of the component while the last two digits represent the width (W) of the component. While the thickness is also an important factor in manufacturing, it is not mentioned in the 4 digits code, for this, the actual datasheet of the component provided by the manufacturer should be used.   Many PCB components such as resistors, capacitors, diodes, FETs, and other transistors are available in SMD. SMD resistors and capacitors, also known as passive devices, come in different sizes. Depending upon the availability of space, soldering capability, and environment temperature, different packages can be used. The names of these packages given in the table below are derived from the size of the components in inches.   Resistors and Capacitors Below are the most common size codes for capacitors and resistors. You can find these resistors and capacitors here.   S. NoPackageDimensions (in)12010.02x0.01220160.2x0.1632020.02x0.0242040.02x0.0452070.02x0.0763030.03x0.0373060.03x0.0684020.04x0.0294040.04x0.04104060.04x0.02115020.05x0.05125050.05x0.08135080.05x0.1145100.05x0.1156030.06x0.03166060.06x0.06176120.06x12187050.07x0.05198050.08x0.05208080.08x0.08218150.08x0.15228160.08x0.16238300.08x0.32410100.1x0.12510200.1x0.22610500.1x0.52712060.12x0.062812100.12x0.12912160.12x0.163012180.12x0.183112200.12x0.23212240.12x0.243312250.12x0.253414050.14x0.053515050.15x0.053615060.15x0.063715100.15x0.13815750.15x0.753916080.16x0.084016320.16x0.324118120.18x0.124220100.2x0.14320120.2x0.124420180.2x0.184520300.2x0.34622080.22x0.084724090.24x0.094824120.24x0.124925100.25x0.15025120.25x0.125125150.25x0.155226150.26x0.155327250.27x0.255427260.27x0.265527280.27x0.285628160.28x0.165728170.28x0.175828180.28x0.185930140.3x0.146030200.3x0.2   At present most manufacturers can manufacture PCBs with SMD components up to 0603 easily, going below this size to such as 0402 or 0201 is still difficult for the manufacturers, and thus the cost of manufacturing increases if these components are included in the design. Therefore, most of the manufacturers recommend using 0603 components for PCB design.   Electrolytic capacitors The electronic industry adopted EIA and IECQ standards for molded tantalum capacitors. These packages are named A, B, C, D, and E. These correspond to different sizes in millimeters.   Package height is not included in the size code.   EIA codeMetric codeDimensionA32163.2 x1.6 mmB35283.5 x 2.8 mmC60326.0 x 3.2 mmD73437.3 x 4.3 mm   Several other electronic devices can not follow any standard because of their unique nature. SMD components like an inductor, transformers, crystals, resonators, and temperature-controlled oscillators require different packages often larger than the standard packages. It is very unlikely that these packages will be standardized because of their unique nature. However, the package must be chosen in a way to make pick and place possible. These capacitors can be found here.   Transistor & diode packages SMD transistors and diodes have the same package type. Transistors have three pins while a diode has two pins. The third pin is added to the diode package to keep the orientation right. Diodes are packages that come in different varieties. Some packages follow the standards of capacitors and resistors that we discussed above.   Some of the most common diode and transistor packages are SOT-23 - Small Outline Transistor: It is the most common diode and transistor package. It has three pins and measures 3 mm x 1.75 mm x 1.3 mm. It is used for low-power applications.SOT-223 - Small Outline Transistor: This diode package is used for high-power applications. It is bigger than SOT-23. It measures 6.7 mm x 3.7 mm x1.8 mm. It has four pins with which the fourth one is used for heat dissipation. Integrated circuit SMD packages IC packages are found in many packages and can be classified in many different ways. It is very common to hear the terms DIP, SOP, SIP, TSOP, QSOP, MSOP, SOIC, QFP etc. These are the different packages of IC. They can be categorized as.   There are three main package types for surface mount integrated circuits: Ball grid array (BGA)Small outline package (SOP)Quad flat pack (QFP) Ball Grid Array   Ball Grid Array package has solder balls attached to the underside of the package. Beneath the balls are electrical traces of IC. Ball Grid Array has further the following types. Molded Array Process Ball Grid Array (MAPBGA)Plastic Ball Grid Array (PBGA)  Thermally Enhanced Plastic Ball Grid Array (TEPBGA)Tape Ball Grid Array (TBGA)Package on Package   MicroBGA. Small Outline Packages   Small Outline Package is another IC package in which pins come out from the sides of the IC. The convention used for SOIC or SO package is the name followed by the number of pins used in the package. i.e SO-12 means the IC has 12 pins.   Further types of SOP/SOIC are SOJ - Small Out-Line J-Leaded PackageTSOP -Thin Small Outline PackageVSOP -Very Small Outline Package).TSSOP -Thin Shrink Small Outline Package SSOP -Shrink Small Outline PackageQSOP -Quarter-size Small Outline Package Flat Packages   Flat IC package have pins arranged on its side in L or J shape. These pins are arranged on the side of the package with the leads coming out. This package further has many subtypes. QFP (Quad Flat Package)TQFP (Thin Quad Flat Package)STQFP (Small Thin Quad Plastic Flat Package)FQFP (Fine-pitch Quad Flat Package),(Low profile Quad Flat Package)VQFP (Very-small Quad Flat Package)ETQFP (Exposed thin quad Flat Package)PQFN (Power Quad Flat Package)PQFP (Plastic Quad Flat Package)QFJ (Quad Flat J-Leaded Package)QFN (Quad Flat Non-Leaded Package)
Allen On 2022-11-29   595
Resistors

Toggle Switch Wiring, Types of Toggle Switch, and Circuit Diagram

Overview of switchesMain parameter of switchesSwitch SymbolSwitch DiagramWhat is a toggle switch?How does toggle switches work?Video related to toggle switchesFive ways toggle switch wiringCircuit diagram of toggle switchTypes of Toggle SwitchDPDT Toggle SwitchDPST Toggle SwitchSPDT Toggle SwitchSPST Toggle SwitchLED Toggle SwitchAdvantages and Disadvantages of toggle switchesRocker Switches vs Toggle SwitchesToggle Switch ApplicationsToggle Switch FAQ  Overview of switchesA switch is a piece of equipment used to stop current flow in a circuit. Simply put, a switch has the power to complete or disrupt an electrical circuit. To turn a device ON and OFF, every electrical and electronic application makes use of at least one switch.Switches are therefore a component of the control system, and control action is impossible without them. A switch has two possible states: completely ON (by shutting its contacts) and completely OFF (by opening its contacts).A switch establishes a closed conduit for the current to flow when its contacts are closed, which causes the load to draw power from the source. As demonstrated in the figure below, no power is used by the load when a switch's contacts are open. Main parameter of switchesSwitches ParametersVoltage ratingThe insulation materials, contact separation, rate of separation, and general safety considerations are some of the variables that affect voltage rating.Current carrying ratingThe electronics switches' current specifications are crucial since they will only be able to transport a particular amount of current through their contacts.Current switching ratingAn electromechanical switch's current switching rating is typically lower than its current carrying rating. The problem is that forming and breaking contacts creates arcing, and the contacts can only handle so much of it before the wear on the contacts significantly limits the operational life.Switch formatFor every electronics circuit design, choosing the appropriate switch format is essential. Toggle switches, slider switches, rotary switches, DIPs, thumbwheels, and many more are among the many various switch formats. Any switch's selection process includes the format.Number of operationsThere is always a tiny degree of wear as the contacts of a switch move across one another to ensure the best resistance is obtained.Contact resistanceThere is a higher contact resistance than there would be if the conductor were continuous because a switch's contacts are not a continuous conductor but can be broken and rebuilt.Power ratingThe maximum power that the switch can manage while working is indicated by its power rating. Overriding this rating may result in an excessive buildup of heat inside the device, which could lead to the switch failing and create a safety issue.Inductive ratingIf not handled properly, any inductance in a circuit will raise the intensity of arcing at the contacts and shorten the life of the switch. This means that once current is flowing, it is challenging to stop since the inductance will produce significant back EMFs when the current is stopped. This is because any inductance in the circuit will oppose the change taking place.Contact typeThere are two different types of contacts used in change-over type electromechanical: Break before make and Make before break.  Switch SymbolSwitch Symbol Switch DiagramSwitch Diagram What is a toggle switch?Toggle switches are electrical switches that be opened or closed using a lever or handle that is moved forward and backward. Toggle power switches and joystick switches are other names for these switches. These switches can be used in any electrical application because they are flexible devices.Since switches are typically manipulated manually, the toggle switch, which functions as a straightforward ON/OFF switch in many electrical circuits, is essential. The toggle switch controls the flow of current from the power source to a device or within a device by use of a lever.Toggle Switch How does toggle switches work?The armature switches the contact into position to start or halt an electrical flow when the switch operator pulls the toggle (the actuator). To put it simply, pushing the toggle can turn a gadget on or off. There are two functions that can be used; a momentary function means that the switch is only engaged when the force is applied. An internal spring mechanism forces the armature to return to its initial position in order to accomplish this. A latching toggle switch, in contrast, keeps the state after being depressed until the toggle is depressed once again to release the switch.The basic toggle switch design is as follows, although being available in various forms and configurations. When the toggle is pulled, an armature (a component conducting electrical current) attached to it moves, adding or removing an electrical contact from a circuit and activating or deactivating the circuit.Even though momentary switches also have an associated spring that will draw the actuator back to its starting point if released, the switch will typically stay in place unless manually pushed again. Video related to toggle switchesVideo Description: Add a switch easily to any household electronics item or automotive project easily by watching this short video. Five ways toggle switch wiringStep One: Look at the instruction about the toggle switchesElectrical setups for the many types of equipment that you might wish to install toggle switches on vary substantially. As a result, no single guide is likely to offer a universally applicable solution. The procedures in this section are intended to serve as general guidance for a straightforward on-off (also known as SPST) toggle switch. They should never take precedence over any installation instructions that came with your toggle switch or the appliance you're placing it into.You can look at the below instruction about the toggle switches:Toggle Switches Instruction Step Two: Your device's supply wire should be cutYou must link your toggle switch to the device's power source in order for it to act as an on-off switch. Cut the supply wire for your device with wire cutters at a spot that will make it easiest to route one or both ends of the cable to the switch. Using a wire stripper, remove about 12 inch (1.3 cm) of insulation from each end of the wire.Cut the supply wire Step Three: If the cable does not reach the switch from either end, add a pigtail.A pigtail is a brief wire piece with both ends stripped, often measuring under 6 inches (15 cm). It can be used as a form of "extender" by being attached to cables that aren't quite long enough to reach your toggle switch.Pigtail connetced to switches Step Four: Connect the supply wire to the toggle switchNow that the device's supply wire has been severed, you must insert your toggle switch so that it can control the circuit's current flow in the middle of the break. The kind of toggle switch you have will determine how you should proceed. Step Five: Test your switchWhen your toggle switch is properly wired, carefully reattach the power to the device and check the toggle switch's operation. You can swap out the panel or housing if everything functions as it should. Congratulations! A toggle switch has been fitted successfully. Circuit diagram of toggle switchThe SPDT toggle switch's circuit schematic is displayed below. A 6V battery, two resistors R1 & R3, two LEDs D1 & D3, and a 21236N switch can be used to construct this circuit.Three terminals, including one input and two outputs, make up this switch. Thus, we can acquire two outputs, the first of which comes from pins 2 (COM) and 1 and the second of which comes from pins COM and 3. In three-way circuits, this switch is mostly used to control electrical appliances from two places.The pins 1 and 3 are connected to D1 (an LED) and D2 (an LED), respectively, in the circuit shown above. When pin 1 is toggled, the D1 LED turns on and the D2 LED turns off. In a same manner, when pin 3 is toggled, D2 LED will turn ON and D1 LED will turn OFF. Consequently, we are able to manage two loads using a single SPDT toggle switch.Toggle Switch Circuit Diagram Types of Toggle SwitchThere are four main versions of these switch designs, each of which has a different combination of throws and poles, such as SPDT, SPST, DPDT, and DPST. Poles of these switches are often the distinct power supply controlled by each switch, whereas throws are the various areas the switch can be used, such as ON & OFF.DPDT Toggle SwitchDPST Toggle SwitchSPDT Toggle SwitchSPST Toggle SwitchLED Toggle Switch DPDT Toggle SwitchDouble pole, double throw (DPDT) toggle switches are used to establish or terminate connections between two conductors and two different circuits. There are six terminals on these switches, and terminals 3 and 4 get the necessary power to drive the loads on the other terminals, which are 1, 5, 2, and 6. Four-way or four-position switches are the names given to these switches.DPDT Switches The six terminals of a DPDT toggle switch are. The toggle switch is represented by terminals 3 and 4. The electricity required to drive the loads on terminals 1 and 5, as well as 2 and 6, is supplied to these terminals. Between terminals 1 and 5, terminal 3 can switch. Therefore, terminal 3, which represents the toggle switch, can switch between operating the fan and operating the motor if a fan is connected to terminal 1 and a motor is connected to terminal 5. The same is true for terminal 4, too. Between terminals 2 and 6, terminal 4 can switch. In this case, terminal 4, which acts as the toggle switch, can switch between the heater and the blower if a heater is connected to terminal 2 and a blower is connected to terminal 6.Two input switches on a DPDT switch can each be connected to one of two terminals. It can therefore use two switches to control four distinct circuits or devices.The circuit for a DPDT toggle switch is illustrated below:DPDT Toggle Switch Circuit Diagram  DPST Toggle SwitchThe name "DPST" refers to a double-pile single throw switch, which is used to establish or terminate the connection between two circuit conductors inside a single branch circuit. These switches typically have four terminals that can be used to simultaneously connect and disconnect two pairs of terminals.DPST Switches A 30A DPST switch is used in this wiring layout to connect a 240V AC load appliance (such as a dryer or water heater). The hot wires for 240V are immediately linked to the two pole, single throw switch and the load point as it is illustrated because there is no need to wire the neutral wire. The dryer is directly linked to the ground wire. When turned OFF, the DPST switch will cut both hot wires. Similar to that, while in the ON position, it will join both Hot wires.DPST Toggle Switch Circuit Diagram SPDT Toggle SwitchA single conductor connection with any of two additional single conductors can be made or broken using a toggle switch known as an SPDT, or single pole, double throw. These switches typically have three terminals, which are typically utilized in pairs. Any load must be connected to the first terminal in order to power a specific gadget. To power the loads on Terminals 1 and 3, Terminal 2 receives the necessary power, while Terminal 3 is utilized to connect to any load and turn on any device. This switch can therefore power any of two circuits. Three-way switches are another name for these kinds of switches.SPDT Switches Three terminals make up an SPDT toggle switch. Any load can be connected to Terminal 1 in order to power a specific appliance. Furthermore, any load can be connected to terminal 3 to power any device. The power required to power the loads on terminals 1 and 3 is delivered to terminal 2 at this point. A SPDT switch can therefore operate any of two circuits. It can switch between the two circuits so that various gadgets or circuits can be powered with just a flick of the switch. The circuit for an SPDT toggle switch is illustrated below:SPDT Toggle Switch Circuit DiagramWe link our 9-volt DC power source to terminal 2 in this circuit. The toggle switch at terminal 2 allows us to switch between terminals 1 and 3. A fan is attached to Terminal 1. The DC motor does not operate when the switch is flipped to the left (terminal 1). The DC motor turns on when the switch is flipped to the right (terminal 3), but the fan does not. You can see how we can control two distinct circuits or devices with an SPDT switch in this manner. A double throw switch offers two possibilities. SPST Toggle SwitchSPST, which stands for "Single Pole Single Throw," refers to a device with two terminals, such as input and output. These switches function just like an ON/OFF switch. This switch's primary job is to establish or terminate a connection between a single conductor and a single branch circuit. Once this switch is opened, the circuit will be cut off, stopping any current flow through the load. When the switch is closed, current flows through the load in a similar manner.SPST Switches A SPST toggle switch only has 2 terminals, as you can see. The input is on terminal 1. The output will be at the other terminal. Simple ON-OFF switches are what SPST toggle switches do. They interrupt the circuit when open, preventing current from reaching the load. Current can move across a closed circuit and drive the load. You can see that the DC motor may be started or stopped using this circuit simply as an ON/OFF switch. The circuit for an SPST toggle switch is illustrated below:SPST Toggle Switch Circuit Diagram LED Toggle SwitchToggle switches with illumination operate at 12 volts DC and light up to show the status of your circuit. Add some flair to your switch and control panels by using these lit toggle switches. Our assortment is completed by toggle switches with LED tips, duck bills, and longer handles. Red, blue, green, and amber are the available illumination colors. Toggle switches with illumination are available in an ON-OFF, single pole, single throw design. The switches' connections, which consist primarily of power in, power out, and a ground for the indicator light, are 1/4 inch push-on terminals. The fundamentals of how to wire an illuminated toggle switch are demonstrated in our video.You shouldn't have any trouble wiring an LED rocker switch if you pay close attention to where your ground, power, and acc pins are placed, follow the diagram below (which uses Oznium's LED Round Rocker Switch with a recommended mounting hole diameter of 3/4 inch) :LED Toggle Switch Circuit Diagram Advantages and Disadvantages of toggle switchesAdvantagesDisadvantagesUse of these switches with circuit boards is optimal.While using these switches, a clicking sound will be heard.These switches often have a small footprint, are incredibly sturdy, and are very easy to seal.When compared to rocker switches, these are bigger and bulkier.These switches are effective in controlling electricity.It requires a toggle lock washer.There are small and regular sizes of these switches available.Only low voltage circuits can use it.A lever can be used to extend and operate them.-These switches are energy efficient since they utilize less -These switches are very strong.- Rocker Switches vs Toggle SwitchesRocker switches and toggle switches are the two primary categories of maintained switches. The advantage of having a rocker switch is that you can typically add images, symbols, or even writing to the switch's face to make it more personalized. It therefore especially helpful in situations where function communication is required. Switches that can be sealed easily are perfect for usage with circuit boards. indicating increased resilience against water and dust. enhancing the switch's suitability for hostile conditions.Which switch is best for your project will ultimately depend on its design and environmental factors. From a design standpoint, some people favor the toggle switch's appearance, while others like the rocker switch's more common appearance. Your choice will be influenced by the circumstances. A toggle switch, for instance, may be preferable if the product is for the marine industry because of its IP rating. Toggle Switch ApplicationsThese switches give drivers of cars easy access to headlights, comparable controls, and indicator lights.Conveyor belts, residual current devices, and other industrial and electrical equipment employ these (RCDs).These switches are present in home, commercial, and industrial power outlets.It can serve as the primary switch for industrial machinery like conveyors and packaging machines as well as AC equipment.These switches are employed in switching headlights, logic-level programs, automobiles, and aviation control panels, among other things.Toggle switches are utilized as switching circuits in communications, commercial, and industrial equipment.  Toggle Switch FAQOverview and Applications of toggle switchAn electronic on/off switch is a toggle switch. The best purpose for toggle switches is to change the status of system settings and functionalities. To allow users to select between two opposed states, toggles may be used in place of two radio buttons or a single checkbox. What are the 4 types of switches?Single pole single throw, single pole double throw, double pole single throw, and double pole double throw are the four primary categories of switches. The differences between toggle and switchSince they both manage states but not in the same way, we must first distinguish between a toggle button and a toggle switch: Toggle button: Represents an action that changes a state. Two (or more) mutually incompatible states or possibilities that can be switched are represented by a toggle switch. Should a toggle switch be on the positive or negative?Never switch the ground return side; always switch the supply side. You can flip both lines if you're using a twin pole switch, but you must keep the ground line to the chassis intact. More corrosion is likely to occur on the negative terminal. What is a toggle switch?In order to switch an electrical circuit, toggle switches include an operating lever that can be moved up and down or left and right. A "toggle" is a little wooden rod that is used in place of buttons to fasten garments.
kynix On 2022-11-15   5186
Transmitters

RS485 Serial Communication Protocol

IntroductionWhat is RS485?MaterialsMAX485 pinoutHalf duplex operationHere is how the program worksFull duplex operationHalf duplex operation codeFull duplex codeIntroductionIn digital computer communication between two computers can be made using either parallel or serial method. In parallel communication separate line is dedicated for a one-bit information to transfer. This communication is fast and easy, but it requires a lot of wires at least as many as the number of bits need to be sent in parallel. For example, to transfer a 64-bit data from one device to another, 64 data lines will be required which is impractical in embedded systems. The alternative method to transfer data is to use serial communication. In serial communication one bit at a time is transferred from one device to another one. While this method solves the wiring problem it has a lot of other problems such as bandwidth, data lagging, complex protocol, and electrical standards. There are lot of different methods to do serial communication while one method is good in one situation another one is better in another situation. In this article we will discuss RS485 communication protocol which is one of the many available serial communication methods.Materials1MAX485 module2STM32 F401CDU6What is RS485?An industry specification called RS-485 outlines the physical layer and electrical interface for point-to-point electrical device communication. RS485 is the industrial standard for communication that defines the electrical interface and physical layer for point-to-point communication. RS485 is a robust communication system it can support multiple devices on a single bus, works in a noisy environment as well and requires a maximum of 4 lines.RS485 was first developed in 1983 and has since been used in many industrial applications because of its robustness and simplicity. It has the ability to transmit data over long distances while at the same time it is cheap, thus engineers are using it in all sorts of applications such as automotive, manufacturing, and theater spaces. Nowadays almost all motor controllers, VFDs and manufacturing machines will have a port available for RS485.RS485 is actually a standard that defines the electrical characteristics of the transmitters and receivers for communication protocols. RS482 uses two lines usually called A and B which must be balanced and differential. It means that the two lines must have same impedance, nearly same length and must be differential. The key features of RS485 communication are given belowMultipoint operation10 Mbps data transfer rate at 40 feet lengthMaximum cable length is 4000 feetRS485 works both in half duplex as well full duplex mode. In half duplex mode one device can either transmit or receive data at a time. While in full duplex mode, a device can transmit and receive data at the same time. Having more than one device on a bus can cause problem when two or more devices transmit data at the same time. Therefore, software control is necessary to ensure only one device transmit data at a time.RS485 is the physical layer of communication in the OSI model. It means this layer can be used as a base for other protocols such as UART which in most application people use because UART is an asynchronous communication protocol that does not require any clock signal which make it very easy to use. In this article we will demonstrate how RS485 can be used between two STM32 microcontrollers to communicate and exchange data. We will be using MAX485 module which is an easily available RS485 module. MAX485 pinoutRO → Receiver outputRE → Receiver enableDE → Data enableDI → Data inputVCC → Input voltageGND → GroundA, B → RS485 differential linesHalf duplex operationIn half duplex operation either data can be received or transmitted at a time. Both operations cannot be done at the same time. MAX485 has data flow control pins called DE and RE which puts the module in receiver mode or in transmit mode. Making them low puts the module in receiving mode while making them high puts the device in transmitter mode.In CubeMX the microcontroller of our choice is selected which in our case is STM32 F401CDU6. In connectivity UART1 should be enabled with 115200 bps baud rate. Other necessary settings are given below.RCC → Crystal/Ceramic ResonatorSYS → Debug → Serial WireClock Configuration → HCLK → 84 MHzClock Configuration → PLL Source Mux → HSEGPIO A7 is set as outputHere is how the program worksThe setup has two microcontrollers. We will call one side as A and the other side as B. When a user presses the user key on A STM32 microcontroller it will send the information to the B microcontroller via RS485. The receiving B microcontroller will switch on the onboard LED and will responds with an OK message. The OK message will blink the led on A microcontroller twice. Similarly, when the user presses key on B microcontroller it will transmit a message to A microcontroller and turns on the onboard LED and will responds with an OK message. The OK message will blink LED on B microcontroller twice. Similarly pressing the button again will do the same except this time it will turn off the LED.Full duplex operationIn full duplex operation data can be received or transmitted at the same time. Both operations can be done at the same time. In this mode two MAX485 modules will be required at each end and overall, 4 MAX485 modules will be used. It means that the two MAX485 modules will be constantly in receiving mode while the other two will constantly in transmission mode. MAX485 has data flow control pins called DE and RE which puts the module in receiver mode or in transmit mode. We will put the data control pins of two module as high while put the data control pins of other two module low. The configuration is shown below.The program works the same way as it was working in the half duplex mode however, this time the transmitted and received by MCUs at the same time.Half duplex operation code#include "main.h" UART_HandleTypeDef huart1; /* USER CODE BEGIN PV */int8_t R_Data[1] = {0};int8_t T_Data[1] = {69};/* USER CODE END PV */ /* Private function prototypes -----------------------------------------------*/void SystemClock_Config(void);static void MX_GPIO_Init(void);static void MX_USART1_UART_Init(void); int main(void){   HAL_Init();   SystemClock_Config();     MX_GPIO_Init();  MX_USART1_UART_Init();  /* USER CODE BEGIN 2 */  HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_RESET);   //Put RS485 module in receiving mode  HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, GPIO_PIN_RESET);   //Turn Off LED pin    while (1)  {      HAL_UART_Receive(&huart1, R_Data, 1, 10);  // If button is pressed on the other MCU  if(R_Data[0] == 83)  {  HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_13);                //Toggle LED pin  HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_SET);    //Put RS485 module in transmission mode  HAL_UART_Transmit(&huart1, T_Data, 1, 10);             //Send acknowledgment  HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_RESET);  //Put RS485 module in transmission mode  R_Data[0] = 0;  }  // If OK message is receive  if(R_Data[0] == 69)  {  if (HAL_GPIO_ReadPin(GPIOC,GPIO_PIN_13))  {  HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_RESET);  HAL_Delay(500);  HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_SET);  HAL_Delay(500);  HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_RESET);  HAL_Delay(500);  HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_SET);  }  else  {  HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_SET);  HAL_Delay(500);  HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_RESET);  HAL_Delay(500);  HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_SET);  HAL_Delay(500);  HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_RESET);  }  R_Data[0] = 0;  }  // Button is pressed  if(HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_0))  {  HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_SET);    //Put RS485 module in transmission mode  T_Data[0] = 83;  HAL_UART_Transmit(&huart1, T_Data, 1, 10);  T_Data[0] = 69;  HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_RESET);    //Put RS485 module in Receiving mode  }  }  /* USER CODE END 3 */}Full duplex code#include "main.h" UART_HandleTypeDef huart1; /* USER CODE BEGIN PV */int8_t R_Data[1] = {0};int8_t T_Data[1] = {69};/* USER CODE END PV */ /* Private function prototypes -----------------------------------------------*/void SystemClock_Config(void);static void MX_GPIO_Init(void);static void MX_USART1_UART_Init(void); int main(void){   HAL_Init();   SystemClock_Config();     MX_GPIO_Init();  MX_USART1_UART_Init();  /* USER CODE BEGIN 2 */  HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, GPIO_PIN_RESET);   //Turn Off LED pin    while (1)  {      HAL_UART_Receive(&huart1, R_Data, 1, 10);  // If button is pressed on the other MCU  if(R_Data[0] == 83)  {  HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_13);                //Toggle LED pin  HAL_UART_Transmit(&huart1, T_Data, 1, 10);             //Send acknowledgment  R_Data[0] = 0;  }  // If OK message is receive  if(R_Data[0] == 69)  {  if (HAL_GPIO_ReadPin(GPIOC,GPIO_PIN_13))  {  HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_RESET);  HAL_Delay(500);  HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_SET);  HAL_Delay(500);  HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_RESET);  HAL_Delay(500);  HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_SET);  }  else  {  HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_SET);  HAL_Delay(500);  HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_RESET);  HAL_Delay(500);  HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_SET);  HAL_Delay(500);  HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_RESET);  }  R_Data[0] = 0;  }  // Button is pressed  if(HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_0))  {  T_Data[0] = 83;  HAL_UART_Transmit(&huart1, T_Data, 1, 10);  T_Data[0] = 69;  }  }  /* USER CODE END 3 */}  
Victoria On 2022-10-26   796
Resistors

LEDs Test, LEDs design and How do LEDs work[FAQ&Video]

What is a LED?Video related to LEDLED Colours and materialsHow do LEDs work?Types of LedsCalculating LEDs resistor valueHow to Test LED LightsThe warning of LEDs useLEDs FAQWhat is a LED?LED = Light Emitting Diode. An LED must be prevented against transferring too much current because its electrical behavior differs significantly from that of a light. Typically, this is done by connecting a resistor in series with the LED. Never attach an LED directly to a power source or battery.LEDs must be wired in the proper direction; the diagram may be labeled with the letters an or + for the anode and k or - for the cathode (yes, it really is k, not c, for cathode). In the case of spherical LEDs, the cathode is the short lead and there may be a slight flat on the body. Although the cathode is the larger electrode within the LED if you can see it, this is not a recognized method of identification.LEDs Video related to LEDVideo Description: This video is mainly talk about how to design LED circuits, how to calculate resistor size, how to protect LED, how long will a battery power a circuit, how to calculate resistor power rating, how to connect LED and much more. LED Colours and materialsThe semiconductor material, not the coloring of the "package," determines the color of an LED (the plastic body). All colors of LEDs are available in uncolored, diffused (milky), or clear (commonly referred to as "water clear") packaging. The colored packaging is also offered in diffused (the typical type) and clear forms. White and blue LEDs could cost more than the other colors.ColorWavelength (nm)Voltage Drop (V)Semiconductor MaterialInfrared> 760< 1.9Gallium ArsenideInfrared> 760< 1.9Aluminium Gallium ArsenideRed610 - 7601.6 -2.0Aluminium Gallium ArsenideRed610 - 7601.6 -2.0Gallium Arsenide PhosphideRed610 - 7601.6 -2.0Aluminium Gallium Indium PhosphideRed610 - 7601.6 -2.0Gallium PhosphideOrange590 - 6102.0 -2.1Gallium Arsenide PhosphideOrange590 - 6102.0 -2.1Aluminium Gallium Indium PhosphideOrange590 - 6102.0 -2.1Gallium PhosphideYellow570 - 5902.1 -2.2Gallium Arsenide PhosphideYellow570 - 5902.1 -2.2Aluminium Gallium Indium PhosphideYellow570 - 5902.1 -2.2Gallium PhosphideGreen500 - 5701.9 -4.0Gallium Indium PhosphideGreen500 - 5701.9 -4.0Aluminium Gallium Indium PhosphideGreen500 - 5701.9 -4.0Aluminium Gallium PhosphideGreen500 - 5701.9 -4.0Indium Gallium NitrideBlue450 - 5002.5 -3.7Zinc SelenideBlue450 - 5002.5 -3.7Indium Gallium NitrideBlue450 - 5002.5 -3.7Silicon CarbideBlue450 - 5002.5 -3.7SiliconViolet400 - 4502.8 -4.0Indium gallium NitridePurplemultiple types2.4 -3.7Dual Blue/Red LEDsPurplemultiple types2.4 -3.7Blue with Red PhosphorPurplemultiple types2.4 -3.7White with Purple Plasticultraviolet< 4003.1 -4.4Diamondultraviolet< 4003.1 -4.4Boron Nitrideultraviolet< 4003.1 -4.4Aluminium Nitrideultraviolet< 4003.1 -4.4Aluminium Gallium Nitrideultraviolet< 4003.1 -4.4Aluminium gallium Indium NitridePinkmultiple types3.3Blue with phosphorPinkmultiple types3.3Yellow with Red, Orange or Pink phosporPinkmultiple types3.3White with Pink pigmentWhiteBroad spectrum3.5Blue/UV diode with Yellow Phosphor How do LEDs work?A P-type semiconductor (which has a higher hole concentration) and an N-type semiconductor are combined to create LEDs, which are semiconductor light sources (larger electron concentration). The P-N junction's electrons and holes will join once more when a strong enough forward voltage is applied, releasing energy in the form of light.LEDs (Light Emitting Diodes) transform electrical energy directly into light as opposed to conventional light sources, which first convert electrical energy into heat before turning it into light. This results in efficient light creation with minimal electricity waste.LEDs Emit Light Types of LedsDual In-Line Package (DIP) LEDs:The first LED chips were DIP ones, which are what most people think of when considering LED lights. Despite being more established than its more recent counterparts, DIP LED chips are still in use and are more frequently seen integrated into electronics because of their small size. However, they are not very strong and can only provide a small amount of brightness.DIP LEDs Surface Mounted Diode (SMD) LEDs:These are likely the most popular sort of LED chip available; they are installed and soldered onto the circuit board. They are more adaptable when it comes to encasing them within smaller electronics or across other forms of lighting, such as strip lighting, because they are brighter than their DIP counterparts and are also smaller. Three diodes can fit on a single SMD chip, allowing you to produce a variety of colors and provide customers more options. The LED market has undergone this significant progress. SMD 3528 and SMD 5050, both of which measure 5mm in width, are the two most used SMD chip sizes.SMD LEDs Chip on Board (COB) LEDs:The most recent advancement in LED technology is represented by these chips. Out of the three, COB LED chips are the brightest since they can frequently fit nine or more diodes onto a single chip. In what ways does this affect LED lighting? First off, it increases lighting efficiency by improving brightness-to-energy output. They can therefore be utilized with a variety of various lighting types. However, it's important to keep in mind that a COB LED chip's circuitry prevents it from emitting a wide variety of colors.COB LEDs Calculating LEDs resistor valueTo limit the current flowing through an LED, a resistor must be connected in series with the LED; otherwise, the LED will burn out fairly immediately. R, the resistor's value, is determined by:R = (VS - VL) / IR = resistor value in ohms (ohm).VS = supply voltage.VL = LED voltage (2V, or 4V for blue and white LEDs).I = LED current in amps (A) The LED current needs to be lower than what your LED is capable of handling. Since the The maximum current for typical 5mm diameter LEDs is frequently 20mA; however, many circuits can work with 10mA or 15mA. Divide the mA current by 1000 to convert it to amps (A) for the calculation.If the projected value is unavailable, pick the nearest larger standard resistor value so that the current will be a little less than what you chose. If you choose a higher resistor value to reduce the current, the LED will be less bright (for example, to extend the battery life).The color of the LED affects the voltage VL of the LED. The voltage of red LEDs is the lowest; yellow and green have a somewhat higher value. The highest voltages are used in blue and white LEDs. You can use 2V for red, yellow, and green LEDs and 4V for blue and white LEDs for the majority of applications where the precise value is not crucial. According to Ohm's law, the resistor's resistance, R = V/I, is determined by:V = voltage across the resistor (= VS - VL in this case) I = the current through the resistorSo R = (VS - VL) / IResistor Value How to Test LED LightsStep One: Use a MultimeterGet a digital multimeter with a diode reading capability. Simple multimeters only measure voltages, amps, and ohms. A multimeter with a diode setting is required to test LED lighting. Mid-range to high-range multimeters, which are more likely to offer this capability than affordable versions, can be found online or at your neighborhood hardware store.Multimeter Step Two: Connect the black and red test leadsTo the outlets on the front of the multimeter, attach the red and black test leads. The positive charge is in the red lead. The input marked "COM" should be connected in with the black lead, which is the negative.Multimeter Connect Step Three: Select the diode setting on the multimeter's dialTo move your multimeter's front dial from the "off" position, turn it clockwise. Up till you reach the diode setting, keep twisting it. The diode setting may be represented by the diode circuit symbol if it is not labeled explicitly. The cathode and the anode of a diode are both visually represented by the diode symbol. In this digital multimeter dial picture, we need to set the multimeter’s dial on 14 to test diode.Multimeter dial Step Four: The red probe should be connected to the anode and the black probe to the cathodeThe cathode end of the LED, which is typically the shorter prong, should be touched with the black probe. The red probe should then be pressed against the anode, which is the longer prong. Ensure that the black probe is connected before the red probe because doing so can result in inaccurate readings. During this test, be sure the cathode and anode are not in contact with one another since this could prevent electricity from flowing through the LED light and affect your results. Throughout the test, the red and black probes must not come into contact. After making the connections, the LED ought should turn on.Diode test Step Five: Verify the reading on the digital multimeter displayA healthy LED light should show a voltage of about 1600 mV when the probes are in contact with the cathode and anode. If during the test there is no reading displayed on your screen, repeat the procedure to ensure that the connections were completed correctly. This can indicate that the LED light isn't functioning if the test was done correctly. The transformer needs to be changed if your supply does not provide any output voltage. LED lights need to be replaced if there is voltage present at the output. The warning of LEDs useIn general, it is not a good idea to connect multiple LEDs in parallel with just one resistor shared between them. Only the lowest voltage LED will light if the other LEDs require slightly different voltages, and the higher current running through it could damage the other LEDs. One resistor can be used to successfully link identical LEDs in parallel, but since resistors are so inexpensive and the current utilized is the same as connecting the LEDs separately, this rarely provides any significant benefit.LEDs in parallelInstead, we should do as follows: Connecting LEDs in seriesConnecting LEDs in series LEDs FAQWhat can the LEDs be applied to?LEDs (Light Emitting Diodes) are mostly used to illuminate items and even spaces. Due to its small size, low energy consumption, long lifespan, and versatility in terms of use in many applications, it is applied everywhere. LED usage and applications include TV backlighting. How many types that LEDs own?Fundamentally, LED lighting uses three major forms of LED technology: DIP, SMD, and COB. What is LED and how it works?When an electric current passes through a semiconductor device called a light-emitting diode (LED), the LED emits light. When current flows through an LED, the electrons and holes recombine and produce light. How long do LED lights last?The longer lifespan of LED lighting fixtures is one of its main benefits. The most durable LED light fixtures have been evaluated to survive as long as 100,000 hours, whereas incandescent light bulbs were designed to last roughly 1,000 hours. On average, LED light bulbs last at least 20 years before needing to be replaced. Which is not a benefit of LED?On a capital cost basis, LEDs are now more expensive (price per lumen) than the majority of conventional lighting solutions.
kynix On 2022-10-17   1977
IC Chips

4×4 matrix keypad in STM32

Keypads are input devices that are being widely used in many embedded system projects. It can be found in appliances, door locks, and industrial machines. Keypads are used to take input from the user in the form of numbers or characters which can further be used for processing such as password, menu selection and navigating among different options. One of the most common and low-cost keypads is the matrix keypad with 4×4 or 3×3 buttons. In this article we will discuss how a low cost 4×4 matrix keypad can be used in STM32. Before proceeding further, we will need to know few things.Materials14×4 matrix keypad2STM32 F401How a 4×4 keypad works? 4×4 keypadIn microcontrollers usually a pin is used to take input from the user. This input can be either 1 or 0. Multiple 1’s and 0’s can be combined to store more information. For this purpose, multiple input pins will be required. However, this becomes impractical when the input pins required exceed certain number such as 16 or 9 as the microcontrollers do not have this many pins available.The 4×4 matrix keypad solves this problem and reduced the required number of pins to 8 or 6. It  is made of a thin and flexible membrane. The 16 keys of the 4 x 4 keypad module are arranged in a matrix of rows and columns. A copper trace connects each of these switches to the others. The rows and column are not connected to each other in normal condition. When we push a key, a column and a row come into contact with each other. In matrix keypads the buttons are divided among rows and columns. Four buttons lie on each row and each column. Thus, columns are connected to external input pins of microcontroller while the rows are connected to output pins of microcontroller. The output pins are high all the time. When a button is pressed the corresponding column goes high and the microcontroller detects it. Finding which column has been activated is easy as each column is connected to a separate pin, however, finding a row is difficult. Once both row and column are identified then the corresponding button can be identified. A clever method to identify the pressed key is to switch off all output pins except one, and then check which input pins is high. Doing this for all the output pins will identify the row. Once the row number is found out, the button can easily be traced out.matrix keypad in STM32STM32 F401 implementationSTM32 F401In CubeMX the relative microcontroller of our choice is selected which in our case is STM32 F401CDU6. The GPIOs that need to be selected as output or external interrupt input are given in the figure above. In the NVIC tab the interrupt should be enabled. Other necessary settings are given below.RCC → Crystal/Ceramic ResonatorSYS → Debug → Serial WireClock Configuration → HCLK → 84 MHzClock Configuration → PLL Source Mux → HSE Once the CubeMX code is generated the following code should be added to the /* USER CODE BEGIN PV */ section./* USER CODE BEGIN PV */  GPIO_InitTypeDef GPIO_InitStructPrivate = {0};  uint32_t previousM = 0;  uint32_t currentM = 0;  uint8_t key = 0;  uint8_t InputData[5] = {0};  int i = 0;/* USER CODE END PV */This code section defines the necessary variables that will come handy later.In the main.c section in /* USER CODE BEGIN 2 */ the output configured pins should be set to 1.  /* USER CODE BEGIN 2 */  HAL_GPIO_WritePin(GPIOA, GPIO_PIN_15, 1);  HAL_GPIO_WritePin(GPIOB, GPIO_PIN_3, 1);  HAL_GPIO_WritePin(GPIOB, GPIO_PIN_4, 1);  HAL_GPIO_WritePin(GPIOB, GPIO_PIN_5, 1);  /* USER CODE END 2 */  While the interrupt callback function void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) should be added to /* USER CODE BEGIN 4 */ section.void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin){  currentM = HAL_GetTick();  if (currentM - previousM > 10) {    /*Configure GPIO pins : PB6 PB7 PB8 PB9 to GPIO_INPUT*/    GPIO_InitStructPrivate.Pin = GPIO_PIN_6|GPIO_PIN_7|GPIO_PIN_8|GPIO_PIN_9;    GPIO_InitStructPrivate.Mode = GPIO_MODE_INPUT;    GPIO_InitStructPrivate.Pull = GPIO_NOPULL;    GPIO_InitStructPrivate.Speed = GPIO_SPEED_FREQ_LOW;    HAL_GPIO_Init(GPIOB, &GPIO_InitStructPrivate);     HAL_GPIO_WritePin(GPIOA, GPIO_PIN_15, 1);    HAL_GPIO_WritePin(GPIOB, GPIO_PIN_3, 0);    HAL_GPIO_WritePin(GPIOB, GPIO_PIN_4, 0);    HAL_GPIO_WritePin(GPIOB, GPIO_PIN_5, 0);    if(GPIO_Pin == GPIO_PIN_6 && HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_6))    {      key = 68; //ASCII value of D    }    else if(GPIO_Pin == GPIO_PIN_7 && HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_7))    {      key = 67; //ASCII value of C    }    else if(GPIO_Pin == GPIO_PIN_8 && HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_8))    {      key = 66; //ASCII value of B    }    else if(GPIO_Pin == GPIO_PIN_9 && HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_9))    {      key = 65; //ASCII value of A    }     HAL_GPIO_WritePin(GPIOA, GPIO_PIN_15, 0);    HAL_GPIO_WritePin(GPIOB, GPIO_PIN_3, 1);    HAL_GPIO_WritePin(GPIOB, GPIO_PIN_4, 0);    HAL_GPIO_WritePin(GPIOB, GPIO_PIN_5, 0);    if(GPIO_Pin == GPIO_PIN_6 && HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_6))    {      key = 35; //ASCII value of #    }    else if(GPIO_Pin == GPIO_PIN_7 && HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_7))    {      key = 57; //ASCII value of 9      if (i == 4)      {       //Send Data      }      else      {       InputData[i] = 9;      }      if(i <= 4)      {       i = i + 1;       }      else      {       i = 0;      }    }    else if(GPIO_Pin == GPIO_PIN_8 && HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_8))    {      key = 54; //ASCII value of 6      if (i == 4)      {       //Send Data      }      else      {       InputData[i] = 6;      }      if(i <= 4)      {       i = i + 1;       }      else      {       i = 0;      }    }    else if(GPIO_Pin == GPIO_PIN_9 && HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_9))    {      key = 51; //ASCII value of 3      if (i == 4)            {             //Send Data            }            else            {             InputData[i] = 3;            }            if(i <= 4)            {             i = i + 1;             }            else            {             i = 0;            }    }     HAL_GPIO_WritePin(GPIOA, GPIO_PIN_15, 0);    HAL_GPIO_WritePin(GPIOB, GPIO_PIN_3, 0);    HAL_GPIO_WritePin(GPIOB, GPIO_PIN_4, 1);    HAL_GPIO_WritePin(GPIOB, GPIO_PIN_5, 0);    if(GPIO_Pin == GPIO_PIN_6 && HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_6))    {      key = 48; //ASCII value of 0      if (i == 4)      {       //Send Data      }      else      {       InputData[i] = 0;      }      if(i <= 4)      {       i = i + 1;       }      else      {       i = 0;      }    }    else if(GPIO_Pin == GPIO_PIN_7 && HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_7))    {      key = 56; //ASCII value of 8      if (i == 4)      {       //Send Data      }      else      {       InputData[i] = 8;      }      if(i <= 4)      {       i = i + 1;       }      else      {       i = 0;      }    }    else if(GPIO_Pin == GPIO_PIN_8 && HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_8))    {      key = 53; //ASCII value of 5      if (i == 4)      {       //Send Data      }      else      {       InputData[i] = 5;      }      if(i <= 4)      {       i = i + 1;       }      else      {       i = 0;      }    }    else if(GPIO_Pin == GPIO_PIN_9 && HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_9))    {      key = 50; //ASCII value of 2      if (i == 4)      {       //Send Data      }      else      {       InputData[i] = 2;      }      if(i <= 4)      {       i = i + 1;       }      else      {       i = 0;      }    }     HAL_GPIO_WritePin(GPIOA, GPIO_PIN_15, 0);    HAL_GPIO_WritePin(GPIOB, GPIO_PIN_3, 0);    HAL_GPIO_WritePin(GPIOB, GPIO_PIN_4, 0);    HAL_GPIO_WritePin(GPIOB, GPIO_PIN_5, 1);    if(GPIO_Pin == GPIO_PIN_6 && HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_6))    {      key = 42; //ASCII value of *     }    else if(GPIO_Pin == GPIO_PIN_7 && HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_7))    {      key = 55; //ASCII value of 7      if (i == 4)      {       //Send Data      }      else      {       InputData[i] = 7;      }      if(i <= 4)      {       i = i + 1;       }      else      {       i = 0;      }    }    else if(GPIO_Pin == GPIO_PIN_8 && HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_8))    {      key = 52; //ASCII value of 4      if (i == 4)      {       //Send Data      }      else      {       InputData[i] = 4;      }      if(i <= 4)      {       i = i + 1;       }      else      {       i = 0;      }    }    else if(GPIO_Pin == GPIO_PIN_9 && HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_9))    {      key = 49; //ASCII value of 1      if (i == 4)      {       //Send Data      }      else      {       InputData[i] = 1;      }      if(i <= 4)      {       i = i + 1;       }      else      {       i = 0;      }    }     HAL_GPIO_WritePin(GPIOA, GPIO_PIN_15, 1);    HAL_GPIO_WritePin(GPIOB, GPIO_PIN_3, 1);    HAL_GPIO_WritePin(GPIOB, GPIO_PIN_4, 1);    HAL_GPIO_WritePin(GPIOB, GPIO_PIN_5, 1);    /*Configure GPIO pins : PB6 PB7 PB8 PB9 back to EXTI*/    GPIO_InitStructPrivate.Mode = GPIO_MODE_IT_RISING;    GPIO_InitStructPrivate.Pull = GPIO_PULLDOWN;    HAL_GPIO_Init(GPIOB, &GPIO_InitStructPrivate);    previousM = currentM;   }} In the callback function the two linescurrentM = HAL_GetTick();  if (currentM - previousM > 10)takes care of the debouncing of the buttons. In keypad it is a common problem that a but hits once is recorded twice or thrice. So, take of that, a little delay is added at the beginning of callback function.The complete code is given below.#include "main.h" /* USER CODE BEGIN PV */  GPIO_InitTypeDef GPIO_InitStructPrivate = {0};  uint32_t previousM = 0;  uint32_t currentM = 0;  uint8_t key = 0;  uint8_t InputData[5] = {0};  int i = 0;/* USER CODE END PV */ /* Private function prototypes -----------------------------------------------*/void SystemClock_Config(void);static void MX_GPIO_Init(void);/* USER CODE BEGIN PFP */ /* USER CODE END PFP */ /* Private user code ---------------------------------------------------------*//* USER CODE BEGIN 0 */ /* USER CODE END 0 */ /**  * @brief  The application entry point.  * @retval int  */int main(void){  /* USER CODE BEGIN 1 */   /* USER CODE END 1 */   /* MCU Configuration--------------------------------------------------------*/   /* Reset of all peripherals, Initializes the Flash interface and the Systick. */  HAL_Init();   /* USER CODE BEGIN Init */   /* USER CODE END Init */   /* Configure the system clock */  SystemClock_Config();   /* USER CODE BEGIN SysInit */   /* USER CODE END SysInit */   /* Initialize all configured peripherals */  MX_GPIO_Init();  /* USER CODE BEGIN 2 */  HAL_GPIO_WritePin(GPIOA, GPIO_PIN_15, 1);  HAL_GPIO_WritePin(GPIOB, GPIO_PIN_3, 1);  HAL_GPIO_WritePin(GPIOB, GPIO_PIN_4, 1);  HAL_GPIO_WritePin(GPIOB, GPIO_PIN_5, 1);  /* USER CODE END 2 */   /* Infinite loop */  /* USER CODE BEGIN WHILE */  while (1)  {    /* USER CODE END WHILE */     /* USER CODE BEGIN 3 */  }  /* USER CODE END 3 */}  /* USER CODE BEGIN 4 */void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin){  currentM = HAL_GetTick();  if (currentM - previousM > 10) {    /*Configure GPIO pins : PB6 PB7 PB8 PB9 to GPIO_INPUT*/    GPIO_InitStructPrivate.Pin = GPIO_PIN_6|GPIO_PIN_7|GPIO_PIN_8|GPIO_PIN_9;    GPIO_InitStructPrivate.Mode = GPIO_MODE_INPUT;    GPIO_InitStructPrivate.Pull = GPIO_NOPULL;    GPIO_InitStructPrivate.Speed = GPIO_SPEED_FREQ_LOW;    HAL_GPIO_Init(GPIOB, &GPIO_InitStructPrivate);     HAL_GPIO_WritePin(GPIOA, GPIO_PIN_15, 1);    HAL_GPIO_WritePin(GPIOB, GPIO_PIN_3, 0);    HAL_GPIO_WritePin(GPIOB, GPIO_PIN_4, 0);    HAL_GPIO_WritePin(GPIOB, GPIO_PIN_5, 0);    if(GPIO_Pin == GPIO_PIN_6 && HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_6))    {      key = 68; //ASCII value of D    }    else if(GPIO_Pin == GPIO_PIN_7 && HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_7))    {      key = 67; //ASCII value of C    }    else if(GPIO_Pin == GPIO_PIN_8 && HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_8))    {      key = 66; //ASCII value of B    }    else if(GPIO_Pin == GPIO_PIN_9 && HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_9))    {      key = 65; //ASCII value of A    }     HAL_GPIO_WritePin(GPIOA, GPIO_PIN_15, 0);    HAL_GPIO_WritePin(GPIOB, GPIO_PIN_3, 1);    HAL_GPIO_WritePin(GPIOB, GPIO_PIN_4, 0);    HAL_GPIO_WritePin(GPIOB, GPIO_PIN_5, 0);    if(GPIO_Pin == GPIO_PIN_6 && HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_6))    {      key = 35; //ASCII value of #    }    else if(GPIO_Pin == GPIO_PIN_7 && HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_7))    {      key = 57; //ASCII value of 9      if (i == 4)      {       //Send Data      }      else      {       InputData[i] = 9;      }      if(i <= 4)      {       i = i + 1;       }      else      {       i = 0;      }    }    else if(GPIO_Pin == GPIO_PIN_8 && HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_8))    {      key = 54; //ASCII value of 6      if (i == 4)      {       //Send Data      }      else      {       InputData[i] = 6;      }      if(i <= 4)      {       i = i + 1;       }      else      {       i = 0;      }    }    else if(GPIO_Pin == GPIO_PIN_9 && HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_9))    {      key = 51; //ASCII value of 3      if (i == 4)            {             //Send Data            }            else            {             InputData[i] = 3;            }            if(i <= 4)            {             i = i + 1;             }            else            {             i = 0;            }    }     HAL_GPIO_WritePin(GPIOA, GPIO_PIN_15, 0);    HAL_GPIO_WritePin(GPIOB, GPIO_PIN_3, 0);    HAL_GPIO_WritePin(GPIOB, GPIO_PIN_4, 1);    HAL_GPIO_WritePin(GPIOB, GPIO_PIN_5, 0);    if(GPIO_Pin == GPIO_PIN_6 && HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_6))    {      key = 48; //ASCII value of 0      if (i == 4)      {       //Send Data      }      else      {       InputData[i] = 0;      }      if(i <= 4)      {       i = i + 1;       }      else      {       i = 0;      }    }    else if(GPIO_Pin == GPIO_PIN_7 && HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_7))    {      key = 56; //ASCII value of 8      if (i == 4)      {       //Send Data      }      else      {       InputData[i] = 8;      }      if(i <= 4)      {       i = i + 1;       }      else      {       i = 0;      }    }    else if(GPIO_Pin == GPIO_PIN_8 && HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_8))    {      key = 53; //ASCII value of 5      if (i == 4)      {       //Send Data      }      else      {       InputData[i] = 5;      }      if(i <= 4)      {       i = i + 1;       }      else      {       i = 0;      }    }    else if(GPIO_Pin == GPIO_PIN_9 && HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_9))    {      key = 50; //ASCII value of 2      if (i == 4)      {       //Send Data      }      else      {       InputData[i] = 2;      }      if(i <= 4)      {       i = i + 1;       }      else      {       i = 0;      }    }     HAL_GPIO_WritePin(GPIOA, GPIO_PIN_15, 0);    HAL_GPIO_WritePin(GPIOB, GPIO_PIN_3, 0);    HAL_GPIO_WritePin(GPIOB, GPIO_PIN_4, 0);    HAL_GPIO_WritePin(GPIOB, GPIO_PIN_5, 1);    if(GPIO_Pin == GPIO_PIN_6 && HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_6))    {      key = 42; //ASCII value of *     }    else if(GPIO_Pin == GPIO_PIN_7 && HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_7))    {      key = 55; //ASCII value of 7      if (i == 4)      {       //Send Data      }      else      {       InputData[i] = 7;      }      if(i <= 4)      {       i = i + 1;       }      else      {       i = 0;      }    }    else if(GPIO_Pin == GPIO_PIN_8 && HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_8))    {      key = 52; //ASCII value of 4      if (i == 4)      {       //Send Data      }      else      {       InputData[i] = 4;      }      if(i <= 4)      {       i = i + 1;       }      else      {       i = 0;      }    }    else if(GPIO_Pin == GPIO_PIN_9 && HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_9))    {      key = 49; //ASCII value of 1      if (i == 4)      {       //Send Data      }      else      {       InputData[i] = 1;      }      if(i <= 4)      {       i = i + 1;       }      else      {       i = 0;      }    }     HAL_GPIO_WritePin(GPIOA, GPIO_PIN_15, 1);    HAL_GPIO_WritePin(GPIOB, GPIO_PIN_3, 1);    HAL_GPIO_WritePin(GPIOB, GPIO_PIN_4, 1);    HAL_GPIO_WritePin(GPIOB, GPIO_PIN_5, 1);    /*Configure GPIO pins : PB6 PB7 PB8 PB9 back to EXTI*/    GPIO_InitStructPrivate.Mode = GPIO_MODE_IT_RISING;    GPIO_InitStructPrivate.Pull = GPIO_PULLDOWN;    HAL_GPIO_Init(GPIOB, &GPIO_InitStructPrivate);    previousM = currentM;   }}  
Allen On 2022-10-17   1030

Kynix

Kynix was founded in 2008, specializing in the electronic components distribution business. We adhere to honesty and ethics as our business philosophy and have gradually established an excellent reputation and credibility in our international business. With the accurate quotation, excellent credit, reasonable price, reliable quality, fast delivery, and authentic service, we have won the praise of the majority of customers.

Follow us

Join our mailing list!

Be the first to know about new products, special offers, and more.

Kynix

  • How to purchase

  • Order
  • Search & Inquiry
  • Shipping & Tracking
  • Payment Methods
  • Contact Us

  • Tel: 00852-6915 1330
  • Email: info@kynix.com
  • Follow Us

authentication

Kynix

© 2008-2026 kynix.com all rights reserved.