Qgelm

3.3 vs 5 » JeeLabs

Originalartikel

Backup

<html> <p>One of the decisions made early on for the <a href=„https://jeelabs.org/jn5.html“>JeeNode</a>, was to make it run at 3.3V, instead of the 5V used by the standard Arduino.</p> <p>The main reason for this was the RFM12B wireless module, which can only be used with supply voltages up to 3.8V, according to the specs. Running them at 5V seems to give varying results: I&#8217;ve never damaged one, but there have been reports of such failures. Given that the older RFM12 (no B) worked up to 5V, my hunch is that something in the design was found to give problems at the higher voltage. It&#8217;s just a guess on my part, though.</p> <p><em>So what&#8217;s the deal with 3.3V vs 5V?</em></p> <p>Well, the first thing to note, is that the ATmega328 used in a 3.3V JeeNode runs at the same 16 MHz frequency as a 5V Arduino does. This <a href=„http://en.wikipedia.org/wiki/Over-clocking“>overclocking</a> is &#8220;out of spec&#8221;:</p> <p><img src=„https://jeelabs.org/wp-content/uploads/flickr/3370/3296730347_e909707594_o.png“ alt=„“/></p> <p>You&#8217;re not <em>supposed</em> to do this, but in my experience the good folks at Atmel (the designers and manufacturers of ATmega&#8217;s and other goodies) have drawn up specifications which are clearly on the conservative side. So much so, that not a single case has been reported where this has caused problems in any of the several thousand JeeNodes produced so far. As I pointed out in a <a href=„https://jeelabs.org/2009/02/27/out-of-spec/index.html“>previous post</a>, that doesn&#8217;t necessarily mean everything is 100% perfect over the entire temperature range. But again: no known problems to date. None.</p> <p>This is good news for low-power uses, BTW. It means you can get the same amount of work done using less power, since power = voltage x current. Even more so because both voltage <em>and</em> current are lower at 3.3V than when running at 5V.</p> <p>A <em>second</em> reason for running at 3.3V, is that you can use 3 AA batteries instead of 4 (either alkaline or rechargeable). And that you can also power 3.3V circuits with LiPo packs, which have this hugely convenient 3.5..4.2V range.</p> <p>The <em>third</em> important reason to run JeeNodes at 3.3V, is that more and more neat sensor chips are only available for use in the 2.7 .. 3.6V range or so. By having the entire setup operate at 3.3V, all these sensors can be used without any tedious level converters.</p> <p>Occasionally I&#8217;ve been bitten by the fact that I used a chip which <em>doesn&#8217;t</em> work as low as 3.3V, as in the first <a href=„https://jeelabs.org/2009/09/20/clock-plug-v1/index.html“>RTC Plug</a> trial. But more often than not, it&#8217;s simply a matter of looking for alternative chip brands. One recent example was the <a href=„https://jeelabs.org/2010/10/10/generating-ir-pulses/index.html“>555 oscillator</a> used on the <a href=„https://jeelabs.org/ir1.html“>Infrared Plug</a>: the original NE555 needs at least 4.5V, but there&#8217;s an ICM7555 using CMOS technology which works down to 3V, making it a non-issue.</p> <p><strong>Mixing 3.3V and 5V devices</strong></p> <p>The trouble with these voltage differences, is not just that the power supply needs to be different. That&#8217;s the easy bit, since you can always generate 3.3V from a 5V supply with a simple voltage regulator and 2 little capacitors.</p> <p>The real problem comes from the I/O interface. Placing a 5V signal on a chip running at 3.3V will cause problems, in the worst case even permanently damaging the chip. So <em>each</em> I/O pin connected is also affected by this.</p> <p>Fortunately, there&#8217;s often a very simple workaround, using just an extra resistor of 1 k&#937; or so in <em>series</em>. To see how this works, here&#8217;s the way many chips have their input signals hooked up, internally:</p> <p><img src=„http://files.jeelabs.org/2010/12/screen_shot_2010_12_14_at_233516.png“ alt=„Screen Shot 2010 12 14 at 23.35.16“/></p> <p>There&#8217;s a pair of diodes inside the chip, <em>for each pin</em> (not just the inputs), used for <a href=„http://en.wikipedia.org/wiki/Electrostatic_discharge“>ESD</a> protection, i.e. to protect the chip against static electricity when you pick it up.</p> <p>These diodes &#8220;deflect&#8221; voltage levels which are above the VCC of the device or below GND level. They do nothing else in normal use, but if you were to place 5V on in a pin of such a device powered by 3.3V, then that would lead to a (potentially large) current through the upper diode.</p> <p>With electronics (as with humans, btw), it&#8217;s usually not the voltage itself which causes damage, but the current flow it leads to, and &#8211; in the case of sensitve electronics components &#8211; the heat produced from it.</p> <p>By placing a 1 k&#937; resistor in series, we limit the flow through the diode to under 2 mA, which most devices will handle without any problems:</p> <p><img src=„http://files.jeelabs.org/2010/12/screen_shot_2010_12_14_at_234227.png“ alt=„Screen Shot 2010 12 14 at 23.42.27“/></p> <p>Ok, so now we can hook up signals to a JeeNode, even if they swing in the 0..5V range. This works best with &#8220;slow&#8221; signals, BTW. The extra resistor has a bad effect on rise and fall times of the signal, so don&#8217;t expect this to work with signals which are in the 1 MHz range or higher. Then again, it&#8217;s unlikely you&#8217;ll need to tie such fast signals directly to an ATmega anyway&#8230;</p> <p><em>How about the other direction?</em></p> <p>What if you have a chip running at 5V which needs to receive signals from a chip running at 3.3V, i.e. signals going in the other direction?</p> <p>Well, it turns out that this <em>may or may not</em> work by simply tying the two lines together. The 3.3V output signal will definitely not damage a chip running at 5V. The worst that can happen, is that the 5V side doesn&#8217;t consider the signal valid.</p> <p>We need to look into logic levels to figure this one out, as specified in the datasheet of the chip. The easy part is <em>logic &#8220;0&#8221;</em>, i.e. a low level. Most chips consider anything between 0 and 0.8V a logic &#8220;low&#8221;. There will hardly ever be an issue when tying a 3.3V chip to a 5V chip.</p> <p>The tricky part is <em>logic &#8220;1&#8221;</em>, i.e. a signal which is intended to represent a high level. Now it all depends on what the 3.3V chip sends out, and what the 5V chip requires.</p> <p>Most CMOS chips, including the ATmega, send out nearly the full power line voltage to represent a logic &#8220;1&#8221; (when the load current is low), so you can expect output signals to be just about 3.3V on a JeeNode.</p> <p>On the input side, there are two common cases. Some chips consider everything above 1.6V or so to be a logic one. These chips will be perfectly happy with the JeeNode signal.</p> <p>The only case when things <em>may or may not</em> work reliably, is with chips which specify the minimum logic &#8220;1&#8221; voltage to be &#8220;0.7 x VCC&#8221; or something like that. On a 5V chip, that translates to a minimum value of 3.5V &#8230;</p> <p>Note that datasheets usually contain conservative specs, meant to indicate limit values under all temperatures, load conditions, supply voltages, etc.</p> <p>In practice, I find that even with &#8220;0.7 x VCC&#8221;, I can usually drive a 5V chip just fine from a JeeNode. The only exception being higher power chips, such as stepper motor drivers and such, which operate mostly at much higher voltage levels anyway. For these, you may have to use special &#8220;level translator&#8221; chips, or perhaps something like the I2C-based <a href=„https://jeelabs.org/op1.html“>Output Plug</a>, which can be powered with voltages up to 50V or so.</p> <p>This post only addresses <em>digital</em> I/O signals. With analog I/O, i.e. varying voltage levels, you will need to carefully review what voltage ranges are generated and expected, and perhaps insert either a voltage divider or an op-amp to amplify voltages. That&#8217;s a bit more involved.</p> <p>But all in all, living <em>mostly</em> in a 3.3V world is often more flexible than living <em>mostly</em> in a 5V world, nowadays.</p> <p><em>Which is the fourth reason why I decided to run JeeNodes at 3.3V, BTW.</em></p> </html>

Cookies helfen bei der Bereitstellung von Inhalten. Diese Website verwendet Cookies. Mit der Nutzung der Website erklären Sie sich damit einverstanden, dass Cookies auf Ihrem Computer gespeichert werden. Außerdem bestätigen Sie, dass Sie unsere Datenschutzerklärung gelesen und verstanden haben. Wenn Sie nicht einverstanden sind, verlassen Sie die Website.Weitere Information