With NW.js, developers can port to Raspberry Pi the apps and games they have created using JavaScript, HTML/HTML5, CSS/CSS3 and Node.js (all of these are optional so for example one can just use HTML only if desired). It also lets you call Node.js modules directly from the DOM and enables a new way of writing native applications with all Web technologies.
Almost all web apps and web games that work in Chrome can be ported to Raspberry Pi now using the NW.js port. However performance can be issue because RPi 1 and Zero are not very powerful.
Since NW.js includes Node.js, the developers can access hardware (GPIO, USB, etc.) without problems and do any thing that Node.js can do and they can provide a GUI if they want since NW.js also includes Chromium. All packaged in a binary so it is interesting for many projects.
The instructions can be found in the GitHub repository of the port and also in the official NW.js repository (in the part where they talk about the old version called node-webkit).
Compatibility
• Raspberry Pi Zero, all models (untested)
• Raspberry Pi, all models
• Raspberry Pi 2, all models (untested)
• Raspberry Pi 3, all models
• Other devices with compatible hardware (untested)
Source: [GitHub]
Almost all web apps and web games that work in Chrome can be ported to Raspberry Pi now using the NW.js port. However performance can be issue because RPi 1 and Zero are not very powerful.
Since NW.js includes Node.js, the developers can access hardware (GPIO, USB, etc.) without problems and do any thing that Node.js can do and they can provide a GUI if they want since NW.js also includes Chromium. All packaged in a binary so it is interesting for many projects.
The instructions can be found in the GitHub repository of the port and also in the official NW.js repository (in the part where they talk about the old version called node-webkit).
Compatibility
• Raspberry Pi Zero, all models (untested)
• Raspberry Pi, all models
• Raspberry Pi 2, all models (untested)
• Raspberry Pi 3, all models
• Other devices with compatible hardware (untested)
Source: [GitHub]
Formula AllCode is a robotics course which includes a high specification Bluetooth enabled robot buggy with course, programmable via Python, AppBuilder, Flowcode 6, Matlab, LabView, C, C# & more.
The project consists of:
- The Formula AllCode robot itself
- A FREE PDF course in robotics
- Accessories used to learn including graphical mat and maze walls
The robot can be used with hosts including Windows, MAC, Raspberry Pi, Android and iPhone and a number of examples that can be seen in the above video and at www.matrixtsl.com/formula-allcode
A low cost robot buggy, the AllCode is great for makers to test their skills and capabilities using an interesting and diverse platform or for introducing younger school children to programming and robotics in a fun and motivating way with huge scope for further work and competitions.
The major benefit of Formula AllCode is that you learn about robotics with a software and hardware platform of your choice.
Not only is this a superb learning tool with free robotics PDF course, but also a robot that is compatible with hardware from Raspberry Pi to Android to iPhone, Windows PC's, MAC and more.
What's more, you can program the AllCode via just about anything including Flowcode, LabVIEW, MATLAB, Python and AppBuilder.
The Formula AllCode includes a powerful 16 bit processor and a Bluetooth module. The processor is pre-programmed with a full API (Application Programming Interface) that allows you to control the robot buggy using Bluetooth.

