This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

EVM430-CAPMINI: Captivate MCU Best/Good Option for Capacitive 4-20mA sensor?

Part Number: EVM430-CAPMINI
Other Parts Discussed in Thread: MSP430FR2512, ENERGYTRACE

I want to make a 4-20mA loop powered picofard capacitance meter with adjust able offset (upto 100pF) with a full scale range adjustable up to probably upto 10pF. It looks like a MSP430FR2512 could handle most of this in one chip . When I generate the CCS project from the Captivate project the LED's don't light up when the buttons are pressed, which is fine if intended.

Does the generated CCS project only include the tuning for the captivate inputs but no the tone generation and LED control?

Is delta stored anywhere or is it calculated in the Captivate app?

(it took a while to find but this is how I got a similar reading - rawSensor = 1960-PRX00.pCycle[0]->pElements[0]->filterCount.ui16Natural;)

Will the timeout or prox detection in the generated project cause problems with continuous capacitive measurements - in the order of 24hrs+?

Worded another way;

If the update time is set to 50ms, will the generated code allow this without timing out or moving through the threshold?

In the CCS energy trace, I get a fairly high mean current of 4.1mA, is this expected?

Here is the sensor setup;

 

//*****************************************************************************
// CAPT_UserConfig.c
//
// \version 1.83.00.05
// Released on May 15, 2020
//
//*****************************************************************************

//*****************************************************************************
//
// NOTE: This is an automatically generated source code file!  The Captivate
// Design Center generates the User Configuration file automatically based
// upon the sensor layout that was created.
//
// Changes to this file will be OVERWRITTEN if a you select
// "Update Existing Project" under "Generate Source Code" in the Design Center.
//
// To avoid interference with the code generation process, keep ALL application
// code external to this file.
//
//*****************************************************************************

#include "CAPT_UserConfig.h"

//*****************************************************************************
//
//! Captivate Element Definitions
//! All elements in this application are defined below.
//! Each element has 3 components:
//!  1) a raw count array (One index per freq. scanned) (uint16_t)
//!  2) a tuning array (One index per freq. scanned) (tCaptivateElementTuning)
//!  3) a element structure (tElement)
//
//*****************************************************************************
// Sensor: PRX00, Element: E00
uint16_t PRX00_E00_RawCnts[CAPT_SELF_FREQ_CNT];
tCaptivateElementTuning PRX00_E00_Tuning[CAPT_SELF_FREQ_CNT];
tElement PRX00_E00 =
{
    .ui8RxPin = 0,
    .ui8RxBlock = 0,
    .ui8TouchThreshold = 60,
    .pRawCount = PRX00_E00_RawCnts,
    .pTuning = PRX00_E00_Tuning,
};


//*****************************************************************************
//
//! Captivate Time Cycle Definitions
//! All time cycles in this application are defined below.  Time cycles are
//! groups of elements that are measured together in parallel in one time slot.
//! Each cycle has 2 components:
//!  1) an element pointer array to the member elements (tElement*)
//!  2) a cycle structure (tCycle)
//
//*****************************************************************************
// Time Cycle: PRX00_C00
tElement* PRX00_C00_Elements[1] =
{
    &PRX00_E00,
};
tCycle PRX00_C00 =
{
    .ui8NrOfElements = 1,
    .pElements = PRX00_C00_Elements,
};


//*****************************************************************************
//
//! Captivate Sensor Definitions
//! All sensors in this application are defined below.  Sensors are
//! groups of time cycles that utilize raw measurement data to create an
//! abstract sensor type, such as a button, slider, wheel, or prox sensor.
//! Each sensor has 3 components:
//!  1) a cycle pointer array to the member time cycles (tCycle*)
//!  2) a sensor-specific parameter structure (tGenericSensorParams)
//!  3) a sensor structure (tSensor)
//
//*****************************************************************************
//Sensor: PRX00
const tCycle* PRX00_Cycles[1] =
{
    &PRX00_C00,
};

tProxSensorParams PRX00_Params =
{
    .pSensor = NULL,
    .ui8NumberOfSensors = 0,
};

