StefanoTesla / Ascom-Alpacha-ESP32-Switch-Borad-Dome-Board

Ascom Alpaca Dome Switch coverCalibrator control with a ESP32
MIT License
6 stars 2 forks source link

Ascom Alpacha Switch and Dome Board ESP32

Hello everyone, with this board you can use Ascom Switch and Ascom Dome via Wifi!

Each two devices are recognized form ascom aplacha, no usb connectio or driver are needed to work!

Switch can be ON/OFF or PWM!!!!

The switch are already tested with N.I.N.A! Dome is already tested with Ascom device hub, Nina and Starkeepper Voyager Software

It's a work in progess, but it's already tested with great stability!

WiFi Manager for first connection. Automatic reconnection in case of disconnection (hoping for a router restart) Ota Update to update the firmware without any cables.

Dome

Actually Ascom Dome function is tested with:

My dome is R.O.R rolling roof, I used a gate motor, so I use just two output and two input:

The start signal is HIGH until I will not lost the acutal position sensor.

Switch

Actually Ascom Switch function is tested with:

16 Switch can be configurated as output or input, pwm signal or analog input. PWN singals are automatically setted up with a range from 0 to 8192.

Error sended to ascom alpaca:

History

The software was made with Arduino IDE and ported subsequently to Platformio for better management Version 1.2 requred I/O config form the firmware, with version 2.0 you need to download the firmware only the first time!

Changelog

💥 3.0.0 - BREACKING NEWS! Now switch, calibrator and dome are module, if you don't plan to use it, you can disable it!, the web page and the discovery will hide it for you. Also pin validation during the setup is better now

💥 2.0.0 - BREACKING NEWS! Now all the board can be setupped by the browser. Dome I/O and Switch setting is now editable from the browser and you can save the confi files. Before update write in a memo all your setting.

What's new in version 3.0.0?

Auto Close Dome if anyone is talking with the board (browser or ascom alpacha driver) it's ok Switch, Cover Calbirator, and Dome are modular now. If you don't use you can comment the respective row at the beginning of the main.cpp:

#define DOME #define SWITCH #define COVERC

You don't use the dome? \\#define DOME #define SWITCH #define COVERC

What's new in version 2.0.0?

Web pages run now alpine.js and all the js under the hood is rewrited in a modern way. Now Dome and switch are in the same page, olso settings now are in the same page! New dome function: Auto Close if anyone is talking with the board (browser or ascom alpacha driver) [IS UNDER DEVELOPMENT], you can enable or disable this featur by browser setup page.

ToDo List:

Knowed browser bugs:

html_pages directory

This folder contain a vite project with web browser pages, in this way I can have a clean and powerfull css by Taliwind 3.

How to use

First time board installation

First of all we need to install Visual Studio Code and add Platformio extension.

Download Visual Studio Code from: https://code.visualstudio.com/

Install it.

One installation is finish, Go to Extension and search Platformio, then install it.

platformio

And wait until restart vs code is needed:

restartvscode

At this point, download the software from this page, go up click on Code and click on Download Zip

image

Extact the folder where you want, BE CAREFUL, don't extract the files inside the folder! extract directly the folder!

Go to VsCode and click on the Platformio Icon, click on Pick a Folder and select the extracted folder

image

At this point wait platformio will download all the necessary things needed to make the board work:

image

Once is finish on the right you will have this menu:

image

Click build and wait until you will not have this message:

image

Now we are ready to upload the firmware!

If it is your first time connecting an esp32 to the pc you need to install serial driver depending on your bard serial chip:

CH340 driver: https://learn.sparkfun.com/tutorials/how-to-install-ch340-drivers/all (download at the buttom of the page) CP210x driver: https://www.silabs.com/developers/usb-to-uart-bridge-vcp-drivers?tab=downloads

(check the video on the CH340 page to see wich COM port is used by your device)

Connect your esp32 board to a usb port On the menu we seen before we need to click:

Upload Filesystem Image

image

After some while the board will rebot.

Now we need to click on Upload

image

