XMEN BLOGGER: January 2017

Sunday, January 29, 2017

Raspberry Pi - RetroPie configuration


-RetroPie SetUp
https://github.com/retropie/retropie-setup/wiki/manual-installation

-SSH configuration
https://github.com/retropie/retropie-setup/wiki/ssh

-Updating RetroPie
https://github.com/retropie/retropie-setup/wiki/updating-retropie

-Setting up PS3 controller
https://github.com/retropie/retropie-setup/wiki/Setting-up-a-PS3-controller

-Adding C64 emulator
https://www.youtube.com/watch?v=u2TwHKVYAZk

Green Laser Telescope for Astronomy


-Where to buy:

http://www.potentelaser.com/laser-verde-50mw-comprar.html

http://torlaser.com/es/2-greenpocket-puntero-laser-verde-50mw-de-torlaser.html



https://oxlasers.en.alibaba.com/product/916515069-218703343/OXLasers_OX_G306_1_100mW_burning_focusable_MINI_Green_Laser_Pointer_torch_light_matches_visible_green_beam.html

https://wholesaler.alibaba.com/product-detail/OXLasers-focusable-Green-Laser-Pointer-with_60406913165.html

http://www.telescopiomania.com/accesorios-para-telescopios-astronomicos/3173-laser-verde-lunatico-astronomia-con-soporte-para-telescopio.html?gclid=CMK8sK3Ro9ECFYwQ0wod3WEDOg

http://tienda.lunatico.es/



Cosmik - Soporte buscador laser universal
http://www.telescopiosbarcelona.es/55-laser-verde#/

Orion 52062 SkyLine Deluxe Laser Pointer-to-Telescope Bracket *******
http://www.ebay.com/itm/Orion-52062-SkyLine-Deluxe-Laser-Pointer-to-Telescope-Bracket-/122283404157?hash=item1c78a8ab7d:g:T-gAAOSwEzxYXtRE

Laser Pointer-to-Telescope Bracket
http://www.telescope.com/Accessories/Telescope-Finder-Scopes/Orion-SkyLine-Deluxe-Laser-Pointer-to-Telescope-Bracket/c/3/sc/49/p/52062.uts

Solomark Adjustable Laser Pointer Bracket
Laser Pointer Finderscope Bracket for Telescope - Astronomy
http://www.ebay.com/itm/Laser-Pointer-Finderscope-Bracket-for-Telescope-Astronomy-/201479155841?hash=item2ee917f081:g:-yUAAOSw6BtVUuI1



Orion Dual Finder Scope Mounting Bracket
http://www.telescope.com/Orion-Dual-Finder-Scope-Mounting-Bracket/p/102788.uts

Skywatcher Bracket Scope
http://www.ebay.com/itm/New-Standard-Deluxe-Multi-Slot-Finder-Scope-Bracket-for-Vixen-SkyWatcher-Finder-/361762099005?hash=item543ab38f3d:g:za0AAOSwzaJX7dgO

https://www.firstlightoptics.com/finders/flo-multi-finder-adapter-for-skywatcher.html



Telescope Smartphone Finder Scope Mirror Bracket for SKYATCHER ******
http://www.ebay.com/itm/Telescope-Smartphone-Finder-Scope-Mirror-Bracket-for-SKYATCHER-VIXEN-Standards-/172348431994?hash=item2820c45e7a:g:lJkAAOSwOyJX4Kp7

S8049 smartphone bracket
https://www.aliexpress.com/store/product/S8049-smartphone-bracket-Astronomical-telescope-phone-finder-scope-mirror-for-SKYATCHER-VIXEN-type/1371081_32350751366.html



Black Metal Small Dovetail Board Plate for Optical Telescope Finderscope



- DIY e.g. Red Laser Pointer

From:
http://laserpointerforums.com/f50/cheap-red-laser-300mw-build-pics-heavy-91508.html

Survival Laser DIY C6 Host Assembly 10.89$+1$(drilled driver pill)
Survival Laser Red Anodized Aluminum Heat Sink 7.99$
10pcs Aixiz Standard acrylic lens 12.00$/10=1.2$ each
Aixiz laser module 5.6mm 4.50$
2pcs Contact board (cheap led driver) 2.77$/2=1.385$ each
Aixiz adjustable current laser diode driver 80-500mA w/TTL 3.75$
10pcs Red Laser Diodes ML101U29-25 29.98$/10=2.998$ each

Together 33.72$+shipping






Raspberry Pi - Installing OS images on Mac


From:
https://www.raspberrypi.org/documentation/installation/installing-images/mac.md



-Open a terminal, then run:

diskutil list

Identify the disk (not partition) of your SD card e.g. disk4, not disk4s1.

-Unmount your SD card by using the disk identifier, to prepare for copying data to it:

diskutil unmountDisk /dev/disk

where disk is your BSD name e.g. diskutil unmountDisk /dev/disk4

-Copy the data to your SD card:

sudo dd bs=1m if=image.img of=/dev/rdisk

where disk is your BSD name e.g. sudo dd bs=1m if=2017-01-11-raspbian-jessie.img of=/dev/rdisk4

This may result in a dd: invalid number '1m' error if you have GNU coreutils installed. In that case, you need to use a block size of 1M in the bs= section, as follows:

sudo dd bs=1M if=image.img of=/dev/rdisk

This will take a few minutes, depending on the image file size. You can check the progress by sending a SIGINFO signal pressing Ctrl+T.

If this command still fails, try using disk instead of rdisk, for example:

sudo dd bs=1m if=2017-01-11-raspbian-jessie.img of=/dev/disk4

or

sudo dd bs=1M if=2017-01-11-raspbian-jessie.img of=/dev/disk4

-After the dd command finishes, eject the card:

sudo diskutil eject /dev/rdisk3



Or using ApplePi Baker for macOS!!!



Summary:

$ diskutil list
$ diskutil unmountDisk /dev/disk3
$ sudo dd bs=1m if=SDimage.img of=/dev/rdisk3
$ diskutil eject /dev/rdisk3



Format USB disk ( and ExFAT):

$ diskutil list
$ diskutil unmountDisk /dev/disk3
$ diskutil eraseDisk ExFAT Files /dev/disk3

or...

$ diskutil eraseDisk JHFS+ SDcard /dev/disk3

Where "Files" and "SDcard" is the lavel of the device.

Saturday, January 28, 2017

Raspberry Pi - Add Commodore 64 emulator to RetroPie


-VICE Emulator
https://github.com/retropie/retropie-setup/wiki/Commodore-64

-Install VICE on RetroPie (Video - Youtube)
https://www.youtube.com/watch?v=u2TwHKVYAZk

-Amiga emulator(UAE4ALL2) on Raspberry Pi
https://www.youtube.com/watch?v=1s1BJXzsoRM
https://www.raspberrypi.org/forums/viewtopic.php?f=78&t=102328

-ROMS
http://www.gametronik.com/site/emulation/commodore_c64/

-C64 Mod (RaspberryPi)
http://www.breadbox64.com/blog/c64-raspberrypi-mod/#comment-926
Note: Uses Neutrik connectors

-ROMS & Videos
https://c64endings.wordpress.com



ROMs compatibles *****
Tapes.c64.no

http://www.commodorezone.com/64tapef.htm

Monday, January 23, 2017

Cygwin - How to run a crontab


