×

INDI Library v1.9.9 Released (30 Nov 2022)

Bi-monthly INDI Library released with new drivers and bug fixes.

Wifi control of 12v relay switch for ad-hoc devices

  • Posts: 148
  • Thank you received: 10
I have main mirror cooling fans, anti-dew heater bands and a camera that all require a 12 volt supply that has to be switched manually.  It would be great if Indi supported wifi enabled devices that were small simple switches (typically 12 volts up to 4 amps).  I have a Skywatcher EQ8-R Pro mount which has a convenient usb hub on the dec axis with internal wiring to the base.  This hub can be powered by a separate 12 volt supply with outlets at the telescope and helps to eliminate trailing wires.  I find I need to fix small switches to side of tube so I can turn devices on and off (although the crude way is just to pull the jack plug out) .  If these switches could be controlled across the wifi this would not require any additional cabling and control could be done through Kstars and/or included in macros.  Is there any industry standard and SDK for controlling wifi enabled devices.  "Alexa turn my dew heaters on" 
10 months 6 days ago #80110

Please Log in or Create an account to join the conversation.

  • Posts: 269
  • Thank you received: 53
One way is to use Astroberry on a RPi as it has a relay driver the uses the GPIO pins. There is also the indi-rpi-gpio driver which is similar and also allow PWM on the GPIO pins and can be installed on other RPI systems like StellarMate. The RPi can be controlled via Wifi.
I'm sure there are a multitude of "standards" for wifi enabled devices. As we used to say "the great thing about standards is there are so many to choose from!". As long as there is an API for the device then a driver could be written but the RPi approach can drive conventional relays and the drivers are already there.
-- Ken
RPi3 Ubuntu Server 20.04, Windows 10 AMD64, AAEON UP Core Ubuntu Desktop 20.04
Avalon M-Uno, EQ6 Pro, Atik420, ASI1600MM-C, ASI120MM-S, DBK21AU04, ZWO EFW, Optec TCFSi
Vixen R150S, GSO RC8, ST80
10 months 6 days ago #80113

Please Log in or Create an account to join the conversation.

  • Posts: 148
  • Thank you received: 10
Hi Ken.  Yes I could use the GPIO on my Pi to turn power on and off to the device mounted on the telescope but to avoid trailing wires and the power limitations on my EQ8 auxiliary output (4A) needs a bit of thought.  The switch controlled by GPIO would need its' own power supply for items like anti-dew band heaters as it needs to be at 12 volts at about 1 amp.   Having said that the PI USB provides power for my ZWO guide and imaging cameras (but not cooling).  Currently the PI sits under the mount with 3 switched power supplies for the Pi, mount motors and the auxiliary power feeding the 3 outlets on the USB hub built into the Dec head of the mount.  I could move the PI and fix it to the Dec head but that would mean taking some of the auxiliary power (with a 12v to 5v converter) leaving approximately 2A for the dew heaters, main mirror cooling fans and imagining camera cooler. Not enough.   This leads me to keeping the PI under the mount on the pier with wifi controlled relay switches on the Dec head so I have the full 4A available from the auxiliary power. Wifi control avoids trailing wires. I haven't investigated much but for a few pounds I can by WIFI relay switches aimed at home automation like Alexa or Google home. The plan would be to write a driver but not found source software yet?   
Sorry to blabber on but your suggestion of using existing Astroberry or Indi relay drivers might be the way to go if I can use the Auxiliary I/O RJ connections on the mount and connect these to the relay switch at the Dec head and driven by the GPIO at the pier end.  There are 3. RJ10, RJ12 and RJ45 with 0.5A max per pin sufficient to operate the relay I would hope and this would avoid trailing wires.  Further investigation needed as I haven't spotted an interface Tab in EKOS to control relays?
10 months 6 days ago #80137

Please Log in or Create an account to join the conversation.

  • Posts: 148
  • Thank you received: 10
Found the Astroberry Relays under Others for Aux! I can see how to control from the Indi control panel but haven't spotted where to find the switch (AUX1) in Ekos.
10 months 6 days ago #80139

