🚚 Free delivery on orders over: €35 Croatia • €60 EU • $100 U.S.

WHAT IS A PULL-UP / PULL-DOWN RESISTOR

INTRODUCTION

When using a microcontroller or any other digital logic devices we encounter the concept of pull-up resistors. They ensure us to maintain the desired state of a logic circuit, whatever the conditions. Thus an a high impedance state when the pin is not set in the HIGH or LOW state, but instead float between those two states. A good example of this are Dasduino input pins. Try to command your Dasduino board a code which will in the Serial monitor write digital readout of a pin. The readings that you get should be LOW, or 0 (zero). However, if on the same pin an experimental board cable is connected and you simply touch it with your hand, you will notice that the situation is changing from LOW to HIGH and vice versa. To pin is said to float which is not acceptable, especially for such a precise microcontrollers.

Pull-up resistor on Dasduino Core board

 

PULL-UP VS PULL-DOWN RESISTOR

Pull-up and pull-down resistors are not a special type of resistor but simply a constant value connected via, mainly, + 5V and pin or GND and pins. Resistor between pin and + 5V is called pull-up resistor, while the one between the pin and GND is a pull-down resistor. The default value of this resistor is 4.7kΩ or 10K, but more about that later. When to use a pull-up and when a pull-down resistor, we will study in the example of push-up keys aka pushbuttons.

We will connect one push button on the pull-down resistor (pictured above left), and the other on the pull-up resistor (pictured above right). Resistance value can be 10K ohms supplied in CSP set. We will write a code that will print status of pushbuttons on the serial monitor. To write code, you can use the example of the Arduino IDE under File – Examples – Digital – Button. Alternatively, you can use the code below. It is connected via a pull-down resistor to give us the state of CA 0 (LOW) when it is inactive, or 1 (HIGH) when activated. The opposite will be readings on pin 6 which is connected via a pull-up resistor. Now we are sure that the push button will not be activated “by itself”.

