The concept of the project is to sense the pressure distribution on a persons palm/foot when he lands his palm/foot on the floor. The pressure distribution map is useful for analyzing a patients orthopedic problems . The pressure map is displayed in the form of a MATLAB 3D plot helping to visualize the pressure distribution on the persons hand shown below.

 The 3d plot used to show the pressure distribution is a shown using the surf()  funtion of MATLAB. The plot will display pressure variations from low pressure ares with a lighter color/higher peaks and higher pressure areas with darker colors/ lower peaks. The design would involve many flat pressure sensors(FSR) distributed to form a sensor bed.

 

The sensors used can be a FSR (Force sensitive resistor shown above) or other sensors which you find suitable. The sensors used must be selected small enough to provide better sensing resolution in a given area. Smaller the size of pressure sensor, more will be the number of sensors in a given area, which will give a more detailed plot of pressure areas. If you are using an FSR then you can interface them to the microcontroller via an ADC and convert the pressure variations to digital values and transmit them to a PC running MATLAB via UART or other interface.

The microcontroller PIC16F877A reads the 8-pressure sensor values using an 8 bit ADC and sends them to the PC COM port. A piece of the microcontroller code is shown below,

 

{code}


#include 
#include "UART.h"


unsigned char channel;

unsigned char ADCReadComplete = 0;
unsigned char Temp;
unsigned short Data[8];
unsigned char channel = 3;
void ReadADCCH(unsigned char ch)
{
    

    Temp = ADRESL;
	Temp |= (ADRESH<<8); 
	ADRESL = 0;
	ADRESH = 0;
	channel = ch;

	switch(ch)
	{
		case 0:
		case 1:
		case 2:
		case 3:
			TRISA = 1<<ch;
		break;
		case 4:
			TRISA = 1<<5;
		break;
		case 5:
			TRISE = 1;
		break;
		case 6:
			TRISE = 2;
		break;
		case 7:
			TRISE = 4;
		break;			
	}	
		
	ADCON1= 0xC0;
	ADCON0 = 0xC0 | ch<<3;	
	ADCON0 |= 0x01;			
	
	ADCON0 = 0xC5 | ch<<3;
    while((ADCON0 & 0x04) == 0x04);
    while(ADIF == 0);	
    Data[channel]  = ADRESL;
	Data[channel] |= (ADRESH<<8); 
}



extern unsigned short Counter;
unsigned char rxdata;
void main()
{
	unsigned char i;
    
	InitUART();
  
 	RB4 = 1; 

    while(1)
	{
		ReadADCCH(0);
		ReadADCCH(1);
		ReadADCCH(2);
		ReadADCCH(3);
		ReadADCCH(4);
		ReadADCCH(5);
		ReadADCCH(6);
		ReadADCCH(7);
	

		if(PIR1bits.RCIF != 0)
        {
            // Clear the interrupt flag
            PIR1bits.RCIF = 0;
            if(RCSTAbits.OERR == 1)
            {
                
                //
                // Clear Over run flag by clearing CREN
                // and enable again for reception
                //
                RCSTAbits.CREN = 0;
                RCSTAbits.CREN = 1;
            }
            rxdata = ReadUART();
            if(rxdata == '#')
            {

		    	for(i = 0; i < 8; i++)
		    	{
		    		PrintNumber3(Data[i]);
		    		Print((unsigned char*)" ");
		    	}	
		    	Print((unsigned char*)"\r\n");
		    }
        }   	
   		
	}
	
}


{/code}

The MATLAB program running on the PC will read the sensed values and plot the pressure distribution map. MATLAB has inbuilt serial port interface library function's, which can be used to open,close, set baud rate for serial port. The surf() 3d plot function in MATLAB is used to display the individual peaks. Each peak represents a pressure point/pressure sensor value. The MATLAB 3d plot,serial port code used is shown below,

{code}


s = serial('COM1');

set(s,'BaudRate',9600);
set(s,'DataBits',8);
set(s,'Parity','none');

fopen(s);

while 1

    try
        fprintf(s,'#');
    catch
        fclose(s);
    end

    try
    line = fgets(s)
    catch
        fclose(s);
    end
   
    try
    out = strread(line)
    catch
        fclose(s);
    end
    

    zsign(1) = 1-out(1)/1024;
    zsign(2) = 1-out(2)/1024;
    zsign(3) = 1-out(3)/1024;
    zsign(4) = 1-out(4)/1024;
    zsign(5) = 1-out(5)/1024;
    zsign(6) = 1-out(6)/1024;
    zsign(7) = 1-out(7)/1024;
    zsign(8) = 1-out(8)/1024;


    zsign
    
    

hold on
   
    
    [x,y] = meshgrid([-3:0.5:3]);
    z = exp(-x.^2-y.^2);

    surf(x+5,y+5,(z * 0));    
    surf(x+5,y+15,(z * 0));    
    surf(x+5,y+20,(z * 0));    
    surf(x+15,y+20,(z * 0));        
    
    
    
    surf(x+10,y+20,(z * zsign(1)));    

    surf(x+10,y+15,(z * zsign(2)));    

    surf(x+15,y+15,(z * zsign(3)));

    surf(x+5,y+10,(z * zsign(4)));

    surf(x+10,y+10,(z * zsign(5)));
  
    surf(x+15,y+10,(z * zsign(6)));

    surf(x+10,y+5,(z * zsign(7)));

    surf(x+15,y+5,(z* zsign(8)));
    
    
    
    hold off

    shading interp
    drawnow

    
    box off
    grid off
    axis off
    caxis([0 1])
    colorbar;
    axis([0 20 0 25 0 2]);

    

    display('f');
    cla
end




{/code}




About the Author

is the author of this blog and is an Embedded systems design engineer by profession & Founder @ Valetron Systems Pvt Ltd


Email:This email address is being protected from spambots. You need JavaScript enabled to view it.

Find us on Google+

HIRE ME FOR YOUR PROJECT AS A FREELANCER

 

EasyEDA: Free Circuit Design Software

  • Easy Schematic Capture
  • Powerful Circuit Simulation
  • Online PCB design

Design Your Circuit and PCB here:

https://easyeda.com/editor

Cheap PCB Manufacturing

Electronic Components Online Store