Blogger Themes

Search This Blog | Copyright © 2017 | All Rights Reserved | Nithin Pradeep . Theme images by Storman. Powered by Blogger.

Follow by Email

Popular KOZHI



Blogger Tricks


What is an Embedded System?

An embedded system is a combination of hardware and software that is designed to carry out a certain task or tasks, meaning it has a s...


Popular Posts


Search results

Search This Blog


More Links




Tuesday, 5 September 2017

Projects On Raspberry Pi


1. IOT Based Smart Home Project on Raspberry Pi 3 (Home Automation)

The Raspberry Pi is a series of small single-board computers developed in the United Kingdom by the Raspberry Pi Foundation to promote the teaching of basic computer science in schools and in developing countries.The original model became far more popular than anticipated,selling outside of its target market for uses such as robotics. Peripherals (including keyboards, mice and cases) are not included with the Raspberry Pi. Some accessories however have been included in several official and unofficial bundles.
According to the Raspberry Pi Foundation, over 5 million Raspberry Pis have been sold before February 2015, making it the best-selling British computer.By November 2016 they had sold 11 million units.
Several generations of Raspberry Pis have been released. The first generation (Raspberry Pi 1 Model B) was released in February 2012. It was followed by the simpler and cheaper Model A. In 2014, the Foundation released a board with an improved design in Raspberry Pi 1 Model B+. These boards are approximately credit-card sized and represent the standard mainline form-factor. Improved A+ and B+ models were released a year later. A "Compute Module" was released in April 2014 for embedded applications. The Raspberry Pi 2 which added more RAM was released in February 2015. A Raspberry Pi Zero with smaller size and reduced input/output (I/O) and general-purpose input/output (GPIO) capabilities was released in November 2015 for US$5. Raspberry Pi 3 Model B released in February 2016 and is bundled with on-board WiFi, Bluetooth and USB boot capabilities. As of January 2017, Raspberry Pi 3 Model B is the newest mainline Raspberry Pi. Raspberry Pi boards are priced between US$5–35. On 28 February 2017, the Raspberry Pi Zero W was launched, which is identical to the Raspberry Pi Zero, but has the Wi-Fi and Bluetooth functionality of the Raspberry Pi 3 for US$10.
All models feature a Broadcom system on a chip (SoC), which includes an ARM compatible central processing unit (CPU) and an on-chip graphics processing unit (GPU, a Video Core IV). CPU speed ranges from 700 MHz to 1.2 GHz for the Pi 3 and on board memory range from 256 MB to 1 GB RAM. Secure Digital(SD) cards are used to store the operating system and program memory in either the SDHC or MicroSDHC sizes. Most boards have between one and four USB slots, HDMI and composite video output, and a 3.5 mm phone jack for audio. Lower level output is provided by a number of GPIO pins which support common protocols like I²C. The B-models have an 8P8C Ethernet port and the Pi 3 and Pi Zero W have on board Wi-Fi 802.11n and Bluetooth.
The Foundation provides Raspbian, a Debian-based Linux distribution for download, as well as third-party Ubuntu, Windows 10 IOT Core, RISC OS, and specialized media center distributions.It promotes Python and Scratch as the main programming language, with support for many other languages. The default firmware is closed source, while an unofficial open source is available.


The Raspberry Pi hardware has evolved through several versions that feature variations in memory capacity and peripheral-device support.
Raspberrypi block function v01.svg
This block diagram depicts Models A, B, A+, and B+. Model A, A+, and the Pi Zero lack the Ethernet and USB hub components. The Ethernet adapter is internally connected to an additional USB port. In Model A, A+, and the Pi Zero, the USB port is connected directly to the system on a chip (SoC). On the Pi 1 Model B+ and later models the USB/Ethernet chip contains a five-point USB hub, of which four ports are available, while the Pi 1 Model B only provides two. On the Pi Zero, the USB port is also connected directly to the SoC, but it uses a micro USB (OTG) port.


The Raspberry Pi 2 uses a 32-bit 900 MHz quad-core ARM Cortex-A7processor.
The Broadcom BCM2835 SoC used in the first generation Raspberry Pi is somewhat equivalent to the chip used in first modern generation smartphones (its CPU is an older ARMv6 architecture),which includes a 700 MHz ARM11 76JZF-S processor, VideoCore IV graphics processing unit (GPU), and RAM. It has a level 1 (L1) cache of 16 KB and a level 2 (L2) cache of 128 KB. The level 2 cache is used primarily by the GPU. The SoC is stacked underneath the RAM chip, so only its edge is visible.
The Raspberry Pi 2 uses a Broadcom BCM2836 SoC with a 900 MHz 32-bit quad-core ARM Cortex-A7 processor, with 256 KB shared L2 cache.
The Raspberry Pi 3 uses a Broadcom BCM2837 SoC with a 1.2 GHz 64-bit quad-core ARM Cortex-A53 processor, with 512 KB shared L2 cache.


