table of contents raspberry pi

4
5 Table of Contents Introduction 9 1 Requirements 11 1.1 RPi 12 1.2 SD Card 12 1.3 Keyboard 12 1.4 Mouse 13 1.5 Display 13 1.6 Internet Connection 15 1.7 Power Supply 16 1.8 USB Hub 16 1.9 Loudspeaker (or Earphones) 17 1.10 Breadboard 17 1.11 Components 18 1.12 Software Oscilloscope 18 2 A Quick Tour Of The RPi 21 2.1 LXterminal 22 2.2 LXterminal – Scrot 23 2.3 LXterminal – Nano 23 2.4 IdleX 25 2.5 Debian Reference 25 2.6 Midori 25 2.7 WiFi Config 26 2.8 Scratch 26 2.9 Accessories – Leafpad 26 2.10 Accessories – File Manager 27 2.11 System Tools – Task Manager 27

Upload: elektor

Post on 30-Mar-2016

215 views

Category:

Documents


0 download

DESCRIPTION

Table of contents belonging to the Bert van Dam bestseller Raspberry Pi - Explore the RPi in 45 Electronics Projects

TRANSCRIPT

Page 1: Table of Contents Raspberry Pi

5

Rraspberry pi – van dam

elektor international media – 129025-1/UKpagina 5

Table of Contents

Introduction 9

1 Requirements 11

1.1 RPi 12

1.2 SD Card 12

1.3 Keyboard 12

1.4 Mouse 13

1.5 Display 13

1.6 Internet Connection 15

1.7 Power Supply 16

1.8 USB Hub 16

1.9 Loudspeaker (or Earphones) 17

1.10 Breadboard 17

1.11 Components 18

1.12 Software Oscilloscope 18

2 A Quick Tour Of The RPi 21

2.1 LXterminal 22

2.2 LXterminal – Scrot 23

2.3 LXterminal – Nano 23

2.4 IdleX 25

2.5 Debian Reference 25

2.6 Midori 25

2.7 WiFi Config 26

2.8 Scratch 26

2.9 Accessories – Leafpad 26

2.10 Accessories – File Manager 27

2.11 System Tools – Task Manager 27

Page 2: Table of Contents Raspberry Pi

6

TABLE OF CONTENTS

raspberry pi – van damelektor international media – 129025-1/UK

pagina 6L

3 Installing the software 29

3.1 RPi 29

3.1.1 Keyboard 29

3.1.2 Larger SD Card 30

3.1.3 Changing The Memory Allocation (Memory Split) 31

3.1.4 IP Address 31

3.1.4.1 Fixed IP Address Using Static Lease 32

3.1.4.2 Fixed IP Address Using Static IP 34

3.2 Windows PC (Optional) 36

3.2.1 Disk Imager 37

3.2.2 Python, wxPython And IdleX 37

3.2.3 Putty (SSH) 39

3.2.4 Xming (Xwindows) 40

3.2.5 WinSCP 44

4 Short Introductions To... 47

4.1 Debian Linux 47

4.2 Programming in Bash 53

4.3 Programming in Python 58

4.4 Programming in JavaScript 85

5 GPIO 91

5.1 Introduction 91

5.2 LED 93

5.3 Flashing LED 96

5.4 Alternating Flashing LED 100

5.5 Timer LED with Window 102

5.6 Switch 106

5.7 Time Switch 110

5.8 Toggling Switch 111

5.9 Switch State in a Window 113

5.9.1 Using a Timer 113

5.9.2 Using Multi-threading 116

5.10 A Button with Sound 122

5.11 Pin Communications 124

6 More Power 129

6.1 TD62783 8-Channel Source Driver 129

6.1.1 Light (6 V, 65 mA) 131

6.1.2 Motor (5 V, 145 mA) 132

Page 3: Table of Contents Raspberry Pi

7

TABLE OF CONTENTS

Rraspberry pi – van dam

elektor international media – 129025-1/UKpagina 7

6.2 ULN2003 7 Open Darlington Arrays 133

6.2.1 Fan (12 V, 150mA) and Light (6 V, 65 mA) 135

6.3 IRF740 MOSFET 137

6.3.1 Motor (5 V, 550 mA) 137

7 PWM 141

7.1 PWM in three ways 142

7.1.1 Frequency Driven 143

7.1.2 Mark-Space with Fixed Frequency 145

7.1.3 Mark-Space with Variable Frequency 147

7.2 Light with Gradually Increasing Brightness 148

7.3 Motor with Variable Speed 152

8 SPI 155

8.1 Introduction to SPI 155

8.2 MAX522 Digital to Analog (DAC) 158

8.3 DAC with opamp 164

8.4 More than two SPI devices 169

8.5 MCP3008 Analog to Digital (ADC) 170

8.6 MCP3008 pseudo-differential measurement 176

9 I2C 179

9.1 Introduction to I2C 179

9.2 MCP23008 I/O extender 181

9.3 More power for the extender 187

9.4 TC74 digital thermometer 187

10 Serial 197

10.1 Introduction to RS232 197

10.1.1 Serial loopback 198

10.2 Serial connection between RPi and Piccolino 200

10.2.1 Serial echo 202

10.2.2 Serial analog measurement (ADC) 204

11 Web Server 211

11.1 Introduction 211

11.2 HTML server 211

11.3 CGI 214

11.3.1 Hello User 215

11.3.2 Visitor counter in a file 219

Page 4: Table of Contents Raspberry Pi

8

TABLE OF CONTENTS

raspberry pi – van damelektor international media – 129025-1/UK

pagina 8L

11.3.3 Passing variables from the browser to the server 221

11.3.4 GPIO 224

11.3.5 GPIO with JavaScript 228

11.3.6 I2C Fridge alarm with automatic web page 236

12 Client-server 241

12.1 Introduction 241

12.2 TCP multiplication 241

12.3 TCP LED control 247

12.4 TCP DAC 249

12.5 TCP sawtooth and square wave generator 250

12.6 TCP Voltmeter with 8 channels 259

12.7 UDP echo 264

12.8 UDP light meter 267

Appendix 273

1 Adjustable power supply 273

2 GPIO header circuit 275

3 Contents of the download package 276

4 Parts list 277

5 Other books by the same author 278

Index 281