Motor Power Up Order

So you got your robot built, installed everything, and the calibration worked, but now that you actually want to run the robot it does nothing.

The first thing is to turn it on and go use the `~/catkin_ws/src/Metatron/scripts/` script along with the recommended commands from `~/catkin_ws/src/Metatron/scripts/direct2PropSerialTestLines.txt` to observe and test how everything works without ROS.
However, most people seem to either be doing this already, or be well past it, because you guys are really smart! 🙂

There is a hidden problem though. It is discussed in the calibration instructions, so I was assuming everyone knew about it, but I now realize it isn’t well explained.

Three separate people have contacted me with this issue, so I want to post it here on the blog.
The motor controllers have a strange quirk. Their “normal” mode does not work with the Propeller board! However, within the first few seconds after turning them on they listen for a certain kind of signal. If they get it, they flip to a mode that does work with the Propeller.

What does this mean? If you turn on the motors, then start everything up, the robot won’t do anything.

The solution: You have to wait until the Propeller board is fully running, after the first arlo_drive command has been sent to turn on the motors.
If you have PING sensors installed, you can know when it is time to turn the motors on by when the PING sensors start flashing.
The main thing is just to make sure the Propeller board is “initialized” before you turn on the motors. That means after the ROS arlobot program is already started, or after you sent the “i   0” to it via the `` command.

Another solution? Get a USB Controlled Relay and wire it between the motor outputs on the Arlo Power Distribution board and the motor controllers. This way the code will actually turn on the motors at the right time. This is how mine is set up, and why I forget about this problem.

Kernel 3.13.0-65 may break Serial connections!

Yesterday, after updating to the linux-image-3.13.0-65-generic 3.13.0-65 Kernel on Lubuntu 14.04.3 LTS using the normal Ubuntu update/upgrade two different programs that rely on PySerial quit working. and my ROS (Robot Operating System) based Python node quit working.


$ /dev/ttyUSB0 115200
--- Miniterm on /dev/ttyUSB0: 115200,8,N,1 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---

