Uploading the Firmware
In order to upload the firmware to your micro-controller, you need to do several tasks.
Install and configure the Arduino IDE
Install the Arduino environment (IDE). Version 1.8.5 had a long history of working correctly but the newest versions seem to be consistently reliable now too so download the latest version (supported by Teensyduino if that's required) but not the "Windows app" version.
If you are using a Teensy3.x (3.2, 3.5, or 3.6) be sure to download and install the Teensyduino add-on.
If you are using an STM32F103 board (e.g. the Blue Pill), then you need to install Arduino_STM32. The details on doing so are in the Installation section on the STM32 Wiki page.
The Arduino IDE menu File>Preferences "Additional Boards Manager URLs" should have the following line added so you can install ESP32 and ESP8266 support if required:
If you are using the ESP32 to run OnStep or the ESP32 version of the SHC install support for those boards from within the menu Tools>Board>Boards Manager. Install ESP32 version 1.0.4
If you plan to use the WiFi add-on (ESP8266) install support for those boards from within the menu Tools>Board>Boards Manager. Install ESP8266 version 2.4.2
Getting the OnStep Firmware
Download OnStep release 2.22 .zip from GitHub unless you're running OnStep on an ESP32, in which case you need the latest beta branch. It is recommended that you stay with the latest release branch if possible. The beta branch is available here for those who want or need to use it and while it may have more features or bug fixes, it is not as well tested.
Unzip the folder to you PC. This can be on your desktop or in your ~/Documents/Arduino folder.
The directory will be name OnStep-release-2.22 or OnStep-beta, depending on the version you downloaded. You must rename the directory to "OnStep", otherwise you will not be able to compile OnStep.
Also, remember there is separate (but related) source code for the ESP8266 Wifi and Teensy3.2 Ethernet servers and Smart Hand Controller (SHC) in the /src/addons directory within your OnStep directory.
Configuring the Firmware
Before you start with the configuration, you should use the spreadsheet to calculate your mount's specific parameters. These are critical in matching OnStep to your hardware. This includes your final stage gear ratio (GR2), your secondary (transfer) gear ratio (GR1), the full steps per rotation of your stepper motors and how many microsteps each motor full step is divided up into by your stepper driver. By default OnStep will operate at 1 degree/second slew speed. If the mechanical design warrants it feel free to adjust the DesiredBaseSlewRate to 0.5 degrees/second or slower.
While it is highly recommended that you follow the procedure below you can instead make use of the online OnStep Configuration Generator (for OnStep version 1.1f or later. Here is a step by step video on how to use it) and skip steps 4 and 5 (instead copy the online configuration generator provided data into the Config.xxx.h file; replacing it's original contents.)
- Open the OnStep folder you downloaded/unzipped from GitHub.
- Double click on OnStep.ino file (inside the OnStep folder.) This opens the project so you can edit the configuration.
- Choose only one Config.xxx.h file that matches your hardware! Instructions for configuration are in that file.
- From the spreadsheet enter the critical parameters: StepsPerDegreeAxis1, StepsPerDegreeAxis2, StepsPerWormRotationAxis1, PECBufferSize, and MaxRate into Config.xxx.h
- Fill in the "AXIS1/2 STEPPER DRIVER CONTROL" section with your AXISn_DRIVER_MODEL and AXISn_MICROSTEPS values. The AXISn_DISABLE HIGH default works with most common stepper drivers except the RAPS128 (LOW.) The AXISn_FAULT option is usually only used with TMC2130 stepper drivers but it can work with others. *** Notice that you can also reverse the direction of movement for each axis (AXISn_REVERSE_ON/OFF) in this section should that be required (and it frequently is.) You'll want to evaluate/correct this, if necessary, once connected and "operational". ***
- You should review all of the other settings in the Config.xxx.h file to be sure they match your hardware. Most of these are optional and OnStep will work reasonably well without changing them from the defaults. One exception to that is the MOUNT_TYPE_XXX parameter near the beginning of the configuration file. This defaults to _GEM but for _ALTAZM or _FORK mounts you'll want to change it now. Take a moment and read through... these are the features OnStep supports and this is an excellent place to learn about them. Each setting has a comment describing it's purpose and available options.
Uploading the Firmware
After you have done the above, proceed with the configuration:
- In the Arduino IDE select the correct serial port and board.
- For a Teensy3.2 I select 72MHz operation though this isn't required.
- For any Teensy3.x I select Optimize: "Fastest".
- For a STM32 Blue Pill I select the STM32F103C, Optimize "Smallest", and Variant: "128KB".
- For a ESP32S (MaxESP2/3) I select the ESP32 Dev Module with its default settings.
- For a Mega2560 simply select the board with its default settings.
- You can now upload the firmware using the button on the Arduino IDE toolbar.