Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Hands-On Robotics with JavaScript

You're reading from   Hands-On Robotics with JavaScript Build robotic projects using Johnny-Five and control hardware with JavaScript and Raspberry Pi

Arrow left icon
Product type Paperback
Published in Aug 2018
Publisher Packt
ISBN-13 9781789342055
Length 214 pages
Edition 1st Edition
Languages
Concepts
Arrow right icon
Author (1):
Arrow left icon
Kassandra Perch Kassandra Perch
Author Profile Icon Kassandra Perch
Kassandra Perch
Arrow right icon
View More author details
Toc

Table of Contents (19) Chapters Close

Title Page
Dedication
Packt Upsell
Contributors
Preface
1. Setting Up Your Development Environment FREE CHAPTER 2. Creating Your First Johnny-Five Project 3. Building Interactive Projects with RGB LED 4. Bringing in Input with Buttons 5. Using a Light Sensor to Create a Night-Light 6. Using Motors to Move Your Project 7. Using Servos for Measured Movement 8. The Animation Library 9. Getting the Information You Need 10. Using MQTT to Talk to Things on the Internet 11. Building a NodeBots Swarm 1. Assessments 2. Other Books You May Enjoy Index

Index

A

  • Adafruit
    • reference / Project – using two gearbox motors and the motors object
  • AdafruitIO
    • Message Queuing Telemetry Transport (MQTT), setting up / Setting up MQTT on the Pi with AdafruitIO
    • reference / Creating an account and a feed
  • AdafruitIO dashboard
    • LCD, adding / Project – adding an LCD and button to see and send MQTT events
    • MQTT events, viewing with LCD / Project – adding an LCD and button to see and send MQTT events
    • MQTT events, sending with button / Project – adding an LCD and button to see and send MQTT events
    • LCD, wiring up / Wiring it all up
    • button, wiring up / Wiring it all up
    • client constructor, adding / Coding it all together
  • ambient light sensor
    • about / The ambient light sensor
    • wiring up / Wiring up the sensor
    • SCL pins / Wiring up the sensor
    • SDA pins / Wiring up the sensor
    • readings, obtaining / Writing a program to get readings and print them to the command line
    • readings, printing to command line / Writing a program to get readings and print them to the command line
    • Johnny-Five sensor events / The Johnny-Five sensor events
    • sensor data, handling in event handler / Handling sensor data in the event handler
    • Johnny-Five sensor data, using / Using and formatting Johnny-Five sensor data
    • Johnny-Five sensor data, formatting / Using and formatting Johnny-Five sensor data
    • .scaleTo() function, using / Using .scaleTo() and .fscaleTo() to fine-tune measurements
    • .fscaleTo() function, using / Using .scaleTo() and .fscaleTo() to fine-tune measurements
    • data, printing to command line / Printing sensor data to the command line
    • barcli, using / Using barcli to make the data easier to see
    • barcli, importing / Importing barcli and constructing our barcli graph
    • barcli graph, constructing / Importing barcli and constructing our barcli graph
    • bar graph, obtaining / Getting the bar graph to update
  • analog input
    • versus digital input / Digital versus analog input
    • handling, with Raspberry Pi / How to handle analog input with the Raspberry Pi
    • analog GPIO expanders / Analog GPIO expanders
    • input devices, using with digital interfaces / Using input devices with digital interfaces
  • analog sensor
    • using / Using an analog sensor with the Pi
    • selecting / Finding the right sensors for your Pi project
    • I2C devices / I2C devices
    • SPI / SPI 
    • determining, for Johnny-Five / How to determine if your sensor will work with Johnny-Five
  • animation library
    • need for / Animating movement, Why we need the animation library
    • servos, moving with true precision / Moving servos with true precision
    • using / Implicit use of the animation library
    • servo.to() function, using / Using servo.to() to implicitly create an animation
    • implicit animations, playing with / Playing with implicit animations, Playing with implicit animations, take two
  • animation library, terminology
    • frame / The terminology of the animation library
    • keyframe / The terminology of the animation library
    • cue point / The terminology of the animation library
    • duration / The terminology of the animation library
    • tweening / The terminology of the animation library
    • easing / The terminology of the animation library
  • animation object
    • constructing / The construction of the animation object
    • creating / Creating the animation object
    • animation sequence, planning out / Planning out the animation sequence
    • keyframes, creating / Creating keyframes
    • null and false, using as positions in keyframes / Using null and false as positions in keyframes
    • keyframes, programming / Programming our keyframes 
    • cue points, setting / Setting cue points and duration
    • duration, setting / Setting cue points and duration
    • animation, implementing / Putting it all together to make an animation
    • animation, viewing / Watching your animation at work
  • animation segments
    • queuing / Learning more about queuing and playing animation segments
    • playing / Learning more about queuing and playing animation segments, Playing, pausing, and stopping animation segments
    • looping / Looping animation segments
    • speed, modifying / Changing the speed of animation segments
    • pausing / Playing, pausing, and stopping animation segments
    • stopping / Playing, pausing, and stopping animation segments
    • implementing, in REPL / Tying it all together in the REPL
  • ARM processor
    • version, detecting / Detecting your version of ARM processor

