Posts Tagged ‘learning’

h1

Beagles in Paris

September 24, 2014

I’ve been working on a way to demonstrate a networking feature. I should tell you all about the networking feature but let’s just pretend that, like all routing protocols, we don’t really care about how it works.

Actually, that is why it is hard to demo networking protocols: either the demos do something and everyone says, “oh, I could do that over TCP/IP” or they don’t have any interface other than wireshark and everyone says, “wow, I’m bored.”

Yeah, I’ve been working in networking and missing my microprocessors quite a lot.

ANYWAYS… the demo! I have:

  • 8 BeagleBone Black, rev Cs
  • 8 LCD screen capes (these are absolutely marvelous)
  • 8 Webcameras
  • 8 brochure stands
  • 2 100W power supplies (each feeding four units, 5V 2A)
  • 1 hub to rule them all
  • 1 laptop to run the obligatory wireshark
  • Assorted cables (Power, Ethernet, one USB for config/debug)

We’re running something that acts like Dropbox so they all share the same data. (Seriously, I could tell you how but I’d use phrases like “Bit Torrent for the Internet” and get dirty looks from my workplace or crossed eyes from you.)

Before I go on with a few details about the build, how would you demonstrate Dropbox? As a walk-up, show-n-tell style demo on a crowded expo floor? Something that makes sense once you use it is remarkably complex for a demo.

For my demo, every second, each BBB takes a picture. It displays it on its screen and puts it in the shared directory. In another window, it uses a slideshow program to look at all of the pictures in the shared directory. Think of it like a security system, I show you what I see and what everyone else sees. This setup lets people see the how fast files are sync’d and the Ethernet traffic that passes on the wire to implement the protocol (look wireshark, no TCP traffic!).

Beagles

The main difficulty I have working with the single board computers like BBB and Raspberry Pi is that I don’t know the overly crowded space. Good software might have terrible websites, yet vaporware always looks real. It took me a multiple hours of research and testing to settle on streamer to take still pictures and on feh to display them.

For the most part I used three units to do the setup and testing. Eventually, I got it working well-enough to go ahead and set up on all eight units. That was when most of the problems actually showed up, of course.

My pictures kept getting overexposed. They’d start out ok but get lighter all the time until all images turned white if the system was left alone. Of course, it took some time to figure out that the exposure setting was the problems since if I interacted with the units, it took much longer to get to white. Eventually I searched for possible causes, downloaded v4l-utils so I could try v4l2-ctl which communicates with the camera to change settings.  I added it to my start script and apt-get installed on all 8 units.

However, my pictures kept being overexposed at the top, for the top 20%. It wasn’t due to light flicker, pointing at a window (or covering the lens) got the same top part lighter than the rest image. It was definitely the image capture program. I’d put camorama as a step to verify the webcam worked from the display (it is a touch display, so pretty, so nice).  It didn’t have the same problem, but it doesn’t get stills. So I tried a different capture program: fswebcam. That didn’t help the problem and all a change of each control parameter didn’t help. However, fswebcam lets me take a bigger picture and then crop it down. So… problem solved-ish, once I apt-get installed on all 8 units.

I don’t know if that was an artifact of the camera I chose (the fairly expensive Microsoft LifeCam HD-3000). I tried a $6 from the random-cheap bin at Central Computer and it worked fine though the stills didn’t look as nice so I put it in a drawer, forgot about it. I may try to see if it causes the top-image-light problem but since I’m locked into the gear I have for this month, the only way is forward.

Though the slideshow program has been the stable and reliable part of the system for the last few weeks, I’m not sure I like feh. It has a term that will cause it to reload the image. So if I am on Charlie, looking at Alpha’s pictures, feh can reload every second so it shows the latest of Alpha’s pictures. Well, it can do that only if it is not also in automatic slideshow mode. It can reload images or change images. It is as though there exists only one timer in the world and feh must do the best it can with its feeble resources.

It is open source, I could download the code, understand it, fix it, and copy it to all of my units. Or I can make the slideshow a little faster so you are never stuck on one unit for too long.

The slideshow already gets a bit frenetic. Even with only three units it is a bit dizzying: the BBBs bright blue blinking lights, the screen’s orange blinking light and green shining one, the slideshow updating its window every second or ten, and the captured image updating every second. I had five units working Wednesday and will have seven or eight working all at once tomorrow.

I’m not sure how many they will run in Paris, it is ok with me if they only unpack three. And, I’m not sure I’ll have all eight working in the lab tomorrow because DeltaPuppy seems sick. Who gets a kernel oops in a mv command? I sort of expected that when I named GolfPuppy and HotelPuppy, those sound like slackers. Delta has spent more time getting its hardware put on different mountings so maybe it just got knocked around too much. (Yesterday, the mechE turned down my offer of ESD bag and carrying box, popped it into his bag; I begin to see why Delta is sick. Though, maybe this isn’t a sick puppy, just a victim of happenstance, he isn’t always sick…)

Our intern is going to Paris to herd the demo along (and a couple other dogsbody duties [omg, pun totally intended, snicker]). He didn’t even flinch when I gave him the two page long “here’s how you run it” instructions. Not even when I gave him the five page long “here’s how you build the system”, told him he needed to know in case anything went wrong. I think he’s really excited about going. I hope he brings me back something French.

I’m not going. I thought I might want to go. But things here are keeping me here and that’s ok.

The multi page instructions have been replaced with an expect script. Now it takes N lines to set up N units. And you don’t have to look up their identifiers, just know the first eight letters of the international phonetic alphabet. (The intern doesn’t know about this improvement yet, I’m looking forward to surprising him.) Also, expect is wonderful. I haven’t used it in years but it really is efficient. Now I know why my coworker asked why I was typing things instead of making a script.

Speaking of scripts, I wish I could turn off all the cruft that starts with the BBB. There are all these programs and I don’t really want them running (heck, I don’t want them there). I know I could edit init.d but I’m a little worried about breaking something. I haven’t yet seen a good guide to stripping down the BBB Debian system to the bare bones. Anyone have any suggestions?

Overall, I like the BBBs, I love these screens, I’m indifferent about the webcams, and I’m uncertain about the final mounting. I retain my Linux-is-hard-because-nothing-quite-works feeling. There is little standardization (one program likes to use man, another info, another has a sparse man page but gives a nicely detailed output with a command line –help invocation). And I like that this demo is built from off the shelf components, only a bit of extra software (most of which the demo team will provide in tutorial sessions). It has an “I built it, so can you” vibe going for it.

h1

Scribbles to myself

May 28, 2014

I did Unix system administration in college. That was many, many years ago. And really, I managed the consultants, wrote quick references for users, made new accounts, and only filled in on deep technical management when someone made me (usually when someone else was sick or had lit something on fire). Good times. But I really was an expert unix user at one time for multiple unix varieties (hey, the math cluster was hpux so I got deep into that the summer I spent working on computational math libraries to model fluid flow).

But, as I mentioned, it was many, many years ago. Since then, I’ve played with Linux, dabbled here and there. I’m more comfortable with Mac OS in the command line (yes, I’m that awful person who remapped my flower and control keys so my fingers didn’t need to re-learn ctrl-z when developing with xcode).

My next contract will be all Linux-y and I’ve been wanting to do more embedded Linux (why is everyone so excited? When I played with it in 2006 it seemed like a great way to spend $100k in development time and then switch to something deterministic). Having borrowed a Beagle Bone Black, reinstalled Windows to have 64-bits so I can access all of my RAM, and installed a virtual machine so my husband will stop laughing at me when I destroy things, I’m ready.

My first mini-project is to rebuild the BBB’s Angstrom distribution. The board I have is a bit old and the OS has been updated. It would be nice to return it from whence I borrowed it, all updated.

Of course, it isn’t that easy, I’m plagued with stupid things I feel like I should know. And I’m reading Chris Hallinan’s Embedded Linux Primer: A Practical Real-World Approach (2nd Edition). I read the first edition many years ago (about the time it came out since we were still working on the embedded Linux project then, though my role was manager-only, not developer).

As I struggle with getting everything set up and configured as I like, I figured I should note some of my favorite commands.

On my Linux VM, here are some of the things I shouldn’t forget:

> cat /proc/version 
Linux version 3.8.13-16.2.2.el6uek.x86_64 (mockbuild@ca-build44.us.oracle.com) (gcc version 
4.4.7 20120313 (Red Hat 4.4.7-3) (GCC) ) #1 SMP Tue Nov 26 08:41:44 PST 2013

I like to know where I am and what I’m running.

> sudo usermod -a -G dialout elecia

Since I got an off-the-shelf VM (Oracle’s Linux 6), I wanted an account for myself. I know better than to run as root all the time. On the other hand, I keep failing to be able to use things. It took me a stupidly long time to remember that I have to log out after changing permissions.

> screen /dev/ttyUSB0 115200

As long as I remember to switch my USB-serial cable to the VM, I can snoop on the BBB as it boots up and use a command line there. U-boot is neat. Also, control-a then k kills the screen but leaves it openable (it detaches).

On my unmodified BeagleBone Black

root@beaglebone:~# cat /proc/version
Linux version 3.8.6 (koen@rrMBP) (gcc version 4.7.3 20130205 (prerelease) (Linaro GCC 4.7-2013.02-01)
 ) #1 SMP Sat Apr 13 09:10:52 CEST 2013

