Last edited · 23 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 pulse/dir encoders in this firmware.

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!

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.

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".

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.

Wiring

There are two W5500 PCB's available on EasyEDA, the W5500ToMax2 for the MaxPCB v2.x and the W5500ToMax for the MaxPCB v1.x

For the W5500ToMax2 the WeMos D1 Mini footprint is used and it plugs right into the MaxPCB v2.x  Be aware that the W5500ToMax2 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 MiniPCB v2.x, though not in its standard aluminum case.

The W5500ToMax was designed for the (obsolete) MaxPCB v1.x and also has a WeMos D1 Mini footprint - but it also has a convenient Molex KK pin-header for connection instead.  This design should also work the MiniPCB v1.x using the BT socket.

 

If you are not using the above combination 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.

Note: SERIAL_B or SERIAL_C can be used for Bluetooth, WiFi, Ethernet, or RS232, etc.

Attention: 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.)

Power

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.

Starting Up

The Ethernet server will only begin operation if it was able to connect to OnStep via Serial1 and find it working. Otherwise, you will not be able to connect to the web-site or use the command channel.

You can replace DEBUG_OFF in Config.h with DEBUG_ON to change this behavior if interested in verifying operation.