Wednesday, October 11, 2017

motionEyeOS (Raspberry PI) push video and image to dropbox

motionEyeOS can send video and image to cloud storage (Google Drive and Dropbox)

This topic will storage them to Dropbox.

  • Login to motionEyeOS

  • Select File Storage Section
  • Enable Upload Media Files, Upload Pictures and Upload Movies
  • On Upload Service. Select Dropbox.
  • On Location. Select Folder on Dropbox for save video and image. (If don't have folder, go to dropbox create new folder before config motionEyeOS)

  • Click on Obtain Key. It will go to Dropbox for generate Authorization key.

  • Allow Authorization. and copy Authorization key.
  • Enter Authorization key on Authorization key form and click Test service button
  • After success. click on apply for save all config. 

If you enable Motion Detection for record video or save images, after record finish or save images finish. It will push video and image push to Dropbox automatic.

Hope you enjoy with it. 😊

Tuesday, October 10, 2017

motionEyeOS (Raspberry PI) notification via LINE Notify

motionEyeOS (CCTV Software)

motionEyeOS is A Video Surveillance OS For Single-board Computers

motionEyeOS Source:
motionEye Source:

Download motionEyeOS Image:

motionEyeOS Wiki:

How to install can see at Raspberry PI Spy (

LINE Instant Messager

LINE Notify Service:

  • Login with LINE Account

  • Select menu My page

  • Select Generate Token button

  • Enter token name and select 1-on-1 chat with LINE Notify or Group for send notification
  • Select Generate Token button

  • I will show token for send notification. copy it. and select close button

  • In LINE Instant Messenger will have LINE Notify Account add to you.  

Test send notify with curl
curl -k -X POST -H 'Authorization: Bearer [access_token]' -F 'message=hello' https://
After run this curl command. You will receive message 'Hello' to LINE Instant Messenger via LINE Notify

If you want to send Message and Image to LINE Instant Messager, you can curl with this command.

curl -k -X POST -H 'Authorization: Bearer [access_token]' -F 'message=hello' -F 'imageFile=@[**file path to image]' https://
**file path to image = Image file Supported image format is png and jpeg
Image will upload to server for send notification.

More Information
LINE Notify API Document:
LINE Engineer Blog:

Create script for send notification on motionEyeOS

  • create directory /data/script with command
mkdir /data/script
  • create shell script
File: /data/script/

curl -k -X POST -H 'Authorization: Bearer [access_token]' -F "message=$1" https://

File: /data/script/

curl -k -X POST -H 'Authorization: Bearer [access_token]' -F "message=$1" -F "imageFile=@$2" https://

  • change mode of file to executable file.

chmod 755
chmod 755

Test script file

/data/script/ "Good world"

It will receive "Good world" message at LINE Instant Message

/data/script/ "Good Job" "/data/output/Camera1/test.jpg"

It will receive "Good Job" message and test.jpg image at LINE Instant Message.

Now. You can run script for sent notification.

Use notification script at motionEyeOS

  • Login on motionEyeOS

  • Go to Motion Notifications section

  • Enable Run A Command (Send notification if motionEyeOS detect motion on camera)
  • On command box enter command

/data/script/ "Motion Detect at %Y-%m-%d %H-%M-%S"

  • (Option) If you want to send notification after finish motion detect, Enable Run An End Command and  enter command.

/data/script/ "Motion Detect End at %Y-%m-%d %H-%M-%S"

  • If you want to send image of motion detect, go to Still Images section.
  • Select capture mode to Motion Triggered or Motion Triggered (One Picture).

  • go to File storage.
  • Enter command on Run An Command 
/data/script/ "Motion Detect at %Y-%m-%d %H-%M-%S" %f

  • go to Motion Detection Section. Enable Motion Detection

  • Select Apply button on top to apply all config.

If motion detect of motionEyeOS detected, I will send "Motion Detect at [Date and Time]" message to LINE Instant Message.

After finish with motion detect (nothing movement) Send "Motion Detect End at [Date and Time]" message to LINE Instant Message.

and Send "Motion Detect at [Date and Time]" message " and image file to send to LINE Instant Message

Wednesday, May 25, 2016

Waveshare 7inch HDMI LCD (C) and 5inch HDMI LCD (B) on NOOBS


Waveshare 7 inch HDMI LCD (C)

Waveshare 5 inch HDMI LCD (B)

NOOBS (Raspberrry PI)

First write NOOBS Image to SD Card.
After finished.

Create file config.txt on NOOBS SDCard. (It don't have config.txt on NOOBS image)

config.txt  (for 7 inch HDMI LCD (C))

# 1024 x 600
hdmi_cvt 1024 600 60 6 0 0 0

config.txt (for 5 inch HDMI LCD (B))

hdmi_cvt 800 480 60 6 0 0 0
Save it. and eject from computer.
Try to boot with Raspberry PI to test it.

All image on NOOBS should change config.txt for support this HDMI LCD Device.

Enjoy ;)

NOOBS (Raspberrry PI)

Friday, March 25, 2016

Live TV DVB-T2 with VDR Addons on OpenELEC

I have Geniatech DVB-T2 Stick T220.
I use OpenELEC to play Live TV with it.

Current version of OpenELEC is 6.0.3.

First install services add-ons VDR PVR Backend.
Goto: System -> Settings -> Add-ons -> Install from repository -> OpenELEC Add-ons (offical) -> Services -> VDR PVR Backend

Install VDR PVR Backend

After Installed. Go back to PVR clients.

Install VDR VNSI Client (If VDR VNSI Client is not installed)

Select Configure of VDR VNSI Client.

Enable create channel groups automatically on the server And OK.

Next Goto Home -> Programs -> VDR Configuration

Select Channel scanner Configuration

Start scanning TV channel.
  • Tuner Type: DVB-T
  • Country: <your location>
  • Cleanup all
And Start

After scan completed. Select Close.

Enable TV menu on OpenELEC
Goto: Home -> System -> Settings -> TV

Select Enable:  General -> Enabled and Synchronis channel groups with backend(s)

Go back to Home and Select TV

Now already to watch Live TV from DVB-T2 Device and recording.

Have a good day. :)


VDR PVR Backend has other plugins to use.
You can enable on configure menu.

Goto: Home -> System -> Settings -> Add-ons -> Install from repository -> OpenELEC Add-ons (offical) -> Services -> VDR PVR Backend

Select Configure.

You can enable other plugins if you want to use.

VDR - The Video Disk Recorder

VDR Wiki

Thursday, March 24, 2016

Add custom keyboard layout to OpenELEC image

OpenELEC system partition on Raspberry PI is read-only filesystem (squash filesystem or squashfs).
I cannot change anything of system partition or add custom keyboard layout.

If you want to change something on this filesystem, you should unpack and repack squashfs image.

I use Ubuntu 15.10 for repack squashfs image.

First install squashfs-tools for re-create squashfs image.
$ sudo apt-get update
$ sudo apt-get install squashfs-tools

Download OpenELEC Image and extract compress file.

Backup original and copy to new image file.

$ cp OpenELEC_original.img OpenELEC_custom.img

Mount image file to loop device (/dev/loop0)
$ sudo losetup -P /dev/loop0 OpenELEC_custom.img

option -P for create a partitioned loop device (/dev/loop0p1, /dev/loop0p2)

Check partitioned loop device with fdisk.
$ sudo fdisk -l /dev/loop0
Disk /dev/loop0: 548 MiB, 574619648 bytes, 1122304 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x3902d568
Device       Boot   Start     End Sectors  Size Id Type
/dev/loop0p1 *       2048 1050624 1048577  512M  c W95 FAT32 (LBA)
/dev/loop0p2      1052672 1118208   65537   32M 83 Linux

It created /dev/loop0p1 and /dev/loop0p2.

Create boot and system directory
$ mkdir boot system

Mount  first loop partition (/dev/loop0p1) to boot partition.
$ mount -t vfat /dev/loop0p1 boot

Check all file on boot partition.
$ ls boot
bcm2708-rpi-b.dtb       bootcode.bin  fixup.dat   start.elf
bcm2708-rpi-b-plus.dtb  cmdline.txt   kernel.img  SYSTEM
bcm2708-rpi-cm.dtb      config.txt    overlays

It found SYSTEM file (OpenELEC system filesystem).

Mount SYSTEM file to system partition.
$ mount -t squashfs boot/SYSTEM system

Check all file on system partition.
$ ls -F system
bin/  etc/    lib/    opt/   run/   storage/  tmp/  var/
dev/  flash/  media@  proc/  sbin/  sys/      usr/

Create temporary directory for copy all file on system partition and add custom keyboard layout.
$ mkdir tmpsystem

Copy all file of system to temporary directory
$ sudo cp -Rpf system/. tmpsystem

After copy all file to temporary directory.
Unmount system filesystem.
$ sudo umount system

OK. Now you can change everything on temporary directory.

Location Kodi system data on OpenELEC: /usr/share/kodi

Kodi keyboard layout directory on OpenELEC (/usr/share/kodi/system/keyboardlayouts)
You can add custom keyboard layout or change exists keyboard layout on this directory.

Now: tmpsystem/usr/share/kodi/system/keyboardlayouts

Example. I want to add Thai keyboard layout (thai.xml) to this directory.
Copy thai.xml to tmpsystem/usr/share/kodi/system/keyboardlayouts
$ sudo cp thai.xml tmpsystem/usr/share/kodi/system/keyboardlayouts

OK. Now you finished to change temporary directory.

I will re-create system filesystem  (SYSTEM file) from temporary directory with mksquashfs.

$ sudo mksquashfs tmpsystem SYSTEM -noappend -comp gzip

Now. I have new SYSTEM file.

Delete SYSTEM file on boot partition.

$ sudo rm boot/SYSTEM

Copy new SYSTEM file to boot partition.

$ sudo cp SYSTEM boot

Unmount boot partition.

$ sudo umount boot

Deattach loop device from OpenELEC image.

$ sudo losetup -d /dev/loop0

Delete temporary directory

$ sudo rm -Rf tmpsystem

OK. Now. OpenELEC image (OpenELEC_custom.img) has changed.

Try to write image to sdcard for test it.

Goto  System -> Settings -> Appearance -> International -> Keyboard layouts
Select Thai keyboard layout.


You can add font to Kodi on system font path: /usr/share/kodi/media/Fonts.


Monday, October 5, 2015

How to compile nginx with nginx-rtmp-module

Prepare environment for compile.
$ sudo apt-get update
$ sudo apt-get install libpcre3-dev libatomic-ops-dev libgeoip-dev geoip-bin geoip-database geoip-database-extra libperl-dev libssl-dev libxml2-dev libxslt1-dev

Create directory src

$ mkdir src

Download Nginx (last version)

$ cd src
$ wget
$ tar -xvzf nginx-1.9.5.tar.gz

Git Clone nginx-rtmp-module

$ git clone

Change current to nginx-1.9.5

$ cd nginx-1.9.5

Run configure

$ ./configure --prefix=/usr/local/nginx --user=www-data --group=www-data --with-select_module --with-poll_module --with-threads --with-file-aio --with-ipv6 --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module --with-http_image_filter_module --with-http_geoip_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module  --with-http_auth_request_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_stub_status_module --with-http_perl_module --with-mail --with-mail_ssl_module --with-pcre --with-pcre-jit --with-md5-asm --with-sha1-asm --with-libatomic --with-pcre --with-stream --with-stream_ssl_module --with-http_v2_module --add-module=../nginx-rtmp-module

Run make to compile

$ make

Install nginx to /usr/local/nginx

$ sudo make install

Config Nginx on /usr/local/nginx/conf/nginx.conf

$ sudo nano /usr/local/nginx/conf/nginx.conf

Config for streaming server see on nginx-rtmp-module wiki

Web path /usr/local/nginx/html

Start nginx service

$ sudo /usr/local/nginx/sbin/nginx

Stop nginx service

$ sudo /usr/local/nginx/sbin/nginx -s stop


nginx-rtmp-module (source code)

nginx-rtmp-module (wiki)

Streaming with nginx-rtmp-module

Wednesday, September 30, 2015

Install font to OpenELEC

How to install new font to OpenELEC

Login with root to OpenELEC.

# mkdir -p /storage/.xbmc/media/Fonts
# mkdir -p /storage/.kodi/media/Fonts

Upload truetype font to this path.

Reboot OpenELEC again.

How to Disable Power Management of rtl8192cu

Fix problem wireless disconnect and go to save mode.

Create file /etc/modprobe.d/8192cu.conf

$ sudo nano /etc/modprobe.d/8192cu.conf

add this line

options 8192cu rtw_power_mgnt=0 rtw_enusbss=0

Restart raspberry pi

Reference :


How to build DLNA/UPnP Server on Raspberry PI for use at Home device.
(Example TV, Media player, PS3, Xbox etc.)

Install minidlna package

$ sudo apt-get install minidlna

Add pi user to minidlna group

$ sudo usermod -a -G minidlna pi

Create Directory for store media file


$ mkdir -p /home/pi/minidlna/music
$ mkdir -p /home/pi/minidlna/pictures
$ mkdir -p /home/pi/minidlna/videos
$ mkdir -p /home/pi/.minidlna

Change Mode of /home/pi/minidlna and /home/pi/.minidlna
$ sudo chmod 777 /home/pi/minidlna
$ sudo chmod 777 /home/pi/.minidlna

Config MiniDLNA

$ sudo nano /etc/minidlna.conf

Modify this file
# * "A" for audio (eg. media_dir=A,/var/lib/minidlna/music)
# * "P" for pictures (eg. media_dir=P,/var/lib/minidlna/pictures)
# * "V" for video (eg. media_dir=V,/var/lib/minidlna/videos)
# Name that the DLNA server presents to clients.
friendly_name=RASPBERRY DLNA
# Automatic discovery of new files in the media_dir directory.
# Notify interval, in seconds.notify_interval=895...

Restart MiniDLNA Service

$ sudo /etc/init.d/minidlna restart

Or re-indexing all of media files

$ sudo /etc/init.d/minidlan force-reload

Test on Device supported with DLNA/UPnP to play media.


Digital Living Network Alliance

ReadyMedia (MiniDLNA Source Code)

ReadyMedia (Wiki of Archlinux)

Tuesday, August 11, 2015

How to use own remote control for OpenELEC

IR Receiver (TSOP44.., TSOP48.., TSOP38238, ...)

Connect IR Receiver to Raspberry Pi

Vcc -> 3V
Vout -> GPIO 18

Load LIRC module on boot.
Edit /boot/config.txt
Add line


or (change GPIO pin in for IR Receiver)


See on :

Learning own remote control

Kill Process of LIRCD

# killall lircd

Start learning remote control button.

# irrecord /storage/.config/lircd.conf

irrecord -  application for recording IR-codes for usage with lirc

Copyright (C) 1998,1999 Christoph Bartelmus(

This program will record the signals from your remote control
and create a config file for lircd.

A proper config file for lircd is maybe the most vital part of this
package, so you should invest some time to create a working config
file. Although I put a good deal of effort in this program it is often
not possible to automatically recognize all features of a remote
control. Often short-comings of the receiver hardware make it nearly
impossible. If you have problems to create a config file READ THE
DOCUMENTATION of this package, especially section "Adding new remote
controls" for how to get help.

If there already is a remote control of the same brand available at you might also want to try using such a
remote as a template. The config files already contain all
parameters of the protocol used by remotes of a certain brand and
knowing these parameters makes the job of this program much
easier. There are also template files for the most common protocols
available in the remotes/generic/ directory of the source
distribution of this package. You can use a template files by
providing the path of the file as command line parameter.

Please send the finished config files to  so that I
can make them available to others. Don't forget to put all information
that you can get about the remote control in the header of the file.

Press RETURN to continue.

Now start pressing buttons on your remote control.

It is very important that you press many different buttons and hold them
down for approximately one second. Each button should generate at least one
dot but in no case more than ten dots of output.
Don't stop pressing buttons until two lines of dots (2x80) have been

Press RETURN now to start recording.

Found const length: 107201
Please keep on pressing buttons like described above.
Space/pulse encoded remote control found.
Signal length is 67.
Found possible header: 8951 4451
Found trail pulse: 572
Found repeat code: 8961 2214
Signals are space encoded.
Signal length is 32
Now enter the names for the buttons.

Please enter the name for the next button (press  to finish recording)

Now hold down button "KEY_POWER".

Please enter the name for the next button (press  to finish recording)

Now hold down button "KEY_1".

Please enter the name for the next button (press  to finish recording)

Now hold down button "KEY_2".

Please enter the name for the next button (press  to finish recording)

Now hold down button "KEY_3".

Please enter the name for the next button (press  to finish recording)

If you want to know irrecord key and button name list, use this command.

# irrecord --list

It will display list of key and button name.

IR Remote Key for OpenELEC on Raspberry PI (See on file /etc/lirc/lircd.conf.rpi)

After finish all key. Press Enter for finished.

(If you type incorrect or some problem about step, delete file /storage/.config/lircd.conf and run irrecord command)

Reboot OpenELEC.

# shutdown -r now

Test IR Remote for control menu on OpenELEC.

Reference :

Device Tree overlays

Guide To lirc rpi GPIO Receiver

Guide to add your own remote