Introduction – Circuit and Ohm’s Law

The purpouse of this entry is to show a very simple example of application in Unity, an electrical circuit with a DC source connected to a resistor.

The DC source provides a constant voltage over time and the resistor is a passive electrical component that is characterized by offering resistance to the flow of electric current. When these two components are connected as shown in Figure 1, a current is established that will be proportional to the voltage and inversely proportional to the resistance, according to Ohm’s Law:

I = V / R

Fig.1: Electrical circuit with DC source and a resistor, the current flowing will be calculated by applying Ohm’s Law.

Screenshots of the program running

Figures 2 and 3 show the program running, the circuit diagram is a representative image, the three values on the right are the actual values of the system, the voltage and resistance are variable parameters that can be changed using the sliders at the bottom and the current is calculated as a result of these values.

Fig. 2: Screenshot of the program running, the sliders allow to modify the voltage and resistance values, the current is calculated by applying Ohm’s Law.
Fig. 3: Another snapshot of the program with other values.

Analysis of the Script that controls the system

The script responsible for controlling the system and displaying the information on the screen is analyzed below.

System variables

Figure 4 shows the variables defined in the Script, in lines 9, 10 and 11 we have some references for the Text components that are responsible for displaying the values in the graphical interface. To see in detail how to write texts on screen dynamically in Unity see this video.

Then, three float variables are defined for the voltage, resistance and current of the circuit (lines 13, 14 and 15).

Fig. 4: Script variables controlling the DC circuit simulator.

Start function, value update on the screen and Ohm’s Law calculation

In figure 5 there are three functions belonging to the system. Start is a function that Unity executes automatically after pressing the Play button and before the first frame of the application is displayed, within this function Ohm’s Law is applied with the initial values that are defined and the values are refreshed on screen, this occurs in the execution of the methods of lines 19 and 20 respectively.

The “RefreshValues” method is responsible for writing the voltage, resistance and current values to the Text components of the graphical interface.

The “ApplyOhmLaw” method performs the calculation of the current as a function of the voltage and the resistance, here you could have an indeterminacy if the resistance (the denominator) is null, if this happens there is no error at run time, but Unity detects this situation and solves it by assigning the value “Infinity”, which serves as an indicator that there is an indeterminacy.

Fig. 5: Script functions controlling the DC circuit simulator, initialization, Ohm’s Law and GUI update.

Functions for modifying values from the graphical interface

In order for the Sliders of the graphic interface to be able to modify values within a Script, they must do it through public methods, the methods shown in figure 6 fulfill this purpose, the top one allows to modify the voltage value and the bottom one the resistance value. Note that not only the values are modified but also Ohm’s Law is recalculated and the values are refreshed on the screen.

Fig. 6: Functions of the script that controls the DC circuit simulator, public methods that allow to modify the voltage and resistance values by manipulating the sliders of the graphical interface.

Introduction

In previous entries we saw how to define matrices in programming and load data into them, in this article we will see how to multiply two matrices using two-dimensional arrays.

Initial data

We will start from two matrices “A” and “B” with preloaded data and we will analyze a method that will multiply two matrices that are sent as parameter and returns the result matrix.

In figure 1 we see the declaration of two 2×2 matrices and the loading of their data, then in lines 27 and 28 we make the calls to the method that is in charge of multiplying the matrices that are sent as parameters and returning the resulting matrix.

Fig. 1: Declaration of two matrices A and B, data loading and execution of the function that multiplies two matrices passed as parameters.

Algorithm for multiplying matrices in programming

The product of matrices is not commutative, so it matters the order in which the matrices are multiplied. Let’s consider that matrix A is on the left and multiply it by matrix B which is on the right.

The procedure to multiply two matrices consists of multiplying each element of the i-th row of the left matrix by each element of the j-th column of the right matrix and then adding these products, the result of that sum will be the ij-element of the resulting matrix. Therefore, in order to carry out the product of matrices, the condition that the number of columns of the left matrix equals to the number of rows of the right matrix must be fulfilled.

The result of the multiplication of matrices A and B will be another matrix that will have a number of rows equal to the number of rows in A and a number of columns equal to the number of columns in B.

Algorithm analysis

Figure 2 shows the implementation of an algorithm that multiplies two matrices that are sent as parameters. First the result matrix is declared and the sizes of both matrices are read, this is done in lines 32 to 36.

Then we check if it is possible to multiply both matrices, if it is not possible the result will be null, otherwise we proceed to solve the product of matrices.

The resulting matrix structure is created with the corresponding number of rows and columns (see the description of the procedure above). Then the three nested for loops shown in figure 2 are used to determine the value of each resulting element.

