Hands-on robotics with JavaScript build robotic projects using Johnny-five and control hardware with Javascript and Raspberry Pi

Leverage Raspberry Pi 3 and different JavaScript platforms to build exciting Robotics projects Key Features Build robots that light up and make noise Learn to work with Raspberry Pi 3 and JavaScript Connect your Johnny-Five projects to external APIs and create your own IoT Book Description There has...

Full description

Bibliographic Details
Other Authors: Perch, Kassandra, author (author)
Format: eBook
Language:Inglés
Published: Birmingham ; Mumbai : Packt 2018.
Edition:1st edition
Subjects:
See on Biblioteca Universitat Ramon Llull:https://discovery.url.edu/permalink/34CSUC_URL/1im36ta/alma991009630704706719
Table of Contents:
  • Cover
  • Title Page
  • Copyright and Credits
  • Dedication
  • Packt Upsell
  • Contributors
  • Table of Contents
  • Preface
  • Chapter 1: Setting Up Your Development Environment
  • Technical requirements
  • What is the Raspberry Pi?
  • Microcontrollers
  • General-Purpose Input/Output (GPIO) pins
  • Debian and Raspbian
  • Johnny-Five and Raspi-IO
  • So, the Pi is technically a microcontroller...
  • ...but it is also a computer!
  • How we will use the Raspberry Pi
  • Taking advantage of all that the Raspberry Pi has to offer!
  • Johnny-Five - letting us code hardware in Node.js
  • Installing the operating system
  • Downloading Raspbian Lite
  • Burning the image to an SD card
  • Editing files on the SD card
  • Booting up the Pi
  • SSHing from a Linux or Mac
  • SSHing from Windows
  • Setting up your password and hardware interfaces
  • First things first - change your password!
  • Updating the Raspberry Pi
  • Turning on the hardware interfaces
  • Installing Node.js, Johnny-Five, and Raspi-IO
  • Installing Node.js and npm
  • Detecting your version of ARM processor
  • Installing Johnny-Five and Raspi-IO
  • Summary
  • Questions
  • Further reading
  • Chapter 2: Creating Your First Johnny-Five Project
  • Technical requirements
  • Creating a project folder
  • Setting up npm to manage our modules
  • Getting started with Johnny-Five and Raspi-IO
  • Gathering resources and documentation
  • Taking a look at the LED-blink project
  • Raspberry Pi pin numbers
  • Wiring up an LED
  • Putting together and attaching the cobbler
  • Attaching the resistor and LED
  • Making the LED blink
  • Putting your code on the Raspberry Pi
  • Running your code
  • Summary
  • Questions
  • Further reading
  • Chapter 3: Building Interactive Projects with RGB LED
  • Technical requirements
  • Looking at the LED and LED.RGB API
  • The LED object
  • The Led.RGB object.
  • PWM pins and GPIO expanders
  • How do PWM pins work?
  • Why we need a GPIO expander
  • Wiring up our GPIO expander and RGB LED
  • Bringing in other node packages
  • Project - building a rainbow
  • Using the color npm module
  • Getting our Johnny-Five code started
  • The REPL - a powerful tool in Johnny-Five
  • How does the REPL work?
  • Adding our RGB LED to the REPL
  • Controlling our LED from the command-line interface
  • Summary
  • Questions
  • Further reading
  • Chapter 4: Bringing in Input with Buttons
  • Technical requirements
  • Using inputs in robotics projects
  • Digital versus analog input
  • How to handle analog input with the Raspberry Pi
  • Analog GPIO expanders
  • Using input devices with digital interfaces
  • How Johnny-Five handles input
  • The structure of a typical Johnny-Five project
  • The beginning - including libraries and creating our board object
  • The board ready event handler
  • Constructing our component objects
  • Input event handlers and output device manipulation
  • The Johnny-Five button object
  • The button object
  • Button events
  • Wiring up buttons
  • Putting a button on a breadboard
  • Using a pull-down resistor
  • Adding buttons to our RGB LED project
  • Wiring everything up
  • Using the power and ground side rails
  • Wiring up the buttons
  • Button 1 - stop and start rainbow
  • Refactoring the rainbow cycle
  • Button 2 - next color
  • Summary
  • Questions
  • Further reading
  • Chapter 5: Using a Light Sensor to Create a Night-Light
  • Technical requirements
  • Using an analog sensor with the Pi
  • Finding the right sensors for your Pi project
  • I2C devices
  • SPI
  • How to determine if your sensor will work with Johnny-Five
  • The ambient light sensor
  • Wiring up the sensor
  • Writing a program to get readings and print them to the command line
  • The Johnny-Five sensor events.
  • Handling sensor data in the event handler
  • Using and formatting Johnny-Five sensor data
  • Using .scaleTo() and .fscaleTo() to fine-tune measurements
  • Printing sensor data to the command line
  • Using barcli to make the data easier to see
  • Importing barcli and constructing our barcli graph
  • Getting the bar graph to update
  • Creating our night-light
  • Wiring up the LED
  • Coding this project
  • Summary
  • Questions
  • Further reading
  • Chapter 6: Using Motors to Move Your Project
  • Technical requirements
  • More about motors
  • How to control a motor with a microcontroller
  • Preparing for a motor-driven project with Raspberry Pi
  • Putting the hat together
  • Putting the hat on the Pi
  • The Johnny-Five motor object
  • Constructors for our hat
  • Functions that move the motor
  • Adding REPL control
  • Loading and running your motor
  • Troubleshooting your motorized projects
  • Project - cat toy
  • Putting a piece of paper on the motor shaft
  • Coding the randomness to start/stop the motor
  • Project - using two gearbox motors and the motors object
  • Wiring up your TT motors
  • The motors Johnny-Five object
  • Writing some functions
  • Running our motors project
  • Summary
  • Questions
  • Chapter 7: Using Servos for Measured Movement
  • Technical requirements
  • Differences between motors and servos
  • Calculated movements
  • Regular versus continuous servos
  • Powering servos and motors
  • Getting a servo working with Johnny-Five
  • The Johnny-Five servo object
  • Wiring the servo to our PWM hat
  • Coding your first servo sweep
  • Project - two servos and the REPL
  • Wiring up a second servo
  • Using the Johnny-Five servos object
  • Adding the Servos object to our code
  • Adding in REPL functionality
  • Playing with our servos on the command line
  • Project - light meter with the servo
  • Adding in the light sensor.
  • Making the servo into a meter
  • Coding the project
  • Running and using our light meter
  • Project - the continuous servo
  • Wiring up the servo
  • Continuous servo constructor and methods
  • Using the REPL with the continuous servo
  • Playing with the continuous servo in the REPL
  • Summary
  • Questions
  • Chapter 8: The Animation Library
  • Technical requirements
  • Animating movement
  • Why we need the animation library
  • Moving servos with true precision
  • Implicit use of the animation library
  • Using servo.to() to implicitly create an animation
  • Playing with implicit animations
  • Playing with implicit animations, take two
  • The terminology of the animation library
  • The construction of the animation object
  • Creating the animation object
  • Planning out the animation sequence
  • Creating keyframes
  • Using null and false as positions in keyframes
  • Programming our keyframes
  • Setting cue points and duration
  • Putting it all together to make an animation
  • Watching your animation at work
  • Easing into your servo animations
  • How easing fits into an animation segment
  • Adding easing to our first animation
  • Easing an entire animation segment
  • Learning more about queuing and playing animation segments
  • Looping animation segments
  • Changing the speed of animation segments
  • Playing, pausing, and stopping animation segments
  • Tying it all together in the REPL
  • Summary
  • Questions
  • Chapter 9: Getting the Information You Need
  • Technical requirements
  • Why connect your NodeBots to the internet?
  • Using the power of npm modules
  • Using the data you collect
  • Some things to keep in mind
  • Getting weather data on our Pi with OpenWeatherMap
  • Getting an OpenWeatherMap API key
  • Bringing in request
  • Parsing the response
  • Building a weather dashboard with an LCD
  • Adding an LCD to the Pi
  • The LCD object.
  • Constructing our LCD
  • Setting up the LCD
  • Printing to and clearing the LCD
  • Coding it all together
  • Project - scraping data from websites with your Pi
  • Scraping downforeveryoneorjustme.com for johnny-five.io
  • Making the HTTP request
  • Using Cheerio to get the element we want
  • Parsing the HTML and showing the result
  • Summary
  • Questions
  • Further reading
  • Chapter 10: Using MQTT to Talk to Things on the Internet
  • Technical requirements
  • IoT device communications
  • Long polling
  • Websockets
  • MQTT - an IoT PubSub protocol
  • The basics of MQTT
  • Setting up MQTT on the Pi with AdafruitIO
  • Creating an account and a feed
  • Subscribing to the feed using the mqtt npm module
  • The mqtt module
  • The dotenv module
  • Testing our connection
  • Project - adding an LCD and button to see and send MQTT events
  • Wiring it all up
  • Coding it all together
  • Project - social media notifier bot with IFTTT
  • Getting started with IFTTT
  • Linking IFTTT to Adafruit
  • Setting up feeds for your social media MQTT messages in AdafruitIO
  • Creating our IFTTT Applets
  • Wiring up our project
  • Coding our social media notifications to show on the LCD
  • Running your social media bot
  • Summary
  • Questions
  • Further reading
  • Chapter 11: Building a NodeBots Swarm
  • Technical requirements
  • Project - connecting multiple NodeBots
  • Optional - setting up a second Raspberry Pi
  • Setting up your project files and folders
  • If you're using one Pi
  • If you're using two Pis
  • Adding a light sensor to the Pi
  • Creating an MQTT broker on the Pi
  • Programming the MQTT client - have the Pi Report Home
  • If you're using one Pi
  • If you're using two Pis
  • Running our MQTT project
  • If you're using one Pi
  • If you're using two Pis
  • Expanding your NodeBots knowledge
  • Using Johnny-Five on other boards
  • Figuring out pin numbers.
  • Checking the platform support page.