applied electronics engineering

Learn electronics design with Us

Here you can find free electronics design tutorials, tips and tricks


Search

for analog, digital circuit tutorials, Microcontroller, C programming, antenna tutorials, FPGA chip programming with VHDL/Verilog, free ebooks, software and much more...




differences between RF mixer and audio mixer

Leave a Comment
RF mixers and audio mixers are widely used components in electronics system. Basically the term mixer means a device that mixes two signals. However, mixing itself has two forms- adding and multiplying. Adding two signals and multiplying two signals are both mixing.

What is Audio Mixer?

Audio mixer or microphone mixer are devices that combines(adds) two or more signals such that the resulting output signal has frequencies of the input signals that were added. Audio mixers are adders, summers or combiners that adds two or more input signals.

An adder circuit example is shown below with two input signals. V1 and V2 are two ac source which produces frequencies 200Hz and 500Hz respectively. They are simply joined by wires. When the voltage across resistor R12 is measured we find that the voltage signal has two frequencies

Audio Mixer Circuit example
Fig: Audio Mixer Circuit example

The following shows the V1, V2 and Vout voltage signal waveforms. The first is a sinusoid of frequency 200Hz, the second is of frequency 500Hz and the third has both 200Hz and 500Hz component.


The fact that the added signal or the combined signal has both the 200 and 500Hz frequencies can be verified by plotting the Vout signal spectrum.

Spectrum of audio mixer output
Fig: Spectrum of audio mixer output

As can be seen in the above spectrum of Vout signal it has two frequency components at 200 and 500Hz.

What is RF mixer?

RF mixers are devices that multiplies two or more signals such that the output mixed signal has sum and differences of the frequencies of all the input signal frequencies. RF mixers are multipliers and uses non-linear devices such as transistor or diodes.

The following circuit is an example of simple RF mixer. We have two input signals with frequencies 200Hz and 500Hz.

 RF mixer example
Fig: RF mixer circuit example
The following figure shows the inputs and output signal waveforms.

 RF mixer signal Waveforms
Fig: RF mixer signal Waveforms

In the figure above, the lowest signal waveform is that of the output mixed signal. We can see that it has multiple high and low profiles. This is because of the addition and subtraction of input signal fundamental and harmonic frequencies.

The same information in the frequency domain of the output signal is shown below.

Spectrum of RF mixer output
Fig: Spectrum of RF mixer output
RF mixers are used in AM radio, FM and PM radios to modulate a higher frequency signal with audio signals of lower frequency. Essentially this is embedding low frequency signal onto higher frequency.

In the tutorial AM Circuit Design using Proteus you can see example of how RF mixer works.

simulation of ADC with Microcontroller using Multisim

Leave a Comment
National Semiconductor(NI) provides their own circuit simulator and PCB design software called Multisim-Ultraboard. The circuit simulator Multisim can be used for analog, mixed signal, microcontroller and digital system simulation.

Here is an example of how to use Multisim for simulating ADC with 8051 microcontroller.

Multisim has different types of ADCs which can be found in the mixed signal library. Here we will use the generic 8 bit ADC. The 8051 microcontroller can be found in the MCU library. Also to display the analog voltage sensed we will also interface LCD to the 8051 microcontroller.

ADC, LCD and Microcontroller Interfacing Circuit

The schematic circuit diagram is shown below. For simulation purpose, only the essential components have been shown here. For example, crystal oscillator, reset connection, capacitors etc for the Microcontroller are not shown in this diagram. For PCB design these should be included in the schematic. However we will not do this here.

ADC, LCD interfacing with Microcontroller in Multisim
Fig: ADC, LCD interfacing with Microcontroller in Multisim

ADC and analog input


Analog input to ADC
Fig: Analog input to ADC
The analog input to to be converted to digital signal is derived from potentiometer connected to the 5V supply and the ground. Thus the input voltage range is from 5V to 0V. The ADC itself has internal highest and lowest voltage sensing circuit. The Vref+ is the highest voltage reference which is 5V and the Vref- is the lowest voltage reference which is ground. The SOC is a clock input port. This is connected to the 5V, 1KHz frequency clock signal.

ADC and Microcontroller

The ADC has 8 bit digital output pins which are connected to the Port 1 of the microcontroller. Also notice that the EOC* is active low End of Conversion signal that ADC uses to inform the Microcontroller that the current sampling of analog signal and digital equivalent data is available for pickup. This is an interrupt signal. This is connected to the port 3 pin 0 of the microcontroller.

ADC interfacing with 8051 Microcontroller
Fig: ADC interfacing with 8051 Microcontroller


