TensorFlow-Powered Vision For Pi-based robot

Introduction

This is a Pi-based robot to implement visual recognition(by Inception V3). The TensorFlow-Powered vision can recognize many objects such as people, car, bus, fruits, and so on.

  • Hardware: Raspberry-Pi2, Sony PS3 Eye Camera(Available to use Logitech C270 USB camera with Raspberry Pi)
  • Software: TensorFlow(v1.0.1), Jupyter-Notebook

Structure.png

My motivation

I was so curious about excellence of the image recognition with TensorFlow on Raspberry Pi. Also, the Jupyter notebook is very convenient to instantly code as a quick prototype. So, in terms of error rate of the image classification, Inception V3(3.46%) is more excellent than human(5.1%) whereas raspberry pi’s processing speed is very slow compare to my laptop.

(Table: Jeff Dean’s Keynote @Google Brain).

Chart_IR.png

  • Schematic diagram of Inception-v3

InceptionV3.png

Requirements and Installation

  • Install Webcam driver on your Rapsberry Pi.
sudo apt-get install fswebcam
  • Test your webcam.
fswebcam test.jpg

Quick Start

  • You should install both TensorFlow(v1.0.1) and Jupyter notebook on your Raspberry Pi.
  • First, clone the TensorFlow-Powered_Robot_Vision git repository here. This can be accomplished by:
cd /home/pi/Documents
git clone https://github.com/leehaesung/TensorFlow-Powered_Robot_Vision.git

next, cd into the newly created directory:

cd TensorFlow-Powered_Robot_Vision

Drive your jupyter notebook on your Raspberry Pi.

jupyter-notebook

The pre-trained data(inception_v3.ckpt) will automatically download when driving the Jupyter notebook. (Where: /pi/home/Documents/datasets/inception)

Source Codes

Results of Object Recognition

  • Wow! The result is really awessome!!

RecognitionResult.png

References

YOLO-Powered_Robot_Vision

YOLO-Powered_Robot_Vision


Introduction

This is a Pi-based robot to implement visual recognition(by YOLO). The YOLO-Powered vision can recognize many objects such as people, car, bus, fruits, and so on.

  • Hardware: Raspberry-Pi2, Sony PS3 Eye Camera

    (Available to use Logitech C270 USB camera with Raspberry Pi)

  • Software: YOLO(v2), Jupyter-Notebook

Structure.png

My motivation

I was so interested in performance of the image recognition with YOLO-2 on Raspberry Pi. In addition, the Jupyter notebook is really convenient to instantly code as a quick prototype. According to paper, I realised that YOLO is a fast, accurate visual detector, making it ideal for computer vision system. We connect YOLO to a webcam and verify that it maintains real-time performance. So, the Raspberry pi’s processing speed is very slow compare to my laptop.

(Picasso Dataset precision-recall curves: paper)

Perfomance_Picaso.png

(The Architecture: paper)

Architecture_CNN.png

Requirements and Installation

Quick Start

This post will guide you through detecting objects with the YOLO system using a pre-trained model. If you don’t already have Darknet installed, you should install OpenCV2 before on your Raspberry Pi.

  • Install dependencies for OpenCV2
sudo apt-get update

sudo apt-get install build-essential
sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev python-dev python-numpy libjpeg-dev libpng-dev libtiff-dev libjasper-dev

sudo apt-get install python-opencv
  • Check which version of OpenCV you have in Python
python
import cv2
cv2.__version__
  • Install the darknet for YOLO
git clone https://github.com/pjreddie/darknet
cd darknet
make

Easy!

You already have the config file for YOLO in the cfg/ subdirectory. You will have to download the pre-trained weight file here (258 MB). Or just run this:

wget http://pjreddie.com/media/files/yolo.weights

Then run the detector to test.

./darknet detect cfg/yolo.cfg yolo.weights data/dog.jpg

You will see some output like this:

