Difference between revisions of "Debugging electronics"

From Interaction Station Wiki
Jump to navigation Jump to search
Line 138: Line 138:
 
This circuit works just as well as the NPN-based switch, but there's one huge difference: to turn the load "on", the base must be low. This can cause complications, especially if the load's high voltage (VCC being 12V connecting to the emitter VE in this picture) is higher than our control input's high voltage. For example, this circuit wouldn't work if you were trying to use a 5V-operating Arduino to switch off a 12V motor. In that case, it'd be impossible to turn the switch off because VB (connecting to the control pin) would always be less than VE .
 
This circuit works just as well as the NPN-based switch, but there's one huge difference: to turn the load "on", the base must be low. This can cause complications, especially if the load's high voltage (VCC being 12V connecting to the emitter VE in this picture) is higher than our control input's high voltage. For example, this circuit wouldn't work if you were trying to use a 5V-operating Arduino to switch off a 12V motor. In that case, it'd be impossible to turn the switch off because VB (connecting to the control pin) would always be less than VE .
  
 
+
====Base Resistors===
 
+
<br>
 +
'''again Base Resistors!'''
 +
You'll notice that each of those circuits uses a series resistor between the control input and the base of the transistor. Don't forget to add this resistor! A transistor without a resistor on the base is like an LED with no current-limiting resistor.
 +
<br>
 +
Recall that, in a way, a transistor is just a pair of interconnected diodes. We're forward-biasing the base-emitter diode to turn the load on. The diode only needs 0.6V to turn on, more voltage than that means more current. Some transistors may only be rated for a maximum of 10-100mA of current to flow through them. If you supply a current over the maximum rating, the transistor might blow up.
 +
<br>
  
 
==JFET==
 
==JFET==
  
 
==MOSFET==
 
==MOSFET==

Revision as of 19:03, 16 July 2019

Hardware.jpg

Testing

As a test circuit we will build our own continuity tester, using the 555 timer IC
Tester circuit.png
Tester circuit2.png

555 Timer operation in ASTABLE mode

The astable mode is what most people think of when it comes to the 555 timer. Many times when you see a project with flashing LEDs, it’s a 555 timer at work. But it has a lot of other interesting applications too. For example, it can also generate frequencies to produce sound when the output is connected to a speaker.
Pin 2 – Trigger: Turns on the output when the voltage supplied to it drops below 1/3 of Vcc
Pin 6 – Threshold: Turns off the output when the voltage supplied to it reaches above 2/3 Vcc.
Pin 7 – Discharge: When the output voltage is low, it discharges C1 to ground.
In astable mode, the output cycles on and off continuously. In the schematic above, notice that the threshold pin and the trigger pin are connected to C1. This makes the voltage the same at the trigger pin, threshold pin, and C1.



Case 1—if there is a break in circuit If this case arises then that means there is infinite resistance (open circuit) between pin 2 and ground (no continuity between probes) which causes all voltage drop between pin 2 and ground which is obviously greater than 1/3 of 9 volt, so we get 0 volt as output from pin 3 at which buzzer Hence buzzer will produce no sound indicating a break in circuit.
Case2—if there is no break in circuit If this case arises then that means there is almost 0 volts (short circuit) between pin 2 and ground (there is continuity between probes) which causes all voltage drop across 4.7k resistor and thus pin 2 gets 0 volts which is obviously less than 1/3 of 9 volt, so we get 1 volt as output from pin 3 at which buzzer is connected. Hence buzzer will produce sound indicating continuity in circuit.

Always check first

  • do you understand the schematic (or image)
  • power
  • connections (soldered or breadboarded) If any dry soldering, solder bridges, any potential shorting or open PCB track issues are there?
  • polarities. If any component is connect in reverse polarity, pin one of Microcontroller is soldered to pin one of the microcontroller PCB pad, etc.
  • If all components are of desired value?


Understanding schematics

Dd2-digital-delay-schematic.gif

We will watch a short lynda video (which you can easily go back to with your student account) here

a good guide in reading chematics

Breadboarding and breadboard debugging

