The post How to Use CD4013 Dual D Type Flip Flop | Datasheet appeared first on Circuit X Code.

]]>

To understand how to use the CD4013, you must first know how D-type flip-flops work.

Flip-flops have a clock pin, input pin(s) and output pins. The state of the output depends on the state of the input. However, the output doesn’t change unless the clock pin changes. Hence, flip-flops store data, although only 1 bit of it.

The D flip-flop is a type of flip-flop that only has one input, the D pin, and two outputs, Q and Q.

For every *rising pulse* on the CLK pin, the D pin toggles and the Q pin follows its state. *The Q pin is always the complement of the Q pin*.

A variation of the D flip-flop is the inclusion of R (reset) and S (set) pins (shown above). This variation is precisely the type inside the CD4013. When reset is high and set is low, the output Q is always low and the output Q is always high. This is true no matter the state of CLK. Also, the D pin becomes unusable.

Conversely, when reset is low and set is high, the output Q is always high and the output Q is always low. For normal D flip-flop operation, the R and S pins must be both low.

The CD4013 contains two D flip-flop circuits each with R and S pins. Its pinout is shown below:

Being a CMOS IC, the CD4017 consumes less power than its TTL counterpart. It can operate from 3 V to 18 V while its input pins can tolerate + 0.5 V of its supply voltage.

The function table for the CD4017 is shown below:

As already mentioned, the Q pin follows the state of the D pin for every rising clock pulse. This is only true if both S and R pins are low. The Q pin is always the complement of the Q pin.

In normal D flip-flop operations, the S and R pins are tied to ground.

Consider the circuit shown below:

A 1 second pulse is applied to the CLK pin. If the button is pressed while the pulse is rising, the Q pin goes LOW while the Q pin goes high. Pressing the button while the pulse is going low will not result in any change of state.

We can modify the circuit above to create a debouncing circuit:

A common problem when dealing with buttons is that they “bounce” after pressing, resulting in an undetermined state. With this circuit, the output latches to a single state after every button press.

Here, the button connects to the CLK pin while the D pin connects to the Q pin. At button press, the Q pin follows the D pin but since its complement the Q pin is wired to D, the Q pin now complements its previous state.

Here’s an animation of the circuit above:

CD4013 Full Datasheet:

cd4013bThe post How to Use CD4013 Dual D Type Flip Flop | Datasheet appeared first on Circuit X Code.

]]>The post WeMos D1 Mini Schematic Diagram appeared first on Circuit X Code.

]]>Some notes on the schematic:

- The voltage regulator is a ME6211 which has a maximum input voltage of 6.5 V. This input pin is directly wired to the 5V pin which means you can power the WeMos D1 Mini at a maximum of 6.5 V.
- A 0.5 A fuse connects the 5V pin and the USB VBUS. 0.5A or 500 mA is the maximum output current from desktop computer USBs. Using a higher current external power supply through the microUSB will not give higher current to the WeMos D1.
- The USB-serial chip is a CH 340G. For interfacing problems with USB, download the CH340 driver.
- There is an external 4MB flash memory communicating with the ESP8226 through SPI.
- Deep sleep solder joint connects RST to GPIO16.

The post WeMos D1 Mini Schematic Diagram appeared first on Circuit X Code.

]]>The post Using Single-Supply Op-Amps for Microcontroller Projects appeared first on Circuit X Code.

]]>

Operational amplifiers are considered one of the building blocks of electronic circuits. In this note, the author describes the basic op-amp circuits with single-supply. But what we are more interested is the design of a single-supply op-amp circuit for temperature measurement.

An example of such circuit is shown below:

In this circuit, a PT100 is used to measure temperature. Such sensor needs current excitation, thus a current-source op-amp configuration is used. Moreover, gain and anti-aliasing circuits are also provided. The conditioned sensor signal is fed to a 12-bit ADC and then read by an 8-bit microcontroller.

The post Using Single-Supply Op-Amps for Microcontroller Projects appeared first on Circuit X Code.

]]>The post Battery Charger Circuit for NiMH with Status Indicator appeared first on Circuit X Code.

]]>

This design overcomes the disadvantages of trickle chargers. These types of charges, in contrast to fast chargers, are more economical. In this design, a microcontroller provides charge status and detect faults.

This battery charger circuit allows simultaneous charging of up to four NiMH batteries. The circuit for the battery charger is shown here:

The 8-bit microcontroller is responsible for task scheduling, voltage measuring, time-keeping and displaying (if there is).

The post Battery Charger Circuit for NiMH with Status Indicator appeared first on Circuit X Code.

]]>The post How to Use the LM2596S Module appeared first on Circuit X Code.

]]>The LM2596S module is an easy to use **voltage regulator** for people who use multiple power sources in their projects.

The module features the **LM2596S** *SIMPLE SWITCHER® Power Converter* from National Instruments. This voltage regulator IC can provide fixed voltages of 3.3, 5 and 12 V as well as a variable output. Moreover, the LM2596S safely belts out a maximum of 3 A current to its load.

The LM2596S requires only 4 external components to work. Below is an application circuit for fixed output voltage:

