Elixir Robots


Elixir Robots

My robot hobby is picking up steam. After going through the Python examples that came with the GoPiGo, I got inspired by some embedded Erlang videos on YouTube and decided to see if I could control the GoPiGo with Elixir. After watching Elixir Sips, I learned of a project called Elixir/Ale, an Elixir library for embedded programming. With Elixir/Ale, you can talk to the GPIO ports on the Raspberry Pi and some common hardware bus protocols: I2C and SPI. I2C is used by the GoPiGo board, so Elixir/Ale looked like what I needed. So I looked up some Elixir docs, typed mix new exgopigo, and started coding. The result is ExGoPiGo. All it lets you do right now is turn on and off the robot’s two front LEDs, but it does that by writing to the I2c bus. Controlling the motor and such shouldn’t be too hard.

I also ordered an USB kit for my robot arm. This lets you plug the arm into your computer. The software that comes with it only runs on Windows, but the Internet is a wonderful thing. Somebody reverse engineered the protocol and wrote a C program to talk to the arm via the USB port. Somebody else wrote a Mac OS X app using IOKit to talk to the arm via USB. There’s also a Python project that uses libusb to talk to the arm. At first, it didn’t seem like I could you Elixir to control it, but I found an article on Elixir’s Ports and NIFs, which lets Elixir talk to external code. Using that example as a base, I modified the C program to talk to the USB like the C program in the reverse engineered protocol article and created an Elixir module to talk to my new C program via a port. The result is ExRobotArm, which ables you to fully control the arm with Elixir. I tried it on both Mac OS X and my Raspberry Pi. Now it is totally plausible to attach the arm to whatever robot has a Raspberry Pi controlling it.

My compass and GPS module for the GoPiGo have arrived, so that’s next. Then more work on ExGoPiGo.





Robots! Robots! Robots!

I’ve been getting into robots lately. For a long time I was searching for the perfect robot kit to use with my Arduino. Then I decided I’d rather use my Raspberry Pi to control my robots so I could use better programming languages like Clojure, Elixir, Scala, Ruby, etc. So I was looking around for the perfect Raspberry Pi robot kit.


For Christmas, my parents gave me the OWI Robotic Arm Edge. For the longest time, I didn’t like it. I wanted a moving robot and something I could program.


Finally in April, I decided to pull the plug on the GoPiGo, a Raspberry Pi robot kit. It was a little challenging to put together the motors at first and one of the encoders broke. I asked for a new one and they sent it right out. I ran the examples that simply let me remote control the GoPiGo by ssh’ing into the Raspberry Pi on the robot. I had no sensors or anything else. My goal is to create an autonomous robot. No remote control.


So I ordered an ultrasonic sensor, and a Raspberry Pi camera and waited. It took probaby a month before those all came in.


In the meantime, I decided to put the robot arm together. 48 steps! Took me 2 days, but it wasn’t that hard. I ended up with this.


Completed robot arm


Then I went to our local Microcontroller meetup hosted by Make Salt Lake. There were lots of cool projects everybody was working on, and I talked a little about my GoPiGo. I expressed my desire to make it autonomous and also to have a battery that I could recharge. Somebody mentioned the iRobot Create and that got me thinking. A couple of weeks later, I ordered one, and a week later it showed up.


iRobot Create 2


Finally, my GoPiGo parts came and I added those to my robot. That was a little bit of a challenge as well. So here’s the GoPiGo:


Completed GoPiGo


I ran the examples for that demonstrating how to use the sensor and camera. They worked. I decided to order a compass and a GPS module to add to the GoPiGo because there are examples that use that. I want to make this thing as smart as possible.


So lots of things to do. I want to:



    • Control the robot arm wirelessly


    • Make the GoPiGo roam around on its own.


    • Use Clojure to program the Roombda (iRobot Create) and see what I can do with that. Someday maybe add a Kinect to it, or attach the robot arm to it.


I don’t know where all of this is going, but I’m just having fun exploring and seeing what I can do. I’ll keep you informed.