Propeller Code for Arlobot (PropWare Version)

While a lot of the fun stuff with the robot happens on the Ubuntu laptop with ROS, the motor control and sensor polling is all done on a Parallax Propeller microcontroller.

I like to think of the laptop as the cerebral cortex of the robot’s brain and the Propeller board as the Cerebellum.

The code for the Propeller is all written in C. I have set it up so that it will refuse to run into things even if ROS tells it to, and if it gets much too close to an object it will actually back away. This way it is safe to experiment with ROS without worrying too much about crashing into walls. You can also gently “push” the robot out of your way by just getting close to it and it will move away if it can. (Yes, you can “herd” your robot!) Obviously you still need to be careful, especially if you tell it to drive around extremely fast, because you can drive into a wall faster than the sensors are able to register it.

Here are the steps to get the C code that I use with my Arlobot ROS package onto your robot’s Propeller board using the Ubuntu laptop you should have connected to it.

Follow all of these steps from your Ubuntu laptop. Because the laptop must be connected to the Propeller board via USB at all times for ROS to operate, it is natural to update the code on the Propeller board from the laptop when needed.

The only thing you need to do now is run the script to automatically install the required code to your Propeller Activity Board.

Everything below is useful information, but if the script above worked, you can stop reading this page now and move on to testing your robot with and then use the Web Interface to run the robot.

0. PropWare Background Information

You can skip step 0 if you like, and come back if you need more information. Everything here is background information, not things you need to do.

Parallax used to support Linux, but they have not maintained their Linux support for some years now. If you follow any Linux links on their site you will find a dead end of old broken code.

If you want to use Windows and SimpleIDE, you can follow the old Propeller Code for Arlobot (SimpleIDE Version) instructions. Otherwise we will use a third party system called “PropWare” to install the code to our Propeller Board from Linux.

Please note that this is all background information. The installation of PropWare was done via the noetic-setup script already.

Now you can work through the steps here to prove that it works and learn how to make new projects:
They really do work. 😉
The TL;DR: is:

  1. cd to the folder with your code.
  2. Make a CMakeList.txt file
  3. mkdir bin; cd bin
  4. and then every time you want to test your build:
    rm -rf *;cmake -G "Unix Makefiles" ..;make debug

This site will give some clues about translating settings from .side files to CMakeList.txt, such as memory model and board type:

The various make directives decide where to send the code (RAM or EEPROM) and what to do after sending it:

  • run: Load the executable to EEPROM and execute the code.
  • run-ram: Load the executable to HUB RAM and execute the code.
  • run-sd-loader: Load the executable to SD card, and execute the code.
  • run-sd-cache: Load the executable to SD card, use it as a cache, and execute the code
  • debug: Load the executable to HUB RAM, execute the code, and open an interactive serial terminal
  • debug-eeprom: Load the executable to EEPROM, execute the code, and open an interactive serial terminal
  • debug-sd-loader: Load the executable to SD card, execute the code, and open an interactive serial terminal
  • debug-sd-cache: Load the executable to SD card, use it as a cache, execute the code, and open an interactive serial terminal
  • gdb: Load the executable to HUB RAM and start GDB

make – build without attempting to load it anywhere (No Propeller board)
make debug – load to Propeller board, but do NOT overwrite EEPROM (for testing)
make run – load it to EEPROM for permanent use

1. Add your user to the “dialout” group
Otherwise you will not have access to /dev/ttyUSB0

sudo adduser [your_user_name] dialout
sudo adduser chrisl8 dialout

And then you will have to reboot to make this work.
NOTE: The setup-noetic script probably did this for you.

2. Edit the Propeller C Code for Arlobot to fit your setup.
In whatever editor open up ~/.arlobot/per_robot_settings_for_propeller_c_code.h
Now at the top there is an entire section of “#define” statements.
You need to comment out some for items you don’t have, and you need to adjust the numbers after others to indicate things like how many PING sensors you have and where they are located.
By doing this, the code will be compiled to only include the parts you need and with setting specific to your robot.

3. Load Propeller C Code for Arlobot on to Propeller board.
The way the Propeller controller works is that if you load a program into “EEPROM” it will stay there and start any time the board is reset or power cycled. This means once the code is there you don’t have to mess with it again unless you want to change something.

