Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect values #5

Open
ShuffleBit opened this issue Aug 19, 2020 · 0 comments
Open

Incorrect values #5

ShuffleBit opened this issue Aug 19, 2020 · 0 comments

Comments

@ShuffleBit
Copy link

ShuffleBit commented Aug 19, 2020

Arduino 1.8.13, all libraries and boards up to date.

The hardware, ESP8266 (Wemos D1 Mini R1) running at 80MHz, hardware SPI to MCP3208, 3.415V VDD/VREF. There is a 470uF cap between the VDD/VREF, and ground, plus another 100pF cap in parallel with that. VDD is flat/quiet on an oscilliscope.

Constructor is MCP3208(3415, 0) // VREF, CS_PIN
SPI clock is set to 1.6MHz, MODE0, per examples.

Reading MCP3208::Channel::SINGLE_0, the value 4095 isn't returned by read() until pin 1 is at 4.000 VDC: above the VREF. Shorting pin 1 to pin 16 returns 3910.

I expected a return of 4095 when pin 1 reaches 3.415 VDC, same as the VREF.

The adc_sample.ino example, modified only for ADC_VREF and CS pin, behave the same way my own sketch behaves: 4095 is only returned by read after pin 1 reaches 4.000 V.

Shorting pin 1 to pin 15 (VREF), MCP3208::read() returns only 3915.

It looks like a genuine MCP3208, and it came from Mouser.

4.000V is suspiciously ... round but could just be chance. I haven't tried changing SPI clock frequency.


All measurements are w/ Fluke 179, Rigol scope, and BK bench supply, though VDD is off the 3v3 pin of the ESP8266 (hence the additional filter caps).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant