Last edited · 15 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.

For my early testing I used an Arduino M0 and Arduino Ethernet Shield R3 (W5100.)  Also tested is the Teensy3.2/W5500 (available on eBay) combination which is now the recommended hardware.  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 (Arduino M0 or Teensy3.2,) you need to install the platform for the Arduino IDE.

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

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

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

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

If you are using a MaxPCB v1.14 or later with the W5500ToMax PCB you don't need to worry about wiring, since it is all done for you (the WeMos D1 Mini footprint is used so the W5500ToMax plugs right into the MaxPCB.)

If you are not using the above combination you have to connect your ESP8266 to certain pins for your microcontroller. Basically, the TX on the Ethernet controller should be connected to an otherwise unused serial port RX on the microcontroller, and RX on the Ethernet controller should be connected to and otherwise unused serial port TX on the microcontroller.

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, or Etherent, or RS232, etc.

Note: Serial2 on a Mega2560 is only available if using the latest Alpha branch OnStep.

Attention: In no case (WeMos D1 Mini, Node MCU, Mega2560, STM32, etc.) should you use the TX/RX pins that are attached to the microcontroller's serial to USB chip!  Those consist of two serial devices talking to each other and adding another will damage hardware.

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.