Jump to content

Taking my printer on the road...


Penatr8tor

Recommended Posts

So I want to take my printer on the road. I'm going to visit my family over the holidays and I want to take my RatRig V-Minion and a couple spools of filament along. My Dad gets to hear all of my stories and has a few prints I sent him but since he's 94 with no computer or smartphone knowledge...He doesn't get to see the printer printing. So I figured, How cool would it be to spend a couple, few hours with him showing him how the printer works in real time. I'll have access to WIFI where I'm going but I need some kind of script or something that would let me change the wifi on my Pi3A.

Is there a way to do this or am I stuck having to SSH in and do it manually? Or worse, open it up and edit the SD card.

Link to comment
Share on other sites

1 hour ago, Penatr8tor said:

I understand where you're going with this but my advice is don't. This is not about ease it's about preparation. I get the feeling you don't really want to waste time cursing, swearing and generally farting around when you're at your dad's, just distracts from the experience that is the wonders of 3D priting 😁 . You want something that you know works. Manually editing the wpa_supplicant file works.

I'll make a (dangerous?) assumption that you know your dad's SSID and passphrase. Just before you go, set your local WIFI details to your dad's get your PI reliably connecting connecting to that so when you go it just works. (oh and don't forget to switch back, otherwise the family moans). Even if you had a spare WIFI doo-dah that would make it even less disruptive locally (everyone's got spare neworking equipment!?!?)

It's a bit clunky but it'll work and be rock-solid. Unless you're going to be routinely translocating your printers I would suggest the time/effort is not worth it vs a reliable approach.

Link to comment
Share on other sites

1 hour ago, atrushing said:

I don't know enough to help with a WiFi script, but maybe it would be easier to connect an Ethernet cable and run it wired. Then you won't need to change it back to your WiFi either.

On the faff vs reliability factor this is workable (assuming you have an Ethernet port on your controlling device, there a USB to RJ45 to a generally useful device). All you need is a cross-over RJ45 cable. The most you then need to do is to manually assign IP addresses on both ends (again klunky but workable and avoids having to temporaily change your SSID) and can be tested ahead of time.

Link to comment
Share on other sites

Since I often have to change WIfi when I sell a printer, I have been there, first warning, older things dont work anymore with the new security in place since 6 months or so.

Manual works fine, you can change it on your wifi directly from Putty, check it well, save and turn of your printer, wait till you are in range of the new wifi and turn it on again.

Second option, put your SD card in a computer, create the file and save, put it back in the printer and boot, easy as pie.

Change three things in the conf file 1. country code 2. wifi name 3. wifi password

For both options you have to:

Place it in the right temporary folder and the run command to move it with sudo rights to the boot folder.

You should be able to ADD the second Wifi, so it chooses the network whatever is in range, havent tested this yet.

Config should be something like this i guess:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
ap_scan=1

country=NL # Netherlands

# WPA/WPA2 secured
network={
		scan_ssid=1 # Used to find hidden SSID's
        ssid="WiFiHome"
        psk="homepassword"
        proto=RSN
        key_mgmt=WPA-PSK
        pairwise=CCMP
        auth_alg=OPEN
}
network={
		scan_ssid=1 # Used to find hidden SSID's
        ssid="WiFiWork"
        psk="workpassword"
        proto=RSN
        key_mgmt=WPA-PSK
        pairwise=CCMP
        auth_alg=OPEN
}
# place this file in home/pi and go there with putty and execute:
# sudo cp -v wpa_supplicant.conf /boot/

 

How to change Wifi.txt wpa_supplicant.conf

  • Like 2
Link to comment
Share on other sites

Every day is a school day, perhaps I was too quick to go for a "basic is best" approach. I just veriied your @Buurman suggestion of a second WIFI entry - I know it works in general as I roam about on my laptop but it's more about ease of editing files and I've never roamed with my PI's.

However, I just created an additional WIFI SSID (pitest) on my internal networrk and confirmed that adding the additional network definition/stanza works: Here is my wpa_supplicant.conf file from the raspberry pi for my new V0:

 

country=GB
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
ap_scan=1

update_config=1
network={
        ssid="sixthst-wrong"
        psk=XXXXXXXXXXXXXXXXXXXXXX
}

network={
        ssid="pitest"
        psk="chunkymonkey"
}

Couple of things to point out:

  • I tested it (by creating a new SSID) and I simply renamed the existing SSID to stop the PI from connecting to it. That's good enough, the PI would not see the "wrong" SSID and save me knocking everything else off the network (by actively killing the proper SSID).
     
  • My network definitions are a lot shorter (basically the SSID and PSK) so I'm leaving the WPA stuff on the PI to do all the security negotiation stuff. Back to Buuman's earlier observation about security protocols (my kit is regularly updated). Guess the quesiton is, when you've been out to Dad's in the past has the WIFI presented a problem (e.g. is it notoriously ropey)?
     
  • I also just directly edited the file "/etc/wpa_supplicant/wpa_supplicant.conf" on the PI as root so basically a "sudo vi /etc/wpa_supplicant/wpa_supplicant.conf". NB: I like VI, just use your favorite text editor. Next time I rebooted the PI the new settings took effect.

    Creating the wpa_supplicant.conf file in the /boot directory works as well, all that happens is when LINUX boots it just copies the file from the /boot directory to the /etc/wpa_supplicant directory. You could check this process ahead of time by creating the new /boot file and then making sure it was copied to /etc/.....

    Directly editing the wpa_supplicant file means you only need to add the minimal ("network={....}" ) stanza to your file rather than create an entirely new wpa_supplicant file (or go to the hassle of copying the existing file from /etc back  into /boot). That is only my personal preference, more than one ways to skin a cat.

 

 

Probably best still to have a plan-B, all depends on how comfortable you are fixing on the fly and the level of supporting stuff that you have at Dad's. If there's no spare monitor/keyboard to plug into a "dead" PI then it's pretty faffy (not impossible). Granted I'd go OTT and have cabling and spare network switch along with my linux laptop........unless I know there was already some spare network ports on site...

  • Like 2
Link to comment
Share on other sites

I'll jump on the bandwagon with @Buurman and @smirk. Editing the wpa_supplicant file ahead of time I think would be easiest and that's the route I think I would have gone.

Getting the printer up and running quickly so you can show it off and amaze your dad is the priority. It's fun watching people's reactions seeing a 3D printer actually working and making something out of that roll of plastic spaghetti.

  • Like 1
Link to comment
Share on other sites

3 minutes ago, claudermilk said:

I'll jump on the bandwagon with @Buurman and @smirk. Editing the wpa_supplicant file ahead of time I think would be easiest and that's the route I think I would have gone.

Getting the printer up and running quickly so you can show it off and amaze your dad is the priority. It's fun watching people's reactions seeing a 3D printer actually working and making something out of that roll of plastic spaghetti.

Agree, This is what I'll do. I can try it out using my neighbors wifi as a test. 

  • Like 1
Link to comment
Share on other sites

5 hours ago, smirk said:

That's actually a very good point! How old is dad's wifi!

I'm going to use my sisters wifi, hers is new enough. I believe hers is Comcast and was installed a couple years ago. As for Dad... I'll take him to see the printer as Sis's house which is where I'll be staying anyway. My Dad has wifi but it's his neighbors wifi, the neighbor is an IT specialist and lets him use it so that we kids have some internet to help them with insurance and other internet stuff while we're there.

I'm going to try both the @Buurman and @smirk methods this week using my extra pi4b I have. I'll let you know how it works.

Thanks everyone!

Link to comment
Share on other sites

Ah, its not the WIFI version what I ment, its the klipper OS version, they changed something so you can just go in and edit the wifi config file anymore, but you have to place this file in the boot and reboot to make it effective, and it gets deleted after.

I asume all wifi networks are WPA2, otherwise, buy a new wifi, its not secure and hacked within an hour, these days.

Link to comment
Share on other sites

Ah, I spend inordinate amount of time (at work) dealing with things that have stopped working properly cause x,y and z havre been deprecated.....I sometimes forget that the rest of the world isn't an outdated pigs-ear of a steaming pile of festering excrement......

8 minutes ago, Buurman said:

I asume all wifi networks are WPA2, otherwise, buy a new wifi, its not secure and hacked within an hour, these days.

but I don't think we would be surprised - there's people still on dial-up out there....

11 minutes ago, Buurman said:

they changed something so you can just go in and edit the wifi config file anymore

Out of interest how were you editing the wifi config (wpa_supplicant.conf) file previously? I had no trouble editing my one directly (and it's a brand spanky new install....well regularly updated install since I've been building the V0 for about 8 months).

Link to comment
Share on other sites

3 minutes ago, smirk said:

well regularly updated install since I've been building the V0 for about 8 months

Muahahahaha!! 

I dont know when they changed this exactly, but I dont think you may update your OS, just the mainsail?

Anyway, you cannot update the file directly anymore, its not there anymore, thats the whole idea of higher security, it was a bit of a "hole".

So now you need to place a new file in boot, and after boot it gets read, configured, and then deleted. its stored somewhere encrypted now.

Link to comment
Share on other sites

25 minutes ago, Buurman said:

I dont know when they changed this exactly, but I dont think you may update your OS, just the mainsail?

 

Please I work in IT! Hang on we're some of the worst, but nope the OS is regularly updated. That's weird, I'll need to do some research, as I say no issue for me. I should say that the SSID and PSK entered as part of the build are encrypted. My test only showed the PSK ("chunkymonkey") unencrypted as I had manually entered it and was too lazy to run wpa_passphrase.

However, that's probably a good (and secure) point to make. The command, to generate a secure wpa_supplicant.conf stanza would be:

pi@voronpi2:~ $ wpa_passphrase wifi-ssid "my secret wifi passphrase"
network={
	ssid="wifi-ssid"
	#psk="my secret wifi passphrase"
	psk=ee49e58ba214e5f763769afb474ddbe0a6de232f9734332b78c3fcb632cf4f5c
}
pi@voronpi2:~ $ 

Naturally, replacde "wifi-ssid" with the actual correct wifi SSID and the pass phrase (in this case "my secret wifi passphrase") only needs double quotes around it as it has spaces in it (stops the command interpreter getting confused and misreading the number of parameters being passed into the command).

ALSO don't forget to remove the commented out passphrase in the clear!!!

Then copy and paste the stanza into your existing /etc/wpa_supplicant/wpa_supplicant.conf file

 

Link to comment
Share on other sites

Aha! I noticed something interesting. Thanks to the fact I was using a colour bash session. In reality the /etc/wpa_supplicant/wpa_supplicant.conf file is actually a symlink to a file in the /boot directory:

pi@voronpi2:~ $ ls -l /etc/wpa_supplicant/wpa_supplicant.conf 
lrwxrwxrwx 1 root root 35 Jan 31  2022 /etc/wpa_supplicant/wpa_supplicant.conf -> /boot/mainsailos-wpa-supplicant.txt

I would not say that's for security purposes as the "/boot/mainsailos-wpa-supplicant.txt"  is world readable.

I suspect it will have been done for the typical nerdy, geeky IT "I know let's do this ridiculously complex de-facto standard ruinination technique. It's cool I saw it on Stackoverflow" reason and also for no other reason than they can.

 

Link to comment
Share on other sites

1 hour ago, smirk said:

The command, to generate a secure wpa_supplicant.conf stanza would be:

pi@voronpi2:~ $ wpa_passphrase wifi-ssid "my secret wifi passphrase"
network={
	ssid="wifi-ssid"
	#psk="my secret wifi passphrase"
	psk=ee49e58ba214e5f763769afb474ddbe0a6de232f9734332b78c3fcb632cf4f5c
}
pi@voronpi2:~ $ 

Naturally, replace "wifi-ssid" with the actual correct wifi SSID and the pass phrase (in this case "my secret wifi passphrase") only needs double quotes around it as it has spaces in it (stops the command interpreter getting confused and misreading the number of parameters being passed into the command).

ALSO don't forget to remove the commented out passphrase in the clear!!!

Then copy and paste the stanza into your existing /etc/wpa_supplicant/wpa_supplicant.conf file

OK so this will sound dumb. You say "The command, to generate a secure wpa_supplicant.conf stanza would be:" Where do I type in this command exactly? From the command line when I'm logged into my pi with putty?... or is this a command that gets appended to a config file somewhere, is there some folder I need to be in? Do I need to use nano to edit this file?

I'm great at following precise instructions... assumptions on your part like, "he knows what I mean" will result in me asking more dumb questions.

  • Haha 1
Link to comment
Share on other sites

2 hours ago, Penatr8tor said:

I'm great at following precise instructions... assumptions on your part like, "he knows what I mean" will result in me asking more dumb questions.

No such thing as a dumb question, and you are quite right that I should not presume.

You are correct, the wpa_passphrase command would be run from the PI when you are logged in (using PuTTY).  I try whereever possible to use "live" data and captures in those code blocks. So the previous wpa_passphrase example is just copied and pasted from my terminal (logged into my PI) so it is verbatim. I never like trying to rely purely on memory when giving advice and examples of commands. Sadly I have not figured out how to put colour into the code block to easily differentiate between what I typed (wpa_passphrase wifi-ssid "my secret wifi passphrase") and what the computer said.

Absolutely you can use nano to edit the wpa_supplicant file. I am presuming that there is a "/etc/wpa_supplicant/wpa_supplicant.conf" (and that it is really a link to the file in the /boot folder that Buurman refences). Easy enough to check,  and not a major issue if there's not one in /etc and doesn't matter a hoot if there is one and it's a link.

The one thing I would say is since the wpa_supplicant.conf file (whereever it lives e.g. /boot or /etc/wpa_supplicant/) is a system file  it is only writable by the root user. In that case you would need to prefix you "nano" command with the command "sudo" e.g. "sudo nano /etc/wpa_supplicant/wpa_supplicant.conf". The sudo command prompts you for your regular login password and once it's verified you are who you are it will actually run whatever command (that followed the "sudo" command) as the root user. Basically it's a *nix hack to get around the fact that there is really only one privileged user on a unix system.

Link to comment
Share on other sites

 

 

The easy way to configure the WiFi, in my opinion. I use a Raspi imager which allows for this to happen when writing the image to the SD card - much easier than editing the file in an editor.

https://www.raspberrypi.com/software/

Use other specific-purpose OS:

image.thumb.png.74a00845df43735a3e422f3e701ef41b.png

 

Then choose 3d Printing

image.thumb.png.e4d9333bfbb614fd25b89f0c134a083c.png

 

Mainsail OS:

image.thumb.png.07b8c707ac93ac461d5e7326165a9509.png

 

 

image.thumb.png.f644da138810010f4300ad5d4c46fd46.png

 

Choose storage

image.png.6913a120d4ab8ede1b76faec5e28b447.png

image.thumb.png.5cc7063f18e295c526085fddf4169e35.png

Then before choosing Write

image.thumb.png.d6c2e78e921b8011c725cbb495eed5c0.png

 

Click on the gear icon:

image.png.8886d01c6fbdb2b052538ad08a102a89.png

Now the main happens:

image.thumb.png.f8b934e6ff2f0865db6332be5d99c43d.png

Obviously click yes and fill in the parameters: (Tick all the boxes you want the OS to pre-configure.)

image.thumb.png.f0b083b3770c56aa9368f12993c17e75.png

For wireless settings:

image.thumb.png.df0718f047d90b66e907dfeaf3e5e1cb.png

Once you happy, click save and then write the image.

And Wha-lha - all done without much effort at all. (Only issue may be that it is configured for mainsail, but you can always change that through kiauh and install fluid.

image.png

Link to comment
Share on other sites

Yes, That's how I flashed my 2.4 and also my Switchwire pi's. Thank you, appreciate your effort BTW. I was thinking of doing what you're saying however... I don't want to start over from scratch, I just want to change to another wifi for a bit then switch back to my home wifi. My problem is that I'm not too familiar with the pi's command line commands and syntax and help with that is hugely valuable to me while I try to make sense of as much as I can.

I'm hoping I can plug in the printer at my sisters house and connect with my laptop. If I can do that... I'm golden. I have ~50 g-code files that can be printed on the pi already. What I really need is a screen that I can plug in to my V-Minion with klipperscreen. Then I don't think I need to be on wifi at all. Hmmmmm

I happen to have this 6" AMOLED hanging out... Maybe... Just Maybe...

1574974037_20221031_1724201.thumb.jpg.4f640ce5809471f1fae0f741e3b3d2b9.jpg

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...