applied electronics engineering

Latest

Latest Posts

How to unroute all routed traces in Proteus

- Wednesday, April 26, 2017 No Comments
In this PCB tutorial you will learn how to unroute all the routed traces in Proteus. Consider that you have designed PCB and you routed all the nets manually or using auto-router tool. Next you find that the routing is not acceptable or for any other reason you have to delete or unroute all the traces.

For those who does not know what is proteus, it is a PCB design software as well as schematic and circuit simulation software. It is like any other PCB design software like Altium Designer but Proteus is electronics beginners friendly.

Following is an example of routed PCB in Proteus.


Next for some reason we don't like the routed traces and we want to delete all the traces, that is unroute all the traces.

To do this, first select track mode as shown.


After that right click and select all the routed nets.


Now there are two option to unroute(delete) the routed nets.

The first is simply to press delete key in the keyboard. All the traces will then be unrouted.

Or, you can right click once you have selected all the nets and then click on the Block Delete option as shown.


Once you have deleted all the traces you will see the following unrouted nets.


We hope you like our short tutorial on Proteus PCB design.

Programming PIC18F4450 with Proteus

- Friday, April 21, 2017 No Comments
In this tutorial we will show how to program PIC18F4450 with Proteus microcontroller simulation software. For the demonstration purpose we will make a simple LED blinking program.We will also tell you how to download MPLAB IDE and XC compiler needed for compiling the C program code. Also you need to configure Proteus to use the compiler.

The process is to first download and install MPLAB X IDE, download and install XC compiler, optionally you can also download and install the MPLAB code configurator. Then you need to configure the proteus to use the MPLAB compiler. After all these, you create a schematic with a LED connected to the PIC18F4450 and then write led blinking C program code.

What you should expect is the following LED blinking simulation.



The steps are as follows.

1. Download and Install MPLAB X IDE

Go to microchip website and download the MPLAB X IDE which is for free.

2. Download XC compiler

The IDE needs compiler. The microchip compiler for MPLAB X IDE has 8-bit, 16-bit and 32-bit compiler. Depending upon your requirement download the compiler from the following web link:

http://www.microchip.com/mplab/compilers


Once you have downloaded the compiler, just click it to start installation.


3. Install MPLAB MCC(MPLAB Code Configurator)

This is optional step but if you want to work with MPLAB in long term, it is good idea to install this plugin since you are already installing MPLAB for the first time. Open MPLAB X IDE. Go to tools and select Plugins. In the Plugin window, go to Available Plugins and select MPLAB Code Configurator then install it.

Now you are ready to write code for PIC microcontrollers.

4. Configure Proteus

Open proteus and place the PIC18F4550 microcontroller into schematic. Then double click it to open its properties. Then select Edit Firmware.


Then in the window that shows up, click on compiler button.

In the MPLAB XC8 field, edit the path to your MALAB XC8 installation folder. In this case it is C:\Program Files\Microchip\xc8\v1.41
The click ok.

Now you will be able to select MPLAB XC8 compiler as follows.


You will see a default C program code in the code editor window.


We need to write our C program in this editor. Write the following C program code to blink a LED connected to the pin 0 of port B.

#include<p18f4550.h>  

#pragma config PLLDIV = 5 , CPUDIV = OSC1_PLL2 , USBDIV = 2
#pragma config FOSC = INTOSCIO_EC
#pragma config FCMEN = OFF                             
#pragma config BORV = 3
#pragma config WDT = OFF
#pragma config CPB = OFF
#pragma config CPD = OFF

void mydelay(void)
      {
     int i, j;
     for(i=0;i<5000;i++)
        {
           for(j=0;j<2;j++)
                      {      }   
        }  
      }
                         
void main(void)
         {
        TRISB = 0 ;
    
           while(1)
          {
         LATBbits.LATB0 = 1;
         mydelay();
         LATBbits.LATB0 = 0;
         mydelay();
         }
     }

Build the project. this will compile the C code to hex code and upload the hex file into the PIC18F4450 microcontroller.


You should see Compiled Successfully message at the bottom message pane.

Now connect a LED to the port B pin 0 as shown below and also connect the active low MCLR pin to +5V supply via 4.7kOhm resistor. Then click on the Run button for simulation. The LED should blink now.


Explain me Bluetooth Protocol stack and Bluetooth hardware