As seen above, the designer only needs to determine the values of C_{IN}, C_{OUT}, L_{1} and D_{1} base on his/her requirements.

For example, this circuit provides a regulated 5 V_{DC} for an unregulated 12 V_{DC} output:

Meanwhile this circuit provides an adjustable voltage output:

The output voltage is calculated using the formula:

The easiest way to use the LM2596S, obviously, is to use the module. The module shown below has two input pins and two output pins:

You only need to connect an input voltage to the IN pins (taking note of the correct polarity) and then a regulated DC voltage will be on the OUT pins. The input voltage must be higher than the output voltage at least 1.5 V. For example, if you need an output of 7 V, the input must be at least 8.5 V.

To adjust the output, carefully turn the potentiometer knob using a non-metallic screwdriver.

Below an example circuit where a 12 V_{DC} source is used to power both a microcontroller and a solenoid:

Here, the 12 V solenoid is triggered by a 5 V arduino with a FET acting as the switch. The 12 V source needed to drive the solenoid is isolated from the Arduino, preventing the latter from being damaged.

The post How to Use the LM2596S Module appeared first on Circuit X Code.

]]>The post Mesh Analysis for AC Circuits appeared first on Circuit X Code.

]]>

Mesh analysis is a result of simplifying Kirchoff’s Voltage Law (KVL). Recall that according to KVL, the algebraic sum of voltages inside a loop is zero.

Consider the following loop:

In the loop and for any passive circuit, there are sources and sinks. Sources produce energy while sinks consume energy. In the circuit above, we have one voltage source and two resistors as sinks. We assign a convention where sources have positive signs while sinks have negative signs:

The sign on the sources and sinks have significance: if the loop is traversed from minus to plus, the sign is positive, otherwise, the sign is negative.

Now, when the loop is adjacent to another loop, two currents now pass through an element:

The loop direction for all *mesh currents* is always assumed to be the same. Here, both I1 and I2 are in clockwise direction.

The voltage across the resistor R2 will be:

The expression I1 – I2 here is derived by looking at the junction above R2. The currents in that junction would be:

By KCL, the current equation is:

Hence, the current across R2 is:

Now if we do KVL for the two adjacent loops, our equation for the first loop will be:

Similarly, the equation for the second loop (assuming R2 and R3 are the only elements)

I1-I2 here is now positive because the loop is traversed (looking at I2) from minus to plus across R2.

Normally, the values of the voltage source and resistances are given. Thus, we have two equations with two unknowns.

The aim is to arrive at a number of *mesh equations* for a given number of unknown currents. Generally, the number of unknown mesh currents is equal to the number of loops in the circuit. We then use any system of linear equation techniques to solve for the unknowns.

As mentioned, the only difference between mesh analysis in DC and AC circuits is that AC circuits deal with impedances. Consider the circuit below:

This circuit has resistors, capacitors and inductors expressed as phasor elements. Let’s try to solve for the voltage across C1.

At the first loop, the equation is:

Here’s the equation on the second loop:

Finally, here’s the equation for the third loop:

Simplifying, our three equations are now:

We then use techniques like Cramer’s Rule to solve for the first and second loop current. Why these two currents? Because the voltage across the capacitor would be:

We can use a general statement to easily recall nodal analysis for AC:

“Sum of impedances on the loop, multiplied by the loop current, minus the sum of impedances common to this loop and the next loop multiplied by the next loop current is equal to the sum of applied voltages to this loop”

Let’s see if this statement applies to our node equations. Let us look back to our AC circuit:

The first part is:

“Sum of impedances on the loop, multiplied by the loop current…”

Assuming this is referring to the 1st loop then:

The next statement,

“minus the sum of impedances common to this loop and the next loop multiplied by the next loop current…”

This should be:

Finally,

“…is equal to the sum of applied voltages to this loop”

The applied voltage here is any voltage source within the loop. There is just one voltage source in the first loop thus,

Altogether, the equation for the first loop is:

This is the same as the first mesh equation, just rearranged!

We can also apply the same statement to the second and third mesh:

Again, this is the same equation we arrived on earlier.

Hopefully, this tutorial achieved its objective which is to make you understand mesh analysis for AC circuits. For questions, reactions and suggestions, please drop a comment below!

The post Mesh Analysis for AC Circuits appeared first on Circuit X Code.

]]>The post Nodal Analysis for AC Circuits appeared first on Circuit X Code.

]]>

The Nodal Analysis technique is derived from Kirchoff’s Current Law (KCL). Recall that KCL tells us that the algebraic sum of currents leaving or entering a junction or node is zero. Algebraic here means we take the direction of the currents into account. A current entering a node is positive while a current leaving a node is negative.

Consider the circuit below:

At the node labeled “V_{1}”, the current I_{1} is entering the node while the currents I_{2} and I_{3} are leaving the node. Thus, by KCL:

At the node labeled “V_{2}”, the current I_{3} is entering the node while the currents I_{4} and I_{5} are leaving the node. Thus, again, by KCL:

