Types of Networks in Artificial Neural Networks

Based on the connection pattern between the neurons, the artificial neural networks are classified in to two types.
1. Feed-forward networks.
2. Feedback or recurrent networks.

Artificial Neurons and its activation function - Tutorial Part3

Artificial Neurons and its activation function
Just like bio-logical neuron cell, the artificial neuron contains several inputs, output terminals and a computation unit (nucleus) at the center, as shown in the below figure. Each input connected to the neuron cell has its own weight represents the strength of the input signal.

Artificial Neuron


X1, X2, X3, …. Xn are the inputs of artificial neuron and these are multiplied with corresponding weights (W1, W2, W3, … Wn) before entering in to the nucleus. The nucleus will sum up all these weighted input values which produce “activation”.

The activation is given as       

Where Wj is the weight associated with the jth input (Xj).

McCulloch and Pitts were proposed a binary threshold unit as a computational model for an artificial neuron cell.
i.e., if the sum of the weighted inputs of the neuron cell is greater than threshold value gives a output ‘1’ otherwise is gives ‘0’ as output.

McCulloch-Pitts model of a artificial neuron cell






Applications and Importance of Artificial Neural Networks – Tutorial Part2

In the last tutorial of artificial neural networks we specified that human brain is big massive complex non-linear network. From this the Artificial Neuron should be designed with a non-linear function. Ok we will discuss about the non-linear function in the next tutorial.

Now we will some application and importance of Artificial Neural Networks

What is the importance of the Artificial Neural Networks (ANNs):
1.       Human brain is very good at pattern recognition (like handwriting recognition, etc.,) and can interpret noisy and incomplete data.
2.       Human brain is itself responsible for parallel processing and distributed representation.
3.       Human brain is very excellent in Learning.
All the human brain activities can be achieved by using Artificial Neural Networks in the computer technologies.

Applications of Artificial Neural Network (ANN):
1.       System identification
2.       Gamming and decision making (Ex: Chess game)
3.       Pattern recognition (like face recognition, voice recognition, handwritten recognition)
4.       Medical diagnosis – ex: ANN used to diagnosis various cancer.
5.       Financial applications
6.       Email-spam filtering
7.       Robotics

8.       Data processing, etc,

Introduction to Artificial Neural Networks - Tutorial Part1

Introduction to Artificial Neural Networks:

A computer technology is a wonderful technology that have been developed and used by the mankind over the last two centuries. A lot of changes and developments have been taken place in this technology, both in hardware (chip design technology) and software to meet the needs of the mankind. In our daily life we can see a lot of applications by using computer technology. Like desktops, mobile phones, automatic home appliances, etc., but still people not satisfied with these, so they want smarter and user friendly computers which would think like a human being. Therefore people trying to imitate the human brain in the computer technology. In order to do this we should know how our human’s will think and how our brain will work.

Human brain:

A human brain or human nerves system consists of large number (~100 billion) of bio-logical neuron cells and these are connected in a massive complex non-linear network called “Neural Networks”.  The neurons in the neural network have the ability to transmit and receive electrochemical signals. Through this bio-logical neural network the human brain can perform different tasks (like perceptual, recognization, pattern matching, etc.) in very small amount of time. But these tasks are not easily possible to achieve by using today’s high performance computer technology.



Human Brain:
Fig 1: Human Brain


Neuron Cell:
 
Fig 2: Neuron Cell

Real Bio-logical Neuron:

Human brain is big massive complex non-linear network with approximately 100 billion nerve cells called Neurons. Because of these, human’s can think, act, sense, recognize, visualize, etc. Dendrites are the branches of the neuron cell which are used to receive the input signals from other neurons via synaptic input terminals. Each neuron consists of a cell body with nucleus as center, which is treated as computational unit. The received inputs are processed at this computational unit and produce the output signal. The processed output signal is sent via a long branch called AXON. AXON is just like an electrical wire to transmit the output signal to other neuron cells via synaptic output terminals as shown in the figure. Dendrites are shorter branches when compared to AXON.

Artificial Neuron:

