JavaScript on Things
Hardware for web developers
Lyza Danger Gardner
  • MEAP began July 2016
  • Publication in November 2017 (estimated)
  • ISBN 9781617293863
  • 450 pages (estimated)
  • printed in black & white

You can use JavaScript - the language of the web - to make things happen in the real world. JavaScript controls hordes of small robots, creative maker projects, and IoT products. Inexpensive platforms like the Raspberry Pi and Tessel 2 are powerful little computers in their own right, with the oomph to run Node.js on-board, and you can also use JavaScript to control simpler boards like the ubiquitous Arduino Uno. With the Node.js ecosystem at hand, hardware prototyping gets fun, intuitive and fast. Plug stuff in anything from motors to touch screens to soil moisture sensors and you're off! Let's build something!

JavaScript on Things is your first step into the exciting and downright entertaining world of programming for small electronics. If you know enough JavaScript to hack a website together, you'll be making things bleep, blink and spin faster than you can say "nodebot". This fully-illustrated, hands-on book shows you how to get going with platforms like Arduino, Tessel, and Raspberry Pi. You'll get a thorough crash course in basic electronics and go in-depth and step-by-step, building little projects that light up, sense the environment around you, make noise, exchange data, move around, and more. You'll even build a wirelessly-controlled robot. Yay! Learning something truly useful has never been quite this much fun. We guarantee it.

Table of Contents detailed table of contents

Part 1: A JavaScripter's Introduction to Hardware

1. Bringing JavaScript and Hardware Together

1.1. The Anatomy of Hardware Projects

1.1.1. Inputs and Outputs

1.1.2. Processing

1.1.3. Power, Circuits and Systems

1.1.4. Logic and Firmware

1.1.5. Enclosures and Packaging

1.1.6. Embedded Systems

1.2. How JavaScript and Hardware Work Together

1.2.1. Host-Client Method

1.2.2. Embedded JavaScript

1.2.3. Other Hardware-JavaScript Combinations

1.2.4. Cloud-based Services and the Browser

1.3. Is JavaScript a Good Fit for Hardware?

1.4. Putting Together A Hardware Toolkit

1.4.1. Development Boards

1.4.2. Input and Output Components

1.4.3. Other Electronic Components

1.4.4. Power, Wires and Accessories

1.4.5. Tools

1.5. Summary

2. Embarking on Hardware with Arduino

2.1. Getting to Know Arduino Uno

2.1.1. Creating your First Circuit with Arduino Uno

2.2. Working with the Arduino Workflow

2.2.1. Arduino Uno's Digital Pins

2.2.2. Sketches and the Arduino IDE

2.2.3. Connecting the LED to a Digital Pin

2.3. Controlling the Arduino with JavaScript

2.3.1. Configuring the Arduino as a Client

2.3.2. Installing the Johnny-Five Node.js Framework

2.3.3. "Hello, World" Blinking LED with Johnny-Five

2.3.4. Firmata, Johnny-Five and the Host-Client Method

2.3.5. Structuring Scripts with Johnny-Five

2.4. Summary

3. How to Build Circuits

3.1. Voltage, Current and Resistance

3.1.1. Ohm's Law

3.1.2. Problems and Dangers

3.2. Building Circuits

3.2.1. Using Breadboards to Prototype Circuits

3.2.2. Wiring a Simple LED Circuit on a Breadboard

3.2.3. Expanding a Series Circuit with a Button

3.2.4. LEDs in Series

3.2.5. Parallel Circuits and Current Dividers

3.2.6. Powering your Project with Batteries

3.3. Summary

Part 2: Project Basics: Input and Output with johnnyfive

4. Sensors and Input

4.1. Working with Analog Sensors

4.1.1. Analog-to-Digital Conversion

4.1.2. Working with Photoresistors

4.1.3. Voltage Dividers

4.1.4. Wiring and Using a Photoresistor

4.1.5. Using an Analog Temperature Sensor

4.2. Digital Inputs

4.2.1. Using a Button as a Digital Input

4.3. Summary

5. Output: Making Things Happen

5.1. Lighting Things Up

5.1.1. Fading LEDs with Pulse-Width Modulation (PWM)

5.1.2. Animating LEDs with PWM

5.1.3. Combining Input with LED Output

5.1.4. Going Full-Color with RGB LEDs

5.1.5. Build your Own "Weather Ball"

5.2. Working with LCD Displays (Parallel)

5.2.2. Adding a Visual LED "Chime"

5.3. Making Noise with a Piezo

5.3.1. Adding an Audible Piezo Chime to the Timer

5.3.2. Playing Tunes on the Piezo

5.4. Summary

6. Output: Making Things Move

6.1. Making Motors Spin

6.1.1. How Motors Work

6.1.2. Controlling a Motor with a Pushbutton Switch

6.1.3. Controlling a Motor with Johnny-Five

6.2. Making Servos Go

6.2.1. Controlling a Servo with Johnny-Five

6.3. Building Your First Robot!

6.3.1. Robots and Motors

6.3.2. Building the Robot’s Chassis Base

6.3.3. Controlling the Robot’s Motors

6.4. Summary

Part 3: More Sophisticated Projects

7. Communicating with Serial

8. Getting Untethered: Wire-Free Projects

9. Project Software

Part 4: Using JavaScript with Hardware in Other Environments

10. Embedded JavaScript

11. Node.js and Hardware on Small Computers

12. Hardware and the Web

What's inside

  • Using JavaScript in tandem with popular platforms like Arduino, Tessel 2 and Raspberry Pi
  • Introduction to creating and controlling embedded projects
  • Designing and assembling straightforward robots and gadgets
  • Crash course in basic electronics
  • Over a dozen hands-on projects

About the reader

Written for readers with intermediate JavaScript and Node.js skills. No experience with embedded systems or robotics required.

About the author

Lyza Danger Gardner has been web developer for over 20 years. She's part of the nodebots community and is a contributor to the johnny-five Node.js library.

Manning Early Access Program (MEAP) Read chapters as they are written, get the finished eBook as soon as it’s ready, and receive the pBook long before it's in bookstores.
MEAP combo $39.99 pBook + eBook + liveBook
MEAP eBook $31.99 pdf + ePub + kindle + liveBook

FREE domestic shipping on three or more pBooks