The Raspberry Pi 3, with a quad-core Cortex-A53 processor, is described as 10 times the performance of a Raspberry Pi 1.This was suggested to be highly dependent upon task threading and instruction set use. Benchmarks showed the Raspberry Pi 3 to be approximately 80% faster than the Raspberry Pi 2 in parallelized tasks.
Raspberry Pi 2 includes a quad-core Cortex-A7 CPU running at 900 MHz and 1 GB RAM. It is described as 4–6 times more powerful than its predecessor. The GPU is identical to the original.In parallelized benchmarks, the Raspberry Pi 2 could be up to 14 times faster than a Raspberry Pi 1 Model B+.
While operating at 700 MHz by default, the first generation Raspberry Pi provided a real-world performance roughly equivalent to 0.041 GFLOPS. On the CPU level the performance is similar to a 300 MHz Pentium II of 1997–99. The GPU provides 1 Gpixel/s or 1.5 Gtexel/s of graphics processing or 24 GFLOPS of general purpose computing performance. The graphical capabilities of the Raspberry Pi are roughly equivalent to the performance of the Xbox of 2001.
The LINPACK single node compute benchmark results in a mean single precision performance of 0.065 GFLOPS and a mean double precision performance of 0.041 GFLOPS for one Raspberry Pi Model-B board. A cluster of 64 Raspberry Pi Model B computers, labeled "Iridis-pi", achieved a LINPACK HPL suite result of 1.14 GFLOPS (n=10240) at 216 watts for c. US$4000.


The CPU chips of the first and second generation Raspberry Pi board did not require cooling, such as a heat sink, unless the chip was overclocked, but the Raspberry Pi 2 SoC may heat more than usual under overclocking.
Most Raspberry Pi chips could be overclocked to 800 MHz, and some to 1000 MHz. There are reports the Raspberry Pi 2 can be similarly overclocked, in extreme cases, even to 1500 MHz (discarding all safety features and over-voltage limitations). In the Raspbian Linux distro the overclocking options on boot can be done by a software command running "sudo raspi-config" without voiding the warranty. In those cases the Pi automatically shuts the overclocking down if the chip reaches 85 °C (185 °F), but it is possible to override automatic over-voltage and overclocking settings (voiding the warranty); an appropriately sized heat sink is needed to protect the chip from serious overheating.
Newer versions of the firmware contain the option to choose between five overclock ("turbo") presets that when used, attempt to maximize the performance of the SoC without impairing the lifetime of the board. This is done by monitoring the core temperature of the chip, the CPU load, and dynamically adjusting clock speeds and the core voltage. When the demand is low on the CPU or it is running too hot the performance is throttled, but if the CPU has much to do and the chip's temperature is acceptable, performance is temporarily increased with clock speeds of up to 1 GHz depending on the individual board and on which of the turbo settings is used.
The seven overclock presets are:
  • none; 700 MHz ARM, 250 MHz core, 400 MHz SDRAM, 0 overvolting,
  • modest; 800 MHz ARM, 250 MHz core, 400 MHz SDRAM, 0 overvolting,
  • medium; 900 MHz ARM, 250 MHz core, 450 MHz SDRAM, 2 overvolting,
  • high; 950 MHz ARM, 250 MHz core, 450 MHz SDRAM, 6 overvolting,
  • turbo; 1000 MHz ARM, 500 MHz core, 600 MHz SDRAM, 6 overvolting,
  • Pi 2; 1000 MHz ARM, 500 MHz core, 500 MHz SDRAM, 2 overvolting,
  • Pi 3; 1100 MHz ARM, 550 MHz core, 500 MHz SDRAM, 6 overvolting. In system information CPU speed will appear as 1200 MHz. When in idle speed lowers to 600 MHz.
In the highest (turbo) preset the SDRAM clock was originally 500 MHz, but this was later changed to 600 MHz because 500 MHz sometimes causes SD card corruption. Simultaneously in high mode the core clock speed was lowered from 450 to 250 MHz, and in medium mode from 333 to 250 MHz.
The Raspberry Pi Zero runs at 1 GHz.


