Arduino与Raspberry PI

I recently got an Arduino.

我最近有一个Arduino。

When I got the idea of playing around with electronics after 15+ years of not touching a single resistor, I recall I spent some time searching which device was best for what I wanted to do.

当我有15年以上不接触单个电阻器而尝试使用电子产品的想法时,我想起我花了一些时间寻找哪种设备最适合我想做的事情。

Two of the most popular platforms for such a thing are Arduino and Raspberry PI. There are many, many others, but those are the two most popular and in this article I want to explain the difference between those 2.

用于此类事情的两个最受欢迎的平台是Arduino和Raspberry PI。 还有很多很多,但是这两个是最受欢迎的两个,在本文中,我想解释一下这两个之间的区别。

Here is Arduino Uno, the board we’ll take as an example, although Arduino offers many different boards. This is the board I chose, by the way:

这是Arduino Uno,我们将以该板为例,尽管Arduino提供了许多不同的板。 顺便说一下,这是我选择的董事会:

Arduino与Raspberry PI

Arduino与Raspberry PI

Here is a Raspberry Pi model B+

这是Raspberry Pi B +型

Arduino与Raspberry PI

Arduino与Raspberry PI

They look pretty similar, at a first look. Chips, connectors, holes for screws.

乍一看,它们看起来很相似。 芯片,连接器,螺丝Kong。

Turns out, they are very, very different.

事实证明,它们是非常非常不同的。

Starting from the core. Arduino comes with an 8-bit microcontroller. The Raspberry Pi comes with a 64-bit microprocessor.

从核心开始。 Arduino带有一个8位微控制器 。 Raspberry Pi带有64位微处理器

Arduino has 2 Kilobytes of RAM. Raspberry Pi has 1GB of RAM. (500,000x more)

Arduino有2 KB的RAM。 Raspberry Pi具有1GB的RAM。 (超过500,000倍)

In terms of I/O, Arduino has an USB-B port that can be used by a computer to transfer new programs to run, a power input and a set of I/O pins.

在I / O方面,Arduino具有USB-B端口,计算机可以使用它传输要运行的新程序,电源输入和一组I / O引脚。

A Raspberry Pi is much more sophisticated in this regard, having a Video output, an HDMI port, an SD card port, an Audio jack, CSI camera port, DSI display port, 4 USB 2.0 ports which you can use to attach USB devices, a Gigabit Ethernet jack, Wireless LAN, Bluetooth 4.2 and I/O pins (GPIO) as well. Lots of things.

Raspberry Pi在这方面要复杂得多,它具有视频输出,HDMI端口,SD卡端口,音频插Kong,CSI摄像机端口,DSI显示端口,4个USB 2.0端口,可用于连接USB设备,一个千兆以太网插Kong,无线局域网,蓝牙4.2和I / O引脚(GPIO)。 很多事情。

Arduino has no operating system. It can only run programs that were compiled for the Arduino platform, which mostly means programs written in C++.

Arduino没有操作系统。 它只能运行为Arduino平台编译的程序,这主要是指用C ++编写的程序。

Raspberry Pi runs an operating system, which is usually Linux. It’s a mini computer, while Arduino is much more simple.

Raspberry Pi运行一个操作系统,通常是Linux。 这是一台微型计算机,而Arduino更简单。

您应该使用哪一个? (Which one should you use?)

Given those differences you might think a Raspberry Pi is so much more powerful and capable than Arduino, so you should use that. Right? Wrong.

考虑到这些差异,您可能会认为Raspberry Pi比Arduino强大得多,因此应该使用它。 对? 错误。

Arduino consumes much less power (~50 mA idle) than an a Raspberry Pi (700+ mA)

Arduino的功耗( ~50 mA空闲)比Raspberry Pi( 700+ mA )少得多

Arduino has 20 I/O pins. Raspberry Pi has 8. Individual I/O pins in Arduino can drive 40mA while Raspberry Pi GPIO pins can each drive a maximum of 16mA.

Arduino有20个I / O引脚。 Raspberry Pi有8个。Arduino中的单个I / O引脚可以驱动40mA而Raspberry Pi GPIO引脚每个可以驱动最大16mA

I researched those numbers, but I haven’t measured them myself yet.

我研究了这些数字,但是我自己还没有测量它们。

You can program a Raspberry Pi in pretty much any programming language you want, as if you run Linux there is a vast choice for you.

您可以使用几乎任何所需的编程语言对Raspberry Pi进行编程,就好像您在运行Linux一样,它为您提供了广泛的选择。

那编程呢? (What about programming?)

Arduino is best to be programmed using C++ and its “Arduino language” which is just C++ with some convenience features that make it easy for beginners to start with.

Arduino最好使用C ++及其“ Arduino语言”(仅C ++)进行编程,并具有一些便利的功能,使初学者可以轻松上手。

However you are not limited to it. If you can live with the constraints of having the Arduino attached to the USB port of the computer, you can run Node.js code on it using the Johnny Five project, which is pretty cool.

但是,您不仅限于此。 如果您可以忍受将Arduino连接到计算机的USB端口的限制,则可以使用Johnny Five项目在其上运行Node.js代码,这非常酷。

There are similar tools for other languages, like pyserial and Gobot.

其他语言也有类似的工具,例如pyserialGobot

In my opinion Arduino is best when you want to compile a program for it, attach a battery or a power connector and put it somewhere to run, and play around with sensors and other nice stuff that interfaces with the real world.

我认为Arduino最适合用于编译程序,连接电池或电源连接器并将其放置在可以运行的地方,并且可以与传感器和其他与真实世界交互的好玩的东西玩耍。

You don’t have to worry about anything as there is nothing else than your program running on the Arduino. It does not even have a network (I’m talking about the Uno) out of the box.

您无需担心任何事情,因为您的程序仅在Arduino上运行即可。 它甚至没有开箱即用的网络(我在谈论Uno)。

A Raspberry Pi is more like a small computer without a screen, which you program using more traditional tools.

Raspberry Pi更像是一台没有屏幕的小型计算机,您可以使用更传统的工具进行编程。

I would use an Arduino to power my self-watering plants or track the temperature outside, or power some home automation stuff, but I would use a Raspberry Pi as a retro gaming platform or a web server.

我会使用Arduino来为我的自浇植物供电,或者跟踪室外温度,或者为一些家庭自动化设备供电,但是我会使用Raspberry Pi作为复古游戏平台或Web服务器。

翻译自: https://flaviocopes.com/arduino-vs-raspberry-pi/