Jump to content
Welcome to Backyard Astronomy Space - please register to gain access to all of our features. Click here for more details. ×
SmallWorldsForum Microscopy and macro photography - a companion forum to BYA ×

Running the IOptron iMate as a client from a home Wi-Fi network


William Shaw

Recommended Posts

EXPERIMENTAL CODE – SET UP AT OWN RISK ONLY FROM A WIRED ETHERNET CONNECTION

 

WARNING: do not attempt this unless you are comfortable undertaking linux command-line work, and only try setting it up with an ethernet connection to the iMate. Do NOT put any of this stuff into anything run automatically at boot up, at least for now. It takes down the standard iMate networking so if anything has gone wrong you will be bricked if you have disabled normal access at boot ime. I also do not recommend this route unless you have some linux/unix experience, and be comfortable with getting root access, changing permissions with chmod, and running a text editor. I did this set up from a wired ethernet connection for safety and you should do the same.

 

For those of you who just want to take pictures this might seem like a total PITA. I won’t argue with that. For now it is a bit user-hostile, though once set up, typing one short command will make the switch once you have done stuff that needs the default hotspot mode. I will run the ipolarserv app in hotspot mode before switching to my home wi-fi. I’m hoping that IOptron update their tools with a simple switcher like there is (allegedly) on the new Stellarmate Pro or I am used to doing on my Gaius-S under Windows. This is just me hacking around getting something working that I have found worked. So in using the wpa_supplicant tools I am kinda working on a different path from the IOptron networking. This means I am not integrating well, but on the other hand not doing anything (?!) to mess up the standard installed stuff, so you can always reboot into the normal hotspot or ethernet. (so yet again, do not set up any of this to run automatically on start-up!

 

** I am very happy to receive criticism of all kinds for this! If someone one who knows rather more about Debian-flavour linux can do better, especially in terms of smooth DHCP and in particular reverting back to Wi-Fi Server aka Local Hotspot mode, I am all ears. A nice GUI app would be good. 

 

You might be happy with the iMate hotspot or the ethernet connection. In my case I recently boosted my home network to allow me to use devices far into my garden and control them from anywhere in my home. So while the iMate hotspot is certainly strong enough for me to work inside in the room nearest the mount when it is just outside on my drive, with it set in client mode I can now have the mount, and me plus iPad/laptop pretty much anywhere outside and inside respectively. These ideas are all based on the following web site for managing wi-fi under Debian. To be honest this linuxbabe page is most of what you need, but I had “fun” trying to find the commands and getting it to work in the UK, so there are adaptations, and I’ve just listed the key steps. There are also some comments you might like to read before trying it out. I need to look into the iwd route mentioned by “George”. 

 

https://www.linuxbabe.com/debian/connect-to-wi-fi-from-terminal-on-debian-wpa-supplicant

 

Preamble: This stuff is all run from a linux terminal, which you can bring up on the iMate by right clicking on the screen on the background. The iMate appears to have been set up with the keyboard mapping by default as US based and (I think) a Windows PC keyboard. So for me in the UK, in order to avoid typing gibberish with special characters, I run setxkbmap gb before doing anything from a terminal. I am also writing this note on a Mac so have also run 

setxkbmap -model macintosh but you might not need that. Get the keyboard choice sorted out so you can type a ~ and a | without colourful language. You might need do some looking around here – see the general iMate guide I made in BYA for tips on localisation for your client device. It is not managed by NoMachine. 

 

Also be prepared to get yourself root access privileges. I think I needed to do that to edit and save the wpa_supplicant.conf file. Changing permissions may be needed too so be prepared to run chmod. 

 

So here we go. Make sure you are running with a wired ethernet connection before commencing the set up. Do not remove it until the instruction to do so! Stuff you need to type is in red. 

 

1.    Get your wifi adapter name (unlike the instructions the path to /sbin/ seems to be needed to get then to work), so run:    /sbin/iwconfig

2.    It’s probably wlan0, which is what my iMate called its wifi interface. Adapt what follows if not.

3.    Have a look to see what it can see:  sudo iwlist wlan0 scan | grep ESSID   and you should be able to see your local networks (sudo will ask for your standard imate password, which I have left as “imate” again. 

4.    Check wpa_supplicant is present by running the install command: sudo apt install wpasupplicant (I think it was there already but was not taking notes properly at first run!)

5.    Next you need to create a file wpa_supplicant.conf using the wpa_passphrase utility. It will be made in the directory /etc/wpa_supplicant/ and you will likely need to edit it after creating it if you are not in the US (go figure). So having got “your-ESSID” which is the name of your wi-fi,  and “your-wifi-passphrase” which is its password, you need to run the following:

6.    wpa_passphrase your-ESSID your-wifi-passphrase | sudo tee -a /etc/wpa_supplicant/wpa_supplicant.conf

7.    Localisation weirdness here - Edit that newly created .conf file to put (e.g. I am in UK) country=gb if you are not in US, before the stuff about the SSID and password. Note: you do need to run a text editor – I used vim, and I think I applied chmod +777 to it so I could do what I want with the file. So this is what my wpa_supplicant.conf file looks like (using cat to show a short text file), with my own details replaced by gibberish.

 

 

imate@iMate:/etc/wpa_supplicant$ cat wpa_supplicant.conf

 

country=gb

 

network={

            ssid="Gigaclear_999"

            #psk="il0veas1air"

            psk=ch9e8rndc8vdodvvb0319f3c0745ac9053e2c05b5885ee204811d69

}

 

 

8.    To then bring up the client wi-fi and take down the iMate wifi server, run

 

sudo wpa_supplicant -B -c /etc/wpa_supplicant/wpa_supplicant.conf -i wlan0

 

 

Now run 

 

sudo dhclient wlan0 

 

to set up DHCP over wi-fi. NoMachine will die but you should be able to restart it as you are still connected by ethernet. Run /sbin/iwconfig to see that wlan0 is talking to your wi-fi. 

 

NOW AND ONLY NOW disconnect the ethernet cable from the iMate. This is a good time to panic as NoMachine this time will die and not restart so easily. It will see the iMate just fine but then when you tried to reconnect it will likely give you a spinning wheel of doom.  <INSERT COLOURFUL LANGUAGE HERE AS PROXY FOR MY THOUGHTS IN RECENT DAYS> I think the issue here is that NoMachine has done something like cache the previous IP address allocated under the ethernet connection, and now it has a new one and you need to get it to use it. So having just selected the iMate, click on Edit and select a new one that has appeared from the drop down menu. I think in my house the DHCP server just gives out a different IP to the iMate over wi-fi as it does over ethernet, so this messed with my brain.  “OMG What did I do??!!” It’s actually an obvious thing to happen once you know about it. Running ip address before and after you’ve done all this lot might help. One time I connected via the IP6 data before I realised what had happened. At the time of writing what is being cached and when is still a little unclear, but I have attached a screen shot to show where to look to find the new address. It also helps to turn off the NetworkManager with sudo systemctl stop NetworkManager 

 

If the iMate does not work as a Wi_Fi client reboot the iMate and try to figure it out. That's a bit vague but re-reading the linuxbabe page might help. So many opportunities for typoes...

 

 

If it does work you can go to:

 

Streamlining turning on the wi-fi client mode

 

Once all that lot is sorted out you just need to run 

 

sudo wpa_supplicant -B -c /etc/wpa_supplicant/wpa_supplicant.conf -i wlan0

 

sudo dhclient wlan0 

 

sudo systemctl stop NetworkManager

 

 

to make the switch, and of course you can put those in a file with a name like wificlient.sh and just run that. Do NOT make this part of any script you make to autorun at start, as otherwise you will disable the iMate default connectivity and be stuck if something goes wrong. I have that in my desktop and after running chmod +xxx run it from there with 

 

./wificlient.sh

 

You can then quit the NoMachine link and reconnect over wi-fi. Once you have checked this transfer works from ethernet to client wi-fi, you can try switching from wi-fi hotspot mode directly. 

 

A further reminder for DHCP if you are switching between these access modes. NoMachine might need to be reminded to look for any one of three addresses: (examples 2 and 3 are for my home network – adjust accordingly). See the picture attached which shows what comes up if you select the iMate then edit the connection. 

 

1.     172.24.1.1 if you are in Hotspot mode

2.     192.168.1.235 on my home network on wi-fi

3.     192.268.1.85 on my home network on ethernet

 

 

For now, for coming back to hotspot mode I need to reboot the iMate but making that easier is another project. As is making this all nicer and being able to connect to a new network without all the faff. To be continued…

Image 02-02-2024 at 12.00.jpg

Edited by William Shaw
typo fixes
  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...