Node.js RaspberryPi-コンポーネント


コンポーネントとは何ですか?

コンポーネントは、より大きな全体の一部です。この章では、チュートリアルで使用するさまざまなコンポーネントについて説明します。


ラズベリーパイとGPIOピン

GPIOを備えたRaspberryPi 3

これはRaspberryPi3のイラストです。

GPIOピンは、Raspberry Piの右側にある2列の小さな赤い四角で、実際のRaspberryPiでは小さな金属製のピンです。

入力ピンは、外界からオンまたはオフにできるスイッチのようなものです(オン/オフライトスイッチのような)。

出力ピンは、Raspberry Piがオンまたはオフにできるスイッチのようなものです(LEDライトのオン/オフなど)。

Raspberry Pi 3には26個のGPIOピンがあり、残りのピンは電源、アース、または「その他」です。

ピンの配置は、以下の表に対応しています。

ラズベリーパイB +、2、3&ゼロ

3V3 1 2 5V
GPIO 2 3 4 5V
GPIO 3 5 6 GND
GPIO 4 7 8 GPIO 14
GND 9 10 GPIO 15
GPIO 17 11 12 GPIO 18
GPIO 27 13 14 GND
GPIO 22 15 16 GPIO 23
3V3 17 18 GPIO 24
GPIO 10 19 20 GND
GPIO 9 21 22 GPIO 25
GPIO 11 23 24 GPIO 8
GND 25 26 GPIO 7
DNC 27 28 DNC
GPIO 5 29 30 GND
GPIO 6 31 32 GPIO 12
GPIO 13 33 34 GND
GPIO 19 35 36 GPIO 16
GPIO 26 37 38 GPIO 20
GND 39 40 GPIO 21

伝説

物理ピン番号
パワー+
接地
UART
I2C
SPI
GPIO
接続しないでください


ブレッドボード

ブレッドボードは電子機器のプロトタイピングに使用され、はんだ付けせずに回路を作成できます。それは基本的にプラスチックボードであり、タイポイント(穴)のグリッドがあります。ボードの内側には、特定の方法でさまざまなタイポイントを接続する金属ストリップがあります。

下の図では、いくつかのセクションを異なる色で強調表示しています。これは、グリッドがどのように接続されているかを示すためのものです。

接続が強調表示されたブレッドボード

ブレッドボードのさまざまなセクション:

  • 左側と右側には、2列のタイポイントがあります。これらの各列のすべてのタイポイントが接続されています。
  • パワーバス-列は赤で強調表示されています。通常、電源をブレッドボードに接続するために使用されます。柱全体が接続されているため、柱内の任意のタイポイントに電源を接続できます。
  • 地上バス-青で強調表示された列。通常、グラウンドをブレッドボードに接続するために使用されます。柱全体が接続されているため、柱内の任意のタイポイントにアースを接続できます。
  • 接続されたタイポイントの行-緑で強調表示された行。これらの各行のタイポイントは接続されていますが、行全体ではありません。左側のタイポイントが接続され(ABCDE)、右側のタイポイントが接続されます(FGHIJ)。
  • ブレッドボードの中央にはトレンチがあり、これにより左右の列が分離されます。トレンチの幅は、多くの集積回路がトレンチを横切るように設計されています。

その他の電気部品

スルーホールLED

発光ダイオード(LED)。LEDは、電圧が印加されると発光するダイオードです。この例では、スルーホールLEDを使用しています。それらには、正(アノードと呼ばれる)と負(カソードと呼ばれる)のピンがあります。LEDの長い方の脚は、プラスのピンを示しているはずです。

スルーホールLED

RGB LED

Light emitting diode (LED). An LED is a diode that emits light when a voltage is applied to it. An RGB LED has 4 pins. One for each color (R = Red, G = Green, and, B = Blue), and a common cathode/anode. This one LED can display the pure colors, or with PWD to modulate and mix colors.

RGB LED

Push Button

A push button is a type of switch. A switch makes or breaks a connection an an electric circuit.

接続が強調表示されたブレッドボード

Jumper Wire - Female to Male

Short pieces of wire called jumper wires are used to make connections. Female to Male jumper wires can be used to connect from the GPIO on the Raspberry Pi to the Breadboard.

メスからオスへのジャンパー線

Jumper Wire - Male to Male

Short pieces of wire called jumper wires are used to make connections. Male to Male jumper wires can be used to make connections between different parts of the Breadboard.

接続が強調表示されたブレッドボード

Resistor - 68 Ohm

Resistors are used to reduce current, adjust signal levels, etc. This is a 68 Ohm resistor.

68オーム抵抗

Resistor - 220 Ohm

Resistors are used to reduce current, adjust signal levels, etc. This is a 220 Ohm resistor.

220オームの抵抗器

Resistor - 1k Ohm

Resistors are used to reduce current, adjust signal levels, etc. This is a 1k Ohm resistor.

1kオーム抵抗


Node.js Modules

onoff - GPIO access and interrupt detection with Node.js

documentation

Socket.IO - real-time bidirectional event-based communication

documentation

pigpio - wrapper for pigpio C library. Enables GPIO, PWM, servo control, state change notification and interrupt handling with Node.js

documentation