B

  • breadboard
    • reference / Putting together and attaching the cobbler
  • button object, Johnny-Five
    • about / The Johnny-Five button object, The button object
    • events / Button events
  • buttons
    • wiring up / Wiring up buttons
    • placing, on breadboard / Putting a button on a breadboard
    • pull-down resistor, using / Using a pull-down resistor
    • adding, to RGB LED project / Adding buttons to our RGB LED project

C

  • cat toy project
    • creating / Project – cat toy
    • sticky note, putting on motor shaft / Putting a piece of paper on the motor shaft
    • randomness, coding to start/stop motor / Coding the randomness to start/stop the motor
  • color npm module
    • using / Using the color npm module
  • continuous servo project
    • creating / Project – the continuous servo
    • wiring up / Wiring up the servo
    • continuous servo constructor / Continuous servo constructor and methods
    • methods / Continuous servo constructor and methods
    • REPL, using / Using the REPL with the continuous servo
    • playing, with continuous servo in REPL / Playing with the continuous servo in the REPL
  • continuous servos
    • versus regular servos / Regular versus continuous servos

D

  • Debian / Debian and Raspbian
  • digital input
    • versus analog input / Digital versus analog input
  • downforeveryoneorjustme.com
    • reference / Scraping downforeveryoneorjustme.com for johnny-five.io

E

  • ease-component
    • reference / How easing fits into an animation segment
  • Espruino ecosystem
    • about / The Espruino ecosystem
    • reference / The Espruino ecosystem
  • Etcher
    • about / Burning the image to an SD card
    • reference / Burning the image to an SD card

G

  • general-purpose input/output (GPIO) pins / General-Purpose Input/Output (GPIO) pins
  • GPIO expander
    • need for / Why we need a GPIO expander
    • wiring up, with RGB LED / Wiring up our GPIO expander and RGB LED
  • group servos, with REPL
    • building / Project – two servos and the REPL
    • wiring up / Wiring up a second servo
    • Johnny-Five servos object, using / Using the Johnny-Five servos object
    • Servos object, adding / Adding the Servos object to our code
    • adding, in REPL functionality / Adding in REPL functionality

H

  • hardware interfaces
    • setting up / Setting up your password and hardware interfaces
    • turning on / Turning on the hardware interfaces

I

  • I2C devices / I2C devices
  • IFTTT
    • social media notifier bot, building / Project – social media notifier bot with IFTTT
    • about / Getting started with IFTTT
    • reference / Getting started with IFTTT
    • linking, to Adafruit / Linking IFTTT to Adafruit
  • inputs
    • using, robotics projects / Using inputs in robotics projects
    • digital input, versus analog input / Digital versus analog input
    • handling, for Johnny-Five / How Johnny-Five handles input
  • IoT device, communications
    • options / IoT device communications
    • long polling / Long polling
    • websockets / Websockets

J

  • Johnny-Five
    • about / Johnny-Five and Raspi-IO
    • hardware, coding in Node.js / Johnny-Five – letting us code hardware in Node.js
    • installing / Installing Node.js, Johnny-Five, and Raspi-IO, Installing Johnny-Five and Raspi-IO
    • exploring / Getting started with Johnny-Five and Raspi-IO
    • reference / Gathering resources and documentation
    • inputs, handling / How Johnny-Five handles input
    • structure / The structure of a typical Johnny-Five project
    • libraries, including / The beginning – including libraries and creating our board object
    • board object, creating / The beginning – including libraries and creating our board object
    • board ready event handler / The board ready event handler
    • component objects, constructing / Constructing our component objects
    • output device manipulation / Input event handlers and output device manipulation
    • input event handlers / Input event handlers and output device manipulation
    • button object / The Johnny-Five button object
  • Johnny-Five motor object
    • coding / The Johnny-Five motor object
    • constructors / Constructors for our hat
    • functions, implementing / Functions that move the motor
    • REPL control, adding / Adding REPL control
    • loading / Loading and running your motor
    • executing / Loading and running your motor
  • Johnny-Five servo
    • wiring / Getting a servo working with Johnny-Five
    • Johnny-Five servo object / The Johnny-Five servo object
    • wiring, to PWM hat / Wiring the servo to our PWM hat
    • coding, to sweep / Coding your first servo sweep

L

  • LED
    • wiring up / Wiring up an LED
    • cobbler, attaching / Putting together and attaching the cobbler
    • cobbler, connecting together / Putting together and attaching the cobbler
    • resistor, attaching / Attaching the resistor and LED
  • LED-blink project
    • building / Taking a look at the LED-blink project
    • Raspberry Pi pin numbers / Raspberry Pi pin numbers
    • code, installing on Raspberry Pi / Putting your code on the Raspberry Pi
    • code, executing / Running your code
  • Led.RGB object / The Led.RGB object
  • LED object
    • about / The LED object
    • reference / The LED object
  • light meter, with servo
    • project, building / Project – light meter with the servo
    • light sensor, adding / Adding in the light sensor
    • servo, wiring into meter / Making the servo into a meter
    • project, coding / Coding the project
    • executing / Running and using our light meter
    • using / Running and using our light meter
  • Linux
    • Raspberry Pi, booting up with SSH / SSHing from a Linux or Mac
  • long polling / Long polling

M

  • Mac
    • Raspberry Pi, booting up with SSH / SSHing from a Linux or Mac
  • Message Queuing Telemetry Transport (MQTT)
    • about / MQTT - an IoT PubSub protocol
    • MQTT message / The basics of MQTT
    • MQTT client / The basics of MQTT
    • MQTT broker / The basics of MQTT
    • setting up, with AdafruitIO / Setting up MQTT on the Pi with AdafruitIO
    • feed, creating / Creating an account and a feed
    • account, creating / Creating an account and a feed
    • feed, subscribing with mqtt npm module / Subscribing to the feed using the mqtt npm module
    • connection, testing / Testing our connection
  • microcontroller
    • about / Microcontrollers
    • motors, controlling / How to control a motor with a microcontroller
  • mosquitto / MQTT - an IoT PubSub protocol
  • motor-driven project
    • preparing, with Raspberry Pi / Preparing for a motor-driven project with Raspberry Pi
    • wiring up / Putting the hat together
    • implementing, on Pi / Putting the hat on the Pi
  • motorized projects
    • troubleshooting / Troubleshooting your motorized projects
  • motors
    • about / More about motors
    • DC motor / More about motors
    • with brakes / More about motors
    • stepper motors / More about motors
    • controlling, with microcontroller / How to control a motor with a microcontroller
  • motors, versus servos
    • about / Differences between motors and servos
    • calculated movements / Calculated movements
    • regular, versus continuous servos / Regular versus continuous servos
    • powering / Powering servos and motors
  • mqtt npm module
    • feed, subscribing / Subscribing to the feed using the mqtt npm module
    • mqtt module / The mqtt module
    • dotenv module / The dotenv module 

N

  • night-light
    • creating / Creating our night-light
    • LED, wiring up / Wiring up the LED
    • coding / Coding this project
  • Node-RED
    • programming, graphically / Programming graphically with Node-RED
  • Node.js
    • benefits, in coding robotics projects / Johnny-Five – letting us code hardware in Node.js
    • installing / Installing Node.js, Johnny-Five, and Raspi-IO, Installing Node.js and npm
    • reference / Installing Node.js and npm, Detecting your version of ARM processor
  • NodeBots
    • connecting, to internet / Why connect your NodeBots to the internet?
    • npm modules, using / Using the power of npm modules
    • collected data, using / Using the data you collect
    • considerations / Some things to keep in mind, Continuing on your NodeBots adventure, Figuring out what to build
    • multiple NodeBots, connecting / Project – connecting multiple NodeBots
    • Raspberry Pi, setting up / Optional – setting up a second Raspberry Pi
    • folders, setting up / Setting up your project files and folders
    • project files, setting up / Setting up your project files and folders
    • client and broker folders, moving to Pi / If you're using one Pi
    • with multiple Pi / If you're using two Pis
    • light sensor, adding to Pi / Adding a light sensor to the Pi
    • MQTT broker, creating on Pi / Creating an MQTT broker on the Pi
    • MQTT client, programming / Programming the MQTT client – have the Pi Report Home
    • .env file, creating / If you're using one Pi
    • MQTT client, programming for multiple Pi / If you're using two Pis
    • MQTT project, executing / Running our MQTT project
    • MQTT project, executing for single Pi / If you're using one Pi
    • MQTT project, executing with multiple Pi / If you're using two Pis
    • enhancing / Expanding your NodeBots knowledge
    • Johnny-Five, using on other boards / Using Johnny-Five on other boards
    • pin numbers, figuring out / Figuring out pin numbers
    • platform support page, checking / Checking the platform support page
    • node robotics platforms / Other node robotics platforms
    • community / Reaching out to the NodeBots community
    • resources / Where to go to learn more about Electronics
  • node packages
    • using / Bringing in other node packages
    • color npm module, using / Using the color npm module
  • node robotics platforms
    • Tessel 2 / The Tessel 2
    • Espruino ecosystem / The Espruino ecosystem
  • npm
    • installing / Installing Node.js and npm
    • setting up, to manage modules / Setting up npm to manage our modules

O

  • OpenWeatherMap
    • weather data, obtaining on Pi / Getting weather data on our Pi with OpenWeatherMap
    • reference / Getting an OpenWeatherMap API key
    • API key, obtaining / Getting an OpenWeatherMap API key
    • request, handling / Bringing in request
    • response, parsing / Parsing the response
  • operating system
    • installing / Installing the operating system
    • Raspbian Lite, downloading / Downloading Raspbian Lite

P

  • password
    • setting up / Setting up your password and hardware interfaces
    • modifying / First things first – change your password!
  • Pi Cobbler / Technical requirements
  • Pi Wedge / Technical requirements
  • project folder
    • creating / Creating a project folder
    • npm, setting up to manage modules / Setting up npm to manage our modules
  • pull-down resistor
    • using / Using a pull-down resistor
  • PuTTY
    • reference / SSHing from Windows
  • PWM pins / How do PWM pins work?

R

  • rainbow project
    • building / Project – building a rainbow
    • coding, with Johnny-Five / Getting our Johnny-Five code started
    • stopping / Button 1 – stop and start rainbow 
    • starting / Button 1 – stop and start rainbow 
    • rainbow cycle, refactoring / Refactoring the rainbow cycle
    • button, adding for color / Button 2 – next color
  • Raspberry Pi
    • about / What is the Raspberry Pi?, So, the Pi is technically a microcontroller...
    • microcontroller / Microcontrollers
    • general-purpose input/output (GPIO) pins / General-Purpose Input/Output (GPIO) pins
    • Raspbian / Debian and Raspbian
    • Debian / Debian and Raspbian
    • Johnny-Five / Johnny-Five and Raspi-IO
    • Raspi-IO / Johnny-Five and Raspi-IO
    • advantages / ...but it is also a computer!, Taking advantage of all that the Raspberry Pi has to offer!
    • used, for building robotics projects / How we will use the Raspberry Pi
    • booting up / Booting up the Pi
    • booting, via SSH from Linux or Mac / SSHing from a Linux or Mac
    • booting, via SSH from Windows / SSHing from Windows
    • updating / Updating the Raspberry Pi
    • ARM processor version, detecting / Detecting your version of ARM processor
    • analog input, handling / How to handle analog input with the Raspberry Pi
    • motor-driven project, preparing / Preparing for a motor-driven project with Raspberry Pi
  • Raspbian / Debian and Raspbian
  • Raspbian Lite
    • reference / Downloading Raspbian Lite
    • downloading / Downloading Raspbian Lite
    • image, burning to SD card / Burning the image to an SD card
    • files, editing on SD card / Editing files on the SD card
  • Raspi-IO
    • about / Johnny-Five and Raspi-IO
    • installing / Installing Node.js, Johnny-Five, and Raspi-IO, Installing Johnny-Five and Raspi-IO
    • exploring / Getting started with Johnny-Five and Raspi-IO
    • reference / Gathering resources and documentation
  • read–eval–print loop (REPL)
    • about / The REPL – a powerful tool in Johnny-Five
    • functioning / How does the REPL work?
    • RGB LED, adding / Adding our RGB LED to the REPL
    • LED, controlling from command-line interface / Controlling our LED from the command-line interface
  • regular servos
    • versus continuous servos / Regular versus continuous servos
  • resistor
    • LED, attaching / Attaching the resistor and LED
  • RGB LED project
    • using / Looking at the LED and LED.RGB API
    • GPIO expander, wiring up / Wiring up our GPIO expander and RGB LED
    • buttons, adding / Adding buttons to our RGB LED project
    • buttons, wiring up / Wiring everything up, Wiring up the buttons
    • power, using / Using the power and ground side rails
    • ground side rails, using / Using the power and ground side rails
  • robotics projects
    • inputs, using / Using inputs in robotics projects

