Hardware Reference
In-Depth Information
This is not too much of a worry for you because the Raspberry Pi comes with very useful GPIO headers. There are
quite a few different ways you could read an external temperature from the Raspberry Pi's GPIO pins. You could use
a simple thermistor if you wanted or you could use something more advanced, based on the 1-wire protocol. The
GPIO pins you have access to could support any of these methods.
This all sounds a bit complicated. Why can't you just use a digital temperature sensor? Aside from that being
extremely boring it's also not very versatile. With the Raspberry Pi you can do much more. You now have the option
of using many different types of sensors and different connection methods. You now also have the ability to log the
data for future reference. Or you may want to perform an action once the sensor hits a certain reading. Or maybe you
just want to broadcast to the word what temperature your home rack is at. Given the Raspberry Pi's small size and low
power requirements you could be coupled with WiFi to set up a remote temperature station outside. The possibilities
are endless.
This project is designed to be simple and cheap; at the same time I hope that it opens your eyes to how easy a
hardware project can be with the Raspberry Pi. It's not scary and it's not overly hard to understand. I will start off
by talking about the GPIO pins a little more. After that I will discuss the sensors I will be using and how they will be
connected. This will include an introduction to the 1-wire protocol and why it's good for this type of project. After that
I will show you a basic circuit that requires no soldering in order to take your first temperature reading.
Breadboards and GPIO Pins
Since this is the first time you have used the GPIO pins, I would like to spend a little bit of time discussing the physical
side of them. After reading Chapter 1 you will have a good idea what makes up the GPIO pin headers and also
what functions you can get from them. I won't go back over all those details in this chapter. There are a few simple
guidelines you should follow when working with the Raspberry Pi's GPIO pins.
The first point and the most important one to remember is that the GPIO pins are not tolerant of 5 V. If you try
and source 5 V from your GPIO headers and you're lucky, your project just may not work. If you're unlucky, you will
let the magic smoke out of something and if you're really unlucky that something will be the Raspberry Pi. If your
project has more than 5 V and your Raspberry Pi's GPIO pins get connected to this you will let the magic smoke out of
your Raspberry Pi.
There are various methods for protecting your GPIO pins. You can use something fancy like an optocoupler to
fully isolate your Raspberry Pi. This may be needed for some projects, like if you were going to interface with
high-voltage circuits. You could also do something super basic and use a Zener diode. If you place a 3.3 V Zener diode
between the ground and the GPIO pin you intend to use, you will have a small amount of protection. If you attempted
to apply more than 3.3 V, the diode would burn out. Once this occurs the circuit is broken and the dangerous voltage
would never be received by the GPIO pins.
Personally, unless I am designing a project that absolutely needs protection, then I don't worry. I'd rather take the
approach of checking everything I do more than once, making sure I won't supply 5 V to the GPIO pins. This is
a good habit to get into, as you will find mistakes and fix them before they become an issue. I don't like to be sloppy as
I know the protection will save me: I'd much rather check it and get it right. I also tend to use breadboards for all my
prototyping work. This makes things so much easier to work on. Do yourself a favor and get a few of them of various
sizes: you won't regret it! In Figure 3-2 you can see some of my breadboards.
 
Search WWH ::




Custom Search