For more detailed information visit their KickStarter page: http://kck.st/1M9MFO3
What is Game Scribbler?
Game Scribbler is a monthly subscription box which is dedicated to teaching programming through basic game development. It is geared towards development on the Raspberry Pi so the programmer is not required to have a fancy computer, or even internet connection..only a Raspberry Pi which can be obtained for way less than $100.
How does it work?
Each month, the subscriber will receive a game project workbook that outlines and details the code that is used to create a working game. Additionally, the project workbook will include mini coding projects designed to teach basic coding concepts that are going to be used to develop the game.
Along with the workbook will be an SD card with the project game files, art, music, and sounds. In addition to the project files, the operating system and development environments will also be included and configured, so all the coder has to do is insert the SD card into the Pi and they are ready to start programming the game!
What are the features?
Game Scribbler is a monthly subscription box which is dedicated to teaching programming through basic game development. It is geared towards development on the Raspberry Pi so the programmer is not required to have a fancy computer, or even internet connection..only a Raspberry Pi which can be obtained for way less than $100.
How does it work?
Each month, the subscriber will receive a game project workbook that outlines and details the code that is used to create a working game. Additionally, the project workbook will include mini coding projects designed to teach basic coding concepts that are going to be used to develop the game.
Along with the workbook will be an SD card with the project game files, art, music, and sounds. In addition to the project files, the operating system and development environments will also be included and configured, so all the coder has to do is insert the SD card into the Pi and they are ready to start programming the game!
What are the features?
- The key factor, however, is that the coder is given explanations as to what the code actually does and why I coded it the way I did, so it goes beyond simply copying and pasting code. I see to help facilitate the understanding of why code does what it does, rather than feeding code and hoping it is inherently understood what is being done.
- The coder will be given the option of different styles of art, music and background to use so that they may customize the game to their liking. Each game will come with different background music options as well as art options.
- Each project comes with an SD card which includes the Raspbian operating system and the programming environments. So there is no need to configure PATHS, install software, or messing with configuring operating systems. Just plug in the card and you are ready to develop!
- The Raspberry Pi is very affordable! There are several sites where you can obtain a Raspberry Pi 2 Model B for even under $50! This helps to target those who do not have computers, or internet as well as those who just want a device to program on and keep separate from their main computers.
- At the end of each project, you end up with a working game! All of that development offers instant gratification in the form of a game that you developed yourself!
- The project workbook and files are delivered to your house! You don’t have to download the files as I will send them with each monthly project. In the event that your card does not work, I will happily send out another one, or offer the option to download the files should you want the option to.
For more detailed information visit KickStarter page: https://www.kickstarter.com/projects/497586852/game-scribbler-monthly-subscription
DHT11 is a 4 pin sensor which can measure temperatures ranging from 0-50°C & relative humidity ranging from 20-95%.The sensor uses its own proprietary 1-wire protocol to communicate with Raspberry Pi and runs from 3.3V-5V. The timings must be precise and according to the datasheet of the sensor.
Raspberry Pi initiates the data transmission process by pulling the data bus low for about 18 ms and keeps it HIGH for about 20-40 μs before releasing it.Subsequently, the sensor responds to the Pi's data transfer request by pulling the data bus LOW for 80 μs followed by 80 μs of HIGH.At this point Pi is ready to receive data from the sensor.Data is sent in packet of 40 bits (5 bytes) via the data line with the most significant bit at the beginning.
Data is transmitted in the following order:- Integer Part of Relative Humidity--->Decimal Part of Relative Humidity--->Integer Part of Temperature--->Decimal Part of Temperature---> Checksum. Checksum consists the last 8 bits of each part. Transmission of '0' & '1' is done by varying the width of the pulse.For transmitting '0' the data bus is held HIGH for 26-28μs, and 70μs for transmitting '1'.A delay of 50μs(LOW) is introduced before any new data bit is transmitted.After the transmission of last data-bit the data line is held LOW for 50μs and released.
Circuit:-
Holding the DHT11 towards you (the one with grid), the left pin is connected to VCC (pin 1).The data pin is next after VCC and is connected to pin 7.Next pin is NC(no connection).Finally the last pin is connected to GND(pin 25).To prevent random data connect a 10K resistor between data and VCC pin of DHT11.
Software:-
WiringPi which uses C like Arduino language is used to read the sensor value. WiringPi is maintained under GIT for ease of change tracking.If you do not have GIT installed, then under any of the Debian releases, you can install it with-
sudo apt-get install git-core
To obtain WiringPi using GIT:
git clone git://git.drogon.net/wiringPi
If you have already used the clone operation for the first time, then
cd wiringPi
git pull origin
Will fetch an updated version then you can re-run the build script below.
To build/install there is a new simplified script:
cd wiringPi
./build
Save the below code as temp_rh_sensor.c...
Raspberry Pi initiates the data transmission process by pulling the data bus low for about 18 ms and keeps it HIGH for about 20-40 μs before releasing it.Subsequently, the sensor responds to the Pi's data transfer request by pulling the data bus LOW for 80 μs followed by 80 μs of HIGH.At this point Pi is ready to receive data from the sensor.Data is sent in packet of 40 bits (5 bytes) via the data line with the most significant bit at the beginning.
Data is transmitted in the following order:- Integer Part of Relative Humidity--->Decimal Part of Relative Humidity--->Integer Part of Temperature--->Decimal Part of Temperature---> Checksum. Checksum consists the last 8 bits of each part. Transmission of '0' & '1' is done by varying the width of the pulse.For transmitting '0' the data bus is held HIGH for 26-28μs, and 70μs for transmitting '1'.A delay of 50μs(LOW) is introduced before any new data bit is transmitted.After the transmission of last data-bit the data line is held LOW for 50μs and released.
Software:-
WiringPi which uses C like Arduino language is used to read the sensor value. WiringPi is maintained under GIT for ease of change tracking.If you do not have GIT installed, then under any of the Debian releases, you can install it with-
sudo apt-get install git-core
To obtain WiringPi using GIT:
git clone git://git.drogon.net/wiringPi
If you have already used the clone operation for the first time, then
cd wiringPi
git pull origin
Will fetch an updated version then you can re-run the build script below.
To build/install there is a new simplified script:
cd wiringPi
./build
Save the below code as temp_rh_sensor.c...
#include <wiringPi.h> #include <stdio.h> #include <stdlib.h> #include <stdint.h> #define MAX_TIME 85 #define DHT11PIN 7 int dht11_val[5]={0,0,0,0,0}; void dht11_read_val() { uint8_t lststate=HIGH; uint8_t counter=0; uint8_t j=0,i; float farenheit; for(i=0;i<5;i++) dht11_val[i]=0; pinMode(DHT11PIN,OUTPUT); digitalWrite(DHT11PIN,LOW); delay(18); digitalWrite(DHT11PIN,HIGH); delayMicroseconds(40); pinMode(DHT11PIN,INPUT); for(i=0;i<MAX_TIME;i++) { counter=0; while(digitalRead(DHT11PIN)==lststate){ counter++; delayMicroseconds(1); if(counter==255) break; } lststate=digitalRead(DHT11PIN); if(counter==255) break; // top 3 transistions are ignored if((i>=4)&&(i%2==0)){ dht11_val[j/8]<<=1; if(counter>16) dht11_val[j/8]|=1; j++; } } // verify cheksum and print the verified data if((j>=40)&&(dht11_val[4]==((dht11_val[0]+dht11_val[1]+dht11_val[2]+dht11_val[3])& 0xFF))) { farenheit=dht11_val[2]*9./5.+32; printf("Humidity = %d.%d %% Temperature = %d.%d *C (%.1f *F)\n",dht11_val[0],dht11_val[1],dht11_val[2],dht11_val[3],farenheit); } else printf("Invalid Data!!\n"); } int main(void) { printf("Interfacing Temperature and Humidity Sensor (DHT11) With Raspberry Pi\n"); if(wiringPiSetup()==-1) exit(1); while(1) { dht11_read_val(); delay(3000); } return 0; }
Compile the code as...
gcc -o sensor temp_rh_sensor.c -L/usr/local/lib -lwiringPi
Now execute it...
sudo ./sensor
[ Humidity = 87.0 % Temperature = 32.2 *C (90.0 *F) ]
One of the few things that separates the Pi from other SBC (Single Board Computer) is the ability to use the GPIO (General Purpose Input/Output) pins which can be set as HIGH or LOW to control any external devices. To get started with hardware equivalent of "Hello world", all you need is a female to male jumper wire along with an LED and a resistor. Make sure to check out the cool Starter Kit put together by CanaKit. It includes everything needed to get started using the GPIO port of the Raspberry Pi.
In this post pin 9 is used for GND and pin 11 for GPIO17. The LED was connected using a 470 ohm register in series with pin 9 and 11 to limit the current.
Software Implementation:-
The fastest way to get started is to use python which comes pre-installed with all images. Download the RPi.GPIO library and copy the gz tar ball to the RPi wheezy raspbian. Open the terminal and navigate to the extracted folder containing the RPi.GPIO library. Then type: $ sudo python setup.py install to install the module. Imp: As the OS is multitasking and not Real-time unlike Arduino there may be jitters depending on CPU priority.
Based on the library I have written a simple code to turn ON and turn OFF the LED after a delay of 1 sec (1000ms) each.The LED blinks 50 times.
In this post pin 9 is used for GND and pin 11 for GPIO17. The LED was connected using a 470 ohm register in series with pin 9 and 11 to limit the current.
Software Implementation:-
The fastest way to get started is to use python which comes pre-installed with all images. Download the RPi.GPIO library and copy the gz tar ball to the RPi wheezy raspbian. Open the terminal and navigate to the extracted folder containing the RPi.GPIO library. Then type: $ sudo python setup.py install to install the module. Imp: As the OS is multitasking and not Real-time unlike Arduino there may be jitters depending on CPU priority.
Based on the library I have written a simple code to turn ON and turn OFF the LED after a delay of 1 sec (1000ms) each.The LED blinks 50 times.
import RPi.GPIO as GPIO import time # blinking function def blink(pin): GPIO.output(pin,GPIO.HIGH) time.sleep(1) GPIO.output(pin,GPIO.LOW) time.sleep(1) return # to use Raspberry Pi board pin numbers GPIO.setmode(GPIO.BOARD) # set up GPIO output channel GPIO.setup(11, GPIO.OUT) # blink GPIO17 50 times for i in range(0,50): blink(11) GPIO.cleanup()