Fig. 2: Algorithm that solves the multiplication of two matrices received as parameters and returns a matrix that is the result of the product of both matrices.

Introduction

In previous entries we saw how to define matrices in programming and load data into them, in this article we will see how to add and subtract two matrices using two-dimensional arrays.

To be able to add or subtract two matrices it is necessary that both have the same size, that is to say the same number of rows and the same number of columns, otherwise the operation cannot be solved. We will take this into account in our algorithm, at the time of performing the operation we will check that these conditions are met and if everything is correct the sum will be solved, otherwise the returned matrix will have a null value and this result can be used to make subsequent checks, for example if the resulting matrix is different from null we consider that the operation was successful.

Initial data

We will start from two matrices “A” and “B” with preloaded data and we will analyze a method that will perform the sum of two matrices that are sent as parameter and returns the result matrix.

In figure 1 we see the declaration of two 2×2 matrices and the loading of their data, then in lines 28, 29 and 30 we make the calls to the methods that will be in charge of adding, subtracting or making a linear combination between the matrices that are sent as parameter, those methods will return the resulting matrix.

Fig. 1: Declaration of two matrices A and B, data loading and execution of the methods that add, subtract and perform a linear combination of both matrices.

Algorithm to add two arrays in programming, C# language

To make the sum of two matrices we must first make sure that both matrices have the same size, if this is correct we proceed to go through each element of the matrices and perform the sum element by element, assigning the result to a new matrix previously declared.

Fig. 2: Algoritmo para sumar dos matrices A y B implementado en lenguaje C#, ejemplo en Unity.

Analysis of the algorithm that performs the addition of two matrices

Between lines 30 and 56 we have defined a method that receives as parameters two two-dimensional arrays (“matA” and “matB”) and returns another two-dimensional array.

The result matrix is declared on line 32 and returned on line 55, at the end of the procedure.

Then in line 34 we have an IF statement to check if it is possible to solve the sum of the matrices, the condition is that the matrices match in number of rows and columns, if this is true we proceed to solve the sum, otherwise a message is printed on the console indicating that it is not possible to solve the operation and the result variable is assigned null (lines 51 and 52).

If the sum of matrices can be solved we will determine the number of rows and columns of the result matrix and we will create the data structure for that matrix, we do this in lines 36, 37 and 39 respectively.

The addition of the matrices is done element by element, therefore we will use two nested loops, the first one will go through each row and the inner loop will go through each column, so we will start with a row and go through each of the columns, at the end we will go to the next row. Inside the inner loop we simply solve the sum of the ij-elements of each matrix and assign it to the ij-element of the result matrix.

Algorithm to subtract two matrices in programming, C# language

To subtract two matrices in programming, the algorithm is practically the same as the addition, only that when their elements are traversed, instead of adding them, they are subtracted, we can see an implementation of the algorithm in Figure 3.

Fig. 3: Algorithm to subtract two matrices A and B implemented in C# language, example in Unity.

Algorithm to perform the linear combination of two matrices in programming, C# language.

Since the algorithms for adding and subtracting matrices are very similar, a function could be defined that performs a linear combination between the two matrices indicated together with their coefficients, i.e. it solves the operation:

MatrixC = a * MatrixA + b * MatrixB

In this way to perform the subtraction of matrix A minus matrix B we could call this function passing as parameter 1 for the coefficient that multiplies matrix A and -1 for the coefficient that multiplies matrix B, but we also have a function with higher capabilities. In Figure 4 we see the algorithm that solves the linear combination between both matrices.

Fig. 4: Algorithm to solve the linear combination of two matrices A and B implemented in C# language, example in Unity.

Introduction

In previous entries we saw how to define matrices in programming and load data into them, in this article we will see an algorithm to transpose a matrix in programming, using C# language in Unity.

Initial data

We will start from an “A” matrix with preloaded data and we will analyze a method that will perform the transposition of the matrix sent as parameter and will return the result matrix.

Fig. 1: Declaration of a matrix “A” and call to a function that returns its transposed matrix.

Algorithm for transposing matrix of N rows and M columns

Transpose a matrix implies transforming its rows into columns and its columns into rows, therefore the resulting matrix will be a matrix that will have its dimensions exchanged. The function that will be in charge of transposing the matrix that enters as parameter is shown in figure 2, first we will read the number of rows and columns of the input matrix and we will create the structure of the result matrix, this is done in lines 30, 31 and 32 respectively, notice how in the creation of the result matrix, the dimension is exchanged comparing with the input matrix.

Then we have to traverse each element of the input matrix, we have seen that this could be done by two nested for-loops, the first one traverses rows and the inner loop traverses columns. Inside the loop what we will do is to assign the ij-element of the input matrix, to the ji-element of the output matrix.

