Maslow Home Maslow Community Garden Newsletter

WebControl Setup on Raspberry Pi

To set up your RPI, you have 2 options for the basic OS called Raspian:

Raspian Lite (current version is Buster)

or

Raspian (current version is Buster)

the first option is a stripped down version that does not have the ability to display graphics. It is a command line interface (CLI) with just the cursor and looks like a terminal window. The second is the full desktop and if you have a touchscreen this would be the option.

(Assumption: you have imaged and set up the rpi on your local network and have both internet access and ssh access or keyboard access to it to type in commands. Internet searching can get you imaged and set up to this point, but here is a list of items to be completed in that process:

image
copy “ssh” file to folder on flash drive from imaging computer - a blank file just so ssh will be enabled
copy network file -
make a text file called wpa_supplicant.conf. in it put your network ssid in the “” and your network passkey in the appropriate quotes:

trl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=US
network={
ssid=""
psk=""
key_mgmt=WPA-PSK
}
(should look like this, but formatting doesn’t carry over:

)

$ sudo raspi-config
Network options -> set pi name
Localization options -> set keyboard layout to 104
_________________-> set time zone to US central
_________________-> set locale to en-us UTF8
________________ -> set wifi country (you may have to reboot to do this)
$ reboot
…!!..make sure if you change the password over ssh, you have set the keyboard to local otherwise if you use any special characters, a regular usb keyboard will input a different password because the default is an international UK keyboard and some character maps are different…!!..
change the default password
$ passwd
update the repository links
$ sudo apt-get update
upgrade the distribution kernel
$ sudo apt-get upgrade
and now you are set and ready to go.
)

In either case of distribution option, open a terminal window if you are on the desktop version or simply type in the command line the commands below or right click in putty to paste (don’t type the "$ ". It represents a command line command : EDIT -> the $ show up in the preview on the right when I make the post, but once it saves, some of them get stripped out. no idea why):

$ cd ~
$ mkdir webcontrol
$ cd webcontrol
$ wget https://github.com/madgrizzle/WebControl/releases/download/v0.927/webcontrol-0.927-rpi-singledirectory.tar.gz
$ tar -zxvf webcontrol-0.927-rpi-singledirectory.tar.gz

(927 is the version as of today. Verify the newest version here). Run the program:

$ cd webcontrol
$ ./webcontrol

If you want to run it in the background and have the ability to type in other commands on the same ssh window, then you can use this command instead:

$ ./webcontrol &
disown %1

is supposed to stop the terminal messages, but it doesn’t on my screen. and if you use the &, you have to run htop and scroll down the the webcontrol line and press F9 and 9 to kill the program.

You need to connect to the maslow via USB in the Settings -> Maslow Settings menu and select the correct serial port for your Maslow:

once you are certain it functions and you want it to run whenever the rpi is on, you can make it run automatically as a service

$ sudo nano /etc/systemd/system/Maslow.service

You can name it whatever you want. Maslow.service, webcontrol.service… totally your call.

paste this in that file and adjust the Description, working directory, ExecStart if necessary:

[Unit]
Description=webcontrol
After=network.target
[Service]
ExecStart=/home/pi/webcontrol/webcontrol
WorkingDirectory=/home/pi/webcontrol
StandardOutput=inherit
StandardError=inherit
Restart=never
User=pi
[Install]
WantedBy=multi-user.target

then exit and save with CTRL+X, Y, Enter
to start it, type

$ sudo systemctl start Maslow

if it works, then enable it and it will start automatically when you reboot.

$ sudo systemctl enable Maslow

if you change the “Restart = never” line to “restart=always” then it will try to restart whenever it crashes, but it won’t allow itself to shut down when you click on the upgrade link. you will have to manually stop it.

Once you have the server side running, if you are on command line, you are done for now. To open the web browser on your desktop version, use your mouse to open the webpage and use “http://localhost:5000” as the web page address and you should be able to interact with it.

Type $ ifconfig in a terminal window, you can get your IP address and use that on your phone with :5000 at the end and control Maslow from your phone via webcontrol. Do the same on your design computer (whatever the type) and you can upload gcode to it. Import your groundcontrol.ini file using the actions->import button in webcontrol, to avoid recalibrating.

Another nice option is if you set up /home/pi/.WebControl/gcode as a shared SAMBA folder (instructions here), and give that folder permissions, you can open the folder from your design computer and drag and drop your gcode in without uploading via the web page. This is not entirely necessary, but I find it easy to do. More recently, when I generate gcode, I have it save there directly so no copying or uploading is required.

(author note: this is a wiki entry. if you have additions, please edit this directly rather than comment. at request, this was put in wiki, but I realize this is scattered in various other posts on the forum and in the wiki.)

3 Likes