Hitachi HD44780 based 16x2 character LCD are very cheap and widely available, and is a essential part for any projects that displays information. Using the I2C bus on Raspberry Pi ,PCF8574 IC, and Python characters/strings can be displayed on the LCD. The PCF8574 is an general purpose bidirectional 8 bit I/O port expander that uses the I2C protocol.
The LCD(HD44780) is connected in 4 bit mode as follows to the PCF8574:-

P0 - D4
P1 - D5
P2 - D6
P3 - D7
P4 - RS
P5 - R/W
P6 - E
Port A0 is connected to VCC(5V) with a 10k resistor so that it will be addressed at 0x21.
import smbus from time import * # General i2c device class so that other devices can be added easily class i2c_device: def __init__(self, addr, port): self.addr = addr self.bus = smbus.SMBus(port) def write(self, byte): self.bus.write_byte(self.addr, byte) def read(self): return self.bus.read_byte(self.addr) def read_nbytes_data(self, data, n): # For sequential reads > 1 byte return self.bus.read_i2c_block_data(self.addr, data, n) class lcd: #initializes objects and lcd ''' Reverse Codes: 0: lower 4 bits of expander are commands bits 1: top 4 bits of expander are commands bits AND P0-4 P1-5 P2-6 2: top 4 bits of expander are commands bits AND P0-6 P1-5 P2-4 ''' def __init__(self, addr, port, reverse=0): self.reverse = reverse self.lcd_device = i2c_device(addr, port) if self.reverse: self.lcd_device.write(0x30) self.lcd_strobe() sleep(0.0005) self.lcd_strobe() sleep(0.0005) self.lcd_strobe() sleep(0.0005) self.lcd_device.write(0x20) self.lcd_strobe() sleep(0.0005) else: self.lcd_device.write(0x03) self.lcd_strobe() sleep(0.0005) self.lcd_strobe() sleep(0.0005) self.lcd_strobe() sleep(0.0005) self.lcd_device.write(0x02) self.lcd_strobe() sleep(0.0005) self.lcd_write(0x28) self.lcd_write(0x08) self.lcd_write(0x01) self.lcd_write(0x06) self.lcd_write(0x0C) self.lcd_write(0x0F) # clocks EN to latch command def lcd_strobe(self): if self.reverse == 1: self.lcd_device.write((self.lcd_device.read() | 0x04)) self.lcd_device.write((self.lcd_device.read() & 0xFB)) if self.reverse == 2: self.lcd_device.write((self.lcd_device.read() | 0x01)) self.lcd_device.write((self.lcd_device.read() & 0xFE)) else: self.lcd_device.write((self.lcd_device.read() | 0x10)) self.lcd_device.write((self.lcd_device.read() & 0xEF)) # write a command to lcd def lcd_write(self, cmd): if self.reverse: self.lcd_device.write((cmd >> 4)<<4 0x0f="" cmd="" else:="" self.lcd_device.write="" self.lcd_strobe="" x0="">> 4)) self.lcd_strobe() self.lcd_device.write((cmd & 0x0F)) self.lcd_strobe() self.lcd_device.write(0x0) # write a character to lcd (or character rom) def lcd_write_char(self, charvalue): if self.reverse == 1: self.lcd_device.write((0x01 | (charvalue >> 4)<<4 0x0f="" 2:="" charvalue="" if="" self.lcd_device.write="" self.lcd_strobe="" self.reverse="=" x01="" x04="" x0="">> 4)<<4 0x0f="" charvalue="" else:="" self.lcd_device.write="" self.lcd_strobe="" x04="" x0="" x40="">> 4))) self.lcd_strobe() self.lcd_device.write((0x40 | (charvalue & 0x0F))) self.lcd_strobe() self.lcd_device.write(0x0) # put char function def lcd_putc(self, char): self.lcd_write_char(ord(char)) # put string function def lcd_puts(self, string, line): if line == 1: self.lcd_write(0x80) if line == 2: self.lcd_write(0xC0) if line == 3: self.lcd_write(0x94) if line == 4: self.lcd_write(0xD4) for char in string: self.lcd_putc(char) # clear lcd and set to home def lcd_clear(self): self.lcd_write(0x1) self.lcd_write(0x2) # add custom characters (0 - 7) def lcd_load_custon_chars(self, fontdata): self.lcd_device.bus.write(0x40); for char in fontdata: for line in char: self.lcd_write_char(line)Main Program:-
import pylcdlib lcd = pylcdlib.lcd(0x21,0) lcd.lcd_puts("Raspberry Pi",1) #display "Raspberry Pi" on line 1 lcd.lcd_puts(" Take a byte!",2) #display "Take a byte!" on line 2
Save the above code as test_lcd.py and enter sudo python test_lcd.py
My code assumes that the first 4 bits of the LCD(11,12,13,14) are connected to P0,P1,P2,P3 ports on PCF8574. The next 3 ports on PCF8574(P4,P5,P6) should be connected to 4-RS, 5-R/W, 6-E.However there are other serial backpack lcd's with different pinouts. According to the wiring of your serial backpack LCD you can override the default mapping during initialization.There are 3 modes available-
lcd = pylcdlib.lcd(0x21,0) lower 4 bits of expander are commands bits
lcd = pylcdlib.lcd(0x21,0,1) top 4 bits of expander are commands bits AND P0-4 P1-5 P2-6
lcd = pylcdlib.lcd(0x21,0,2) top 4 bits of expander are commands bits AND P0-6 P1-5 P2-4
(Update):- If you have a Raspberry Pi with a revision 2.0 board, you need to use I²C bus 1, not bus 0, so you will need to change the bus number used. In this case, the line lcd = pylcdlib.lcd(0x21,0) would become lcd = pylcdlib.lcd(0x21,1).
You can check that the device is present on the bus by using the i2cdetect program from the i2ctools package-
i2cdetect 0 -y or i2cdetect 1 -y
Compatible LCD Module for this article:-
The TMP102 is an I2C temperature sensor from Texas Instruments.It's a perfect sensor for Raspberry Pi as it lacks any onboard ADC and TMP102 eliminates the requirement for analyzing the analog signals.When compared with the analog sensors TMP102 is very accurate and capable of measuring 0.0625ºC changes between -25°C and +85°C.

