Exploring Edison - Life At 1.8V
Exploring Edison - Life At 1.8V
Written by Harry Fairhead   
Article Index
Exploring Edison - Life At 1.8V
Level Converters
Bi-directional Level Shift

One of the big problems with using the Edison, or so many believe, is that in its "raw" form it works with 1.8V logic. In practice this isn't as big a problem as you might imagine. Often you don't have to do anything and when you do it is an easy and cheap fix. 

This is a chapter from our ebook on the Intel Edison. The full contents can be seen below. Notice this is a first draft and a work in progress. Use the comments or email harry.fairhead@i-programmer.info with your queries or suggestions.

ExploringEdison

 

Now On Sale!

You can now buy a print edition of Exploring Intel Edison.
You can buy it from:
 

USA and World  Amazon.com
Canada              Amazon.ca
UK                      Amazon.co.uk
France                Amazon.fr
Germany            Amazon.de
Spain                  Amazon.es
Brazil                  Amazon.br
Italy                    Amazon.it
Japan                 Amazon.co.jp
Mexico               Amazon.com.mx 


Chapter List

  1. Meet Edison
    In this chapter we consider the Edison's pros and cons and get an overview of its structure and the ways in which you can make use of it. If you have ever wondered if you need an Edison or an Arduino or even a Raspberry Pi then this is the place to start. 

  2. First Contact
    When you are prototyping with the Edison you are going to need to use one of the two main breakout boards - the Arduino or the mini. This chapter explains how to set up the Edison for both configurations. 

  3. In C
    You can program the Edison in Python, JavaScript or C/C+ but there are big advantages in choosing C. It is fast, almost as easy as the other languages and gives you direct access to everything. It is worth the effort and in this chapter we show you how to set up the IDE and get coding. 

  4. Mraa GPIO
    Using the mraa library is the direct way to work with the GPIO lines and you have to master it. Output is easy but you do need to be aware of how long everything takes. Input is also easy but using it can be more difficult. You can use polling or the Edison interrupt system which might not work exactly as you would expect.

  5. Fast Memory Mapped I/O
    There is a faster way to work with GPIO lines - memory mapped I/O. Using this it is possible to generate pulses as short at 0.25 microsecond and read pulse widths of 5 microseconds. However getting things right can be tricky. We look at how to generate fast accurate pulses of a given width and how to measure pulse widths.

  6. Near Realtime Linux 
    You need to be aware how running your programs under a non-realtime operating system like Yocto Linux effects timings and how accurately you can create pulse trains and react to the outside world. In this chapter we look the realtime facilities in every version of Linux. 

  7. Sophisticated GPIO - Pulse Width Modulation 
    Using the PWM mode of the GPIO lines is often the best way of solving control problems. PWM means you can dim an LED or position a servo and all using mraa. 

  8. Sophisticated GPIO -  I2C 
    I2C is a simple communications bus that allows you to connect any of a very large range of sensors. 

  9. I2C - Measuring Temperature  
    After looking at the theory of using I2C here is a complete case study using the SparkFun HTU21D hardware and software. 
     
  10. Life At 1.8V
    How to convert a 1.8V input or output to work with 5V or 3.3V including how to deal with bidirectional pull-up buses.

  11. Using the DHT11/22 Temperature Humidity Sensor at 1.8V 
    In this chapter we make use of all of the ideas introduced in earlier chapters to create a raw interface with the low cost DHT11/22 temperature and humidity sensor. It is an exercise in interfacing two logic families and implementing a protocol directly in C. 

  12. The DS18B20 1-Wire Temperature 
    The Edison doesn't have built in support for the Maxim 1-Wire bus and this means you can't use the very popular DS18B20 temperature sensor. However with a little careful planning you can and you can do it from user rather than kernel space. 

  13. Using the SPI Bus 
    The SPI bus can be something of a problem because it doesn't have a well defined standard that every device conforms to. Even so, if you only want to work with one specific device it is usually easy to find a configuration that works - as long as you understand what the possibilities are. 

  14. SPI in Practice The MCP3008 AtoD 
    The SPI bus can be difficult to make work at first, but once you know what to look for about how the slave claims to work it gets easier. To demonstrate how its done let's add eight channels of 12-bit AtoD using the MCP3008.

  15. Beyond mraa - Controlling the features mraa doesn't. 
    There is a Linux-based approach to working with GPIO lines and serial buses that is worth knowing about because it provides an alternative to using the mraa library. Sometimes you need this because you are working in a language for which mraa isn't available. It also lets you access features that mraa doesn't make available. 
 

<ASIN:1871962447>


 