- Wednesday, April 19, 2017 No Comments
Today bluetooth is everywhere from Personal Computer(PC) to cell phones. They are also used in industrial electronics and healthcare systems. From Bluetooth developer point of view it is a complicated technology. A Bluetooth IC is a complete radio system on its own operating at 2.5GHz frequency. The IC is small but contains everything like RF front end, ADC(Analog to Digital Converter), DAC(Digital to Analog Converter), DSP(Digital Signal Processors), Microcontroller, RAM and various connection interfaces. Shown below is a typical Bluetooth Architecture of BC417143B bluetooth IC.


As if this hardware aspect is not complicated, the software architecture is equally complicated. The Bluetooth software aspect is dependent on its protocol stack. A pile or stack of predefined functions and protocol that must be followed and dictates how the Bluetooth system works. Shown below is the protocol stack of the Bluetooth.

Lets briefly see what these components of the stack are and what they do. Overall these all protocol stacks are there to help user application connect reliable and quality wirelessly.

Beginning at the bottom is the radio interface related protocols. As we go up higher the stacks, the protocol becomes more software oriented, that is application oriented. At the top we have the user application interacting with the rest of the protocol stack. Now user application varies widely. So in order to support such variety of application, the protocol stack is complicated.

Thus at the bottom of the stack there is link manager, link controller and radio controller. These all have to do with physical wireless air connection. They format the over-air transmissions, handle error detection and re-transmission, and manages the links between devices.

The L2CAP stands for Logical Link Control and Adaptation Protocol. It is responsible to package or multiplex the data from the upper level(applications) into Asynchronous ConnectionLess (ACL) connection between two bluetooth devices. First remember that L2CAP only deals with data traffic and not voice. In case, the device is a master, the L2CAP directs the data to the slave device. It packages data coming from the upper level and/or unpackages the data coming from the lower level. In reality, the I2CAP is performing simulateous operation on coming data either up or down. And the application to which the data belong are identified by have each I2CAP logical channel with a unique Channel Identifier (CID).

RFCOMM emulates full 9-pin RS232 serial communication over an L2CAP channel. It is based on the TS 07.10 standard for a software emulation of the RS232 hardware interface.TS 07.10 includes the ability to multiplex several emulated serial ports onto a single data connection using a different Data Link Connection Identifier (DLCI) for each port. However, each TS 07.10 session can only connect over a single L2CAP channel and thus only communicate with one device.A master device must have separate RFCOMM sessions running for each slave requiring a serial port connection.

OBEX stands for Object Exchange which is a standard developed by the Infrared Data Association (IrDA) to facilitate operations common to IR-enabled devices like personal digital assistants (PDAs) and laptops. Rather than develop a new standard, the Bluetooth SIG took OBEX largely as is, detailed a few specifics regarding Bluetooth implementation (e.g., making some optional features mandatory),
and used it in the File Transfer, Synchronisation, and Object Push profiles. OBEX allows users to put and get data objects, create and delete folders and objects, and specify the working directory at the remote end of the link. IrDA has also provided formats for data objects, while the Bluetooth specification has adopted the vCard format for business card exchange and the vCal format for exchanging calendars.

Telephony Control Protocol Specification Binary (TCS Binary, also called TCSBIN), is based on the International Telecommunication Union-Telecommunication Standardization Sector (ITU-T) Q.931 standard for telephony call control. It includes a range of signaling commands from group management to incoming call notification, as well as audio connection establishment and termination. It is used in both the Cordless Telephony and Intercom profiles.

The Service Discovery Protocol(SDP) is like a service database. It is different from other layers in the protocol stack because SDP is specifically Bluetooth oriented. The user application is registered as available services on the database. Then remote devices once connected can query the database to find out what services are available and how to connect to them.

In the protocol stack picture above you can see device manager, security manager and connection manager. These are rather function blocks rather than protocol. The device manager handles the lower level operation of the bluetooth device. The security manager mainly checks that the device has sufficient service privileges. The connection manager handles application connection to bluetooth devices.


How to add 3D step model in Proteus

- Tuesday, April 18, 2017 No Comments
In this tutorial you will learn how to add 3D step model in Proteus professional electronics and PCB design software. Proteus allows you to add 3D step models to your components. 3D modeling is helpful feature to view the design you have created. With 3D modeling you can anticipate how your end design looks like, you can share it with your friends, boss or clients. Proteus can import mechanical STEP, IGES models and 3DS visual models.