If you have more than one device on the I2C bus you can modify the address of the sensor using the address pin (ADD0).The sensor's address will be 72(0×48 in hex) when the address pin is grounded.It will be set to 73 (0×49 in hex) if the address pin is tied to VCC.
Pi GPI0 Function
---------------------------
Pin 2 SDA
Pin 3 SCL
Pin 26 5V
Make sure your system has the latest version of Linux 3.2 kernel and a proper I2C driver.Also you will be requiring two utilities:-
1) "lm-sensors" package, enter "apt-get install lm-sensors"
2) "I2C tools" package, enter "apt-get install i2c-tools"
After installation we can now use the modprobe i2c-tools.Run "i2cdetect" to check whether TMP102 is connected.
[email protected]:~# i2cdetect -y 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- 48 -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
As we have received the address from i2cdetect, the system has to be updated to get new drivers.
[email protected]:~# echo tmp102 0x48 > /sys/class/i2c-adapter/i2c-0/new_device
Run the "sensors" command to get the temperature:-
[email protected]:~# sensors
tmp102-i2c-0-48
Adapter: bcm2708_i2c.0
temp1: +35.7°C (high = +70.0°C, hyst = +55.0°C)
(Update):- If you have a Raspberry Pi with a revision 2.0 board, you need to use I²C bus 1, not bus 0.You can check that the device is present on the bus by using the i2cdetect program from the i2ctools package:-
i2cdetect 0 -y or i2cdetect 1 -y

