XMEN BLOGGER: Raspberry Pi - Node Telescope Server for Stellarium/SkySafary 4

Tuesday, December 27, 2016

Raspberry Pi - Node Telescope Server for Stellarium/SkySafary 4


From:
 https://www.npmjs.com/package/node-telescope-server
 https://github.com/fcsonline/node-telescope-server

 http://blog.raceconditions.net/wifi-telescope-control-with-skysafari-4/
 https://www.npmjs.com/package/stellar-socks



Overview
This is a small tutorial to connect Stellarium with a Celestron telescope, and control it remotly. The next diagram describes all the required elements to build your own homemade planetarium.

Requirements
 - RaspberryPi with raspbian installed.
 - A Ethernet wire or a Wireless adapter for your Raspberry Pi (I prefer a Wireless LAN adapter).
 - Telescope Celestron (Nexstar Protocol) with GoTo feature (Celestron NexStar 127SLT, in my case).
 - USB to Serial port adaptor (recommended).
 - A computer with Stellarium installed.

Installation
The first step is to install the nodejs and npm packages:

pi@raspberry $ sudo apt-get install nodejs npm

Verify that the current nodejs and npm packages have compatible versions:

pi@raspberry $ node -v
0.8.9

pi@raspberry $ npm -v
1.1.4

If the previous commands have returned older versions you should install node and npm manualy:

pi@raspberry $ wget http://www.nodejs.org/...
pi@raspberry $ tar zxf node-0.8.9.tar.gz
pi@raspberry $ cd node-0.8.9
pi@raspberry $ ./configure && make
pi@raspberry $ sudo make install

pi@raspberry $ node -v
0.8.9
pi@raspberry $ npm -v
1.1.4

Then install the node-telescope-server module in your Raspberry running:

pi@raspberry $ sudo npm install node-telescope-server -g

Now, connect your USB to Serial port adaptor to one of your available ports in the Raspberry Pi and connect the other side to the telescope. Run the next lsusb command to identify the USB device to be initialized:

pi@raspberry $ lsusb
...
Bus 001 Device 002: ID 4358:2523
...
pi@raspberry $ sudo modprobe usbserial vendor=0x4358 product=0x2523

Run dmesg command and you shall see lines like these:

pi@raspberry $ dmesg
usbserial_generic 1-1:1.0: generic converter detected
usb 1-1: generic converter now attached to ttyUSB0
usbcore: registered new interface driver usbserial_generic

Identify the device uid assigned by the kernel to the serial port, aka ttyUSB0

Start a nts instance to control your telescope. You should specify -t and -i arguments with your telescope type and file to the device file descriptor:

pi@raspberry $ nts -s stellarium -p 5050 -t nexstar -i /dev/ttyS0
Remote stellarium control server running at port 5000 to a nextar telescope
This command starts a Stellarium control server listenning at port 5050 connected to a Nexstar (Celestron telescopes) sending commands to /dev/ttyS0 device.

Now the Node Telescope Server (nts) is ready to receive instructions to move your telescope to the desired target.

Next step is to connect this nts instance with the Stellarium software. Open Stellarium and press Ctrl+0 or go to the telescopes window. Add a new telescope and choose the External software or remote computer. Then choose a desired name for your telescope, for example "NodeJS-RaspberryPI". Then specify the ip assigned to the RaspberryPI and the port listening by nts instance, in my case 192.168.5.1 and 5050 (because my Raspberry is configured as a AP gateway). Save the telescope configuration.

Multiple servers

$ nts -c config.json
Telescope Dummy: Remote dummy control server running at port 4000 to a dummy telescope
Telescope Stellarium Dummy: Remote stellarium control server running at port 4001 to a dummy telescope
Telescope Nexstar: Remote stellarium control server running at port 5000 to a nexstar telescope
Disabled remote web control server running at port 5001 to a nextar telescope

This command starts several servers defined in the config.json file.

An example of config file:

[
{
"name": "Telescope Dummy"
, "server": "dummy"
, "port": 4000
, "telescope-device": "/dev/null"
, "telescope-type": "dummy"
},
{
"name": "Telescope Stellarium Dummy"
, "server": "stellarium"
, "port": 4001
, "telescope-device": "/dev/random"
, "telescope-type": "dummy"

, "enabled": true
},
{
"name": "Telescope Nexstar"
, "server": "stellarium"
, "port": 5000
, "telescope-device": "/dev/ttyS0"
, "telescope-type": "nextar"
, "camera-device": "/dev/null"
},
{
"name": "Telescope Lx2000"
, "server": "web"
, "port": 5001
, "telescope-device": "/dev/ttyS0"
, "telescope-type": "lx2000"
, "camera-device": "/dev/null"

, "enabled": false
}
]

Last step is to click on connect button and the status label should change to "Connected".

Finally you have the Stellarium connected to your telescope! Choose the desired object and pres the Ctrl+1 and realize that the telescope start pointing to the target. :-)

Enjoy it!



-Do the same but now with Stellar-Socks (a TCP server for interacting with a telescope via serial connection from planetarium software such as Stellarium and SkySafari).

$ npm install stellar-socks

Configuration
By default the server will open a TCP socket on port 5000, and connect to a telescope on /dev/ttyUSB0. To configure these values, change the configuration in config.json.

Starting the Server

Before you start the server, you'll want to make sure you have your telescope on and aligned, as well as the Raspberry Pi (or other device) connected to the serial port on the telescope. You'll also want to make sure you have the configuration file config.json set up properly for your environment.
To start the server, navigate to the installation directory from the installation step, and run the following command:

$ npm start

When you run the command, the service will start up and announce its status as shown in the image below.

Running StellarSocks

You are now ready to configure your remote planetarium software to connect to the server.

http://www.nexstarsite.com/PCControl/RS232Cable.htm

0 comentarios: