Connect The Hardware¶
We’ll wire:
SPI between the Raspberry Pi and the electricity monitor.
LED + resistor to the Raspberry Pi.
SPI¶
Raspberry Pi Pins¶
The diagram below point out the Raspberry Pi’s pinout:
MOSI: pin 19
MISO: pin 21
CLK: pin 23
GND: pin 25
We’ll use GPIO 5 (pin 29) for CS.
Circuit Setup Pins¶
Wire the MOSI, MISO, SCLK, GND, CS lines from the Rasp Pi to the Energy monitor.
LED¶
The schematic for wiring an LED is quite simple.
We used a 470 ohm resistor. Anything from 400 ohm to 1K ohm works.
Good Reminder - You must ALWAYS use resistors to connect LEDs up to the GPIO pins of the Raspberry Pi. mportant to use a resistor.The Raspberry Pi can only supply a small current (about 60mA). The LEDs will want to draw more, and if allowed to they will burn out the Raspberry Pi. Therefore putting the resistors in the circuit will ensure that only this small current will flow and the Raspberry Pi will not be damaged.