If you have more than one device on the I2C bus you can modify the address of the sensor using the address pin (ADD0).The sensor's address will be 72(0×48 in hex) when the address pin is grounded.It will be set to 73 (0×49 in hex) if the address pin is tied to VCC.
Pi GPI0 Function
---------------------------
Pin 2 SDA
Pin 3 SCL
Pin 26 5V
Make sure your system has the latest version of Linux 3.2 kernel and a proper I2C driver.Also you will be requiring two utilities:-
1) "lm-sensors" package, enter "apt-get install lm-sensors"
2) "I2C tools" package, enter "apt-get install i2c-tools"
After installation we can now use the modprobe i2c-tools.Run "i2cdetect" to check whether TMP102 is connected.
[email protected]:~# i2cdetect -y 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- 48 -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
As we have received the address from i2cdetect, the system has to be updated to get new drivers.
[email protected]:~# echo tmp102 0x48 > /sys/class/i2c-adapter/i2c-0/new_device
Run the "sensors" command to get the temperature:-
[email protected]:~# sensors
tmp102-i2c-0-48
Adapter: bcm2708_i2c.0
temp1: +35.7°C (high = +70.0°C, hyst = +55.0°C)
(Update):- If you have a Raspberry Pi with a revision 2.0 board, you need to use I²C bus 1, not bus 0.You can check that the device is present on the bus by using the i2cdetect program from the i2ctools package:-
i2cdetect 0 -y or i2cdetect 1 -y