NodeMCU with MCP3208 - Correct Components?

Hi Guys,

I've got a NodeMCU running with a MCP3208, all channels are working and I can get valid readings (thought i'm struggling with it being linear and stable/noisey). Could someone check the diagram below to see if this is corect based on what I've read in the datasheet?

I've managed to get rid of noisey results by using running average, this makes it pretty smooth how-ever results are definitely not linear. This may be an issue that I'm running into due to amount of bits I have to use within X voltage range.

I've seen a few posts not related to Arduino use case, that you should have a resistor somewhere on the MCP3208, though I cannot figure out where.

Cheers,

Nice Drawing that tells a lot. I have a feeling the regulator is running warm. You have no bypass capacitors on it which the data sheet requires. Also no decoupling o the chips, a big No-No. I can understand why all the noise problems. I assume VCC at the bottom of the ripple is at least 7 volts.

Always add a low ESR ceramic 100nF capacitor as close as possible on the input to GND of a 7805.

gilshultz:
Nice Drawing that tells a lot. I have a feeling the regulator is running warm. You have no bypass capacitors on it which the data sheet requires. Also no decoupling o the chips, a big No-No. I can understand why all the noise problems. I assume VCC at the bottom of the ripple is at least 7 volts.

yeah the LMN7805 was running really hot, I added another one just for the MCP3208 VCC and AREF as a test, i think it is more stable/consistant now.
For the Bypass Caps on the LM units, isnt that C1 and C3 on the diagram?
For the Decoupling Caps on the chip, do you mean for the NodeMCU and MCP3208? If so, is that just the process of adding a Cap between Vin and GND pins on the NodeMCU and on betweem MCP VDD and AGND?

larryd:
Always add a low ESR ceramic 100nF capacitor as close as possible on the input to GND of a 7805.

For the LM I'm using 100uF 35VDC Low ESR Electrolytic Capacitor, I also have the following units available 10uF 16VDC Tantalum Capacitor or 100nF 50VDC Ceramic Capacitors. Which would be best?
100uF 35VDC Low ESR Electrolytic Capacitor
https://www.jaycar.com.au/100uf-35vdc-low-esr-electrolytic-capacitor/p/RE6334?pos=2&queryId=86dbcde3aa920751d53655ebb00820f9&sort=relevance
10uF 16VDC Tantalum Capacitor
https://www.jaycar.com.au/10uf-16vdc-tantalum-capacitor/p/RZ6648?pos=6&queryId=89a847825f7c49db004ba38a8cd2537e&sort=relevance
100nF 50VDC Ceramic Capacitors
https://www.jaycar.com.au/100nf-50vdc-ceramic-capacitors-pack-of-2/p/RC5360?pos=1&queryId=63fa4154f09a7226999056f7c4eb1684&sort=relevance

Is it right that electrolytics capacitors are best for smoothing and reducing ripples? Should they be used on input and output of LM units?

For accurate info on decoupling the 7805 why not refer to the first page of the data sheet?

Nice schematic @hksmonaro - what did you use to draw it?

Re issues - the 7805 should not get hot, but you dont say what the value of Vcc is?

Noise - check the layout of your analog and digital grounds, the connection shown on the schematic is not good.

LM340, LM340A and LM7805 Family Wide VIN 1.5-A Fixed Voltage Regulators datashee.png

LM340, LM340A and LM7805 Family Wide VIN 1.5-A Fixed Voltage Regulators datashee.png

Well I’ll be damned, i always thought the LM data sheet just said the size of capacitor and not a type lol :frowning: ceramic it is!

Regarding the AGND and DGND connections, how should it be done/improved?

Vcc is 12v, just using regulators for easy of testing now. Have an LM for the NodeMCU an one just for AREF of the MCP has helped

Diagram is done in easyeda

As per post #2.

The NodeMCU uses almost all the power, the MCP3208 very little.
Powering a 3.3volt processor that draws about 100mA (with 400mA transmit peaks) with a linear regulator from 12volt is not very wise.
Better use a 5volt cellphone charger, connected to the USB socket of the NodeMCU.
or, if you must use 12volt, then use a 5volt buck converter connected to the 5volt/USB pin of the NodeMCU.

Powering the MCP3208 from 5volt is wrong.
The NodeMCU uses 3.3volt logic, so the MCP must also be powered from 3.3volt.

What are you measuring.
Connecting Aref of the MCP3208 to VCC makes it ratiometric.
Perfect for ratiometric sensors, but 'voltage' measurement will be unstable.
Leo..

larryd:
As per post #2.