Like, bio-logical neuron, people have developed the model for Artificial Neuron (equivalent electrical model for bio-logical neuron). Like, bio-logical neuron, the artificial neuron basically consists of a nerve cell connected to several inputs (like synaptic input terminals through dendrites) and one or more output (like synaptic output terminals through AXON). Each input is connected to the nerve cell with some strength called weight of the input as shown in the figure below.

Artificial Neuron Cell

Visitor Counter using IR sensors and MSP430 launch pad

Microcontroller based Visitor counter project is useful in so many areas like railway stations, holy places, banks, etc. I was implemented this project by using Texas instruments MSP430 launch pad and IR sensor technology. But ultra sonic sensors will best suitable for this application because the effect of sunlight is more on IR based sensor module than ultra sonic sensors. But the ultra-sonic sensor modules are more costly that IR sensor modules and easy to implement.

IR sensor Modules:
This IR sensor Module is just same as obstacle sensor circuit. In this I have connected a 10k resistor to the inverting terminal of the opamp LM358 which is single supply opamp and the photo diode (D2) is connected to the positive terminal of the opamp. The IR diode is connected between the Vcc and Gnd via resistor R5 (330ohms). When the IR rays falls on the photodiode, a voltage is generated at the positive terminal of the opamp. Then the opamp will generate a high or low at the output and this is fed to MCU interrupt pins. Here i have designed the circuit diagram with eagle cad software.

IR sensor Module circuit diagram




Circuit Diagram:
Circuit for object or visitor counter project


In the above circuit diagram, I have connected two IR sensor modules (with two separate opamps 1A and 1B) to the MSP430 microcontroller port pins P1.2 and P2.3. A power on reset circuit (resistor and capacitor) is connected to the RST pin of thee microcontroller. A 16x2 character LCD is connected to port2 of the MSP430 microcontroller. A tutorial on the interfacing the 16x2 LCD to MSP430 is described here.
Simple Steps to Build Algorithm using MSP430 interrupts:
1
  1. If a person crosses the first sensor (1A) and then second (1B), then the count will increment. Check out the video shown below.
   2.  If a person crosses the second sensor (1B) and then first (1A), then the count will decrement.


Video:




Code:
#include  "msp430g2553.h"
#include  "stdio.h"
#include  "string.h"
#include "stdlib.h"
#include "MSP430_LCD.h"

void IntToString(int);
void strrev(char *);

#define delay_value 500
char LCD_Data = '';
char Template[50] = "\0";
char Temp_Array[5]="\0",Temp_Array1[5]="\0";
unsigned char Flag = 0,Temp=0;
static unsigned char i=0, j=0, status = 0, Button_Press=0;
static int COUNT = 0x00;
unsigned int Temp_Flag=0;

void main(void)
{
  WDTCTL = WDTPW + WDTHOLD;                 // Stop WDT
  BCSCTL1 = CALBC1_1MHZ;                    // Set DCO
  DCOCTL = CALDCO_1MHZ;
  BCSCTL2 &= ~(DIVS_3); //This line of code ensures that the SMCLK divider is 0, so we have SMCLK=DCO=1MHz (in fact if we are to have a /8 divider, it should be   BCSCTL2 |= DIVS_3;).


 // P1DIR = 0xFF;
  P2DIR = 0xFF;

  P1SEL  = BIT1 + BIT2;                     // P1.1 = RXD, P1.2=TXD, P1.6 = LCD_RS, P1.7 = LCD_EN
  P1SEL2 = BIT1 + BIT2;                     // P1.1 = RXD, P1.2=TXD

  P2SEL = 0;
  P2SEL2 = 0;

 P1DIR = 0xC1;                             // P1.0 output, else input
    P1OUT |= BIT0+ BIT3 + BIT4 + BIT5;                            // P1.4 set, else reset

    P1IE |= 0x38;                             // P1.3 interrupt enabled
    P1IES |= 0x38;                            // P1.3 Hi/lo edge
    P1REN |= 0x38;                            // P1.3 pullup
    P1OUT |= 0x38;       // Pull Up Resistor at 1.3
    P1IFG &= ~0x38;                           // P1. IFG cleared

    _enable_interrupt();
       P1IFG &= ~0x38;                           // P1. IFG cleared
       P1OUT &= ~BIT0;


  LCD_Init(); // LCD initialization
  delayms(50);


       send_cmd(0x01);  // clear display
       delayms(delay_value);
       send_cmd(0x81);  // clear display
       delayms(delay_value);
       send_string("Visitor Counter:");
       delayms(delay_value);
       send_cmd(0x01);  // clear display
       delayms(delay_value);



   while(1)
   {
    send_cmd(0x81);  // clear display
      delayms(delay_value);
      send_string("COUNT:");
      delayms(delay_value);

    send_cmd(0xC0);  // clear display
    delayms(50);

    if(COUNT != 0)
    IntToString(COUNT);
    else
    Temp_Array[0]='0';
    strrev(Temp_Array);
    if(COUNT>3)
     P1OUT |= BIT0;

    send_string(Temp_Array);
    strcpy(Template,"\0");

    for(Temp=0;Temp<5 data-blogger-escaped-0x01="" data-blogger-escaped-0x08="" data-blogger-escaped-0x10="" data-blogger-escaped-0x20="" data-blogger-escaped-10="" data-blogger-escaped-1="" data-blogger-escaped-__interrupt="" data-blogger-escaped-bit3="" data-blogger-escaped-button_press="1;" data-blogger-escaped-char="" data-blogger-escaped-cleared="" data-blogger-escaped-count--="" data-blogger-escaped-count="" data-blogger-escaped-edge="" data-blogger-escaped-else="" data-blogger-escaped-emp="" data-blogger-escaped-empvalue="" data-blogger-escaped-end="" data-blogger-escaped-for="" data-blogger-escaped-if="" data-blogger-escaped-ifg="" data-blogger-escaped-int="" data-blogger-escaped-interrupt="" data-blogger-escaped-interrupt_flag1="0;" data-blogger-escaped-interrupt_flag2="1;" data-blogger-escaped-inttostring="" data-blogger-escaped-k="" data-blogger-escaped-main="" data-blogger-escaped-nterrupt_flag1="=" data-blogger-escaped-nterrupt_flag2="=" data-blogger-escaped-of="" data-blogger-escaped-p1.0="toggle" data-blogger-escaped-p1.3="" data-blogger-escaped-p1.4="" data-blogger-escaped-p1="str," data-blogger-escaped-p1ifg="" data-blogger-escaped-p2="" data-blogger-escaped-pina="" data-blogger-escaped-port="" data-blogger-escaped-port_1="" data-blogger-escaped-pragma="" data-blogger-escaped-return="" data-blogger-escaped-routine="" data-blogger-escaped-service="" data-blogger-escaped-static="" data-blogger-escaped-str="" data-blogger-escaped-strrev="" data-blogger-escaped-temp_array="" data-blogger-escaped-tempvalue="(value" data-blogger-escaped-th="" data-blogger-escaped-the="" data-blogger-escaped-toggle="" data-blogger-escaped-value="value/10;" data-blogger-escaped-vector="PORT1_VECTOR" data-blogger-escaped-void="" data-blogger-escaped-while="" data-blogger-escaped-x08="" data-blogger-escaped-x10="" data-blogger-escaped-x20="" data-blogger-escaped-x30="">p1; ++p1,--p2)
 {
  *p1 ^= *p2;
  *p2 ^= *p1;
  *p1 ^= *p2;

 }

 strcpy(Temp_Array,str);

//return str;


}


PC based Power Automation using 8051 microcontroller and Java

In this project, the power of the loads that are connected to a house, offices, buildings, etc,are controlled by using a simple java application. Actually this project works in two modes.
1. auto-mode
2. manual-mode

In the auto-mode, all the loads can be switch ON or OFF by using software resides in PC by simply pressing buttons shown on the java frame.

In the manual-mode, all the loads can be switch ON or OFF by simply pressing manual buttons which is shown in the video. During this mode, you are not able to control the load via software. To do that you have switch mode via the software.

The project was developed by using 8051 microcontroller and relay circuitry.
The PC based power control software was developed by using java software

The java code is available in http://www.npprogrammers.blogspot.com

Video:

Interfacing Graphical LCD JHD 128x64E with TI Stellaris Launch pad LM4F120XL

Interfacing diagram:
Hello! Every one, in this tutorial I am going to show how to interface the GLCD with stellaris launch pad LM4F120XL processor. I have searched a lot around the internet but I didn’t get any proper details to interface GLCD with TI stellaris launch pad. Well! Here I am using JHD 128x64E GLCD. This GLCD contains 20 pins, out of these 8 data lines (D0-D7), 5 control lines (EN, RW, RS, CS1, CS2). The interfacing diagram is shown below.

Interfacing diagram for GLCD (JHD 128x64E) with Stellaris launch pad LM4F120XL




The data lines (D0-D7) of the GLCD are connected to GPIO PORTB (PB0-PB7) of the Stellaris LM4F120XL processor. The GLCD contains two segments, to enable these segments there are two control lines (CS1 and CS2) are available on the GLCD. According to the JHD 128x64E data sheet, these signals are active low signals. To enable any one of these segments, an active low signal is provided on these control lines. The other control lines like Enable, Read/Write, and RS are connected to GPIO PORTE (PE3, PE2, and PE1) respectively. Vcc should be 5v, Vee is -5v and a 10k preset is connected to V0 pin of the GLCD to adjust the contrast. Stellaris operated with 3.3v, but the GLCD is operated with 4-6v. Join both stellaris launch pad and GLCD ground pins, otherwise you won’t get proper animation or characters on the display.

Program code:
/*******************************************************************************************/
Graphical LCD working perfectly - printing dots on the GLCD.
Author: kiranvarma
/*******************************************************************************************/
#include "inc/lm4f120h5qr.h"
#include "inc/hw_gpio.h"
#include "inc/hw_memmap.h"
#include "inc/hw_sysctl.h"
#include "inc/hw_types.h"
#include "driverlib/gpio.h"
#include "driverlib/rom.h"
#include "driverlib/sysctl.h"
#include "font5x8.h"


unsigned int delay_value = 10 ;

volatile unsigned long ulLoop;

//*****************************************************************************
// PORTB is defined as data lines for graphical LCD
//*****************************************************************************

#define LCD_DATA_PERIPH        SYSCTL_PERIPH_GPIOB  // LCD data port
#define LCD_DATA_BASE          GPIO_PORTB_BASE
#define LCD_DATA            0xFF

//*****************************************************************************
// define control pins of GLCD 128x64
//*****************************************************************************
#define LCD_CS1_PERIPH           SYSCTL_PERIPH_GPIOA  // column 1 select
#define LCD_CS1_BASE             GPIO_PORTA_BASE
#define LCD_CS1_PIN              GPIO_PIN_2
#define LCD_CS2_PERIPH           SYSCTL_PERIPH_GPIOA  // column 1 select
#define LCD_CS2_BASE             GPIO_PORTA_BASE
#define LCD_CS2_PIN              GPIO_PIN_3
#define LCD_RST_PERIPH           SYSCTL_PERIPH_GPIOA   //Reset pin
#define LCD_RST_BASE             GPIO_PORTA_BASE
#define LCD_RST_PIN              GPIO_PIN_4
#define LCD_DI_PERIPH            SYSCTL_PERIPH_GPIOE  // DATA or INSTRUCTION (RS)
#define LCD_DI_BASE              GPIO_PORTE_BASE
#define LCD_DI_PIN               GPIO_PIN_3
#define LCD_RW_PERIPH            SYSCTL_PERIPH_GPIOE  // Read or Write pin
#define LCD_RW_BASE              GPIO_PORTE_BASE
#define LCD_RW_PIN               GPIO_PIN_2
#define LCD_EN_PERIPH            SYSCTL_PERIPH_GPIOE  // Enable Pin
#define LCD_EN_BASE              GPIO_PORTE_BASE
#define LCD_EN_PIN               GPIO_PIN_1




void delayms(unsigned int value)
{
 unsigned int i;
 for(i=0;i PORTE.1
 delayms(delay_value);
 GPIO_PORTE_DATA_R &= ~GPIO_PIN_1; // EN = 0
 delayms(delay_value);

}

void GLCD_ON()
{

 //enable both chips on Graphical LCD
 GPIO_PORTA_DATA_R |= GPIO_PIN_2;   // CS1 = 0 --> PA2, both are active low signals -- '0' must be provide to enable
 GPIO_PORTA_DATA_R |= GPIO_PIN_3;   // CS2 = 0 --> PA3

 // for command transfer
 GPIO_PORTE_DATA_R &= ~GPIO_PIN_3;  // DI or RS = 0 --> PE3 (command)
 GPIO_PORTE_DATA_R &= ~GPIO_PIN_2;  // RW = 0 --> PE2 (write)

 // command to ON 0x3F
 GPIO_PORTB_DATA_R = 0x3F;
 glcd_enable_pulse();
}


void Set_Start_Line(unsigned char linenum)
{
 //enable both chips on Graphical LCD
 GPIO_PORTA_DATA_R &= ~GPIO_PIN_2;   // CS1 = 0 --> PA2, both are active low signals -- '0' must be provide to enable
 GPIO_PORTA_DATA_R &= ~GPIO_PIN_3;   // CS2 = 0 --> PA3

 // for command transfer
 GPIO_PORTE_DATA_R &= ~GPIO_PIN_3;  // DI = 0 --> PE3 (command)
 GPIO_PORTE_DATA_R &= ~GPIO_PIN_2;  // RW = 0 --> PE2 (write)

 // command on PORTB
 GPIO_PORTB_DATA_R = (0xC0 | linenum);
 glcd_enable_pulse();
}




void GLCD_Write(unsigned short b)
{
 // for DATA write operation DI = 1, for command write operation DI = 0
 // for data transfer
 GPIO_PORTE_DATA_R |= GPIO_PIN_3;  // DI = 1 --> PE3 (data)
 GPIO_PORTE_DATA_R &= ~GPIO_PIN_2;  // RW = 0 --> PE2 (write)

 GPIO_PORTB_DATA_R = b;            //put data on data port
 delayms(10);
 glcd_enable_pulse();
}


unsigned short GLCD_Read(unsigned short column)
{
 unsigned short read_data = 0; //Read data here

 GPIO_PORTB_DIR_R = 0x00;//Make PORTB as Input

 // for data read
 GPIO_PORTE_DATA_R |= GPIO_PIN_3; //DI = 1 --> PE3 (data)
 GPIO_PORTE_DATA_R |= GPIO_PIN_2; //RW = 1 --> PE2 (read)

 // if column is greater than 63 then de-activate CS1 (CS1 = 1) and activate CS2 (CS2 = 0)

 if(column>63)
 {
  GPIO_PORTA_DATA_R &= ~GPIO_PIN_2;   // CS1 = 0 --> PA2 -- CS1 controller(left side) -- De-activated
  GPIO_PORTA_DATA_R |= GPIO_PIN_3;   // CS2 = 1 --> PA3 -- CS2 controller(right side) -- activated
 }
 else
 {
  GPIO_PORTA_DATA_R |= GPIO_PIN_2;   // CS1 = 1 --> PA2 -- CS1 controller(left side) -- activated
  GPIO_PORTA_DATA_R &= ~GPIO_PIN_3;   // CS2 = 0 --> PA3 -- CS2 controller(right side) -- De-Activated
 }

 GPIO_PORTE_DATA_R |= GPIO_PIN_1; // EN = 1 -> PORTE.1
 delayms(delay_value);
 GPIO_PORTE_DATA_R &= ~GPIO_PIN_1; // EN = 0
 delayms(delay_value);
 GPIO_PORTE_DATA_R |= GPIO_PIN_1; // EN = 1 -> PORTE.1
 delayms(delay_value);

 read_data = GPIO_PORTB_DATA_R;    //Input data

 GPIO_PORTE_DATA_R &= ~GPIO_PIN_1; // EN = 0
 delayms(delay_value);
 GPIO_PORTB_DIR_R = 0xFF;     //Output again
 return read_data;
}

void GOTO_COL(unsigned int x)
{
 unsigned short Col_Data;
 // for command transfer
 GPIO_PORTE_DATA_R &= ~GPIO_PIN_3;  // RS/DI = 0 --> PE3 (command)
 GPIO_PORTE_DATA_R &= ~GPIO_PIN_2;  // RW = 0 --> PE2 (write)

 if(x<64)             //left chip section
 {
  GPIO_PORTA_DATA_R |= GPIO_PIN_2;   // CS1 = 1 --> PA2 -- CS1 controller(left side) -- activated
  GPIO_PORTA_DATA_R &= ~GPIO_PIN_3;   // CS2 = 0 --> PA3 -- CS2 controller(right side) -- De-Activated
  Col_Data = x;              //put column address on data port
 }
 else                 //right chip section
 {

  GPIO_PORTA_DATA_R &= ~GPIO_PIN_2;   // CS1 = 0 --> PA2 -- CS1 controller(left side) -- De-activated
  GPIO_PORTA_DATA_R |= GPIO_PIN_3;   // CS2 = 1--> PA3 -- CS2 controller(right side) -- activated
  Col_Data = x-64;   //put column address on data port
 }

 Col_Data = (Col_Data | 0x40 ) & 0x7F;  //Command format
 GPIO_PORTB_DATA_R = Col_Data;
 glcd_enable_pulse();
}

void GOTO_ROW(unsigned int y)  // page selection
{
 unsigned short Col_Data;
 // for command transfer
 GPIO_PORTE_DATA_R &= ~GPIO_PIN_3;  // DI = 0 --> PE3 (command)
 GPIO_PORTE_DATA_R &= ~GPIO_PIN_2;  // RW = 0 --> PE2 (write)
 Col_Data = (y | 0xB8 ) & 0xBF; //put row address on data port set command
 GPIO_PORTB_DATA_R = Col_Data;
 glcd_enable_pulse();
}

void GOTO_XY(unsigned int x,unsigned int y)
{
 GOTO_COL(x);
 GOTO_ROW(y);
}

void GLCD_Clrln(unsigned short ln)
{
 int i;

 GOTO_XY(0,ln);      //At start of line of left side
 GPIO_PORTA_DATA_R |= GPIO_PIN_2;    // LEFT HALF OF THE SCREEN IS SELECTED,CS1 = 1 and CS2 = 0
 GPIO_PORTA_DATA_R &= ~GPIO_PIN_3;
 for(i=0;i<64;i++)
  GLCD_Write(0);

 GOTO_XY(64,ln);      //At start of line of right side
 GPIO_PORTA_DATA_R &= ~GPIO_PIN_2;    // Right HALF OF THE SCREEN IS SELECTED,CS1 = 0 and CS2 = 1
 GPIO_PORTA_DATA_R |= GPIO_PIN_3;
 for(i=64;i<128;i++)
  GLCD_Write(0);
}


void GLCD_CLR()
{
 unsigned short m;
 for(m=0;m<8;m++){
  GLCD_Clrln(m);
 }
}

void Draw_Point(unsigned short x,unsigned short y, unsigned short color)
{
 unsigned short Col_Data;;
 GOTO_XY(x,(y/8));
 switch (color)
 {
 case 0:         //Light spot
  Col_Data = ~(1<<(y%8)) & GLCD_Read(x);
  break;
 case 1:         //Dark spot
  Col_Data = (1<<(y%8)) | GLCD_Read(x);
  break;
 }
 GOTO_XY(x,(y/8));
 GLCD_Write(Col_Data);
}




void main(void)
{
 unsigned short u, v;
 setup();
 delayms(delay_value);

 GPIO_PORTA_DATA_R &= ~GPIO_PIN_2; // de-activate the chips
 GPIO_PORTA_DATA_R &= ~GPIO_PIN_3;
 GPIO_PORTA_DATA_R &= ~GPIO_PIN_4; // RST active low - reset applied
 delayms(1000);
 GPIO_PORTA_DATA_R |= GPIO_PIN_4; // RST
 GLCD_ON();
 GLCD_CLR();
 Set_Start_Line(0);

 do {

  for(u=0; u<64; u+=6)
   for (v=0; v<128; v+=2)
    //GLCD_Write(1);
    Draw_Point(v, u, 1);
  delayms(100);
  GLCD_CLR();
  delayms(100);

 } while(1);

}




Video:

If you really like this tutorial, Don't forget to give the comment or please subscribe to the RSS feed by submitting your E-mail or like our Facebook page.
Related Posts Plugin for WordPress, Blogger...

 
Powered by Blogger