Please Log in or Create an account to join the conversation.

  • Posts: 269
  • Thank you received: 53
You need to use the INDI control panel as there is no relevant EKOS module.
If you use the home automation switches be sure to check they can work with DC. I was looking into a DIY solution for my observatory and the solid state relays I could find dont switch DC, only AC. These devices have a built-in web server which is easy to interface to but may use different command sets which means different drivers. You could instead use something like a eddicated Pi Zero to control all the relays you need. That could run the relevant INDI drivers and nothing else. There may even be a pre-built setup of this type somewhere on the webs. I could certainly find Arduino style solutions quite readily and regular Raspberry Pi relay hats.

Edit: Here you go: raspberry.piaustralia.com.au/products/re...ay-board-for-pi-zero
-- Ken
RPi3 Ubuntu Server 20.04, Windows 10 AMD64, AAEON UP Core Ubuntu Desktop 20.04
Avalon M-Uno, EQ6 Pro, Atik420, ASI1600MM-C, ASI120MM-S, DBK21AU04, ZWO EFW, Optec TCFSi
Vixen R150S, GSO RC8, ST80
Last edit: 10 months 6 days ago by Ken Self. Reason: More info
10 months 6 days ago #80147

Please Log in or Create an account to join the conversation.

  • Posts: 148
  • Thank you received: 10
Hi Ken. Thanks for info. I have connected GPIO 5 and ground to a breadboard with a LED and resistor and tested indi relay 1 just to observe the driver working. All good. The 4 relay board you suggest looks the ticket. I could plug this to my Pi 4 or get a pi zero as you suggest. If I adopt the former I could use the auxiliary i/o on the EQ8-R mount. The relay board would be mounted on the telescope and connected via serial cable just acting as 5 conductors for GPIO 31,33,35,37 and gnd to the Pi 4 on the pier . In this way I can turn things on and off from a single instance of Ekos. Everything in one place. I suppose the danger is a short or something occurring with the serial/mount internal cabling. The latter solution using a raspberry Pi zero means I would be running 2 astroberry devices independently in two browser windows. Do I make sense?
10 months 5 days ago #80148

Please Log in or Create an account to join the conversation.

  • Posts: 269
  • Thank you received: 53
Hi David,
The way to run multiple Indi servers is to chain them together which is exactly what I do. I have my x64 device (an Aaeon UP Core) on the dovetail to control EFW, Cameras and focuser. A RPi2 is on the RA axis and controls the mount. Both run INDI with drivers relevant to their tasks. Note: The RPi2 runs without a GUI so it doesn't have much to do except run INDI server. The primary INDI server is on the Aaeon and I chain the RPi2 INDI server using INDI web manager remote driver option which in my case is "Avalon StarGo"@10.42.0.1 (the Pi2 runs a wifi hotspot so my Aaeon has 2 wifi devices: one to connect to the RPi2 and one for the main connection to the rest of the world)
I run Ekos on a third Windows machine and simply connect to the primary INDI server on the x64. It forwards all comms to/from the RPi2 so it looks like the RPi2 drivers are on the Aaeon. So from the main computer everything is in one place.
The only "downside" is that all work on the RPi2 is through the command line via SSH from the Aaeon.
-- Ken
RPi3 Ubuntu Server 20.04, Windows 10 AMD64, AAEON UP Core Ubuntu Desktop 20.04
Avalon M-Uno, EQ6 Pro, Atik420, ASI1600MM-C, ASI120MM-S, DBK21AU04, ZWO EFW, Optec TCFSi
Vixen R150S, GSO RC8, ST80
10 months 5 days ago #80152

Please Log in or Create an account to join the conversation.

  • Posts: 148
  • Thank you received: 10
Blimey that's more complicated than my set up. I have a windows PC in my study and in the edge browser connect to astroberry.local which is a Pi4 device on the pier in the observatory. I have hard wired a Lan cable from my router to the Pi (actually it goes through a switch on the pier so I can connect my laptop if I need to from the observatory) I don't use wifi although it does reach the observatory. I hit the connect button and log in with a password then run kstars and select Ekos and run things from there.
The Pi4 fits neatly in a space under EQR-8 mount. To keep it tidy and avoid snagging trailing wires I use the mount USB hub to connect to the cameras, focuser and filter wheel and supply power. This means connected to the single Pi4 I have a USB3 cable from the base of the mount and 2 usb2 cables from the mount control board and dome drive.