Consider that you have made a circuit schematic. Then to add 3D step model open the ARES PCB layout editor. The one in this tutorial looks like the following.

How to add 3D step model in Proteus

At this point the 3D view of the PCB looks like the following.


The RJ11 socket in this project does not look so good. So we want to add 3D step model for RJ11 socket so that 3D PCB looks more realistic. To do this we download 3D step model for RJ11 socket. There are many website which offers such step model for free. One of the is 3D ContentCentral(www.3dcontentcentral.com). So visit this site, register free account and search for RJ11 socket. The one used in this tutorials is shown below.



Select STEP(*.step) as the Format and download it.


Now extract the downloaded file in some folder. You will see the following.


The 3D step model file is User Library-RJ11-WE-HOR-TAB-UP.STEP. We can rename it so that its name is more sensible. Rename it like RJ11-SOCKET.STEP


Now copy or cut this RJ11-SOCKET.STEP file and put it int the MCAD folder in your Proteus installation path.


Now we are ready to attach this model file to our RJ11 socket in proteus.

Go back to the PCB editor in Proteus. Right click on the RJ11 socket connector and choose 3D.


In the window that shows up, choose M-CAD(STEP or IGES) File, then in the File name field browse to the location of the RJ_SOCKET.STEP step file that you had just saved in the Proteus MCAD folder.


With The Rotation and Offset, orient the model to align with the pins and drill of the footprint.

How to add 3D step model in Proteus

Click OK and the 3D step model attached to the RJ11 socket. The PCB should be updated and the 3D view will show the newly attached 3D model RJ11 socket.


So in this way we showed you how you can add 3D step model in Proteus.

If you are working on Altium designer see how to add 3D step model in Altium Designer PCB design softw

What is the difference between ATmega8L and ATmega8u2

- Monday, April 17, 2017 No Comments
The ATMega8L or ATMega8 and ATMega8u2 are both 8 bit CMOS microcontroller product of ATMEL. The main difference to users is that the ATMega8u2 has USB support while the ATMega8 or ATMega8L does not. In the new version of Arduino UNO, the ATMega8u2 IC is used for transferring data from Computer(PC) to the Arduino via the USB.

Other features of the two chips, ATMega8 and ATMega8u2 are similar. Particularly they both have 16 MIPS Throughput at 16 MHz. Flash memory, EEPROM, SRAM are same, instruction set is little different- the ATMega8 or ATMega8L has 130 instructions while the ATMega8u2 has 125 instructions, pheripheral features are also similar.

Another difference is that the ATmega8u2 does not come in PDIP package. It only comes in QFN32 (5x5mm) / TQFP32 packages while the ATMega8 comes in both the PDIP and QFN/TQFP package. That implies that ATMega8u2 is a surface mount IC.

Many people confuse these two types of chips because they have the same name except at the end there is u2 in ATMega8u2. One reason why people are interested in ATMega8u2 chip is that they are used in Arduino UNO for USB communication. Since USB communication or interface is required not only for making homebrew Arduino UNO but also because USB interface is required in many other electronics products. This has led user to believe that they can use the ATMega8u2 chip for interfacing microcontroller to USB in similar fashion the popular FTDI chip. One thing to note is that FTDI chips is a full blown USB support chip whereas ATMega8u2 is not. For higher speed USB application the ATMega8u2 will now provide sufficient speed.

Below is a picture that shows how ATMega8u2 IC looks like.

 And the following picture shows ATMega8L


How to know if input signal is high or low with Arduino

- No Comments
Often you will be need to read some input signal. The input signal can be in any voltage range, for example 1.55V to 2.3V. Now if you want to connect 1.55V-2.3V range input signal to one of the Arduino UNO digital pin what do you think the Arduino microcontroller will interpret this signal- High or Low signal?

Let's dwell some foundation for digital logic system. In the digital system with 1 and 0 bits there is a range of voltage for 1 and for 0. This is called the logic level. With the development of digital system, now, we have two different popular digital logic system. One is called TTL logic level and the other is called 3.3V CMOS logic level. The TTL logic level is concerned with 5V where the 3.3V CMOS is concerned with 3.3V. TTL is a methodology of creating digital devices and so is CMOS. The TTL technology is based on Bipolar Transistors while the 3.3V CMOS digital system are based on CMOS transistors.