I think I’m going to need to learn more about Linaro. I has come up a few times. I don’t think it is like ucLinux which can run without an MMM. Still, Linaro seems common for microcontrollers (the system-on-a-chip (SOCs)) that I’m likely to want to use.

This one is general more general:

ln -s /usr/local/bin/python2.7 python

That is linking the source (/usr/local/bin/python2.7) to the dest (python in the current directory). I’ve missed symbolic links.

Alias is ok:

alias ll="ls -lags"

But it should be noted that friends do not do

alias vi="rm -rf"

When their terminal is left open in a public environment. That’s just wrong. Of course, the way I use vi, it might as well be right.

I’ve been trying to stay in the Linux environment for most of the stuff I’m doing. When I find myself typing in questions into my Windows browser, I stop and go back to Linux. The fact that the VM captures my keyboard so I can’t alt-tab out of there is probably a good thing.

Building Angstrom has been difficult, lots of dependencies that are required to be something else by another part of my OS. Since I got the off-the-shelf VM from Oracle, I don’t think I got what would have been easiest to build Angstrom. I’m not sure what they want but it isn’t the Linux I have.

Oh, another good command to remember:

 find . -name sanity.conf

Where the dot is where to search (from here through all directories) and -name is what to search for. I initially typed “find sanity.conf” which leads to a pleasing error message

