Last edited · 89 revisions  

 


The WeMos R32 with CNC V3 Shield

This is the Basic OnStep configuration using the WeMos (D1 or D2) R32 Microcontroller Unit (MCU) & the CNC V3 (CNC3) Stepper Driver interface board. We use these powerful, widely available & inexpensive boards for the simplicity and small package size they offer. 

You can see a comparison of various micro-controller features here 

The first photo below shows how the 2 boards appear after being stacked. 

The 2nd photo shows the WeMos board separated from the CNC V3 board which has 2 stepper drivers installed. 

This simple combination of components provides a complete basic OnStep Telescope Controller once the OnStep software is uploaded. 

Because the build is so modular, it is up to you to decide exactly what you need,  you provide the sockets or connections for the optional hand controllers, GPS, Real Time Clock, Environmental, Wifi or Ethernet modules.  

These parts are readily available from many sources including Amazon, AliExpress and eBay.  
(be sure to select the CNC V3 Shield )

 

License: Free use granted by author, Ken Hunter

 

License: Free use granted by author, Ken Hunter

 

Capabilities of this basic build include:

User configuration of Right Ascension and Declination - or - Altitude and Azimuth motor control via the Micro USB port and/or the OnStep remote Bluetooth Application loaded onto your Android phone plus ASCOM Connection to many Astronomy, Astro photography and other software programs which are freely available., .

Features:

  • The Wemos R32 board uses the ESP32S micro-controller which has very good performance.
  • Non-volatile memory/EEPROM: Built-in, The ESP32S has 4KB (by flash memory emulation) which is enough for user catalog storage.
  • Micro USB port provides a USB virtual serial port to upload OnStep firmware and allow control of the telescope mount once finished.
  • Easy OnStep firmware (software) upload compared to some other options.
  • Built-in Bluetooth on the ESP32 micro-controller.
  • Little or no soldering needed.
  • Stepper driver outputs on 0.1" pin-headers.
  • Power in for stepper motor drivers on two screw terminal jacks on CNC V3 board.
  • WiFi, Ethernet, Real Time clock, Environment sensor, GPS easily added...  See below.
  • OnStep can use different PINMAP designs and support for this device is in the Config.h file.  It is called the CNC3 using OnStep release-4.24 or later.

You decide what you need and how you want your controller to be configured. Additional capabilities can include Basic (BHC) or Smart Hand Controller (SHC), Wifi, Ethernet, GPS location and time, environmental data such as Temperature, Humidity, and Dew Point, improved Clock timing all are optional and easily added with inexpensive modules. The OnStep firmware is capable of ALL of this and more. What  you need or want is already supported by the OnStep software.

Most connections on this build can be made using Dupont jumpers. Pre-made adapters and circuit boards are available for most of the options and it's up to you to decide your own particular needs. Start basic, decide on the additional options you want and add them as you go along. Once you arrive at the perfect solution, it's time to find a suitable case for YOUR OnStep Controller

 

*** It's up to you to understand the design, connection, limitations, and use of this device and its components, I accept no responsibility. ***

You should read this entire page before starting the build...

 

 

CNC V3 Schematic:

License

 

 

Connection Diagram :

Here's a view of how the General Purpose Input/Output (GPIO) and other connections are actually made...

License: Free use granted by author, Ken Hunter

 

Power:

The CNC V3 stepper driver board should be powered from the motor supply (VMOT). Higher voltages are often used to improve the top end speed of the steppers in SLEW mode, the maximum voltage should always be less than 36V. 

The CNC V3 stepper driver board is normally connected to a 5V device in a 3D Printer but the OnStep telescope controller uses a WeMos D1 R32 which is a 3.3V device. For this reason, a single 10K resistor (which pulls stepper driver EN pins HIGH) must be cut off or un-soldered and removed. 

This single 10K resistor can easily be cut away with small diagonal cutters.

 

 