const int button1 = 7;  
const int button2 = 6;   
void setup() {
  pinMode(button1, INPUT);
  pinMode(button2, INPUT);
  
  Serial.begin(9600);
}
void loop() {
  Serial.print("State of button 1: ");
  Serial.println(digitalRead(button1);
  Serial.print("State of button 2: ");
  Serial.println(digitalRead(button2);
  
}

 

CALCULATING THE VALUE OF THE RESISTOR

The value of the resistor depends on two factors. First is consumption, waste of energy. If the value of the resistor is too low HIGH (+ 5V in the example above), the voltage will go through a pull-up resistor and unnecessarily waste energy when the circuit is closed. The energy will be spent on heating. This condition is called a strong pull-up and should be avoided when your circuit doesn’t not need much power. Another factor is the voltage when the circuit is open, ie. pressed. If the value of the resistor is too large, the input voltage may be too small for microcontroller to register as a change. This situation is called a weak pull-up. Croduino digitally register voltage of 3V or more as HIGH, everything else is LOW .
Usual assay is that we use resistors which are at least 10 times less than the resistance of the input pins. For Croduino, of course, and all other Arduino chips, which use 5V voltage, typical resistor value is 1-10kΩ. Recommended values for sensors are ​​1-5kΩ, and good value for start is 4.7kΩ. Use Ohm’s law, if you want to calculate the exact value of a pull-up resistor for a particular module.

THE INTERNAL PULL-UP RESISTORS

Atmega328 chip, which are located on Dasduino Core have integrated 20kΩ pull-up resistors. If you use an Arduino board with some other microcontroller, the value of an integrated pull-up resistors can be found at this link. We invite you in defining the pin using INPUT_PULLUP.

pinMode(pin, INPUT_PULLUP);

What is polarity

If you know one thing about batteries, it’s that they have one positive and one negative terminal (or pole). When connecting the battery, the positive side goes to the positive side of a device. Likewise, the negative goes to the negative. The energy won’t flow through the circuit if it’s connected the opposite way. Some components work similarly. But why is that? Because of something called polarity.

Current direction

Before talking about polarity in more detail, we have to first go over the current direction. The conventional current flows from the positive pole to the negative. Electrons flow in the opposite direction, from the negative pole to the positive.

 

When working with electronic circuits, only the conventional current is shown. All descriptions use it. If you see an arrow depicting current flow, you know for a fact it’s the conventional current flow.

 

In a direct current (DC) circuit, the current flows in one direction only. One pole is always negative while the other is always positive. In an alternating current (AC) circuit, these poles change from negative to positive and vice versa routinely.

What is polarity

 

What is polarity in electricity?

In the simplest terms, polarity indicates the symmetry of a component. It is a directional flow of electrons from one pole to the other. Hence, the name. The components are either polarized (with polarity) or non-polarized (without polarity).

 

Non-polarized components are as simple as they get. They can be connected either way and will work correctly. It is uncommon for them to have more than two terminals. Every terminal on a non-polarized component is equal.

 

Polarized components can be connected only one way in a circuit for them to work. The current must go from anode to cathode (from the positive pole to the negative). If the current goes the other way, at best it will just stop the circuit. At worst, it could result in sparks and burned components. Polarized components can have a minimum of two pins and over one thousand. Every pin is unique. They each have a designated position where they go. If they aren’t connected correctly, some of the mentioned issues might happen.

 

Polarity identification

But how would someone identify which pole is positive or negative? If there is a constant voltage between two points, one of them will have more electrons than the other. The pole with more electrons has negative polarity. The other one, then, has positive polarity. If those two points are connected with a conductive path, the electrons flow from one pole to the other. This is what we call an electric current.

 

When polarity needs to be identified on a schematic or a diagram, the polarity symbols are used. The positive pole is usually marked with the color red or a plus symbol. The negative pole is most commonly marked with the colors black or blue and a minus symbol. Other color schemes are sometimes used in different industries, like automotive and telecommunications.

 

The term polarity is used in electronic signaling, electricity, and magnetism. It is a crucial concept to understand before seriously working with electronics. You won’t be able to solder components to a PCB or plug them into a breadboard if you don’t understand it. Knowing how to identify polarized components is essential before any of that.

 

Let’s go over the most common components to learn how and recognize polarized components and connect them properly.

Resistor

A resistor  is a component you’ll be using the most. It doesn’t have polarity so you don’t have to worry about how you connect it. This is true for both THT and SMD resistors. Imagine it like a bumpy road. No matter the side you come from, it will be bumpy. No matter which side the current comes from, the resistance will be the same.

What is polarity

You’ll want to use an appropriate resistor for the circuit, though. Too strong of the resistor will block current from reaching all components. If it’s too weak, there is a chance of components frying due to excessive current.

 

Non-polarized capacitor

Depending on the material, capacitors  can be polarized or non-polarized. Non-polarized THT capacitors commonly have blue or yellow ceramic bodies.

What is polarity

Non-polarized SMD capacitors look like tiny, two-colored metal bricks. They don’t have any markings on them to indicate terminals.

What is polarity

 

Diode & LED

A diode is a two-terminal component that allows current flow in only one direction. It is always polarized. The positive pole is called the anode, and the negative cathode. Current flows through the anode to the cathode. The diode’s sibling, the LED (light-emitting diode) , is not too different. The main difference is that LED emits light, as the name suggests.

 

Since both diode and LED are polarized, there is a need for differentiating the anode and cathode. On a regular THT diode, the cathode is marked with a colored band at the end. The 1N4007 diode  is pictured below. As you can see, the cathode is on the left, indicated by the silver band.

 

What is polarity

SMD diodes similarly indicate cathode. The line indicating cathode can be of various thicknesses, but it is always on the cathode side.

What is polarity

The LED indicates the cathode a little differently. Instead of a colored band, the cathode pin will be shorter on the LED. Since you can’t see this when the LED is soldered or on a breadboard, the case will be slightly cut off on the cathode side. This might be a bit hard to notice at first, but once you see it, you’ll have no trouble finding it in the future.

LED (Light-emitting diode) explained

SMD LEDs similarly indicate the cathode – one corner will be slightly cut off.

What is polarity

 

Battery

If you don’t connect the battery correctly, it won’t matter if you connect polarized components properly. Batteries are polarized, so regardless of which one you use, you need to connect it correctly.

 

If you replaced batteries, you know how to find their polarity. Most of them will indicate the positive terminal with a plus symbol, and the negative with a minus symbol. Some batteries might have wires. The red wire will indicate the positive terminal, and the black or blue wire will indicate the negative terminal.

What is polarity

 

Polarized capacitor

As mentioned, capacitors can be either polarized or non-polarized. THT electrolytic capacitors (those that look like little tin cans) are polarized. The negative terminal is usually marked with a minus symbol on the side. The cathode pin is also usually shorter than the anode.

What is polarity

Be very careful when connecting the electrolytic capacitor. If it’s not connected correctly, it will end up in smoke, becoming useless. It might even explode ! Before plugging your circuit with capacitors into a power source, make sure everything is connected correctly.

 

Similar to SMD diodes, SMD capacitors have a line on the side indicating a terminal. Unlike diodes that have a line indicating cathode, the capacitor’s line indicates anode.

What is polarity

 

 

Integrated circuit (IC)

A single integrated circuit can contain hundreds of pins, each with its function. Just like electrolytic capacitors, it is important to pay attention to an integrated circuit’s polarity. Otherwise, it will most likely burn, melt, and become completely unusable.

 

An integrated circuit will usually have a notch or an etched dot to indicate the first pin.

What is polarity

 

Check the datasheets

Among the many components available, these are just a few examples. Knowing the polarity of the components allows you to prevent damage.

 

Some non-polarized components can be packaged in polarized packages. Most components will indicate whether they are polarized or not. You should always check the datasheets if you’re unsure of the component’s polarity.

 

When working with components, it is also important to know whether they are active or passive.  If you’re interested in building some projects, check our tutorials page . We regularly update it with new tutorials and projects.

E Ink Displays: The Evolution and Advantages of Digital Paper

Electronic ink (e-ink) technology has become a game-changer in the world of digital displays, offering a unique blend of readability, energy efficiency, and flexibility. In this article, we delve into the workings of e-ink displays, their historical evolution, applications across various industries, and the distinctive advantages they bring to the digital landscape.

How E Ink Works

E-ink operates on a simple yet ingenious principle. Microscopic particles within the display contain charged pigments that respond to an electric field. When a charge is applied, the particles move, creating patterns that form text and images. Unlike traditional displays that emit light, e-ink displays reflect ambient light, providing a paper-like reading experience.

Evolution of E Ink Technology

The journey of e-ink technology began in the 1970s, but significant advancements have occurred in recent decades. Key breakthroughs include improvements in contrast, resolution, and the development of flexible e-ink displays. Companies like E Ink Corporation have played instrumental roles in pushing the boundaries of e-ink technology.

Applications of E Ink Displays

E-ink displays find applications in diverse fields. In e-readers, the technology replicates the appearance of ink on paper, reducing eye strain and offering a comfortable reading experience. Beyond literature, e-ink is making waves in digital signage, where it provides dynamic displays with minimal power consumption. Wearable technology, such as smartwatches and fitness trackers, benefits from the low power requirements of e-ink displays. Moreover, industries like healthcare and manufacturing leverage e-ink for its visibility in various lighting conditions.

Advantages of E Ink Displays

The strengths of e-ink displays lie in their efficiency and readability. These displays consume significantly less power compared to traditional LCD and OLED screens, resulting in extended battery life for devices. The high visibility of e-ink in different lighting conditions, including direct sunlight, enhances user experiences. Furthermore, the reduction of eye strain makes e-ink an ideal choice for prolonged reading or continuous usage. The flexibility of e-ink displays also opens doors to innovative form factors in product design.

Challenges and Limitations

While e-ink displays offer numerous benefits, they come with their set of challenges. The slow refresh rates in monochrome e-ink displays can be a limitation for certain applications. Additionally, color capabilities in e-ink are currently limited, posing challenges for industries that require vibrant visuals.

Future Developments in E Ink Technology

The future of e-ink displays is promising, with ongoing research and development focusing on overcoming current limitations. Innovations in color e-ink and improvements in refresh rates are on the horizon, potentially expanding the range of applications for this technology.

E Ink vs. Other Display Technologies

In comparison to traditional LCD and OLED displays, e-ink stands out for its energy efficiency and readability in various lighting conditions. The reflective nature of e-ink reduces the need for backlighting, contributing to a more sustainable and eco-friendly display technology.

Conclusion

E-ink displays have come a long way since their inception, proving to be a versatile and sustainable alternative in the realm of digital screens. As technology continues to evolve, e-ink’s unique advantages and potential for innovation position it as a key player in the future of display technologies, impacting industries and enhancing user experiences across the board.

LED (Light-emitting diode) explained

LED (Light-emitting diode) explained

Pretty much everywhere you look, you will see an LED in use. It doesn’t matter if you’re looking at your smartphone, TV, car, or coffee machine, there are some likely in them. LEDs are widely used and supported, and come in many colors, shapes, and sizes. The first Arduino project usually being taught is making an LED blink  because of its simplicity and LEDs’ widespread use. Let’s dive into the world of LEDs together and learn a thing or two about them!

What is an LED?

The first question that might pop into your mind is, what is exactly an LED? A regular diode is a semiconductor device that works as a one-way switch for electrical current. It allows current in only one direction and will stop it from flowing in the other. An LED works the same way. The only difference is that it emits light when the current passes through, as the name suggests. This similarity is reflected even in the schematic , as seen below.

LED (Light-emitting diode) explained

The only difference between a diode and an LED in the schematic is the arrows added over the symbol. They represent the light being emitted from the diode.

If you take a closer look at an LED, you will see it’s made of several parts. The case or housing of the LED is usually made from epoxy or plastic material. This makes it more durable to fall or similar damage. The inside of the LED consists of two main parts – post and anvil. The post is the positive side of the LED, the anode side, and the anvil is the negative side, the cathode. A die is inside a little divot on the anvil, and the bond wire leaps from anvil to post, connecting the two.

LED (Light-emitting diode) explained

For the light to be emitted, the diode has to be made from special material. The semiconductor die, the thing that makes LED emit light, is made from gallium arsenide (GaAs), gallium phosphide (GaP), gallium arsenide phosphide (GaAsP), silicon carbide (SiC), gallium indium nitride (GaInN), aluminum gallium indium phosphide (AlGaInP), and similar chemical compounds. The color of the LED will depend on the compound used.

To understand how to work with LEDs, we have to know some things about them.

 

Polarity

In electronics, polarity  indicates the symmetry of a component, meaning it will matter how you connect it if it’s polarized. Non-polarized components can be connected either way and they will work properly (e.g. resistors). As mentioned, a diode will allow the current to flow in only one direction. Thus, an LED is polarized and will only emit light if it’s connected correctly. For it to work properly, the current must go from anode to cathode. The anode must be connected to the positive end and the cathode to the negative. If it’s the other way around, the LED will remain off. It won’t break, it just won’t work, and it might stop the whole circuit. On a schematic diagram, the anode should be the line coming to the broad side of the triangle.

LED (Light-emitting diode) explained

Every diode should have some physical mark to differentiate the anode from the cathode. On most regular LEDs you will work with, the anode “leg” or pin is longer than the cathode. Since you can’t see the pins’ lengths once you plug them in a breadboard or solder them, the cathode side of the case will be slightly cut off. It might be hard to notice at first, but once you find it, you’ll have no trouble seeing it in the future.

LED (Light-emitting diode) explained

 

Current and resistors

The light emitted will depend on the current the LED draws. The more light it emits, the more power it uses, thus the more batteries it drains. Diodes in general do not limit current and will destroy themselves if they consume too much of it. Resistors are used to prevent this from happening. They will restrict the electrons’ flow in the circuit and save the LED from drawing too much power. But with so many resistors out there, which one should you use to prevent your LED from burning itself?

We made a tutorial on resistors so if you’re not sure how to calculate its resistance, find out here . For most LEDs, you’ll be fine with using a 330-ohm resistor. That’s the one with two orange and one brown color band. The stronger resistor you use, the less bright LED will be.

LED (Light-emitting diode) explained

If you don’t want to calculate the resistance, you can always try plugging in different resistors to see what happens. Resistors let go of extra power as heat so if it’s getting warm, you’ll likely want a smaller one. If it’s too small, however, you might burn out your LED. When you plug in your resistor and LED on the circuit, check if the LED quickly blinked on and off. If that’s the case, you burned your LED and should use the stronger resistor. If the LED is on, but it’s not as bright as you hoped for, try using a different resistor. Experiment this way until you get wanted LED brightness. Keep in mind that this is not the recommended way of doing things, and we strongly encourage you to learn how to read resistor values.

When you’re looking at LED’s datasheet , you’ll see three things listed that you’ll find useful. They are the forward current, peak forward current, and suggestion using current. Most LEDs will have the forward current rated at 20 mA. This means for optimal performance, you could run them on 20 mA. This doesn’t mean you have to necessarily run them at that value, just that it’s recommended for most cases. Peak forward current is usually set at 30 mA. You can run them on higher than that, but you’re risking breaking them. Suggestion using current is usually set to 16-18 mA. We would recommend using LEDs at around 10 mA to extend their shelf life, as the brightness difference between 10 and 20 mA is relatively insignificant.

 

Forward voltage

A term you’ll likely see often when working with LEDs is the forward voltage. It is a number that will help you with the voltage your circuit needs to supply to LEDs. This number becomes especially important if you have more than one LED connected to one power source. If you provide 5 V to your circuit, your components put together shouldn’t exceed that number.

Here’s a list of the most common forward voltages for LEDs depending on the color:

  • Red – 1.6 V
  • Orange – 2 V
  • Yellow – 2.1 V
  • Green – 1.9 V
  • Blue – 2.4 V
  • Ultraviolet – 3 V
  • Clear white- 3.5V

 

Types of LEDs

We’ve talked about regular, one-color, simple LEDs thus far. But LEDs have come much further than that and there are a bunch of types today. Here are some of the LED diodes we find particularly interesting to work with.

Bi-color and tri-color LED

Bi-color and tri-color LEDs will light up in a color depending on the current flow direction. Regular bi-color LED has two wires. The LEDs are connected back to back, anode to cathode. The color of the light will depend on the anode which is provided with positive voltage. Let’s say the LEDs in our example have colors green and red.

If the red anode is provided voltage, the red LED will light up. Conversely, if the green anode is provided voltage, the green LED will light up. In this system, only one LED can light up at a time.

LED (Light-emitting diode) explained

Tri-color LEDs are a bit different. They have three wires, one for each anode and the middle one for the cathode. Like with the bi-color LED, depending on the anode provided with a positive voltage, that color will light up. Here’s a catch. Because the two anodes are wired separately, you can apply a positive voltage to both wires. If you do, the LED will light up in a third color, which is a mixture of both.

LED (Light-emitting diode) explained

 

 

RGB LED

RGB is short for red, blue, and green. RGB LED is essentially LEDs in those colors put together. Combining those colors, RGB LED can produce almost any color, but it struggles with shades of pink and brown. With legs for each of the three colors, an RGB LED will have a fourth leg, for anode or cathode. When looking at an RGB LED, you should face it so the second leg from the left is the longest. They should then be in the following order: red, anode or cathode, green, and blue.

LED (Light-emitting diode) explained

The red, green, and blue wires are all connected to the external anode or cathode wire (the second leg). Depending on whether you have anode or cathode RGB LED, you’ll supply power differently. If you have an anode one, you’ll connect the anode wire on the power supply to the positive terminal. A low signal will need to be applied to red, green, and blue wires. However, if you have a cathode one, you’ll connect the cathode wire on the power supply to the negative terminal. A high signal will need to be applied to the red, green, and blue wires.

LED (Light-emitting diode) explained

LED (Light-emitting diode) explained

 

 

Infrared LED

An infrared LED, or IR LED, looks like a normal LED at first and can be hard to distinguish. The main difference is that it emits light in the infrared range. This is outside of the normal visible spectrum so you won’t see this type of LED emit light. They allow for the cheap production of infrared light and enable wireless communication between devices and sensors. That is why they are common in machine-to-machine environments, as well as Internet of Things applications.

You’ve likely seen this type of LED in real use. A TV remote control is a prime example of an infrared LED. Some older cell phones that still used physical buttons had IR LEDs to transfer data to other devices.

SMD LED

When you look at an Arduino board, you will notice a few SMDs (surface-mount-devices). Like other components, LEDs can also be surface mounted. The RX and TX LEDs on Arduino are, as you might have guessed, examples of SMD LEDs. These types of LEDs don’t require any wiring and are soldered directly onto a circuit board.

There are a couple of SMD LED variants, such as with diffuse or water-clear lens, and three chips. The three chips can have the same or three different colors. If it has different colors, they are red, green, and blue. Thus, the LED can produce virtually any color wanted.

The SMD LEDs are rectangularly shaped and have three cells that contain semiconductor crystals. These crystals produce light when current goes through them. Resin is used for the protection of the SMD cell. A single-color LED will always have one anode and one cathode. The SMD RGB LED will have three anodes and cathodes, one for each color.

LED (Light-emitting diode) explained

LED (Light-emitting diode) explained

 

OLED

OLED stands for organic light-emitting diode. Unlike other LEDs we’ve talked about so far, OLED is a conductive sheet of organic compounds that emits light when an electric current passes through. This layer, grouped with some others, is placed between two electrodes. The “organic” compound means that it contains carbon-hydrogen bonds, and doesn’t refer to materials harvested from nature.

OLEDs are massively used in screens, from smartphones and TVs to Arduino projects . Because of how it’s made, each pixel on the OLED display is controlled individually and emits its light. In LCDs, for example, the light comes from a backlighting unit. That is why OLEDs offer better image quality in screens, display bright colors better, and show “real” black.

LED (Light-emitting diode) explained

 

 

Pros and cons of using an LED

As with everything we use, LEDs have some pros and cons. Compared to incandescent light sources, LEDs have a longer lifespan and need less power. That is why they are becoming a norm in light bulbs, among other places. Here’s a list of why you should consider using LED is in your projects, and why you might want to seek an alternative.

Pros:

  • Very cheap
  • Come in different shapes, sizes, and colors
  • RGB LEDs allow you to light them up in virtually any color
  • Light up very quickly
  • Physically robust
  • Can easily be dimmed by lowering the forward current or with PWM
  • Radiate very little heat
  • Long lifetime
  • Can be used in a variety of applications

Cons:

  • Single LED’s power is low
  • Short illumination range
  • Can easily burn so they depend on resistors and other components
  • Require current-regulated supply
  • Different colored LEDs require different voltages

 

Real-life applications

LEDs are really simple to use and very cheap to produce. They see use virtually everywhere because of this. You’re likely using items with LEDs without even realizing it. Our smartphones and smartwatches are using OLEDs. Cars and other vehicles come with LED lights more often than with incandescent as they used to before. Camera flashes, traffic lights, alarm systems, flat panel displays in public places… The list goes on.

We use LEDs pretty much daily in our work. We even use them when tinkering with our projects at home. Take a look at our tutorial pages  to find some projects using them. With so many varieties available and so many applications LEDs have, we’re sure you thought of some Arduino projects on your own. For which project are you planning to use an LED? Let us know! 🙂

WHAT IS MOSFET?

When you opened the Dasduino set for beginners, you must have found one MOSFET transistor among many given components. You must have wondered what is MOSFET and what is its purpose? In this article, we will explain MOSFET in detail, its basic characteristics and work priciple in order for you to understand how this component works and what it can be used for.

WHAT IS MOSFET?

MOSFET (engl. Metal–Oxide–Semiconductor Field-Effect Transistor) is a name for a special type of unipolar FET  (engl. Field Effect Transistor) transistor. MOSFET has three pins better known as Source, Drain and Gate. Source and Drain are electrodes derived from layers of semiconductor which are connected into the so-called “channel”. Using the control electrode (Gate), we control the flow of current on that channel. MOSFET transistor’s main feature is the fact that, unlike bipolar transistors which are current-controlled, MOSFET is voltage-controlled. This means that, the current flow (between Source and Drain electrode) is being controlled by certain amount of voltage brought to the Gate electrode of MOSFET. It is enabled by adding a special thin layer of oxide material, most commonly silicon dioxide (SiO2 – primary glass-making material) around the control electrode, by which it is electrically isolated from the “channel”.

MOSFET’s work can also be seen as a variable resistor where using the difference between the Source and Gate electrode, we can control the resistance between Source and Drain electrode. When there is no voltage between Source and Gate electrode, the resistance between Source and Drain pin is very high ( it can reach values up to MΩ) and it can be seen as if the circuit is open, i.e. the current does not flow through the circuit. But, by bringing certain amount of voltage between the Source and Gate electrode, specified resistance is reduced, thereby enabling the current flow, i.e. we can say that the circuit is closed.                                        The appearance of static charge can easily damage the isolating oxide layer. Since the oxide layer acts as a very thin dielectric of the capacitor, low static charge can create charge large enough to break through the layer and damage the transistor. Usage requires careful handling to prevent ruining the transistor by static electricity.

 

TYPES OF MOSFET TRANSISTORS

There are two different types of MOSFET transistors: P (engl. positive) and N (engl. negative) channel MOSFET. Their function is the same, but primarily they differ in the internal structure. P-channel MOSFET‘s internal structure is made so that the conductive channel is made out of P type, while the N-channel MOSFET‘s conductive channel is made of N type. For proper operation of the P-channel MOSFET it is necessary to bring negative voltage to the control electrode (Gate). For the N-channel MOSFET it is necessary to bring positive voltage to the control electrode (Gate), in order for it to function properly. The image below shows the internal structure of P and N-channel MOSFET.

Along with that, there are two more types of MOSFET transistors: enhancement and depletion. By the enhancement type of MOSFET, the conducting channel between the Source and Drain electrode is only generated by applying the voltage on the Gate electrode. When talking about the depletion MOSFET transistors, there is a quite opposite characteristic. When there is no voltage on the Gate electrode, the resistance on the conducting channel is minimal. By increasing voltage on the Gate electrode, the resistance on the conducting channel also increases. The image below shows symbols of all types and kinds of MOSFET transistors. Pay attention to the fact that each type has a different symbol that is displayed in the circuit.

WHAT IS MOSFET USED FOR?

Now, you must be wondering what are MOSFET transistors used for, do I really need them and where can I find their use? MOSFET is mostly used as an electronic switch or amplifier where by using certain voltage it leaks or controls flows of a different voltage current. Various integrated circuits, such as microprocessors and memory devices, contain from thousands to one million integrated MOSFET transistors on each device, providing basic switch functions necessary for the implementation of logical operations and data storage. Different electronic circuits which contain MOSFET transistors are widely used in applications such as power sources, variable frequency drives and other applications for power supplying where each device can control electric energy of up to 1000W. Radio frequency amplifiers which operate up to very high frequencies (UHF spectrum) use MOSFET transistors as oscillators. It is apparent that the usage of MOSFET transistors is very wide. If you are interested in an example of a project which includes MOSFET transistors, check our tutorial on How to use MOSFET as a switch?.

You want to know more about MOSFET transistors? Then you should certainly check the simulation in which you can see its behavior within the circuit, change parameters of the circuit and see how they affect MOSFET’s work.

HUM: THE SIMPLE H-BRIDGE

You are a beginner with Dasduino. Or electronics? A specific module caught your eye, but you do not know how to use it? Do not worry, HUM is here for you! How to Use Module (HUM) is a blog tutorials series by soldered where you will find all you need in order to begin working with your favorite module. Tutorials include: technical characteristics, work principle, instructions on how to connect module with Dasduino and the basic code. Everything else is left to your imagination.

INTRODUCTION

You have certainly already encountered some type of a DC motor. You know that connecting the DC motor’s pins to a source of certain voltage results in rotating the motor to one side. Also, if we switch pins on the motor and connect the power source the opposite way, we will see that the motor rotates to the opposite side. This feature of the motor is very useful, but it is complicated to constantly switch pins of the motor manually. There must be an electronic circuit which can do it for us? Of course there is. The answer is in the H-bridge circuit. Using it, we can easily and safely change the motor rotation direction. In continuation, we will explain the H-bridge work principle in more detail.

Characteristics:
• Maximum current: 
• Maximum voltage: 
• Control via and control pins

HOW DOES IT WORK?

H-bridge is a circuit that, in theory, consists of four switches connected to some load (e.g. DC motor). Various configurations of these switches can allow us to control current flow in the circuit. Using the H-bridge, it is very simple to switch the polarity on the load. Even though the load can theoretically be whatever you want, by far, the most widely used H-bridge application is for DC and stepper motors. It is most commonly used to control and replace the DC motor rotation direction. H-bridge is also used in many other applications such as DC/AC, AC/AC or DC/DC converters. The H-bridge circuit reminds of the letter H, and that is how it has gotten its name.

The image above represents a scheme display of the H-bridge. We can see that the H-bridge consists of four MOSFETs connected in a certain way. Because of the inability to simultaneously switch between the two possible states of the bridge, diodes were added to the circuit (mostly Schottky’s diodes) in order for it to ensure simultaneous switch of states and limit the current’s flow power during these short periods of imbedding, without the load voltage being too high. The upper end of the bridge is connected to a power source (e.g. battery), while the bottom end is grounded. The basic work principle of the H-bridge is very simple: if Q1 and Q4 are turned on, the left cable of the motor will be connected to the power supply, and the right to the ground. The current flows through the motor (so to say) in the forward direction, and the engine shaft starts rotating.

If Q2 and Q3 are on, what will happen is quite the opposite, the motor is powered in the reversed direction, and the shaft will rotate in the opposite direction.
You must never close Q1 and Q2 (or Q3 and Q4) at the same time! If that happens, a direct path between the power supply voltage and ground which is of very low resistance is created, which ultimately results in a short circuit. A short circuit can lead to destruction of the H-bridge, or some other component in the circuit.

The table below shows every possible combination of switch states and their outcome.

It is necessary to note that this module has only two control pins (A and B) which are used to control the H-bridge operation. A pin is connected to 2 MOSFETs (Q1 and Q2) which are actually one N-channel and one P-channel MOSFET. The reason for it is the elimination of states in which the Q1 and Q2 are simultaneously “turned on”. When the N-channel MOSFET conducts current, P-channel MOSFET does not, and it ensures that, at any given time, Q1 and Q2 are not in the same state (more about MOSFETs here). B pin is connected to the other 2 MOSFETs (Q3 and Q4) in the same way. This makes it easier to work with the module where we do not have to look out for accidentaly making the short circuit or destroying the module.

 

HOW TO CONNECT IT?

Below, we will show the connection of the H-bridge module with the DC motor whom we will control using Dasduino. H-bridge contains several pins:

VCC – Input for the external power supply.
GND – Serves for connecting minuses of the power supply.
A – Control pin for controlling the H-bridge operation.
B – Another control pin for controlling the H-bridge operation.
OUTPUT x2 – Two pins to which we connect the load (e.g. DC motor).

The image below shows an example of the correct connection of the H-bridge with Croduino. It is necessary to note that the A and B module pins are connected to Croduino, while the DC motor is connected to the OUTPUT pins. It is not important which OUTPUT pin is connected to which DC motor connector, as the rotation direction will be determined in the program.

ARDUINO CODE

There is no need to use any library for motor control using the H-bridge module. By simply switching the A and B connectors on/off using digitalWrite() function, we start the motor. The motor will rotate only when the A pin’s state is different from B pin’s state. When their states are the same, A=B, it means we have brought the same voltage to both motor connectors (e.g. +5V or -5V). Therefore, when the A pin is in HIGH state, and B in LOW, the motor will rotate in one direction. When the A pin is in LOW state, and B pin in HIGH, the motor will rotate to the opposite direction.

//This simple program runs the motor for 2 sec in one direction, after which the motor stops for 2 sec
//After that, the direction changes and it rotates to the opposite direction for 2 sec and then stops for 2 sec
int pinA = 4;       // defining pins for motor rotation control
int pinB = 3;
void setup() {
  pinMode(pinA, OUTPUT);      // Setting pins as outputs
  pinMode(pinB, OUTPUT);
}
void loop() {
  pokreniMotor (1); //the motor rotates in one direction
  delay(2000);      //wait 2 sec
  pokreniMotor (0); //the motor stops
  delay(2000);      //wait 2 sec
  pokreniMotor (2); //the motor rotates in the opposite direction
  delay(2000);      //wait 2 sec
  pokreniMotor (0); //the motor stops
  delay(2000);      //wait 2 sec
}
void pokreniMotor (int stanje) { //we use this function to start the motor
  switch (stanje) {
    case 0:                    //if the state=0, the motor will not start, breaking mode
      digitalWrite(pinA, LOW);
      digitalWrite(pinB, LOW);
      break;
    case 1:                    //if the state=1, the motor will rotate in one direction
      digitalWrite(pinA, HIGH);
      digitalWrite(pinB, LOW);
      break;
    case 2:                    //if the state=2, the motor will rotate in the opposite direction
      digitalWrite(pinA, LOW);
      digitalWrite(pinB, HIGH);
      break;
      
    default:                  //not necessary, if the state is different than the above mentioned values, turn the engine off, for safety.
      digitalWrite(pinA, LOW);
      digitalWrite(pinB, LOW);
      break;
  }
}

Parallel vs serial communication

Without communication protocols, there would be no embedded electronics or microcontrollers. They allow integrated circuits to share data and information with each other. It would be an understatement to say there are quite a lot of communication protocols. They fit in one of two categories, though: parallel or serial. Let’s learn more about how different these two categories are.

Parallel communication

Between the two, parallel communication was used much more in the past. It was the preferred choice of sending the data at the time. While not as common as it once was, it is still used in many different applications. You’ll mostly find it inside your devices in some crucial internal workings, such as RAM or CPU.

 

The main principle is simple – use more wires to transfer data bits faster and at the same time. If your parallel bus has eight wires, and the data you’re sending has eight bits, you can send them simultaneously. More data wires mean higher throughput rates, which results in faster output. The most common number of wires is 8, 16, and 32, but it can go higher than that. Hence, 8, 16, or 32 bits can be sent together.

 

To ensure that bits are sent at the same time, a clocking signal sent over a separate wire is provided. Thus, we can say that parallel communication is synchronous. The parallel channel can also have a signal to control data flow’s direction and a handshaking signal.

Parallel vs serial communication

 

 

 

Parallel communication is half-duplex, which means that data bits can be sent in either direction. A device can send data, as well as receive it. This cannot happen simultaneously, though. If data is being transmitted in one direction on the bus, the transmission must finish before going the other way.

 

Issues with parallel communication

One disadvantage of parallel communication is the number of I/O lines it needs. When data is sent in 8, 16, or 32 bits, each bit needs its own physical I/O line. Thus, the faster or bigger the data transfer you want, the more wires you need. This also increases the cost of the connection, especially for longer connections. Always keep in mind that you’re trading physical lines for speed when working with parallel communication.

 

These physical I/O lines, or connectors, are prone to damage. They can easily be bent and if you’re not careful, you can damage them beyond repair.

 

Another thing to be aware of is the distance between the two components. Parallel connections work really well for short distances and point-to-point connections, but the bigger the distance, the worse it gets. You’ll always want to keep it to a minimum.

 

The length of the cable can also increase the probability of crosstalk. Also known as noise, crosstalk is when an electromagnetic signal affects another electromagnetic signal, creating an unwanted effect. This happens when the data lines are close together. Adding more lines makes this even more apparent.

Parallel vs serial communication

Lastly, another issue arises when data bits on the same clock signal get mixed up and arrive at different times. This is quite a problem because parallel communication requires all data bits to be received simultaneously. This difference is called clock skew. The receiver will usually wait for all the bits to be transferred, and then take them all in at the same time. Clock skew is one of the reasons why serial interfaces are preferred over parallel ones.

Parallel vs serial communication

 

Serial communication

The other communication category is serial communication. You’ve probably already come across this category without even realizing it. If you’ve ever plugged in a USB device to your computer or laptop, you’ve used serial communication. It’s in the name, after all (USB = Universal Serial Bus). Serial communication is used for long-haul communication where parallel communication would be impractical due to its common issues. Lately, serial communication is becoming more common at shorter distances due to improvements it has been seeing. It is often used in peripheral devices such as keyboards and computer mouses, as well as computer expansion buses. One such example is PCI Express.

 

Unlike parallel communication which sends multiple bits at the same time, serial communication sends them one by one. It can use as little as one wire, but two or more are most common. It usually never uses more than four. This cuts down the cost of wiring material and relaying equipment. It also takes less space on a PCB . It is the simple form of communication between two devices we call a sender and a receiver. It can be either synchronous or asynchronous. Some of the most common serial communication protocols you’ll be working with are UART , SPI , and I2C .

Parallel vs serial communication

Serial communication can be half-duplex like parallel communication, as well as simplex and full-duplex. Simplex denotes that data bits can only be sent one way, while full-duplex means they can be sent both ways simultaneously.

Issues with serial communication

The main issue with serial communication is speed. More wires typically mean more speed, hence serial communication is slower than parallel communication. Optimized applications for parallel communication can greatly exceed serial communication’s data transfer rate. However, due to the modern technical advancements, many speed limitations originally found with serial communications were reached and passed.

 

Since there is only one data line and fewer conductors in proximity, crosstalk is less of an issue in serial communication. It can still happen, but it’s much rarer. Because of longer distance applications, higher throughput, and multiple nodes, serial transmission is more complex and harder to analyze. In contrast, parallel transmission is easier to analyze due to shorter distances and simple timing.

Parallel vs Serial

If you were to imagine parallel and serial communication as types of roads, you’d get a clearer picture of them. Parallel communication would be a mega-highway with 8 or more lanes. It can get a bunch of cars to their destinations in less time, but it costs more to build. Mega-highways aren’t as frequent as normal two-lane roads, which would be serial communication. Two-lane roads are pretty much everywhere and they can be built with just a fraction of the cost of mega-highways. Seems very similar, doesn’t it?

Parallel vs serial communication

Let’s take a look at the table below to see a more comprehensive comparison between the two.

Parallel vs serial communication

Which one should you use?

It depends. As we’ve seen both communications have their advantages and disadvantages. If your integrated circuit supports a small number of I/O pins, you should probably choose serial over parallel communication. However, if you want faster speed at a smaller distance, parallel communication is a better choice.

 

Serial communication is slowly but surely taking over most electronic devices. Parallel communication still takes place within a computer system, on a computer bus. We’re sure it will never disappear as in some situations it’s just the better solution. However, we would recommend you start with learning serial communication first and then parallel later down the road.

 

If you want to work on some projects with serial communication such as I2C, check out the tutorials page . New tutorials are often added so be sure to check back after some time. 🙂

What is a breadboard and how to use it

If you want to make an electronics project, you will need something to connect your circuit on. Sure, you could solder everything together, but what if you’re just testing something? Or if the project you’re working on is temporary, and you plan on using the parts for something else? You would then use a breadboard.

 

If you’ve got a starter kit for an Arduino or Raspberry Pi, you probably have one. And you’ll be using it quite a lot. Let’s take a deeper look at what they actually are.

Introduction

A breadboard is a construction base for electronics prototyping. It might look like a regular plastic board with many tiny holes in it, but it’s much more than that. It is one of the main tools for circuit building and electronics in general. Prior to today’s breadboard being invented in 1971, a technique called wire-wrap was used for circuit building. It involved wrapping wires several times around a component lead or a socket pin on an insulating board. You had to be really careful and know what you were doing. Things could get messy quite quickly, as you can see from the picture below.

Auto Draft

Solderless breadboard

A solderless breadboard is as simple a device as it gets. It’s the most used device when creating temporary circuits. It is called solderless because no soldering is required, you can just plug in the components. A component can easily be removed from a breadboard if you make a mistake, or when starting a new project. This makes it great for both beginners who are just starting to learn about electronics and seasoned professionals.

 

If you’ve never worked with it before, you might wonder which holes do what. Let’s take a look at the bottom of a breadboard so you get a better idea of what’s going on.

Bottom of a breadboard

What is a breadboard and how to use it

Seeing it like this, you’ll get a better picture of how it works. The smaller metal platings are used for connecting components into your circuit. Rows are not interconnected. Two larger metal platings, perpendicular to smaller ones, are used to connect the board to a power source. That’s why they are referred to as power strips or rails (sometimes called bus strips).

 

If you were to take the metal platings out, you would see that they are actually little metal clips. They’re designed to grab the legs of components pushed through holes on the top side of the breadboard. Because they’re made from a conductive metal, you can test circuits without any soldering. Hence, the name solderless. All breadboards operate like this, no matter the size.

What is a breadboard and how to use it

What is a breadboard and how to use it

Top of a breadboard

Looking at the breadboard from the top side, you’ll see a bunch of little holes. This is where the legs of components go, and the clips inside grab on them. The spacing between these holes is 2.54 mm (0.1 inches). It is aligned with the spacing between the legs of most electronic components and integrated circuits.

 

The holes are divided into two areas called strips. These strips are made from interconnected electrical terminals.

Power rails or bus strips

Power strips (bus strips) are on the sides of the breadboard. They are used to provide electric power to the electronic components. They usually contain two columns – one for ground and one to supply voltage. The row indicating ground is normally marked blue or black, while the row indicating voltage supply is marked red. Along with colors, a ground column is indicated with a minus (-), and a voltage column is indicated with a plus (+).

 

Power rails generally go from one end of the breadboard to another. The holes are set in groups of fives. On large breadboards, however, the power rails are often broken in two.

Terminal strips

The main areas, those between the power rails, are used to hold most of the electronic components. As power rails, terminal strips are also divided into two columns, with a small ravine between them.

 

The rows are marked with numbers from 1 to as many as the breadboard design has. The columns are marked with A, B, C, D, E on one side of the board, and F, G, H, I, and J on the other side. Only five components can be connected in each row.

 

Wait, the row has ten holes, so why can you connect only five components? Notice that each horizontal row is separated by a ravine, or crevasse, in the middle of the breadboard. This ravine isolates both sides of a given row from one another, and they are not electrically connected. Thus, a hole on one side is not electrically connected to a hole on the other side.

Take a look at the picture below. You’ll get a clear idea of which hole connects to which.

What is a breadboard and how to use it

Mind the gap

At the very center of the breadboard lies a small ravine. It serves an important purpose. It is 7.6 mm (0.3 inches) wide and enables the usage of integrated circuits.

What is a breadboard and how to use it

Many integrated circuits (aka ICs or chips) are developed to fit onto breadboards. Since they tend to be larger than other components, they come in the so-called dual in-line package (DIP or DIL). That minimizes the amount of space they take on the breadboard. The ICs fit perfectly over the ravine. One side of the legs connects to column E, and the other side connects to column F. This way the legs of the ICs don’t interfere with each other’s functionality.

Shapes, sizes, colors…

Breadboards come in all shapes and sizes, but they are pretty much all the same. They are made from plastic and come in different colors, but they are usually in some tint of white. The most common sizes you’ll see are so-called full-size, half-size, and mini. Most breadboards have tabs and notches so you can snap more of them together. For the most part, though, you’ll be fine using just one half-size board included in most starter kits.

 

Speaking of sizes, while the half-size board will be sufficient for most of your needs, you might consider getting a different-sized breadboard. A full-size breadboard  is 17 cm tall and 5.5 cm wide (7” x 2.2”). It has 830 tie-points (holes), or 63 rows and 10 columns. Pulling out the power rails narrows the breadboard to just 3.5 cm (1.4”). It usually has tabs and notches so you can make it longer and wider.

The most common size among beginners is the so-called half-size. It is 8.5 cm tall and 5.5 cm wide (3.4” x 2.2”). As you can see, it’s basically the full-size breadboard cut in half. It has 400 tie-points, or 30 rows and 10 columns. It has removable power rails. Removing them makes the board 3.5 cm (1.4”) wide.

Last but not least, a mini breadboard is 4.6 cm tall and 3.6 cm wide (1.8” x 1.4”). It has 170 tie-points and doesn’t come with the power strip. It’s perfect for small and simple projects. It fits nicely on top of the Arduino proto shield as a small circuit. It is then used as a signal source feeding other electronic circuits. Mini breadboards come in various bright colors, but they are the same no matter the color.

 

How to connect components on a breadboard

Now that we have an understanding of what a breadboard is, it’s time to learn how to use it. You’ll be able to put most components on the board.

 

Components have long metal legs called leads used to get the electrical current to the component. Just put these legs through the holes and that’s it! The metal clips below will grab onto them and make them electrically connected to anything else in that row.

 

Make sure to push them all way through, until they can’t go any further. A lot of beginners will push the legs partially into the breadboard, not wanting to break them. This can, in turn, lead to strange circuit behavior, like LEDs flickering or not working at all, etc. The components can get damaged this way, so it’s always better to firmly push them down all the way.

What is a breadboard and how to use it

Keep in mind that some components have very long legs that don’t fit into the breadboard all the way. LEDs are like that. Be careful not to break them when putting them in. You’ll feel it when the component hits the bottom of the breadboard. The connections are not permanent and it’s easy to remove any components that might be connected wrongly.

Jumper wires

To connect the components to each other, Arduino or a power source, we’ll need some wires. Jumper wires are a type of wires that are used with the breadboard. There are two types most commonly used: Dupont-style and U-shaped.

 

Dupont-style wires come in three varieties, depending on their ends: male/male,  male/female, and female/female. They are very flexible and easy to work with, which is why they are often included in starting kits. For connecting an Arduino with a breadboard, a male/male Dupont-style jumper wire is used.

What is a breadboard and how to use it

U-shaped wires are simply wires with insulation stripped at both ends and bent at a 90-degree angle. Unlike Dupont-style, these wires keep their shape once they are put in position. They are great for connecting to power and ground since they keep the connection as short as possible.

 

Both types of wires come in different colors, but they don’t mean anything. There are some color-coding disciplines that you can adhere to for consistency, though. For example, you can use red and blue or black for supply voltages and ground. Use a different color for the main signals, and the rest how you see fit. There’s a common issue with this, though. The number of colors is often smaller than the number of signal types or paths.

 

Pros & cons of using a breadboard

As with any other product, there are pros and cons to using a breadboard. Let’s take a look at why you would consider using it, and why not.

 

Pros:

  • inexpensive
  • it’s reusable, no soldering is required
  • changes to a circuit are simple to make by plugging components in and out
  • easy circuit construction
  • fast and easy way to get prototypes up and running
  • a variety of electronic components can be used

Cons:

  • not suitable for long-term connections due to them not being soldered
  • limited to operating at relatively low frequencies
  • not suitable for high current flow (the current limited to ~2 A with a good quality breadboard)
  • depends on high-quality contacts so connections don’t lag
  • usually can’t accommodate surface-mount devices or components with grid spacing other than 2.54 mm (0.1”)
  • connections have higher impedance than soldered connections
  • not suitable for components that rely upon a large ground plane connection
  • places limitations on how closely components can be placed

 

When just looking at the bullet points, it wouldn’t be unjustified to think you shouldn’t use a breadboard. The cons list is longer, after all. But pros outweigh the cons in this situation. The breadboard is just too useful for it not to be used in most cases. Unless you’re making a large project or something that must stay connected at all times, you can stick to using a breadboard for your projects.

Fun fact: the name comes from...

…an actual breadboard! Back in the olden days, amateur makers used to hammer nails or screws on a wooden board. They would then put copper wires on them and solder electronic components to them. Often it was literally a board used to slice bread on.

 

As it usually is with technology, the breadboard of that time has evolved over the years. While breadboards are now used for all kinds of electronics prototyping, they aren’t made from wood anymore. You no longer have to ruin cutting boards every time you wanted to test something. The name, however, stuck and reminds us daily how far we’ve come in just a few years.

Breadboards are here to stay

SMD components are better in almost every aspect compared to their leaded counterparts. The problem with them, though, is that there is no easy way to directly prototype with them without making a PCB  to mount them to. Because of this, many SMDs will continue to be adapted for breadboards. You don’t have to worry about fabricating a PCB every time you want to work with a circuit for the foreseeable future. The breadboards are not going anywhere.

HUM: PN532 NFC + RFID

You are a beginner with Dasduino. Or electronics? A specific module caught your eye, but you do not know how to use it? Do not worry, HUM is here for you! How to Use Module (HUM) is a blog tutorial series by soldered where you will find all you need in order to begin working with your favorite module. Tutorials include technical characteristics, work principles, instructions on how to connect the module with Dasduino, and the basic code. Everything else is left to your imagination.

INTRODUCTION

In this tutorial, you will find out more about the PN532 module which enables NFC and RFID communication. We have already talked about RFID communication, in the tutorial for the RDM6300 module, and we know that we can read card codes using it. Below you will see what is the difference with NFC communication and how to use the module.

HOW DOES IT WORK?

RFID is a type of one-way communication that allows reading the code stored in the chip on the card (tag) from the card or the tag. NFC does not differ much from RFID communication, but one of the most important differences is that with this type of communication we can, in addition to reading the UID code of the card, also write/read messages on the card (tag).
This module works like any RFID or NFC module. On the board, there is a built-in antenna that is marked with a white line around the edge of the board, and when using it, we must make sure that all communication or power lines go vertically to the antenna so that they do not interfere. The cards and tags also have antennas and chips inside them, and they are powered by and communicate with the RFID/NFC module using these. When we bring the card close enough to the module, it is activated (through the antenna, the chip receives power in it) and the RFID/NFC module can communicate with it.
The PN532 module allows reading RFID and NFC cards, as well as write and read messages on NFC cards which we will see in the code examples.

HOW TO CONNECT?

The module is very practical for connecting to a microcontroller because it supports I2C, HSU (High-Speed ​​UART), and SPI communication, and we can choose which communication suits us best for a particular use. To select the communication, it is necessary to move the switches located on the module. In the example, we will go through all three modes of connecting the module and give an example code for all three communications, and finally, we will go through writing and reading messages on the NFC card. For SPI communication we use an 8-pin header (we connect 6 pins), and we connect the necessary pins to a microcontroller as shown in the example. For I2C and HSU communication, we use 4-pin headers on which we have GND, VCC, TXD (SDA), and RXD (SCL) pins, and as you can see, the same pins are used for HSU and I2C (labels for HSU are on the back, and for I2C on the front of the module).

Let us begin with going through HSU and SPI communication with a simple code example to read the UID code from RFID cards, after that, we will test NFC communication, and for that application, we will connect the module to Dasduino via I2C communication.

ARDUINO CODE

To use the module, we need to download the library from the link. When we download the zip file, we need to unzip it and add all the folders (there are 6 of them) to the Arduino library folder. If you don’t know where the Arduino library folder is, see the tutorial on how to install a new library.

RFID

HSU (HIGH-SPEED UART)

The module is adjusted for HSU communication (both switches should be in position 0), so we will make the first example with this type of communication between the module and Dasduino. We connect the module according to the scheme and transfer the given code to Dasduino, so we should be able to read the UID code from the card or tag depending on what we are using.

//including the SoftwareSerial library that implements serial communication on certain pins
#include <SoftwareSerial.h>
 
//including the library for software HSU(High-speed UART) and library for the PN532 module
#include <PN532_SWHSU.h>
#include <PN532.h>
 
SoftwareSerial SWSerial( 10, 11 );//(RX,TX) constructor for our SoftwareSerial library, in which we define the pins to which we will connect the module
//constructors for libraries that are used for communication with the module
PN532_SWHSU pn532swhsu( SWSerial );//constructor for High-speed UART
PN532 nfc( pn532swhsu ); //constructor for the PM532 library
 
void setup(void) {
 Serial.begin(115200);////serial communication initialization (speed 115200 baud)
 Serial.println("Hello!");//displaying a greeting message on the Serial monitor 
 nfc.begin();//initialization of communication with the module
 uint32_t versiondata = nfc.getFirmwareVersion(); //requesting the Firmware version and saving it to the versiondata variable
 //if we have not gotten a Firmware version from the module, displaying that the module was not found on the Serial monitor, staying in the indefinite while loop
 if (! versiondata) {
 Serial.print("PN532 module not found..Check how it is connected");
 while (1);
 }
 //if communication is established, displaying the Firmware version
 Serial.print("PN5 module found"); Serial.println((versiondata>>24) & 0xFF, HEX);
 Serial.print("Firmware ver. "); Serial.print((versiondata>>16) & 0xFF, DEC);
 Serial.print('.'); Serial.println((versiondata>>8) & 0xFF, DEC);
 //configuring the module
 nfc.SAMConfig();
 //displaying a message that we need to press the card
 Serial.println("Press the card or tag...");
}
 
void loop(void) {
 boolean success;
 uint8_t uid[] = { 0, 0, 0, 0, 0, 0, 0 }; //buffer to which we save the code from the card
 uint8_t uidLength; //writing the UID code length (4 or 7 bytes)
//requesting the module to read the card (in the success variable, it saves whether there is a card, and if there is, saving the card code to the uid variable
success = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, &uid[0], &uidLength);
 
//if the module has read the card, displaying the lenght of the code on the card (4 or 7 bytes) and after that, the card code
 if (success) {
 Serial.println("Card found!");
 Serial.print("UID code length: ");Serial.print(uidLength, DEC);Serial.println(" bytes");
 Serial.print("UID Code: ");
 //displaying the code from the card in HEX form
 for (uint8_t i=0; i < uidLength; i++)
 {
 Serial.print(" 0x");Serial.print(uid[i], HEX);
 }
 Serial.println("");
 
 delay(1000);//1 second pause before the next reading
 }
//if the card is not found, displaying the message about waiting for the card
 else
 {
 Serial.println("Time is up.. Waiting for the card");
 delay(500);//half second pause so that the message if there is no card is not displayed constantly
 }
}

SPI COMMUNICATION

As we already know, for SPI communication we need 4 lines + 2 more for the power supply, but despite having more lines, this communication has a higher baud rate than the I2C and HSU communication. In order for the module to know how to use SPI, it is necessary to leave the first switch in position 0, and move the second to position 1, which is shown in the previous part of the tutorial. In the wiring scheme, it is shown how to connect the module to the microcontroller and which pins we need. After connecting the module to Dasduino, according to the given scheme, it is necessary to transfer the code example for SPI communication to the Dasduino board. Just like the previous code, this one only allows reading the UID code from cards or tags.

//including the SPI library that is used for SPI communication 
 #include <SPI.h>
//including the library for SPI communication with the module and the library for PN532 module
 #include <PN532_SPI.h>
 #include "PN532.h"
//constructors for libraries that are used for communication with the module
 PN532_SPI pn532spi(SPI, 10); //constructor for SPI communication with the module
 PN532 nfc(pn532spi); //constructor for PM532 library
 
void setup(void) {
 Serial.begin(115200);////serial communication initialization (speed 115200 baud)
 Serial.println("Hello!");//displaying a greeting message on the Serial monitor 
 nfc.begin();//initialization of communication with the module
 uint32_t versiondata = nfc.getFirmwareVersion(); //requesting the Firmware version and saving it to the versiondata variable
 //if we have not gotten a Firmware version from the module, displaying that the module was not found on the Serial monitor, staying in the indefinite while loop
 if (! versiondata) {
 Serial.print("PN532 module not found..Check how it is connected");
 while (1);
 }
 //if communication is established, displaying the Firmware version
 Serial.print("Module PN5 found"); Serial.println((versiondata>>24) & 0xFF, HEX);
 Serial.print("Firmware ver. "); Serial.print((versiondata>>16) & 0xFF, DEC);
 Serial.print('.'); Serial.println((versiondata>>8) & 0xFF, DEC);
 //configuring the module
 nfc.SAMConfig();
 //displaying a message that we need to press the card
 Serial.println("Press the card or tag...");
}
 
void loop(void) {
 boolean success;
 uint8_t uid[] = { 0, 0, 0, 0, 0, 0, 0 }; //buffer to which we save the code from the card
 uint8_t uidLength; //writing the UID code length (4 or 7 bytes)
//requesting the module to read the card (in the success variable, it saves whether there is a card, and if there is, saving the card code to the uid variable
success = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, &uid[0], &uidLength);
//if the module has read the card, displaying the lenght of the code on the card (4 or 7 bytes) and after that, the card code
 if (success) {
 Serial.println("Card found!");
 Serial.print("UID code length: ");Serial.print(uidLength, DEC);Serial.println(" bytes");
 Serial.print("UID Code: ");
 //displaying the code from the card in HEX form
 for (uint8_t i=0; i < uidLength; i++)
 {
 Serial.print(" 0x");Serial.print(uid[i], HEX);
 }
 Serial.println("");
 delay(1000);//1 second pause before the next reading
 }
//if the card is not found, displaying the message about waiting for the card
 else
 {
 Serial.println("Time is up.. Waiting for the card");
 delay(500);//half second pause so that the message if there is no card is not displayed constantly 
 }
}

 

 

