Last edited · 10 revisions  


The Bluetooth GamePad Hand Controller (BGC) Add-On

*** NOTE: The Wemos ESP32 module used here is a "swapable" unit for the commonly used Wemos ESP8266. It can also be added to almost any OnStep controller.***

*** NOTE: This specific GamePad and a ESP32 module are required. The Wemos ESP32 and several other ESP32 modules are supported. Both the GamePad and Wemos ESP32 module can be obtained for about $10.00 US, making the total cost about $20.00 US.***

*** NOTE: This is part of the SmartWebServer. It is in addition to the WiFi/Ethernet and will operate concurrently.***

It is a cordless, operate by "feel" controller. IMHO for visual observing it beats a corded hand controller. Object not centered? Just pull it out of your pocket, select a guide rate and use the joystick to center. Not in the field of view? Use the spiral guide to locate it. One keypress starts it at the current guide rate another tap stops it. Lost? The "A" button will return you to the last location. The trigger buttons are for a Focuser. Like the SHC they go from slow to fast speed after the button is held for more than 5 seconds.

BLE Bluetooth avoids many of the old Bluetooth issues. It does not require "pairing". Just turn the GamePad on and it will connect to OnStep automatically. If you walk away and disconnect, it will turn the blue led (Wemos) on. When you are back in range it will automatically reconnect and turn the blue led off again. Battery life is long, it will not die during a nights viewing. You will probably be shocked when you finally have to charge it.

BGC Hardware requirements

This is a link to a Wemos ESP32 module, it is a pin for pin (with many additional pins) substitute for the Wemos ESP8266:

These are available from many locations including Ebay, AliExpress and Amazon. Just search for "Wemos ESP32". If it looks like the above module it is most likely good.

I believe it can be used almost wherever the original Wemos ESP8266 WiFi module is used. The cost is similar. The only caveat I am aware of is that the board is physically larger and may require some minor modifications to get it into boards with space limitations.

For the electronically adept. The Wemos ESP32 is just a ESP32 on a board with the Wemos pin layout. This makes it a "swapable" replacement for the Wemos ESP8266. A "Dev C" ESP32 would also work (either the 30 or 38pin). This may help with other OnStep designs that do not already have the Wemos WiFi socket. It is up to the user to design a daughter board and connect it to the main OnStep board. Power/Gnd and the Rx/Tx pins are all that are required.

The only GamePad currently supported is this:

These can be obtained for about $10 from China, with the attendant slow shipping. I suggest you buy two. The code supports two in a "hand off" mode. That is, you can switch from one GamePad to the other if the battery runs down on the first.

This GamePad comes in several versions but all end with "R1". I have the "Magicsee R1". The ACGAM R1 is another acceptable version. It wil be a BLE {bluetooth v4.0+) GamePad. This is because you can only have WiFi and BLE enabled at the same time with the ESP32 chip. They do seem to play together well, that is they are "concurrent". GamePads in general seem to have very loose coding standards. Another type (even if BLE) may require different button coding and most likely will not work correctly or at all. Eventually several different types will be supported.

The ConfigX.h file must have the correct MAC address for your specific unit and have the GamePad enabled (BLE_GAMEPAD ON). The easiest way to obtain the MAC address is to use the OnStep Android App. After pairing the GamePad with your Android Device start the OnStep App. Note: you will need your OnStep device on in order for the App to start. Once started go to the Connections tab. This will open a screen showing all of your paired bluetooth devices. Find the one with "R1" on the end of the name, copy the MAC address down.  Before flashing you will need to insert the MAC address in the ConfigX.h file of SmartWebServer. There are other ways to find the name and MAC and there are other Android Apps and WiFi/Bluetooth tools that can do this.

Note. The GamePad itself does not require pairing. Your Android device will in order for it to show in the OnStep App. To prevent problems I suggest you "unpair" the GamePad with your Android device after obtaining the MAC address. This is to prevent it from connecting to and hijacking the GamePad away from OnStep. This is a very annoying issue and a leading cause for not connecting (the GamePad can only connect to one device at a time).

Battery charge life is fairly long. I have had one charge last several weeks with fairly heavy use. There is nothing currently to tell you when the charge is low. Weird responses and buttons not responding are typical symptoms.

Currently, two GamePads are allowed in a "hand off" fashion. This is so you can have a spare GamePad if the charge should run down on the first one. Just turn off the exhausted one and turn on the one with a fresh recharge. Assuming you inserted the two MAC address correctly it will automatically find the new one and connect to it seamlessly. Note, it will connect to only one at a time! No "his/her remote" fights allowed.

