Re: Arduino + MCP9600 + thermocouple help needed

Liste des GroupesRevenir à rc metalworking 
Sujet : Re: Arduino + MCP9600 + thermocouple help needed
De : muratlanne (at) *nospam* gmail.com (Jim Wilkins)
Groupes : rec.crafts.metalworking
Date : 20. Mar 2024, 12:41:52
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <utei2u$1fe57$1@dont-email.me>
References : 1 2 3 4 5 6 7
User-Agent : Microsoft Windows Live Mail 16.4.3505.912
"James Waldby"  wrote in message news:ute49n$1ci6f$1@dont-email.me...
Richard Smith <null@void.com> wrote:
"Jim Wilkins" <muratlanne@gmail.com> writes:
"Richard Smith"  wrote in message news:m1ttl3qahq.fsf@void.com...
>
"Second picture is where commented-out "pinMode(2,
INPUT_PULLUP);". Initially LED lighting randomly when button not
pressed. Then added in the circuit the "pull-up" resistor connected to
on-board supply voltage and the circuit behaved like the first
circuit."
The webpage pictures and your problem descriptions aren't clear enough
or specific enough for definitive help.  Explicit wiring diagrams and
complete code listings are needed, as well as context like Arduino
IDE version number.  <https://arduino.stackexchange.com> may be of
help if you can fully explain what you wired up and give a
minimum-working-example for the problem,
I suggest that when getting started, you first navigate to the Blink
sketch (run Arduino, then File / Examples / Basics / Blink) and
compile it and download it.  Then, to verify you are able to make and
install program changes, copy it to a directory of your own with a new
name, eg Blink2, and try a few simple changes, like substituting 13 in
place of LED_BUILTIN, or 400 in place of 1000, etc. and download
again.  If you want to try an external LED, connect it to some other
IO pin (not D13) with eg a 2K resistor, put that IO number into your
Blink2, test it, etc.
Then, if you are working with a program like DigitalInputPullup,
connect a switch between an IO pin and Gnd, say D2 and ground, per
.png-image schematics in examples/02.Digital/DigitalInputPullup .
When you download the program to the Uno and it starts running,
setup() will be called, which will set up serial IO and pinModes for
D2 and D13.  The pinMode(2, INPUT_PULLUP) statement places D2 into
input mode with a pullup resistor to V+ (say 5V).  That is, if D2 is
in the INPUT_PULLUP state, an internal resistor like 35K ohms (RPU min
20K, max 50K per spec sheet) is connected between V+ and D2, which
means that if you leave D2 open, D2 will sit at V+; or if you connect
D2 to ground, after transients settle (~1us) D2 will sit at 0V, and
some number of uA, eg 5/35000 A ~ 143 uA, will flow through the pullup
resistor.  You can measure that current by hooking an ammeter between
the pin and ground if you want to calculate pullup resistance.  If the
current's really high or is zero the pin's not in INPUT_PULLUP mode.
If you have an external pullup and turn on INPUT_PULLUP, the effective
pullup resistance is the two resistors in parallel.  If your external
resistor is a pulldown (connected to Gnd instead of V+) the open-pin
voltage [open aside from pull resistors] will be that of a resistor
divider, instead of 0 or V+.
Re the I2C problem with your MCP9600 breakout board - Again, wiring
diagrams and code listings are needed for diagnosis.  One comment: You
could write an if statement to try both addresses, 0x66 and 0x67,
mentioned in the Pimoroni page, or a loop to try the whole range
0x60-0x67, proceeding ahead when a ready-test succeeds.  Or, for
simpler programming you could make a program with one address,
download and test it, then change it for each possible address until
successful.  The I2C fails I've seen were due to wrong addresses,
miswiring, bad chips, or in one case wires longer than a few feet.

Unconnected inputs are sensitive antennas that pick up secret messages
from space, or noise from fluorescent lights and radio/TV
transmitters. Some even float to a middle level where they partly turn
on both the input high and input low circuits, causing oscillation or
higher power consumption. They are all best made high or low if not
used. [...]
Setting an open IO to low or high output like that is one approach,
but on the Arduino Uno a simpler / less risky approach is to set
pinMode to INPUT_PULLUP.  Note, ATmega328P microcontroller chip
hardware as on an Uno sets all IO pins to INPUT during Reset, but boot
firmware changes the modes of some pins like D0, D1, D13 as per eg
<https://forum.arduino.cc/t/behavior-of-pins-during-reset-state/640285/12>

