Pages

Tuesday, May 07, 2013

MCP3201 conversion accuracy confirmed 0.2%













Now I have tidied up the messy wiring of the MCP3201 board, and then tested again, with the following conditions.

Vcc = 4.95V
Vref = 4.95V
Vin- = 0V
Vin+ = 2.37V

I tested 5 times to check if the output is stable.


Test 01 00001111 01011010
Test 02 00001111 01011000
Test 03 00001111 01011000
Test 04 00001111 01011010
Test 05 00001111 01010111

I found the worst case accuracy is 4 bits / 12 bits or 16/4096 == 0.4%, average is 3 bits or 8/4096 = 0.2%

Then I compared the converted output with the Excel worksheet which is 0x7a9 


Test 01 00001111 01011010
Test 02 00001111 01011000
Test 03 00001111 01011000
Test 04 00001111 01011010
Test 05 00001111 01010111
Excel      01111 0101001

Then I found that I made a mistake earlier, of miscounting the 12 digits to 13.  So the worst and average accuracy should be 3/4096 and 2/4096 == 0.2% and 0.04%.

And comparing to Excel, the accuracy is 3 bits, or 0.2%. 

In other words, retesting confirms MCP3201 accuracy as 3 bits out of 12, or 0.2%.



****************************************************************

$ sudo python fl2067.py

fl2067.py:268: RuntimeWarning: This channel is already in use, continuing anyway.  Use GPIO.setwarnings(False) to disable warnings.
  setupOutputPin = lambda oPin: GPIO.setup(oPin, GPIO.OUT) # set GPIO pin as output
fl2067.py:270: RuntimeWarning: This channel is already in use, continuing anyway.  Use GPIO.setwarnings(False) to disable warnings.
  setupInputPinWithPullUp = lambda iPin: GPIO.setup(iPin, GPIO.IN, pull_up_down=GPIO.PUD_UP) # set GPIO pin as input, with pull up

*** Start Program - MCP3201 ADC 01   ***


*** Start testing MCP3201 ADC ***

ADC output byte 1 =  00001111
ADC output byte 2 =  01011010

*** Stop testing MCP3201 ***


*** Stop Program ***

pi@raspberrypi ~/python_programs/test_guzuntypi $ sudo python fl2067.py

*** Start Program - MCP3201 ADC 01   ***


*** Start testing MCP3201 ADC ***

ADC output byte 1 =  00001111
ADC output byte 2 =  01011000

*** Stop testing MCP3201 ***


*** Stop Program ***

pi@raspberrypi ~/python_programs/test_guzuntypi $ sudo python fl2067.py/
python: can't open file 'fl2067.py/': [Errno 20] Not a directory
pi@raspberrypi ~/python_programs/test_guzuntypi $ sudo python fl2067.py

*** Start Program - MCP3201 ADC 01   ***


*** Start testing MCP3201 ADC ***

ADC output byte 1 =  00001111
ADC output byte 2 =  01011000

*** Stop testing MCP3201 ***


*** Stop Program ***

pi@raspberrypi ~/python_programs/test_guzuntypi $ sudo python fl2067.py

*** Start Program - MCP3201 ADC 01   ***


*** Start testing MCP3201 ADC ***

ADC output byte 1 =  00001111
ADC output byte 2 =  01011010

*** Stop testing MCP3201 ***


*** Stop Program ***

pi@raspberrypi ~/python_programs/test_guzuntypi $ sudo python fl2067.py

*** Start Program - MCP3201 ADC 01   ***


*** Start testing MCP3201 ADC ***

ADC output byte 1 =  00001111
ADC output byte 2 =  01010111

*** Stop testing MCP3201 ***


*** Stop Program ***

pi@raspberrypi ~/python_programs/test_guzuntypi $

.END



No comments:

Post a Comment