--- exit ---
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python2.7/", line 810, in __bootstrap_inner
  File "/usr/lib/python2.7/", line 763, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/bin/", line 220, in reader
    data = character(
  File "/usr/lib/python2.7/dist-packages/serial/", line 460, in read
    raise SerialException('device reports readiness to read but returned no data (device disconnected?)')
SerialException: device reports readiness to read but returned no data (device disconnected?)

To resolve your issue temporarily reboot, and at the “GNU GRUB” menu select “Advanced options for Ubuntu” and then move down to select the Ubuntu, with Linux 3.13.0-63-generic kernel option. (NOT the recovery mode one) and it should boot into the old kernel and work fine again.Reverting to the 3.13.0-63 kernel allows and other Python Serial based programs to work normally.

To fix the issue permanently: Remove the new kernel with:

sudo apt-get remove linux-image-3.13.0-65-generic

and reboot,
which will remove the new kernel and remove it from GRUB.

There is a bug report open for this:
I also opened my own, but it is probably a duplicate of the above

Hopefully the next kernel patch won’t break it again.

Where am I?

Someone asked where I’ve been. What have TwoFlower and I been doing?

I have been quiet here because the robot has gone from a fever of building to slow steady background work.
My focus right now is to build an internal “behavior” system using Behavior3JS to allow the robot to “act” more independently.

The first goal is simply to have it intelligently go from “power on” to freely moving about the room. This may sound simple, but there are a lot of start-up tasks that need to be coded properly so that things are safe and sane.
Then the robot needs to know where he is,
load a map for that room,
know where he is in that room if point 0 on the map doesn’t happen to be it,
know if any doors in the room are open which might lead to dangerous stairs,
and unplug himself.

My github repo kind of shows my work days and progress, but I realize it is also cluttered because I commit too often.

So here is a brief timeline of what I’ve been laboring away at:

June 16th – This is when I built the web based control panel that runs both on board and can be remotely accessed. This lets me control important parameters of the robot remotely and get him started remotely without having to run lots of scripts:

June 17th – I built a setup script to allow you to install everything from one command. This is documented on the front of my Arlobot repository now in the readme.

July 2nd – I added roslibjs to my Node based control panel so that ROS functions can be directly polled and controlled.

July 5th – I added the ability to set “waypoints” using the web interface. This means you can drive the robot to a position on the map, set a waypoint, and then in the future you can tell it to go to that waypoint again and it will return to the same spot on the map.
Now places like “Kitchen” and “LivingRoom” can easily be set and recalled.

July 7th – Added QR code reading. Now the robot can use a QR code taped to the wall to determine what room it is in as soon as it is started and automatically load the correct map for the room without any human intervention.

August 17th – Added the function for the robot to use a waypoint called “initial”, if found for the map, to set its initial “2D pose estimate” so if your normal starting point isn’t the same as point 0 on the map, the robot can automatically localize itself on startup.

Somewhere in there I also tweaked the “stop if a door is open” code and I installed a Moteino based door monitor on my basement door to alert the robot.moteino

Next I am working on the self unplugging routine. This isn’t super fancy. I just anchor the cord to the wall and have the robot back up, but once this works the robot can start up and go without human interaction!

So that is what I’ve been doing! 🙂

It excites me a lot when someone reaches out and asks what I’m up to and why no recent posts. So thank you!

Install Script!

There is now a script to install everything.
First install Ubuntu.

Then just run this script:

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.

After that you'll just need to edit the config files as noted by the script,
and then set up your Propeller Code for Arlobot.

As always, please let me know if you find any problems!


I’ve been working in a dev branch of my Arlobot code for a long time now, and today I marged it into Master so there is a lot of new code there.
Hopefully it all works, but obviously I am the only one who tests it before you do.

A few of changes are:
1. I made a bunch of changes to the C code that runs on the Propeller Activity Board to try to make it more generic. You will have to answer a bunch of questions and comment out a bunch of #define lines to “customize” it for your setup, but hopefully it will be easy to do.
2. The automatic explore function should be functional now.
3. I’ve added some more smarts to the script to make it more robust and give myself more ability to adjsut settings while the robot is running.
4. I added my code to make use of an XV11 “Neato” vacuum cleaner scanner that I bought.

At this point I’m also working a lot in my Metatron package to createa a nice GUI for interacting with the robot’s functions.

My next step once this is working will be to create a new setup routine that includes installing both the ArloBot and Metatron packages and bringing up the entire package.
It should work as either a monolithic “application” with a GUI or as a nifty set of convenience scripts along with access to all of the basic ROS functions that you can use on a TurtleBot. Whichever you prefer.

So head over to and check out the commit history to see what is new and give the new code a spin if you are brave!
Or wait a week or two to see if anyone else discovers a major bug! 🙂

Wiring Photos

Please see this Parallax forum post for a good diagram of how to wire the HB-25’s, motors and encoders:

It is worth looking at the ActivityBot setup too: which explains the server connections, which are also used for the motor controllers, and the use of pull-up resistors.

Also this thread has some good information on the the “ActivityBot”code that I use to control the motors:!

TODO: Write up a full wiring description with diagrams of every component . . .

The rest is just a collection of high resolution photos of the robot’s wiring. I hope these may help others imagine how to wire their ArloBot!

Click on each image for a full resolution version. Download them as you see fit and if you build a wiring diagram of your own please let me link to it! Or I can host it of course if you want.


















Prevent Propeller Activity Board from running on USB Power

If you have an Arlo Power Distribution Board, and you frequently leave your Activity Board plugged into a notebook computer when you turn off the Arlo Power Distribution Board, you may have noticed that the Activity Board stays on.
Furthermore, anything connected to the 5 volt supply on the Arlo Power Distribution Board stays on also.
The Activity Board is getting power from the USB port on the computer, and then it is passing this 5 volts on to other devices via the barrel connector.

Parallax has kindly provided instructions on how to prevent the Activity Board from drawing any power from the USB Port:

I performed both steps 7 and 8 to ensure that mine would not run from USB power under any circumstances, because I never want it to do that on my robot.

Now your Activity Board will turn off when you turn off the Arlo Power Distribution Board and everything else will shut off too!

This also opens up the possibility to power cycle the Activity Board with the USB Relay Board. I have not done this yet, because I knew it was pointless as long as the Activity Board would continue to draw power from the USB port. I might try it now though, because sometimes I think a power cycle would be the most reliable way to force a reset on the Activity Board. All it would take is running the 6.5 volt wire through one of the relays before going to the Activity Board.

Use a Raspberry Pi and Asterisk to turn an old Alarm System into a Home Monitor

If you have an old alarm system that is capable of calling a remote monitoring station, and you want to just turn it into a fancy “chime” instead that can notify your phone.
Please note that this is not reliable enough to be considered a “security” system. But if you don’t even use your alarm system anymore, or quit paying for the monitoring service, this will add some fun features!

The orginal source for the Raspberry Pi intall of Asterisk is here:

Here is how I connected it all to my old alarm system.

First, you need an alarm system.
I have an old GE Interlogix Simon 3 Wireless Security System, so these instructions work for this model.
In theory this will work with any alarm system that can dial out to a monitoring station via plain old telephone lines.
The secret sauce is in a file called app_alarmreceiver.c You may have to replace and/or edit and recompile this file to get it to work with your particular system.
I will cover that later.

Second, you need either a dedicated Linux computer to run Asterisk, or a Virtual Machine running Asterisk 24×7,
or a Raspberry Pi B or better! You do not need the latest model, just make sure it has 512 MB of memory and it will work.

Third, you need an “ATA”. An ATA is a box with phone jacks and an Ethernet connection. It allows you to plug a normal phone into it and receive dial tone, accept touch tones and send them over TCP/IP to anywhere in the world.
I am using the Grandstream GS-HT702 Handytone 2-FXS Port Analog Telephone Adapter from Amazon, so if you want one that is tested for this, use that.
You do not need two phone jacks though, so you could use a cheaper single jack model. I got the two jack model so that I could experiment with other uses on the second line.

Note that I will not be covering any setup of external VoIP providers or anything here, but in theory you can do all kinds of things with this box once it is done.

Install PBX In A Flash:
Download incrediblepi-3.6.tar.gz from
NOTE: Watch the versions! I am still on version 3.6!
Version 3.7 *MIGHT* work, but I am sure nothing newer will!
The 3.11.x versions use Asterisk 11 and those did not work for me. Only try them if you are interested in experimenting, otherwise stick with 3.6.

Extract the files (I used the 7zip 64 bit install on my Windows box)
Use win32 Disk Imager to write the image to the SD card
Put the SD into my Raspberry Pi, plug in TV, and Ethernet and power and watch it boot up!
The Pi should read its IP address out loud if you have speakers or headphones plugged into it!

NOTE: When I say “ssh” you can use PuTTY if you are on Windows.

ssh root@ip-address-of-your-pi

Password: raspberry

Hit Enter to let it start downloading updates.

Set new root password!

Set Timezone (America, Chicago) or whatever yours is.

(should show nothing to update, since it just did this on login)


This will give you lots of fun options, use this anytime, but now is best for some things.

Select: “expand_rootfs”
Then go to “Finish” when it is done, and tell it “Yes” to reboot.

ssh root@ip-address-of-your-pi
ctrl-cl to skip updates

# For some reason the install doesn’t include vi!
apt-get update
# This only updates the local package index, it doesn’t change anything, so “update” is safe.
# Without it you get errors about not finding stuff because it has been moved around
apt-get install vim

vi /etc/profile.d/
# So it doesn’t ask you to update on every login!
echo “/usr/local/sbin/status”
# So it doesn’t run this and clog up logins

IP & Hostname:
IF you want to set up a static IP on the Raspberry PI do this.
Your ATA will need to talk to the Pi, so it is good if the IP does not change, although it can use a hostname.
Also, using Google’s DNS servers works well for me.

I’m using here, but use an address that works on your network!

vi /etc/network/interfaces
iface eth0 inet dhcp
iface eth0 inet static
Set IP to in Router’s Static config.

To change the hostname to “Pi” run:
hostname Pi

vi /etc/hosts
# replace all instances of incrediblepbx with Pi
vi /etc/hostname
# Replace incrediblepbx with Pi
shutdown -r now

Open up iptables for SSH from outside:
add this line to /etc/network/iptables and reboot:
iptables -A INPUT -p tcp -m multiport –dports 22 -j ACCEPT
Run this to list active entries:
iptables –list

Put (or whatever IP you chose) in your web browser and click on FreePBX Administration

Username: admin Password: admin

1. Changing FreePBX admin Password and Default Email.
From the main FreePBX GUI,
click Admin => Administrators.
Click on admin user in the far-right column.
Enter a new Password and click Submit Changes button.
Then click the Apply Config button.
Next, set your default email address at the bottom of Settings -> General Settings.
Repeat the procedure above to save your entry.

Set up 701 for use with ATA
secret: 13n38j (You may want to set your own, just keep it consistent!)
dtmfmode: In band audio
allow: ulaw
apply config

Set up your ATA:
The HT702 manual is here:

Hook it up to the network, power and plug in a phone.
pick up the handset and dial ***
then dial 02
It should announce its IP address.

Enter it into a web browser.
The default password is “admin” for admin use.

First thing is to get the latest firmware!

Download latest firmware from

NOTE: I am on firmware version I have found that sometimesa version does not work, so once you get it working, don’t upgrade it again unless you have time to debug!

Upload firmware through Advanced Settings:

1- Download the firmware file from Grandstream web site
2- Unzip it and copy the file in to a folder in your PC
3- From the HT70X web interface (Advanced Settings page) you can browse your hard drive and select the folder you previously saved the file (ht70xfw.bin)
4- Click “Upload Firmware” and wait few minutes until the new program is loaded.

Note: Always check the status page to see that the program version has changed.

To reset to defaults:
Basic Settings->Reset Type: Full Reset->Reset

Basic Settings:
Set a new End User Password and record it.
Time Zone: GMT -06:00 (Central Time) or whatever yours is.
(If this doesn’t account for Daylight Savings, then define a custom one)

Advanced Settings:
Set an Admin Password and record it.
#Firmware Server Path:
CHECK – Always Skip the Firmware Check
Syslog Server: (Your Pi’s IP address)
Syslog Level: INFO

Primary SIP Server: (Your Pi IP Address)
SIP User ID: 701
Authenticate ID: 701
Authenticate Password: 13n38j
Name: 701

Primary SIP Server: (Your Pi IP Address)
SIP User ID: 702
Authenticate ID: 702
Authenticate Password: 13n38j
Name: 702
Preferred DTMF method: Set all 3 to “In-audio”
Offhook Auto-Dial: 85764 (This makes it VERY fast, because it dials immediately, just set the alarm to dial a #, which is normally redial, but the ATA forgets the last number dialed every time you reset it, also, this means that if you don’t know how to change the number that your alarm system dials out, it doesn’t matter, the ATA will dial for it and ignore whatever phone number the alarm system tries to dial!)

Direct incoming calls to extension 701:
Connectivity -> Inbound Routes -> Default.
In the Set Destination section of the form, change the target to Extensions and then select 701 from the list.
Then clickSubmit and Apply Config.

Set up Extension 702 on Asterisk for Alarm System:

Edit /etc/asterisk/extensions_custom.conf and add this at the bottom
; Alarmreceiver
exten => s,1,NoOp(Alarm received)
exten => s,n,System(/etc/asterisk/PreAlarmNote)
exten => s,n,Answer
exten => s,n,AlarmReceiver
exten => s,n,Hangup

NOTE: /etc/asterisk/PreAlarmNote is a script I wrote that sends me a PushOver notice and plays a sound from the Pi whenever an alarm notice comes in.

In FreePBX go to Admin, Custom Destinations

Enter in Custom Destination this custom-myalarmreceiver,s,1
In Description enter Alarm Receiver
Submit Changes
Apply Config

Set up Alarm Receiver:
from my GitHub Repository,
and put them in /etc/asterisk
cd /etc/asterisk
chmod +x AlarmCommand
chmod +x PreAlarmNote
mkdir /eventArchive/
chmod a+w /eventArchive/

PreAlarmNote and AlarmCommand are stripped down copies of my scripts.
You need to open them and edit them to match your system and do things for you. As they are now, they will not do anything.

In Web admin interface:
Applications->Extensions->Add Extension
Generic SIP, Submit
User Extension: 702
Display Name: 702
secret: 13n38j
dtmfmode: In band audio
nat: Yes
Click on 702 again
allow: ulaw
apply config

Applications->Misc Applications
Description: Alarm Call Center
Feature Code: 85764
Destination: Custom Destinations:Alarm Receiver
“Submit Changes”
“Apply Config”

Recompile Asterisk with with new alarmreceiver:
This is the important part that made my system work.
It is possible that YOUR system does not need this step,
or that you will have to make more or different changes to app_alarmreceiver.c for your particular system.


amportal stop
cd /usr/src
tar zxvf asterisk-
rm asterisk-
mv asterisk- asterisk

cd asterisk/apps/
mv app_alarmreceiver.c /root/ORIGapp_alarmreceiver.c

from my GitHub Repository,
and put it here in /usr/src/asterisk/apps/

cd ..
make clean
# Make your putty window full screen, or you will get an error about minimum terminal size
make menuselect
# Select “res_config_mysql”, “app_mysql” and “cdr_mysql” from the top item “Add-ons”
make install

NOTE: This output was seen, but it did not appear to cause any problems:
Your Asterisk modules directory, located at
contains modules that were not installed by this
version of Asterisk. Please ensure that these
modules are compatible with this version before
attempting to run Asterisk.

amportal start

You can go to the Linux prompt and run
asterisk -vvvvvvvvvvr
to get a an Asterisk command line and watch the log

That is it! Plug in your alarm system’s phone line to the ATA port 2, arm it, and see if it starts talking to your Asterisk install and making things happen!
Note that most systems only dials out when they are ARMED, so you have to leave it armed for this to work. The two options are to disable all sirens and use it as a sort of “chime” system, or only get notices when the system is armed. Either way, you have to arm it to test it now.

FreePBX Module Updates
FreePBX will tell you about modules that need to be updated, and you should do these.
Be ware of anything that says it will update Asterisk though,
and don’t install anything new unless you know what you are doing.
But the updates for the installed modules should be installed for security issues.

Below are some issues that came about as I updated things:

Ensure FreePBX Admin page works:
Sometimes the menu at the top of the FrePBX Admin pages looses all of its buttons and turns into small text with small text drop downs that are very hard to use, not to mention a lot of other bits of the page are malformed.
Do this to prevent that: (or whatever your IP is)
FreePBX Administration
Settings->Advanced Settings
Disable Mainstyle CSS Compression: True

That should fix/prevent that problem.

I started getting this error in FreePBX after some updates:

retrieve_conf failed to sym link:
/etc/asterisk/udptl.conf from core/etc (Already exists, not a link)
This can result in FATAL failures to your PBX. If the target file exists and not identical, the symlink will not occur and you should rename the target file to allow the automatic sym link to occur and remove this error, unless this is an intentional customization.
Added 4 minutes ago

The solution appears to be:

mv /etc/asterisk/udptl.conf /etc/asterisk/udptl_custom.conf

Then do an “apply changes” in the FreePBX admin (you may have to fiddle with something to get the “apply changes” to appear.

Note that the /etc/asterisk/udptl.conf should now be a link to /var/www/html/admin/modules/core/etc/udptl.conf and that includes udptl_custom.conf

Default ARI Admin password Used
Somewhere in the FreePBX updates we got an “ARI Password” in amportal.conf
I *think* that this is used for the “Voicemail & Recordings (ARI)” page.

root@Pi:~# grep ARI /etc/amportal.conf

But DO NOT change it here, instead go to Settings->Advanced Settings and set it!

Default Asterisk Manager Password Used
You are using the default Asterisk Manager password that is widely known, you should set a secure password
Added 94 weeks, 5 days, 23 hours, 48 minutes ago

This you should be able to set in Settings->Advanced Settings
I set it to the same ad the FreePBX password from LastPass (admin/)