NFC

I2C COMMUNICATION

I2C communication is slightly easier to connect and use, and we will use it in the following examples. Below is the image of the wiring scheme, as well as the layout of switches for this type of communication.

As we saw earlier, NFC differs from RFID in the fact that, in addition to reading the UID code from cards, it allows reading and writing messages on a card or tag. First of all, let us explain how, in order for us to be able to write a message on it, the card must be of a certain format. That format is NDEF, and since the cards are not pre-formatted, we must first do the formatting so that we can write on the cards.
To format the card, you simply need to transfer the card formatting code (tag) to Dasduino and place the card on the PN532 module, and a message that the card is formatted will be displayed on the Serial monitor. If the card has already been formatted, a message stating that the formatting failed is displayed.

THE CODE FOR FORMATTING THE CARD
//including the library for I2C communication
#include <Wire.h>
 
//including the library for I2C communication with the PN532 module, library for the PN532 module and the library for the NFC
#include <PN532_I2C.h>
#include <PN532.h>
#include <NfcAdapter.h>
 
//constructors for the library for I2C communication with the module and for the NFC
PN532_I2C pn532_i2c(Wire);
NfcAdapter nfc = NfcAdapter(pn532_i2c);
 
void setup(void) {
 Serial.begin(115200);////serial communication initialization (speed 115200 baud)
 Serial.println("NDEF Formatting.");//displaying that we are using the module for NDEF formatting on the Serial monitor 
 nfc.begin();//initialization of communication with the module
}
 