Flashing The BGC Firmware

The GamePad is part of the SmartWebServer located here

Extract from the zip file the entire subdirectory to the proper location in your Arduino IDE. You will now have a SmartWebServer subdirectory to use for the Wemos ESP32 firmware uploading.

You will need to have the ESP32 hardware library installed. Under the menu File->Preferences open the dialog and add this line in the "Additional "Boards Manager URL's" text box: "," (no quotes). The ESP32 board library can then be installed from the Hardware Manager in Arduino IDE. Select the "tools" tab, go down to the "Board:" selection. The "Boards manager" will be the top selection. Click it and enter "ESP32" into the search box. Install version 1.0.4. This is very important! Later version have problems with the serial port that the Wemos uses.

It is best to flash the WemosESP32   "off-board" with a short USB cable that supports data transfers. Be forewarned that a lot of cables are power only. If this is the case it will not connect or show the Wemos Serial port number.

Before flashing you need to enter the MAC address obtained previously. Put it in the ConfigX.h file. Replace the "ff:ff:ff:ff:ff:ff" with your MAC address in lower case. You will end up with a line like: "define BLE_GP_ADDR   "ff:ff:ab:09:d6:5a" ". There is provision for two GamePads. Unless you have two leave the second line with the default "ff:ff:ff:ff:ff:ff". Be sure you have the GamePad enabled "BLE_GAMEPAD ON".

Before compiling you must erase the ESP32 completely. The ESP32 does not have an  option for this like the Wemos ESP8266. The required utility is located here:  You will need to install the erase utility from the Zip file into the main Arduino directory (usually in Documents/Arduino). Afterward you should have a path like "C:\Users\Administrator\Documents\Arduino\Tools\ESP32Erase\tool" containing the file "esp32erase.jar". Start/Restart the Arduino IDE. You will now have a "ESP32 Erase Flash" in the tools tab. You must select the ESP32 hardware and Serial port first and then select the "ESP32 Erase Flash", a window will pop up asking you if you want to Erase the ESP32. Select "yes", it will run the utility and report when done. Only now you can upload the code to the Wemos ESP32.

To compile I suggest you use the "MH ET LIVE ESP32MiniKit" for the hardware. You must select the "No OTA (Large APP)" Partition Scheme (The BLE code uses a lot of memory). I have found out that the Wemos D1 ESP32 hardware options also works.

Starting Up

Turn the GamePad on/off switch to "ON".

The GamePad operates in Mode "D". It starts in Mode "A" on power up. This means when you turn on the GamePad you must remember to switch it  into mode "D". Pressing the "M" and "D" buttons at the same time accomplishes this. You can do this at anytime, but it will not operate correctly until you do.

The typical startup procedure is:

  1. Start OnStep with the ESP32 module installed
  2. Turn on the GamePad, it will start blinking
  3. The Wemos will blink until it is done setting up the WIFi/Ethernet and Bluetooth.
  4. The GamePad led will go out indicating that it is connected.
  5. Press the "M" and "D" buttons simultaneously, it will blink once.
  6. You are now connected.

Button Assignments

This is a seven button GamePad with a joystick. Current button assignments are the following:

  • Joystick = N,S,E,W
  • Upper trigger = Focus out
  • lower trigger = Focus in
  • Button A = GoTo last location
  • Button B = Spiral search
  • Button C = Slew Rate decrement
  • Button D = Slew Rate increment
  • Button M = Park/UnPark (The M button is also an "emergency stop" pressing it during an errant slew will stop all motors)

These are initial assignments and will be added to in the future.

Usage Notes

Slewing starts with the lowest speed. If you don't see any movement press the "D" button and try again. Each time you press it  the speed will increase.

OnStep starts pointing at "NCP" (North pole). The Spiral will not work until the scope is pointed 10 degrees from NCP by default. Move the scope away from the NCP and it should work. Note that the Spiral search speed is the same as that set by the slew speed buttons.

The focus buttons also start at the lower speed. It will switch to high speed after the button is held for 5 seconds. This is the same as the Smart Hand Controller.

If you still cannot get any response try setting "Mode + D" again. The GamePad should flash once. If the GamePad is continually blinking it means it is not connecting for some reason. Check the MAC address (most common problem). Check to be sure another device has not "hijacked" the GamePad. Not unpairing from the device you got the MAC address from is the a common culprit.

You can set "
BLE_GAMEPAD OFF" in ConfigX.h and reflash the Wemos ESP32 to remove the GamePad function enable WiFi/Ethernet function only.