Raspberry Pi with Java: Programming the Internet of Things (IoT)

Book description

Use Raspberry Pi with Java to create innovative devices that power the internet of things!

Raspberry Pi with Java: Programming the Internet of Things (IoT) fills an important gap in knowledge between seasoned Java developers and embedded-hardware gurus, taking a project-based approach to skills development from which both hobbyists and professionals can learn. By starting with simple projects based on open-source libraries such as Pi4J, hobbyists can get immediate results without a significant investment in time or hardware.

Later projects target simplified industrial use cases where professionals can start to apply their skills to practical problems in the fields of home automation, healthcare, and robotics. This progression prepares you to be an active participant in the IoT revolution that is reshaping our lives.

For the hobbyist:

  • Hardware used in projects is affordable and easily accessible
  • Follows a project-based learning approach with a gradual learning curve
  • Projects are based on open-source code repositories with commercial friendly licenses

For the professional computer engineer:

  • Uses an industry-standard platform that allows for high performance, secure, production-ready applications
  • Introduces Java SE Embedded for large devices and Java ME Embedded for small devices
  • Code is portable to a wide variety of ARM and MIPS based platforms
  • Provides practical skill development with advanced projects in the fields of home automation, healthcare, and robotics

Table of contents

  1. Cover
  2. Title Page
  3. Copyright Page
  4. Contents at a Glance
  5. Contents
  6. Acknowledgments
  7. Introduction
  8. 1 Baking Pi
    1. Powering Your Raspberry Pi
      1. Purchasing Compatible SD Cards
      2. Formatting SD Cards
    2. Installing Raspbian
      1. Connecting Your Raspberry Pi
      2. How to Tell Your Raspberry Pi Is Working
    3. Installing Raspbian with NOOBS
    4. Networking Your Raspberry Pi
      1. Connecting via Ethernet
      2. Connecting via a Local Computer Network
      3. Connecting via a Wireless Network
      4. Updating and Upgrading
      5. Setting Up a Hostname
      6. Connecting to Your Raspberry Pi with SSH
    5. Creating a Simple Raspberry Pi Application
  9. 2 Your First Java Project
    1. Bill of Materials
    2. Getting Started with NetBeans
      1. Downloading and Configuring NetBeans
      2. Revisiting HelloRaspberryPi
    3. Brewing Java
      1. Communicating with a USB Scale
      2. Coffee Calculator
      3. Asynchronous Communication
      4. Coffee Brewing Recipe
    4. Commercial Licensing
  10. 3 Binary Timer
    1. Bill of Materials
    2. Accessing GPIO from Java
      1. Installing the Device I/O Library
      2. Device I/O Pin Assignments
      3. Device I/O Library LED Test
    3. Using Pi4J
      1. Pi4J Pin Assignments
      2. Pi4J LED Test
    4. Counting Down in Binary
      1. Implementing a Binary Timer
      2. Wiring the Breadboard
      3. Binary Timer Algorithm
      4. Completed Binary Timer
    5. Bonus: GPIO Performance Hacking
  11. 4 IoT Hat
    1. Bill of Materials
    2. Setting Up Your Raspberry Pi A+
    3. NFC/RFID Support on the Raspberry Pi
      1. Configuring Your Raspberry Pi for I2C, SPI, and UART
      2. Connecting the Smart Card Reader
      3. NFC Library Configuration
      4. Compiling and Installing libnfc
      5. Compiling and Installing ifdnfc
    4. Reading Cards from Java
    5. Physical Construction of the IoT Hat
  12. 5 Line Runner
    1. Bill of Materials
    2. Robot Assembly
    3. Programming the Line Runner
      1. Makeblock/ARPI600 Pin Mappings
      2. Pulse-Width Modulation
      3. Infrared Controller
      4. Line Following
      5. Obstacle Detection
    4. Summary
  13. 6 Tea Station
    1. Bill of Materials
      1. Choosing a Scale
      2. Temperature Probe
      3. Touchscreen Displays
      4. Tea Supplies
      5. Miscellaneous Items
    2. Precise Measurement with a Serial Scale
      1. Connecting the Serial Scale
      2. Testing with Minicom
    3. Accessing the Scale from Java
      1. Reading Scale Data with Pi4J
      2. Serial Implementation of Scale
    4. Accurate Temperature Sensing
      1. 1-Wire Serial Interface
      2. Testing the DS18B20
      3. Accessing the Temperature Sensor from Java
    5. Tea Recipe
    6. JavaFX UI
  14. 7 Autonomous Drone
    1. Hardware Bill of Materials
    2. Required Software
    3. Building an Autonomous Drone
      1. Setting Up Your Raspberry Pi
      2. Establishing a Network Connection Between the Pi and Drone, and Configuring the Raspberry Pi as a WAP
      3. Assembling and Fastening the Hardware to the Drone
      4. Writing a Java Method that Contains Flight Instructions
      5. Connecting to the Raspberry Pi via NetBeans to Remotely Deploy the Java Application and Supporting Libraries
      6. Flying the Drone by Invoking the Java Application
    4. Achieving Greater Degrees of Autonomy
      1. Orienting the Drone in 3D Space
      2. Implementing a Control Loop
  15. 8 Retro Video Game Emulator
    1. Bill of Materials
      1. Raspberry Pi
      2. Display and Adapter
      3. Speaker and Audio
      4. Navigation and Buttons
      5. Wiring and Tools
    2. Creating a GPIO Controller
      1. Wiring the Controller
      2. Soldering the Kippah
      3. Donning the Kippah
      4. Hooking Up Speakers
    3. Emulating the NES
      1. Running the Emulator
      2. Overclocking Your Raspberry Pi
      3. Automatic NES Startup
  16. 9 NightHacking RetroPi
    1. Bill of Materials
      1. Power Supply
      2. 3D Printer
    2. Construction of the RetroPi Case
      1. 3D Modeling in Autodesk Fusion 360
      2. Printing the Case
    3. Assembling the RetroPi
      1. Direct Wire Audio
      2. Portable Power
      3. Rewiring the Buttons
      4. Fitting the Internal Hardware
      5. Attaching the Screen
  17. Index

Product information

  • Title: Raspberry Pi with Java: Programming the Internet of Things (IoT)
  • Author(s): Stephen Chin, James Weaver
  • Release date: October 2015
  • Publisher(s): McGraw-Hill
  • ISBN: 9780071842020