The Edison works with 1.8V logic. When you use it with the Arduino breakout board then there are logic level converters that save you from having to worry about this. If you want to make the best use of the Edison then you certainly have to avoid the Arduino breakout board and use the mini breakout board. However the mimi breakout board doesn't buffer or level shift the raw GPIO lines of the Edison.

This means that you either have to find sensors and transducers that work with 1.8V logic or you have to implement level shifters of your own. Once you have done this a few time it becomes very easy and it is very cheap.

The following descriptions of how things work are aimed at the reader who knows about basic physics - Ohm's Law say - but isn't an electronics expert. 

Logic Levels

All logic implementation have a range of voltages that are regarded as a zero and a one. These are important specifications that you need to know to make sure that your implementation of logic or logic level shifting works in a wide range of situations. 

The diagram below summarizes the logic levels for the most commonly encountered systems.

 

logiclevel

 

In each case the important numbers are Vih, Vil and Voh, Vol which give you the voltage range the inputs and outputs work with. For example for 1.8V logic Vih and Vil are 1.17V and 0.63V. That is if the input is 1.17V or greater it reads a one and if it is 0.63 or lower it reads a zero. The Voh and Vol figures give you the limits on the ouputs of the logic family. For example for 1.8V logic Voh is 1.35 and Vol is 0.45. What this means is that any 1.8V device will output at least 1.35V for a one and at most 0.45V for a zero.

You can see that these figures give you a margin of tolerance. 

It the output is low then it will be at most 0.45V and this is below the 0.63V needed by Vil which reads it as a zero. 

The Edison specification gives 

Vil as 0.35*Vdd and Vol as 0.45V which is exactly the standard as long as Vdd is 1.8V. 

Of course your level shifters and custom logic and aim for 1.8V for a one and 0V for a zero but the logic voltage levels tell you how accurate you have to be and what you can expect from the standard logic in the worst case. 

Output 1.8V To 3.3V and 5V

For output level conversion the key figures are Voh and Vol. The GPIO line will be at least 1.35V when high and not more than 0.45V for a low. 

As we are talking about voltage levels there is a tendency to immediately think that a voltage controlled device such as a MOSFET is the obvious choice. However the difficulty is finding a MOSFET with a gate threshold voltage in the correct range. Most general purpose MOSFETs have too high a threshold voltage to be turned on by 1.8V. 

Even if you find a MOSFET with a gate threshold voltage of 1.8V on average it is not going to be turned on sufficiently by the 1.8V on the GPIO line in the best case and in the worse case the GPIO line might be as low as 1.3V and the MOSFET gate threshold could be 2V or more. 

Also note that the gate threshold is the minimum voltage need to make the MOSFET just start to conduct. 

There are specially made N Channel MOSFETS for use in 1.8V logic circuits. For example, the FDN327B is marketed as a 1.8V logic MOSFET. Its characteristics are:

VGS(th) Gate Threshold Voltage min 0.4 avg 0.7 max 1.5 V

Equally important is the figure: 

RDS(ON) = 120 mΩ @ VGS = 1.8 V 

which is the MOSFETS resistance at a gate voltage of 1.8V. A typical MOSFET has a higher on resistance at its quoted gate threshold voltage. You can see that in this case it is low enough to conduct a reasonable current at 3.3V or 5V. 

Any MOSFET that you plan to use for a 1.8V level converter has to have parameters similar to or better the FDN327B.

One big problem with the 1.8V MOSFETs is that they are generally surface mount components. This is not a huge problem in that in many case this is exactly what you want but it does make prototyping more difficult. If you want to use such MOSFETs then your choices are to buy a device pre-mounted on a breakout board, use a general purpose breakout board or solder some wires to the surface mount contacts.

A good alternative to a MOSFET is an "old fashioned" Bipolar Junction Transistor - a BJT. 

The BJT often gets left out of introductory electronics courses because it is a current controlled device and this is more difficult to understand and work with. However in this case it has a big advantage.

If you think of the silicon BJT as a simple 3-terminal switch then it switches on when the base reaches 0.6V relative to the emitter. If you compare this to the 1.8V logic thresholds you can see that it is a good fit and what is more any silicon npn transistor works in this way.

That is you can use almost any general purpose npn transistor to convert 1.8V logic to 3.3V or 5V logic. 

In the rest of this chapter the 2N2222 transistor is used because it is common, cheap and available in a range of packages including through-hole, making it easy to use for prototyping. 



Last Updated ( Wednesday, 11 May 2016 )
 
 

   
Banner
RSS feed of all content
I Programmer - full contents
Copyright © 2017 i-programmer.info. All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.