At the end of the loop, the result matrix is returned (line 41).

Fig. 2: Algorithm for transposing a matrix.

Introduction

In mathematics, a matrix is a structure containing numerical data arranged in rows and columns, one of its main uses is to represent and solve systems of linear equation.

In this article you will see how to represent a matrix and load data to it in C# language in Unity Engine.

About the development environment, script creation and execution

For this example we will use the Unity engine, create a C# Script and assign it to a GameObject in the scene, when pressing the Play button, Unity will automatically execute some functions inside the Script.

Implementation of a matrix in programming

Declaration of data

Matrices have a certain number of rows and columns, so we will need two integers, let’s call them “rows” and “columns”.

To declare the matrix in programming we will use a two-dimensional arrays and we must indicate the data type, usually we are going to work with the set of real numbers, so the data type we are going to use is “float”. However we could define arrays of any data type needed, for example “bool”, “int”, “double”, “string”, etc.

The declaration of the required data would be as follows:

Fig. 1: Data declaration to represent a matrix size “rows” by “columns”.

To declare a two-dimensional array, brackets are used and a comma is placed for each extra dimension that is needed, in this case as we need two dimensions it looks like this: “[ , ]”.

Initialization of the matrix data

In the previous step we declared the necessary variables, now it is time to initialize those variables, that is to say to give them concrete values or to create data structures and assign them. The initialization will be done in the “Start” method of the Script, the Start and Update functions are automatically defined when creating a new Script. By pressing the Play button in Unity, the Start functions of all the scripts present in the scene will be automatically executed, this will happen before the the first frame of the program appears on the screen.

In figure 2 we see an example of the initialization of a 2×2 matrix, in lines 17 and 18 is the initialization of the rows and columns respectively. In line 20 a two-dimensional array is created indicating the total number of elements of each dimension and this array is assigned to the “myMatrix” field that was declared in the previous step.

Fig. 2: Inicialización de los datos necesarios para representar una matriz de 2 filas y 2 columnas.

In C# the first element of the arrays is 0 and the last is “n-1”, where n is the size of the array, so in line 22 for example, the data in position [0,0] refers to the element in the first row and first column.

Conclusion

We have seen how to declare two-dimensional arrays that can be used to represent matrices and subsequently perform operations between them.

In this example the data type used for the array is “float”, which means that each element will have a number with decimal point stored, but you could define arrays of any data type you need, for example “bool”, “int”, “double”, “string”.

To read or modify an element within the matrix we use the name with which it was defined and between brackets we indicate the row and column separated by comma, so for example if we write “myMatrix[1,0]” we are pointing to the element of the matrix that is in the second row, first column.

Introduction

A resistive voltage divider is an arrangement of two resistances in series that allows us to have at the midpoint a fraction of the voltage at the ends.

Applications of a resistive divider

The divider with potentiometer is usually used as an analog input in the frequency driver of the motors. Using the potentiometer we change the speed of the motor.

A BJT transistor can also be polarized with a splitter, connecting the central point of the splitter to the base of the transistor.

Working principle of the resistive divider

In figure 1 we see an arrangement that can be used as a divisor.

Fig. 1: Generic resistive divider in LT Spice.

To understand how it works we must consider the potential drops in both resistances.

The voltage drop on a resistor is the current flowing through it multiplied by the resistive value.

LT Spice simulation

To see how a resistive splitter works let’s do a simulation using LT Spice. If you need help getting started with LT Spice go to this article where I explain how to install it and make a simple circuit to simulate.

We are going to analyze two cases, when the resistances are equal and when one is greater or less than the other.

Case 1: Equal Resistors

In this case we can intuit that the potential drop in both resistances will be the same (because the same current circulates through them and their resistive value is equal), therefore at the midpoint of the divisor we will have a voltage value equal to the mean value between the potential difference at the extremes.

In figure 2 we can see that the voltage in Vo is 2.5 Volts, half of the 5 Volts applied in the divisor.

With this result we may be tempted to say that the voltage at the midpoint of the divisor is going to be equal to half the value applied in V2, but this is not always the case.

This is only fulfilled if in V1 we have applied 0 Volts (in figure 2 V1 is grounded).

In figure 3 we see an example in which this is not fulfilled, in this case the potential difference in the divisor is still 5 Volts, but V1 is not grounded but has applied 5 Volts while V2 has 10 Volts.

The result is that in Vo we have half the applied potential difference plus the voltage V1.

Fig. 2: The voltage at the midpoint of the divisor is equal to half of the applied voltage.

