Book Image

Raspberry Pi 2 Server Essentials

By : Piotr J Kula
Book Image

Raspberry Pi 2 Server Essentials

By: Piotr J Kula

Overview of this book

There’s no end to what you can do with a Raspberry Pi – it makes a huge range of tech projects possible. This book shows you how to transform it into a multipurpose web server, able to store and manage resources that lets you build some truly innovative and impressive computing creations. You’ll learn how to use your Raspberry Pi 2 to host a website using a range of different languages, host a game server, store files, and run everything from a media center to a cloud network. If you want to take control of your technological world, start building your own server and find out what’s possible with the Raspberry Pi microcomputer. Begin by getting your Pi set up – follow each step as the book shows you how to prepare a network and configure the additional features that you’ll need to build your projects. Once you’ve done this you’ll dig a little deeper and set up your pi as a file server, making sure it’s built for speed using a range of different tools, including Python, Node.js and ASP.NET. Following this the book shows you how to extend your server to allow you to host games, and stream live HD video before customizing it even further to create a fully-fledged media center. It doesn’t stop there however – the book then dives into the exciting world of the Internet of Things (IoT). You’ll learn how to install Windows IoT onto your Raspberry Pi, the operating system that’s driving embedded software projects all around the world. Once you’ve done this you’ll be ready to explore IoT further, as the book shows you how to use your device to host a cloud network that can form the basis of a wider IoT project.
Table of Contents (19 chapters)
Raspberry Pi 2 Server Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Extra peripherals


The Raspberry Pi is branded as a computer, and it is expected that we can connect various different devices to it. Raspbian is based on Debian, and an immense effort has been made to port the majority of drivers and software available for Raspbian. You might have some old USB peripherals lying around, for example, a joystick. If you can find a driver for any other Linux platform, it should be possible to make it work with Raspbian. Plug it in, use the lsusb command-line utility, and check whether it has been detected. If you manage to get it working with your knowledge, you should share this knowledge on a forum for the benefit of other users.

Essential peripherals

You should consider buying these peripherals and dedicating them for the use of your Raspberry Pi. They will really make it easier to set everything up and are even used for long-term purposes:

  • Wireless USB network adapters: At the time of writing this book, the current Raspbian image supports a variety of wireless adapters without the need to install any extra drivers. Many of the mini, nano, or micro versions run directly from the Pi's USB ports and do not require a powered USB hub.

  • USB hubs: Because some versions of the Raspberry Pi are limited to two USB ports, it might be wise to have a compatible, powered USB hub. Powered is the key word here, as this will allow you to plug in any USB device or several devices at the same time without affecting the Pi's power stability. At the time of writing this, Raspbian is not fully compatible with three USB hubs yet.

  • Keyboards and mice: Most wired keyboards and mice will run directly off the Raspberry Pi USB port. Many Bluetooth keyboards and mice also work directly off the Pi's USB ports but require initial setup using a wired keyboard. Some wireless keyboards, such as the Microsoft 3000 series, do not need any configuration as the USB dongle emulates a PS/2 wired keyboard and can be used straight away at boot time without any extra configuration.

Tip

You can visit http://elinux.org/RPi_VerifiedPeripherals for an up-to-date list of compatible peripherals.

Useful peripherals

As you grow more familiar with your Raspberry Pi, you will think of new a bigger ideas for your projects. With such ideas, you might need a few more useful devices to help you out.

Internet 3G dongles

You can connect to the Internet using a 3G dongle. These require a lot of power and will need to run from a powered hub to operate at full speed. They are a really easy way to connect your Raspberry Pi to the Internet even in the most remote places of your country. As long as you have a basic voice signal, you should always be able to use GPRS (single channel 57.5 kbps or dual channel 115 kbps), which can be enough to send plenty of logging text data. Some countries offer free text messages, and this can also be used to send and receive the bare minimum of data. If you plan to run a server, it would be recommended that you use LAN or Wi-Fi connected to an ADSL/DSL connection instead.

Audio recording

The Raspberry Pi has its own sound output hardware, which is really good at giving you a high definition sound over HDMI or analog audio via the 3.5 mm jack.

You might find yourself in a situation where you would like to record audio from a line input or microphone; you could then use any USB 1.1 or USB 2.0 sound capture device to do this.