layer     filters    size              input                output
    0 conv     32  3 x 3 / 1   416 x 416 x   3   ->   416 x 416 x  32
    1 max          2 x 2 / 2   416 x 416 x  32   ->   208 x 208 x  32
    .......
   29 conv    425  1 x 1 / 1    13 x  13 x1024   ->    13 x  13 x 425
   30 detection
Loading weights from yolo.weights...Done!
data/dog.jpg: Predicted in 0.016287 seconds.
car: 54%
bicycle: 51%
dog: 56%

Output

  • Re-name from ‘darknet’ to ‘YOLO-Powered_Robot_Vision’.
mv /home/pi/Documents/darknet /home/pi/Documents/YOLO-Powered_Robot_Vision
cd /home/pi/Documents/YOLO-Powered_Robot_Vision
  • Download ‘YOLO-Powered_Robot_Vision.ipynb’ at /home/pi/Documents/YOLO-Powered_Robot_Vision
wget https://github.com/leehaesung/YOLO-Powered_Robot_Vision/raw/master/YOLO-Powered_Robot_Vision.ipynb

jupyter-notebook

Source Codes

Result of Object Recognition

(Caution!!: I have used the image sources for an educational purpose. Please don’t use any pictures in copyright. So, I am not responsible for any images you use.)

predictions06.png

  • Another examples predictions07.png

predictions08.png

predictions09.png

predictions11.png

Videos

  1. Deep Learning and Neural Networks with Kevin Duh: course page
  2. NY Course by Yann LeCun: 2014 version, 2015 version
  3. NIPS 2015 Deep Learning Tutorial by Yann LeCun and Yoshua Bengio (slides)(mp4,wmv)
  4. ICML 2013 Deep Learning Tutorial by Yann Lecun (slides)
  5. Geoffery Hinton’s cousera course on Neural Networks for Machine Learning
  6. Stanford 231n Class: Convolutional Neural Networks for Visual Recognition (videosgithub, syllabus, subreddit, projectfinal reports, twitter)
  7. Large Scale Visual Recognition Challenge 2014, arxiv paper
  8. GTC Deep Learning 2015
  9. Hugo Larochelle Neural Networks class, slides
  10. My youtube playlist
  11. Yaser Abu-Mostafa’s Learning from Data course (youtube playlist)
  12. Stanford CS224d: Deep Learning for Natural Language Processing: syllabus, youtube playlist, reddit, longer playlist
  13. Neural Networks for Machine Perception: vimeo
  14. Deep Learning for NLP (without magic): page, better page, video1, video2, youtube playlist
  15. Introduction to Deep Learning with Python: video, slides, code
  16. Machine Learning course with emphasis on Deep Learning by Nando de Freitas (youtube playlist), course page, torch practicals
  17. NIPS 2013 Deep Learning for Computer Vision Tutorial – Rob Fergus: video, slides
  18. Tensorflow Udacity mooc
  19. Oxford Deep NLP Course 2017 (github)

Links

  1. Deeplearning.net
  2. NVidia’s Deep Learning portal
  3. My flipboard page

AMIs, Docker images & Install Howtos

  1. Stanford 231n AWS AMI:  image is cs231n_caffe_torch7_keras_lasagne_v2, AMI ID: ami-125b2c72, Caffe, Torch7, Theano, Keras and Lasagne are pre-installed. Python bindings of caffe are available. It has CUDA 7.5 and CuDNN v3.
  2. AMI for AWS EC2 (g2.2xlarge): ubuntu14.04-mkl-cuda-dl (ami-03e67874) in Ireland Region: page,  Installed stuffs: Intel MKL, CUDA 7.0, cuDNN v2, theano, pylearn2, CXXNET, Caffe, cuda-convnet2, OverFeat, nnForge, Graphlab Create (GPU), etc.
  3. Chef cookbook for installing the Caffe deep learning framework
  4. Public EC2 AMI with Torch and Caffe deep learning toolkits (ami-027a4e6a): page
  5. Install Theano on AWS (ami-b141a2f5 with CUDA 7): page
  6. Running Caffe on AWS Instance via Docker: page, docs, image
  7. CVPR 2015 ITorch Tutorial (ami-b36981d8): page, github, cheatsheet
  8. Torch/iTorch/Ubuntu 14.04 Docker image: docker pull kaixhin/torch
  9. Torch/iTorch/CUDA 7/Ubuntu 14.04 Docker image: docker pull kaixhin/cuda-torch
  10. AMI containing Caffe, Python, Cuda 7, CuDNN, and all dependencies. Its id is ami-763a311e (disk min 8G,system is 4.6G), howto
  11. My Dockerfiles at GitHub