Fig. 3: Voltage at Vo does not match half of the applied potential difference at the ends.

Case 2: Different Resistors

In figure 4 we consider R1 smaller than R2 and in figure 5 the opposite case.

Fig. 4: The voltage at Vo is greater than half the difference in potential applied at the ends.
Fig. 5: The voltage at Vo is less than half the potential difference applied at the ends.

Based on the results we can say that if 100% of the resistive value is 150 Ohms, 50 Ohms and 100 Ohms will be approximately 33% and 66% respectively.

These percentages seem to be reflected in the Vo voltage, as in Figure 4 the 3.3 V voltage is approximately 66% of 5 V while 1.6 V is approximately 33% of 5V.

Analogously to figure 3, we should not assume that this will always be so, we must remember to add the voltage applied in V1, we can see this in figures 6 and 7.

Fig. 6: The result in figure 4 must be added to the voltage applied in V1.

Fig. 7: The result of figure 5 must be added to the voltage applied in V1.

Formula deduction

Now that we have seen the working principle and some experiments we are going to find an expression for the voltage Vo that takes into account both resistances.

The voltage Vo will be equal to the voltage V1 plus the potential drop in resistance 2.

Vo = V1 + Vr2

The potential drop in R2 is equal to the current flowing through the resistance multiplied by the value of R2.

Vr2 = i x R2

Then:

Vo = V1 + i x R2

The current circulating through the divisor, by Ohm’s Law, is equal to the difference of potential applied at the ends divided by the sum of the resistances.

i = ( V2 – V1 ) / ( R1 + R2 )

Replacing the current in the previous expression we have:

Vo = V1 + R2 x ( V2 – V1 ) / ( R1 + R2 )

Here we already have an expression for Vo in which are all the variables of figure 1, however we can solve the sum and obtain a more compact expression.

Vo = ( R1 x V1 + R2 x V2) / ( R1 + R2 )

The Potentiometer

This element can be used as a variable resistive divider.

The potentiometer is basically two resistors that we can change value but the sum of both remains unchanged.

If we connect a potential difference at the ends, in the middle we will have a voltage that will be between the minimum voltage and the maximum of that potential difference.

Using the knob we can control the voltage in the central leg.

Conclusion

We have seen what a resistive divider is and what its working principle is.

Some applications can be to enter values in analog inputs of different control devices such as frequency inverters or logic controllers. Polarize transistors.

Introduction

In this post I’m going to show an industrial simulation that I did some time ago trying to combine automation with PLC and Unity graphical environment.

The experiment consists in the simulation of a pulp line made with the graphic engine Unity, the idea is similar to SCADA (control system and data acquisition) only in this case we only observe the states of the machines, there is no control.

The 3D models of the machines were made with Blender and then animated with programming in Unity.

In the simulation the machines can be switched on and off, the idea is that these machines are controlled with the information received from the Arduino via USB port.

Experiment Description

The idea is to control variables in Unity using an Arduino that is in charge of reading the states of the PLC outputs and with that to elaborate a word that is sent by USB to the PC and from Unity that word is interpreted and the corresponding changes are applied.

In the following video belonging to the channel of my other page I show the result of the simulation.

The synchronization problems seen in the video have already been solved using multi-threaded programming. I will probably do an article to show how the final version was used to simulate the operation of a cold room.

Conclusion

This industrial simulation was the basis for a job in which a PLC was used to control a process involving temperature sensors and frequency drivers to control the rotation of fans.

With Arduino, the states of the digital outputs of the PLC and the analog output are read to control the speed of the fans and this is sent in a 6-character word.

Unity takes this 6-character word and interprets what the state of the digital outputs is and what value is coming out of the analog port and the simulation adjusts to these values.

Introduction

In this article we will deduce how to calculate the resulting resistive value by placing resistors in parallel, i.e. connecting two or more resistors with their interconnected legs. In addition we will use LT Spice to verify these results.

See also calculations with resistances in series

Fig. 1: Example of an arrangement with two generic parallel resistors.

Analyzing figure 1 we can see that the voltage applied to each resistance is the same for all, what will generate a current in each of these, the total current of the source will be the sum of the currents by all the branches of the resistances.

Deduction

To begin the deduction let’s assume a simple circuit consisting of a V voltage source connected to the parallel resistor array, like the one illustrated in Figure 2.

Fig. 2: Circuit with voltage source and N resistors in parallel. In all resistances the same potential V falls.

On this circuit we are going to apply Kirchoff’s circuit Law for current, which tells us that a node the sum of all the currents that enter the node is equal to the sum of all the currents that leave the node. We consider as node a point that is between the voltage source and the union of all resistances.