Install cron (Vixie's Cron) first!!! From Cygwin setup.exe!!!



From:
http://stackoverflow.com/questions/707184/how-do-you-run-a-crontab-in-cygwin-on-windows

You have two options:

1. Install cron as a windows service, using cygrunsrv:

cygrunsrv -I cron -p /usr/sbin/cron -a -D
net start cron

2. The 'non .exe' files are probably bash scripts, so you can run them via the windows scheduler by invoking bash to run the script, e.g.:

C:\cygwin\bin\bash.exe -l -c "./full-path/to/script.sh"



Hat tip http://linux.subogero.com/894/cron-on-cygwin/

Start the cygwin-setup and add the “cron” package from the “Admin” category.

We’ll run cron as a service by user SYSTEM. Poor SYSTEM therefore needs a home directory and a shell. The “/etc/passwd” file will define them.

$ mkdir /root
$ chown SYSTEM:root /root
$ mcedit /etc/passwd
SYSTEM:*:......:/root:/bin/bash

The start the service:

$ cron-config
Do you want to remove or reinstall it (yes/no) yes
Do you want to install the cron daemon as a service? (yes/no) yes
Enter the value of CYGWIN for the daemon: [ ] ntsec
Do you want the cron daemon to run as yourself? (yes/no) no
Do you want to start the cron daemon as a service now? (yes/no) yes

Local users can now define their scheduled tasks like this (crontab will start your favourite editor):

$ crontab -e # edit your user specific cron-table HOME=/home/foo
PATH=/usr/local/bin:/usr/bin:/bin:$PATH
# testing
* * * * * touch ~/cron @reboot ~/foo.sh 45 11 * * * ~/lunch_message_to_mates.sh

Domain users: it does not work. Poor cron is unable to run scheduled tasks on behalf of domain users on the machine. But there is another way: cron also runs stuff found in the system level cron table in “/etc/crontab”. So insert your suff there, so that SYSTEM does it on its own behalf:

$ touch /etc/crontab
$ chown SYSTEM /etc/crontab
$ mcedit /etc/crontab
HOME=/root
PATH=/usr/local/bin:/usr/bin:/bin:$PATH
* * * * * SYSTEM touch ~/cron
@reboot SYSTEM rm -f /tmp/.ssh*

Finally a few words about crontab entries. They are either environment settings or scheduled commands. As seen above, on Cygwin it’s best to create a usable PATH. Home dir and shell are normally taken from “/etc/passwd”.

As to the columns of scheduled commands see the manual page.

If certain crontab entries do not run, the best diagnostic tool is this:

$ cronevents



Applied the instructions from this answer and it worked Just to point out a more copy paste like answer (because cygwin installation procedure is kind of anti-copy-paste wise implemented).
Click WinLogo button , type cmd.exe , right click it , choose "Start As Administrator". In cmd prompt:

cd cygwin installer:
set package_name=cygrunsrv cron
setup-x86_64.exe -n -q -s http://cygwin.mirror.constant.com -P %package_name%

Ensure the installer does not throw any errors in the prompt ... If it has - you probably have some cygwin binaries running or you are not an Windows admin, or some freaky bug ...

Now in cmd promt:

C:\cygwin64\bin\cygrunsrv.exe -I cron -p /usr/sbin/cron -a -D
or whatever full file path you might have to the cygrunsrv.exe and start the cron as windows service in the cmd prompt

net start cron

Now in bash terminal run:

crontab -e

set up you cron entry an example bellow:

#sync my gdrive each 10th minute
*/10 * * * * /home/Yordan/sync_gdrive.sh

# * * * * * command to be executed
# - - - - -
# | | | | |
# | | | | +- - - - day of week (0 - 6) (Sunday=0)
# | | | +- - - - - month (1 - 12)
# | | +- - - - - - day of month (1 - 31)
# | +- - - - - - - hour (0 - 23)
# +--------------- minute

Saturday, January 21, 2017

DLink DNS-320L - Replacing fan


From: DLINK Forum
http://forums.dlink.com/index.php?topic=53051.30



I also decided to replace the noisy fan yesterday. This is what I did:

 1. Cut a hole on the top cover.
 2. Remove original fan.
 3. Attach new fan on the top...
    http://noctua.at/en/products/product-line-redux/nf-r8-redux-1200
 4. Switch polarity on the fan's connector.

The new fan has ultra low noise. Auto fan control works too. However, I set it to run "High" constantly. The new fan sucks air out of the chassis, so cold air flows in at the bottom/back (where the original fan was). When it is in idle, it is around 33/34 C degrees.



Gelid Silent 8 (fn-sx08-16)



If I put ramsinks:
http://forum.dsmg600.info/viewtopic.php?id=6574

--> The main board with ramsinks = no temp change!!

Wednesday, January 18, 2017

Relay Switches



Where to buy...

AC-220V-1-CH-Relay-Mini-Receiver-10A-Remote-Switch-Input-AC220V

Wireless-Remote-Control-Switch-AC-220V

IR Sensor Switch


Thursday, January 05, 2017

Nikon D7000 - Raspberry Pi as an Access Point to control your camera w/Raspbian


From:
http://dslrdashboard.info/
http://digicamcontrol.com/doc/



You need:

- Raspberry Pi 2B, because it has 4 USB port, and I need it to control my Nikon camera and my Celestron teelescope (if you need more info, check this) with Raspbian installed.
- USB Wifi dongle compatible.
- External battery (5V output) to do power to your Raspberry Pi.
- USB cable (USB to mini-USB), to connect raspberry pi to Nikon D7000 camera.

First step:

- Install Raspbian (if you have doubts, please check raspbian.org.

- Update your Raspberry Pi from repositories:

pi@raspsrv $ sudo apt-get update
pi@raspsrv $ sudo apt-get upgrade

- And install rpi-update:

pi@raspsrv $ sudo apt-get install rpi-update
pi@raspsrv $ sudo rpi-update

Please, reboot when finish!!

- Troubleshooting... (If needed)

pi@raspsrv $ sudo apt-get install ca-certificates

pi@raspsrv $ sudo apt-get install ntpdate
pi@raspsrv $ sudo ntpdate -u ntp.ubuntu.com

Second step:

Configure your Raspberry Pi as an Acces Point.

1. Install all that you need:

pi@raspsrv $ sudo apt-get install hostapd isc-dhcp-server

# Probably you don't need install this:
pi@raspsrv $ sudo apt-get install iptables-persistent

If you have a non-common WiFi adapter, you can update hostapd driver from adafruit...

pi@raspsrv $ wget http://adafruit-download.s3.amazonaws.com/adafruit_hostapd_14128.zip
pi@raspsrv $ unzip adafruit_hostapd_14128.zip

pi@raspsrv $ sudo mv /usr/sbin/hostapd /usr/sbin/hostapd.ORIG
pi@raspsrv $ sudo mv hostapd /usr/sbin
pi@raspsrv $ sudo chmod 755 /usr/sbin/hostapd

2. Edit your interfaces file to configure wlan0 adapter:

pi@raspsrv $ cat /etc/network/interfaces
auto lo

iface lo inet loopback
iface eth0 inet dhcp
#iface eth0 inet static
# address 192.168.0.190
# netmask 255.255.255.0
# gateway 192.168.0.1

allow-hotplug wlan0
#iface wlan0 inet manual
#wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
#iface default inet dhcp
iface wlan0 inet static
address 192.168.5.1
netmask 255.255.255.240
gateway 192.168.0.1

pre-up iptables-restore < /etc/iptables.ipv4.nat

3. Edit your DHCP daemon config file:

pi@raspsrv $ cat /etc/dhcp/dhcpd.conf
#
# Sample configuration file for ISC dhcpd for Debian
#
#

# The ddns-updates-style parameter controls whether or not the server will
# attempt to do a DNS update when a lease is confirmed. We default to the
# behavior of the version 2 packages ('none', since DHCP v2 didn't
# have support for DDNS.)
ddns-update-style none;

# option definitions common to all supported networks...
##option domain-name "example.org";
##option domain-name-servers ns1.example.org, ns2.example.org;

default-lease-time 600;
max-lease-time 7200;

# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
#authoritative;
authoritative;

# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
log-facility local7;

# No service will be given on this subnet, but declaring it helps the
# DHCP server to understand the network topology.

#subnet 10.152.187.0 netmask 255.255.255.0 {
#}

# This is a very basic subnet declaration.

#subnet 10.254.239.0 netmask 255.255.255.224 {
# range 10.254.239.10 10.254.239.20;
# option routers rtr-239-0-1.example.org, rtr-239-0-2.example.org;
#}

# This declaration allows BOOTP clients to get dynamic addresses,
# which we don't really recommend.

#subnet 10.254.239.32 netmask 255.255.255.224 {
# range dynamic-bootp 10.254.239.40 10.254.239.60;
# option broadcast-address 10.254.239.31;
# option routers rtr-239-32-1.example.org;
#}

# A slightly different configuration for an internal subnet.
#subnet 10.5.5.0 netmask 255.255.255.224 {
# range 10.5.5.26 10.5.5.30;
# option domain-name-servers ns1.internal.example.org;
# option domain-name "internal.example.org";
# option routers 10.5.5.1;
# option broadcast-address 10.5.5.31;
# default-lease-time 600;
# max-lease-time 7200;
#}

# Hosts which require special configuration options can be listed in
# host statements. If no address is specified, the address will be
# allocated dynamically (if possible), but the host-specific information
# will still come from the host declaration.

#host passacaglia {
# hardware ethernet 0:0:c0:5d:bd:95;
# filename "vmunix.passacaglia";
# server-name "toccata.fugue.com";
#}

# Fixed IP addresses can also be specified for hosts. These addresses
# should not also be listed as being available for dynamic assignment.
# Hosts for which fixed IP addresses have been specified can boot using
# BOOTP or DHCP. Hosts for which no fixed address is specified can only
# be booted with DHCP, unless there is an address range on the subnet
# to which a BOOTP client is connected which has the dynamic-bootp flag
# set.
#host fantasia {
# hardware ethernet 08:00:07:26:c0:a5;
# fixed-address fantasia.fugue.com;
#}

# You can declare a class of clients and then do address allocation
# based on that. The example below shows a case where all clients
# in a certain class get addresses on the 10.17.224/24 subnet, and all
# other clients get addresses on the 10.0.29/24 subnet.

#class "foo" {
# match if substring (option vendor-class-identifier, 0, 4) = "SUNW";
#}

#shared-network 224-29 {
# subnet 10.17.224.0 netmask 255.255.255.0 {
# option routers rtr-224.example.org;
# }
# subnet 10.0.29.0 netmask 255.255.255.0 {
# option routers rtr-29.example.org;
# }
# pool {
# allow members of "foo";
# range 10.17.224.10 10.17.224.250;
# }
# pool {
# deny members of "foo";
# range 10.0.29.10 10.0.29.230;
# }
#}

subnet 192.168.5.0 netmask 255.255.255.240 {
range 192.168.5.5 192.168.5.10;
option broadcast-address 192.168.5.15;
option routers 192.168.5.1;
default-lease-time 600;
max-lease-time 7200;
option domain-name "wifi.local";
option domain-name-servers 8.8.8.8, 8.8.4.4;
}

4. Edit your DHCP server config file:

pi@raspsrv / $ cat /etc/default/isc-dhcp-server
# Defaults for isc-dhcp-server initscript
# sourced by /etc/init.d/isc-dhcp-server
# installed at /etc/default/isc-dhcp-server by the maintainer scripts

#
# This is a POSIX shell fragment
#

# Path to dhcpd's config file (default: /etc/dhcp/dhcpd.conf).
#DHCPD_CONF=/etc/dhcp/dhcpd.conf

# Path to dhcpd's PID file (default: /var/run/dhcpd.pid).
#DHCPD_PID=/var/run/dhcpd.pid

# Additional options to start dhcpd with.
# Don't use options -cf or -pf here; use DHCPD_CONF/ DHCPD_PID instead
#OPTIONS=""

# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
# Separate multiple interfaces with spaces, e.g. "eth0 eth1".
##INTERFACES=""
INTERFACES="wlan0"

5. Edit your host APD config file:

pi@raspsrv / $ cat /etc/hostapd/hostapd.conf
interface=wlan0
driver=nl80211
#driver=rtl871xdrv
ssid=MyPi
hw_mode=g
channel=6
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=Raspb3rry
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

6. Edit your host APD daemon config file:

pi@raspsrv / $ cat /etc/default/hostapd
# Defaults for hostapd initscript
#
# See /usr/share/doc/hostapd/README.Debian for information about alternative
# methods of managing hostapd.
#
# Uncomment and set DAEMON_CONF to the absolute path of a hostapd configuration
# file and hostapd will be started during system boot. An example configuration
# file can be found at /usr/share/doc/hostapd/examples/hostapd.conf.gz
#
#DAEMON_CONF=""
DAEMON_CONF="/etc/hostapd/hostapd.conf"

# Additional daemon options to be appended to hostapd command:-
# -d show more debug messages (-dd for even more)
# -K include key data in debug messages
# -t include timestamps in some debug messages
#
# Note that -B (daemon mode) and -P (pidfile) options are automatically
# configured by the init.d script and must not be added to DAEMON_OPTS.
#
#DAEMON_OPTS=""

7. Edit your SYSCTL config file:

pi@raspsrv / $ cat /etc/sysctl.conf
#
# /etc/sysctl.conf - Configuration file for setting system variables
# See /etc/sysctl.d/ for additonal system variables
# See sysctl.conf (5) for information. #

#kernel.domainname = example.com

# Uncomment the following to stop low-level messages on console kernel.printk = 3 4 1 3

###############################################################
# Functions previously found in netbase
#

# Uncomment the next two lines to enable Spoof protection (reverse-path filter)
# Turn on Source Address Verification in all interfaces to
# prevent some spoofing attacks
#net.ipv4.conf.default.rp_filter=1
#net.ipv4.conf.all.rp_filter=1

# Uncomment the next line to enable TCP/IP SYN cookies
# See http://lwn.net/Articles/277146/
# Note: This may impact IPv6 TCP sessions too
#net.ipv4.tcp_syncookies=1

# Uncomment the next line to enable packet forwarding for IPv4
#net.ipv4.ip_forward=1
net.ipv4.ip_forward=1

# Uncomment the next line to enable packet forwarding for IPv6
# Enabling this option disables Stateless Address Autoconfiguration
# based on Router Advertisements for this host
#net.ipv6.conf.all.forwarding=1


###################################################################
# Additional settings - these settings can improve the network
# security of the host and prevent against some network attacks
# including spoofing attacks and man in the middle attacks through
# redirection. Some network environments, however, require that these
# settings are disabled so review and enable them as needed.
#
# Do not accept ICMP redirects (prevent MITM attacks)
#net.ipv4.conf.all.accept_redirects = 0
#net.ipv6.conf.all.accept_redirects = 0
# _or_
# Accept ICMP redirects only for gateways listed in our default
# gateway list (enabled by default)
# net.ipv4.conf.all.secure_redirects = 1
#
# Do not send ICMP redirects (we are not a router)
#net.ipv4.conf.all.send_redirects = 0
#
# Do not accept IP source route packets (we are not a router)
#net.ipv4.conf.all.accept_source_route = 0
#net.ipv6.conf.all.accept_source_route = 0
#
# Log Martian Packets
#net.ipv4.conf.all.log_martians = 1
#

# rpi tweaks
vm.swappiness=1
vm.min_free_kbytes = 8192

8. Add a iptables file:

pi@raspsrv / $ cat /etc/iptables.ipv4.nat
# Generated by iptables-save v1.4.14 on Thu Nov 26 08:15:51 2015
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m comment --comment "Accept all ingoing" -j ACCEPT
-A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -i wlan0 -o eth0 -j ACCEPT
-A OUTPUT -m comment --comment "Accept all outgoing" -j ACCEPT
COMMIT
# Completed on Thu Nov 26 08:15:51 2015
# Generated by iptables-save v1.4.14 on Thu Nov 26 08:15:51 2015
*nat
:PREROUTING ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
-A POSTROUTING -o eth0 -j MASQUERADE
-A POSTROUTING -o eth0 -j MASQUERADE
-A POSTROUTING -o wlan0 -j MASQUERADE
-A POSTROUTING -o eth0 -j MASQUERADE
COMMIT
# Completed on Thu Nov 26 08:15:51 2015

9. Add a iptables file:

pi@raspsrv / $ cat /etc/iptables.ipv4.nat
pi@raspsrv $ sudo service hostapd start
pi@raspsrv $ sudo service isc-dhcp-server start

pi@raspsrv $ sudo service hostapd status
pi@raspsrv $ sudo service isc-dhcp-server status

pi@raspsrv $ sudo update-rc.d hostapd enable
pi@raspsrv $ sudo update-rc.d isc-dhcp-server enable

Third step

- Download, Install and Confiure DSLR Dashboard server (ddserver)

1. Clone GitHub reposiroty and compile:
pi@raspsrv $ pwd
/home/pi
pi@raspsrv $ git clone git://github.com/hubaiz/DslrDashboardServer package/DslrDashboardServer
pi@raspsrv $ cd package/DslrDashboardServer
pi@raspsrv $ sudo make menuconfig

pi@raspsrv $ sudo apt-get install build-essential pkg-config libusb-1.0-0-dev
pi@raspsrv $ sudo g++ -Wall src/main.cpp src/communicator.cpp `pkg-config --libs --cflags libusb-1.0` -lpthread -lrt -lstdc++ -o ddserver

2. Move to /usr/local/bin:

pi@raspsrv $ cd /home/pi/package
pi@raspsrv $ sudo mv DslrDashboardServer /usr/local/bin/DslrDashboardServer

/usr/local/bin/DslrDashboardServer/ddserver

- Create and add ddserver script on startup

pi@raspsrv /etc/init.d $ cat ddserver.sh
#!/bin/sh

### BEGIN INIT INFO
# Provides: ddserver
# Required-Start: $all
# Required-Stop:
# Should-Start:
# Should-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: DslrDashboardServer daemon
# Description: Access and Control DSLR Cameras
### END INIT INFO

DIR=/usr/local/bin/DslrDashboardServer
DAEMON=$DIR/ddserver
DAEMON_NAME=ddserver
DAEMON_OPTS=""
DAEMON_USER=root

PIDFILE=/var/run/$DAEMON_NAME.pid

. /lib/lsb/init-functions

do_start () {
log_daemon_msg "Starting system $DAEMON_NAME daemon"
start-stop-daemon --start --background --pidfile $PIDFILE --make-pidfile --user $DAEMON_USER --chuid $DAEMON_USER --startas />$DAEMON -- $DAEMON_OPTS
log_end_msg $?
}
do_stop () {
log_daemon_msg "Stopping system $DAEMON_NAME daemon"
start-stop-daemon --stop --pidfile $PIDFILE --retry 10
log_end_msg $?
}

case "$1" in
start|stop)
do_${1}
;;
restart|reload|force-reload)
do_stop
do_start
;;
status)
status_of_proc "$DAEMON_NAME" "$DAEMON" && exit 0 || exit $?

