Grumpy_Mike:
That is a very bad idea.
Simplifying wiring is not sufficient reasion.
To me it's an inelegant solution, but Mike is there a real technical reason for not doing this? (....always assuming the current's within limits in the first place, of course.)
Another feature of the DS18B20 is the ability to operate without an external power supply. Power is
instead supplied through the 1-Wire pullup resistor via the DQ pin when the bus is high. The high bus
signal also charges an internal capacitor (CPP), which then supplies power to the device when the bus is
low. This method of deriving power from the 1-Wire bus is referred to as “parasite power.” As an
alternative, the DS18B20 may also be powered by an external supply on VDD
Grumpy_Mike:
That is a very bad idea.
Simplifying wiring is not sufficient reasion.
Assuming you don't exceed limits, how is this really different than using the microcontroller as an LED driver? As an LED driver, the microcontroller acts as a power supply with at least one and sometimes both of VCC and GND.
I agree this is odd with an ATMega, though, unless you are trying to power-up and power-down (perhaps for power saving) an external low-power IC. Then I would say it makes a lot of sense.
I have seen some other microcontrollers with built-in regulators where the manufacturer specifically provides regulated power to a dedicated pin so the end-user can pull power off the microcontroller in order to simply the BOM by eliminating the need for a separate external regulator. Of course the manufacturer describe the limits of that regulator in the datasheet. This is a different scenario, but I wanted to mention it.
JimboZA:
is there a real technical reason for not doing this?
If everything goes perfectly? No.
But the world is imperfect. What if there's a bug in your program, or you upload the wrong sketch...?
Sounds like user error, like wiring a chip's power backwards. It happens. Get a new chip. Or maybe include diodes if the voltage drops don't cause a problem.
A potential problem is the voltage drop. AVR pins effectively have an internal resistance. For example, at 15mA the voltage will be about 4.6V. At 20mA the voltage will be below 4.5V. For some things the lower voltage could cause problems. For the DS18B20 the slightly lower voltage will not make a difference.
Grumpy_Mike:
That is a very bad idea.
Simplifying wiring is not sufficient reasion.
To me it's an inelegant solution, but Mike is there a real technical reason for not doing this? (....always assuming the current's within limits in the first place, of course.)
Yes Coding Badlly has the main reasion. Look at the data sheet and you will see that the output voltage at even 20mA can drop quite a lot.
Then you will want to put decoupling caps on the sensors, that will mean the output current is exceeded every time it is switched on. Also the high output impedance of the supply could upset the sensors.
Finally the system is that bit more unreliable and prone to fail as you have an extra component ( the output transistor ) that is a potential point of failure.
So to the "other side of the battery": I have some Arduino pins 2,54 mm away from the DS18B20 cable. Any objection to use this as GND with OUTPUT / digitalWrite(3, LOW); beside a higher risk in case you make mistakes? Why it is "a very bad idea"?
Using the “parasite power” method derives power from VDD, but it's passed through the pullup resistor. As such, there will be no loading on the Arduino pin when HIGH. If there is a slight voltage drop, it would be due to the DS18B20 deriving power from this wire.
EDIT: For controlling the Arduino pin for 1-wire communication, I don't think it should even go logic HIGH (isn't it 3-state or high-impedance as in I2C?).
The grounds are just connected together as normally done. Should be no issues here either.
In summary, my answer to the question "Can I use normal pins as Vcc or GND?" would be "Its not applicable and not advisable to do this".
Simplify wiring is not a good idea at all. You should use proper VCC or GND pins as those are high-power stuff. (those add up quickly.)
If you are controlling power to an device you should use a MOSFET to handle the power. Look into International Rectifier's portfolio for common high power MOSFETs that can be driven by Arduino's digital outputs, and for smaller power usage, the NXP PMV48XP (a logic level P-channel MOSFET with 50 milliohm Rdson, SOT-23 package) is a good option.
@technix, you need to have a word with your SSL provider...
This Connection is Untrusted
You have asked Firefox to connect securely to en.maxchan.info, but we can't confirm that your connection is secure.
Normally, when you try to connect securely, sites will present trusted identification to prove that you are going to the right place. However, this site's identity can't be verified.
What Should I Do?
If you usually connect to this site without problems, this error could mean that someone is trying to impersonate the site, and you shouldn't continue.
en.maxchan.info uses an invalid security certificate. The certificate is not trusted because no issuer chain was provided. (Error code: sec_error_unknown_issuer)
I don't have the money to buy a proper SSL certificate so I used an CACert one, but I need HTTPS for technical reasons. If you can donate me money for one wildcard certificate I would be grateful and fix this immediately.