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 (https://picamera.readthedocs.io/en/release-1.11/changelog.html):

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 (http://picamera.readthedocs.io/en/release-1.11/fov.html#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.



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 https://github.com/rm-hull/ssd1306/archive/master.zip

Install the library, switch to the unpacked download folder:
$ sudo python setup.py 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.


Remark@2017-05-07:

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

(reference: https://github.com/rm-hull/luma.examples/issues/44)


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


Updated@2017-05-14:
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.

Thingiverse

Remark:
I haven't try it by myself!