Friday, February 28, 2014

Review: BeagleBone Home Automation by Juha Lumme

I've been reading a lot of book from Packtpub lately and just finished BeagleBone Home Automation by Juha Lumme.  This 178 page book has a lot of information on setup your single board computer, inputs and outputs, client/server programming, scheduling and finally creating an Android client.  Although I don't agree with all of the concepts presented by the author, such as creating your own communication protocol (use REST...), I still thought this book provided a lot of using information that could help a hobbyist/DIY tinkerer interface sensors and output pins on the BeagleBone.  A lot of these concepts presented also apply to the Rasperry Pi so the concepts are quite transferable.  This is a great book to help the uninitiated get started with home automation using the BeagleBone.

Saturday, February 22, 2014

Review: Building a Home Security System with BeagleBone by Bill Pretty

I read another book on the BeagleBone last week.  Building a Home Security System with BeagleBone by Bill Pretty focuses on using the GPIO pins available on the BeagleBone Black to create a multi-zone security system.  I was pretty excited about this when I started reading the first few chapters.  The author provides very useful tips and tricks about electronics hardware with a light addition of Javascript as the programming language of choice.  There are useful explanations behind the IC selection but none of the circuit diagrams are explained in great detail.  To fully understand them, I feel you would need to have a full background and experience in electrical engineering but someone with only hobby level of knowledge and experience could still build, test and use the circuits.  At chapter 7 of 9, the book jumps into a how to guide of installing some basic network intrusion detection open source packages to run on the BeagleBone Black.  I wish the author would have continued the book, in the hardware direction, by having add-on modules that could be stacked onto the core project.  Instead, the book is 75% about the steps to build single (fun) home security system project and 25% about installing network monitoring software.  It seems loosely added to at the end.  This short 120 page book started off strong, but didn't keep it up all the way to the end.

Friday, February 21, 2014

Spartacus - Robotics Project Part 1

I've undertaken my biggest robotics project yet: Spartacus.  Feeling empowered by the rich feature set of the BeagleBone Black and the apparent vast support of its online community, I decided to build my own robotics research platform.

I had an idea for a box looking robot, that would sit around, move it's big square head and move its arms based in learned behaviours.  To do so, I need a good prototyping building material.  I ended up deciding to use form board since I could play around with it more than 3D printed plastic parts.  I could always model the final product once I have the design finalized and stick to foam board for the prototyping.

I once received some valuable advice from a wise friend that I didn't up end following about cutting wallpaper: use a sharp blade!  Only after I replaced by x-acto knife blade did I realize the hours saved cutting form board to share using a good sharp edge.  Write this one down if ever you end up using this building material.

I also chose to use basic servo pan/tilt modules from the for the hard and arm movements.  This gave my robot 6 degrees of freedom. With a usb webcam and future upgrades planned for the head, I ended up having to change the neck pan/tilt setup to use standard size servos instead of micro servos such as the ones used for the arms.  It made a world of a difference.

He's a pic of the work in progress.  This post will part of an ongoing series!  Stay tuned friends.

Saturday, February 15, 2014

Review: BeagleBone Robotics Projects by Richard Grimmett

I just finished reading BeagleBone Robotics Projects by Richard Grimmet.  I wish this book had been available to me a few months ago as I was building by home security system.

This book could be seen as a set of polished articles that build upon each other to create a very customizable robotics platform.  It covers replacing the default image to Ubuntu, sensor inputs, speech processing and synthesis, servo motor controller interfacing, GPS and more.  Countless hours of work can be saved by taking the time to read this culmination of insightful tested steps to building robots.  The author appears to have a preference for USB type interfaces which tends to be ideal for the BeagleBone Black embedded computer.

On the software side, the book focuses on using Ubuntu, Python and OpenCV.  The author is concise in his writing and doesn't spend too much time explaining the reasoning behind his design choices.  This is good for someone who wants to hit the group running and wants to do some of the deeper exploring on his/her own.  I'm a fan of open-source everything and the author appears to share the same values.

