Last edited · 28 revisions  

 


The Ethernet Add-on

This add-on provides a Ethernet adapter which can be used to connect OnStep to an LAN, and from there a cell-phone/tablet (if a wireless access point is on the network) or laptop/desktop computer.  It has both a web-server and IP command channel (on port 9999.)  Programs such as Sky Safari, my ASCOM driver, and the Android App can use the IP channel.

There is also support for A/B quadrature and CW/CCW Encoders in this firmware.  From what I read an Teensy3.2 can handle at least 40k count A/B encoders.  Limitations in CW/CCW mode are unknown but expected to be in the same range at a minimum.

The Teensy3.2/W5500 (available on eBay) combination is the recommended hardware.  For my early testing I used an Arduino M0 and Arduino Ethernet Shield R3 (W5100.)   Other configurations are untested but Arduino's with ARM MCU's and similar Ethernet Shields should generally work.

  • There are reports of the Arduino Ethernet Shield V2 not working with the M0 so avoid that!

Wiring and Power

For the W5500ToMax2 the WeMos D1 Mini footprint is used and it plugs right into the MaxPCB2 or MaxESP3.  Be aware that this PCB requires very careful attention to the order of assembly due to its overlapped components.  Also, the excess pin header "tails" need to be trimmed (at each step) after soldering or they will cause shorts!  Having it this compact is a hassle but it results in a nice clean install inside the MaxPCB2 case with the Ethernet jack positioned right at the case edge (where a slot can be cut to allow access to the Ethernet jack) and the PCB held tightly in place since the jack is in contact with the case top.  This design should also work the MiniPCB2, though not in its standard aluminum case.

  • The W5500ToMax2 version 2.0 will plug right into a MaxESP3 but the serial interface pins are at a different location.  It can work but you will have to fly wire the WeMos D7/D8 (swapped serial) to RX/TX (primary serial) pins to make correct connection.  The W5500ToMax2 Version 2.1 already has those extra connections.

 

The W5500ToMax was designed for the (now obsolete) MaxPCB1 and also has a WeMos D1 Mini footprint.  Additionally it has a convenient Molex KK pin-header for connection to other boards as well.  This design should also work with the MiniPCB1 using the BT socket.

 

If you are not using one of the above PCB's you have to wire your W5500's ground, power, and SPI interface pins to its microcontroller (T3.2 or M0.)  Then connect the microcontroller (T3.2 or M0) TX to an otherwise unused serial port RX at the OnStep device, and RX on the microcontroller (T3.2 or M0) should be connected to and otherwise unused serial port TX at the OnStep device.

Serial channels in OnStep are designated with a letter A, B, C.

  • A is always the Serial/USB channel (where programming normally happens) and is always occupied (not available.)
  • B is the first available Serial port.  Normally Serial1 (Mega2560, Teensy3.x) but the STM32 uses Serial3 (PA10/TX and PA11/RX.)
  • C is the next available Serial port.  This is Serial2 (for a Mega2560) or Serial4 (for a Teensy3.5/3.6) and isn't available on the Teensy3.2 or STM32.

Notes:

  • Serial channels in OnStep are not specific to a purpose and SERIAL_B or SERIAL_C can be used for Bluetooth, Wifi, Ethernet, or RS232, etc.
  • These Ethernet add-on modules should be powered from a 5V supply (my MiniPCB and MaxPCB, for example, are easily capable of providing 5V at sufficient current.)
  • The Teensy3.2 or Arduino M0 take 5V and then provide 3.3V for powering the Ethernet adapter.  In the case of the W5500 the Teensy3.2 3.3V regulator is capable of powering the device.  The Arduino M0 is designed to allow an Arduino Ethernet Shield R3 (W5100) to plug in so no problem there either.
  • The Serial1 port on a MKS Gen-L (and possibly other similar boards) may have additional circuitry that interferes with the WeMos D1 Mini's operation.  For this reason we recommend wiring to the Serial2 port of this device.
  • Never plug into the add-on's micro-usb while the gnd and power connections to the OnStep telescope controller are connected unless there is a diode installed to block reverse feeding power into the telescope controller.
  • If OnStep is running on a Mega2560 note that the Arduino M0 pins are not 5V tolerant so a level shifting circuit will be needed to drop the 5V TX from the Mega2560 to 3.3V levels.  On a Teensy3.2/W5500 this is not required (Teensy3.2 has 5V tolerant I/O.)

