Google Analytics

Saturday, May 18, 2013

A Home Security System - BeagleBone Black getting started

BeagleBone Black - Getting Started

Keywords: BeagleBone Black, Home Automation, Home Security, Python, Raspberry Pi, Tkinter, 

Updated June 5, 2013 (Table of Contents)
May 18, 2013
Next
Table of Contents

Note that I'm on an Ubuntu system, not a Windows system.



I received my BeagleBone Black (B3) yesterday.  Now I'm trying to figure out how to use it!

Per the included card that came in the B3 box, I noted, under Tethered to a PC:

  • Connect the USB mini cable to BeagleBone Black.  OK, did that.  They supplied the cable - nice!
  • Connect the other end of the USB cable to the PC.  OK, did that too.  
  • Look for a new mass storage drive to appear on the PC.  OK, it's there.
  • Open the drive and click on START.htm.  OK, there it is.  Clicking...
  • It opened a web browser page, in URL:  file:///media/BEAGLEBONE/START.htm , and presented the "Getting Started" page.  Nice!  I skipped the step 2, "Install drivers", as it noted: "Driver installation isn't required, but you might find a few udev rules helpful".  This has no meaning for me, as I don't know what udev is or the rules they are talking about, so I'm going to skip for now, since they said it wasn't required.  I can always do later...
  • Step 3, Browse to web server on Beagle.  I did this, and observed the web page from my B3's server on http://192.167.7.2.  
    • On this page, under Troubleshooting, it says not to use Windows Explorer.  That's OK, I'm not using it on my Ubuntu node that I'm working from, I'm using Chrome.  I'm not Troubleshooting either, as I'm not having any problems.
    • The next section is "Update board with latest software".  Here, I got confused.  I'm on Ubuntu, but everything here appears to be oriented towards assuming I'm on a Windows node.
      • It says" Download "Angstrom Distribution" from http://beagleboard.org/latest-images". 
      • Notes - 'due to sizing necessities, this download may take 30 minutes or more".  OK, it takes whatever it takes, no issues here.
      • The file you download will have an .img.xz [sic]extention.  This is a compressed sector-by-sector image of the SD card.  OK, no issue here for me.
      • Then it says, Step#2, Install compression utility, download and install 7-zip.  OK , then the screen clearly shows a Windows "open file security warning, publisher could not be verified, run?"  Well, I'm not running on Windows, so now what do I do?  I read along further...
      • Step #3, Decompress the image.  Use 7-zip to decompress the SD card .img file.  OK, still showing a Windows screen here.  Can't do that....so reading further to see if I can figure this out, or see what else may present itself...
      • Step #4, Install SD card programming utility.  Download and install Image Writer for Windows, be sure to download the binary distribution.  OK, can't do that either, so let's continue down to see what might present itself and clear this up....
      • Then an odd note, after all this Windows stuff:  Some general help on programming SD cards can be found on the Ubuntu Image Writer page.  OK, that sounds like me, so let's have a look; but what about all the zip unpacking, etc?  I'll have to let that be unresolved for the moment.  In the meantime, I'm over at the Ubuntu site, and note this "describes how to install from a .IMG file', and  about "downloading IMG image to a device that your computer can boot from", so maybe I'm onto something here.  So, for now, I'm assuming this is what I need to do.  
      • Returning, for now, to the B3's Update Software section, I note "Connect SD card to your computer", and I'm wondering, which computer are they talking about?  My Ubuntu computer, or the B3?  Reading further, it says "Use the provided microSD card to SD adapter or a USB adapter to connect the SD card to your computer.  Well, there wasn't any provided "microSD card to SD adapter"!!!  The uSD slot (under board) is empty, and other than the USB to micro USB cable provided, there's nothing else provided.  So, something wrong here!  Reading further....
      • Step #6: Write the image to your SD Card.  OK, that clears up one question, where I didn't know which computer they were referring to - my Ubuntu computer, or the B3.  It's now clear they are referring to my Ubuntu computer.  OK, got it - I'm going to program an SD card, using the Ubuntu instructions noted above from the Ubuntu web site, with the .IMG file.  OK, understood.
      • Step #7: Eject the SD card.  OK, got it.
      • Step #8: Boot your board off of the SD card.  They then give detailed instructions on what to hold down while booting from the SD card.  One thing that concerns me though is that it doesn't say how big an SD card (in capacity) I need.  It also says "this can take up to 45 minutes."!!!
    • Well, looks like I'm stopping here until I can go to the store to buy a 4GB SD card.  While I'm doing that, I'll go ahead and download the BeagleBone Black latest-images (Sngstrom Distribution (BeagleBone Black) 2013-05-08.  Well, I first clicked on the 'torrent', but it came up with a warning that torrent would also mean I would agree to upload.  I don't want to do that off of this computer, so I canceled that, and used the normal download instead.  I'm also going to get a 5VDC power supply.
      • Hmmm, can't seem to find the specs on the power supply physical dimensions needed.  After much searching, I found it embedded in the document:  The connector used is a 2.1MM center positive x 5.5mm outer bar
    • I want to power down the B3 - I never leave new electronic devices powered up and unattended, so I want to power it down - how to do that?
      • OK, here it is:  A power button is provided near the reset button close to the Ethernet connector....f you hold the button down longer than 8 seconds, the board will power off if you release the button when the power LED turns off. If you continue to hold it, the board will power back up completing a power cycle
      • Yep, that did it.