This book is worth every penny for anyone undertaking or interested in a wide range of BeagleBone based projects.  I highly recommend this one.

Saturday, February 8, 2014

BeagleBone Black TTL serial camera home security system with private motion activated tweets

In 2013, I bought my first BeagleBone Black with the intention to jump head first into new robotics projects.  I had been reading a lot of books and blogs on robotics over the past few years, with my career starting taking precedence to my passion projects, but it was time to get back into it.  My last robot was a maze navigating and flame detecting & extinguishing mobile robot.  Embedded devices have evolved quite a bit since that HC12 project with the recent popularity of Arduino, Raspberry Pi, BeagleBone and similar products.  It's a perfect storm of embedded electronics fun.

To get started, I bought the BeagleBone Black starter kit from Adafruit (awesome company) and a series of parts and tools from Amazon and The Robot Shop (Canadian!) - more on this in another post.

I also needed a good introductory project to follow the classic embedded equivalent to Hello World: make a LED blink.  Since I was about to head out on a vacation out of the country for two weeks, I decided to build a home security system.

Here's my part list:
  • Weatherproof TTL Serial JPEG Camera with NTSC Video and IR LEDs
  • Adafruit Beagle Bone Black Starter Pack 
  • USB Wifi dongle
  • 2 port USB hub
  • 32Gig micro SD card
  • That's it!
I've always believed in code over hardware in design decisions.  Even with my electrical engineering background, I find it less costly, more flexible and more robust to code solutions rather than to rely on hardware.

Here's a Python code snippet of my project.

 enable_tty01 = 'sudo sh -c \'echo > /sys/devices/bone_capemgr.9/slots\''   
 filepath = "/home/ubuntu/"  
 def initialize():   
   resp = ""  
   while(serial.inWaiting() > 0):  
       data =  
       resp += data  
       if "Init end\r\n" in resp:  
           print "Ready"  
   # Set image size to 640 x 480  
   resp = ""  
   while (serial.inWaiting() > 0):  
     data =  
     resp += data  
     if b'\x76\x00\x54\x00\x00' in resp:  
       print "Size set"  
 #Picture function  
 def takePic():  
   print "Take Picture"  
   # Take picture  
   #Get JPG size  
   resp = ""  
   print "Get image size from serial device"  
   bytes = cam.getbufferlength()  
   # Write image to file  
   print "Read image from serial device"  
   return cam.readbuffer(bytes)  
 # Initialize serial connection.  
 serial = serial.Serial("/dev/ttyO1", baudrate=38400)  
 cam = VCam(serial)  
 # Initialize the camera settings for the first picture.  
 tweet = Tweet()  
 while 1:  
   # Continuously check for motion detection.  
   if (cam.motionDetected()):  
     # If motion is detected, take a pic.      
     frame1 = takePic()  
     string_frame = ''.join(frame1)  
     now =  
     filename = "%d.%02d.%02d.%02d.%02d.%02d.jpg" % \  
       f = open(filepath + filename, 'w')  
       print "Error writing the file to the system."  
     #Post the image to Twitter in a new thread to resume motion detection.  
     t = Thread(target = tweet.postimage, args = (filepath, filename))  

I had a number of challenges in getting my program to work.  The main two include:

  1. The camera's baud rate is rather slow so I wasn't able to implement the motion detection on the computer and had to rely on the built in feature from the camera.  In the future, I will use a USB or IP camera instead.
  2. The wifi dongle was difficult to install but with enough googling, I was able to find working steps.  While I was working on this project, the BeagleBone Black was still relatively new compared to the Raspberry Pi so there were limited examples available online.  This is no longer the case.

And finally, the working prototype!

While I was away, I had pictures of the sun rise and sun set lighting change against the wall of my home office tweeted to me on a daily basis (they were detected as motion).  It was nice to see everything was good at home while being away.

Until next time!