Last edited · 73 revisions  


Uploading the Firmware

In order to upload the firmware to your micro-controller, you need to complete several tasks.

Install and configure the Arduino IDE

Install the Arduino environment (IDE).  The recent versions seem to be consistently reliable so download the latest (supported by Teensyduino if that's required) but not the "Windows app" version.

If you are using a Teensy3.x (3.2, 3.5, 3.6, or 4.0) 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

Unless the Wiki instructions for your particular board states otherwise, it is recommended that you use the latest OnStep release (currently release-3.16).

Unzip the folder to you PC. This can be on your desktop or in your ~/Documents/Arduino folder.

The directory will be named "OnStep-release-3.16". 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.

Preliminary Firmware Configuration

Before you start with the configuration, you should use the Configuration Calculator spreadsheet to calculate your mount's specific parameters.

Instead of editing the Config.h file manually, you can use the web based Online Configuration Generator to get a basic working configuration fast.

The values from the spreadsheet 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 SLEW_RATE_BASE_DESIRED to 0.5 degrees/second or slower.

  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. Select the tab for the Config.h file, Instructions for configuration are in that file.
  4. Near the top enter the selection for the PINMAP that matches your hardware.  For example if you have an OnStep MiniPCB controller you would use a Value of MiniPCB instead of OFF.
  5. A little further down is the MOUNT_TYPE parameter.  This defaults to GEM but for ALTAZM or FORK mounts you'll want to change it now.
  6. The AXIS1 RA/AZM section is next, enter the parameters from the spreadsheet: AXIS1_STEPS_PER_DEGREE, AXIS1_STEPS_PER_WORMROT.  Also, usually AXIS1_DRIVER_MODEL gets set to the type of stepper driver you're using (Config.h lists the types) and set AXIS1_DRIVER_MICROSTEPS to match the microstep mode you chose in the spreadsheet.
  7. The AXIS2 DEC/ALT section follows, enter the parameters from the spreadsheet: AXIS2_STEPS_PER_DEGREE.  Also, usually AXIS2_DRIVER_MODEL gets set to the type of stepper driver you're using (Config.h lists the types) and set AXIS2_DRIVER_MICROSTEPS to match the microstep mode you chose in the spreadsheet.
    *** Notice you can also reverse the direction of movement for each axis in this section using AXISn_DRIVER_REVERSE should that be required (and it frequently is.)  You'll want to evaluate/correct this, if necessary, once connected and "operational". ***
  8. You should review all of the other settings in the Config.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.   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 its purpose and available options.  Each section has a comment with a link to an online Wiki page with an expanded description of each setting.

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 select 72MHz operation though this isn't required.
    • For any Teensy3.x select the board and Optimize: "Faster".
    • For a STM32 Blue Pill select the STM32F103C and Optimize "Smallest" and Variant: "128KB". Upload method must be "Serial".
    • For a ESP32S or WeMos D1 R32 select the "ESP32 Dev Module" with its default settings.
    • For a Mega2560 select the board with its default settings.
  • You can now upload the firmware using the button on the Arduino IDE toolbar.

Verifying That OnStep Is Working

Once the upload of the firmware is complete, you should verify that OnStep is running on your board.

Some boards require an extra step here. For example, the STM32 Blue Pill, you need to first disconnect the USB cable, power off the board, and move the Flash/Run switch to the Run position.

To do this, open Serial Monitor in the Arduino IDE, set the baud to 9600, connect the USB to your computer, then enter the following command:

If you get a response like this:


Then OnStep is working as intended on your board, and responding to commands.