In figure 3, in line 1 I have written what this law tells us considering that we have a finite number of resistances.

On line 2 I place the value of the currents in terms of voltage and resistance according to Ohm’s Law. The next step is to take out the voltage v as a common factor, since all resistors have the same voltage v applied.

Finally we conclude that what is in parentheses on line 3 is the value of a resistance for an equivalent circuit that instead of having n resistors has only one with this value. In figure 4 we see this equivalent circuit.

Fig. 3: Deduction of the equivalent resistance considering the circuit of the previous figure.

Fig. 4: Same circuit as above but considering that the voltage source is applied to a single resistor with equivalent value.

LT Spice Simulation

Let’s put together a simple circuit in LT Spice to show that this result is met. If you don’t have LT Spice installed I invite you to read this article in which I show you how to download it, install it and create a simple circuit.

In figure 5 we have simulated a circuit with a voltage source of 1 Volt and two resistances of 100 Ohm connected in parallel, while in figure 6 we have a circuit with the same voltage source but only a resistance with the equivalent resistance value that would be 200 Ohms.

As can be seen in the posters with the result of the simulation, the current circulating through the voltage source is the same in both cases, so we can conclude that these circuits are equivalent.

Fig. 5: Simulation of a circuit with a 1 Volt source and two 100 Ohm resistors in parallel.

Fig. 6: Simulation of a circuit with a source of 1 Volt and a resistance of 200 Ohms.

Conclusion

We have analyzed a circuit with generic parallel resistances and applied the current laws to determine an equivalent expression of resistance.

When we have arrangements of resistances in parallel we know that these have applied the same tension in their extremes, applying Kirchoff’s circuit laws we can deduce an expression for the equivalent resistance.

Finally we have made a simulation to show that we can think of an equivalent circuit grouping the resistances.

Introduction

In this article we will deduce how to calculate the resulting resistive value by placing resistances in series, i.e. connecting two or more chained resistances. We will also use LT Spice to verify these results.

See also calculations with parallel resistances

Fig. 1: Example of an arrangement with two generic value resistors in series.

If we think about the physical size of the resistors we realize what the result is going to be. Let’s suppose that we have identical resistances of 100 Ohms that measure 1 cm, if we place two of these resistances one after the other we would have two centimeters of resistive material, then intuitively we can say that two resistances of 100 Ohm in series will result in a resistive value of 200 Ohm.

This reasoning leads us to think that if we have resistors connected in series, their Ohmic value will be added.

Deduction

To begin the deduction let’s assume a simple circuit consisting of a V voltage source connected to the array of series resistors, as illustrated in Figure 2.

Fig. 2: Circuit with voltage source and N resistors in series. The same current i circulates through all the resistors.

On this circuit we are going to apply Kirchoff’s circuit Law for voltage, which tells us that a closed circuit the sum of all potential drops gives as a result 0.

In figure 3, in line 1 I have written what this law tells us considering that we have a finite number of resistances.

On line 2 I place all the resistors on the right side of the equation. The next step is to take the current i as a common factor, since this same current i circulates through all the resistances.

Finally we conclude that what is in parentheses on line 3 is the value of a resistance for an equivalent circuit that instead of having n resistors has only one with this value. In figure 4 we see this equivalent circuit.

Fig. 3: Deduction of the equivalent resistance considering the circuit of the previous figure.

Fig. 4: Same circuit as above but considering that the voltage source is applied to a single resistor with equivalent value.

LT Spice Simulation

Let’s put together a simple circuit in LT Spice to show that this result is met. If you don’t have LT Spice installed I invite you to read this article in which I show you how to download it, install it and create a simple circuit.

In figure 5 we have simulated a circuit with a voltage source of 1 Volt and two resistances of 100 Ohm connected in series, while in figure 6 we have a circuit with the same voltage source but only a resistance with the equivalent resistance value that would be 200 Ohms.

As can be seen in the posters with the result of the simulation, the current circulating through the voltage source is the same in both cases, so we can conclude that these circuits are equivalent.

Fig. 5: Simulation of a circuit with a 1 Volt source and two 100 Ohm resistors in series.

Fig. 6: Simulation of a circuit with a source of 1 Volt and a resistance of 200 Ohms.

Conclusion

We have intuitively raised what the equivalent resistance value of a series resistor array might be.

When we have arrangements of resistances in series the current that circulates is the same in all, applying Kirchoff’s circuit laws we can deduce an expression for the equivalent resistance.

Finally we have made a simulation to show that we can think of an equivalent circuit grouping the resistances.

Introduction

Without a doubt a useful tool at the time of making tests of operation in the circuits is the Protoboard. In this article we are going to see what it is, sizes, accessories, internal connections and we are going to see examples of incorrect connection and correct connection of elements.