;;
*)
echo "Usage: /etc/init.d/$DAEMON_NAME {start|stop|restart|status}"
exit 1
;;
esac
exit 0

pi@raspsrv $ cp -p ddserver.sh /etc/init.d
pi@raspsrv $ sudo chmod u+x /etc/init.d/ddserver.sh
pi@raspsrv $ sudo update-rc.d /etc/init.d/ddserver.sh defaults

pi@raspsrv $ cp your_script /etc/init.d/
pi@raspsrv $ sudo chmod u+x /etc/init.d/your_script
pi@raspsrv $ sudo update-rc.d /etc/init.d/your_script defaults

Nikon D7000 - DIY DSLR External Battery Pack



From:
http://itschriswinter.com/dslr-video/the-ultimate-dslr-external-battery/
https://fstoppers.com/video/diy-dslr-external-battery-pack-get-9-hours-shooting-9433



You need the following items that you can buy on Amazon or eBay or Aliexpress:

- (Anker) XTPower MP-10000 External Battery Pack 9v-12v
- Battery Dummie (DC Coupler for EP-5B, Nikon D7x00)
- Cheeseplate - SmallRig Camera Mounting Plate
- Hot Shoe Adapter
- Adhesive Velcro

Wednesday, January 04, 2017

Raspberry Pi - Pharos Microsoft GPS-360


FROM:
http://astrobeano.blogspot.com.es/2012/10/pharosmicrosoft-gps-360-on-raspberry-pi.html



I bought a Microsoft GSP-360 USB dongle on eBay as an impulse purchase, toying with the idea of running a Raspberry Pi in my car for live map display or at least route tracking for contributing road traces to the Open Street-Map project.
Just getting my location out of it proved harder than I'd expected.

The front of the dongle has a big Microsoft logo, while the sticker on the back (which has a bright blue LED when active) says:

  P/N: X11-49577
  360-1000-02
  S/N: ...
  GPS-360
  Tested to comply with FCC standards
  Rating: DC 3.5 - 5.5V 70mA
  Pharos USA
  SiRF Powered
  Made in China

For running this with a Raspberry Pi that current information could be useful, and the broad voltage tolerance is reassuring.
What do we learn at the command line? It appears as a Profilic USB/Serial adaptor at the USB level - here's what my Mac tells me:

$ system_profiler SPUSBDataType
...
  USB-Serial Controller:

   Product ID: 0xaaa0
   Vendor ID: 0x067b (Prolific Technology, Inc.)
   Version: 3.00
   Serial Number: 12345678
   Speed: Up to 12 Mb/sec
   Manufacturer: Prolific Technology Inc.
   Location ID: 0xfa130000 / 6
   Current Available (mA): 500
   Current Required (mA): 500

And in Linux, running on a Raspberry Pi (with no other devices attached):

$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 004: ID 067b:aaa0 Prolific Technology, Inc. Prolific Pharos

USB/Serial Drivers

I should be able to talk to the USB-serial port, but to do on the Mac it seems I must first install a Prolific USB-serial driver. That's what this and this helpful blog told me.
Finding the Prolific USB/serial driver for Mac OS X took a while, it was hiding behind a "GUEST"/"GUEST" password protected page - but I eventually found md_PL2303_MacOSX10.6_dmg_v1.4.0.zip released 2011/05/13 which claims to support OS X 10.8 Mountain Lion.
There's also an open source driver, osx-pl2303 on SourceForge (SVN latest updated Jan 2008), forked as osx-pl2303 on Github (last updated Nov 2011), reported to have been tested under Mac OS X 10.7 Lion and 10.8 Mountain Lion. I punted on this.

As an aside, finding drivers for older versions of Windows was quite easy, but Profilic won't support their older PL-2303HXA and PL-2303X chips under Windows 8, using this as a stick to encourage people to buy their newer PL2303TA chip instead. Ouch.

For Linux there drivers should be already installed - so I went with that. Here's an excerpt from the Raspberry Pi boot log (with the GSP-360 dongle as the only external USB device plugged in):

$ dmseg
...
[ 38.098548] usb 1-1.3: new full-speed USB device number 4 using dwc_otg
[ 38.200535] usb 1-1.3: New USB device found, idVendor=067b, idProduct=aaa0
[ 38.200565] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 38.200581] usb 1-1.3: Product: USB-Serial Controller
[ 38.200595] usb 1-1.3: Manufacturer: Prolific Technology Inc.
[ 38.200608] usb 1-1.3: SerialNumber: 12345678
[ 38.270238] usbcore: registered new interface driver usbserial
[ 38.272087] USB Serial support registered for generic
[ 38.273859] usbcore: registered new interface driver usbserial_generic
[ 38.273887] usbserial: USB Serial Driver core
[ 38.283343] USB Serial support registered for pl2303
[ 38.283511] pl2303 1-1.3:1.0: pl2303 converter detected
[ 38.290249] usb 1-1.3: pl2303 converter now attached to ttyUSB0
[ 38.291944] usbcore: registered new interface driver pl2303
[ 38.291972] pl2303: Prolific PL2303 USB to serial adaptor driver

As per that log, the new serial port is available as /dev/ttyUSB0

$ ls -l /dev/ttyUSB0
crw-rw---T 1 root dialout 188, 0 Oct 11 15:57 /dev/ttyUSB0

I'm using the default image here, username 'pi', and I am therefore a member of the dialout group so should be able to connect to this device:

$ groups
pi adm dialout cdrom sudo audio video plugdev games users input

Strangely I didn't (immediately) get anything from the device using a low level check:

$ cat /dev/ttyUSB0
(nothing)

GPSD

It seems the main low-level GPS software for Linux is gpsd, so I installed that and tried to run it.

$ sudo apt-get install gpsd gpsd-clients
...

Encouragingly the GPSD hardware page says support for the Microsoft GPS-360 is good, they test it before each release, and it should be plumbed into the Linux hotplug system to start gpsd automatically.

Rebooting with the GPS attached should create /dev/gps0 as an alias for /dev/ttyUSB0 and start the gpsd daemon automatically, check with:

$ ps -e | grep gpsd
307 ? 00:00:00 gpsd

In this case it is running (with process identifier 307). Similarly, if you boot up without the dongle and then plug it in, it should be recognised as gpsd started automatically. If it is running, this should kill it (advice from the GPSD Troubleshooting page):

$ sudo killall gpsd
$ sudo rm /var/run/gpsd.sock

You can (re)start it manually with:

$ gpsd /dev/ttyUSB0

I then tried a little test (with the daemon off):

$ gpsctl -f -n /dev/ttyUSB0 gpsctl:SHOUT: vendor/product match with 091e:0003 not found
gpsctl:ERROR: packet recognition timed out.

That isn't good... the -f meant without using the deamon mode of gpsd, the -n meant switch to NMEA mode. When it works I got this and could look at the raw NMEA output:

$ gpsctl -f -n /dev/ttyUSB0
gpsctl:SHOUT: vendor/product match with 091e:0003 not found
gpsctl:SHOUT: /dev/ttyUSB0 identified as a SiRF binary at 4800.
gpsctl:SHOUT: switching to mode NMEA.

$ cat /dev/ttyUSB0
$GPGGA, ...

Incidentally, until I read this blog post about why GPS support sucks, I'd been under the impression that NMEA 0183 was a good standard.

The GPSD Troubleshooting suggests starting with xgps or cgps. When cgps works:

$ cgps
┌───────────────────────────────────────────┐┌─────────────────────────────────┐
│ Time: 2012-10-11T17:06:42.920Z ││PRN: Elev: Azim: SNR: Used: │
│ Latitude: 56.XXXXXX N ││ 1 XX XXX XX Y │
│ Longitude: 3.XXXXXX W ││ 11 XX XXX XX Y │
│ Altitude: 58.9 m ││ 32 XX XXX XX Y │
│ Speed: 1.4 kph ││ 20 XX XXX XX Y │
│ Heading: 215.3 deg (true) ││ 14 XX XXX XX Y │
│ Climb: 12.8 m/min ││ 28 XX XXX XX Y │
│ Status: 3D FIX (3 secs) ││ 19 XX XXX XX Y │
│ Longitude Err: +/- 10 m ││ 17 XX XXX XX Y │
│ Latitude Err: +/- 11 m ││ 11 XX XXX XX Y │
│ Altitude Err: +/- 32 m ││ │
│ Course Err: n/a ││ │
│ Speed Err: +/- 84 kph ││ │
│ Time offset: 0.509 ││ │
│ Grid Square: IO86kk ││ │
└───────────────────────────────────────────┘└─────────────────────────────────┘
{"class":"DEVICES","devices":[{"class":"DEVICE","path":"/dev/ttyUSB0","activated":"2012-10-11T17:06:39.461Z","flags":1,"driver":"SiRF binary","subtype":...

I've masked out my exact location. Note CPU usage running gpsd and cgps with the default SiRF binary protocol was about 8%.

However, after rebooting and immediately running cgps it starts, waits for a bit with missing location information, then quits with a time out:

$ cgps
┌───────────────────────────────────────────┐┌─────────────────────────────────┐
│ Time: n/a ││PRN: Elev: Azim: SNR: Used: │
│ Latitude: n/a ││ │
│ Longitude: n/a ││ │
│ Altitude: n/a ││ │
│ Speed: n/a ││ │
│ Heading: n/a ││ │
│ Climb: n/a ││ │
│ Status: NO FIX (0 secs) ││ │
│ Longitude Err: n/a ││ │
│ Latitude Err: n/a ││ │
│ Altitude Err: n/a ││ │
│ Course Err: n/a ││ │
│ Speed Err: n/a ││ │
│ Time offset: n/a ││ │
│ Grid Square: n/a ││ │
└───────────────────────────────────────────┘└─────────────────────────────────┘
{"class":"WATCH","enable":true,"json":true,"nmea":false,"raw":0,"scaled":false,"timing":false} cgps: GPS timeout

I also ran into this:

$ gpsctl -n /dev/ttyUSB0
gpsctl:ERROR: error 'Multiple subscribers, cannot change control bits on /dev/ttyUSB0.'
gpsctl:ERROR: /dev/ttyUSB0 mode change to NMEA failed

And:

$ cat /dev/ttyUSB0
cat: /dev/ttyUSB0: Device or resource busy

I'm not quite sure what is going on here. I suspect a problem in how gpsd is started automatically (possibly Debian or Raspian specific?). What does seem to work is a cold restart (from power off) with the dongle attached, log in, kill and restart gpsd, and then run cgps.

GPS Babel

The Open Street-Map on their instructions for uploading GPS tracks request GPX format and recommend GPS Babel to generate this. At the time of writing the latest release is GPSBabel 1.4.4, the repository hasn't caught up yet as this gave me v1.4.3:

$ sudo apt-get install gpsbabel
...

$ gpsbabel -V

GPSBabel Version 1.4.3

Then (provided that everything was co-operating - see above), I could use the gpsd utility to switch the output to NMEA mode, capture some of that to a file, and convert it into GPX format using gpsbabel:

$ gpsctl -f -n /dev/ttyUSB0
gpsctl:SHOUT: vendor/product match with 091e:0003 not found
gpsctl:SHOUT: /dev/ttyUSB0 identified as a SiRF binary at 4800.
gpsctl:SHOUT: switching to mode NMEA.
$ cat /dev/ttyUSB0
$GPGGA,...
^C
$ cat /dev/ttyUSB0 > temp.nmea
^C
$ gpsbabel -i nmea -f temp.nmea -o gpx -F temp.gpx
$ head temp.gpx
<?xml version="1.0" encoding="UTF-8"?>
<gpx
  version="1.0"
  creator="GPSBabel - http://www.gpsbabel.org"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns="http://www.topografix.com/GPX/1/0"
  xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd">
<time>2012-10-11T18:17:34Z</time>
<bounds minlat="56.xxxxxxxxx" minlon="-3.xxxxxxxxx" maxlat="56.xxxxxxxxx" maxlon="-3.xxxxxxxxx"/>
<trk>

In principle that should work with the SiRF binary format, but perhaps something is going wrong when I try to capture a random section with since the GPX file is essentially empty (valid XML, but no actual data unlike the NMEA capture above):

$ gpsctl -f /dev/ttyUSB0
gpsctl:SHOUT: vendor/product match with 091e:0003 not found
gpsctl:SHOUT: /dev/ttyUSB0 identified as a SiRF binary at 4800.
$ cat /dev/ttyUSB0 > temp.sbn
^C
$ gpsbabel -i sbn -f temp.sbn -o gpx -F temp.gpx
$ more temp.gpx
<?xml version="1.0" encoding="UTF-8"?>
<gpx
  version="1.0"
  creator="GPSBabel - http://www.gpsbabel.org"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns="http://www.topografix.com/GPX/1/0"
  xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd">
<time>2012-10-11T18:25:47Z</time>
</gpx>

That was rather tortuous. But with the rough edges sorted out could work as the basis of a GPS track logger.

Update 1

Here's a link to Peter Mount's blog post using a GPS dongle and Raspberry Pi as an NTP server (Network Time Protocol), useful as a way to set the clock on a RPi as it has no internal battery like a normal PC - meaning it needs a network connection or other external system to set the time and date. It seems he is also wondering about connecting his Raspberry Pi to his telescope...

Update 2

Here's a link to David Taylor's GSP based Raspberry Pi NTP server page, incredibly detailed including how to use Pulse Per Second (PPS) for improved precision.

Tuesday, January 03, 2017

Photography - Northern Lights



From: http://www.davemorrowphotography.com/2014/10/how-to-photograph-northern-lights.html
& http://fullsuitcase.com/photograph-northern-lights-beginners/



Preset Your Focus Point During the Day

It’s much easier to focus during the day than at night, for both you and your camera’s autofocus software.

Since focusing is one of the hardest parts of night / low light photography, getting this step out of the way during the daytime is always best practice.

Follow these easy steps to get started:

1. Set up your camera during the day with the lens you will be using to take your night / low light photos. You can do this at your house, or anywhere else that’s easy, it doesn’t have to be at the location where you plan on taking your night photos.

2. Adjust your lens to focus at infinity, or at a far away horizon. I always like to use my camera’s Live View Mode, zoomed in, and focus on the furthest horizon in my composition. This will ensure that you’ve focused at infinity. You can also focus by looking through your camera’s view finder. This works very well too.

3. Next manually make the final adjustments if / as required using the focus ring. I find that Auto Focus usually does very well during the day, but sometimes needs manual input to nail down the final focus in low light.

4. Take some more practice shots at an aperture of f/8 – f/11 and make sure the entire photo is in focus. If it isn’t focused, repeat Step 2 and Step 3.

5. Now your lens is focused at infinity.

6. Using a permanent marker, mark both the focus ring, and the barrel of the lens (non-rotating part of lens). Tape works as well, but may fall off over time.

This is a reference point that you will be able to use when returning to shoot at night or in low light. I’ve personally marked my lens using a silver Sharpie, allowing me to see the mark at night without using a headlamp or light.



1. Set your camera focus to infinity
Setting focus is probably the most challenging step of night photography, since your camera will not focus well in the dark. If you don’t do this right, you won’t get sharp pictures.
How to set your camera to focus to infinity? In human language, it’s basically making sure that your pictures are sharp at the far horizon. It’s best to do this during the day. Select manual mode on your lens, focus to infinity, adjust as needed and mark your lens at the right place. You can use permanent marker, silver sharpie or tape for it. When you’re outside at night, all you need to do is set your lens to the right position.
If you couldn’t do this during the day, try looking for a brighter point (a house or a lit road in the distance) in the area you are and focus your camera sharp on it. In the worst case, you might try using your flash light to illuminate the point as far from you as possible and focus on it. Make sure you don’t turn the lens after doing this, reframe for the Northern Lights and shoot.

2. Metering mode
Use the following metering mode for Northern Lights photography: Evaluative Metering for Canon cameras or Matrix metering for Nikon.



3. Wide aperture
Set your camera to Manual Mode for Northern Lights photography (M on most cameras) and make sure you set the aperture as wide as possible. So at 2.8 if you have a f2.8 lens or at f4 if you have a f4 lens.

4. Exposure time
If aurora moves slowly, try a 12-20 second exposure. For very vague auroras you might even need 20-25 seconds. If aurora moves fast, however, 5-10 seconds might be more than enough.



5. What ISO value to use to photograph auroras
Depending on how bright auroras are, you might need to adjust your camera’s ISO settings. Remember: the higher the ISO, the bigger chance of ‘grain’ in your picture. Try shooting at ISO 800 if auroras are very bright. You may need to increase ISO to 1,600-3,200 or even more if it’s really dark.

6. Best white balance settings for Northern Lights photography
You’re probably not shooting in RAW as a beginner (neither do I, to tell you the truth), so you want to get the colours as close to reality as possible straight from the camera. You can use Automatic white balance mode and see what it gives. I found that setting white balance to Custom mode and choosing Kelvin values of 2,800-4,000 worked best for me. Or shooting in RAW mode!!!



1. Start out shooting with an ISO of 400-800 and take a practice shot.

2. After doing so, if your practice shot wasn’t bright enough, increase your ISO to approximately 1200 and take a practice shot.

3. If the photo still isn’t bright enough, continue to increase your ISO until it is. I usually shoot in the ISO range of 800-4000.



Check histogram, and decide...

Camera Settings: 10 Seconds, f/2.8, ISO2500 - Overexposure
Camera Settings: 10 Seconds, f/2.8, ISO2000 - Correct Exposure
Camera Settings: 10 Seconds, f/2.8, ISO1000 - Optimal Exposure



Fast guide!!!

1. Find your location and composition first. Even at night the story in the image matters, and you want foreground, middle ground and background whenever possible.

2. Set your camera on manual focus and choose the manual setting (M) from your camera menu. Then choose the aperture setting and open the lenses as far as it will go, dialing in lowest aperture F-setting available.

3. Set the self-timer - to avoid camera shake from pressing the shutter - and choose an ISO around 800-1600.

4. Look at your LCD display (turn it on if needed) and zoom in as far as it will go and use menu controls to move the zoomed view to an area in the sky with extra bright stars.

5. Turn the focus ring on your lens to infinity. It is the little symbol that looks like a horizontal eight, and you will notice the stars more and more becoming small piercing dots. Fine-tune, using miniscule movements, until you have gained the sharpest focus possible,

6. Now that the stars are in focus the northern lights will also be, and you are ready to start shooting. Choose a shutter speed around 5-8 seconds initially and check the first results.

7. Adjust the exposure using only shutter speed and ISO, keeping the aperture fixed and the focus unchanged, and keep shooting the northern lights as they change in the sky.



ESP8266 ESP-01 Firmware Update with Arduino



From: http://www.elec-cafe.com/esp8266-esp-01-firmware-update/



pdate ESP8266 ESP-01 to new firmware for my home automation project, initially the module was working perfect to you.

Step 1: Parts List

Arduino UNO
ESP8266 ESP-01

Step 2: Download ESP8266 Flasher and ESP8266 Firmware

Download ESP8266 flasher from this link
ESP8266_Flasher

Download ESP8266 Firmware from this link
AI-v0.9.5.0 AT Firmware.bin

Step 3: Connecting ESP8266 to Flash mode

ESP8266 <-> Arduino UNO



Tx    <->Tx (D1)
Rx    <-> Rx (D0)
VCC   <-> 3.3v
GND   <-> GND
CH_PD <-> 3.3v
GPIO0 <-> GND (Connect into flashing mode, disconnect after finish)

** Connect ESP8266 RX to Arduino UNO Rx and ESP8266 TX to Arduino UNO TX **

Step 4: ESP8266 to Boot Mode

Upload Blink example code to Arduino UNO

// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin 13 as an output.
pinMode(13, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}

** if you can’t run upload , please remove TX and RX and then connect after finish **

Step 5: Uploading Firmware

Browse the bin file or firmware version files
Set you COM Port –> (view Device Manager> Ports(COM&LPT))

Click Download button



Complete update firmware

** In the end at 99% it will show some error but this is ok.



Test AT commands in Arduino Serial Monitor
Set Both NL & CR
Set Baudrate at 9600
Enter “AT” and you will get “OK”.
Enter “AT+GMR” and check the firmware version.

ESP8266 ESP-12 Standalone with Blynk


From: http://www.instructables.com/id/ESP8266-ESP-12Standalone-Blynk-101/step4/Results/



Hardware:

1. ESP8266 board
2. USB-TTL/FDTI adapter 3.3V
2. Smartphone (IOS/Android)
3. Dupont wires
4. LED
5. Breadboard
6. Power Source 3.3V.. Note: separate power source required for ESP board

Nikon D7000 - ESP8266 + Smartphone Wireless Remote for DSLR with (possible) GPS



FROM: Instructables!!!!
http://www.instructables.com/id/ESP8266Smartphone-Wireless-Remote-for-DSLR-with-po/step4/The-Sketch/
& http://statusorel.ru/technology/esp8266-smartphone-wireless-remote-for-dslr-with.html



All Items:

A while back I came across this awesome project by CosmicMac. Basically you can trigger your DSLR wirelessly using your smartphone via the ESP8266 connected to the DSLR. Given that not all cameras have support for built in shutter terminal, and that different brands have different pinouts for their camera, you need to modify the peripherals accordingly. My camera is a Nikon DSLR D3200 with remote terminal using proprietary MC-DC2 port. You can buy a cheap wired shutter remote online for around $1.

What’s interesting is that the MC-DC2 also has a pin for GPS data. After doing some research I found these projects:

1. Nikon D90 Homemade GPS

2. BUILD A BLUETOOTH GPS UNIT FOR NIKON CAMERAS

I was about to make my version of CosmicMac’s project using ESP-12 development board and programming using the Arduino IDE when I got the idea of trying to send GPS data from phone to ESP mcu and communicate it to DSLR. While in theory this sounds promising,I came into a lot of trouble mostly because:

1. I am a beginner.

2. The camera uses NMEA 0183 protocol to read GPS data while getting this form of data is tricky. It might be possible by writing a native android app using NMEA listener but I didn’t try it.

3. I wanted to use the Blynk app to implement the project, however direct communication with ESP and smartphone is not yet possible and GPS widget is not yet available. Maybe I will make it in the future :)

So, my project is mostly a spinoff of CosmicMac’s project with possible integration of Ido Nassimi and Grinkevich projects. I am also submitting this project for the REMIX 2.0 contest, so if you like it please vote.

Here are some of the major changes I made from original projects:

1. Using arduino to program ESP mcu instead of nodemcu firmware.

2. Using ESP-12 instead of ESP-1

3. Using HTML 5 geolocation API to get user’s data location

4. Setting up wifi web server on esp mcu to communicate with smartphone

5. I also implemented a FOCUS option since not everybody uses manual focus.

DISCLAIMER: This project is more of an experiment. Its main objective is to provide of proof of concept and may open the eyes of others to adapt it to their own imagination. As I stated, Im a beginner, so maybe there are codes that are written that may look crude and there are possibly better ways to implement them. I try to give credit to anyone whose code or ideas I used but however the list is unending ( i inserted links to relevant projects wherever possible). I apologise if I missed anyone. This project is also a learning process for me and any feedback is welcome. I had to research a lot about HTML and javascript. I am grateful to anyone who helped me write this project, albeit they might not be aware.

Also, about the GPS part, it’s still a work in progress so bare with me.

Step 1: Overview

Firstly, I’m going to introduce the materials needed for this project. Then dive into how to write the sketch to the board. I’m also going to explain key methods in the .ino sketch. Afterwards we look at the hardware setup. Then finally see it in action.

Step 2: Materials

1. ESP8266 microcontroller, I bought mine, ESP-12 development board, from TaoBao for around 3 dollars.

2. USB-TTL converter for writing sketch to ESP8266. I bought one with adjustable 3.3V and 5V logic. Be careful!! the esp uses 3.3V

3. 2* 4N25 optocouplers

4. 2 resistors

5. Jumper wires

6. Breadboard

7. Smartphone and DSLR, not accounted in bill of course

8. Corresponding shutter remote

Step 3: Setting up the Board

There are a lot of tutorials out there on how to setup the esp for arduino programming.

I made my first instructable mentioning that. Look at step one here.

We are using esp standalone, that is without AT firmware.

Set up hardware as shown in step 3 here

make sure you have separate power supply for esp, 3.3V!!!!!!

You might want to upload a simple sketch to make sure everything works fine.

Then download this sketch and upload to board.

Step 4: The Sketch

Initially, we define libraries used and pins.

Change the FOCUS and FIRE pin numbers as desired.

Then change your preferred “ssid” and “password” for the Access Point setup. Note, this is not the ssid or password of you home network. It is used on smartphone to connect to ESP.

The /* Set page handler functions */

This part is based on Ashish Derhgawen’s sketch.

Here we setup the page links name and assign method names to handle them.

/* Root page for the webserver */

Where we setup how to handle the root. Basically the address you first go to to load the root page is the IP address provided in serial monitor. 192.168.4.1

The page contains links 3 options:

The remote with timer page

It contains code to display “/remote” page. On this page you can select timer, then press the submit button.

The values are sent to ESP where the delay is processed and then the FOCUS is triggered (also allows 5s for focus to complete) the FIRE is triggered to actually take the picture. you can modify the code according to your requirements.

The compatibility page

This page just checks if your smartphone browser supports geolocation. On prompt on smartphone, please allow access. Also, you may need to enable location services for browser in device settings.

The Remote+ GPS page

Here we first convert geotag values to NMEA and send a string to esp.

This part requires a lot of coding. The $GPRMC and $ GPGGA( please make sure you read NMEA protocol first) need to be sent to camera. This part is a bit experimental as the values need to be computed, a checksum calculated and sent as TTL logic, possibly 5V for some cameras.

Remote_GPS_separate_final_.ino

Step 5: Wiring

Show All Items

After writing the sketch to the mcu, we can finally run our code independently.

The wiring is similar to the one used in CosmicMac’s project. I modified it a little bit.

1. There are two output pins, thus 2 optocouplers, one for focus, one for shooting.

2. The MC-DC2 port I used for my project needs to be modified as only wires for ground, focus and shoot are wired inside . For those wanting to try the GPS, this modification is required, otherwise for the remote, the 3 wires are good.

I am not going to dwell too much on how to do this as these two places provide ample info

(i) https://grink.com/2010/12/05/nikon-d90-homemade-gp…
(ii) http://www.diyphotography.net/build-a-bluetooth-gp…

Step 6: The Web UI

Show All Items

After wiring and writing code to esp, it’s time to actually use the setup.

Connect your smartphone’s wifi to the name you set up as SSID for the access point.
Open your browser, and to go IP provided in serial monitor.

Choose your options for shooting

Step 7: The END

That’s it folks.
Thank you for your attention.

I welcome any feedback and help especially if someone wants to refine the codes or help with the GPS part.

Nikon D7000 - Clone Nikon ML-L3 IR Remote and Emulation


From: http://goughlui.com/2013/12/06/teardown-and-project-clone-nikon-ml-l3-ir-remote-and-emulation/



Teardown and Project: Clone Nikon ML-L3 IR Remote and Emulation

Users of Nikon cameras, including the D3200, have had several choices for remote triggering. The use of a wired remote is traditional, with infrared (IR) remotes being common accessories for many and Wi-Fi just becoming the latest craze.

The Product

The Nikon D3200 is compatible with the Nikon ML-L3 IR remote. A quick look on eBay reveals a large number of clone (compatible, non OEM) remotes available for as little as AU$1.20 posted. That includes the CR2025 battery as well. For that price, you’d be silly to go without one (or two, or three)!

I’m not sure what the original ML-L3 is made of, but this is very much like the cheap “flat” remotes provided with many TV tuners. It is constructed of a single PCB, using a single CR2025 coin battery. The buttons are made by carbon-coated dome-formed thick self-adhesive plastic sheet which sits over the PCB interlocking finger pattern traces. It’s not particularly glorious or durable with repeated use, but that’s the way things are.

Tearing it apart reveals an extremely simple construction. The PCB underside is marked with KD301B-A054-002 and FS3423. The plastic mold is marked with KD301B. The PCB utilizes a single IC, capacitor and IR LED. There are no resistors, or even ceramic oscillators (455khz commonly seen on IR remotes, as 455khz/12 = 37.91khz).

here’s no real information I can find on the IC, it’s marked PRT-P08 TX0917. This IC must be able to generate the IR code pattern (including the timing) and limit the current to the LED on the on-phase. I can’t say all clone remotes would use this chip – others may opt for chip-on-board construction.

Tracing the very-simple traces gives me the following schematic:



Simple ain’t it? You could probably alter the circuit board to generate the IR code on other triggers. I don’t know what the unconnected pins are used for – or if they are used at all. Maybe it’s programmable? Maybe there are other modes?

The remote itself fires off the D3200 very reliably, and it’s cheap. I can’t complain of the quality given the price, but I wouldn’t want to rely on having just one in an emergency. Infrared trigger isn’t as “reliable” as wired triggering, since you do need to have a working battery and be within range of the sensor. The sensor has to be activated through the menus, and the camera will time out and sleep the sensor if it’s not been used for a while, so the applications are limited. But it’s nice since it involves no touching the camera (after set-up) and no possibility of conducting any vibrations through trigger cables.

Analyzing the Code

It’s not the first time I’ve worked on emulating infrared remotes. I had posted two videos earlier, which are quite long which does show my previous work (although isn’t easy to follow from the video). I think it’s much more illustrative to write about it instead.

Incidentally, this remote proves to be one of the simplest to emulate.

The first thing you need to do is “record” the signal from the remote. You can do this directly by reading the voltage across the LED (which is most direct, and gives you the raw data including the carrier frequency of the IR system). Another way is to use an IR receiver like the ones used in TV tuners and probe with TTL output (high for presence of 38khz IR carrier, low for absence of 38khz IR carrier).

An IR receiver from a TV tuner.

The method with the IR receiver was used in my former emulation attempts, but it’s not ideal as the sensor may not be able to give you data for non-38khz IR systems. Most of them are 38khz, but there are some using other rates.

IR transmission mostly involves the keying on-and-off of a 38khz signal. The use of 38khz allows for the filtering of “steady” IR background and general noise.

It’s important to capture the IR pulse train using an oscilloscope, high rate data-logger or something similar. I used my Poscope basic2. I cannot recommend users to buy this product, as it only supports Windows, triggering has no hold-off options and is hit and miss, there’s no anti-aliasing filter, the software is pretty broken in Recorder mode when recording at high rates, the data is recorded in a format needing conversion by their tools and it is very limited in sampling rate. I have a heap of trouble with it in general under Windows 7, although older versions of software on Windows XP with specific USB controllers can work semi-reliably. But with enough patience, even something this basic like this is sufficient.

The first thing to understand is that IR remotes tend to send the same code over and over when the button is depressed. In this case, the remote actually sends its code three times over – here we can see just one iteration which takes about 100ms, which repeats.

Most of the time is with the IR LED off, the code itself is very simple. Re-acquiring zoomed in (noting polarity is due to the way the connections were made):

We can see the remote starts with a 2ms burst of 38khz, followed by 28ms rest, 0.5ms burst, 1.5ms rest, 0.5ms burst, 3.5ms rest, 0.5ms burst, 63.5ms rest. That is the IR code we need to emulate to make it “work”. Note that slight timing and frequency differences are expected – say different battery levels and component tolerances.

Take it from me, it’s 38khz – I looked closely into it.

Making it Work

The first thing you need to emulate something like this is a suitable IR LED. Instead of buying it off the shelf, I decided to pinch one from a “useless” remote I had from my RTL-SDR purchases. I’m never going to use the remote – so why waste the LED?

Having extracted the LED, I have to ensure its safety. The voltage drop of my IR LED is about 1v at 1mA, and using a 5v Arduino, I decided to go with two 680 ohm resistors in parallel for an LED current of about 12mA. LEDs like these may be capable of currents up to 20mA, but I decided to play it safe. In fact, it’ll be safe to overdrive it slightly given the low duty cycle of the remote signal.

Of course, as a lazy person, I decided to solder it to some header pins air-wire style, and then cover it with globs of hot glue.

Positive in this case is the pin on the left. I decided to plug it straight into my Arduino Mega 2560 (clone) which I had handy, but you don’t need something this powerful.

The first thing is to write the code that approximates the timing. You’ll find that you will encounter some possible issues say if you use tone() with duration, so instead, use tone() and noTone() instead.

Here is the code – I tested my code, and it does fire off my D3200:

// Nikon Remote Emulator by Gough Lui (http://goughlui.com)
// A1 = IR +
// A0 = IR -

int count=0;

void setup() {
pinMode(A0,OUTPUT);
digitalWrite(A0,LOW);
pinMode(A1,OUTPUT);
digitalWrite(A1,LOW);
}

void loop() {
// Send code three times, as the clone remote does
// Delays are tuned to account for overhead of library code.
while(count<3) {
tone(A1,38000);
delay(2);
noTone(A1);
delay(28);
tone(A1,38000);
delayMicroseconds(200);
noTone(A1);
delayMicroseconds(1500);
tone(A1,38000);
delayMicroseconds(200);
noTone(A1);
delayMicroseconds(3300);
tone(A1,38000);
delayMicroseconds(200);
noTone(A1);
delayMicroseconds(100);
delay(63);
count++;
}
}

Note that the delay timings are not as suggested by the scope capture – this is because there is overhead in the Arduino library functions which take time to execute. Instead, the times are trimmed through trial and error to result in a trace on the scope which closely mirrors the original (although slight timing deviations would be okay). You don’t need to match the original quite 100% as each remote may have slight component differences resulting in offset carrier frequencies and timing. As long as you’re within a few percent, the device should recognize the transmitted code.

The pulse train, as measured by my crappy PoScope basic2 unit looks pretty damn close to the original remote – so now I’ve got the code to trigger my camera using IR. What to do now? Well, you could make some specialized trigger system algorithmically controlled by the Arduino … it’s really up to your imagination.

Besides, now you know what to do when you want to emulate a remote :).

Nikon D7000 - Add a GPS


From: https://www.cyrozap.com/2011/08/13/diy-nikon-d5100-gps/



You need:

- Microsoft GPS-500 (or GPS-360, it has the same pinout). You can get one on eBay for $20 (and if you're lucky enought, it came with a TTL-USB cable AND Streets & Trips 2008 AND an MSN Direct Receiver).
- Shutter connecting cord for Nikon D5100 (or D7000 ;-P). They use MC-DC2 connector (mini-USB propietary connector)
- Ethernet cable that you're willing to strip (if you want, or the same Pharos GPS cable-connector).
- Kapton tape (if you want).
- 5v diode.
- Some sort of strain relief for the wires at the camera connector.
- A steady hand.

I got the pinout data for the GPS from here and the pinout data for the camera connector (with a lot of other useful info) here. Note: on the Flickr photo, read my comment for clarifying info and corrections.



 

My setup doesn't use any TTL voltage converters because the D5100 seems to be able to use the 3.3V TTL from the GPS. I may include a diode in the power line at some point to drop the voltage a little because the camera is feeding 6V to the GPS and its specs say it has a max power input of 5.5V, but it's working so far.

Basically, connect pin 5 on the GPS (the one to the right of the leftmost one when the gold contacts are facing up) to the power pin on the camera connector, pin 2 on the GPS to ground on the camera connector, and pin 3 on the GPS to TTL/Serial in on the camera connector.

  GPS PIN2 - MC-DC2 PIN3 - GND
  GPS PIN3 - MC-DC2 PIN7 - DATA (4800 TTL NMEA)
  GPS PIN5 - MC-DC2 PIN4 - +5v

EDIT: I added the diode; it dropped the voltage to about 5.0V-5.2V. I feel a bit better now.

Oh, by the way, don't connect Pin 1 (GPS Rx) to ground! I happened to do this by accident and it screwed up the serial output until I fixed the solder bridge.

This setup may work for other newish Nikon cameras, but they may not be 3.3V TTL tolerant, so YMMV.



Pharos GPS-500 & GPS-360 specs