Examples and Tutorials

  1. IPython Caffe Classification
  2. IPython Detection, arxiv paper, rcnn github, selective search
  3. Machine Learning with Torch 7
  4. Deep Learning Tutorials with Theano/Python, CNN, github
  5. Torch tutorials, tutorial&demos from Clement Fabaret
  6. Brewing Imagenet with Caffe
  7. Training an Object Classifier in Torch-7 on multiple GPUs over ImageNet
  8. Stanford Deep Learning Matlab based Tutorial (github, data)
  9. DIY Deep Learning for Vision: A Hands on tutorial with Caffe (google doc)
  10. Tutorial on Deep Learning for Vision CVPR 2014: page
  11. Pylearn2 tutorials: convolutional network, getthedata
  12. Pylearn2 quickstart, docs
  13. So you wanna try deep learning? post from SnippyHollow
  14. Object Detection ipython nb from SnippyHollow
  15. Filter Visualization ipython nb from SnippyHollow
  16. Specifics on CNN and DBN, and more
  17. CVPR 2015 Caffe Tutorial
  18. Deep Learning on Amazon EC2 GPU with Python and nolearn
  19. How to build and run your first deep learning network (video, behind paywall)
  20. Tensorflow examples
  21. Illia Polosukhin’s Getting Started with Tensorflow – Part 1, Part 2, Part 3
  22. CNTK Tutorial at NIPS 2015
  23. CNTK: FFN, CNN, LSTM, RNN
  24. CNTK Introduction and Book

People

  1. Geoffery Hinton: Homepage, Reddit AMA (11/10/2014)
  2. Yann LeCun: Homepage, NYU Research Page, Reddit AMA (5/15/2014)
  3. Yoshua Bengio: Homepage, Reddit AMA (2/27/2014)
  4. Clement Fabaret: Scene Parsing (paper), github, code page
  5. Andrej Karpathy: Homepagetwitter, github, blog
  6. Michael I Jordan: Homepage, Reddit AMA (9/10/2014)
  7. Andrew Ng: Homepage, Reddit AMA (4/15/2015)
  8. Jurden Schmidhuber: Homepage, Reddit AMA (3/4/2015)
  9. Nando de Freitas: Homepage, YouTube, Reddit AMA (12/26/2015)

Datasets

  1. ImageNet
  2. MNIST (Wikipedia), database
  3. Kaggle datasets
  4. Kitti Vision Benchmark Suite
  5. Ford Campus Vision and Lidar Dataset
  6. PCL Lidar Datasets
  7. Pylearn2 list

Frameworks and Libraries

  1. Caffe: homepage, github, google group
  2. Torch: homepage, cheatsheet, github, google group
  3. Theano: homepage, google group
  4. Tensorflow: homepage, github, google group, skflow
  5. CNTK: homepage, github, wiki
  6. CuDNN: homepage
  7. PaddlePaddle: homepage, github, docs, quick start
  8. fbcunn: github
  9. pylearn2: github, docs
  10. cuda-convnet2: homepage, cuda-convnet, matlab
  11. nnForge: homepage
  12. Deep Learning software links
  13. Torch vs. Theano post
  14. Overfeat: page, github, paper, slidesgoogle group
  15. Keras: github, docs, google group
  16. Deeplearning4j: page, github
  17. Lasagne: docs, github