void loop(void) {
 //displaying that we need to press the unformatted card on the Serial monitor
 Serial.println("\nPress the unformatted card or tag against the module");
 if (nfc.tagPresent()) {//checking whether the card is pressed, if it is, we format the card
 bool success = nfc.format();//command for formatting the card that returns data about whether the card is formatted or not 
 if (success) {
 //if the card is formatted, displaying a message about successful formatting on the Serial monitor 
 Serial.println("\nThe card (tag) successfully formatted in the NTAG.");
 } else {
 //if formatting was not successful, displaying an error message
 Serial.println("\nUnsuccessful formatting.");
 }
 }
 delay(2000);//2 seconds pause so that the messages are not displayed constantly
}

Once we format the card we can write and read messages from the card. Since the card has just been formatted, there is an empty message on it, which we can see if we read the card with an example of a reading code. To write something on the card you need to transfer the writing code to Dasduino. In the code, you need to change what you want to write on the card, and then just transfer the code and press the card. If everything is done correctly, you should get a note that the message was successfully written and read it with a reader or a mobile phone (newer mobile phones support NFC communication, so you can test whether you can read the message with your phone).

 

THE CODE FOR “WRITING” ON THE CARD
//including the library for I2C communication
#include <Wire.h>
//including the library for I2C communication with the PN532 module, library for the PN532 module and the library for the NFC
#include <PN532_I2C.h>
#include <PN532.h>
#include <NfcAdapter.h>
 