LCD and Microcontroller interfacing

The LCD is connected to the microcontroller port 2 and port 0. The data lines of LCD are connected to the port 2 and the control signals(RD*, RS*, E*) of LCD are connected to the port 0 pin 7, 6 and 5 respectively. Since these are connected to port 0, pullup resistors have been used.

LCD interfacing with Microcontroller in Multisim
Fig: LCD interfacing with Microcontroller in Multisim

C program for ADC

The C program code for this ADC simulation is below.

#include <htc.h>

#define rw P07                          
#define rs P06                         
#define en P05

#define eoc P30

void msdelay(unsigned int t);
void cmd(unsigned char cmdword);      
void init();                          
void senddata(unsigned char mymsg);     
void ConvertDecimal(unsigned char value);

void main()
   {     
    
     unsigned char Binary_Data;
     init();
     P1 = 0xFF;
     eoc = 1;
     while(1)
     {
        while(eoc == 1);
        Binary_Data = P1;
        ConvertDecimal(Binary_Data);   
     }
   }

void msdelay(unsigned int t)
{
unsigned int i,j;
for (i=0;i<t;i++)
for (j=0;j<120;j++);
}

void cmd(unsigned char cmdword)        //sub. to write commands
      {
      P2 = cmdword;
      rs=0;          //select the instruction register
      rw=0;          // 0 for write operation
      en=1;          // to strobe the data
      msdelay(2);      // create some delay
      en=0;            // reset strobe signal
      }

void init()                             //lcd initializtion
      {
      cmd(0x38);                  //function set: 8 bit, 2 lines, 5x7 dot matirx
      cmd(0x0E);                  //display on and cursor on
      cmd(0x01);                  // clear display
      cmd(0x06);                  // entry mode: move cursor right, don?t shift display
      cmd(0x80);                  //cursor position to first position of first line
      }

void senddata(unsigned char mymsg)        //sub to write data
      {
      P2=mymsg;
      rs=1;
      rw=0;
      en=1;                              //start data write
      msdelay(2);
      en=0;                             // end data write
      }
void ConvertDecimal(unsigned char value)
      {

unsigned char x,d1,d2,d3,a1,a2,a3;
     x = value/10;
     d1 = value%10;
     a1=d1+'0';
     d2 = x%10;
     a2=d2+'0';
     d3 = x/10;
     a3 = d3+'0';
     senddata(a1);
     msdelay(10);
     senddata(a2);
     msdelay(10);
     senddata(a3);
     msdelay(10);
     senddata(' ');
     msdelay(200);
      }

We describe the C program briefly here. The beginning part of the C program consist of definition and creating alias names for various port pins so that it is easier to write the program.

The main function begines by creating a variables required to save the digital data from the ADC. The init( ) function is a function that initializes the LCD.

Next the port 1 is made an input port because this port is used to read data from the ADC. After that you can see use of a forever while loop to continuously execute the sampling, reading digital values and send to the LCD for display. The inner while loop is used to monitor the interrupt signal from the ADC. When it goes low, we save the port 1 binary data from ADC to a local variable. After that we convert the binary to decimal for display on the LCD. The function ConvertDecimal( ) is used here to this job.

Generic Multisim ADC vs ADC0804 or other ADCs

As a note, some facts about the ADC used here is discussed. The SOC(Start of Conversion) signal of the generic ADC used here is usually a signal from microcontroller to the ADC that tells the ADC to start sampling the analog signal. This is an input control signal from microcontroller. But in multisim this SOC port is connected to clock which is not so in most ADC interfacing. Most ADC have separate clock port and control signal port to start the analog to digital conversion. For more realistic ADC simulation see the ADC0804 interfacing with Microcontroller and programming in C which is done in Proteus.

How to Simulate 8051 Microcontroller in Multisim

Leave a Comment
This tutorial shows you how you can stimulate 8051 Microcontroller in Multisim. First we show how to create a new project(new design), then how to add 8051 microcontroller and the supporting components. Then next the steps for writing C program and compiling the code is shown. Finally we show how to run the simulation.

8051 Microcontroller simulation in Multisim
Fig: 8051 Microcontroller simulation in Multisim

Starting Multisim Project

Open Multisim


Select File > New


Select Blank and click create


You will see a design page as shown below.



Adding 8051 Microcontroller and supporting components

 Click on the MCU icon(or use the Part library > MCU) and you should see the the MCU library. Select the 8051 microcontroller and click on OK.


When OK is clicked in the above step, the MCU wizard pops out. In the first page, select the location where you want save the design. Then give the workspace some name. Here it is MC8051_project. Then click Next.


