Artwork by Mike Sgier
![Gitter](https://badges.gitter.im/Join Chat.svg)
Johnny-Five is an Open Source, Firmata Protocol based, IoT and Robotics programming framework, developed at Bocoup. Johnny-Five programs can be written for Arduino (all models), Electric Imp, Beagle Bone, Intel Galileo & Edison, Linino One, Pinoccio, pcDuino3, Raspberry Pi, Particle/Spark Core & Photon, Tessel 2, TI Launchpad and more!
Johnny-Five has grown from a passion project into a tool for inspiring learning and creativity for people of all ages, backgrounds, and from all across the world.
Just interested in learning and building awesome things? You might want to start with the official Johnny-Five website. The website combines content from this repo, the wiki, tutorials from the Bocoup blog and several third-party websites into a single, easily-discoverable source:
- If you want to find the API documentation, that’s right here.
- Need to figure out what platform to use for a project? We put that stuff here.
- Need inspiration for your next NodeBot? Check out the examples.
- Want to stay up-to-date with projects in the community? Check this out.
- Need NodeBots community or Johnny-Five project updates and announcements? This is what you’re looking for.
Johnny-Five does not attempt to provide "all the things", but instead focuses on delivering robust, reality tested, highly composable APIs that behave consistently across all supported hardware platforms. Johnny-Five wants to be a baseline control kit for hardware projects, allowing you the freedom to build, grow and experiment with diverse JavaScript libraries of your own choice. Johnny-Five couples comfortably with:
- Popular application libraries such as Express.js and Socket.io.
- Fellow hardware projects like ar-drone, Aerogel and Spheron
- Bluetooth game controllers like XBox Controller and DualShock
- IoT frameworks, such as Octoblu
...And that's only a few of the many explorable possibilities. Check out these exciting projects: node-pulsesensor, footballbot-workshop-ui, nodebotui, dublin-disco, node-slot-car-bot, servo-calibrator, node-ardx, nodebot-workshop, phone-home, purple-unicorn, webduino, leapduino, lasercat-workshop, simplesense, five-redbot, robotnik, the-blender
Why JavaScript? NodeBots: The Rise of JavaScript Robotics
The ubiquitous "Hello World" program of the microcontroller and SoC world is "blink an LED". The following code demonstrates how this is done using the Johnny-Five framework.
var five = require("johnny-five");
var board = new five.Board();
board.on("ready", function() {
// Create an Led on pin 13
var led = new five.Led(13);
// Blink every half second
led.blink(500);
});
Note: Node will crash if you try to run johnny-five in the node REPL, but board instances will create their own contextual REPL. Put your script in a file.
Johnny-Five has been tested on a variety of Arduino-compatible Boards.
For non-Arduino based projects, a number of platform-specific IO Plugins are available. IO Plugins allow Johnny-Five code to communicate with any non-Arduino based hardware in whatever language that platforms speaks!
Documentation for the Johnny-Five API can be found here and example programs here.
Need help? Ask a question on the NodeBots Community Forum. If you just have a quick question or are interested in ongoing design discussions, join us in the Johnny-Five Gitter Chat.
For step-by-step examples, including an electronics primer, check out Arduino Experimenter's Guide for NodeJS by @AnnaGerber
Here is a list of prerequisites for Linux, OSX or Windows.
Check out the bluetooth guide if you want to remotely control your robot.
- Recommended Starting Kit: Sparkfun Inventor's Kit
- Download Arduino IDE
- Plug in your Arduino or Arduino compatible microcontroller via USB
- Open the Arduino IDE, select: File > Examples > Firmata > StandardFirmataPlus
- StandardFirmataPlus is available in Firmata v2.5.0 or greater
- Click the "Upload" button.
If the upload was successful, the board is now prepared and you can close the Arduino IDE.
For non-Arduino projects, each IO Plugin's repo will provide its own platform specific setup instructions.
git clone git://github.com/rwaldron/johnny-five.git && cd johnny-five
npm install
Install the module with:
npm install johnny-five
To get you up and running quickly, we provide a variety of examples for using each Johnny-Five component. One thing we’re especially excited about is the extensive collection of Fritzing diagrams you’ll find throughout the site. A huge part of doing any Johnny-Five project is handling the actual hardware, and we’ve included these as part of the documentation because we realised that instructions on how to write code to control a servo are insufficient without instructions on how to connect a servo!
To interactively navigate the examples, visit the Johnny-Five examples page on the official website. If you want to link directly to the examples in this repo, you can use one of the following links.
- Basic Board initialization
- Board - Specify port
- Board - Multiple in one program
- REPL
- Board - Specify Sampling Interval
- Pin
- Expander - MCP23017
- Expander - MCP23008
- Expander - PCF8574
- Expander - PCF8575
- Expander - PCA9685
- Expander - PCF8591
- Expander - MUXSHIELD2, Digital Input and Output
- Expander - MUXSHIELD2, Analog Sensors
- LED
- LED - PCA9685
- LED - Tessel Servo Module
- LED - Blink
- LED - Pulse
- LED - Pulse with animation
- LED - Fade
- LED - Fade callback
- LED - Fade with animation
- LED - Demo sequence
- LED - Slider
- LED - Array
- LED - RGB
- LED - RGB (Common Anode)
- LED - RGB (Common Anode) PCA9685
- LED - RGB Intensity
- LED - Rainbow
- LED - Rainbow BlinkM
- LED - Digital Clock
- LED - Digital Clock, HT16K33
- LED - Digital Clock, Dual Displays
- LED - Matrix
- LED - Matrix Demo
- LED - Matrix HT16K33
- LED - Matrix HT16K33 16x8
- LED - Draw Matrix Characters Demo
- LED - Enumerate Matrix Characters & Symbols
- Servo
- Servo - PCA9685
- Servo - Tessel Servo Module
- Servo - Continuous
- Servo - Slider control
- Servo - Prompt
- Servo - Drive
- Servo - Sweep
- Servo - Array of servos
- Motor
- Motor - Directional
- Motor - Brake
- Motor - Current
- Motor - H-Bridge
- Motor - PCA9685
- Motor - GROVE_I2C_MOTOR_DRIVER
- Motor - LUDUS
- Motor - 3 pin
- Motor - EVShield EV3
- Motor - EVShield NXT
- ESC - Keypress
- ESC - Dualshock
- ESC - PCA9685
- ESC - Bidirectional
- ESC - Bidirectional Forward-Reverse
- ESC - ESC Array
- Button
- Button - Bumper
- Button - Options
- Button - Pullup
- Toggle Switch
- Button - EVShield EV3
- Button - EVShield NXT
- Shift Register
- Shift Register - Seven segment controller
- Shift Register - Seven segments, daisy chained
- Proximity
- Proximity - GP2Y0A710K0F
- Proximity - SRF10
- Proximity - MB1000
- Proximity - MB1010
- Proximity - MB1003
- Proximity - MB1230
- Proximity - HC-SR04
- Proximity - HC-SR04 I2C Backpack
- Proximity - LIDAR-Lite
- Proximity - EVShield EV3 (IR)
- Proximity - EVShield EV3 (Ultrasonic)
- Proximity - EVShield EV3 (IR)
- Proximity - EVShield EV3 (Ultrasonic)
- LCD
- LCD - Enumerate characters
- LCD - Runner 20x4
- LCD - Runner 16x2
- LCD - I2C
- LCD - I2C PCF8574
- LCD - I2C Runner
- Sensor
- Sensor - Slide potentiometer
- Sensor - Force sensitive resistor
- Sensor - Photoresistor
- Sensor - Potentiometer
- Sensor - Microphone
- Accelerometer
- Accelerometer - ADXL345
- Accelerometer - ADXL335
- Accelerometer - MMA7361
- Accelerometer - MPU6050
- Accelerometer - Pan + Tilt
- Gyro
- Gyro - Analog LPR5150AL
- Gyro - I2C MPU6050
- Temperature - TMP36
- Temperature - TMP102
- Temperature - LM35
- Temperature - LM335
- Temperature - DS18B20
- Temperature - MPU6050
- Temperature - HTU21D
- Temperature - MCP9808
- Barometer - MPL115A2
- Barometer - MPL3115A2
- Altimeter - MPL3115A2
- Temperature - MPL3115A2
- Temperature - MPL115A2
- Barometer - BMP180
- Hygrometer - HTU21D
- Temperature - BMP180
- Temperature - SI7020
- Button - EVShield EV3
- Button - EVShield NXT
- Color - EVShield EV3 (Code)
- Color - EVShield EV3 (Raw)
- Color - EVShield NXT (Code)
- Light - EVShield EV3 (Ambient)
- Light - EVShield NXT (Ambient)
- Light - EVShield EV3 (Reflected)
- Light - EVShield NXT (Reflected)
- Motor - EVShield EV3
- Motor - EVShield NXT
- Proximity - EVShield EV3 (IR)
- Proximity - EVShield EV3 (Ultrasonic)
- Intel Edison + Grove - Accelerometer (ADXL346)
- Intel Edison + Grove - Accelerometer (MMA7660)
- Intel Edison + Grove - Barometer (BMP180)
- Intel Edison + Grove - Compass (HMC588L)
- Intel Edison + Grove - Flame Sensor
- Intel Edison + Grove - LED
- Intel Edison + Grove - Light Sensor (TSL2561)
- Intel Edison + Grove - Button
- Intel Edison + Grove - Moisture Sensor
- Intel Edison + Grove - Gas (MQ2)
- Intel Edison + Grove - Air quality sensor
- Intel Edison + Grove - Joystick
- Intel Edison + Grove - Rotary Potentiometer
- Intel Edison + Grove - RGB LCD
- Intel Edison + Grove - LCD RGB temperature display
- Intel Edison + Grove - Relay
- Intel Edison + Grove - Servo
- Intel Edison + Grove - Touch
- Intel Edison + Grove - Q Touch
- Intel Edison + Grove - I2C Motor Driver
- Grove - LED
- Grove - Button
- Grove - Touch
- Grove - Joystick
- Grove - Rotary Potentiometer
- Grove - RGB LCD
- Grove - LCD RGB temperature display
- Grove - Servo
- Grove - Motor (I2C Driver)
- TinkerKit - Accelerometer
- TinkerKit - Blink
- TinkerKit - Button
- TinkerKit - Combo
- TinkerKit - Continuous servo
- TinkerKit - Gyro
- TinkerKit - Joystick
- TinkerKit - Linear potentiometer
- TinkerKit - Rotary potentiometer
- TinkerKit - Temperature
- TinkerKit - Tilt
- TinkerKit - Touch
- Line Follower
- Motobot
- Navigator
- Nodebot
- Whisker
- Phoenix Hexapod
- BOE Bot
- Bug
- Lynxmotion Biped BRAT
- Robotic Claw
- Kinect Robotic Arm Controller
- Laser Trip Wire
- Radar
- Led Blink on Electric Imp
- Led Blink on Spark Core
- Led Blink on pcDuino3
- Led Blink on Intel Galileo Gen 2
- Led Blink on Raspberry Pi
- Led Blink on Intel Edison Arduino Board
- Led Blink on Intel Edison Mini Board
All contributions must adhere to the Idiomatic.js Style Guide, by maintaining the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using grunt.
Copyright (c) 2012, 2013, 2014 Rick Waldron [email protected] Licensed under the MIT license. Copyright (c) 2014, 2015 The Johnny-Five Contributors Licensed under the MIT license.