tSensor PRX00 =
{
    // Basic Properties
    .TypeOfSensor = eProx,
    .SensingMethod = eSelf,
    .DirectionOfInterest = eDOIDown,
    .pvCallback = NULL,
    .ui8NrOfCycles = 1,
    .pCycle = PRX00_Cycles,
    .pSensorParams = (tGenericSensorParams*)&PRX00_Params,
    // Conversion Control Parameters
    .ui16ConversionCount = 2000,
    .ui16ConversionGain = 100,
    .ui8FreqDiv = 1,
    .ui8ChargeLength = 1,
    .ui8TransferLength = 1,
    .bModEnable = false,
    .ui8BiasControl = 3,
    .bCsDischarge = true,
    .bLpmControl = false,
    .ui8InputSyncControl = 0,
    .bTimerSyncControl = false,
    .bIdleState = true,
    // Tuning  Parameters
    .ui16ProxThreshold = 60,
    .ui16NegativeTouchThreshold = 30,
    .ui16ErrorThreshold = 8191,
    .ui16TimeoutThreshold = 65535,
    .ProxDbThreshold.DbIn = 1,
    .ProxDbThreshold.DbOut = 0,
    .TouchDbThreshold.DbIn = 1,
    .TouchDbThreshold.DbOut = 0,
    .bCountFilterEnable = true,
    .ui8CntBeta = 1,
    .bSensorHalt = false,
    .bPTSensorHalt = true,
    .bPTElementHalt = true,
    .ui8LTABeta = 7,
    .bReCalibrateEnable = true,
};


#if (CAPT_CONDUCTED_NOISE_IMMUNITY_ENABLE==true)
//*****************************************************************************
//
//! \var g_EMCConfig
//! This structure stores the EMC configuration for this application.
//
//*****************************************************************************
const tEMCConfig g_EMCConfig =
{
	// Conversion Style
	.selfModeConversionStyle = CAPT_SELF_MODE_CONVERSION_STYLE,
	.projModeConversionStyle = CAPT_PROJ_MODE_CONVERSION_STYLE,
	
	// Oversampling Style
	.selfModeOversamplingStyle = CAPT_SELF_MODE_OVERSAMPLING_STYLE,
	.projModeOversamplingStyle = CAPT_PROJ_MODE_OVERSAMPLING_STYLE,
	
	// Jitter Filter Enable
	.bJitterFilterEnable = true,
	
	// Noise Thresholds and Calibration Noise Limits
	.ui8NoiseThreshold = CAPT_NOISE_THRESHOLD,
	.ui16CalibrationNoiseLimit = CAPT_CALIBRATION_NOISE_LIMIT,
	.ui8CalibrationTestSampleSize = 8,
		
	// Dynamic Threshold Adjustment Parameters
	.bEnableDynamicThresholdAdjustment = CAPT_DYNAMIC_THRESHOLD_ADJUSTMENT,
	.ui8MaxRelThreshAdj = 76,
	.ui8NoiseLevelFilterEntryThresh = 40,
	.ui8NoiseLevelFilterExitThresh = 0,
	.ui8NoiseLevelFilterDown = 6,
	.ui8NoiseLevelFilterUp = 1,
	.coeffA = _IQ31(0.0065),
	.coeffB = _IQ31(0.050)
};
#endif

//*****************************************************************************
//
//! \var g_pCaptivateSensorArray
//! This array allows for indexed access to any
//! sensor in the configuration.
//
//*****************************************************************************
tSensor* g_pCaptivateSensorArray[CAPT_SENSOR_COUNT] =
{
    &PRX00,
};


//*****************************************************************************
//
//! \var g_uiApp
//! This structure stores the global settings for this application.
//
//*****************************************************************************
tCaptivateApplication g_uiApp =
{
    .state = eUIActive,
	.pSensorList = &g_pCaptivateSensorArray[0],
    .ui8NrOfSensors = CAPT_SENSOR_COUNT,
    .ui8AppLPM = CAPT_LOW_POWER_MODE,
    .bElementDataTxEnable = true,
    .bSensorDataTxEnable = true,
    .ui16ActiveModeScanPeriod = 50,
    .ui16WakeOnProxModeScanPeriod = 50,
    .ui16InactivityTimeout = 303,
    .ui8WakeupInterval = 7,
};