After you have clicked Next, you will see the 2nd wizard window. Select the Project type as Standard, C as the Programming language, Assembler/compiler tool as Hi-Tech C51-Lite compiler. And specify the project name(here it is MC8051proj). Then click Next.


In the next wizard window, select Add source file and give some name with .c extension for your C program. Here the default main.c is chosen. Click on Finish.


After you have clicked on Finish, you should see 8051 microcontroller placed on the schematic sheet. On the left side inside Design Toolbox panel you should see Design1 and the project MC8051_project, MC8051proj and the main.c file.


 Next add components as shown in the figure below.

As you can see in the above diagram, we have connected a LED at the port 2 zero pin.

Writing C program and Compiling

 Next we have to write the C program to blink ON and OFF the LED. Click on the main.c file that is visible in the design panel. You will see an initial C code template with only main( ) C function.


Next write the following C program into the C code editor.

#include <htc.h>
#define LED P20

void delay(unsigned int);

void main()
{

while(1)
{
    LED = 1;
    delay(250);
    LED = 0;
    delay(250);
}
}

void delay(unsigned int x)
{
    unsigned int i, j;
   
    for(i = 0; i <= x; i++)
        for(j = 0; j <= 5000; j++);
}


Next we have to compile the code. Right click on the main.c file and click on Build. This will compile the C code. Then see the console window for any warning or errors. There should be none.


Simulating the design

 Next to simulate the design, go to the schematic view. On the toolbar click on Run button. When it is clicked you will see a message window that says that the design is out of date and that you need to build it(rebuild it if not saved). Click on Yes to build the project.


The 8051 microcontroller simulation will start. You should see the LED blinking On and off as per the C program. If you cannot see the LED blinking then zoom into the LED area. The following shows screenshot taken when the LED was On.


In this way you can simulate 8051 Microcontroller in Multisim. You can do variety of microcontroller simulation project in multisim just like in Proteus.

If you like microcontroller simulation see also how to simulate microcontroller in Proteus.

If you have any comments or questions please leave it in the comment box below.


how to create a new Component in NI Multisim?

Leave a Comment
If you use NI Multisim to design and test your electronics circuit you may not find the component that you need in the component database. Here we show how you can create a new component with circuit symbol, simulation spice model and footprint.

There are two ways in which you can create a new component in NI Multisim circuit simulator. The first way is to use the Component Wizard and the other is to directly edit an existing component in the Database.

We will be using the second method which is to edit an existing component in the Database. Also for the illustration purpose we will create a new transistor component which is the 2N3565 NPN transistor which is not available in the Multisim installation.

When you open Multisim you should have the following screen.


Next to start with go to Tools > Database > Database manager.


The Database Manager window pops up which is shown below.


This database contains all the components that comes shipped with Multisim. What we want to do is to select one of the existing transistor in the database which is very similar in symbol and footprint package as the 2N3565.

For this reason we will select the 2N3501 transistor. To find this transistor we can use the filter that helps in finding the component we are looking for quicker. Click on the Filter button. Then select BJT_NPN as shown below.


Then in the following window we can search and select the 2N3501 to edit it.


You will see the following screen. Now we have to change this 2N3501 component information to 2N3565 along the way in the series of tabs.


In the general tab, change the name of the component to 2N3565, change the name of the author and date of change.


Next go to the Symbol tab. Since this 2N3501 and 2N3565 transistors have the same number of pins and pin numbers we do not have to change it.


Next go to the Model tab.


Next click on Add/ Edit button to add new component to the Database. You can add the component to the Master Database, Corporate Database or the User Database. We will add the new component in the User Database. Select User Database, click on Add and when you do this it ask you for Model ID. There enter 2N3565 and click OK.


Then in the table Model List ID, you can give manufacturer name. Here it is shown generic.


Next in the Model Data field enter the 2N3565 spice model below-

.MODEL 2N3565 NPN(IS=5.911E-15 ISE=5.911E-15 ISC=0 XTI=3
+ BF=697.1 BR=1.297 IKF=13.93E-3 IKR=0 XTB=1.5
+ VAF=62.37 VAR=21.5 VJE=0.65 VJC=0.65
+ RE=0.15 RC=1.61 RB=10
+ CJE=4.973E-12 CJC=4.017E-12 XCJC=0.75 FC=0.5
+ NF=1 NR=1 NE=1.342 NC=2 MJE=0.4146 MJC=0.3174
+ TF=820.4E-12 TR=4.687E-9 ITF=0.35 VTF=4 XTF=7
+ EG=1.11 KF=1E-9 AF=1
+ VCEO=25 ICRATING=50M MFG=NSC)