//constructors for the library for I2C communication with the module and for the NFC
PN532_I2C pn532_i2c(Wire);
NfcAdapter nfc = NfcAdapter(pn532_i2c);
 
void setup() {
 Serial.begin(115200);////serial communication initialization (speed 115200 baud)
 Serial.println("NDEF Writer");//displaying that the module saves a message that is defined in the code to the card
 nfc.begin();//initialization of communication with the module
}
 
void loop() {
 Serial.println("\nPress the formatted card against the reader.");
 if (nfc.tagPresent()) {
 NdefMessage message = NdefMessage(); //creating a variable of NdefMessage type
 //depending on whether we want to write a certain text or url, we need to comment or uncomment the corresponding line of the code
 //message.addTextRecord("Hello, Arduino!");//adding text to the message variable
 message.addUriRecord("http://arduino.cc");//adding url to the message variable
  
 //writing the message variable on the card as a message, the function returns data about whether writing is successful or not
 bool success = nfc.write(message);
 if (success) {
 //if writing was successful, displaying a message about it
 Serial.println("Successful. Try reading the message using reader or mobile phone.");
 } else {
 //if writing was not successful, displaying that there was an error
 Serial.println("Writing unsuccessful.");
 }
 }
 //2 seconds pause
 delay(2000);
}

