- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a sensor that outputs a voltage between 0 and 3V. When I use Delta Sigma, the reading from my PSoC is compared with a volt meter. The result is not the same as the volt meter, it may be off by 5-10 mV some times, but I just want to prove the concept, and I'm just glad that it has some reading.
However, when I remove the sensor, the reading still says 200mV instead of zero. What am I doing wrong?
Here is the code snippet of the sensor reading function:
void handleRead(uint8 *buf, uint8 len) {
int16 adcResult = 0;
int16 mVolts = 0;
if(ADC_IsEndConversion(ADC_RETURN_STATUS) != 0) {
adcResult = ADC_GetResult16();
if (((int16)adcResult) < 0) {
adcResult = 0u;
} else if (((int16)adcResult) > 16383) {
adcResult = 16383;
}
mVolts = ADC_CountsTo_mVolts(adcResult);
printf("sensor read: %d\n", mVolts);
}
memcpy(buf, &mVolts, len);
}
- Labels:
-
PSoC 5LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The ADC input is configured to be one of the GPIO pins, which is connected to the input voltage of the sensor when present.
Should I short the GPIO pin to ground to see what voltage it reads?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The pin is high-z, this will allow for any voltage when left open. Set to a defined level between GND and Vdda. Use a porentiometer to check the ADC.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Do we need a potentiometer to measure the output voltage of a sensor? How about a 10k resistor between the ADC pin and ground?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No you don't need a potentiometer to measure the sensor output voltage. But in order to test the zero voltage when the sensor is removed the input must be connected to ground voltage, and in order to test the performance of the ADC a potentiometer is very useful.
A 10k between the ADC pin and ground will make the voltage 0 when the sensor is removed, but it will also load the sensor output a little, and lower the signal a fraction. Probably not a noticeable fraction unless your sensor is very precise and stable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
"Do we need a potentiometer to measure the output voltage of a sensor?" No, but you can simulate a sensor with a poti.
"How about a 10k resistor between the ADC pin and ground?" Will connect the pin to GND.
Bob