Installing the Platform

Before you can flash the firmware on your board (Teensy3.2 or Arduino M0) you need to install the platform for the Arduino IDE.

For the Teensy3.2, download and install the Teensyduino package.

For the Arduino M0, from the "Tools, Boards, Boards Manager" menu select and install the Arduino M0 add-on.

Configuring OnStep for the Ethernet Add-on

No special configuration of OnStep is necessary.

Configuring the Ethernet Add-on

Open the Ethernet Add-on source code located inside the OnStep folder under the "addons/Ethernet" sub-directory in the Arduino IDE.  In the IDE you will see its configuration file in a tab (Config.h.)  It is important to have the following settings correct for your network.  You can assign a unique mac address if you like, this is like a serial number to differientiate devices on a network, you should never have two that are alike.  A value of 0 to 255 can go in any position, so for example { 244, 124, 64, 98, 213, 6 } would be valid.  The ip should be an unique static IP address (DHCP is not supported) within your networks address range as limited by the subnet.  The myDns and gateway should often point to the address of your home networks wireless access point.  Finally, the subnet probably won't need to be changed.  Here are the defaults:

// ETHERNET SETTINGS ---------------------------------------------------------------------------------------------------------------
// Enter a unique MAC address for your controller if you like:
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
// The IP addresses below will be dependent on your local network:
IPAddress ip(192, 168, 1, 55);
IPAddress myDns(192,168, 1, 1);
IPAddress gateway(192, 168, 1, 1);
IPAddress subnet(255, 255, 255, 0);

You can also select a "locale" at this point if you like:  English and German are currently supported in the latest release.  Select a locale using #define DISPLAY_LANGUAGE L_xx where xx is the country code as listed in the file Locales.h.  Other languages can easily be added if you can do the translation though, so please ask on the forum to learn how to go about this.

Notes:

There are other advanced settings in the Config.h file and those should all be left in their default state at this stage.  Once you have things working you can go back and customize to your liking.

Flashing The Ethernet Server

The exact flashing procedure depends on which Arduino board you will be using.

In the Arduino IDE, pick your device from "Tools, Boards" menu.

Select the devices USB serial port

The source code is inside the OnStep folder under the "addons/Ethernet" sub-directory.

Open the Ethernet.ino file inside this folder. Check the "Config.h" file for information about serial port wiring and to configure before uploading. Once this is done upload to the board.

Start Up Sequence

OnStep and the Ethernet Add-on both use a default serial port baud rate of 9600.  On startup the Ethernet Addon sends a command to OnStep to change its baud rate up to a higher operating baud rate of 57600 (or 19200 for a Mega2560.)

The Ethernet web server and command channel will only start if the Addon's MCU is able to connect to OnStep and get a valid reply for this baud rate change. Otherwise, you will not be able to connect to the website or command channel. 

Notes:

  • During this time you might notice repetitive flashing of any serial comms LEDs (if present) at four second intervals as my firmware tries to get a valid reply to the baud rate change up command (after which it begins operating.)
  • You can also change the default and operating baud of both OnStep and the Addon's MCU to be one and the same (both 19200 or both 57600.)  This disables the baud rate change up and lets the web and command channel servers come up without confirming OnStep's presence.

Once It's Working

When you power on your OnStep controller you can connect to the Wifi add-on access point from a computer of cell-phone.

  • Open a browser, and enter the IP address you assigned above (for example 192.168.1.55) to reach the website.
  • Or open Sky Safari, the Android App, ASCOM driver and use IP address you assigned above and :9999 (for example 192.168.1.55:9999) for an IP connection.