UBUNTU

  • So, this is what I did to install an updated image via Ubuntu.
    • First, I downloaded the image on to my Chrome browser into the Download directory.
    • Then I double clicked the .xz file.
    • This brought up an Archive Manager window, where I selected the 'Extract' button.  In this case, I created a new folder and labeled as pertaining to BeagleBone Black and the date, then I extracted to this folder.  This created a .IMG file.
    • This is the file that needs to be transferred onto the SD card.
    • Per the Ubuntu post here, this page describes how to install from a .IMG file.  
    • It says to 'write the downloaded IMG image to a device (my SD card in this case) to a device that [my] computer [my B3] can boot from.  It also notes that this action will destroy any data on the destination SD.
    • There's a lot of good information on this page, so I would suggest that you view it and understand it before proceeding.
    • The steps given:
      • 1. Download the .img file.
      • 2. Install the usb-imagewriter package
        • 2.1 If your release does not include this, download it from Oliver's PPA
        • 2.2 if the imagewriter fails to launch, you may need to install python glade2 support.  Install the python-glad2 packge or Run sudo apt-get install python-glade2
        • 2.3 If your release does not include it and you are runing Ubuntu 9.04 Jaunty Jackalope then run this command from the console: sudo apt-get install usb-imagewriter
      • 3. Oopen Applications->Accessories->Image Writer
        • 3.1 from teh command line, from the console:
          • sudo imagewriter
        • On some usb-imagewriter versions (console command:imagewriter) the applications fails to write if the image path contains blank spaces, exiting with "IndexError: list index out of range".
      • 4. Insert your flash media
      • 5. Sleect the downloaded file and flash device, and click "Write to Device"
      • 6. REmove your device when the operation is complete.
    • Well, in my case, I went to 'console' and typed in 'sudo imagewriter', and it launched, so I didn't have to do any of the installation stuff before.  I probably installed this previously.
    • When I placed the SD card into my Ubuntu's SD slot, I was expecting to see it in the File Manger, but I never saw it.  I looked in the folders Mnt and Media, but didn't see it there either.  So, on a whim, I launched 'imagewrite' and sure enough, it found it.  So I'm assuming this didn't have any type of file system created on the SD, so nothing was seeing it.
    • Running 'imagewriter'
      • it presented an interactive window, where it prompted me for the Write Image to select.    I used this to select the file from the folder I created previously (above).
      • From the 'to' listbox, I selected the SD card I had inserted.
      • I selected 'Write to Device'
      • I OK'd the warning that says it will destroy all data on the device (which as it turns out, is mounted at /dev/sde).
    • And, at 7:21 PM, it started writing.  Knowing that Beagle's site said it may take 45 minutes, I'm expecting a loooonnnnnggggg wait.  So far, I don't see anything, so I'm going to check the process running on my system to see if I can see it writing and consuming CPU cycles.
  • Update 6/5/13  Sorry for the long delay.  Had some other things pop up, and just now getting back to this.  So, to resume from the post above:
    • I had some problems getting the write to complete without error.  I suspected it was the SD card, so I removed it and tried another one, and the replacement worked fine.  However, it was too small overall, so I wouldn't be able to use it for the final installation.  
    • My system, which I built from components (my first computer, in 1978, was built from discrete components, such as transistors, capacitors, etc, except for the mother-board.  This was a Heathkit, H11, which incorporated a PDP-11/03 motherboard from DEC.  It cost me about $3,500!  In 1978, you could buy a CAR for this amount of money!  But now, I just buy the components and plug them in - no more putting the springs under a keyboard, no more solenoids for a paper tape punch, no more flyback transformer for the display monitor!).  I did not include a separate SD card reader, instead opted to use a USB SD card reader.  On a whim, I decided to try a different USB SD card reader I had with the problem SD card.....and the SD card worked fine!  So, it was a combination of the USB SD card reader device and the SD card itself that was causing the problem.  Switching to a different USB SD card reader and the same SD card worked great.
    • So this part of the project is complete!

8 comments:

  1. I am a new Beaglebone user, but a good deal of embedded micro-controller programming experience. I could not get my out of the box beagle bone black to connect using ssh over usb. I read somewhere that the latest image fixes that problem. So I just wrote the new image to an 8 Gbyte Micro SDHC card using WinDoze. I am ready to flash the Beagle Bone, but it is storming violently here right now. I think I will wait until the weather passes.

    How did your re-flash go.

    ReplyDelete
  2. John, the first time I re-flashed by booting with the SD card it was not apparent anything was happening so I rebooted. Note Bango's last point - I used the'top' command to see process activity. There will be a noticeable drop with the re-flash has finished.

    ReplyDelete
    Replies
    1. Now, I have re-flashed three times. Right after I re-flash, Cloud9 IDE and GateOne SSH client seem to work once and then don't work again. I can see the Beagle bone as a drive listed on my computer, but it is not the root directory. I used Filezilla, my favorite FTP program, and can access the entire Linux file structure using SFTP (SSH file transfer) when pointing it at 192.168.7.2. I don't know where the cloud9 node.js files are located. This is important to me, since I woudl like to access the device as a web server to monitor and control.

      I am trying to decide whther to stick with the Angstrom OS and try to make it work, or consider using something else.

      Hope the effort on your board is going well.

      Delete
    2. John,

      Sorry for the delay. I'm using Google's Chrome browser, on Google's Blogspot (where this blog is), and believe-it-or-not, I've been unable to post any replies via Chrome! Lots of Bloggers have had this problem and also people that are trying to post a comment. Don't know what the problem is, but I finally gave up troubleshooting it and am posting this from FireFox ;-)

      Anyway, I've been involved with my other systems for the last week (posted an update on that today), and will be out of town next week camping, so it will be a couple of weeks before I get back to this project.

      I haven't had any of the issues you describe. I did update the OS as one of the first things I did when I powered up, but don't know if that's your case or not.

      Delete
    3. Also, my reflash went OK, but there was a snag at first. It would fail before completion. I swapped out SD cards, and then it worked. I then went back to the original SD card, but swapped out the USB SD Card Reader that I had been using, and all of the SD cards would work with it. So my problem was the original SD card would not work with the USB SD Card Reader I was using, but another SD card would work with it. Swapping out the USB Card Reader with another one I had worked with all SD Cards.

      Delete
  3. Just a quick note on BBB install - I had numerous issues - and have been beating the crap out of mine since I got it. First, be sure to use a class 10 SD card... this will keep the speed up. They are cheap... so cost shouldn't be an issue. I also happen to have a Ubuntu desktop here... which helped expand the partition so I could use the full SD card size. So this said... here are my notes on getting Ubuntu setup on BBB:

    Install Ubuntu on BBB w/ 16GB SD Card

    1) Download image from: http://www.armhf.com/index.php/boards/beaglebone-black/
    2) On Windows box, extract .IMG from .xz file using 7-zip
    3) Use WinImage to write the .IMG file to the 16 GB SD Card
    4) Using Gparted on Linux box, expand SDE2 to max size of SD card
    5) Insert SD card into BBB - while pressing the boot button, power up the BBB
    6) Log in as u:ubuntu - p:ubuntu

    Done :)

    Hope this helps with getting Ubuntu running on the BBB. I would also suggest running "sudo apt-get update" before installing any packages. I was brave and tried to install Ubuntu-Desktop... but failed, as I haven't been able to find a video driver to support the BBB (my screen looked like it was having a heart-attack!).

    Cheers!

    Wes

    ReplyDelete
    Replies
    1. BTW - my web site is not being used right now... so feel free to email me at wes(at)charleslowe.com should you have any questions. Also... I love what you are working on. Between your project and the BeagleBell Project (http://beaglebell.com/wordpress/), I'll have my home automated in no time!

      Cheers!

      Wes

      Delete
  4. As an alternative to downloading, etc. the Ubuntu image, you can get a pre-installed and configured microSD flash with Ubuntu 13.04 on it:

    https://www.akirisolutions.com/products/buy/ubuntu/sdcard

    Insert it and boot to Ubuntu on the Beagle Board Black.

    ReplyDelete