Skip to content

markwest1972/johnny_five_intro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Johnny-Five Introduction Workshop

This is a set of exercises for a 2-3 hour workshop I will be running in Spring/Summer 2015. The workshop is aimed at introducing attendees to Arduino, Johnny-Five, Node.js and Javascript.

In this workshop we will use the Arduino UNO, but Johnny-Five supports a range of platforms. Check out the Johnny-Five pages to find out more.

The exercises revolve mainly about using different types of sensors (input) to control different types of actuators (output). The last exercise involves using a public MQTT broker for communication between different Johnny-Five processes.

Note that code for all exercises can be found here.

This work is licensed under a Creative Commons Attribution 4.0 International License.

How Johnny-Five works

The Arduino UNO natively runs the Arduino language, which is a C++ variant. This picture shows how Johnny-Five communicates with the UNO.

Johnny-Five setup

Johnny-Five can also connect over Bluetooth and WIFI, but this requires extra equipment. To keep things cheap and simple, we'll use a serial cable for this workshop.

Requirements

This workshop is setup to require a minimum amount of hardware:

  • A Mac, Linux or Windows machine with Node.js and the Arduino IDE installed (see exercise one).
  • 1 x Arduino UNO, flashed with Firmata (see exercise two).
  • 1 x type 2 USB Cable.
  • 1 x Breadboard (if you've never used a breadboard then check out this tutorial).
  • 1 x Potentiometer.
  • 1 x Button.
  • 1 x Servo.
  • 1 x 5mm LED.
  • 1 x 330 ohm resistor (orange-orange-brown).
  • 1 x 10k ohm resistor (brown-black-orange).
  • Male-Male Jumper Leads.

Exercises

In this first exercise you will install Node.js, the Arduino IDE and optionally the Atom text editor.

In this exercise you will install Johnny-Five and use it to make the built in LED (output) on the Arduino Blink on and off at a specified interval.

In this exercise you will use Johnny-Five to dim and brighten the LED (output) by using a Button (input). In addition you will learn about how you can use the Johnny-Five REPL.

In this exercise you will expand your experience of Johnny-Five by using a Potentiometer (input) to control a Servo (output) and LED (output). You'll also learn more about the different types of Pin provided by the Arduino UNO.

In this exercise you will learn how you can utilise other Node.js modules in your Johnny-Five project. By adding adding the keypress Node.js module we'll be able to control a Servo and LED using the keyboard.

MQTT is quickly becoming the de-facto messaging standard for the Internet of Things, due to it's small footprint and simplicity. In this exercise we'll add an MQTT broker to our solution, making it possible to control our LED and Servo setup from an online MQTT client.

Further Reading

The work here draws heavily on the Arduino Experimenter's Guide for NodeJS, along with the Johnny-Five API.

You may also want to take a look at this book, by the people behind Johnny-Five : Make: JavaScript Robotics: Building NodeBots with Johnny-Five, Raspberry Pi, Arduino, and BeagleBone.

Disclaimer

This workshop is my attempt at creating a quick and simple Johnny-Five primer, based on my limited knowledge and experience with Johnny-Five, Arduino and Javascript. I am by no means an expert with any of these and welcome corrections or suggestions for improvement are most welcome.

As for the code - it's been hacked together and can easily be improved. If my code makes you want to cry, then tell me how I can make it better :)

Releases

No releases published

Packages

No packages published