Hardware Reference
In-Depth Information
The first time you run the script it would be a good idea to run it with no options:
# ./sensor.sh
By doing this you will be presented a help page on how to use the script. This help page will show you all the
different options you can use.
For example if I wanted to monitor the DS1820B every five seconds my command would look like this:
# ./sensor.sh ds1820_mon 5
If I wanted to log the DHT11 sensor every five seconds to a log file my command would look like this:
# ./sensor.sh dht11_log 5 /var/log/dht11_sensor
Summary
In this chapter you received a detailed introduction to my love of data sheets and breadboards, starting off with how
breadboards work and how they are laid out. I still suggest that you keep many breadboards around. I can guarantee
you that sometimes you will have half-finished projects and pulling all the components off the board just to build
something simple gets a little frustrating very quickly. This rule applies for jumper wire too. Even with a box of it I still
find myself unable to find that exact cable or jumper I need. You also may have noticed my tendency to always refer
you back to the data sheets when possible. I can't stress enough how important they are. Just quickly read over them:
sometimes they will save you hours of frustration.
A good example of this is the DHT11 used in this chapter. You would expect it to run fine at 3.3 V; after all it's
a very common voltage source. On the other hand 3.6 V is not common. I don't know why or how the DHT11 came to
need that as a minimum voltage, but my point is that one quick glance at your data sheets would show you this right
away. The voltage range was printed on the back of the DHT11, lucky enough, but that's not normal just like 3.6 V.
After all this I then explained the differences between the DS1820B and the DHT11. I still feel that the DS1820B is
a better sensor in a lot of aspects. This is more so when you're talking about connecting it to the Raspberry Pi and not
an Arduino. The DHT11 is just far too timing-critical to work well in Linux. Sure, we got it working but I would not pick
it as a sensor for use with the Raspberry Pi.
With that in mind I showed you how to access the DS1820B via the 1-wire bus. I also showed you how to make
use of parasitic power. I talked about how to load the modules for the 1-wire bus and what each of them did. Once we
had kernel support for the 1-wire bus I showed you how to search for and access each one of the 1-wire slaves.
In the last part of this chapter I talked about the DHT11 and how you can access it under Linux. This proved
to be a bit more involved than using the built-in 1-wire bus. You were required to install additional header files to
support the application that reads the DHT11. In the end the sensor was up and working, giving you temperature and
humidity readings every two or more seconds. This is a little slow compared with the DS1820B. It works fine if you
need to use it. The only reason I have included it is that it's quite common to use the DHT11 with the Arduino. So you
may have one lying around. Now that you have mastered data sheets and breadboards, in the next chapter you will
connect a simple LCD. It will require more breadboard action and, of course, more reading of data sheets.
 
Search WWH ::




Custom Search