S

  • SD card
    • image, burning / Burning the image to an SD card
    • files, editing / Editing files on the SD card
  • servo animations
    • easing into / Easing into your servo animations
    • easing functions, adding / How easing fits into an animation segment
    • easing, adding / Adding easing to our first animation
    • animation segment, easing / Easing an entire animation segment
  • servos, versus motors
    • about / Differences between motors and servos
    • calculated movements / Calculated movements
    • regular, versus continuous servos / Regular versus continuous servos
    • powering / Powering servos and motors
  • social media notifier bot
    • building, with IFTTT / Project – social media notifier bot with IFTTT
    • feeds, setting up for MQTT messages in AdafruitIO / Setting up feeds for your social media MQTT messages in AdafruitIO
    • IFTTT Applets, creating / Creating our IFTTT Applets
    • project, wiring up / Wiring up our project
    • notifications, displaying on LCD / Coding our social media notifications to show on the LCD
    • executing / Running your social media bot
  • SPI / SPI 
  • Stretch / Debian and Raspbian

T

  • Tessel 2
    • about / The Tessel 2
    • reference / The Tessel 2
  • two-wheeled robot
    • gearbox motors, using / Project – using two gearbox motors and the motors object
    • motors object, using / Project – using two gearbox motors and the motors object
    • TT motors, wiring up / Wiring up your TT motors
    • motors Johnny-Five object / The motors Johnny-Five object
    • functions, writing / Writing some functions
    • motors project, executing / Running our motors project

W

  • weather dashboard
    • building, with LCD / Building a weather dashboard with an LCD
    • LCD, adding to Pi / Building a weather dashboard with an LCD
    • LCD object, using / The LCD object
    • LCD, constructing / Constructing our LCD
    • LCD, setting up / Setting up the LCD
    • LCD, clearing / Printing to and clearing the LCD
    • data, printing on LCD / Printing to and clearing the LCD
    • coding / Coding it all together
  • weather data
    • obtaining, on Pi with OpenWeatherMap / Getting weather data on our Pi with OpenWeatherMap
  • web scraping
    • with Pi / Project – scraping data from websites with your Pi
    • downforeveryoneorjustme.com, scraping for johnny-five.io / Scraping downforeveryoneorjustme.com for johnny-five.io
    • HTTP request, creating / Making the HTTP request
    • element, obtaining with Cheerio / Using Cheerio to get the element we want
    • result, displaying / Parsing the HTML and showing the result
    • HTML, parsing / Parsing the HTML and showing the result
  • websockets / Websockets
  • Windows
    • Raspberry Pi, booting up with SSH / SSHing from Windows
  • WinSCP
    • reference / Putting your code on the Raspberry Pi
lock icon The rest of the chapter is locked
arrow left Previous Section
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime
Visually different images