In TTL logic, the input signal is interpreted as high if the input signal voltage range is within 2V to 5V. If the input signal voltage is in the range 0V to 0.8V then it is interpreted as logic low. With 3.3V CMOS devices, if the input signal is between 0V to 0.8V then the input is low logic. If the input signal is in the range 2V to 3.3V then it is interpreted as logic high.

The Arduino UNO in similar manner has a predefined range of voltage for logic high and low. If the input voltage is between 0V to 1.5V then it is interpreted as logic 0. If the input voltage is between 3V to 1.5V then it is interpreted as logic high.

So in this way you can know whether the input signal is logic high or logic low with Arduino UNO.




How Arduino UNO ADC works

- Sunday, April 16, 2017 No Comments
The Arduino UNO uses ATMega328P microcontroller. In its default it uses 10bit ADC and its sample rate is configured to be 9.6KHz. That means that the analog signal like audio signal bandwidth that can be effectively captured is 4.8KHz. So if you have analog signal and ask the question where is most of the information contained and it is within 4.8KHz then this ADC setting of Arduino UNO can be used. Each analog signal sampled value is stored as 10 bit digital value. The higher the ADC resolution which is 10 bit in Arduino default state, the better the precision of the analog signal. For example, a CD audio signal is stored as 16bit digital values.

The sampling rate of the inside ADC of Arduino is determined by an internal clock that is fed to the ADC. Meaning the ADC clock determines the sampling rate. The clock is programmable via the prescaler. The prescaler is a digital component inside the microcontroller that divides the Arduino 16MHz master clock by 128 to create 125KHz clocking frequency to the Arduino ADC.

Now you might be asking, ok, inside the microcontroller we have a clock of 16MHz, the prescaler due to default dividing factor of 128 gives us 16/128=12KHz clock source but you said the ADC of Arduino works as 9KHz sampling rate? Well yes, the ADC is in fact clock sourced using 125KHz clock pulses but sampling one analog signal takes 13 clock cycle. Each clock cycle is 125KHz and hence the sampling rate is 125KHz/13 which is approximately 9.6KHz.

OK so we have a analog signal at the analog pin of the Arduino and we want to convert it to digital signal by using the Arduino internal ADC. The analog signal is fed into the ADC. The ADC has sampling rate of 9.KHz. Hence we actually are acquiring signal with bandwidth 4.8KHz. The sampling rate of the internal ADC is due to the prescaler and the due to the 13 clock cycle for sampling one time the analog signal.

How can you increase the sampling rate? We if you think for a moment, the sampling rate is determined by prescaler(16MHz/128). If you lower the prescaler value then the sampling rate is increased. See the following block diagram of the Atmega328 microcontroller.

See also Programming ATmega328P microcontroller using Proteus


Programming ATmega328P microcontroller using Proteus

- Saturday, April 15, 2017 No Comments
You may have programmed Arduino UNO using Proteus software. But have you tried programming the ATMega328P microcontroller using Proteus? As you should know ATMega328P is the microcontroller that is used in Arduino UNO. The benefit of learning ATmega328P microcontroller programming instead of Arduino UNO board is helpful in your professional career or if you want to design some embedded system application.

Here is how you can program ATmega328P using Proteus. It is very simple. For illustrative purpose we will create a hello world microcontroller program, that is LED blinking program and circuit. See the following circuit diagram.


The microcontroller is easily found if you type in the ATmega328 into the search field in the proteus library. Then place it onto the schematic sheet. Complete the circuit for simple LED blinking at port PB5 which corresponds to pin 13 in the usual Arduino board.

To program the microcontroller, double click it to open its properties. There click on the edit firmware. Select either Arduino AVR or Arduino AVR(proteus), doesn't matter both should work.


Now write the following program into the code editor window that you will see.

void setup() {
  pinMode(13, OUTPUT);
}

void loop() {
  digitalWrite(13, HIGH); 
  delay(100);                     
  digitalWrite(13, LOW);  
  delay(100);                    
}

Finally right click on the main.ino file on the left pane and select Build Project. This should compile and upload the program file into the ATmega238P microcontroller.

Now return to the schematic and run the simulation. The LED should be blinking at rate 100ms as programmed.

Next see our other Arduino tutorials Send message to Arduino using Bluetooth Module HC-05, How to read sinusoidal signal using Arduino Due