When a message is written on the card, it is useless if we cannot read it, so there is an example of a code for reading NFC cards that, in addition to the UID code, also displays a message that we previously wrote on the card.

THE CODE FOR READING THE CARD
//including the library for I2C communication
#include <Wire.h>
//including the library for I2C communication with the PN532 module, library for the PN532 module and the library for the NFC
#include <PN532_I2C.h>
#include <PN532.h>
#include <NfcAdapter.h>
 
//constructors for the library for I2C communication with the module and for the NFC
PN532_I2C pn532_i2c(Wire);
NfcAdapter nfc = NfcAdapter(pn532_i2c);
 
void setup(void) {
 Serial.begin(115200);////serial communication initialization (speed 115200 baud)
 Serial.println("NDEF Citac"); //displaying a message that the module works as NDEF reader
 nfc.begin();//initialization of communication with the module
}
 
void loop(void) {
 Serial.println("\nSearching for NFC card/tag\n");
 if (nfc.tagPresent())//if we have pressed a card, we are reading a message from it and displaying this message immediately on the Serial monitor.
 {
 NfcTag tag = nfc.read(); //reading the NFC card or tag
 tag.print(); //displaying data from the card/tag
 }
 //2 seconds pause so that the read data is not displayed constantly
 delay(2000);
}

If for some reason we do not want the message to remain on the card, we can simply erase the card, i.e. the message from the card, and then the card will have an empty message as the one we had when the card was formatted.

THE CODE FOR DELETING THE MESSAGE
//including the library for I2C communication
#include <Wire.h>
 
//including the library for I2C communication with the PN532 module, library for the PN532 module and the library for the NFC
#include <PN532_I2C.h>
#include <PN532.h>
#include <NfcAdapter.h>
 
//constructors for the library for I2C communication with the module and for the NFC
PN532_I2C pn532_i2c(Wire);
NfcAdapter nfc = NfcAdapter(pn532_i2c);
 
void setup(void) {
 Serial.begin(115200);////serial communication initialization (speed 115200 baud)
 Serial.println("NFC Deleting data from the card");
 nfc.begin();//initialization of communication with the module
}
 
void loop(void) {
 //displaying a message that the module is deleting data from the pressed card
 Serial.println("\nPress the card you want to delete.");
 //checking whether the card is pressed and if it is, calling the function for erasing the card.
 if (nfc.tagPresent()) {
 bool success = nfc.erase();//the function for erasing the card that returns whether the card has been erased or not
 if (success) {
 //displaying a message whether data has been deleted
 Serial.println("\nSuccessful, data deleted from the card.");
 } else {
 //displaying that deleting was not successful
 Serial.println("\nUnsuccessful data deletion.");
 }
 }
 //2 seconds pause so that checking whether the card is pressed does not continue
 delay(2000);
}

Of course, sometimes we will do something wrong and we will need a new card without messages that is not formatted to the NDEF format. That is why there is a code that clears the card and returns it to the default settings. After we transfer this code to Dasduino and press the card against the module, the message will be deleted from it and the card will be returned to the default settings. If we want to write messages on the card again after clearing it, we need to format it beforehand.

 

THE CODE FOR CLEARING THE CARD
//including the library for I2C communication
#include <Wire.h>
 
//including the library for I2C communication with the PN532 module, library for the PN532 module and the library for the NFC
#include <PN532_I2C.h>
#include <PN532.h>
#include <NfcAdapter.h>
 
//constructors for the library for I2C communication with the module and for the NFC
PN532_I2C pn532_i2c(Wire);
NfcAdapter nfc = NfcAdapter(pn532_i2c);
 
void setup(void) {
 Serial.begin(115200);////serial communication initialization (speed 115200 baud)
 Serial.println("NFC Tag Cleaner");//displaying that the module is clearing the pressed card, i.e. returning it to default settings 
 nfc.begin();//initialization of communication with the module
}
 
void loop(void) {
 //displaying the message to press the card you want to clear
 Serial.println("\nPress the card you want to clear.");
 //checking whether the card has been pressed and if it is, we call the function to clear the card
 if (nfc.tagPresent()) {
 bool success = nfc.clean();//function for clearing the card that returns the data about whether the card is cleared or not
 if (success) {
 //if the card is cleared, displaying the message that it is returned to the default settings
 Serial.println("\nSuccessful, the card is returned to the default settings.");
 } else {
 //if we did not manage to clear the card, displaying the message that an error occured
 Serial.println("\nError, clearing the card is unsuccessful.");
 }
 }
 //2 seconds pause so that checking whether the card is pressed does not continue
 delay(2000);
}

 

Arduino vs Raspberry Pi – what’s the difference

Windows vs Mac, Nvidia vs AMD, Firefox vs Chrome… There are so many debates in the community of electronics geeks. It was only natural the Arduino vs Raspberry Pi debate would see fruition at some point. But is the debate really necessary in this case?

 

Glancing at both boards would reveal where the debate comes from. They are similar in size, both are used to control electronic components and are quite popular in the maker community. They are about as same as apples are to oranges, though. They are both electronic boards, yes, but it would be very wrong to say they are the same. Let’s get into more detail as to why.

Arduino

Arduino is a circuit board commonly referred to as a microcontroller. It is based on the ATmega328P microchip. It is used to control electronic components. You can control components like light sensors, motors, wireless and Bluetooth modules, OLED displays, etc.

 

The core of the Arduino is a microcontroller. It is why the whole board is often referred to as a microcontroller. It has more or less everything needed to store, run and execute programs within the chip.

 

Arduinos come in all shapes and sizes. Both hardware and software are open-sourced so everybody can make their own Arduino (like we did! ). Because of this, no matter how big your project is, there’s usually an Arduino to fit your needs. On top of that, there are also breakout boards  and shields  that you can connect to your Arduino. These allow you to expand the possibilities of it!

 

To program your Arduino board you will need to connect it to a computer. Writing the code is usually done in the Arduino IDE. It uses a simplified version of C++ making it easy to learn even for beginners. There are also a few third-party options for programming it using languages like Python and Blockly.

Raspberry Pi

Raspberry Pi is a circuit board based on a microprocessor. It can control electronic components, same as Arduino. Unlike Arduino’s microcontroller that does it all, Raspberry Pi’s microprocessor needs other chips to work with the code. On the plus side, you can connect a mouse, keyboard, and other peripherals directly to the board. The same way you would to your desktop computer.

 

Because Raspberry Pi has built-in RAM, USB graphics, wireless, hard drive, Bluetooth, and runs the Linux operating system, it needs more power than Arduino to run. More chips and software make it more complex than Arduino, as well as more complicated to work with. Being an entire computer itself, you can see why the Arduino vs Raspberry Pi comparison quickly diminishes.

 

But where does the comparison come from, anyway? If you take a look at the board, you’ll see a set of general-purpose input-output pins.

 

They are used to control other electronic components, just like on Arduino. They may not be as extensive as the GPIO pins on Arduino, but they can still do most of the same things. Controlling the LEDs, OLEDs and LCDs, sensors, motors, and a lot more is possible on Raspberry Pi as well.

 

Since the Raspberry Pi is essentially a full computer, you don’t need a separate computer to program it. You can program it directly on itself! Python is the primary programming language, but since it uses a Linux-based OS, you can also use other popular languages.

 

The Raspberry Pi Foundation continuously develops and updates new versions of Raspberry Pi due to its popularity. Similar to Arduino shields, Raspberry Pi has HATs – boards connected to Raspberry Pi’s set of 40 GPIO pins. HATs add functionalities such as lights, motors, sensors, fans, and everything else you’d expect from an Arduino Shield to Raspberry Pi.