find: `sanity.conf': No such file or directory

But that was the clue to me that find was one of those trickier commands that I usually mapped.

I was looking for sanity.conf because I got error messages that suggested I look in there for more information. Inside, there was a comment:

# Expert users can confirm their sanity with "touch conf/sanity.conf"

Windows doesn’t have this whimsy. I’d forgotten that. Linux is more clearly built by people, with all of the interpersonal spats associated therein.

Windows is more of a machine, with the personality of an annoying, talking paperclip. Linux is more of a crowded bar with lots of people talking in many groups. If you can find a quiet spot and a good group, you’ve won.

But standing on the outside, trying to figure out where to go, is excruciating. And wearing the wrong distribution can get you shunned.

 

 

h1

Beagle Bone Black

May 17, 2014

I have a beagle. She’s a great dog.

No, that’s not right. She’s a terrible dog.

When you look up breed information about beagles, you see “merrily stubborn” and “amiable and determined.” What that means is “thinks you are an idiot but is pleased with the opportunity to laugh at you.”

My dog thinks I’m dumb for not wanting to roll in whatever it is she just rolled in. In her world, I’m her not-so-bright straight-man, trying to make her go in boring directions instead of following her supernose. But she’s a happy-go-lucky dog, having accepted the burden of trying to teach me about the joy of squirrels.

(Seriously, she’s an awesome dog, far too intelligent, and very seldom as sad as her pictures indicate.)

And so we plug the beagle into the USB port…

Every time I think about the Beagle boards, I fall into rumination about my pet. Let’s just say, this board had best not act like my dog.

But let’s see what it does act like… Philip over at Fliptronic loaned me his Beagle Bone Black for a week or two after my twitter-whining about Sparkfun’s lack of stock got overwhelming and I finally just asked if anyone had one I could borrow. Yay Philip!

I spent some time on beagleboard.org, reading about the system. It looks sort of like an Arduino or an mbed or any number of other small processor development boards. I keep forgetting that it (and Raspberry Pi) are computers, not really embedded platforms. Certainly, it has more oomph than the computers I had in the 90s.

Now that I have one in my possession, what am I going to do with it? I don’t have an end goal but I do have a couple of things to try, mostly following along with some Adafruit Beagle Bone tutorials.

Step 1 is unbox it, then plug in the BBB to USB.  That was relatively unclimactic until I plugged the hub into my computer. Then it started signalling planes with its ridiculously bright blue LEDs. Next step, install drivers.  Clearly my beagle told them about my mental deficiencies because they’ve really made the getting started page simple.

Though, of course, it didn’t work. (I swear, computers hate me.) Everything installed ok, didn’t say I needed to reset my computer. The getting started page say to use Chrome to navigate to http://192.168.7.2/, which will be a network-over-USB thing. That doesn’t work. The page says older software images require ejecting the BBB as a USB drive but that gives me an error (as in “An error occurred whiled ejecting ‘Removable Disk (G:)”, thanks Microsoft. Unplugging USB doesn’t  work but it does get the flashing lights to stop.

Oh gods, the flashing lights. They make me really, really anxious. I put a sparkfun box over them but it still leaks. I thought I could deal with it but making it stop was such a huge relief.

I think the next step is to find a bigger, less light leaking box. Oh, and reboot my computer to maybe activate those drivers I installed (despite the huge warnings Microsoft put up).

 After Windows reboot

The reboot didn’t work but using the USB cable from the box did. The BBB is serving up a webpage which has little scripts I can edit and run (from the webpage). There is an IDE that runs (Cloud9 IDE) though I have to sign up (I hate signing up for things, particularly for things I don’t know if I’ll want to play with).  There is an SSH shell that doesn’t work (“This webpage has a redirect loop”) until I set the date (there is a button on the page that will do that).

Lots to do. Lots of hardware pins.

I’m torn between an dimming an LED and reading about I2C RTC so I can use the information to talk to an accelerometer or something. (I suppose I have an I2C RTC around here somewhere but I know where the accels and fuel gauges are.) I also want to update the FW build, maybe cross compile it myself so I understand all of the pieces. Oh, and I could try out Willow Garage’s robot operating system for Angstrom (the Linux variant that the BBB runs).

Oh, I2C was pretty easy. I don’t even need to know the address? What sort of black magic is this?

There is so much here. I’ll be lost for awhile.  That’s ok.

h1

Headline: Treasure maps making finding treasure 1000x easier

March 27, 2014

I was trying to work with a few other people on the ayok project so I made a map, so they could build their devices. Then they got busy and I got busy and not much happened on our stuffed animal monitoring device.

The good part of making documentation is using it myself, feeling so pleased with old-me and her amazing foresight in writing things down.

Having opted not to cave to easy money, I’m sticking to my plan of working on personal projects until after the embedded systems conference. And since my boards aren’t back yet, I can’t solder the motor boards.

Which is good because I want to build the ayok a little more. First step is actually building and thanks to that document, the hard part was finding the accelerometer I gave to my husband.

Map of how to build the are-you-ok electronics

I built this up (using a solderless breadboard, well, I didn’t put on the battery-monitoring fuel gauge yet, I need to solder a header on so it can connect).

It didn’t work. Electric Imp’s APIs have changed. That’s worrisome but I after some futzing around, trying to figure things out from their examples (their docs are better but still leave many things to be desired), I managed to get the thinking-of-you functionality working again, including the web page.

Connect ayok hw

What’s next? I think I’m going to make LED color depends on orientation angle (so red is x, green is y, and blue is z acceleration). That doesn’t properly use the Imp’s internet connection but I need to make the accelerometer work and that will be a pretty demo.

The whole text-me thing makes me nervous. I should see if Electric Imp has examples for that, I know they’ve been ordering pizza from the internet. I bet I can twitter to myself if the widget doesn’t get any motion. That will probably be an intermediate step.

Oh! Also, having had lunch with ayok idea generator Elizabeth, we agreed that the non-stuffed animal version should be a magnet on the fridge. If you open the fridge, proof of life for the day has been established.  (She mentioned toilet roll module as well but I’m not going to potty humor, despite the temptation.)

h1

Easier and harder

March 17, 2014

Armed with my gerbers, I went to OSHPark, the place where I’ve heard small quantities of small boards can be had at a reasonable price. It starts with a nice welcome page. I pushed the giant Get Started Now button, thinking I’ll need a log in. Nope, it gets started, wanting me to upload my files.

We’ve only just met, that seems a little fast.

I tried to upload files but it failed because I tried to upload the first of the many files in my newly unzipped directory. Happily, it told me to load the zip so I deleted my expanded folder and just loaded the zip file I got from electrical engineer Casey. Clearly, this site was designed for idiots. Which is great in this case.

When I uploaded the zip, it didn’t have one of the files but it told me which one was missing. I emailed Casey. But then, as I was procrastinating kitting parts decided to write up these experiences, I read more of the text surrounding the large buttons on OSHPark. It said I can put in the brd file. I saw one of those in the source directory (as opposed to the Gerbers zip).

This succeeded. Faced with a “name it and give us your email”, I had to choose Continue (the only other option was start over). The buttons were inviting but I felt like I was herded along the path.

The site showed the different layers, similar to what Casey had sent. They looked good. Now, Approve or Approve and Order? I wanted to order them… but how much will it be? They didn’t (yet) have payment info so cancelling was possible.

Oh! Check this out, on the next page it said:

Your design will cost $6.45 per set of three.

Squee! I can buy them! They aren’t very expensive. I have to buy in units of 3… well, I thought it would be $40 for 10 or 15 so… let’s do 15 ($32.25). And free shipping? Cool!

Seriously, this is too easy, it has to fail catastrophically any second now. Typed in my credit card number (obviously this is a business expense!)… now there is email from their bot and a receipt in my email account.

I just bought boards. Wow. That’s pretty cool. So easy a software engineer could do it.