Before we move on:

Usually before implementing an electrical circuit, a schematic and simulation are done to verify that everything is working correctly and to make improvements. In this page we are going to use LT Spice to simulate circuits, click here to read the article explaining how to download and install this software.

Protoboard

As we see in figure 1 is a plate that has a lot of holes where we can place our components.

Fig. 1: Two examples of protoboards.

Depending on the circuit that we want to implement we may need more than one Protoboard, it is good to know that most have sockets on their sides to fit plates of the same manufacturer.

Fig. 2: The protoboards have sockets that allow one after the other.

In addition in the market we can find certain accessories that we can use in the protoboard, like cables with male terminals and DC sources.

In the figures 3 and 4 we see an example of these sources that come prepared to place in the protoboard. We can feed it with transformer or with USB cable and train two switches that allow us to choose between 3.2V and 5V.

Fig. 3: Arduino Source ready to be connected to a protoboard.
Fig. 4: This source has a mini USB connection or transformer plug.

Pin Distribution

In figure 5 I have highlighted with colors to show how the electrical bridges under the dot matrix are made.

Fig. 5: Standard bridge of a protoboard.

At both ends of the board we see a red line indicated with a sign “+” and another blue with a sign “-“, these lines are used to provide voltage to our circuits.

In the middle in green color we have 60 lines of 5 points that we can use to make the interconnections of our circuit.

The 5 points on each line are bridged together under the board, which helps us reduce the amount of cables we need.

Another important detail is that we have numbers for the rows and letters for the columns so that we can identify each point of the Protoboard, for example A-1 is the first point at the top right in Figure 5 and J-30 is the last point at the bottom left.

How to connect elements in the Protoboard

When we have devices with several legs such as transistors or integrated circuits, it is important that we know what the internal distribution of bridges is like, otherwise we can make a mistake in the way they are connected.

In figure 6 we see examples of current and incorrect connections.

Fig. 6: Integrated circuits and resistors in protoboard. Badly connected in red, well connected in green.

For example take the case of the resistance connected at points G-24 and J-24, the 5 points on line 24 from the letter F to J are bridged to each other, so it makes no sense to connect a resistance at two of these points, the current will never flow through it.

Conclusion

The protoboard is a useful tool when testing the operation of our circuits.

Depending on the project, we will need larger or smaller plates, it is good to know that plates of the same type can be fitted using the side skirtings and that there are accessories that can facilitate the supply and connections of the elements.

It is important to know the distribution of the internal bridges of the plate, in this way we will avoid placing the elements badly.

Introduction

In this article we are going to see how to download and install LT Spice software to simulate electrical and electronic circuits. We will also create a simple circuit to test the program.

Download the software

First we will download the installer from the official website, click on the link below:

LT Spice

Fig. 1: On the official website we download the program according to our operating system.

Fig. 2: The unloading process starts.

Once the download finishes we run it. In my case I got a screen saying that the installation was blocked by the Windows protection system, when I clicked on “More information” the button “Run anyway” appeared.

Fig. 3: Windows blocked the installation, clicking on More Information displays the Run anyway button.

We accept the terms and conditions and choose the installation location. In my case I leave everything by default.

Fig. 4: First we must accept the terms and conditions of the software.

Fig. 5: Choose the installation parameters and click Install Now.

At the end of the installation the program runs automatically, the sign appears in Figure 6 saying that the program is ready to run for the first time.

Fig. 6: At the end of the installation, the software prepares for the first run.

At the end of the process the main window of the program appears, and we are ready to start creating schematics and simulating electrical and electronic circuits.

Fig. 7: This is the main window of the simulation program

Create an Schematic

Next we’re going to create a very simple circuit like the one we saw in the article about what electrical resistance is, which consisted of a voltage source and a resistance.

First we go to File > New Schematic, to create a new project, this can be seen in figure 8.

Fig. 8: To start with we create a new schematic.

The workspace appears in gray, here we will begin to build the schematic.

Let’s add elements, click on the AND gate button shown in figure 9.

Fig. 9: Button to add a component to the schematic.

This will display a window in which we can choose the components.

Power Source

To power our circuit we are going to need a voltage source, in the search bar of the components window we write “voltage” and select the generic source that can be seen in figure 10.

Fig. 10: In the window that appears write “Voltage”.

We place it in the workspace and right click on it, this will open a window to enter the parameters of the font, in my case I will use 5 Volts.

The “Advanced” button allows us to define advanced parameters of the source, such as signal type, frequency, period, duration, ascent and descent times, among others. For now we are only going to keep the DC source that comes by default.