Plug the USB cable into the Activity Board and Ubuntu Laptop.

cd ~/catkin_ws/src/ArloBot/PropellerCodeForArloBot/ROSInterfaceForArloBot/
mkdir bin
cd bin
rm -rf *
cmake -G "Unix Makefiles" ..
make run # Remember, make run installs it to EEPROM

The board should load the code and reset.

If you get any of the “#define” settings wrong the first time, this could be one reason to reload it.

9. Testing.
A good way to test your Propeller code is to run:

cd ~/catkin_ws/src/ArloBot/scripts/

It will start a test engine for testing everything about your robot before trying to run ROS.

Test all output, and attempt sending twist commands directly.
Until this works, do not expect ROS to work.

All done!

Remember, this is open source, so feel free to fix mistakes and make changes to the code and tell me about them! Better yet, fork the code and send me pull requests!
Next read over, or try scripts from ~/catkin_ws/src/ArloBot/scripts/ and anything else from ROS that you want to try!

Finally don’t forget the web interface to your robot!

P.S. Prevent Propeller Board from running on USB Power 
You may want to do this if you ONLY want the the Propeller Board to run from DC power and not the USB device.

ROS Noetic Setup

In the last article I explained how to set up an Ubuntu laptop for use by ROS. Here I’m posting my notes about how to get ROS Noetic up and running on that laptop.

There is now a script to install everything.
Just run:

bash <(wget -qO- --no-cache

and you are done!

To update your code just run the same script again and it will pull down and compile anything new without erasing custom settings.

Next we’ll want set up Propeller Code for Arlobot

Laptop Setup for ROS Noetic

Part of the ArloBot setup is to have a laptop riding on board the robot to run ROS. This article is a quick set of instructions for setting up that Laptop.

My Laptop:
I am currently using a beat-up Dell XPS 15 9530 that my brother-in-law took to the desert and back. It has a nice fast CPU and lots of memory although the battery life isn’t great.
I previously used a well loved HP EliteBook 2760p from Ebay.

Ubuntu 20.04 Desktop 64 bit:
ROS Noetic is built for Ubuntu LTS 20.04 Desktop. It is the “Long Term Support” (LTS) version, so you can download and use it for several years without having to upgrade to the next version. This gives the ROS development community some stability in their target OS.

You can also use one of the Ubuntu derivatives such as Lubuntu or Xubuntu if you are highly familiar with them, as long as they use the same package repository as Ubuntu.

Just remember that it must be an Ubuntu Desktop variant of version 20.04 LTS (the .01, .02, .03 on the end is fine). Other Linux distributions will not work, nor will newer versions of Ubuntu.

Download Ubuntu Desktop 20.04 LTS 64bit ISO (ubuntu-20.04.1-desktop-amd64.iso) from
My laptop has no DVD drive, so I have to use a USB “flash drive” to install.

If you are on Windows, use the instructions here to create a bootable USB flash drive if you need to:
If you are on Linux, I like to use to put the ISO onto my USB flash drive.

In the BIOS I suggest that you:
* Turn off Secure Boot
* Turn off “Fast Boot”
* Enable USB boot if it isn’t already to get it to show up in the boot options.

I recommend that you do NOT plug the laptop into Ethernet during install. This way the Ubuntu setup will ask you to configure WiFi during setup, proving it works and getting it preconfigured during install.

Boot from the USB stick or DVD you created with the Ubuntu (or Lubuntu, Xbuntu, etc.) ISO.

Install Ubuntu

Connect to WiFi

Minimal installation – We don’t need Libreoffice, and anything we do need, we can add later.

CHECK: Download updates while installing Ubuntu

I like to CHECK: Install third-party drivers. You don’t have to, but know that my install is using them, so if you run into strange WiFi or Video issues, this could be the cause if you didn’t include 3rd party drivers.


Pick your Installation Type:
Really, anything here will work. You can dual boot with Windows or another Ubuntu version, or erase the disk.
Personally I always pick the “Erase disk and install Ubuntu” option because nothing else runs on the system I use for my robot.

If you are asked about encryption or LVM:
I recommend not using encryption,
and you do not need LVM either.

Continue or Install Now

Pick your time zone.

Your Name: Chris L8 (replace with the name you want)
Your computer’s name: ArloBot (Or pick something else)
Pick a username: chrisl8 (Replace with the user ID you want for Ubuntu)
CHECK: Log in automatically – I prefer this, but you don’t have to.


Once you boot into the Ubuntu Desktop:

On first boot a window will come up asking for some options.
I do not set up “Live Update”, nor do I have my install send data to Canonical. Basically set up as little as possible.

Shortly after the first boot the Software Updater will ask to install updates. Go ahead and install all updates and reboot if asked to. It isn’t required, but saves time later and sometimes trying to update everything at the same time as installing ROS causes issues.

After your first set of updates and reboots:

Once Ubuntu starts click on the “Show Applications” button in the bottom left and type “terminal” and run Terminal:

Right click on the icon on the left and select “Add to Favorites” to keep it there for easy use in the future.

You can also drag it up higher on the dock after you lock it,

and you can right click it and run a “New Terminal” when you need another one.

Install the SSH server:

sudo apt install openssh-server

Now you can use ssh from Linux or PuTTY where you can cut/paste.
If you are not familiar with how to use SSH to connect to Linux machines, search the Internet for “ssh putty tutorial”. I thought this one looked pretty good: SSH Tutorial for Windows

Enable Remote Control of GUI Desktop:
The entire idea of a robot is to be remote, so it will help a lot to be able to control it from your desktop.
VNC works well. If your normal computer is running Windows use TightVNC.
If you are on Ubuntu you can use Remmina. Click on the “Search Desktop” button, type “remmina”.

Install VINO for remote desktop on the robot:

sudo apt install vino

VNC Setup on Ubuntu:
From “Show Applications” type “settings” to search for it.
Find and click on “Settings”
Find and click on “Sharing” on the left.
If the switch in the upper right is OFF turn it ON.
Select “Screen Sharing”.
(IF “Screen Sharing” doesn’t exist on the screen, open a terminal window and run “sudo apt install vino” and then try again)
Turn it on and set a password.
The official instructions are here:

Customize Ubuntu Desktop:
These are all a matter of personal preference, but I find this to be the best way to set things up for myself.

Blank Screen: 1 minute (or set as you like)
Automatic suspend: Off (or set as you like)
Suspend when inactive for: Don’t Suspend     Don’t suspend
When power is critically low: Power off
When the lid is closed: Do Nothing     Do nothing
Connectivity: Checking: Off
Location Services: Off
File History & Trash: Turn everything OFF
Screen Lock:
Blank Screen Delay: (This is the same setting as the one above in Power)
Automatic Screen Lock: Off
Lock Screen on Suspend: Off
Show Notifications on Lock Screen: Off
Diagnostics: Never
Search: Off

Byobu: (I use tmux myself, but if you are new to Linux, this is a good option)
When you run ROS nodes on the laptop via SSH they will be in your session. If your session disconnects it will stop ROS.

To allow your session to continue in the case of an accidental or even purposeful disconnect you can use a program called tmux (or screen) that lets you leave running “sessions” open. byobu is a front end to tmux that makes it pretty and easier to use.

sudo apt install byobu

byobu-enable This will cause byobu to automaticlaly start when you connect via SSH.

Log off and back on,
The first time you press ctrl-a it will ask if you want this to go to work with Emacs or Screen, pick Screen.
F1, Toggle Status, add/remove what you want. I like to add the battery level.

Disable lid close detection: If you want to run your laptop on the robot with the lid closed, you may need to do this, because when you reboot or try to shut down while the lid is closed and the laptop is on battery power, as soon as XWindows shuts down the computer goes to sleep before it even shuts down!
This leaves the laptop in a limbo where it sleeps until the battery dies with no hope of connecting to it until you open the lid and let it finish shutting down!
I found two solutions. I am using the first option, which works for me, but if Option 1 doesn’t work try Option 2.
Option 1. Set “IgnoreLid=true” in /etc/UPower/UPower.conf
sudo vi /etc/UPower/UPower.conf

Option 2. Set LidSwitchIgnoreInhibited=no and HandleLidSwitch=ignore in /etc/systemd/logind.conf:
sudo vi /etc/systemd/logind.conf
Reboot to make these changes take affect.

Next you will want to do the ROS Noetic Setup