Now what if we want to know the voltages at nodes “V_{1}” and “V_{2}”. Can we do it using KCL alone? Of course we can, but that would take a lot of time!

Here lies the beauty of Nodal Analysis. With this technique, we can directly solve for the node voltages. Let’s see how.

Ohm’s Law tells us that current is the ratio of voltage and resistance:

This formula, however, assumes that the reference for the voltage is zero volts or ground. Remember that voltage is the unit of potential difference. Of course, you can have references other than zero volts. The general formula for current from Ohm’s Law should be:

Also remember that (conventional) current always go from higher potential to lower potential:

And so going back to our original circuit:

At node 1, where the node currents are:

I_{1} can be substituted with

Here, its safe to assume that V_{S} is the higher potential because it’s the only voltage source!

We can also determine that:

Since the other potential is ground or zero volts.

And for I_{3}:

Here, we assume that V1 is higher than V2 because V1 is closer to the voltage source.

Our first nodal equation is now:

We could repeat the same for the second node, and acquire a second equation:

We now have two equations with the node voltages as the two unknowns!

AC circuits now deal with impedance rather than resistance. Recall that impedance is a complex number whose real part is resistance and imaginary part is reactance.

A resistor’s impedance does not have an imaginary component so its impedance is equal to its resistance.

But AC circuits now have capacitors and inductors!

A *pure capacitor’s* impedance has no real component and only contains an imaginary part, known as capacitive reactance:

Where j is the imaginary number and f is the frequency of the source. Similarly, a pure inductor only has an inductive reactance:

Note that pure capacitors and inductors are only theoretical. Real capacitors and inductors have small resistances which give them impedances with real parts.

Now let’s give values to the resistors in the circuit above. Also, let’s replace some of the resistors with capacitors and inductors:

Using the formulas above, the impedances of the capacitors and inductor will now be:

Redrawing the circuit:

Applying the same technique we used with DC circuits, the equations will now become:

*At node 1:*

*At node 2:*

The next challenge here is using the appropriate technique to solve for the unknowns V_{1} and V_{2}. Cramer’s Rule is a good tool to used.

Students often have difficulties dealing with complex number equations especially those involving fractions. This is why I often suggest using admittance instead of impedance. An admittance is the reciprocal of impedance:

Just like impedance, admittance has a real component and an imaginary component.

The real component of admittance is called **conductance** **(G)** while the imaginary component is called **susceptance (B)**.

For pure capacitors and inductors, only susceptance exists.

For the elements of our example AC circuit:

For resistors, only conductance exists:

So if we are to write the equations above using admittance:

*For node 1:*

*For node 2:*

No more fractions!

We can use a general statement to easily recall nodal analysis for AC:

“Sum of admittances connected to the node multiplied by the node voltage, minus the sum of admittances common to this node and the next node multiplied by the next node voltage is equal to the sum of applied currents to this node”

Let’s see if this statement applies to our node equations. Let us look back to our AC circuit:

The first part is:

“Sum of admittances connected to the node multiplied by the node voltage…”

Assuming this is referring to the 1st node then:

The next statement,

“Minus the sum of admittances common to this node and the next node multiplied by the next node voltage…”

This should be:

Finally,

“…is equal to the sum of applied currents to this node”

Applied current here is the Norton equivalent current to the node. There is just one applied current in the first node and that is

Thus,

This is the same as the first nodal equation, just rearranged!

We can also apply the same statement to the second node:

Again, this is the same equation we arrived on earlier.

Hopefully this tutorial achieved its objective which is to make you understand nodal analysis for AC circuits. For questions, reactions and suggestions, please drop a comment below!

The post Nodal Analysis for AC Circuits appeared first on Circuit X Code.

]]>The post IGBT Transistor Basics appeared first on Circuit X Code.

]]>

The IGBT’s schematic symbol is shown below:

The likeness of the IGBT’s symbol to the BJT is intentional. Like the BJT, the IGBT’s output is current from the collector to the emitter. However, the insulated gate of this device means the input current at the gate is almost zero. A very small current is proportional to a very high impedance. Thus, loading does not affect the driving circuit connected to the gate of this transistor. The insulated-gate bipolar transistor is also superior to BJT (in some applications) in terms of switching speed.

Since the IGBT is a voltage-controlled device, it’s similar to the MOSFET. Its primary advantage over MOSFETs is its capability of handling over 200 V of collector-to-emitter voltage. Such transistor also have smaller saturation voltage than MOSFET.

An equivalent circuit below best describes the operation of a IGBT:

As seen, a MOSFET is on the input side of the insulated-gate bipolar transistor while a BJT is at the output side. Current will flow from collector to emitter when enough voltage is applied to the gate.

IGBTs often come as modules. Such modules are, in-fact, solid-state relays. IGBT applications include motor drivers, induction heaters and power supplies.

An IGBT module looks like this:

Below is an example schematic diagram of a motor driver circuit:

Notice that the schematic diagram above is just like an H-bridge but only using insulated-gate bipolar transistors. The advantage of using this IGBT H-bridge is higher operating voltage and current.

The post IGBT Transistor Basics appeared first on Circuit X Code.

]]>