Fig. 11: Right click on the voltage source to enter the value.

Resistors

Let’s add the resistor, press the button of the AND gate again (figure 9) and this time we write “resistor” in the search bar. Select the generic resistor shown in figure 12.

Fig. 12: Add the “resistor” component to the schematic.

We place it in the workspace and right click on it to enter the parameters.

For now we will only enter a resistance value of 1000 (the standard unit is Ohm, as we see in figure 13 between square brackets to the left of the value 1000).

Fig. 13: Right click on resistance to enter the values.

Wiring

When all the elements are in place, let’s make the connections. Click on the pencil button shown in Figure 9 or use the F3 shortcut.

Then we draw the connections between the source and the resistance.

Fig. 14: Use F3 or the menu buttons to make the connections of the elements.

Ground

Finally, in order for the program to perform the calculations, it needs a ground point for reference. Click on the triangular button in figure 9 or with the “G” key.

We place the ground on the cable that is connected to the negative terminal of the source, as shown in figure 15.

Fig. 15: For the schematic to work, a reference ground must be added to the circuit.

Simulation

When we finish the schematic, we go on to configure the simulation parameters.

If this is the first time we are going to simulate, click on the Run button shown in figure 16. If this is not the first time, go to the “Simulate” tab and click on “Edit Simulation CMD”.

Fig. 16: Schematic simulation button.

In the Edit Simulation window we are going to choose the last tab called “DC op pnt”, which is shown in figure 17.

Fig. 17: In the simulation configuration window, select the “DC op pnt” tab and click OK.

With this option the program will make a direct current calculation of the circuit, showing the voltages in all the nodes and the currents in all the branches.

Fig. 18: A window appears with the operating values of the DC circuit.

In the window that appears we can see that the current in the resistance is 5 mA, which is condiced with taking the 5 V of the source and dividing them by 1000 Ohms of the resistance, according to the Law of Ohm.

With this we finish the exercise, we are ready to simulate more complex electrical and electronic circuits. In other articles we will talk about how to draw graphs or produce other simulations.

Introduction

In this article we will see the concept of electrical resistance, resistive elements and we will analyze a simple circuit to see the effect it has on the current.

What is electrical resistance?

It is a property of matter that indicates the difficulty that the electric current has in crossing it.

There are materials that have a low resistance, in which the current can flow easily, and there are other materials that have a high resistance, in which it is more difficult for the current to circulate.

Materials with low resistance are called conductors and materials with high resistance are called insulators.

Resistive elements

Fig. 1: Different types of resistance or resistors.

On the other hand “Resistance” is the name given to certain elements that are built with the purpose of having a predictable resistance value, we can see some examples in figure 1.

These elements are used in circuits to make currents behave in a certain way.

Effect on the current in a simple circuit

We are going to simulate a simple circuit with a voltage source of 10 Volts of direct current connected to a resistor. The objective will be to analyze how the current is in the circuit.

For the simulation we are going to use LT Spice, click here to go to the article where we downloaded and installed this software and also show how to draw the next schematic and configure the simulation.

Fig. 2: Circuit with 10V source and 1K resistance Ω , current 10mA.

In the first case, illustrated in figure 2, the resistance of the circuit is 1000Ω or 1KΩ (kilo ohm) as it is most often called.

When running the simulation we see that the resulting current is 0.01A (Ampere) or 10mA (milli Ampere).

Fig. 3: Circuit with 10V source and 100mA resistance Ω , 100mA current.

If we now change the resistance value to 100 Ω and simulate again, the current now increases to 100 mA (Figure 3).

In the third test we give the resistance a value of 10 Ω and when simulating the current increases to 1 A, figure 4.

Fig. 4: Circuit with 10V source and 10V resistor Ω , current 1A.

What we observe is that when the resistance value decreases, keeping all the other parameters of the fixed circuit, the current increases.

Conclusion

Resistance is a property that determines how good a material is as an electricity conductor.

Materials with low resistance such as metals are good conductors of electricity, while materials with high resistance are called insulators, such as plastic.

In a simple electrical circuit we can see how the current behaves when we change the resistance, leaving the other parameters fixed. We see that they have an inverse relationship, the lower the resistance, the higher the current.

Introduction

Electricity is so present in our daily lives that we often forget its importance until suddenly a blackout occurs. In this article we will look at the concept of electricity, its application in the home and industry. We are also going to delve into the nature of matter in order to understand where electricity comes from as we know it.

Electricity – home and industry

Preserving our food, heating the water in the house, heating and entertainment are some examples of the application of electricity in the home.

In the industry it is used to run machines that require power, such as motors and fans. It is also used to power control systems.

How do all these electrical devices work?

In all cases what happens is that an electric current circulates through these devices, excites their internal circuits and produces an effect.

Types of electric current

There are two types of electric current, direct current (DC in Spanish, DC in English) and alternating current (AC in Spanish, AC in English).

Direct current is generally used to power digital systems such as LED TVs, computers and radios. While alternating current is used to run motors, resistors to generate heat, among others.

It is possible to convert one type of current into another by using the appropriate device. The most common is the transformer we use to charge the smartphone or notebook, these machines are fed by the alternating current from the household sockets and convert it into direct current.

Power Sources

We know thaenergy has to “come out” from somewhere, in general our house is connected to the electrical network of a city or town and we have plugs or sockets.

This energy comes from power plants that use machines that transform a type of energy such as wind, sun or fossil fuels into electrical energy.

Fig. 1: Wind turbines in Rawson, Argentina. Source Wikipedia.

Fig. 2: Polycrystalline solar panel.

In remote places where the power line does not reach, it is necessary to resort to other solutions in order to obtain electrical energy. For example to install solar panels or generators and to apply much the rational use of the energy.

Fig. 3: Generator I received just at the time of writing this article.

What is electricity?

We have talked about its application, the principle of operation of electrical machines and the types of current, now let’s go a little deeper into the nature of matter to understand more deeply

In antiquity it was discovered that matter could be “loaded” in some way, since when rubbing certain materials with others a force of action appeared at a distance like gravity. We are talking about the typical experiment that we do in primary school in which we rub the ruler on our hair and then we can make bits of paper adhere to it.

In addition it was discovered that there were two types of charges, which were later referred to as positive charge and negative charge.

Observing the interaction between these charged materials it was noted that charges of the same type are repelled and charges of dissimilar type are attracted.

These charges present in matter are what give rise to the electric current.

Conclusion

Electricity is widely used in everyday life to power all kinds of devices. The general principle of all these devices is an electric current that circulates through their interior producing an effect.

There are two types of electric current, direct current (DC) and alternating current (AC). We can convert one type of current into another by using the appropriate device.

Electricity is generated by machines that transform different types of energy into electrical energy.

In the matter there are two types of charge, positive charges and negative charges. If two charges of the same type face each other, the result is a repulsive force between the two. If two charges of a different type face each other, a force of attraction appears between them.

Introduction – Setting up the scene

In this article we will see a very simple trick to bend objects in Blender, for this example we will use Blender’s default cube, here is a couple steps you can do to follow exactly this tutorial.

  1. Create a new Blender file.
  2. Select the default cube and go into edit mode.
  3. Press A to select all vertices.
  4. Press S, then X and write “10” to scale the cube in the X axis, ten times its original size.
  5. Press CTRL+R and move the cursor until you see the yellow square shape from the image below. Turn the mousewheel a couple times to get extra subdivisions and left click to apply the subdivisions. Right click to apply with any displacemente.

How to bend an object in Blender

You can bend an object in Blender using the “Proportional Editing” feature by enabling the icon shown in the image below or by pressing the “O” shortcut.

Press LEFT-ALT and click on and edge of the object to select and Edge Loop. Press G to grab that edge loop and move it around.

Proportional Editing option allows you to transform now only the selected vertices but also vertices that are nearby with an intensity that is proportional to the distance.

You can change that intensity by spinning the mousewheel. 

This editing option is applied also for rotation and changes of scale, so you can use it to apply different transformations to an object.

If you press the icon from the image below you will see different options to apply to the proportional editing option, like the “Connected Only” checkbox that makes the editing affect only those vertices who are connected to our selected vertices. You can also choose a different deformation pattern.

Video tutorial on how to BEND objects in Blender

Follow my YouTube Channel for more Blender tutorials.


In this article we will see how to apply the glow effect in Blender for the Eevee engine, this effect is also kwown as bloom and it’s a post processing effect, that means is an effect that is applied after the render process.

How can we see the glow effect

Before we apply the effect we need to make sure that we can see the results, otherwise we won’t be able to know that the effect is applied.

Place the mouse cursor inside the 3D viewport window, press Z and select the “Rendered mode”.

Apply the Glow effect

  1. Go to the Render Properties Tab, which is inside the Properties window. 
  2. Make sure that you are using the Eevee engine.
  3. Enable the Bloom checkbox.
  4. Set up the parameters as you need.

At this point if you bring a light source near the object you will see the glow effect.

You could also set up an emissive material an it will have the glow effect.

Video tutorial on how to make an object glow in Blender

Follow my YouTube Channel for more Blender tutorials.


Exit mobile version
Secured By miniOrange