Wait for success printed out.

Connect the board to your own wifi

If is your first time setup, you need to connct the board to your wifi, don't check into the code, the board will manage everything for you! Open your WiFi and you will have TeslaBoard wifi, connect to him

image

Open a brwoser and type http://192.168.4.1, once the portal is ready click on Configure Wifi image

Click on your WiFi, type the password and click on save image

In few seconds the board will be up and running, go to your route setting and check the board IP. From this moment, the board will try yo connect everytime to your wifi without asking nothing.

Using the board with Ascom driver.

First of all we need to install the last Ascom platform (version 6 or higher) from here: https://ascom-standards.org/Downloads/Index.htm

Not every software as ex. NINA, open the Ascom Device Selector, and the board cannot be founded, in this case we need to crate a new ascom dynamic driver:

Open ASCOM Diagnostic: image

Click on Choose Device>Choose device to connect: image

Select the device type: image

This operation is needed for each device Dome,Switch,Cover Calibrator (you can skip the device you are not planning to use.

Click on Alpaca and then Enable Discovery

image

Once is green, open the list and you will see New Device:

image

Open the setting menu, and check the Manage conncetion as well:

image

Click OK and then OK again.

The board is ready to use! Go to your software (in my case N.I.N.A) and the device will appear:

image

Board web server

To acces to the Board page, type on your browser the IP of the board.

Home Page

image

Dome Section

image

From here we can see the state of our Dome cover and you can send Open Close or Halt commands.

Switch Section

image

From here you can see the state of the switches and command it, for Input switch you cannot send any commands. For Output you can set ON/OFF state For PWM Output you can slide to the desired value.

Setup Page

Dome Section

image

Pin Start is the pin used to give the start to the motor Pin Halt is used to stop the motor

Pin Shutter Open should be ON when the shutter is Open Pin Shutter Close should be ON when the shutter is Closed

The board does not allow having both inputs active.

Enable closing in case of missing connection - If selected the shutter will be closed in ascom don't talk with the board within xxx minutes (computer crash safety) not developed yet

Save you store the configuration on the board Download Configurazione - you can download the Dome configuration for backup.

Switch Section

image

Here you can setup all the Pin you want to use (MAX 16)

You can give a name and a description (max lenght 32)

You can choose the type of the switch (Input, Output, PWM or analog input)

According to the esp32 datashet be sure of wich pin you want to use or you can you can run into problems, any valditation rules are developed for the moment! Read this article: https://randomnerdtutorials.com/esp32-pinout-reference-gpios/ If you need a PCB you can use a mine one: https://github.com/StefanoTesla/esp32-kraken as you can see the pin signed with S are Safe to use, and with the I the Imput only pin. From pin 16 to 33 are safe to use, pin 34 35 36 and 39 are input only. Don't set pin from 6 to 11, you will brick the board! All the PWN singals are automatically setted up with a range from 0 to 8192.

Save to store modification. **If you change the pin number or type, it will not work until a board reboot.++

Save config file to have a configuration backup

Update the firmware in the future

Only if you have download the firmware from the usb port, you are able to upload the firmware via wifi

To do this from your browser you can go on http://your.ip.add.ress/update

image

You can choose if you want to upload a new firmware or filesystem, the difference is: firmware change only the software, filesystem write webpages and configuration files.

Use a backup of your configuration files

From setup page download each configuration files. Go to the project folder and open the folder data

image

Paste here your configuration files and override the existing one.

Upload the firmware via OTA

Open the project with platformio and click in the right menu on build

Now open your browser and go to http://your.ip.add.ress/update choose firmware image

And select the file firmware.bin that you can find in yourProjectFolder/.pio/build/esp32doit-devkit-v1 image

Upload the filesystem via OTA

Read "Use of a backup of your configuration files

Open the project with platformio and click in the right menu on Build Filesystem Image

Now open your browser and go to http://your.ip.add.ress/update choose filesystem

image

And select the file spiffs.bin file that you can find in yourProjectFolder/.pio/build/esp32doit-devkit-v1

image