Other media add-ons

  • IR receivers: Infrared (IR) receivers are a great way to control your Raspberry Pi using conventional remote controls. The FLIRC USB IR remote dongle is a great way for you to start doing this.

  • TV and radio receivers: This is the ultimate way to turn your Raspberry Pi into a full DVR system. Record, playback, or pause live TV from HD satellite or digital TV. You can listen to your favorite radio channels too.

  • Webcams: The Raspberry Pi has a port for its own dedicated HD camera module. Owning one of these cameras is a real treat, and the latest versions of Raspbian support UV4L (Video for Linux). A variety of USB webcams are also supported and support UV4L. Once a fairly complicated task, it has now become a lot easier to work with.

  • Multicard readers: These come in handy if you work with various card types. Support is limited on generic types, but the USB 3.0 USRobotics all-in-one card works really well, and you can mount all six cards at the same time.

  • Alamode: WyoLum is a start-up business that creates useful add-ons for various applications. Specifically, AlaMode is an Arduino-compatible board with a real-time clock and microSD slot that sits on top of the Raspberry Pi. You can communicate with Arduino using the Pi's dedicated UART (Universal Asynchronous Receiver/Transmitter), and it can run off the Pi's power source. If you like electronic projects and are already familiar with Arduino, this is worth looking at. You can even use it to flash other Arduino-compatible chips or upload firmware to run on its own!

  • HDMI to VGA: If you use an older or spare monitor, television, or LCD screen that only works with VGA, you can purchase an inline HDMI to VGA converter from your favorite online auction shops or electronic stores. You must make sure to buy an active converter, which is slightly more expensive than a passive convertor. Active means that it contains a microcontroller that uses power from the HDMI port to convert the digital signal into the VGA standard. The Raspberry Pi is capable of powering this type of device.

Fun peripherals

You might have some of these lying around in your gadget box. Hopefully, reading about some of these less used devices might spark some creative ideas:

  • Joysticks: Microsoft's Xbox 360 controller works like a mouse in X using xboxdrv, which can be installed from the package repository. Other joysticks might need a ported driver that can be found on Internet forums.

  • USB to SATA: You can purchase simple USB to SATA controllers that allow you to attach SATA hard drives using dedicated power supplies. The real fun begins when you use hardware RAID-based USB to SATA controllers that can be chained in various configurations, which can give you massive storage, high redundancy, or maximum performance.

    Tip

    Be careful, though, as the maximum throughput speed you can achieve is governed by the bandwidth of USB 2.0. In theory, this is a maximum speed of 60 MBps, but is shared by all the devices on the controller and not per port. There is more information about this later in the book.

  • CAN bus: The CAN bus is the standard used in all modern motor vehicles. It is a standard port that gives mandatory data that can be interpreted by anybody, for example, throttle value, misfiring of cylinders, or air to fuel ratio. PEAK-System has a variety of peripherals and software that are compatible with the Raspberry Pi. If you have access to manufacturer-specific codes, you can even adjust engine mappings with these tools.

    Note

    Adjusting non-standard values may damage your ECU and will void any warranties.

  • Home automation: A compatible device called TellStick runs well as a third-party, home automation device for the Raspberry Pi, but as an advanced Linux user, you should strive to make your own applications using real-time microcontrollers, such as Arduino on AlaMode, or the very cheap PICAXE microcontrollers.

  • USB missile launcher: Available on a variety of websites and stores, this is the perfect gadget if you need to shoot plushy missiles at unidentified objects! This is purely an entertainment peripheral, but you could use it for DIY projects as well.

  • Fingerprint scanners: Futronic's fingerprint scanners work well with Raspbian, and there are many examples that can be found online. They are standalone programmable devices that communicate with the Pi using simple messages over USB-UART and have extensive documentation available with the device.

  • Weather station: Sparkfun sell a pretty complete weather station that includes a wind vane, anemometer, and tipping bucket rain gauge. The kit includes clamps and mounting masts. You can add a light, temperature, and humidity sensor easily and without breaking the bank. The challenge depends on using a real-time microcontroller and building your own database to log all the data. But don't worry, there are many tutorials online that will help you progress further.