I am still trying to work out why Kstars crashes quite often. I can reproduce the error sometimes and then not which is annoying. I have turned verbose logging on for most things and I can't find anything in the log that helps to identify the problem. All I know at the moment is that it seems to be related to imaging with the main ZWO camera often when or after plate solving. It can also just crash when starting Ekos for the first time but second attempt after re-starting indi server it usually starts. It doesn't crash when I don't connect the two serial devices, the mount and dome but then I can only test imaging as aligning is unavailable without the mount connected. I have done 2 or 3 imaging sequences over several hours without a problem it's just the messing about at the start when setting up aligning and focussing that I get the crashes.

Is there any reason why you use the Avalon board instead of a Pi4? What OS is installed?
10 months 6 days ago #80165

Please Log in or Create an account to join the conversation.

  • Posts: 269
  • Thank you received: 53
Yes my rig sounds complicated but it really isn't too bad. There was a lot of trial and error to work around shortcomings with the Pi and the mount wifi. But this setup is close to the philosophy of INDI and IoT where the idea is lots of low power computers embedded in devices and networked together. The nice thing about this is that if you need to reboot one computer the rest keep running.
The Aaeon is a x64 board. At the time I got it the best Pi option was the Pi3. Some drivers would not run on ARM devices, the Pi OS was a bit flakey and it did not have a USB3. The Aaeon has USB3 and runs 64bit Ubuntu (up to 20.04 now). Unlike the Pi it does not mind being powered down unexpectedly and does not stop responding randomly after an hour or two of operation. Never had any problem getting drivers for it. Plus it has 64Gb eMMC storage so I save images to that and it is basically instantaneous vs several seconds download over wifi. Also, it has a wifi antenna port so I can connect an external antenna. The Pi wifi is rubbish due to the internl antenna. The only reason I use a Pi instead of the Avalon mount's internal wifi is that the Avalon wifi is even worse! I'm considering changing the Pi for a low powered Aaeon due to the hangups. But in the meantime I've installed the hardware watchdog on it and so far it has not hung up since then, touch wood.
BTW I am thinking of also installing a Pi for relay control. One issue I get sometimes with the Aaeon is the ASI1600MM not being found. It seems to be a timing issue and I've found a time delay relay delaying power up to the Aaeon solves it. Having a bit more control would be nice. Unfortunately the Pi Zero W is currently unavailable here. Also note that you need the Pi Zero v2 (the one with an ARMv7 CPU) to install Ubunt. I think I'll go with a Pi 3 Model A+ which is a stripped down Pi and has the same form factor as the Aaeon and only draws about 4W under load, a bit over 1W idle. There is a 3 relay hat with the same form factor.
I used to have KStars crashes quite often but the latest release seems to be more stable. It will still crash if one of the INDI drivers crashes. One solution I found is to run KStars from within WSL (Windows Subsystem for Linux). This works well if you have Windows 11, not so well with Windows 10 or lower. It seems more stable and you can also run Ekosdebugger within the Linux environment for better debugging.
-- Ken
RPi3 Ubuntu Server 20.04, Windows 10 AMD64, AAEON UP Core Ubuntu Desktop 20.04
Avalon M-Uno, EQ6 Pro, Atik420, ASI1600MM-C, ASI120MM-S, DBK21AU04, ZWO EFW, Optec TCFSi
Vixen R150S, GSO RC8, ST80
10 months 5 days ago #80177

Please Log in or Create an account to join the conversation.

  • Posts: 148
  • Thank you received: 10
I bought a Labists Pi4 kit. It comes with a nice box and cooling fans with a power supply and 64Gb card and it works fine. I don't like using wifi for the main control box so coonect it directly to my home lan with a armoured cat 5 cable run underground from house to observatory.
10 months 5 days ago #80187

Please Log in or Create an account to join the conversation.

Time to create page: 1.382 seconds