# 物联网与嵌入式系统概论-week3- Hardware and Software-Lesson1: Hardware Components

This series of articles are the study notes of "An Introduction to Programming the Internet of Things", by Prof. Harris, Department of Computer Science,University of California, Irvine. This article is week 3, Lessen 1: Hardware Components.

# 1. Lesson 1 Hardware Components

## 1.1 Hardware and Software

### 1.1.1 Hardware and Software together

So this lecture, we're going to talk about hardware and software systems. Internet of things devices, aretypically hardware and software combined. So as we're learning about the IoT design process, we really have to think about how you design hardware, how you design software, and how do you design them to work together. So you can't think of one in isolation, you really need to think about both together as you're working on the project.Hardware and software components must be designed together. You've got to design both of the Hardware and Software. So what I mean is when you write the software, you have to be thinking about the hardware.

### 1.1.2 Datasheets

Datasheets give details of each hardware component.

• Physical size
• Input / output pins
• Electrical parameters (max current, etc.)

Data sheets are basically information sheets about hardware components and every component has a datasheet. The simplest components, maybe you don't have adata sheet. For instance, a resistor, actually even resistors you can probably find data sheets, but a resistor is so simple you don't need a datasheet for that. They have very few parameters, but any kind of complicated component will have a datasheet that tells you all kinds of information aboutit. The size, the shape, the inputs, the outputs, the voltage, all the electrical parameters, things like this all the data that you need in order to use it. So reading these datasheets is really important.

## 1.2 Integrated Circuits

### 1.2.1 Datasheet Example

We’ll continue to talk a little bit more about datasheets for hardware components, specifically for integrated circuits, because they are extra complicated.

Datasheet example

You can read a little bit of a datasheet, so I don't expect people to be able to read the whole data sheet. And,in fact, most of the datasheet, you don't practically need. But,some key things you should beable to figure out. For instance, the size, you typically want to beable to read the size because there are certain things that you need to know.

Electrical parameters are important to tell you things like what's the maximum and minimum voltage, maximum current that can go through that. And that is actually important because you want to make sure, for instance, that components are voltage-compatible. So for instance, say you get a microcontroller and it's outputting at 5 volts, but you get a component that only needs, only accepts up to 3.3 volts, which is by the way, a common mismatch. So if that happens, you need to know that so you can either buy the component that matches your microcontroller, 5 volts, or you can do some type of stepping, voltage stepping, put a transformer in between, something like that to change the voltages and make them match. So, these parameters, some of these parameters you need, some of them you don't need that much.

### 1.2.2 Integrated circuits (ICs)

Integrated circuits are another type of component. They're a sort of simple components and more complicated components, and the datasheets vary in complexity.

Integrated circuits are chips. Now, they're typically made of silicon, silicon base. But they can be made of other materials, primarily silicon right now.

• A small electronic device made of a semiconductor material, like silicon, Galium Arsenide, etc.
• Chip is protected by a package
• Package has a set of pins to allow chip access

### 1.2.3 Arduino and Raspberry Pi

We won't have to look at the 150 page datasheet, and look at the details of what's going on. In fact, with the components that we're using, we're usingArduinos and Raspberry Pis. Those boards, they come with libraries that hide the details for us. So we will not have to be exploring a lot of the details inside those components, thankfully. But, you could. So if you really want to make the most use of these components, these chips, you can look in the datasheet and see lots of features.

Arduinos and Raspberry Pis give us these library functions, that simplify things for us as programmers. Butthey hide details, they also hide features. So there are a lot of things that you can't  do with a processor, with a microcontroller, just because the library doesn't allow you access to that feature. Now, if you want access to that feature you can go and look at the datasheet and do it, but you won't be able to rely on the nice, easy library functions that you really want to rely on. And inside this class, we probably won't be going into that level of detail about these microcontrollers at all.

## 1.3 Microcontroller Properties

This lecture we'll talk about microcontroller specifically. Actually probably it's the first decision you're going to make is which microcontroller will I use to control this system. Because you can't write any software, or it's very difficult to write software until you know at least what type of microcontroller you're going to use. But understand that outside of this class, in general when you make an IOT device, you need to make this decision early on, which microcontroller you will use.