After doing the above steps you should see two components 2N3501 and 2N3565 in the Model name field. Select the 2N3501 and delete this component by clicking on the Delete a Model button.



Go to next tab Pin parameter. Here we have to adjust the pin number, pin name, type of pin and ERC status. Since the 2N3501 and 2N3565 have same pin number and name we can leave this tab in its default.


Next go to the Footprint tab. Here we have to specify the footprint for the 2N3565 transistor. The 2N3565 tansistor has the same footprint as the 2N3501 transistor which is TO-39. So we can also leave this information as it is.


Next click the Electronic parameters tab. There you can fill up the information that are asked in the fields by looking into the transistor datasheet.


Next go to the User Field tab. There you can provide information about the vendor, the part number and name and the URL of the datasheet. This is useful for future reference. Here we did not enter any information but you can do so.


When you click OK you will see the following screen. Here you can select the destination of your newly created component.


Select the User Database, the transistor and then click on Add Family. Once you do so give a name to the family like mytransistor. Then click on OK and again OK to complete the component creation process.


To verify that the componet is now in the user database you can select the userdata to see if the new component is there.


Now your new component is ready to use.


If you have any problem or did not understand please leave your comments below.

How to build a Wireless Microphone?

Leave a Comment
A wireless microphone can be used to transmit audio signal without wire to a distant receiver. The distance between the wireless microphone transmitter and receiver depends upon the power of the signal output from the wireless transmitter. Here a low power wireless microphone design is shown which you can build yourself at home.

A professional high quality wireless microphone with receiver is shown below for illustration purpose. We will show how to build a simpler version of such wireless microphone transmitter.

wireless microphone with receiver
Fig: wireless microphone with receiver

Such professional mike operates in the 170MHz band.

Wireless Microphone Circuit Diagram

 The wireless microphone design shown here and the component value in discussion assumes 100MHz FM frequency. The wireless microphone circuit diagram is shown below.
Wireless Microphone Circuit
Fig: Wireless Microphone Circuit

 Circuit Description

We can divide the circuit into major sections-
  • Microphone input
  • Audio amplifier
  • Oscillator
  • Antenna output

Microphone Input

  In the figure the electret microphone(MIC) is modeled as an ac.source. The whole circuit is driven by 9V DC voltage source when the switch S1 is closed. R1 resistor is there to bias the microphone. A variable resistor can be used as R1. It's typical value is 4.7KOhm.

Audio Amplifier

The audio signal from the microphone enters into the audio amplifier circuit made up of 2N3565, R2, R3 and R4. The audio amplifier is biased for 4V and around 5mA output voltage and current. See transistor biasing tutorial.

The capacitor C1 is the coupling/ decoupling capacitor that couples the audio signal into the audio amplifier circuit and decouples the flow of energy back into the input circuit.

Oscillator

The amplified audio signal is then coupled into the oscillator circuit made up of transistor MPSH10(other useable transistor includes 2N3564, 2N5179), R5, R6, R7 and the LC tuned circuit made up of C4 and L1 plus L2 combined inductor. Transistor MPSH10 can be replaced by other transistor 2N3564, 2N5179. These transistors are called VHF transistors.

The LC tank circuit determines the carrier signal frequency which is the FM band.

Variable capacitor C4 is used to vary the output signal frequency. For 100MHz the value of this capacitor is in the range of 9 to 15pF.

L1 and L2 combined inductance is about 0.25uH for FM band. This inductor is made up several turns of #22 wire wound on a 1/4 inch coil form. The tap can be soldered directly to the inductor coil.

C2 is coupling/decoupling capacitor that is used to couple the amplified audio signal into the oscillator and decouple it from entering back into the amplifier circuit.

The R8 and C3 forms an RC circuit that filters the amplified output signal from the amplifier circuit before entering the oscillator circuit.

Antenna Output

The RF energy is coupled into the antenna using the tapped L1 and L2 inductor combinations. C6 is the DC blocking capacitor. For 100MHz FM transmission frequency the wavelength is 3m. Antenna size is about 1/10th of this wavelength which gives 30cm antenna length.

If you have any comments on this please leave it below in the comment box.





TI Piccolo Microcontroller and applications

Leave a Comment
Texas Instruments sells variety of DSP based microcontrollers. One of the line of DSP microcontroller they sell is called Piccolo Microcontrollers. Real time DSP processors requires that the computation result is available instantly, the peripheral devices are informed and controlled by the CPU instantly requiring interrupt signalling. Timing and counting events are essential for real time processing. These capabilities are incorporated in the Piccolo microcontrollers.