OK, first, what's with the name....bread board? Bread, like in food? Well yes, kind of.
Breadboard.jpg

This terminology goes way back in the days. Generally, you would mount electronic components to a piece of wood (the actual "breadboard"), and do all the wiring with point-point wire and the components just hanging between the various devices.

Breadboardreal.jpg

The story goes that an engineer had an idea for a vacuum tube device late one night. Looking around the house, the only base for his prototype that he found was indeed his wife's breadboard, from the breadbox.

A video by the Make magazine people

Ok, but why do we need to breadboard?
Well, they are useful for making temporary circuits and prototyping, and they require absolutely no soldering.
Prototyping is the process of testing out an idea by creating a preliminary model from which other forms are developed or copied, and it is one of the most common uses for breadboards.
The best way to explain how a breadboard works is to take it apart and see what’s inside. Breadboard02.jpg

connections lines are connected like this
Breadboard03.jpg


Tools for debugging

Multimeter

Measuring-resistance-voltage-current-digital-multimeter.jpg

Oscilloscope

Oscilloscoop.jpg


Sparkfun explains it

good extensive guide


Transistors

BJT

the bi-polar junction transistor
In small, discrete quantities, transistors can be used to create simple electronic switches, digital logic, and signal amplifying circuits. In quantities of thousands, millions, and even billions, transistors are interconnected and embedded into tiny chips to create computer memories, microprocessors, and other complex ICs.

Transistors are fundamentally three-terminal devices. On a bi-polar junction transistor (BJT), those pins are labeled collector (C), base (B), and emitter (E). The circuit symbols for both the NPN and PNP BJT are:
Npn-pnp-symbols.png

as Switches

One of the most fundamental applications of a transistor is using it to control the flow of power to another part of the circuit -- using it as an electric switch. Driving it in either cutoff or saturation mode, the transistor can create the binary on/off effect of a switch.
Transistor switches are critical circuit-building blocks; they're used to make logic gates, which go on to create microcontrollers, microprocessors, and other integrated circuits.

=The BC547 as a case study

Npn-switch-led.png

The control input flows into the base, the output is tied to the collector, and the emitter is kept at a fixed voltage.

While a normal switch would require an actuator to be physically flipped, this switch is controlled by the voltage at the base pin. A microcontroller I/O pin, like those on an Arduino, can be programmed to go high or low to turn the LED on or off.

When the voltage at the base is greater than 0.6V (or whatever your transistor's Vth might be), the transistor starts saturating and looks like a short circuit between collector and emitter. When the voltage at the base is less than 0.6V the transistor is in cutoff mode -- no current flows because it looks like an open circuit between C and E.

The circuit above is called a low-side switch, because the switch -- our transistor -- is on the low (ground) side of the circuit. Alternatively, we can use a PNP transistor to create a high-side switch:

Pnp-switch-motor 3.png



Similar to the NPN circuit, the base is our input, and the emitter is tied to a constant voltage. This time however, the emitter is tied high, and the load is connected to the transistor on the ground side.

This circuit works just as well as the NPN-based switch, but there's one huge difference: to turn the load "on", the base must be low. This can cause complications, especially if the load's high voltage (VCC being 12V connecting to the emitter VE in this picture) is higher than our control input's high voltage. For example, this circuit wouldn't work if you were trying to use a 5V-operating Arduino to switch off a 12V motor. In that case, it'd be impossible to turn the switch off because VB (connecting to the control pin) would always be less than VE .

=Base Resistors


again Base Resistors! You'll notice that each of those circuits uses a series resistor between the control input and the base of the transistor. Don't forget to add this resistor! A transistor without a resistor on the base is like an LED with no current-limiting resistor.
Recall that, in a way, a transistor is just a pair of interconnected diodes. We're forward-biasing the base-emitter diode to turn the load on. The diode only needs 0.6V to turn on, more voltage than that means more current. Some transistors may only be rated for a maximum of 10-100mA of current to flow through them. If you supply a current over the maximum rating, the transistor might blow up.

JFET

MOSFET