Last edited · 51 revisions  

 


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:
http://arduino.esp8266.com/stable/package_esp8266com_index.json,https://dl.espressif.com/dl/package_esp32_index.json

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 the OnStep release 2.22 .zip from GitHub. It is recommended that you stay with the latest release branch. The master branch however is also available (master .zip from GitHub) and may have more features or bug fixes, but it is in constant flux and often not as well tested. Only use it if you want to test new features.

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-master, 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.)

  1. Open the OnStep folder you downloaded/unzipped from GitHub.
  2. Double click on OnStep.ino file (inside the OnStep folder.) This opens the project so you can edit the configuration.
  3. Choose only one Config.xxx.h file that matches your hardware! Instructions for configuration are in that file.
  4. From the spreadsheet enter the critical parameters: StepsPerDegreeAxis1, StepsPerDegreeAxis2, StepsPerWormRotationAxis1, PECBufferSize, and MaxRate into Config.xxx.h
  5. 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". ***
  6. 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.