It is a bit of a thought that I would need an oscilloscope to
proceed much further.
One can do a lot with indicator LEDs attached to several outputs.  You
can connect a resistor in series with an LED between an IO pin and
ground or 5V.  Eg, a 3.5V LED with a 1.5K resistor will draw 1 mA,
either when the pin is low if series is between 5V and pin, or when
the pin is high if series is between Gnd and pin. ( 0.001 A =
(5V-3.5V)/1500 ohms.)  Or, because modern LEDs light up ok (visible
but not annoyingly bright) with a few microamps, you can connect an
LED between an IO pin and Gnd; turn it on with perhaps 43 uA, ie
(5V-3.5V)/35000 ohms, when you set pinMode to INPUT_PULLUP; turn it
off by setting pinMode to INPUT.  Note, outputting debug data via the
serial port also is easy to do with Arduino.
If you are uncertain how much electronics work you'll do, or have to
really economize, an item like <https://www.amazon.com/dp/B0C6XPVLPZ>
($37) would get you at least basic scope function, making it possible
to see switch bounce, PWM sequences, and other low frequency stuff.
For a hundred or two more, you can get a 50MHz 2 channel scope like
previously mentioned, a big step up.  If you're into micros for the
long term, go ahead and get a medium cost 4 channel 100MHz or 200MHz
scope, somewhere between $300 and $800.  Scopes in that range often
have an input to accept data from optional add-on logic analyzer
modules, adding 8 or more 0-1 inputs, and often have builtin protocol
analyzers.  Eg, besides displaying an I2C waveform they show its data
content as text on the screen.

I have seen videos of them used to diagnose even what is happening
when you push a push-button - all sorts of noise!  With the
oscilloscope showing very clearly.
It's mostly switch bounce, not noise.  On some switches bounce will be
over within just a few milliseconds (ms), on others it can be dozens
of ms.  With search terms = arduino debounce, you can find code
examples plus simple switch or switch+resistor circuits, and may also
see pages like below with more-complex Schmitt trigger hardware
debounce, or with low-pass filters, which in some cases are truely
awful, amazingly bad.  Following link explains bounce problem and
shows hardware and software debouncing with detailed code notes.
<https://www.circuitbasics.com/how-to-use-switch-debouncing-on-the-arduino/>
--------------------------
Thanks, I'm glad someone whose Arduino experience is less archaic than mine has jumped in. I think in hardware terms, voltage and current,  and should have clarified that INPUT_PULLUP is sufficient to make the pin high.
The $23 one-channel DSO211 oscilloscope I have doesn't seem available and wouldn't capture both I2C signals so I didn't suggest it. I bought it for signals whose return can't be grounded.
IIRC the Arduino needed a separate terminal to talk to the user, the IDE didn't provide that function. Does it now?
The simplest switch debouncer I've seen and used is a spare buffer or noninverting gate(s) with a feedback resistor from output to input that makes it retain its logic level until the switch on its input yanks it to the other one. The switch needs to be double throw, connected to both power and ground, the resistor limits gate output current. In the days of hardwired logic there were almost always spare gates available.