Topics

  1. Scene Understanding (CVPR 2013, Lecun) (slides), Scene Parsing (paper)
  2. Overfeat: Integrated Recognition, Localization and Detection using Convolutional Networks (arxiv)
  3. Parsing Natural Scenes and Natural Language with Recursive Neural Networks: page, ICML 2011 paper

Reddit

  1. Machine Learning Reddit page
  2. Computer Vision Reddit page
  3. Reddit: Neural Networks: new, relevant
  4. Reddit: Deep Learning: new, relevant

Books

  1. Learning Deep Architectures for AI, Bengio (pdf)
  2. Neural Nets and Deep Learning (html, github)
  3. Deep Learning, Bengio, Goodfellow, Courville (html)
  4. Neural Nets and Learning Machines, Haykin, 2008 (amazon)

Papers

  1. ImageNet Classification with Deep Convolutional Neural Networks, Alex Krizhevsky, Ilya Sutskever, Geoffrey E Hinton, NIPS 2012 (paper)
  2. Why does unsupervised pre-training help deep learning? (paper)
  3. Hinton06 – Autoencoders (paper)
  4. Deep Learning using Linear Support Vector machines (paper)

Companies

  1. Kaggle: homepage
  2. Microsoft Deep Learning Technology Center

Conferences

  1. ICML
  2. PAMITC Sponsored Conferences
  3. NIPS: 2015

Installing & Testing Google TensorFlow on Raspberry Pi2

[ Installing & Testing Google TensorFlow on Raspberry Pi2 ]

Let’s install TensorFlow.

sudo apt-get update
# For Python 3.3+
sudo apt-get install python3-pip python3-dev

# For Python 3.3+
wget https://github.com/samjabrahams/tensorflow-on-raspberry-pi/releases/download/v1.0.1/tensorflow-1.0.1-cp34-cp34m-linux_armv7l.whl
sudo pip3 install tensorflow-1.0.1-cp34-cp34m-linux_armv7l.whl

# For Python 3.3+
sudo pip3 uninstall mock
sudo pip3 install mock

And then,
Let’s code it below that

Ref.: https://www.tensorflow.org/get_started/

 

