Hybrid Robotics

Robotics, Gadgets, Circuits, Toys, Radio, and other Tech

Getting Up and Running with Elixir and Phoenix

April 22, 2017

There is a little work to be done to get up and running with the latest versions of Elixir and Phoenix on a Raspberry Pi 2 or 3, but it is not too bad if done right. I had to do a bit of information collecting from a few different sources to make it happen, and have collected the procedure I used here. This procedure assumes you are running either Raspian or Ubuntu 16.04. In my case, I am running Ubuntu MATE 16.04, so that is what this post will assume.

You can download Ubuntu MATE 16.04 for the Raspberry Pi 2 and 3 here

Add the repository for elixir and erlang.

sudo echo "deb http://packages.erlang-solutions.com/debian jessie contrib" | sudo tee /etc/apt/sources.list.d/erlang-solutions.list

sudo wget http://packages.erlang-solutions.com/debian/erlang_solutions.asc

sudoapt-key add erlang_solutions.asc`

Update the repository information.

sudo apt-get update

Install Elixir, inotify, PostGreSQL, and some other prerequisites.

sudo apt-get install elixir erlang-dev erlang-parsetools inotify-tools postgresql

Now, you have the latest and greatest versions of Elixir and Erlang installed! You will also need a few other things to make this all work.

inotify enables Elixir’s live load feature, so any changes you make to Phoenix code for the web will take effect immediately.

erlang-dev and erlang-parsetools are required.

PostGreSQL is the database Phoenix uses by default, and it is better than MySQL.

If you have not set a password for root, you will need to do that now.

sudo passwd root
<enter a good password>

su -
<enter your root password>

su – postgres
psql

ALTER USER postgres with encrypted password 'postgres';

\q
exit

This will set a password for the ‘postgres’ use in the PostGreSQL database software. This is the default password used my the Phoenix database package, ecto. If you want to set a different password for the database ‘postgres’ account, change the password you use in the ALTER USER command above and in your <project name>/config/dev.exs file.

Now, it is time to install Phoenix! Login to the account you will be running Phoenix from – this should NOT be the root (superuser) account!

mix archive.install https://github.com/phoenixframework/archives/raw/master/phoenix_new.ez

Now, you have everything you need to get up and running with Elixir and Phoenix in the least amount of time!

You can create a new project my doing mix phoenix.new <project name>

By Dale

Little Red Rover Upgrades

April 21, 2017

I am finally getting ready to upgrade my Little Red Rover

LRR-Final.jpg

The first upgrade will be to remove the front caster and add two front motors/wheels. This will stabilize the rover and allow me to add more weight to the front.

Following that, I will test communication between a Raspberry Pi 3 and an Adafruit Feather M0 RFM69HCW Packet Radio - 868 or 915 MHz set for 915 MHz. Communication will be via the ROS (Robot Operating System) serial protocol. The Feather M0 board will be programmed to accept and send specific ROS messages. I will have two HC-SR04 Ultrasonic distance sensors connected via a level shifter to convert the 3.3V signals of the Feather M0 board to/from the 5V signals of the sensors.

I will also have a DC Motor + Stepper FeatherWing to control the four motors, and an 8-Channel PWM or Servo FeatherWing to control up to eight servos stacked on top of the Feather M0 board. Both of these FeatherWings are controlled using I2C. It would also be possible to control these FeatherWings directly from the Raspberry Pi 3, or to add the Raspberry Pi HATs directly to it. However, I have chosen to use the Feather M0 board because many sensors are just easier to deal with using an Arduino, and there are many more libraries available.

The really interesting part of all this will be accessing the RFM69HCW transceiver radio on the Feather M0 board from the Raspberry Pi 3 board. This radio will allow creating multi-point packet networks with full encryption. I will also be testing smart sensors using this Feather M0 board, which would theoretically allow my Little Red Rover to communicate with any of these over distances of up to 500 meters (about 1640 feet).

This is my current plan, assuming for now that everything works the way I need it to work.

By Dale