Maslow Home Maslow Community Garden Newsletter

Raspberry Pi and WebControl setup for complete beginners

I wanted to do a write-up of my experiance with setting up WebControl since it involved a lot of learning and “first-time” experiances for me. I followed MadGrizzle’s instructions to get set up (along with a lot of help in a private message) but I added my own bits of info for anyone with less skill than myself. Grizzle made all the steps and I added things after the dash

“1. MadGrizzle is the man” (I borrowed these steps)

-My notes (I added this stuff for other beginners like myself)

PREFACE:
-If you’re like me, you know what raspberry pi is and have always wanted to try it out. I never had a specific project I needed one for until the Maslow. I got a 3B+ from adafruit. I was able to 3D print a case for myself. If you don’t have a printer, I’d recommend buying a case and also a good power supply. I found this one one Amazon for a decent price. I would NOT recommend just finding any old micro usb phone charger you have laying around. You also need a micro SD card with at least 8GB of storage (for full raspbian install, more on that later). I’ve had luck with SanDisk brand and try to stick with them (although a good friend of mine just told me that many fake SD branded cards are out there). I’ve used older, 8GB cards and brand-new 16GB with good results. I get mine on Amazon. You will also need a USB-A to USB-B cable. You only need a very short cable unless you plan on having the Rpi some distance from the Arduino. If you don’t have a spare one laying around from an old printer or other device, here’s one on Amazon. You can also find all of this on Adafruit.

-I did all of this with the Rpi 3+ hooked up to a monitor with HDMI and also using a wireless mouse/keyboard combo with a USB dongle. I recommend getting this set up before you do your first boot so you can have full control of the Rpi.

START HERE:
Step 1: Download and install PiBakery from:

pibakery.org

-This file is HUGE, give it some time.

Do NOT download PiBakery V2

Step 2: Download this recipe from the webcontrol github repo:

https://raw.githubusercontent.com/madgrizzle/WebControl/master/webcontrol-us-recipe.xml

If you right-click the link, it gives you the option to “save link as…” to save the file to your computer… If you click the link, you’ll get a page of raw of XML, but you can then right click on the page and select “save as…” to save it.

Step 3: Startup PiBakery. I think it downloads stuff for a while when it starts…

Step 4: Import the webcontrol-us-recipe.xml file.

-this is the file you saved back in Step 2.

Step 5: Go to this portion of the recipe and enter in your WiFi’s network SSID, password, etc.

-SSID and password are the name of your WiFi and the password to connect to it as if you are connecting a laptop, phone, or nintendo switch. This is not the password to your router, a password you might need later.

Change the WPA/WPA2 if you are using something insecure and adjust the country code if you aren’t in the U.S.

Step 6: Click ‘Write’ to write the prebuilt image to the RPI.

-You will have the option of raspbian full, raspbian lite, or both. I picked full and it works great. Plus, you will have a raspbian desktop to monkey around with for other stuff that you might want to try with Maslow/webcontrol. Just know that doing too much on the RPI itself while doing a cut may slow down the ability of webcontrol to feed gcode to the controller and respond to user input.

After done, you should be able to insert the SD card into the RPI, boot it, wait a minute or two (has to download and install webcontrol) and then access it from the RPI’s IP address, port 5000.

-to find the Rpi’s IP address you can do it one of two ways:

5A. Log into the admin panel of your router and find a tab called “connected devices” (may vary from brand to brand). You should see a device named “webcontrol” with an IP address. Mine was 192.168.1.6 which is a variation of my main IP address. If you don’t know how to do this, you should take a few minutes and google how to access your router, it’s a very useful thing to know how to do.

5B. If logging into your router is beyond you, you can get the IP from the raspberry pi side in raspbian. You need to open a prompt and type in sudo ip addr show and hit enter. Then, look for Wlan and the number. It will look like this: 192.168.1.8/24 (but a custom number for your rpi). Let’s just say yours is the number I just listed. In step 6, you will need to type this in but drop the /24 part and add the 5000 port.

-From my example above: 192.168.1.8:5000 from the remote computer you are trying to access from. Make sure to swap in the webcontrol IP you found on your router or in raspbian after running the “sudo ip addr show” command. Leave the tab open for now.

-The Rpi boots up when you plug it into micro USB power and it detects a micro SD card with a bootable image. It takes two or three seconds and then you will see a flashing green light next to the red power on light. You should see streaming lines of text as it boots up. There will be a grey dialog box that runs before you arrive at the full raspbian desktop.

-go to the main menu (looks like a raspberry)>system tools> task manager in raspbian and look for webcontrol to be running as one of the threads.

-From my example above: 192.168.1.8:5000 from the remote computer you are trying to access from. Type it directly into the search or address bar in internet explorer, chrome, or firefox. Don’t let auto suggest or autocomplete finish the text for you. Make sure to swap in the webcontrol address you found on your router or in raspbian after running the “sudo ip addr show” command. If you use the example one I put in, it likely won’t work. This should pull up webcontrol. Leave this tab open for now.

-Now that you have webcontrol up on your main computer, go into maslow settings and look at the ports settings. Take a screenshot or write down what is showing there. These will be the ports to NOT use later once you hook the Rpi to the Arduino.

-Optional step: get VNC viewer up and running from your main computer to the Rpi so you can have remote control of it, it might come in handy later. I’m planning on adding a webcam soon so I’m glad I added this for easy setup, should I need it.

-Use the main menu and power down the Rpi, don’t just unplug it like I was doing! Bad.

-Leave the micro SD card in and remove the HDMi cable and wireless mouse/keyboard dongle. Go out to the maslow and hook the USB-A to USB-B cable up to the arduino from one of the Rpi’s 4 USB ports. Run the power supply to the Rpi and plug it in. Watch for the green lights, one on the Rpi as I described earlier and also one on the Arduino that will light up when it is connected to the Rpi. They should both light up in about 5 seconds, the Rpi first and then the Arduino shortly afterwards. If you did something wrong along the way, one or both of these lights will not come on and you maybe have to go back and start at step 3, compiling raspbian with webcontrol.

-Go back to your main computer, the one you used to access the rpi before moving it to the Maslow. If you left the tab open to the webcontrol IP address, the tab might just refresh and webcontrol will be up again. If not, refresh the tab or make sure you typed the IP address correctly and added the right port.

-You should now see a new port under maslow options:

ttyACM0. If it’s not already selected, pick this port and hit accept. If everything is working correctly, you will get three green boxes at the top right of the window, above the manual move controls.

-You might run into trouble getting the Rpi/Arduino to talk to the motors and make them move. I had to restart my whole setup twice before I finally got webcontrol to connect and also send commands properly. Remember that it’s better to power down the Rpi from the menu (here’s where remote control is super handy) vs a hard shut down by unplugging. You can also try to shut it down from webcontrol using Actions->Shutdown. I also recommend allowing the Arduino to power up first, then power up the Rpi and let it boot for a full minute or so, and then connect the USB cable. This seemed to be the magic sequence for me.

5 Likes