Pushek Madaan
Published

Analog Pressure Sensor

A 0-15 psi analog pressure sensor made using the PSoC Analog Coprocessor and TE's pressure sensor.

BeginnerFull instructions provided1,932
Analog Pressure Sensor

Things used in this project

Hardware components

PSoC Analog Coprocessor Pioneer Kit
Cypress PSoC Analog Coprocessor Pioneer Kit
×1
TE 1210 Analog Pressure Sensor 0-15Psi
×1

Software apps and online services

PSoC Creator
Cypress PSoC Creator

Story

Read more

Schematics

project datasheet

Code

PSoC Analog Pressure Sensor Project (PSoC Creator)

C/C++
No preview (download only).

Firmware

C/C++
#include <project.h>

/* Constants */
#define     CHANNEL_ID      0
#define     MVOLTS_TO_PSI   60.867

/* System variables */
struct SystemVars{
    uint16 ADC_Value;
    float Pressure_Value;
}MyBuffer;

/* Initialize system resources */
void InitializeSystem(void)
{
    /* Enable programmable reference and Opamp to generate 
       0.45mA excitation current */
    PVref_Start();
    PVref_Enable();
    V_TO_I_Start();
    
    /* Enable the differential amplifier */
    DiffAmp_1_Start();
    DiffAmp_2_Start();
    
    /* Start ADC and enable conversion*/
    ADC_Start();
    ADC_StartConvert();
        
    /* Enable I2C for debugging */
    EZI2C_Start();
    EZI2C_EzI2CSetBuffer1(sizeof(MyBuffer), sizeof(MyBuffer), (uint8 *) &MyBuffer);
}

int main()
{ 
    /* Enable global interrupts. */
    CyGlobalIntEnable; 
    
    /* Initialize system resources */
    InitializeSystem();

    for(;;)
    {
        /* Wait for ADC sample to complete */
        ADC_IsEndConversion(ADC_WAIT_FOR_RESULT);
        
        /* Read ADC value in milliVolts */
        MyBuffer.ADC_Value = ADC_CountsTo_mVolts(CHANNEL_ID, ADC_GetResult16(CHANNEL_ID)); 
        
        /* Convert ADC value to pressure value */
        MyBuffer.Pressure_Value = (float) (MyBuffer.ADC_Value/MVOLTS_TO_PSI);
    }
}

/* [] END OF FILE */

Credits

Pushek Madaan

Pushek Madaan

2 projects • 7 followers
I like to checkout new technology, work on new products, design solutions and define products...

Comments