Arduino Raspberry PI Side-to-side comparison

To make the differences even more clear, we thought a side-to-side comparison would do the trick. This way, the differences should be more apparent at just a glance.

Arduino vs Raspberry Pi – what’s the difference

Which one should you get?

After all these comparisons, you might wonder – should I then get Raspberry Pi if it’s a small computer? The price is usually higher which means it has to be better, right? Not necessarily. They are different tools and your choice will depend on the project you’re planning on doing.

 

If you’re going to work with just senors and other electronic components, Arduino would be more than enough. If you plan on adding computer elements to your project, like a webcam, you should consider Raspberry Pi.

 

If you are a beginner and just starting, we would recommend you get an Arduino board first. An Arduino starting kit  will provide you with all the components you’ll need to start tinkering. It is designed for beginners and is a great and simple way to step into the world of electronics. When you’re comfortable enough with that, you can view Raspberry Pi as the next step.

How to read a schematic

Let’s face it, the maker and electronics world is not intuitive when you first step into it. One thing that intimidates a lot of people is a schematic. It’s filled with lines, symbols, and information that you may not understand yet, and can easily overwhelm you. Once you pick up some basics, schematics become simple to understand. By the end of this tutorial, you’ll understand how to get the most out of them.

What are schematics?

Think of schematics like a roadmap of electronic projects. You could theoretically finish the project without them, but they help you a lot along the way. In other words, a schematic is a simplified representation of an electronic circuit. It can be read and understood easily. Schematics standardize the display of electronic circuits, components, labels, and connections.

 

Everything in a schematic has some kind of meaning. Each symbol represents a component, and each line represents a wire which connects them. With that said, a schematic is not like a physical map. The circuit board will rarely mirror it. It is more of a guide when designing and constructing a circuit board. The components are typically arranged to fit the constraints like the size of the circuit board

Reading schematics

Just recognizing the symbols of the components is not enough. You should get an idea of how a circuit works when looking at the schematic. We’ll go over the fundamental symbols and wires. You will be proficient enough to start reading most schematics after going through the following list.

Schematic symbols

Schematics can be very simple with just a few components, as well as very complicated displayed across numerous pages. An essential part of reading schematics is learning how to read symbols. Here is the list of most commonly used symbols.

Resistors

A resistor  is one of the most basic electronic components. It restricts the current flow. There are two schematic symbols for a resistor. The zig-zag symbol on the left is a standard in the United States, while the rectangular symbol on right is the international standard.

 

How to read a schematic

A variable resistor increases or decreases the resistance according to external input. There are several types of variable resistors, such as photoresistors and thermistors. The symbol is very similar to a fixed resistor, with the only exception being an arrow placed across the middle.

A potentiometer is a type of variable resistor used for adjusting the voltage and current in an electrical circuit. The symbol is similar to a fixed resistor, with an arrow pointing towards it from where the output voltage is taken.

How to read a schematic

Diodes

A diode is a polarized device that allows current flow in only one direction and stops it from going in other. Polarized means it has a positive and a negative lead (anode and cathode). The flat edge of the triangle is a positive lead, while the straight line on the end of the triangle is a negative lead.How to read a schematic

A light-emitting diode  works the same way as a regular diode. The only difference is it emits light when the current passes through. The schematic symbol looks like a diode with two arrows. The arrows represent the emitted light.

How to read a schematic

A photodiode absorbs photons from light and generates an electrical current. While the arrows for the LED schematic symbol go from the diode, the arrows for the photodiode go towards it.

How to read a schematic

 

Capacitors

As the name suggests, a non-polarized capacitor doesn’t have a polarity, so it doesn’t matter how it’s connected. The schematic symbol looks like two T shapes perpendicular to one another. These capacitors can usually store less energy than polarized capacitors.

How to read a schematic

It will matter how you connect a polarized capacitor . If it isn’t properly connected, it might even explode! The positive lead is represented with a straight line and a plus sign, and the negative with a curved line. Polarized capacitors typically have higher capacitance compared to their non-polarized counterparts.

How to read a schematic

A variable capacitor (sometimes called a tuning capacitor) is a capacitor whose capacitance can be changed. The schematic symbol is like a non-polarized capacitor, but with an arrow through the middle.

How to read a schematic

 

Transistors

A transistor is one of the basic building blocks of modern electronics. It is used for digital logic, amplifying and switching electrical signals and power. It is made of semiconductor material and has a minimum of three terminals for connecting to an electronic circuit.

 

The most common type of transistor is the bipolar junction transistor  (BJT). The three terminals on the BJT transistor are base (B), collector (C), and emitter (E). A BJT transistor can either be an NPN (negative-positive-negative) or PNP (positive-negative-positive).

 

A schematic symbol for a BJT is a circle with three lines representing the three terminals going inside it. On the NPN transistor, the base is on the left, the collector is on top and the emitter is on the bottom. There is another line in the circle, and the three terminal lines connect to it. An arrow will go from the line in the circle and point to the emitter.

How to read a schematic

On the PNP transistor, the base remains the same, but the collector and the emitter switch places. An arrow will point from the emitter to the line inside the circle.

How to read a schematic

You’ll sometimes find these two transistor symbols drawn without the circle, but it is an uncommon practice.

 

The other common type of transistor is the metal–oxide–semiconductor field-effect transistor (MOSFET). It is the most used transistor. MOSFET ’s terminals are gate (G), drain (D), and source (S). The schematic symbol is similar to the BJT symbol. A horizontal letter T is put with only the upper half in the circle. Another line is next to it. The drain and source terminals connect to that line. Unlike the collector and emitter in the BJT schematic, the drain and source terminals are drawn with a 90° angle.

How to read a schematic

 

Switches

Switches are electrical components that can connect or disconnect the conducting path in an electrical circuit. They come in many different configurations. The most common type is made of one or more electrical contacts connected to external circuits.

 

An SPST (single pole, single throw) is a simple on-off switch with two terminals either connected to or disconnected from each other. A symbol for a terminal is an empty circle. An SPST switch is denoted with two terminal symbols and a line between them. The line can be either connected to one or both of them. It will depend on whether the circuit is closed or not.

How to read a schematic

An SPDT (single pole, double throw) switch has one input and two output terminals. It is useful when changing between two active states in a device. The schematic symbol is made from three terminal symbols and a line between two of them, depending on how the circuit is wired.

How to read a schematic

A DPST switch is the same as two SPST switches controlled by a single mechanism. The schematic symbol reflects that – it looks like two SPST switches.

How to read a schematic

A DPDT switch is equivalent to two SPDT switches controlled by a single mechanism. The schematic symbol looks like two SPDT switches.

How to read a schematic

 

Inductors

An air-core inductor has coils wound on ceramic, plastic, or other nonmagnetic forms. It doesn’t have a magnetic core made of ferromagnetic material. Inductors  are usually represented by a squiggly line or a series of curved bumps.

How to read a schematic

A magnetic-core inductor has a core made of magnetic material such as iron or ferrite to increase the inductance. The schematic symbol is the same as the air-core inductor, with two lines added next to the squiggly line.

How to read a schematic

 

Sources

Single-cell batteries have the same schematic symbol, no matter if they are lithium-polymer, cylindrical, or alkaline AA. The symbol is two parallel lines of different lengths. The longer line usually represents the positive terminal on the battery.

How to read a schematic

Two battery symbols display multi-cell batteries, regardless of the number of cells.

How to read a schematic

Solar cell (photovoltaic cell) battery is shown with a circled battery symbol and two arrows pointing towards it.

How to read a schematic

When working with electronics, you’ll be working with constant voltage sources for the most part. The schematic symbol of DC voltage (direct current) is a circle with plus and minus signs inside.

How to read a schematic

The other voltage current is AC (alternating current). The sideways letter S inside a circle represents this current.

How to read a schematic

 

Logic gates

Logic gates are electronic circuits that manipulate voltages. In essence, they manipulate the binary ones and zeros (voltage high and low) moving around in an electronic device. Logic gates usually have two inputs and one output. The NOT gate is the only one with a single input.

 

The AND gate will have an output of 1 or high only if both inputs are also 1. In any other case, the output will be 0 or low. The schematic symbol looks like the letter D. Two input lines connect to it on the straight line. The output line is in the middle of the curved line.

How to read a schematic

The OR gate will have an output of 1 if either or both of the inputs are also 1. The output will be 0 only if both inputs are also 0. The schematic symbol is similar to the AND gate symbol. The only difference is that the straight line in the letter D is curved.

How to read a schematic

The XOR gate, short for exclusive OR, is similar to the OR gate. The output will be 1 if either of the inputs is 1. The output will be 0 if both inputs are 0 or 1. In a nutshell, the output is 1 when the inputs are different. The output is 0 when the inputs are the same. The schematic symbol is the same as the OR gate, with another curved line added to the left.

How to read a schematic

The NOT gate is a logic gate implementing logical negation. The main function of the NOT gate is to output the inverted input circuit signal. That is why you’ll often see it referred to as an inverter. Thus, if the input is 1, the output will be 0 and vice versa. The schematic symbol is a simple triangle with a line connecting to one of its sides and coming out of the tip on the other side. At the end of the tip is a little bubble that indicates the negation of the function.

How to read a schematic

The NAND gate is short for NOT AND. As the name implies, it will be the opposite of AND gate. If both inputs are 0 or either one of them is 1, the output will be 1. If both inputs are 1, the output will be 0. The schematic symbol is almost identical to the AND gate. The only difference is the little bubble on the output line indicating inversion.

How to read a schematic

The NOR gate is short NOT OR. It will have the opposite outputs of the OR gate. If both inputs are 0, the output will be 1. If either or both inputs are 1, the output will be 0. The schematic symbol looks like the OR gate, with the inversion bubble at the output line.

How to read a schematic

Finally, the XNOR gate is short for exclusive NOR. The outputs will be opposite to that of the XOR gate. Thus, if both inputs are either 0 or 1, the output will be 1. If the inputs are different, the output will be 0. The schematic symbol is similar to the XOR gate, with the bubble on the output line for the inversion.

How to read a schematic

For easier visualization of the inputs and outputs for each logic gate, we prepared the tables below. They will help you in remembering the schematic symbols for logic gates.

How to read a schematic

How to read a schematic

 

Transformers

Transformers  are passive components that transfer electrical energy from one electrical circuit to one or multiple others. Electrical energy can be transmitted between coils without necessarily having a conductive connection between the circuits. One such example is the air-core transformer, designed to transfer radio-frequency currents. The schematic symbol is two squiggly lines next to each other.

How to read a schematic

The problem with air-core transformers is that they let a lot of flux go to waste. Only a portion of the electrical energy will go from one winding to another. That is why an iron-core transformer is used. It doesn’t let flux vanish into the air. Thus more electric energy is transferred between the windings. The schematic symbol is two perpendicular lines in between the two squiggly lines.

How to read a schematic

Transformers can have one or more winding on both the primary and secondary sides. Those that have more than one are called multiple winding transformers. Below is an example of a transformer with two secondary windings. Secondary windings will have a gap between them on the schematic to display they aren’t connected.

How to read a schematic

Center-tapped transformers are types of transformers with two secondary windings that are connected. They share a common connection, but each one provides a separate secondary voltage. The schematic symbol is very similar to an iron-core transformer. The only thing differentiating them is the line on the secondary winding denoting the center tap.

How to read a schematic