Thanks

  • Hi Rick,

    Keep in mind that the CapTIvate technology measure change in capacitance, not absolute capacitance, so if you are looking to detect a change of 10pf from a base capacitance of up to 100pF then you are on the right track.

    Does the generated CCS project only include the tuning for the captivate inputs but no the tone generation and LED control?

    No. A Captivate design center output project is a code framework that only runs the capacitive sensing with the sensor configuration you setup in the GUI.  Any additional functionality, LEDs, buzzer, etc., is code you will need to add to the application.  You can copy/paste much of what you need from the CAP-MINI example out-of-box.

    Is delta stored anywhere or is it calculated in the Captivate app?

    The delta is not stored.  It is updated at each measurement and is the difference between the element's LTA (long term average of the conversion counts) and filtered conversion count measurement.  Note, for self capacitance delta is LTA - filtered count; mutual is filtered count - LTA.  The 1960 you show in your calculation is the LTA and yes, you can use the raw as well, but filtered is better.  You can control the level or weight of the filter using the .ui8CntBeta setting in the sensor struct or set it in the GUI under the tuning tab > Count Filter Beta.  If you click on the hyperlinks in the GUI tuning tab there is a description on how all of this works.

    Will the timeout or prox detection in the generated project cause problems with continuous capacitive measurements - in the order of 24hrs+?
    If the update time is set to 50ms, will the generated code allow this without timing out or moving through the threshold?

    I'm not exactly sure what you are asking here, but if you are asking what happens if the sensor remains in detect (conversion count < (LTA - threshold) in self cap mode) for long periods of time, the LTA is halted during this time and changes in temperature are not tracked. There is a timeout setting that will force the system to re-calibrate the sensor, but I'm not sure you want to do that for this application.  Can you provide some more detail on how your application would operate in this mode?

    In the CCS energy trace, I get a fairly high mean current of 4.1mA, is this expected?

    Yes, if you are measuring the current while not connected to the GUI,  this is way too much.  The MCU @8MHz will consume ~300uA running 100%, but when measuring  at the default 33ms scan rate, the MCU is only active for a few milliseconds, then spends the rest of its time in a low power mode, so it is probably only consuming about 100uA or less.  If you are seeing mA current, you must be turning on an LED?

    You indicated you are using energyTrace and since the CAP-MINI doesn't have this I'm assuming you are using another MSP430 Launchpad.  Make sure you remove any jumper on J2 and connect the energyTrace 3.3 to the pin shown here.  You don't want to back-power the on-board 3.3v LDO or dump current into the battery (if installed). 

    Now, regarding your setup or sensor configuration (CAPT_UserConfig.c), I can see right away you will have some trouble with the .ui16ConversionCount = 2000.  Without getting into the nuts and bolts of how everything works, the .ui16ConversionCount (target conversion count) sets the sensitivity of the measurement.  The general rule of thumb is to try to get the required sensitivity using values up to 1000, else the system becomes too sensitive to system and environmental noise which causes false detects.  Now there is a way to help mitigate somewhat by raising the touch threshold above the noise margin.  See the MSP430 Captivate Sensitivity, SNR, and design margin tuning guide. But, raising the threshold means your sensor is now less sensitive, which defeats the purpose of trying to increase sensitivity. So if you need to use target conversion count values say in the range of 1500 or more, then you need to change something in the sensor design or mechanicals.  Either increase the size of the sensor or eliminate any parasitic capacitances on the sensor (ground traces, ground pours, other nearby conductive objects).

    Any additional information about this application would be helpful to understand exactly how you are wanting to use this technology.

  • Hi Dennis

    Thanks for clarifying those points. 

    I generated a CCS project from captivate. I debugged the base CCS project on the Capmini dev board. Thats why I was asking about the LEDs and tone generator, you answered that by confirming that only the sensing part of the project is converted into a CCS project. I am using a MSP-EXP430G2 as the programmer/debug interface to the RST/TST/3.3V/GND pins on the CapMini board. I used this connection to program and test the MSP430G2512 on the CapMini.

    The end application is as a capacitance transmitter, not a prox or push button. So it will be constantly sensing with no break for LTA calibration.

    Regarding the 4mA load, it dropped to 560uA  (mean) when I removed the RX/TX jumpers on the CapMini dev board, so thats all good now.

    I want to project the electric field out away from the sensing pad into the product being sensed, and the cross hatched grounding beside and below the pad seemed to work well on the CapMini. It seemed immune to  my hand coming near the product being sensed.

    Do you think much error will be generated if the circuit operates mostly at 70degC but down too 0degC if the LTA halted due to constantly measuring capacitance?

**Attention** This is a public forum