Blog Pages

2/19/18

BJT Common Emitter Circuit #2

BJT Gain Stage #2


Here is the second common emitter gain stage for this series. It operates on a 9V battery or 9V DC supply and uses a 2N5089 NPN transistor. This circuit has a fairly low input impedance so you won't be plugging your electric guitar directly into this stage unless it has active pickups with low output impedance.


BJT STAGE SPECIFICATIONS

This circuit has been bench tested to verify that the design works. Use a good trim pot (see "Adjusting Bias) for R1 to bias the circuit. SPICE simulation calculated R1 to be about 34k Ohms.

The gain AV for this circuit, unloaded, is about 19.4db or 9.34 volts per volt. Is is the current draw in microAmps at 513 uA. Voltages for collector, emitter and base, VCVB, and VE, are all given. Resistor values are given with notes.

Zin is pretty low at 4.7 kOhm. Zout is about 15 kOhm. RL = open represents my oscilloscope probe resistance at 1 Mohm. (Not truly "Open")

Specifications for this stage:


AC GAIN

AC gain for a common emitter stage can be calculated approximately by:

Av ≈ RC total / RE total

EX-1: Av ≈ 15 kohm / 1.5 kohm = 15,000 / 1,500 = 10 V/V


Notice that we neglected the load resistance of 1 Mohm. But, you can't neglect the resistance value for lower load resistances. Let's calculate the gain with Rl = 5kohm.

EX-2  Av ≈ (RC total / RE total)

RC total = 15 kohm || 5 kohm = (15 kohm x 5 kohm) / (15kohm+5kohm)

RC total = 3.75 kohm

Av ≈ (RC total / RE total) = 3.75 kohm / 1.5 kohm = 2.5V/V

Not bad considering the actual measured gain was 2.32 V/V. Remember, take all resistances connected to the collector( Rc in parallel with your load) and divide that by all of the resistances connected to the emitter (In this case just the emitter resistor RE). Gain vs. load resistance is given below.



HIGH BETA TRANSISTOR

The transistor used in this example is an NPN 2N5089 with a Beta greater than 300. Almost any transistor with a Beta greater than 300 should bias up pretty close this this circuit with a little adjustment of the trim pot R1.

Note: Transistor "E-B-C" (Emitter, Base, Collector) pinouts for transistors can vary. All 2N5089's will have the pinout given below. But, other transistors might be B-C-E, or C-B-E. Always verify device pinout before building.



ADJUSTING BIAS

Adjusting bias is easy when you use a quality potentiometer. I use Bourns pots for prototyping.


Thanks for reading,
Trenton

2/2/18

Raspberry Pi 3 GUI - Part 7B - 3 LED's In Action

Below is an image of the three LED's turned "ON" from code in Part 7A.

blizzard python code led

Here's a short video of the program in operation:


Next up I will be hooking up the Raspberry Pi-3 GPIO pins to turn on phantom power, switch phase, and activate an input pad on a preamplifier.

Thanks for reading,
Trenton

1/25/18

BJT Common Emitter Stage - #1

I've received a few emails over time requesting that I post some simple transistor gain stages that could be used for various audio projects. So, I will be posting a series of transistor circuits starting with this one. The first series of circuits will all operate on +9 VDC.

This single stage BJT (bi-polar junction transistor) stage has been bench tested to verify that the design works. Specifications are given below. Use a trim pot for R1 to bias the circuit.


BJT STAGE SPECIFICATIONS

The gain AV for this circuit, unloaded, is about 16db or 6.3 volts per volt. Is is the current draw in microAmps. Voltages for collector, emitter and base, VC, VB, and VE, are all given. Resistor values are given with notes. Input impedance, Zin, and output impedance, Zout, are also given. Notice that the input impedance, is pretty low at 4.8 kohm. RL = open represents my oscilloscope probe resistance at 1 Mohm.

Specifications for this stage:

AC GAIN

Also notice that the AC gain AV V/V drops quickly once a real load has been placed for "RL". Notice that with a load of 5 kohms you only get about 6db of gain. Load value matters.


SPICE DC VOLTS

The circuit draws about 700 micro amps from the supply. Notice that the collector voltage is set to 1/2 VCC, or 4.5 VDC. SPICE simulation agreed fairly well with the real bench tested circuit.



HIGH BETA TRANSISTOR

The transistor used in this example is an NPN 2N5089 with a Beta greater than 300. Almost any transistor with a Beta greater than 300 should bias up pretty close this this circuit with a little adjustment of the trim pot.



ADJUSTING BIAS

Adjusting bias is easy when you use a quality potentiometer. I use Bourns pots for prototyping.


Thanks for reading,
Trenton

1/17/18

Raspberry Pi 3 GUI - Part 7A - 3 LED Control Buttons with Tkinter

Controlling 3 LED's with Tkinter on Raspberry Pi 3. This code adds some color to the status text so it's easier to tell when the LED's are on.

(1) WINDOW WITH 3 BUTTONS - LED's "ON"




(2) WINDOW - LED's "OFF"




(3) CODE
#! /usr/bin/env python

#import Tkinter module, GPIO and atexit
from Tkinter import*
import RPi.GPIO as GPIO
import atexit

# setup GPIO 
GPIO.setmode(GPIO.BOARD)
GPIO.setup(7,GPIO.OUT)#red led
GPIO.setup(11,GPIO.OUT)#yellow led
GPIO.setup(15,GPIO.OUT)#green led

# create window, window title, window size
window = Tk()
window.title( 'tkinter7.PY')
window.geometry('300x200')

# define dynamic properties for led button
def red_led_on():
    GPIO.output(7, True)
    red_led_status.configure(text='ON',bg='red')
    button_red_led.configure(command=red_led_off)
    
def red_led_off():
    GPIO.output(7, False)
    red_led_status.configure(text='OFF',bg='white')
    button_red_led.configure(command=red_led_on)

def yel_led_on():
    GPIO.output(11, True)
    yel_led_status.configure(text='ON',bg='yellow')
    button_yel_led.configure(command=yel_led_off)

def yel_led_off():
    GPIO.output(11, False)
    yel_led_status.configure(text='OFF',bg='white')
    button_yel_led.configure(command=yel_led_on)

def grn_led_on():
    GPIO.output(15, True)
    grn_led_status.configure(text='ON',bg='green')
    button_grn_led.configure(command=grn_led_off)

def grn_led_off():
    GPIO.output(15, False)
    grn_led_status.configure(text='OFF',bg='white')
    button_grn_led.configure(command=grn_led_on)

def cleanup():
        GPIO.output(7, False)
        GPIO.output(11, False)
        GPIO.output(15, False)
        GPIO.cleanup()

# create text box 
red_led_status = Label(window, relief='flat', width=4)
yel_led_status = Label(window, relief='flat', width=4)
grn_led_status = Label(window, relief='flat', width=4)

# create button
button_red_led = Button(window)
button_yel_led = Button(window)
button_grn_led = Button(window)

# set button text
button_red_led.configure(text='RED LED',command=red_led_on)
button_yel_led.configure(text='YEL LED',command=yel_led_on)
button_grn_led.configure(text='GRN LED',command=grn_led_on)

# set initial status text
red_led_status.configure(text='OFF',bg='white')                     
yel_led_status.configure(text='OFF',bg='white') 
grn_led_status.configure(text='OFF',bg='white') 

# set location of button and text
button_red_led.grid(row=1,column=1,columnspan=1)
red_led_status.grid(row=1,column=2,padx=10)
button_yel_led.grid(row=2,column=1,columnspan=1)
yel_led_status.grid(row=2,column=2,padx=10)
button_grn_led.grid(row=3,column=1,columnspan=1)
grn_led_status.grid(row=3,column=2,padx=10)

atexit.register(cleanup)
window.mainloop()






1/16/18

Raspberry Pi 3 GUI - Part 6B - LED Control Button with Tkinter

Controlling an LED with RPi.GPIO - Part 6B


This demonstrates one way to control functions of a microphone preamplifier, such as phantom power, using a software interface. Code can be found in Part 6A.

(1) LED CONTROL PANEL "LED = OFF"


(2) LED ON BREADBOARD = "OFF"


(3) LED CONTROL PANEL "LED = ON"


(4) LED ON BREADBOARD "LED = ON" 


NEXT UP - ADDING TWO MORE CONTROLS

Thanks for reading,
Trenton

1/9/18

Raspberry Pi 3 GUI - Part 6A - LED Control Button with Tkinter

Controlling an LED with RPi.GPIO

This program creates a button that accesses the hardware pins on the Raspberry Pi 3 to control an LED. The status of the LED is updated each time the user presses the button.

(1) LED CONTROL CODE
Add this code to your Python 3 editor.

#! /usr/bin/env python

#import Tkinter module, GPIO and atexit
from Tkinter import*
import RPi.GPIO as GPIO
import atexit

# setup GPIO 
GPIO.setmode(GPIO.BOARD)
GPIO.setup(7,GPIO.OUT)

# create window, window title, window size
window = Tk()
window.title( 'tkinter6.PY')
window.geometry('300x200')

# define dynamic properties for led button
def red_led_on():
    GPIO.output(7, True)# set pin 7 to logic "high"
    red_led_status.configure(text='ON')
    button_red_led.configure(command=red_led_off)
    
def red_led_off():
    GPIO.output(7, False)# set pin 7 to logic "low"
    red_led_status.configure(text='OFF')
    button_red_led.configure(command=red_led_on)

def cleanup():
        GPIO.output(7, False);# reset pin 7 to logic low
        GPIO.cleanup()# cleanup GPIO

# create text box 
red_led_status = Label(window, relief='flat',width=4)

# create button
button_red_led = Button(window)

# set button text
button_red_led.configure(text='RED LED',command=red_led_on)

# set status text
red_led_status.configure(text='OFF')                     

# set location of button and text
button_red_led.grid(row=1,column=1,columnspan=1)
red_led_status.grid(row=1,column=2,padx=10)

atexit.register(cleanup)
window.mainloop()


(2) EXAMPLE CODE
My code looks like this:

blizzard tkinter python led control code

(3) SAVE WORK. RUN PROGRAM
Save to your desktop as tkinter6.py
Change directory to your desktop in your terminal editor.
Type chmod 755 tkinter6.py. Press Enter.
Type ./tkinter6.py . Press Enter.

(4) RESULTS - LED "OFF"
Screen Capture of the program window showing button and status text.
Notice that the LED is initially "OFF".



(5) RESULTS - LED  "ON"
Now notice that after pressing the button the LED is "ON". Press the button one more time and the LED will be OFF again.

blizzard tkinter python led control

UP NEXT - HARDWARE HOOKUP - PART 6B

Thanks for reading,
Trenton

Raspberry Pi 3 GUI - Part 5 - 3 Control Buttons and Text with Tkinter

3 Control Buttons with aligned text using Tkinter


This program creates 3 buttons that will be used to control 3 LED's. The text is aligned to the buttons using ".grid" and will eventually display the state of the LED.

(1) Enter this code into your Python 3 window

#! /usr/bin/env python

from Tkinter import*

window = Tk()
window.title( 'tkinter5.py')
window.geometry('500x300')

# create text items
red_led_text = Label(window, relief='sunken', width=15)
yellow_led_text = Label(window, relief='sunken',width=15)
green_led_text = Label(window, relief='sunken', width=15)

# create buttons for controlling LED's
red_led_button = Button(window)
yellow_led_button = Button(window)             
green_led_button = Button(window)

# set initial button text
red_led_button.configure(text='RED (ON / OFF)', command=exit)
yellow_led_button.configure(text='YEL (ON / OFF)', command=exit)
green_led_button.configure(text='GRN (ON / OFF)', command=exit)

# set initial text values
red_led_text.configure(text='RED LED IS OFF')
yellow_led_text.configure(text='YEL LED IS OFF')
green_led_text.configure(text='GRN LED IS OFF')

# set location of buttons
red_led_button.grid(row=1, column=1,padx=10)
yellow_led_button.grid(row=2, column=1,padx=10)
green_led_button.grid(row=3, column=1,padx=10)
       
# location of text                         
red_led_text.grid(row=1, column=3,padx=10 )
yellow_led_text.grid(row=2, column=3,padx=10 )
green_led_text.grid(row=3, column=3,padx=10 )

window.mainloop()

(2)
My code looks like this:
blizzard tkinter python code

(3)
Save your code as tkinter5.py to your desktop.
Change directory in your terminal window using cd Desktop.
Enter chmod 755 tkinter5.py in your terminal window. Press Enter
Enter ./tkinter5.py in your terminal window. Press Enter

(4)
Screen capture showing window with 3 buttons and aligned text.

blizzard tkinter python desktop

(5)
Next Up - Control and LED with a Button using GPIO.

 Thanks for reading,
Trenton