JavaScript Robotics: Building NodeBots with Johnny-Five, Raspberry Pi, Arduino, and BeagleBone

JavaScript Robotics: Building NodeBots with Johnny-Five, Raspberry Pi, Arduino, and BeagleBone


View All Available Formats & Editions
Choose Expedited Shipping at checkout for guaranteed delivery by Thursday, May 30


JavaScript Robotics is on the rise. Rick Waldron, the lead author of this book and creator of the Johnny-Five platform, is at the forefront of this movement. Johnny-Five is an open source JavaScript Arduino programming framework for robotics. This book brings together fifteen innovative programmers, each creating a unique Johnny-Five robot step-by-step, and offering tips and tricks along the way. Experience with JavaScript is a prerequisite.

Product Details

ISBN-13: 9781457186950
Publisher: Maker Media, Inc
Publication date: 05/10/2015
Pages: 272
Sales rank: 874,223
Product dimensions: 8.00(w) x 9.75(h) x (d)
Age Range: 11 - 17 Years

About the Author

Backstop Media is a partnership that consists of Troy Mott, Bob Herbstman and Christina Rudloff. Troy Mott has over fifteen years of experience in technical publishing, working in every facet of the industry. He currently manages Backstop Media, along with Bleeding Edge Press. Bob has worked in technical publishing for over ten years, editing and producing numerous books and articles. Christina has ten years of publishing experience, acquiring, editing and marketing numerous books and articles.

Rick is the creator of Johnny-Five, a JavaScript framework for hardware programming on the Node.js platform and is working towards establishing standards for general hardware APIs. Currently supporting Arduino, BeagleBone, Raspberry Pi, Pinoccio, Spark-Core, Light Blue Bean, Intel Galileo and Intel Edison, his work was recently highlighted at Intel's IDF2014. As a jQuery Core committer and former board member of the jQuery Foundation, Rick serves on Ecma TC39 as a representative of jQuery, channeling the project's vast real world experience into contributions to the design the next version of JavaScript. All of Rick's work on JavaScript Robotics is made possible by Bocoup.

Table of Contents

Preface xi

1 Building Robots with Lo-tech Materials 1

Building the SimpleBot 2

Bill of Materials 2

Build Steps 3

Installing Nocle.js Packages 6

Testing the Build with a Basic Program 6

Troubleshooting 6

A Simple Driving Program 8

Troubleshooting 9

Cutting the Cord 10

Building a Wireless SimpleBot 10

Wiring Up 10

Controlling the SimpicBot 12

Troubleshooting 15

What's Next? 15

2 TypeBot 17

Bill of Materials 18

Understanding Your Servomotors 18

Anatomy of a Robot Arm 19

Arm Layout 19

Arm Constraints 20

Building the Hardware 20

The Base and Shoulder 20

The Elbow 21

The Wrist 22

The Finger 23

The Brains 24

Writing the Software 24

Creating the Project Files 24

Controlling the Servos 24

Initialization 28

Sequencing a Key Press 29

Running for the First Time 32

Fine-Tuning the Arm 32

What's Next? 33

3 Getting Started with NodeBoats 35

Bill of Materials 36

Tools 37

The Submarine Motor Pod 37

Why Use a Motor Driver? 37

Motor Pod Components 37

Modifying the Motor 38

Testing the Motor 39

Finishing the Motor 39

Inserting the Motor 40

Drilling into the Motor Pod 41

Closing the Motor Pod 42

Waterproofing Your Wires 42

Setting Up Your Spark 43

Testing the Spark 43

Your First Spark Program 44

Soldering the Motor Driver 45

Wiring Up Your Boat 46

Powering the Motor Driver 47

Connecting the Spark and the Motor Oliver 47

Connecting the Motor 48

Controlling Your Motor: The Code 49

Adding Keypress Events 50

Storing Keypress Stale 50

Floating the Boat 52

Steering with Servos 53

Programming Servo Control 54

Assembling the Rudder 56

Setting Sail 57

What's Next? 57

4 piDuino5 Mobile Robot Platform 59

Bill of Materials 60

Tools 61

Setting Up me Boards and Installing Software 61

Installing Models on the Raspberry Pi 61

Downloading the piDuino5 Code and Dependencies 61

Plug in the Arduino 62

Test Johnny-Five over WebSockets 62

Walk Through app.js 62

Initializing Johnny-Five 63

Controlling the Hardware 63

Low-Latency Control with WebSockets 63

Connect from Anywhere 64

Assemble the Hardware 64

Controlling with a Smart phone 65

Downloading the piDuino5 Web App 65

Post localtunnel to the Web App 66

Try the Web App on a Phone 67

Walk Through app.js and index.html 68

Storing the localtunnel Address and Frontend 68

Serving the Ul 68

Touchscreen Joystick 68

Establishing a Connection 68

Sending Commands 68

What's Next? 69

5 Controlling a Hexapod with Johnny-Five 71

Bill of Materials 71

Controlling the Robot from the Command Line 72

An Introduction to phoenix.js 72

Assembling the Robot 74

Prepare the Chassis 74

Mount the Electronics 74

Prepare the Servos 75

Installing the coxae 76

Installing the Femurs 77

Installing the Tibias 77

The Coordinate System 78

Trim the Servos 78

Trim the coxae 78

Trim the Femurs 79

Trim the Tibias 79

Add Ranges to the Servos 80

Walking Is Hard! 81

Meet the Animation Class 81

An Array of Servos as the Target 82

A Servo.Array as the Target 82

An Array of Servo.Arrays as the Target 82

The First Animation Segment 83

