Deutsch English Français Italiano |
<m1h6h0987g.fsf@void.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!weretis.net!feeder6.news.weretis.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!nnrp.usenet.blueworldhosting.com!.POSTED!not-for-mail From: Richard Smith <null@void.com> Newsgroups: rec.crafts.metalworking Subject: Re: Arduino + MCP9600 + thermocouple help needed Date: Wed, 20 Mar 2024 16:30:43 +0000 Organization: BWH Usenet Archive (https://usenet.blueworldhosting.com) Message-ID: <m1h6h0987g.fsf@void.com> References: <m1v85j8ast.fsf@void.com> <utai8d$e7ee$1@dont-email.me> <utanb3$f5i9$1@dont-email.me> <m1ttl3qahq.fsf@void.com> <utb2r3$l04f$1@dont-email.me> <m134smjy0e.fsf@void.com> <ute49n$1ci6f$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain Injection-Info: nnrp.usenet.blueworldhosting.com; logging-data="37907"; mail-complaints-to="usenet@blueworldhosting.com" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:5o4oMjqjbvEL1WI+6b68jjUtwbo= sha1:lXDwgJzqd2OfjojbjcDvyN8bVzQ= sha256:LRtfxf9GlCW2J0YyPixyQnWqhRD96CJUj642+pmz2cM= sha1:rL/EEqBxNdVvHOM51wLI8Yc6jU8= sha256:E7wIpoEXGvH+bqKbQaRwp3ZdvPVadUB+wR++9D0y3+w= Bytes: 8443 Lines: 131 no@no.no (James Waldby) writes: > 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/> Hi James, everyone Thanks for the ideas in your reply. Do thing of copying the example code then adding features. eg. "blink" -> flashes-out morse code with LED on "breadboard" At least got that far. Addresses hint re. Arduino I2C to breakout board great. Maybe accept crawl before tray to walk - do simpler code just to see if can get the I2C connection going - forget trying to read the thermocouple yet? Thinking of the idea of trying the addresses. Rich S