BJT as an amplifier

Learn to use a BJT as an amplifier in the common emitter configuration. The GUI for this is located at Electronics -> Transistor -> Transistor amplifier

The input and output waveforms are traced on the oscilloscope using two channels. The gain can be calculated directly using the measure gain button. This experiment can be modified to calculate the bandwidth of the amplifier by varying the frequency of the input waveform and noting the corresponding gains as a function of the frequency.

Resultant Data:

from SEEL import interface
I=interface.connect()

#fetch 5000 points each from CH1, CH2 with 2uS between each
x,y1,y2 = I.capture2(5000,2)

from SEEL.analyticsClass import analytics
math = analytics()
amp1,freq,phase,offset = math.sineFit(x,y1) #Calculate parameters of input waveform
amp2,freq2,phase2,offset2 = math.sineFit(x,y2) #calculate parameters of output
print (amp1,amp2,'gain = %.3e'%(amp2/amp1)) #calculate and print gain

from pylab import *
plot(x,y1)
plot(x,y2)
show()

 

Output characteristics of a Bipolar Junction Transistor (BJT)

Launch BJT Output Characteristics GUI from SEELablet – > Electronics -> Transistors -> Transistor CE

Prepare the experiment based on the schematic and instructions available in the help section.

Resultant Data:  The base voltage (thereby base current) is varied and the corresponding I-V curves are plotted.

from SEEL import interface
I=interface.connect()

pv2 = I.set_pv2( 1.0)   #  Bias the base via a 200K resistor.
base_voltage = I.get_voltage('CH3')
base_current = (pv2-base_voltage)/200e3 # Use Ohm's law to determine current
CollectorCurrent = []
CollectorVoltage = []
for a in np.linspace(0,5,100):
  pv1 = I.set_pv1(a)
  CollectorCurrent .append( (pv1 - I.get_voltage('CH1') )/1e3 )
  CollectorVoltage.append(pv1)

from pylab import *
plot(CollectorVoltage,CollectorCurrent ) #Plot and try a different base current
show()

 

Design -> Acquire -> Visualize

The experiment designer interface allows users  to quickly put together a study of phenomena using the control and readback elements that have been incorporated into a common interface.

Consider the example of a curve tracer for transistor CE output characteristics. It requires :
A ) Base current setting : A parameter that only needs to be set once per curve
B) Collector voltage setting : A parameter that needs to be swept from Voltage A to voltage B
C) Collector current monitoring : A parameter that needs to be read for each value of B
In addition, the user may require plotting and analytics.

Diode IV
Diode IV is being plotted based on the following schematic. CH3 monitors the voltage drop across the diode, and (PV1-CH3)/1K is the current flowing through it.

The derived channel section can also be used to add I2C sensors.

An analytics section is under active development.

The following screenshots illustrate the use of the experiment designer :

Tab #1

Tab#2 Consider the Diode IV experiment.  We will need :

  • A voltage source that will sweep the biasing voltage in a range that includes the expected knee voltage
  • A Voltmeter that will measure the voltage drop across the diode
  • A derived channel that uses
    • Known Value of PV1
    • Measured value of CH3
    • Known resistance 1K
      And Calculates the current flowing through the diode. I = (PV1 – CH3)/1000

Tab#3

Click on evaluate all rows to obtain readings for all values of PV1 voltage that we specified.

Select the channels to be plotted , and click on Plot

Tab#4

View the plots

Save the Data as either a text file, or an image

 

 

Stepper Motor Control

4-wire, 2-phase stepper motors can be controlled via digital outputs SQR1,2,3,4 .
Since these outputs can only drive currents up to 20mA reliably, users must use push-pull drivers such as the L293B

from SEEL import interface
I = interface.connect()

I.stepForward(20,10)  #20 clockwise steps with 10mS delay between each step
I.stepBackward(20,50)  #20 anti-clockwise steps with 50mS delay between each step

Micro stepper motors shown below consume low amounts of current, and can be driven directly via the SQR outputs.

 

 

 

 

 

They’re 4-wire, 2-phase steppers, and can be driven in half/full step modes using 4 push-pull digital I/O.

Amplitude Modulation

Electronics Experiments example: Studying a linear amplitude modulator circuit

Analog multiplier ICs such as the AD633 are used for communication applications such as amplitude modulation.

Using the sine wave generators and the oscilloscope of the SEELablet, they can be studied

W2 is used as the carrier, and was set to 4987.5 Hz. W1 was set to 402 Hz , and used as the modulating input. The fourier transform of the modulated output clearly shows that sidebands are formed at frequency(carrier) +/- frequency (modulator)

The utility can be launched from SEELablet – > Electronics -> Communication -> amplitude Modulation

Fourier transform of the modulated output shows a single peak for the carrier, and sidebands with frequencies (carrier +/- modulator ) . Changing the modulation amplitude changes the height of the sidebands. In the figure, CH2 is connected to the modulation input.

IMU Sensor for mechanics experiments

Inertial measurement units such as the MPU6050 can be used to study the motion of mechanical systems. The following code snippet demostrates extracting 3-axis data from the accelerometer, and gyroscope of the MPU6050 sensor

from SEEL import interface            # import the module  
I=interface.connect()                 # Connect to the hardware. 
from SEEL.SENSORS import MPU6050 # A 3 axis- accelerometer + 3-axis gyroscope + temperature sensor
M = MPU6050.connect()                 #Connect to the sensor 
Ax,Ay,Az,temperature, Gx,Gy,Gz = M.getRaw()    #Read all values from the sensor
print (' Ax = %.2f,Ay = %.2f, Az = %.2f , Temperature = %.2f , Gx = %.2f , Gy = %.2f , Gz = %.2f'%(Ax,Ay,Az,temperature,Gx,Gy,Gz) )

Aim : To study the oscillations of a physical pendulum, and observe the relation of its angle to its velocity. Also calculate the value of g, given the length of the pendulum

The picture shows an MPU-6050 (3-Axis accelerometer + 3-Axis Gyroscope ) hooked up to the I2C port via thin guage copper wires designed to cause minimal perturbation to the oscillations of the pendulum.


The IC is positioned at the pivot so that the accelerometer can be used to measure the angle of the pendulum accurately using the vertical component of earth’s gravitational pull.The gyroscope’s values for the axis parallel to the pendulum’s pivot are also recorded.

Resultant data : Note that the velocity is maximum at the mean, and zero at the extremities

Making the connections

Connecting I2C sensors such as the MPU6050 featured in this experiment is rather straighforward.

The SEELablet features a 4-pin I2C port that is labelled [Vcc , GND, SCL , SDA ] . The same labels can be found on most I2C modules , and four connections with simple wires up to 1 meter long is all that is required.

Once the connections have been made, the ‘sensor quick view’ app in the ‘ test and measurement’ section can be used to auto-scan the I2C port to check if connections were made properly.

Raw data from the MPU6050 oscillated by hand

Data fitted against standard sine functions by selecting a region and executing the ‘fit’ routine

For systems where wired connections are difficult ( large distance , continuous rotation etc ) , wireless subunits may be used as a drop in replacement for the wires

A simple Pulse-Sensing Application

How to make a pulse sensor with a phototransistor, and a bright LED.

The SEN input of the SEELablet is connected to a 12-bit voltmeter, and is also connected internally to 3.3V via a 5.1Kohm resistor. A photo-transistor connected between SEN and GND can be used to measure the amount of incident light.

In order to measure and visualize heartbeats, place a finger placed between a bright light source and the phototransistor, such that the light has to pass through the finger to get to the phototransistor. The body’s pulse causes the opacity of the finger to change momentarily, and this is reflected in the amount of light received by the sensor.

In order to record these fluctuations , open  SEELablet – > Test and Measurement – > Data Streaming  utility , and set the command to ‘get_resistance()’ . This will start plotting the resistance of the phototransistor as a function of time

Results :

Wireless Nodes : Battery powered intelligent subunits

Wireless Subunits are battery powered devices with unique communication addresses. They are capable of relaying sensor data, and also include various I/O capabilities.
link = I.newRadioLink(address = 0x01010A)   #This address is unique for each IoT node, and is printed on it
link.WS2812B([[0,255,255]])  #Set the colour of the onboard RGB LED to cyan
print link.I2C_scan()        #Scan the I2C bus of the IoT node, and return detected addresses
>>> [58]
link = I.newRadioLink(address = 0x01010A)   #This address is unique for each IoT node, and is printed on it
from SEEL.SENSORS import HMC5883L
mag = HMC5883L.connect(link)  # Tell the magnetometer's class to use the IoT node with address 0x01010A as the link to the magnetometer
print mag.getRaw()
>>> [0.01,126.3,24.0]  # magnetic fields along the x,y, and z axes of the sensor
The 2.4GHz transceiver, and small form factor make it an ideal replacement for interfacing various sensors to the SEELablet. Multiple subunits may be used simultaneously.
Full Feature List:

- Unique 3-byte address
- 10 bit ADC. Capture mode
- Battery Level monitoring
- Automatic detection
- 2Hz to 8MHz frequency counter. 1% accuracy
- I2C bus . Integrated with sensor communication classes
- SPI bus
- 5-bit DAC
- Up to 10 WS2812B RGB LEDs in daisy chained form
 
Graphical Interface for the wireless nodes : Automatically detects nearby nodes and their connected sensors
'''
Connect to a wireless node.

Try out its various features by calling any of the defined functions
uncomment the functions to use them

'''
import time

from SEEL import interface
I=interface.connect()
LINK = I.newRadioLink(address = 0x0c0b0a)  #Replace with the address of your node

#Fetches 16 readings from the battery level monitoring input, and 1 reading from CS3 
def read_adc():
	print (LINK.captureADC('BAT'),LINK.readADC('CS3'))

#Sets the dac to values from 0 to 3.3V
def set_dac():
	for a in range(33):
		print (a/10.,LINK.setDAC(a/10.))
		time.sleep(0.01)

#Sets the DAC, and reads the voltage on CS3. Short Dac output and CS3 on the node
def adc_dac_loopback():
	for a in range(33):
		print (a/10.,LINK.setDAC(a/10.),LINK.readADC('CS3'))

#Write to eeprom, and read it back
def eeprom_check():
	LINK.write_eeprom([6,7],[50,50])
	for a in range(300): print LINK.read_eeprom([0,1,2,4,5,6,7]) # locations 0,1,2 contain the three byte address of the node. location #5 is unwritten(255) . 6,7 will be read 50

#Display various shades on the neopixel
def LED_TEST():
	for a in range(20):
		LINK.WS2812B([[a,0,0]])  #R
		time.sleep(0.05)
	for a in range(20):
		LINK.WS2812B([[20-a,a,0]])  #G
		time.sleep(0.05)
	for a in range(20):
		LINK.WS2812B([[0,20-a,a]])  #B
		time.sleep(0.05)
	LINK.WS2812B([[10,10,10]])  #white



#######################   READ THE BATTERY PERCENTAGE  ###############################
#print (LINK.batteryLevel())

#######################      READ FROM 10 bit ADC      ###############################
#read_adc()

#######################   USE THE NODE AS A FREQUENCY COUNTER  ###############################
#I.sqr1(6000)  #Connect SQR1 to CS3 of the wireless node. Connect GND of the node to GND of the SEELablet
#print LINK.readFrequency()
#print LINK.readHighFrequency()


#######################   SET THE 5-bit DAC output  ###############################
#set_dac()


#######################   DAC to ADC(CS3) LOOP TEST  ###############################
#adc_dac_loopback()

#######################   SET VARIOUS SHADES ON THE NEOPIXEL  ###############################
#LED_TEST()

#######################   R/W 256 byte EEPROM  ###############################
#eeprom_check()

#######################   RESET THE NODE  ###############################
#LINK.reset() #reset the wireless node

#######################   USE CS1 and CS2 as digital I/O  ###############################
#Connect LEDs between the I/O pins and ground via a series resistor
#print LINK.setIO(CS2=1,CS1=0)

#######################   READ FROM A CONNECTED SPI DEVICE  ###############################
#print LINK.readSPI('CS1',[100,100,100,100])