Walking 85

The Row Gait 86

The Walk Gait 86

The Run Gait 87

Turning 87

Command Reference 88

What's Next? 88

6 Building Voice-Controlled NodeBots 89

Bill of Materials 89

BeagleBone Black 91

Budding Our Project 92

Building a Relay Circuit 92

Controlling the Relay Circuit from Johnny-Five 93

Building a Microphone Preamplifier Circuit 93

Connecting the Microphone to the Relay from Johnny-Five 94

Building the Commands Server 95

Simple Voice Control Using the Web Speech API 97

Integrate the Commands Server with the Relay Circuit 99

Advanced Voice Control Using an Android Wearable 100

Android Mobile Application 101

Androsd Wear Application 105

What's Next? 108

7 An Indoor Sundial 111

Bill of Materials 112

Foam Core Structural Pieces 114

Building Our Sundial 115

Cutting and Assembling the Core Structure 115

Assemble the Mounting Board 115

Wiring and Configuring the Servos 116

Wiring the Servos 116

Configuring the Servos 117

Building the Lower Base 118

Making the Disks 119

Build the Base Walls and Base Disk Support 120

Build the Base Walls 120

Position the Disks 120

Build the Disk Support 121

Finish Parts and Construction 123

Build the Azimuth Arm 124

Construct the Elevation Arc 125

Cut a Gnomon 125

Wire Up the Sun 125

Code to Make It Go 126

Understanding sundial.js 126

Set Up Some Configuration in sundial.js 127

Sundial.js Details 128

Putting it All Together! 130

Making It Go! 131

What's Next? 131

8 Spooky Lights 133

Bill of Materials 133

Choosing a Controller Board 135

Background 135

What's an LED Matrix? 135

Assembling the Lights 136

Tools Required 136

Preparing the Matrices 136

Constructing a Cable Assembly 138

Decorating the Lights 142

Troubleshooting 142

Controlling an LED matrix 142

Preparing the Arduino 142

Running a Test Program 143

Matrix Constructor Options 143

Drawing to the Matrix 143

Developing a Web Application 144

Development Tools 144

Using the Express Generator 144

Developing an API 145

Adding a User Interface 146

Extending the Application 147

What's Next? 147

9 Cheerful J5 149

Bill of Materials 149

Wiring the Circuit 151

The CheerfulJ5 code 151

Connecting to the Arduino 151

Controlling an RGB 152

Using the Node.js Read-Eval-Print Loop 153

Denning the CheerLights Color Map 153

Accessing the CheerLights ThingSpeak API 154

Using the Twitter Streaming API 157

Going Wireless with the Spark WiFi Development Kit 159

Adding the Spark to Your Circuit 159

Using the Spark-io IO Plugin 160

Switching to Battery Power 161

Packaging It Up 161

What's Next? 162

10 Interactive RGB LED Display with BeagleBone Black 163

Bill of Materials 164

BeagleBone Black 164

WiFi USB Adapter (optional) 164

External 5V Power Supply (Semi-Optional) 164

RGB LEDs 165

Sensors 165

Miscellaneous 165

Getting Ready: Software 165

LEDScape 165

Wiring Your LEDs 166

Wiring Up Your RGB LEDs 166

Code Time! Let's Bring in the JavaScript 168

Running a Test Script 169

Adding in Johnny-Five/Beaglebone-io 171

Adding a Photoresistor 173

Changing Colors with an Accelerometer 173

What's Next? 174

11 Physical Security, JavaScript, and You 179

Simple Ultrasonic Sensor Project: Experimental Control Test (SUSPECT) 180

Implementation 180

SMS Augmented Ultrasonic Sensor Application: General Experimentation (SAUSAGE) 183

Implementation 184

Point-of-Entry Monitoring System (PoEMS) 185

Implementation 185

Lasers Impress Both Enemies and Relatives, Thank You (LIBERTY) 186

Implementation 186

Status indicator Necessary, Buttons and Diodes (SINBaD) 188

Implementation 189

What's Next? 192

12 Artificial Intelligence: BatBot 193

Artificial Intelligence: The Basics 193

Remote-Controlled Robots 194

Semi-Autonomous Robots 194

Autonomous Robots 194

BatBot 194

Bill of Materials 195

Some Notes About the Materials 196

Assembly 196

Step 1 Remote Control 198

Moving the Robot 198

Controlling the Robot 200

Pointing and Reading from the Sonar 201

Step 2 Autonomy 202

Implementing the Algorithm 203

Troubleshooting 206

What's Next? 206

13 Delta Robots and Kinematics 209

Bill of Materials 210

Delta Anatomy 211

Building Junky Delta 212

Making It Move 216

Predictable Positioning Through Kinematics 218

More Sophisticated Delta Options 222

TapsterBot 222

Robot Army 222

What's Next? 223

14 Meow Shoes 225

Bill of Materials 225

Parts Explained 227

Making the Sensor Inserts 228

Solder the Sensors to the Wiring 228

Install Sensors into the Shoes 229

Tunnel the Wiring out of the Shoe 229

Connecting the Shoes 230

Prepare the Coiled Connector Cord 230

Connect the Shoes to an Arduino 232

Prepare Wiring 232

Arduino Soidering 233

Attach the Arduino to the Right Shoe 233

Running the Code with Johnny-Five 233

Connecting to Johnny-Five 233

Setting up Sensors 234

Logging Output of Sensors 234

Example Behavior 235

What's Next? 236

Appendix A Appendix 237

Index 243

Customer Reviews

Most Helpful Customer Reviews

See All Customer Reviews