### 1.3.1 Microcontroller Characteristics

All right, so characteristics of a microcontroller that you need to consider early on in order to pick which controller will work for your system. So one is the data path bit width.

#### (1) Data path Bit width

• Number of bits in each register
• Determines accuracy and data throughout

Bit is a single binary number. A singlebinary digit is a bit. Now, these numbers can be very large. So, every data path, every microcontroller, it has a certain, what you call a bit width. The size of a standard piece of data in that microcontroller. So common numbers would be likea 32-bit datapath for Microcontroller. That means that most of the data inside that microcontroller is going to be represented as a 32 bit number.

If you look in Arduino, and Arduino is an 8-bit data path, which is small. And Raspberry Pi is a 32-bit data path and there's a big cut off between those two. For instance, just very roughly if using an operating system and we will get to operating systems. Operating systems, you can use an operating system on a 32-bit data path, but it's a very hard thing to have an operating system on an 8-bit data path. So bit width is something you need to know and that's going to be on the front page of the datasheet, somewhere around there.

#### (2) Input / Output Pins

• Need enough pins to support your application

Basically it says that chips get denser and denser every year. They have more and more transistors on them every year, so theoretically more powerful. Now, even though the density is increasing at that rate, the number of pins, meaning the number of connections to the outside world, the wires that go to the outside that increases at a much more slow rate. So, you get more density onchip, but the number of pins is barely increasing over time, slowly increasing over time. So pins can be precious. The microcontroller needs to be connected to other components in the design. And so the numberof input/output pins is really important and you need to decide on that. So input/output pins you'll also see that the front page, and near the frontpage on the datasheet.

#### (3) Performance

• Clock rates are slower than desktop

Now we're going to to judging how fast a microcontroller is, that involves a lot of things. The first thing is going tobe the clock rate, how fast the clock is.A clock is roughly one instruction is executed, one machine code, one very simple instruction, is executed every clock on your standard microcontroller.And, standard single core microcontroller which is what we're dealing with. So, if you want more instructions executed fast, you need a better clock rate so if you have a clock rate of 8MHz, right then that 8MHz, mega is million, that means you can have 8 million instructions in asecond, up to. Or, on the other hand, if you have 1GHz then that means you can have a billion instructions in a second. So, that's also a big cutoff commonly between 8-bit and 32-bit processors. The 8-bits processor are all in this sort of 4MHz, 8MHz, 16MHz range, usually, where the 32-bit processes are up there in the 500MHz/GHz range and higher. So you get a big difference in speed there.

#### (4) Timer

• Needed for real-time applications

Timers. There are lots of different components inside microprocessors, a timer's very common. In fact not just very common, I think a timer is in every microcontroller I've ever seen, you've some sort of timer. You need timers for various things. One thing is, when you're making these IOT devices, they're often interacting with humans. And, so they're often time delays involved with humans, for instance, button pressing, actually, we'll get into more of this detail later. But there are a lot of things where you want them to happen on a certain time deadline.

#### (5) Analog-to- Digital Converters

• Used to read input from analog sensors

How we need to do analog-to-digital conversion because the world is through our perception is analog, we need to convert to digital. So A-to-D converter is typically built in to these microprocessors and microcontrollers.

#### (6) Low-powermodes

• Power saving is key

Another important feature is low power modes so power is important in processors these days. Especially IOT devices, which are often portable, they run off of batteries, and so people are very power-aware these days when they're doing their IOT design. So it's common to look for microcontrollers that have low-power modes which would shut off parts of the microcontroller that you don't need to conserve power.

#### (7) Communication protocol support

• Interface with other ICs
• UART, I2C, SPI, etc.

Communication protocol support, so here's another thing that you're often interested in the microcontroller. The microcontroller has to communicate with lots of different devices. So there will be, the center of the system, it has to communicate with other integrated circuits and different components. And the complicated components, like integrated circuits, they send lots of data back and forth to the microcontroller and the communication is complicated enough that it requires acommunication protocol.

举报原因： 您举报文章：物联网与嵌入式系统概论-week3- Hardware and Software-Lesson1: Hardware Components 色情 政治 抄袭 广告 招聘 骂人 其他 (最多只允许输入30个字)