pi@raspberrypi:~ $ python3
Python 3.4.2 (default, Oct 19 2014, 13:31:11)
[GCC 4.9.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
import tensorflow as tf
import numpy as np

# Create 100 phony x, y data points in NumPy, y = x * 0.1 + 0.3
x_data = np.random.rand(100).astype(np.float32)
y_data = x_data * 0.1 + 0.3
W = tf.Variable(tf.random_uniform([1], -1.0, 1.0))
b = tf.Variable(tf.zeros([1]))
y = W * x_data + b
loss = tf.reduce_mean(tf.square(y - y_data))
optimizer = tf.train.GradientDescentOptimizer(0.5)
train = optimizer.minimize(loss)
init = tf.global_variables_initializer()
sess = tf.Session()
sess.run(init)
for step in range(201):
     sess.run(train)
     if step % 20 == 0:
         print(step, sess.run(W), sess.run(b))


0 [ 0.2893075] [ 0.26960531]
20 [ 0.14367677] [ 0.27712572]
40 [ 0.11184501] [ 0.29379657]
60 [ 0.10321232] [ 0.29831767]
80 [ 0.10087116] [ 0.29954377]
100 [ 0.10023624] [ 0.29987627]
120 [ 0.10006408] [ 0.29996645]
140 [ 0.10001738] [ 0.29999092]
160 [ 0.1000047] [ 0.29999754]
180 [ 0.10000128] [ 0.29999936]
200 [ 0.10000037] [ 0.29999983]

screenshot-2017-01-28-22-17-32

Deep Learning Libraries

Software links

  1. Theano – CPU/GPU symbolic expression compiler in python (from MILA lab at University of Montreal)
  2. Torch – provides a Matlab-like environment for state-of-the-art machine learning algorithms in lua (from Ronan Collobert, Clement Farabet and Koray Kavukcuoglu)
  3. Pylearn2 – Pylearn2 is a library designed to make machine learning research easy.
  4. Blocks – A Theano framework for training neural networks
  5. Tensorflow – TensorFlow™ is an open source software library for numerical computation using data flow graphs.
  6. MXNet – MXNet is a deep learning framework designed for both efficiency and flexibility.
  7. Caffe -Caffe is a deep learning framework made with expression, speed, and modularity in mind.Caffe is a deep learning framework made with expression, speed, and modularity in mind.
  8. Lasagne – Lasagne is a lightweight library to build and train neural networks in Theano.
  9. Keras– A theano based deep learning library.
  10. Deep Learning Tutorials – examples of how to do Deep Learning with Theano (from LISA lab at University of Montreal)
  11. Chainer – A GPU based Neural Network Framework
  12. Matlab Deep Learning – Matlab Deep Learning Tools
  13. CNTK – Computational Network Toolkit – is a unified deep-learning toolkit by Microsoft Research.
  14. MatConvNet – A MATLAB toolbox implementing Convolutional Neural Networks (CNNs) for computer vision applications. It is simple, efficient, and can run and learn state-of-the-art CNNs.
  15. DeepLearnToolbox – A Matlab toolbox for Deep Learning (from Rasmus Berg Palm)
  16. Cuda-Convnet – A fast C++/CUDA implementation of convolutional (or more generally, feed-forward) neural networks. It can model arbitrary layer connectivity and network depth. Any directed acyclic graph of layers will do. Training is done using the back-propagation algorithm.
  17. Deep Belief Networks. Matlab code for learning Deep Belief Networks (from Ruslan Salakhutdinov).
  18. RNNLM– Tomas Mikolov’s Recurrent Neural Network based Language models Toolkit.
  19. RNNLIB-RNNLIB is a recurrent neural network library for sequence learning problems. Applicable to most types of spatiotemporal data, it has proven particularly effective for speech and handwriting recognition.
  20. matrbm. Simplified version of Ruslan Salakhutdinov’s code, by Andrej Karpathy (Matlab).
  21. deeplearning4j– Deeplearning4J is an Apache 2.0-licensed, open-source, distributed neural net library written in Java and Scala.
  22. Estimating Partition Functions of RBM’s. Matlab code for estimating partition functions of Restricted Boltzmann Machines using Annealed Importance Sampling (from Ruslan Salakhutdinov).
  23. Learning Deep Boltzmann Machines Matlab code for training and fine-tuning Deep Boltzmann Machines (from Ruslan Salakhutdinov).
  24. The LUSH programming language and development environment, which is used @ NYU for deep convolutional networks
  25. Eblearn.lsh is a LUSH-based machine learning library for doing Energy-Based Learning. It includes code for “Predictive Sparse Decomposition” and other sparse auto-encoder methods for unsupervised learning. Koray Kavukcuoglu provides Eblearn code for several deep learning papers on this page.
  26. deepmat– Deepmat, Matlab based deep learning algorithms.
  27. MShadow – MShadow is a lightweight CPU/GPU Matrix/Tensor Template Library in C++/CUDA. The goal of mshadow is to support efficient, device invariant and simple tensor library for machine learning project that aims for both simplicity and performance. Supports CPU/GPU/Multi-GPU and distributed system.
  28. CXXNET – CXXNET is fast, concise, distributed deep learning framework based on MShadow. It is a lightweight and easy extensible C++/CUDA neural network toolkit with friendly Python/Matlab interface for training and prediction.
  29. Nengo-Nengo is a graphical and scripting based software package for simulating large-scale neural systems.
  30. Eblearn is a C++ machine learning library with a BSD license for energy-based learning, convolutional networks, vision/recognition applications, etc. EBLearn is primarily maintained by Pierre Sermanet at NYU.
  31. cudamat is a GPU-based matrix library for Python. Example code for training Neural Networks and Restricted Boltzmann Machines is included.
  32. Gnumpy is a Python module that interfaces in a way almost identical to numpy, but does its computations on your computer’s GPU. It runs on top of cudamat.
  33. The CUV Library (github link) is a C++ framework with python bindings for easy use of Nvidia CUDA functions on matrices. It contains an RBM implementation, as well as annealed importance sampling code and code to calculate the partition function exactly (from AIS lab at University of Bonn).
  34. 3-way factored RBM and mcRBM is python code calling CUDAMat to train models of natural images (from Marc’Aurelio Ranzato).
  35. Matlab code for training conditional RBMs/DBNs and factored conditional RBMs (from Graham Taylor).
  36. mPoT is python code using CUDAMat and gnumpy to train models of natural images (from Marc’Aurelio Ranzato).
  37. neuralnetworks is a java based gpu library for deep learning algorithms.
  38. ConvNet is a matlab based convolutional neural network toolbox.
  39. Elektronn is a deep learning toolkit that makes powerful neural networks accessible to scientists outside the machine learning community.
  40. OpenNN is an open source class library written in C++ programming language which implements neural networks, a main area of deep learning research.
  41. NeuralDesigner  is an innovative deep learning tool for predictive analytics.
  42. Theano Generalized Hebbian Learning.
  43. Apache Singa is an open source deep learning library that provides a flexible architecture for scalable distributed training. It is extensible to run over a wide range of hardware, and has a focus on health-care applications.
  44. Lightnet  is a lightweight, versatile and purely Matlab-based deep learning framework. The aim of the design is to provide an easy-to-understand, easy-to-use and efficient computational platform for deep learning research.

If your software belongs here, email us and let us know.

 

NodeRED BlockChain

Build your own block chain in 15 minutes on Node-RED using Node.js, JavaScript, Cloudant/CouchDB on a free IBM Cloud account… Note: To do the tutorial you need a free Bluemix (IBM PaaS Cloud) account. You can obtain one here and the raw file (JSON) for this NodeRED flow is here. Tutorial Objective In this exercise […]

via Node-RED Blockchain — romeokienzler

Installing Cylon.js for the Raspberry Pi

[ Installing Cylon.js for the Raspberry Pi ]

 

Repository| Issues

The Raspberry Pi is an inexpensive and popular ARM based single board computer with digital & PWM GPIO, and i2c interfaces built in.

The Raspberry Pi is a credit-card-sized single-board computer developed in the UK by the Raspberry Pi Foundation with the intention of promoting the teaching of basic computer science in schools

For more info about the Raspberry Pi platform, click here.

How to Install

Installing Cylon.js for the Raspberry Pi is easy, but must be done on the Raspi itself, or on another Linux computer. Due to I2C device support, the module cannot be installed on OS X or Windows.

Install the module with:

$ npm install cylon cylon-raspi

How to Use

This small program causes an LED to blink.

var Cylon = require("cylon");

Cylon.robot({
  connections: {
    raspi: { adaptor: 'raspi' }
  },

  devices: {
    led: { driver: 'led', pin: 11 }
  },

  work: function(my) {
    every((1).second(), my.led.toggle);
  }
}).start();

How to Connect

Install the lastest Raspbian OS

You can get it from here: http://www.raspberrypi.org/downloads/

Setting the Raspberry Pi keyboard

Having trouble with your Raspberry Pi keyboard layout? Use the following command:

sudo dpkg-reconfigure keyboard-configuration

Update your Raspbian and install Node.js

These commands need to be run after SSHing into the Raspi:

sudo apt-get update
sudo apt-get upgrade
wget http://nodejs.org/dist/v0.10.28/node-v0.10.28-linux-arm-pi.tar.gz
tar -xvzf node-v0.10.28-linux-arm-pi.tar.gz
node-v0.10.28-linux-arm-pi/bin/node --version

You should see the node version you just installed.

$ node --version
v0.10.28

Once you have installed Node.js, you need to add the following to your ~/.bash_profile file. Create this file if it does not already exist, and add this to it:

NODE_JS_HOME=/home/pi/node-v0.10.28-linux-arm-pi
PATH=$PATH:$NODE_JS_HOME/bin

This will setup the path for you every time you login. Run the source ~/.bash_profile command to load it right now without having to login again.

Thanks @joshmarinacci for the blog post at http://joshondesign.com/2013/10/23/noderpi where these modified instructions were taken.

Connecting to Raspberry Pi GPIO

This module only works on a real Raspberry Pi. Do not bother trying on any other kind of computer, it will not work. Also note you will need to connect actual circuits to the Raspberry Pi’s GPIO pins.

In order to access the GPIO pins without using sudo you will need to both app the pi user to the gpio group:

sudo usermod -G gpio pi

And also add the following udev rules file to /etc/udev/rules.d/91-gpio.rules:

SUBSYSTEM=="gpio", KERNEL=="gpiochip*", ACTION=="add", PROGRAM="/bin/sh -c 'chown root:gpio /sys/class/gpio/export /sys/class/gpio/unexport ; chmod 220 /sys/class/gpio/export /sys/class/gpio/unexport'"
SUBSYSTEM=="gpio", KERNEL=="gpio*", ACTION=="add", PROGRAM="/bin/sh -c 'chown root:gpio /sys%p/active_low /sys%p/direction /sys%p/edge /sys%p/value ; chmod 660 /sys%p/active_low /sys%p/direction /sys%p/edge /sys%p/value'"

Thanks to “MikeDK” for the above solution: https://www.raspberrypi.org/forums/viewtopic.php?p=198148#p198148

Enabling the Raspberry Pi i2c on Raspbian

You must add these two entries to your /etc/modules

i2c-bcm2708
i2c-dev

You must also ensure that these entries are commented in your /etc/modprobe.d/raspi-blacklist.conf

#blacklist spi-bcm2708
#blacklist i2c-bcm2708

You will also need to update the /boot/config.txt file. Edit it add the following text:

dtparam=i2c1=on
dtparam=i2c_arm=on

Finally, you need to allow the pi user permissions to access the i2c interface by running this command:

sudo usermod -G i2c pi

Now restart your Raspberry Pi.

Enabling PWM output on GPIO pins.

You need to install and have pi-blaster running in the raspberry-pi, you can follow the instructions for pi-blaster install in the pi-blaster repo here:

https://github.com/sarfata/pi-blaster

Available PINS

The following object depicts available pins for all revisions of raspberry-pi, the key is the actual number of the physical pin header on the board,the value is the GPIO pin number assigned by the OS, for the pins with changes between board revisions, the value contains the variations of GPIO pin number assignment between them (eg.rev1, rev2, rev3).

You should just be concerned with the key (number of the physical pin header on the board), Cylon.JS takes care of the board revision and GPIO pin numbers for you, this full list is for reference only.

PINS = {
  3: {
    rev1: 0,
    rev2: 2,
    rev3: 2
  },
  5: {
    rev1: 1,
    rev2: 3,
    rev3: 3
  },
  7: 4,
  8: 14,
  10: 15,
  11: 17,
  12: 18,
  13: {
    rev1: 21,
    rev2: 27,
    rev3: 27
  },
  15: 22,
  16: 23,
  18: 24,
  19: 10,
  21: 9,
  22: 25,
  23: 11,
  24: 8,
  29: {
    rev3: 5
  },
  31: {
    rev3: 6
  },
  32: {
    rev3: 12
  },
  33: {
    rev3: 13
  },
  35: {
    rev3: 19
  },
  36: {
    rev3: 16
  },
  37: {
    rev3: 26
  },
  38: {
    rev3: 20
  },
  40: {
    rev3: 21
  }
};

The website http://pi.gadgetoid.com/pinout has a great visual representation of this information.

Drivers

All Cylon.js digital and PWM GPIO drivers listed below should work with the Raspberry Pi:

I2C Drivers