What is Piccolo Microcontrollers?

Piccolo Microcontroller
Fig: Piccolo Microcontroller
  Piccolo MCUs are 32 bit DSP based microcontroller designed for real time closed loop control application. Internally they are designed such that analog control peripheral are tightly integrated with digital circuit. For example the analog circuits inside it are voltage regulator, PWM(Pulse Width modulation) circuit, temperature sensor, comparators circuit and ADC circuits which are controlled by the digital circuit. The digital circuit includes the 32-bit CPU, memories, timers etc. Besides these two circuit division, it also includes circuit for different communication protocols such IC2, SPI, eCAP etc. More details follows below.

But in brief we can say that Piccolo MCUs are chip in which analog and digital components are integrated in purpose that designers don't have to invest time in creating analog to digital interfacing circuits, signal processing of the converted digital signals and send to other processors or PC. Imagine the time it would take to buy and design such circuit from single analog and digital components. Also consider the fact that there would be errors in the design.

Different types of Piccolo Microcontrollers

TI sells Piccolo Microcontrollers series as follows.
  • TMS320F2807x MCUs     
  • TMS320F2806x MCUs     
  • TMS320F2805x MCUs     
  • TMS320F2803x MCUs     
  • TMS320F2802x MCUs
The difference between these Piccolo MCUs are mainly the instruction processing capability of the CPU called MIPS(Million Instruction Per Seconds), whether they have co processor along with the main CPU and memory size and of course the price that comes with it.

The above listed Piccolo Microcontrollers are also called C2000 Microcontrollers Products. But TI also has other MCU which they call C2000 microcontroller. These along with Piccolo are listed below-
  • Piccolo MCU
  • Delfino MCU
  • InstaSPIN MCU
  • F28x MCU

Main Features of Piccolo MCUs

CPU

  • 32 bit fixed point CPU with 60MHz, 50MHz, 40MHz operating frequencies
  • 16x16 and 32x32 MAC operation
  • 16x16 dual MAC
  • Harvard Architecture
  • Fast Interrupt Response
  • Peripheral Interrupt Expansion(PIE) that supports all peripheral interrupt

 Memory

  • Flash, SARAM, OTP, Boot ROM available

Counters and Timers

  • On chip oscillator or External Clock options
  • Two internal zero-pin oscillator
  • Power On and Brown Out Reset
  • Watchdog Timer
  • Three CPU 32 bit Timers
  • Independent 16 bit Timers in each ePWM module
  • Internal dynamic PLL
  • Missing Clock detector

Input/ Output ports

  • Upto 22 individual programmable multiplexed GPIO pins with input filtering

Serial Port Peripherals

  • One SCI(UART) module
  • One SPI module
  • One Inter-Integrated-Circuit(I2C) module

Security Key/ Lock

  • Memory Protection
  • Firmware Reverse Engineering Protection

Power Supply

  • Single 3.3V supply

Enhanced Control Peripherals

  • Enhanced Pulse Width Modulator(ePWM)
  • High Resolution PWM(HRPWM) module
  • Enhanced Capture(eCAP) module
  • On-chip Temperature Capture
  • Comparator

 Software and Emulation feature

  • C/C++ or assembly language
  • Analysis and breakpoint features
  • Real Time Debug via Hardware

 Piccolo MCU applications

Piccolo MCUs are designed for real time control application such as DC motor control, digital power supplies, solar and renewable energy, LED lighting, smart grid, radar, power line communications and many more. The CPU core is 32 bit fixed point processor designed to perform math extensive computations.

Some application areas include the followings-
  • White Goods
  • Switched-Mode Power Supplies(SMPS)
  • DC-DC Multiple Output Power Supplies
  • Solar Micro Inverters and Converters
  • LED lighting
  • Power Factor Correction
  • Sewing and Textile Machines
  • eBikes
 White Goods are home appliances such as refrigerators, washing machines, AC(Air Conditioners), fans, water coolers or heaters, microwave, dish washers etc. So in all these domestic appliance the Piccolo MCU can be used for processing analog signal and controlling the parts of the devices.



Switched-mode Power Supply(SMPS) is an electronics circuit that regulates the ac main supply to a smooth dc voltage required for such as PC. They are power efficient regulator required in all DC electronics circuits.

As listed in the application they can also be used in DC DC converters required in Solar Powered electronics circuit(see DIY solar powered AM radio and solar powered Cell phone charger).