On the older beta Model B boards, 128 MB was allocated by default to the GPU, leaving 128 MB for the CPU. On the first 256 MB release Model B (and Model A), three different splits were possible. The default split was 192 MB (RAM for CPU), which should be sufficient for standalone 1080p video decoding, or for simple 3D, but probably not for both together. 224 MB was for Linux only, with only a 1080p frame buffer, and was likely to fail for any video or 3D. 128 MB was for heavy 3D, possibly also with video decoding (e.g. XBMC). Comparatively the Nokia 701 uses 128 MB for the Broadcom Video Core IV. For the new Model B with 512 MB RAM initially there were new standard memory split files released( arm256_start.elf, arm384_start.elf, arm496_start.elf) for 256 MB, 384 MB and 496 MB CPU RAM (and 256 MB, 128 MB and 16 MB video RAM). But a week or so later the RPF released a new version of start.elf that could read a new entry in config.txt (gpu_mem=xx) and could dynamically assign an amount of RAM (from 16 to 256 MB in 8 MB steps) to the GPU, so the older method of memory splits became obsolete, and a single start.elf worked the same for 256 and 512 MB Raspberry Pis.
The Raspberry Pi 2 and the Raspberry Pi 3 have 1 GB of RAM.The Raspberry Pi Zero and Zero W have 512 MB of RAM.

GPCLK - General Purpose CLock

General Purpose Clock pins can be set up to output a fixed frequency without any ongoing software control.
The following clock sources are available:
  1. 0 0 Hz Ground
  2. 1 19.2 MHz oscillator
  3. 2 0 Hz testdebug0
  4. 3 0 Hz testdebug1
  5. 4 0 Hz PLLA
  6. 5 1000 MHz PLLC (changes with overclock settings)
  7. 6 500 MHz PLLD
  8. 7 216 MHz HDMI auxiliary
  9. 8-15 0 Hz Ground


  • Uses 3 GPIO pins

PCM - Pulse-code Modulation

PCM (Pulse-code Modulation) is a digital representation of sampled analog. On the Raspberry Pi it's a form of digital audio output which can be understood by a DAC for high quality sound.


The Ground pins on the Raspberry Pi are all electrically connected, so it doesn't matter which one you use if you're wiring up a voltage supply.
Generally the one that's most convenient or closest to the rest of your connections is tidier and easier, or alternatively the one closest to the supply pin that you use.
For example, it's a good idea to use Physical Pin 17 for 3v3 and Physical Pin 25 for ground when using the SPI connections, as these are right next to the important pins for SPI0.


  • 1 pin header
  • Uses 8 GPIO pins

DPI - Display Parallel Interface

One of the alternate functions selectable on bank 0 of the Raspbery Pi GPIO is DPI. DPI (Display Parallel Interface) is a 24-bit parallel interface with 28 clock and synchronisation signals.
This interface allows parallel RGB displays to be attached to the Raspberry Pi GPIO either in RGB24 (8 bits for red, green and blue) or RGB666 (6 bits per colour) or RGB565 (5 bits red, 6 green, and 5 blue). It is available as alternate function 2 (ALT2) on GPIO bank 0.
The pinout presented here is for the RGB24 mode, see url below for documentation of the RGB666 and RGB565 modes.


  • Uses 28 GPIO pins


WiringPi is an attempt to bring Arduino-wiring-like simplicity to the Raspberry Pi.
The goal is to have a single common platform and set of functions for accessing the Raspberry Pi GPIO across multiple languages. WiringPi is a C library at heart, but it's available to both Ruby and Python users who can "gem install wiringpi" or "pip install wiringpi2" respectively.
Python users note the 2 on the end, the WiringPi2-Python library finally brings a whole host of existing WiringPi functionality to Python including brand new features from WiringPi 2.
WiringPi uses its own pin numbering scheme, here you'll learn how WiringPi numbers your GPIO pins, what those pins do and how to do shiny things with them from within Python or Ruby.
Installing to Python couldn't be easier, just:
  1. sudo pip install wiringpi2
For more information about WiringPi you should visit the official WiringPi website.


  • HAT form-factor
  • Uses 28 GPIO pins

UART - Universal Asynchronous Receiver/Transmitter

UART pins in BCM mode are: 14, 15

UART pins in WiringPi are: 15, 16

