Evolution of a Blog

This blog has evolved as I have as a maker. It starts at the beginning of my journey where I began to re-tread my tires in the useful lore of micro electronics and the open-source software that can drive them. While building solutions around micro-electronics are still an occasional topic my more recent focus has been on the 3D Printing side of making.

Wednesday, March 20, 2013

Arch Linux on the Raspberry Pi - Part 3 - 'Bot

The setup for my 'Bot running on Wheezy was described by an earlier post.   The below is a replication of that installation on Arch Linux based on the image that I described by the previous posts on this thread (Arch Linux on the Raspberry Pi).

With the base system built previously booted and running, I decided to work on installing the Arduino development environment.   It looked like I needed to download the source from the Arch User Repository (AUR) so I installed base-dev.   Interestingly there seemed to be a couple packages missing.  I did a "pacman -Syu"  (again as it had been done before for the image that I am using) and they downloaded!  There is a lesson here.  In any case it was all in vain as the source I downloaded apparently is not supported on the RPi!

Given the above I went to github and found the source code there and started to work on what it would take to get it to work.   I am still confused by what is needed so decided to defer the installation of the Arduino SDK.   I don't really need it running on the 'Bot as I can download the Py2Ard interface from one of my other workstations.

The 'Bot is written in Python V2 and relies on a number of Python extensions which is where I decided to begin:
pacman -S python2-imaging
pacman -S python2-pyserial

Once again there were some packages missing so I ran another synchronize.   I wonder if this was because pointers in one of the above packages were out of date?  I don't get it:
pacman -Syu
pacman -S python2 python2-numpy opencv 

With the above installed I went to test the webcam capture from within Python - it needs to be root??? I don't get this either!  I am using the shortest possible webcam capture script and it captures a zero length image without being root.

I don't actually use Python to capture my images given some issues with the camera dropping offline after a while so I pivoted to fswebcam and installed it now.  Note that I do use the above imaging libraries for a couple functions like creating an image of my radar map:
pacman - S fswebcam

My use of the GPIO bus requires one more library, again one that needed to be pulled down from GITHUB:

Finally, the last thing we need is a queue management solution called Beanstallk.  The architecture of my 'Bot is a little more complicated than it needs to be but I thought it would be cool to use some background Daemons with inter-process communications via Beanstalk.

No Arch Linux package exists for Beanstalk so I had to download the source and compile it on my target.   It seemed to work flawlessly:
git clone git://github.com/kr/beanstalkd.git 
install make
install gcc
sudo make install 

Now it was time to setup Beanstalk to run as a service per these instructions.  My approach was to create a service description file by cloning the one that proftpd created:
/usr/lib/systemd/system/proftpd.service -->         

Note that you may need to add your user name to a group, per the below, assuming you want to view logs generated by an error:
sudo systemctl start beanstalkd

I also created a directory for the PID as pointed to from the service file and pointed executable to /usr/local/bin/beanstalkd.

The service can be started once as shown below:
sudo systemctl start beanstalkd

Or started at boot:
sudo systemctl enable beanstalkd

Lastly, I found a version of the beanstalkc extension for Python and copied it into the directory with my Robot source code.

One important caveat.   Something is not working at the moment!   Beanstalk is not starting reliably.   More later.

No comments:

Post a Comment