Monday, June 27, 2016

picamera updated 1.11

Picamera updated 1.11, now support Camera V2. If you not yet updated, run the command to update:
$ sudo apt-get update
$ sudo apt-get upgrade

Suggested to update firmware also:
$ sudo rpi-update

Release 1.11 (2016-06-19) Change log (

1.11 on the surface consists mostly of enhancements, but underneath includes a major re-write of picamera’s core:

  • Direct capture to buffer-protocol objects, such as numpy arrays (#241)
  • Add request_key_frame() method to permit manual request of an I-frame during H264 recording; this is now used implicitly by split_recording() (#257)
  • Added timestamp attribute to query camera’s clock (#212)
  • Added framerate_delta to permit small adjustments to the camera’s framerate to be performed “live” (#279)
  • Added clear() and copy_to() methods to PiCameraCircularIO (#216)
  • Prevent setting attributes on the main PiCamera class to ease debugging in educational settings (#240)
  • Due to the core re-writes in this version, you may require cutting edge firmware (sudo rpi-update) if you are performing unencoded captures, unencoded video recording, motion estimation vector sampling, or manual sensor mode setting.
  • Added property to control preview’s resolution separately from the camera’s resolution (required for maximum resolution previews on the V2 module - #296).

There are also several bug fixes:

  • Fixed basic stereoscopic operation on compute module (#218)
  • Fixed accessing framerate as a tuple (#228)
  • Fixed hang when invalid file format is specified (#236)
  • Fixed multiple bayer captures with capture_sequence() and capture_continuous() (#264)
  • Fixed usage of “falsy” custom outputs with motion_output (#281)
Many thanks to the community, and especially thanks to 6by9 (one of the firmware developers) who’s fielded seemingly endless questions and requests from me in the last couple of months!

Hardware Limits (

The are additional limits imposed by the GPU hardware that performs all image and video processing:

  • The maximum resolution for MJPEG recording depends partially on GPU memory. If you get “Out of resource” errors with MJPEG recording at high resolutions, try increasing gpu_mem in /boot/config.txt.
  • The maximum horizontal resolution for default H264 recording is 1920. Any attempt to recording H264 video at higher horizontal resolutions will fail.
  • However, H264 high profile level 4.2 has slightly higher limits and may succeed with higher resolutions.
  • The maximum resolution of the V2 camera can cause issues with previews. Currently, picamera runs previews at the same resolution as captures (equivalent to -fp in raspistill). You may need to increase gpu_mem in /boot/config.txt to achieve full resolution operation with the V2 camera module.
  • The maximum framerate of the camera depends on several factors. With overclocking, 120fps has been achieved on a V2 module but 90fps is the maximum supported framerate.
  • The maximum exposure time is currently 6 seconds on the V1 camera module, and 10 seconds on the V2 camera module. Remember that exposure time is limited by framerate, so you need to set an extremely slow framerate before setting shutter_speed.

Building the Web of Things: With examples in Node.js and Raspberry Pi

A hands-on guide that will teach how to design and implement scalable, flexible, and open IoT solutions using web technologies. This book focuses on providing the right balance of theory, code samples, and practical examples to enable you to successfully connect all sorts of devices to the web and to expose their services and data over REST APIs.

Building the Web of Things: With examples in Node.js and Raspberry Pi

Purchase of the print book includes a free eBook in PDF, Kindle, and ePub formats from Manning Publications.

About the Technology

Because the Internet of Things is still new, there is no universal application protocol. Fortunately, the IoT can take advantage of the web, where IoT protocols connect applications thanks to universal and open APIs.

About the Book

Building the Web of Things is a guide to using cutting-edge web technologies to build the IoT. This step-by-step book teaches you how to use web protocols to connect real-world devices to the web, including the Semantic and Social Webs. Along the way you'll gain vital concepts as you follow instructions for making Web of Things devices. By the end, you'll have the practical skills you need to implement your own web-connected products and services.

What's Inside
  • Introduction to IoT protocols and devices
  • Connect electronic actuators and sensors (GPIO) to a Raspberry Pi
  • Implement standard REST and Pub/Sub APIs with Node.js on embedded systems
  • Learn about IoT protocols like MQTT and CoAP and integrate them to the Web of Things
  • Use the Semantic Web (JSON-LD, RDFa, etc.) to discover and find Web Things
  • Share Things via Social Networks to create the Social Web of Things
  • Build a web-based smart home with HTTP and WebSocket
  • Compose physical mashups with EVRYTHNG, Node-RED, and IFTTT
About the Reader

For both seasoned programmers and those with only basic programming skills.

About the Authors

Dominique Guinard and Vlad Trifa pioneered the Web of Things and cofounded EVRYTHNG, a large-scale IoT cloud powering billions of Web Things.

Table of Contents

1. From the Internet of Things to the Web of Things
2. Hello, World Wide Web of Things
3. Node.js for the Web of Things
4. Getting started with embedded systems
5. Building networks of Things
6. Access: Web APIs for Things
7. Implementing Web Things
8. Find: Describe and discover Web Things
9. Share: Securing and sharing Web Things

Saturday, June 25, 2016

Learn Electronics with Raspberry Pi: Physical Computing with Circuits, Sensors, Outputs, and Projects

Learn Electronics with Raspberry Pi: Physical Computing with Circuits, Sensors, Outputs, and Projects

Learning electronics can be tremendous fun ― your first flashing LED circuit is a reason to celebrate! But where do you go from there, and how can you move into more challenging projects without spending a lot of money on proprietary kits? One excellent answer is Raspberry Pi.

Raspberry Pi is everywhere, it’s inexpensive, and it's a wonderful tool for teaching about electronics and programming. Learn Electronics with Raspberry Pi shows you how to make a variety of cool projects using the Pi with programming languages like Scratch and Python, with no experience necessary. You'll learn how the Pi works, how to work with Raspbian Linux on the Pi, and how to design and create electronic circuits. You'll then create projects like an arcade game, disco lights, and infrared transmitter, and an LCD display. You'll also learn how to control Minecraft's Steve with a joystick and how to build a Minecraft house with a Pi, and even how to control a LEGO train with a Pi. You'll even learn how to create your own robot, including how to solder and even design a printed circuit board!

  • Learn how to design and build electronic circuits, and even how to make a PCB
  • Learn how to make fun projects like an arcade game, a robot, and a Minecraft controller while learning about sensors and how devices talk to each other
  • Get started programming the Pi with Scratch and Python

Exploring Raspberry Pi: Interfacing to the Real World with Embedded Linux

Expand Raspberry Pi capabilities with fundamental engineering principles

Exploring Raspberry Pi: Interfacing to the Real World with Embedded Linux

Exploring Raspberry Pi is the innovators guide to bringing Raspberry Pi to life. This book favors engineering principles over a 'recipe' approach to give you the skills you need to design and build your own projects. You'll understand the fundamental principles in a way that transfers to any type of electronics, electronic modules, or external peripherals, using a "learning by doing" approach that caters to both beginners and experts. The book begins with basic Linux and programming skills, and helps you stock your inventory with common parts and supplies. Next, you'll learn how to make parts work together to achieve the goals of your project, no matter what type of components you use. The companion website provides a full repository that structures all of the code and scripts, along with links to video tutorials and supplementary content that takes you deeper into your project.

The Raspberry Pi's most famous feature is its adaptability. It can be used for thousands of electronic applications, and using the Linux OS expands the functionality even more. This book helps you get the most from your Raspberry Pi, but it also gives you the fundamental engineering skills you need to incorporate any electronics into any project.

  • Develop the Linux and programming skills you need to build basic applications
  • Build your inventory of parts so you can always "make it work"
  • Understand interfacing, controlling, and communicating with almost any component
  • Explore advanced applications with video, audio, real-world interactions, and more

Be free to adapt and create with Exploring Raspberry Pi.

Wednesday, June 22, 2016

RPi NoIR V2 Camera vs UV-IR CUT vs 720nm Infrared (Hoya R72) filter

After the post "Compare Pi Camera NoIR v1 vs V2", many people ask me about the filters I used. This post show the effect of the filter UV-IR CUT and Hoya R72 used on NoIR V2/Raspberry Pi 3.

Monday, June 20, 2016

Raspberry Pi display on 128x64 I2C OLED with SSD1306, using Python

This post show how to install rm-hull/ssd1306 on Raspberry Pi, and run the example to display on 0.96" 128x64 I2C OLED with SSD1306 driver, using Python.

rm-hull/ssd1306 interfacing OLED matrix displays with the SSD1306 (or SH1106) driver in Python using I2C on the Raspberry Pi.

Before install rm-hull/ssd1306, we have to enable I2C on the Raspberry Pi.

Connect a 0.96" 128x64 I2C OLED to Raspberry Pi 2 as shown:
3V3, GND, SDA and SCL respectively.
(my OLED support both 3.3V and 5V)

Download rm-hull/ssd1306 with:
$ wget

Install the library, switch to the unpacked download folder:
$ sudo python install

Install some packages:

$ sudo apt-get install i2c-tools python-smbus python-pip
$ sudo pip install pillow

That's, now you can try the example, refer to the video.


Somebody commented with error of:
error in luma.oled setup command : 'extras_require' must be a dictionary whose values are strings or lists of strings containing valid project/version requirement specifiers.

I google to found that it may be because of the version of setuptools.

Install and upgrade setuptools:
$ sudo -H pip install --upgrade pip setuptools


NodeMCU/ESP8266 + OLED 0.96" 128x64 I2C SSD1306 using esp8266-oled-ssd1306 library

The driver renamed rm-hull/luma.oled, and updated to support SSD1306 / SSD1322 / SSD1325 / SSD1331 / SH1106 OLED.

Enable I2C on Raspberry Pi running Raspbian Jessie

This post show how to enable I2C (or IIC) interface on Raspberry Pi running Raspbian Jessie.

This test run on Raspberry Pi 2/Raspbian Jessie (2016-05-27)

To run Raspberry Pi Configuration:

> Menu > Preferences > Raspberry Pi Configuration

Select Interfaces tab, and click to enable I2C, OK.

Install i2c-tools, such that you can scan any connected I2C devices, and find its I2C address.
$ sudo apt install i2c-tools

Power off Raspberry Pi, connect I2C device and power on.

run the i2cdetect with option 1 for rev 2 board, or option 0 for rev 1 board.
$ sudo i2cdetect -y 1
$ sudo i2cdetect -y 0

(The connected device with I2C address 0x3C shown in the video is a I2C OLED display, refer to next post: Raspberry Pi display on 128x64 I2C OLED with SSD1306, using Python)

Wednesday, June 8, 2016

Raspberry Pi Camera V2.1 Lens Adjustment Spanner

"Raspberry Pi Camera V2.1 Lens Adjustment Spanner" is suited for the Raspberry Pi Camera V2.1 and if you print two of them, you will have a 8mm socket to hold the lens base and the other end to adjust the lens.


I haven't try it by myself!