UART is an asynchronous serial communication protocol, meaning that it takes bytes of data and transmits the individual bits in a sequential fashion.
Asynchronous transmission allows data to be transmitted without the sender having to send a clock signal to the receiver. Instead, the sender and receiver agree on timing parameters in advance and special bits called 'start bits' are added to each word and used to synchronize the sending and receiving units.
UART is commonly used on the Pi as a convenient way to control it over the GPIO, or access the kernel boot messages from the serial console (enabled by default).
It can also be used as a way to interface an Arduino, bootloaded ATmega, ESP8266, etc with your Pi. Be careful with logic-levels between the devices though, for example the Pi is 3.3v and the Arduino is 5v. Connect the two and you might conjure up some magic blue smoke.
Assuming you have WiringPi2-Python installed, the following python example opens the Pi's UART at 9600baud and puts 'hello world'
  1. import wiringpi2 as wiringpi
  2. wiringpi.wiringPiSetup()
  3. serial = wiringpi.serialOpen('/dev/ttyAMA0',9600)
  4. wiringpi.serialPuts(serial,'hello world!')


  • 2 pin header
  • Uses 2 GPIO pins
  • SPI - Serial Peripheral Interface

    SPI0 pins in BCM mode are: 9, 10, 11 + 7/8

    SPI0 pins in WiringPi are: 12, 13, 14 + 10/11

    Known as the four-wire serial bus, SPI lets you daisy-chain multiple compatible devices off a single set of pins by assigning them different chip-select pins.
    A useful example of an SPI peripheral is the MCP23S17 digital IO expander chip ( Note the S in place of the 0 found on the I2C version ). You can also use the SPI port to "Bit-Bang" an ATmega 328, loading Arduino sketches onto it with Gordon Hendersons' modified version of AVRDude.
    To talk to an SPI device, you assert its corresponding chip-select pin. By default the Pi has CE0 and CE1.
    1. import spidev
    2. spi = spidev.SpiDev()
    3., CHIP_SELECT_0_OR_1)
    4. spi.max_speed_hz = 1000000
    5. spi.xfer([value_8bit])


    • 5 pin header
    • Uses 11 GPIO pins

I2C - Inter Integrated Circuit

I2C pins in BCM mode are: 2, 3

I2C pins in WiringPi are: 8, 9

The Raspberry Pi's I2C pins are an extremely useful way to talk to many different types of external peripheral; from the MCP23017 digital IO expander, to a connected ATmega.
The I2C pins include a fixed 1.8 kohms pull-up resistor to 3.3v. This means they are not suitable for use as general purpose IO where a pull-up is not required.
You can verify the address of connected I2C peripherals with a simple one-liner:
  1. sudo apt-get install i2c-tools
  2. sudo i2cdetect -y 1
You can then access I2C from Python using the smbus library:
  1. import smbus
  2. DEVICE_BUS = 1
  3. DEVICE_ADDR = 0x15
  4. bus = smbus.SMBus(DEVICE_BUS)
  5. bus.write_byte_data(DEVICE_ADDR, 0x00, 0x01)


  • Uses 4 GPIO pins

W1-GPIO - One-Wire Interface

To enable the one-wire interface you need to add the following line to /boot/config.txt, before rebooting your Pi:
  1. dtoverlay=w1-gpio
  1. dtoverlay=w1-gpio,gpiopin=x
if you would like to use a custom pin (default is BCM4, as illustrated in pinout herein).
Alternatively you can enable the one-wire interface on demand using raspi-config, or the following:
  1. sudo modprobe w1-gpio
Newer kernels (4.9.28 and later) allow you to use dynamic overlay loading instead, including creating multiple 1-Wire busses to be used at the same time:
  1. sudo dtoverlay w1-gpio gpiopin=4 pullup=0 # header pin 7
  2. sudo dtoverlay w1-gpio gpiopin=17 pullup=0 # header pin 11
  3. sudo dtoverlay w1-gpio gpiopin=27 pullup=0 # header pin 13
once any of the steps above have been performed, and discovery is complete you can list the devices that your Raspberry Pi has discovered via all 1-Wire busses (by default BCM4), like so:
  1. ls /sys/bus/w1/devices/
n.b. Using w1-gpio on the Raspberry Pi typically needs a 4.7 kΩ pull-up resistor connected between the GPIO pin and a 3.3v supply (e.g. header pin 1 or 17). Other means of connecting 1-Wire devices to the Raspberry Pi are also possible, such as using i2c to 1-Wire bridge chips.

SDIO - SD Card Interface

SDIO is the SD host/eMMC interface on the Raspberry Pi. SD host signals are normally used for the microSD slot.
These pins are "SD host" on Alt0 and "eMMC" on Alt3.


  • Uses 6 GPIO pins

JTAG - Joint Test Action Group

JTAG is a standardised interface for debugging integrated circuits which you can use to debug your Raspberry Pi.


  • Uses 11 GPIO pins

0 on: "Projects On Raspberry Pi"