The current transformer is used for producing an alternating current in the secondary winding proportional to the current measured in the primary winding. They reduce the high voltage currents to a much lower value for monitoring and protection purposes. The symbol is a squiggly line with a straight long line going through it.

How to read a schematic

 

Integrated circuits

The number of integrated circuits is vast. Different integrated circuits do many different things. Because of this, a unique schematic symbol for every one of them is essentially impossible. Most of the time, an integrated circuit will be displayed as a rectangle with pins drawn on the sides. Each pin has a function and a number. These are very important because they help in identifying which IC is displayed on the schematic.

How to read a schematic

 

Wires and grounds

Wires

Wires are used to connect two or more terminals. Without them drawn, the schematic becomes practically useless. Wires can be either connected or not. If they are connected, a dot is added at the intersection.

How to read a schematic

There are three ways to display unconnected wires. The simplest and most common way is to leave the dots intersected. Another way is to draw a semi-circle or an arch over the point where the wires cross. Lastly, unconnected wires can be displayed with one of the wires cut off at the point of the intersection. No matter how it is displayed, you can easily remember it as no dot equals no connection.

How to read a schematic

In the schematics design, it is a good practice to avoid intersected wires. This can’t always be done, so some intersections must be made. In that case, having them displayed the same way is a great way to stay consistent.

Grounds

If you’ve worked with microcontrollers, you know we always connect one wire to the ground. The ground path is where the current returns to its source. We say that it is the negative side of an electronic circuit. There are three different grounds.

Earth ground is, as the name suggests, the earth beneath you. A rod or wires (or both) are driven into the ground. When the electric energy goes through the circuit, it will end up in the ground and disperse. The schematic symbol is three perpendicular lines, with the longest being on top and the shortest on the bottom. It indicates an arrow or triangle. Schematics can sometimes use this symbol to signify the signal ground.

How to read a schematic

Signal or common ground is a reference point from which the signal is measured. They are used as return paths for signals and power in an electronic device. There can be multiple signal grounds in a circuit, but many simple electronic designs have a single return for all signals. The schematic symbol is a simple triangle pointing down.

How to read a schematic

Chassis ground gets its name from the metal enclosure of a device. In this case, the enclosure is defined as a reference point for the electrical circuit. This type of ground can be most notably found in cars and other vehicles. The schematic symbol looks like a skewed letter E.

How to read a schematic

 

Names and values

The final pieces of the puzzle in understanding how to read a schematic are names and values. These will tell you all the information you need to properly understand the schematic. Without them, you’d have a drawing of the circuit and the components, but you’d hardly know what is what exactly.

 

The component’s name is usually a combination of one to two letters and a number. This is called a reference designator. The letters tell the type of a component. The number helps in identifying which exact component it is if there are more of the same type. If we have a component named R10, we know it is one of at least 10 resistors on the device.

How to read a schematic

Another letter can follow that sequence to indicate grouped or matched components. Let’s say we are looking at the four resistors R10A, R11B, R12B, and R13A. By looking at the last letters in each sequence, we’d know that R10A and R13A are one group, and R11B and R12B are another.

 

Lastly, values next to the component will give more information to understand the schematic better at just a glance. If you see 10k next to a resistor, you know for a fact that is a 10k-Ohm resistor.

 

You can find the most common component name identifiers (letters) in the table below. Find a longer list of the reference designators on this link.

How to read a schematic

These names are standardized, but that doesn’t mean the schematic provider needs to follow them. You can find IC instead of U for integrated circuits, for example. The symbol should tell you enough, but keep in mind that they aren’t the same everywhere, and you’ll sometimes need to use your assessment.

 

 

Resources and go further/Reading the schematic

The ability to read schematics becomes essential the more you work with electronics. The more complicated a project is, the more crucial the skill becomes. It is a must-have skill when designing your PCB .

 

Did you know that we add the freely available schematics for all the boards we design? Now that you know how to read them, why not test that knowledge by looking at some of our schematics? Find a product that interests you (e.g. Dasduino Core), and find the schematic for it on the links to the left.

Color E Ink Displays: Bringing Vibrancy to Digital Innovation

Electronic ink (e-ink) has revolutionized the way we interact with digital content, particularly in e-readers, offering a paper-like reading experience. However, traditional e-ink displays have been limited to monochrome, lacking the vibrancy of color. In recent years, advancements in technology have given rise to color e-ink displays, opening new possibilities for a variety of applications.

Understanding Color E Ink Technology

Color e-ink technology builds upon the foundation of traditional e-ink, introducing additional layers to support a broader spectrum of colors. Unlike traditional displays, color e-ink utilizes pigments that reflect ambient light, mimicking the appearance of ink on paper. This innovative approach allows for more vivid and diverse visuals while retaining the benefits of e-ink, such as reduced eye strain and increased battery life.

Historical Development of Color E Ink

The journey of electronic ink technology dates back to the early 1970s, but the development of color e-ink gained momentum in the 21st century. Milestones include breakthroughs in color reproduction, improvements in refresh rates, and collaborations among tech giants and research institutions. Companies like Soldered and others have played crucial roles in advancing color e-ink technology.

Applications of Color E Ink

Color e-ink is reshaping various industries. In the realm of e-readers, it enhances the reading experience by introducing vibrant illustrations and colorful book covers. Beyond literature, color e-ink displays are making waves in signage and displays, transforming advertising, retail, and public spaces with eye-catching visuals. The technology has also found its way into wearable devices, such as smartwatches and fitness trackers, offering a unique blend of functionality and aesthetics. Additionally, color e-ink is proving valuable in industrial and professional settings, with applications in healthcare and manufacturing.

Benefits and Drawbacks

The advantages of color e-ink are compelling. The displays consume less power than traditional LCD or OLED screens, contributing to extended battery life. Furthermore, the reflective nature of e-ink reduces eye strain, making it an ideal choice for prolonged reading or continuous usage. However, challenges include slower refresh rates compared to traditional displays and nuances in color reproduction that are still being addressed by researchers and manufacturers.

As technology continues to evolve, the future of color e-ink looks promising. Innovations such as improved color accuracy, faster refresh rates, and increased flexibility in display sizes are on the horizon. The potential applications for color e-ink in emerging technologies, combined with growing consumer expectations, are driving further research and development in this field.

Comparison with Other Display Technologies

In the broader landscape of display technologies, color e-ink stands out for its unique advantages. In contrast to traditional LCD and OLED displays, e-ink is more energy-efficient and environmentally friendly. The growing awareness of sustainability in technology choices positions color e-ink as a compelling option for various applications.

Conclusion

Color e-ink displays have emerged as a transformative technology, bringing vibrancy to digital content without compromising the inherent benefits of electronic ink. From enhancing reading experiences to revolutionizing signage and wearables, the applications of color e-ink are diverse and promising. As the technology continues to evolve, it is poised to play a crucial role in shaping the future of displays across multiple industries, providing a colorful and sustainable alternative to traditional technologies.

VOLTAGE COMPARATOR

VOLTAGE COMPARATOR INTRODUCTION

Voltage comparator is a bistable circuit (flip-flop) which compares two analog signals at the input and depending on the outcome of the comparison it gives HIGH or LOW output. We can imagine it as a small “multimeter”  with a switch. When the measured voltage is higher on the first input pin, the switch is turned on. However, when the voltage is higher on the second input pin, the switch is turned off. Even though there are different models of comparators, we will study it in the example of LM393, which is probably the most used one.

LM393 - BASIC CHARACTERISTICS

LM393 voltage comparator on the MQ breakout board

This comparator is on the multitude of breakout modules we use with Arduino, therefore it is a great example to show its purpose. LM393 is a “Low Power, Low offset Voltage, Single supply, Dual, Differencial comparator”.

  • Low power – comparator uses low power consumption to operate
  • Low offset voltage – can compare very similar voltages
  • Single supply – uses the same power source as the points we compare
  • Dual – this model has two comparators on the chip
  • Differential – means that it compares two input voltages  depending on each other, not some constant voltage

You should bear in mind that there is no such thing as an ideal comparator, respectively the one we described in the text above. In reality, there is noise, delayed response time, voltage offset, etc. These and all the other characteristics can always be found in datasheet (LM393 datasheet).

 

 

LM393 - PINOUT

LM393 is an 8-pin integrated circuit, as seen in the picture. Two pins are inputs for voltage Vcc and GNDVcc is a positive terminal of the power supply, according to the datasheet up to +36V, while GND is a negative terminal. These two terminals allow the comparator to work. Once we connect the power source to the chip, it needs two voltage comparisons. As it is already mentioned, LM393 has two mutually independent operation amplifiers (op-amp).
ln1(-) and ln1(+) are inputs for the first operating amplifier (Output1), while ln2(-) and ln2(+) are inputs for the second one (Output2). ln1(+) and ln2(+) are non-inverted, while ln1(-) and ln2(-) are inverted inputs.

When the voltage in the non-inverted input is higher than the one in the inverted, output pin goes to the maximum positive value – HIGH (Vcc). In case the non-inverted voltage falls below the invert input voltage, the output goes to the maximum negative value – LOW (GND). The output is, of course, limited to the power values we have brought to Vcc/GND pins.

 

VOLTAGE COMPARATOR EXAMPLE USE CASE

Now that we know how the voltage comparator works, we can make our own electrical circuit. We will do it on an example of night light. Using the photoresistor we will read off the amount of light, and LM393 will be the switch turning the LED diode on or off. This is actually an optical light sensor.
Photoresistor: Before we proceed, we will briefly explain how the photoresistor works. The amount of its resistance depends on the amount of light falling on it. When it is in the dark, the amount of resistance is high. On the other hand, when it is exposed to light, there is little resistance. In some kind of ideal conditions, resistance in the dark would be app. 200kΩ, and when there is bright light 1-2kΩ. For more, check the datasheet.

For this project we will use only ln1(-) and ln1(+) inputs and Output1 output. Firstly, we connect the power source to Vcc and GND pin comparator. As a source we can use a 9V battery.

The following step is to make voltage divider with a fixed resistor and a photoresistor. Fixed resistor should be 10kΩ, which will provide an output of 0.429V when the photoresistor is in the dark (it provides 200kΩ resistance) and 7.5V when the resistor is exposed to light (it provides 2kΩ resistance). Whether we will connect this output voltage to ln(-) or ln(+) does not matter in this case, but we will tell you a bit more about it later on. So, let’s connect it to the inverted input, In1(-), yellow wire.

After that we will connect the input voltage for comparison and over 10kΩ potentiometer so that we can adjust the circuit sensitivity. We connect the potentiometer by connecting the reference voltages to the edge pins. On the left pin, we connect the GND, and on the right +9V. The central pin is our output voltage and we connect it to a non-inverted input of the comparator In1(+). The voltage that the input provides depends on the position of the potentiometer. If we turn it completely left, i.e. towards the GND, the output voltage tends to 0V. As we turn it clockwise, the output voltage is proportional to + 9V. For starters, we can put it roughly in the central position.

What is going to happen next is:

    • in the dark: the voltage on the inverted pin In1(-) is lower than that of the non-inverted In1(+), therefore we get GND on the output
    • in the light: the voltage on the inverted pin In1(-) is higher than that of the non-inverted pin In1(+), therefore we get Vcc (+9V) on the output

Since we want the LED diode to light in the dark, the Output pin will be connected to the cathode(-) of the LED diode, while we will connect the anode (+) over 330Ω to + 9V.

In case we replaced the inverted and non-inverted input on the voltage comparator, they would get +9V on the output, in the dark. Then we would only connect that output to the LED module anode while connecting the cathode to GND. Of course, through some resistor.