Date Sujet#  Auteur
18 Mar 24 * Arduino + MCP9600 + thermocouple help needed44Richard Smith
19 Mar 24 +* Re: Arduino + MCP9600 + thermocouple help needed41Jim Wilkins
19 Mar 24 i`* Re: Arduino + MCP9600 + thermocouple help needed40Jim Wilkins
19 Mar 24 i +* Re: Arduino + MCP9600 + thermocouple help needed38Richard Smith
19 Mar 24 i i+* Re: Arduino + MCP9600 + thermocouple help needed8David Billington
19 Mar 24 i ii`* Re: Arduino + MCP9600 + thermocouple help needed7Richard Smith
20 Mar 24 i ii +* Re: Arduino + MCP9600 + thermocouple help needed5Jim Wilkins
20 Mar 24 i ii i`* Re: Arduino + MCP9600 + thermocouple help needed4Richard Smith
20 Mar 24 i ii i +- Re: Arduino + MCP9600 + thermocouple help needed1Jim Wilkins
20 Mar 24 i ii i +- Re: Arduino + MCP9600 + thermocouple help needed1Jim Wilkins
20 Mar 24 i ii i `- Re: Arduino + MCP9600 + thermocouple help needed1Clare Snyder
20 Mar 24 i ii `- Re: Arduino + MCP9600 + thermocouple help needed1Jim Wilkins
19 Mar 24 i i`* Re: Arduino + MCP9600 + thermocouple help needed29Jim Wilkins
19 Mar 24 i i `* Re: Arduino + MCP9600 + thermocouple help needed28Richard Smith
19 Mar 24 i i  +* Re: Arduino + MCP9600 + thermocouple help needed13Jim Wilkins
19 Mar 24 i i  i`* Re: Arduino + MCP9600 + thermocouple help needed12Leon Fisk
19 Mar 24 i i  i +* Re: Arduino + MCP9600 + thermocouple help needed8Jim Wilkins
19 Mar 24 i i  i i`* Re: Arduino + MCP9600 + thermocouple help needed7Leon Fisk
19 Mar 24 i i  i i +* Re: Arduino + MCP9600 + thermocouple help needed5Jim Wilkins
19 Mar 24 i i  i i i`* Re: Arduino + MCP9600 + thermocouple help needed4Leon Fisk
19 Mar 24 i i  i i i `* Re: Arduino + MCP9600 + thermocouple help needed3Jim Wilkins
20 Mar 24 i i  i i i  `* Re: Arduino + MCP9600 + thermocouple help needed2Leon Fisk
20 Mar 24 i i  i i i   `- Re: Arduino + MCP9600 + thermocouple help needed1Clare Snyder
20 Mar 24 i i  i i `- Re: Arduino + MCP9600 + thermocouple help needed1Clare Snyder
20 Mar 24 i i  i `* Re: Arduino + MCP9600 + thermocouple help needed3Clare Snyder
20 Mar 24 i i  i  `* Re: Arduino + MCP9600 + thermocouple help needed2Leon Fisk
21 Mar 24 i i  i   `- Re: Arduino + MCP9600 + thermocouple help needed1Clare Snyder
19 Mar 24 i i  +- Re: Arduino + MCP9600 + thermocouple help needed1Jim Wilkins
20 Mar 24 i i  `* Re: Arduino + MCP9600 + thermocouple help needed13James Waldby
20 Mar 24 i i   +* Re: Arduino + MCP9600 + thermocouple help needed5Jim Wilkins
21 Mar 24 i i   i`* Re: Arduino + MCP9600 + thermocouple help needed4James Waldby
21 Mar 24 i i   i +- Re: Arduino + MCP9600 + thermocouple help needed1Jim Wilkins
21 Mar 24 i i   i `* Re: Arduino + MCP9600 + thermocouple help needed2Jim Wilkins
22 Mar 24 i i   i  `- Re: Arduino + MCP9600 + thermocouple help needed1Leon Fisk
20 Mar 24 i i   +* Re: Arduino + MCP9600 + thermocouple help needed3Richard Smith
20 Mar 24 i i   i+- Re: Arduino + MCP9600 + thermocouple help needed1Clare Snyder
21 Mar 24 i i   i`- Re: Arduino + MCP9600 + thermocouple help needed1Jim Wilkins
20 Mar 24 i i   `* Re: Arduino + MCP9600 + thermocouple help needed4Clare Snyder
21 Mar 24 i i    `* Re: Arduino + MCP9600 + thermocouple help needed3James Waldby
21 Mar 24 i i     `* Re: Arduino + MCP9600 + thermocouple help needed2Jim Wilkins
22 Mar 24 i i      `- Re: Arduino + MCP9600 + thermocouple help needed1Richard Smith
19 Mar 24 i `- Re: Arduino + MCP9600 + thermocouple help needed1Jim Wilkins
19 Mar 24 `* Re: Arduino + MCP9600 + thermocouple help needed2Jim Wilkins
19 Mar 24  `- Re: Arduino + MCP9600 + thermocouple help needed1Richard Smith

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal