My first message in the Arduino community.
I started in the Arduino world a few days ago, and am running through the different projects proposed with the beginner kit.
This is fantastic to remember all the basics of electronics I learnt 10 years ago during my engineering studies. (I have been working in mechanical engineering since)
I am painfully trying to understand how the circuit can be closed (how the current flows) when some leds and resistance are linked on 1 side to the ground, and on the other side to the digital pins.
In my mind, the circuit is open...
I attached a screenshot of the circuit which puzzles me.
Would you be able to confirm how the current flows in there?
I appologize in advance if my question looks a bit stupid. I'm sure I am missing something very basic here.
higherinthesky:
My first message in the Arduino community.
Then a small tip, reread your post (and especially the title) before posting
The image:
And to answer, on the right a pin provides a voltage (when on) aka connects it to the positive of the supply which causes a current flow through the led and resistor to GND.
On the left, the sensor is just a device which needs power to work hence it has a GND and 5V connection. And it just outputs a voltage depending on the temperature.
Hello Septillion.
Sorry, I realized my mistakes when I sent it and I was unable to edit after.
I will be more carefull the next time.
Thanks for the explanation. I think I get it.
I tried to reformulate in the drawing attached.
Would you be able to confirm if I have the correct understanding?
In that version your LEDs and resistors are doing nothing, as they are all at ground potential.
You should try to always draw circuit diagrams the right way up, supply at the top,
ground at the bottom, current flowing down, signals passing left to right where possible.
This makes it much quicker and easier to read diagrams once you've got used to the
conventions.
thank you for the advice MarkT.
I was not taught this convention 10 years ago in France, but I understand what you mean!
Regarding this version, yes, the leds and resistors are inactive, because the circuit is open.
I created switches in an attempt to illustrate that the digital pins act a bit like a switch: they can be 0V or 5V depending on the signal.
Digital pins are switched to GND or Vcc using MOSFETs inside the device. The ATmega processors output
MOSFETs have about 30 to 40 ohms on-resistance, and are limited to an absolute maximum of 40mA
So they can power an LED or two, but not anything needing real power.
When a GPIO pin is set to output mode, you can either drive it "high" (ie: VCC), or "low" (GND). They can not, however, drive a negative voltage (ie: -VCC). If you want to create a negative voltage, you'd need some external GPIO expander chip sourced off some negative voltage supply, or you'd need to create a negative voltage rail source via a buck-boost converter or similar to generate it from Vcc.
Fortunately for you, Arduino already has a pieze-electric buzzer library, and wiring it up is dead simple. The relevant GPIO pin is connected to the buzzer's positive terminal, and the buzzers negative terminal is grounded.
That circuit is incorrect whether the switches are there or not. The anode of the led has to be connected to a power source (Battery in your case). Right now, you have it connected on the ground side of the temp sensor. If you were to take the single wire from all those led's and move it to the TOP side of the temp sensor, you would have a circuit.
You can also think of those switches as the I/O pins, but you would have to add another connection point, which would be ground, and that would be connected to the negative side of the battery. Then via programming, the "switch" could be 5V, Ground, or Floating (not open like you think) If the I/O were set to HI (5V), the led would light up. If set to LOW (Gnd), it would be off. The "floating" part of that switch comes in on inputs. Not going to get into that here, but just remember floating pins.
As for the temp sensor, you have VCC and VSS, but no data line hooked up, so it is working, but you won't be able to see it.