- Python Programming with Raspberry Pi
- Sai Yamanoor Srihari Yamanoor
- 273字
- 2021-07-02 23:48:46
The applications of GPIO control
Now that we have implemented our first example, let's discuss some possible applications of being able to control the GPIO. We could use the Raspberry Pi's GPIO to control the lights in our homes. We will make use of the same example to control a table lamp!
There is a product called the PowerSwitch Tail II (http://www.powerswitchtail.com/Pages/default.aspx) that enables interfacing AC appliances like a table lamp to a Raspberry Pi. The PowerSwitch Tail comes with control pins (that can take a 3.3V high signal) that could be used to turn on/off a lamp. The switch comes with the requisite circuitry/protection to interface it directly to a Raspberry Pi Zero:

The Pi Zero interfaced to the PowerSwitch Tail II
Let's take the same example from the previous section and connect the GPIO pin 2 to the +in pin of the PowerSwitch Tail. Let's connect the ground pin of the Raspberry Pi Zero's GPIO header to the PowerSwitch Tail's -in pain. The PowerSwitch Tail should be connected to the AC mains. The lamp should be connected to the AC output of the switch. If we use the same piece of code and connect a lamp to the PowerSwitch Tail, we should be able to turn on/off with a 1-second interval.

PowerSwitch Tail II connected to a Raspberry Pi Zero
This appliance control using the LED blinking code is just an example. It is not recommended to turn on/off a table lamp at such short intervals. In future chapters, we will make use of the Raspberry Pi Zero's GPIO to control appliances from anywhere on the Internet.
- Instant Raspberry Pi Gaming
- Design for the Future
- 精通MATLAB神經(jīng)網(wǎng)絡
- 工業(yè)機器人產(chǎn)品應用實戰(zhàn)
- 商戰(zhàn)數(shù)據(jù)挖掘:你需要了解的數(shù)據(jù)科學與分析思維
- 計算機應用復習與練習
- 3D Printing for Architects with MakerBot
- 網(wǎng)絡組建與互聯(lián)
- Windows游戲程序設計基礎
- 悟透AutoCAD 2009完全自學手冊
- 新編計算機圖形學
- Azure PowerShell Quick Start Guide
- 空間機械臂建模、規(guī)劃與控制
- 計算機組成與操作系統(tǒng)
- Mastering Text Mining with R