The WeMos board requires an 8-14V supply. (Typical 12V vehicle batteries while being charged are around 13.6V) Both boards can be supplied from the same power supply as long as the voltage remains less than 14V on the WeMos board.

To avoid the necessity of an additional power supply, An adjustable voltage regulator fed from the Motor supply (VMot) and adjusted to 8-12V can be used to supply voltage at a level usable for the WeMos. The regulated Wemos 5V & 3.3V can be used for powering other options. Be sure to stay within the voltage and current limits for each device.

 

Choice of Stepper drivers:

*** warning: never plug in or remove the stepper motor cables while powered up ***

 

Note: The CNC V3 circuit diagram and circuit board are labeled with the 3D printer functions which causes some confusion. Most OnStep builds using custom made boards have the Driver Axis' labeled Axis1, Axis2 etc. The CNC V3 board Axis' are labeled X, Y, Z, and A (sometimes S) . Just be aware that the OnStep pinmap for the CNCV3 uses the following driver locations on the board.

Axis1 = X = Right Ascension or Azimuth

Axis2 = Y = Declination or Altitude

Axis3 = Z = Rotator or Focuser 2 (selected in Config.h)

Axis4 = A (S) = Focuser 1

 

The yellow highlights below show where shunts must be inserted to properly activate the 4th stepper driver (labeled AMOT.) for a second focuser, filter wheel, rotator etc.

 

License

 

  • Axis1/2 (RA/Dec or Azm/Alt):
    • The LV8729 (or S109 for higher current motors) is the recommend driver due to its low cost and easy setup.
      • These stepper drivers operate in a fixed micro-step mode selected on the 3x 2 pin headers under each stepper driver.
      • This means that Tracking and Slewing use the same microstep setting which will effect slewing and tracking speeds.

    • The FYSETC TMC2130 v1.1 (or Bigtree TMC5160 v1.2 for higher current motors) is also a good choice but requires more connection effort in the CNC V3 build.
      These Stepper Drivers allow different microstep settings during slewing and tracking, often providing greater slewing speeds while retaining great tracking.  
      They are available on eBay (read about the TMC2130 and TMC5160 before buying!)  Just remove all shunts under the stepper driver and plug them in. 
      • Once the following is done you'll be able to configure a variety of settings for these stepper drivers in On Step's  Config.h file including the micro-step mode, stealthChop or spreadCycle, lower the power for tracking, etc.
      • Make the following connections between the Wemos and CNC V3 board. (Soldering required)
        • Axis1 SDI to Axis2 SDI to the WeMos R32 GPIO32 (SPI MOSI, not present on the CNC V3.)
        • Axis1 SCK to Axis2 SCK to the WeMos R32 GPIO33 (SPI SCK, not present on the CNC V3.)
        • Axis1 CS to the WeMos R32 GPIO15 (not present on the CNC V3.)
        • Axis2 CS to the WeMos R32 GPIO 0 (not present on the CNC V3.)



        • Thanks to Chad Gray for graphic idea.
        • Axis1 and Axis2 SDO are NOT supported and don't get connected. 
        • Using these TMC stepper drivers ties up the SPI interface and GPS (Serial3) is then not possible.

      • One must take care if TMC stepper drivers are used (TMC2130, 5160, 2208, etc.) they can NOT have logic/signal power present before the motor power supply comes up:

        Solutions:

        • Using a voltage regulator fed from the motor supply line to power the WeMos ensures the Motor supply is always there before the logic/signal power.
        • There are TMC driver protection devices (that use Vio to power Vmot) which should avoid issues with this; available on aliexpress, eBay, etc.
        • You can skip the TMC drivers and use LV8729's (or S109, A4988, etc.) and not worry about this. (Same microsteps for slewing and tracking)
        • This might sound complicated but when building the controller inside a small enclosure it's all perfectly possible to do in such a way that there will never be an issue.
    • Many other drivers can work too there's a summary here.
    • Tip:
      • The SSS TMC2130/TMC5160 status and error detection feature is not supported with this device since there is no provision for SPI MISO.
      • The Axis1 and Axis2 ENable control line is shared between the drivers.  For this reason you can't use the AXIS2_AUTO_POWER_DOWN_ON option (to save power.). 
      • You can use the power saving options available on the SSS TMC2130/TMC5160 to achieve a similar effect though.
      •  
  • Axis3/4 (Focusers and/or Rotator):
    • The LV8729 is the preferred driver for these sockets due to its low cost and availability.
    • The SilentStepStick TMC2208 is a better choice if TMC drivers are also used in Axis1/2.  They default to using stealthChop for silent operation with 256x interpolation for smooth motion.
      • Supports automatic stand-still power reduction (their ENable pin will need to be cut off for this.)
    • The A4988 is a good option as well due to its very low cost.
    • Tip:
      • These stepper drivers all operate in a fixed micro-step mode selected on the 3x 2 pin headers under each stepper driver.
      • Normally these drivers use lower power levels and so no heat-sink is required.

 


Hardware SPI interface:

Not supported.  Note: This is separate from the SPI interface used for the TMC2130/TMC5160 stepper drivers.

 

Optional Capabilities:

BUZZER: 

The CNC V3 is equipped with a Tone pin (GPIO2) for audible alerts.  An active 3.3 or 5V buzzer works well here (GPIO 2 to + terminal, GND to - terminal)

License: Free use granted by author, Ken Hunter

 

ST4 interface: 

Originally designed for Automatic tracking signals, the ST4 interface used in OnStep allows guiding signals to be sent from a BHC or SHC controller as well as signals from an auto-tracking sensor. This is enabled by setting ST4_INTERFACE  ON in the configuration file. 

If using the Basic or Smart hand controllers the ST4_HAND_CONTROL ON option is used and additional capabilities become available, More information on this can be found in the configuration file. 

ST4 connections typically use an RJ12 connector. To maintain compatibility with other builds it is suggested that you use the following pin connections if an RJ12 connector is used. The order of pins shown here match those of the RJ12 jack they should be connected to (search eBay for "RJ12 breakout"):

Pin 1: +5V
Pin 2: GND
Pin 3: RA-  (GPIO34)
Pin 4: Dec- (GPIO18)
Pin 5: Dec+ (GPIO4)
Pin 6: RA+  (GPIO35)

 

On the CNC V3 board the 4 ST4 hand pad lines (RA-, Dec-, Dec+, RA+.) need to be "pulled up" to 3.3 volts.
The easiest way to do that is to use a SIP (single inline package) network (also called an array). 
SIP networks are available with from 4 to 14 resistors (plus the pin 1 connection) as well as in many different resistance values.  Common values around 2K ohms are appropriate and usable with no bad effects.  In a pinch, regular axial lead resistors can be used to create a resistor network as shown here.
 
 
By connecting pin 1 of the Network to the 3.3 volts, you supply a 3.3v reference through a separate resistor to each line (called a pullup in this case.) This ensures that each ST4 hand pad line is not acting as an antenna where stray voltages could change the logic level of the line and give spurious results.
 
 
License: Free use granted by author, Ken Hunter
 
In the above photo, the resistor network has pin 1 on the left end and each lead after that is a separate resistor tied to pin 1 which is connected to 3.3V. The 6 pin network in the photo I already had on hand so I cut the unused pin off but a 5 pin Network would have worked just the same.

 

Serial Ports:

OnStep on the WeMos R32 has three active Serial Ports. 

SerialA (Serial1) is attached to the WeMos R32 micro USB port 

SerialB (Serial2) is available for the optional WiFi or Ethernet add-on.

  • The SerialB (Serial2) port pins are designated (TX2, GPIO5) and (RX2, GPIO13.)
  • Tip: The built-in WiFi on the ESP32 micro-controller is not supported in OnStep.

RX on the module goes to TX2, TX on the module goes to RX2 on the CNC V3 board (as shown in connection diagram above.)  You also need +5V and Gnd connected to power the device. To learn more about the WiFi and Ethernet devices, their functioning and how to upload the firmware follow these instructions . 

SerialC (Serial3) is reserved for the WeMos onboard Bluetooth (configured in Config.h)

Additional Serial Ports may be available depending on the stepper drivers used. See GPS config...

 

I2C Bus...

Enabling the DS3231 Real Time Clock (RTC) enables the I2C bus and overrides Home SW support since I2C is on the same Aux3/4 pins. 

  • The RTC is optional but the I2C bus is disabled if the RTC is not enabled.
  • The pins for Aux3 (SDA) and Aux4 (SCL) are the I2C bus and are located on the WeMos R32 board only.
  • (like named pins on the CNC V3 shield are NOT I2C.) 
  • GND and RST pins are for a remote RESET switch for the Wemos MCU
  • See the photo below for the location of these pins.

License: Free use granted by author, Ken Hunter

 

DS3231 (RTC)...

The DS3231 module provides the date and time on the I2C bus and a Pulse Per Second (PPS) signal (using Aux7) if desired. Other RTC modules are available also.

 

Stock Internet photo

 

BME280... The BME280 can be used at the same time on the I2C bus. It provides temperature, humidity and Barometric pressure 

Stock Internet photo

 

GPS...

A GPS module can automatically supply Latitude, Longitude, Time when OnStep is first started. Great for operation at remote locations. The connections for this module depend on using Stepper Drivers that do not use the SPI interface pins. Assistance for GPS configuration can be found with a message search for "Additional Serial Port" several different modules are available.

License: Free use granted by author, Ken Hunter

 

Misc. I/O:

There are pins designated Aux7 and Aux8 which can be used to support a single feature on each.  You can bring these out on a 3.5mm mini stereo jack for external access to them.  The jack's collar is Gnd, its ring (middle) is the Limit Sense, and its tip is the Illuminated reticle. 

Aux3 typically used for a Home SW on RA or Azm but can be used any purpose (dew heater for instance, on/off switch, etc.)  If I2C is used this is SDA instead.

Aux4 typically used for a Home SW on Dec or Alt but can be used any purpose (dew heater for instance, on/off switch, etc.)  If I2C is used this is SCL instead.

Aux7 is an input only pin and can be used for one of the following 

  • Limit Sense - A switch (or series of switches wired in parallel) can close pulling the limit sense LOW to stop any slew and tracking.  You should protect the Limit Sense input against ESD with a 0.1uF capacitor and a reasonably strong 2K pull-up resistor.  This can be physical limit switches and/or an emergency stop button.
  • PPS - from the DS3231 RTC or GPS.  Pulse Per Second provides OnStep with a more accurate clock source for precision timing of steps.

Aux8 is an input or output pin and can be used for one of the following:

  • Status LED - not a recommended option.
  • Status LED2 - not a recommended option.
  • Reticle - typically this would be attached by plugging into a mini stereo jack.  If using this to directly drive an LED be sure to add a resistor in series to limit the current.
  • OneWire - supports DS2413 (dual GPIO) and DS18B20 (temperature sensors.)  Allows for temperature compensated focusing, dew heater control, intervalometer, etc.
  • Typically this would be attached by plugging into the mini stereo jack.

 

PEC, periodic error correction input.  Often the critical RA axis of the mount uses a gear reduction worm-wheel gear.  The worm usually has minor machining errors that repeat once per cycle and a physical sensor makes sure OnStep always knows where the worm is in that cycle.  See PEC_SENSE in the configuration file to set this up, there are several options to suit different sensors.

  • Perhaps use a mini (1/8") stereo jack with its collar as Gnd, ring (middle) as the PEC sense, and the tip as a 3.3V source.  Some ESD protection on the sense pin with a 0.1uF capacitor doesn't hurt.  This arrangement can be used with an optical encoder or hall-effect (magnetic) sensor with minimal or no additional circuitry.  This is on the ESP32 input only pin I36 which can be operated in digital or analog mode.