Sorry what do mean, addressing which query?

Well I'll be damned, i always thought the LM data sheet just said the size of capacitor and not a type lol :frowning: ceramic it is!

Post 2 said “. . . low ESR ceramic 100nF capacitor . . .”

Wawa:
The NodeMCU uses almost all the power, the MCP3208 very little.
Powering a 3.3volt processor that draws about 100mA (with 400mA transmit peaks) with a linear regulator from 12volt is not very wise.
Better use a 5volt cellphone charger, connected to the USB socket of the NodeMCU.
or, if you must use 12volt, then use a 5volt buck converter connected to the 5volt/USB pin of the NodeMCU.

Powering the MCP3208 from 5volt is wrong.
The NodeMCU uses 3.3volt logic, so the MCP must also be powered from 3.3volt.

What are you measuring.
Connecting Aref of the MCP3208 to VCC makes it ratiometric.
Perfect for ratiometric sensors, but 'voltage' measurement will be unstable.
Leo..

yeah i wont be using a LM for final setup, just nice and easy at the moment for testing.

I didnt realise that you cannot power the MCP3208 with 5v VCC and AREF if nodeMCU is a 3.3v logic, damn.

For AREF though, how do you provide a better stable voltage and avoid 'ratiometric', just have its own seperate path to a stable 5v source or?

Diagram is done in easyeda

Thanks, I'll have another look at that - I didnt find it easy though!

Regarding the AGND and DGND connections, how should it be done/improved?

I've done a simple diagram. You have not shown where the voltage being measured is coming from.
You need to ensure that parts that draw current (eg the arduino) dont affect the voltages due to track or connector resistance.

The best way to do this is
1: keep analog and digital grounds seperate and only connect at a "star point"
2: decouple with appropriate size (and type) capacitors.

In your case the ADC has seperate connections AGND and DGND

In the top fig all the currents flowing will disturb the voltage read by the ADC
In the bottom fig a capacitor supplies when needed some of the current to the changing load; and grounds are kept seperate to avoid this affecting the ADC reading.

hksmonaro:
For AREF though, how do you provide a better stable voltage and avoid 'ratiometric', just have its own seperate path to a stable 5v source or?

Again, "what are you measuring".

You can connect a reference voltage to the Aref pin of the MCP3208, but it must be <= than VCC of the chip.

You can of course run the chip on 5volt, but then you must level-convert all connections to the NodeMCU.

Could be easier to use voltage dividers on the inputs, but that can't be answered until we know what you're measuring.
Leo..

Edit: Saw in your post history that you were trying to measure a battery stack with an ADS1115.
Much better choice for voltage measurements IMHO.
Just need to learn how to not blow things up :slight_smile:

Wawa:
Again, "what are you measuring".

You can connect a reference voltage to the Aref pin of the MCP3208, but it must be <= than VCC of the chip.

You can of course run the chip on 5volt, but then you must level-convert all connections to the NodeMCU.

Could be easier to use voltage dividers on the inputs, but that can't be answered until we know what you're measuring.
Leo..

Edit: Saw in your post history that you were trying to measure a battery stack with an ADS1115.
Much better choice for voltage measurements IMHO.
Just need to learn how to not blow things up :slight_smile:

haha yeah, thats the trick,,,, not destroying. I think Im avoiding that now but would like to see if I can get some results with an MCP3208.
So if I use 5v to power the arduino (not USB), then can I use the MCP3208 VDD with 5v or like someone said the NodeMCU is 3.3v logic so therefore MCP3208 maxium VDD and AREF is 3.3v?
I am measure out 7s lithium battery pack, biggest issue with using voltage dividers and 3.3v VDD and AREF is that the amount of resolution I have available is pretty small, so I'm getting really high mV per bit, the best I have got is approx 1.1 to 1.3v measure range using voltage dividers across all 7 battery series.

Not sure if I see the problem.
In theory, with a 7-cell LiPo battery stack and a (genuine) ADS1115 (15-bit single-ended), you can get a resolution of 32768/29.4volt = <= 1mV.
Should be more than enough.
Leo..

Wawa:
Not sure if I see the problem.
In theory, with a 7-cell LiPo battery stack and a (genuine) ADS1115 (15-bit single-ended), you can get a resolution of 32768/29.4volt = <= 1mV.
Should be more than enough.
Leo..

yeah Im talking MCP it is an issue, as its on 12-bits.

Another problem with the MCP for voltage measurements is that you must use a <3.3volt stable reference voltage,
like the TL431.

The ADS1115 has a built-in reference voltage.
Leo..

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.