Arduino experimenter's guide with Node.js
Original French translation
NodeBots - Arduino-based robots controlled by Node.js
This guide will introduce you to building and programming a number of projects using an Arduino and Node.js compatible microcontroller to help you start building your own NodeBots. This guide was developed for use with the Arduino Experimenter's Kit, which is available from several vendors including SparkFun, AdaFruit, SEED Studio, and Freetronics.
The overall goal of this guide is entertainment. In addition, the goal is to become familiar with the use of Node.js to control a wide range of electronic components in small, simple and simple circuits. The central point is to make each circuit work and therefore give you the tools to understand how it works and how to develop it.
Installation
You can install this guide on your computer. First, make sure Node.js and the Node package manager (npm) are installed.
Install the manual with the following commands:
git clone https://github.com/AnnaGerber/node-ardx.git && cd node-ardx
npm install
Start the node-ardx web application from the node-ardx directory:
node app.js
To view the guide, enter the URL http ://localhost: 3000 in your browser. (Translator's note: in fact, the port may be different, look in the command line window to find the real port).
OPEN SOURCE MATERIALS
This guide was adapted by Anna Gerber from SparkFun and Arduino Experimenter's (ARDX) version of the Guide de Oomlout.
All Oomlout projects are open source. What does it mean? This means that all equipment making up the ARDX kit, including this manual, loop diagrams and code, are available for free download. But this goes further: you are also free to reproduce and edit any part of this material, and distribute it yourself. This is possible because the manual includes a Creative Commons license (CC-BY-SA). When reproducing or changing this guide, you should mention SparkFun and Oomlout in your design and also share your developments. For what reason? We grew up learning and playing with open source and the experience was good fun. We believe that it would be noticeable if such an experience was possible with physical objects.
Learn more about the Creative Commons CC (By Share Alike) License at http://ardx.org/CCLI/.
AboutJOHNNY FIVE
We will be working with the Johnny-Five library for Node.js on programming our NodeBots. Johnny-Thebes uses a protocol called Firmata to communicate with the microcontroller via USB (Universal Serial Bus).
Setting up Firmata
Before you start programming NodeBots, you need to load Firmata into your compatible Arduino microcontroller:
- Download Arduino EDI.
- Connect the Arduino-compatible microcontroller via USB.
- Start EDI Arduino and open the Firmata thumbnail from File> Examples> Firmata> StandardFirmata.
- Select an Arduino card type (for example, Arduino Uno) using Tools> Board.
- Select the port for the board using Tools> Serial Port> (Arduino com port).
- Download the program by choosing: File> Download.
If you're having trouble downloading, a complete troubleshooting guide can be found here: http://ardx.org/TRBL/.
Johnny-Five Program Execution
The Johnny-Five module was already installed when this guide was installed, so all sample code you create in the node-ardx directory will work. If you create code elsewhere, you will have to install the Johnny-Five module and its dependencies:
npm install node-gyp npm install johnny-five
Run the code samples from your device:
node CIRC01-code-led-a-strobe.js
Translator node: You may receive an ENOENT error message when attempting to install the module. This is according to npm. In this case, you must create the directory manually:
C:\Users\[votrenom]\AppData\Roaming\npm
Using REP
Johnny-Five provides a "Reple-Evaluer-Show-Coulder" loop (REPL/Read-Eval-Print-Loop) that allows you to enter commands to interactively control equipment while the program is running. See exercises for examples.
LICENSE
Source code is available on https://github.com/AnnaGerber/node-ardx
Code samples are distributed under a MIT license.
This work is licensed under Creative Commons Attribute-Share Alike 3.0 Unported.
To view a copy of this license, go to https://creativecommons.org/licenses/by-sa/3.0/
Or send an email: Creative Commons 171 Second Street Suite 300 San Francisco California 94105 USA.
Translation license for this page and all pages of the "Nodebot" section: Faithful translation of Anna Gerber's text into English by .fr. Copying and changing the translation is allowed provided that the notice of appointment is saved, including a link to the original .fr. It is important that the link is tracked by search engines and is not dynamic or nofollow.
There is a fairly close version of this document in the form of an ODF file provided by MC Hobby, under a free CCA license. However, this tutorial differs from the MC Hobby manual, whose code is written in C, while the code here is in JavaScript and works with Node.js. This tutorial provides the foundations for robotics, and that's what we're interested in at this site. However, the component set and exercises used are similar.