Jul 6, 2014

Jul 2, 2014

Sharing Folders with Dropbox

My wife and I have separate Dropbox accounts. Why? We were sharing one Dropbox account for awhile and then she started to use her iPhone camera more and more. I also started documenting my projects with the iPhone. This meant we were each adding off-topic photos that mixed in with the other person's albums. Plus, we were starting to get tight on the free Dropbox space.

The fix for that was separate accounts. This works well with iPhones - Dropbox will automatically backup your iPhone photos if you set it up that way. What's even better for my wife, sharing photos with her friends is a breeze: open Dropbox Photos (Camera Uploads) on your iPhone; select photos to share; click share; email. This will send a link to your photos to the contacts you choose. Slick!

We still had a need to use the same files for some things, like the password manager file. For this, use the sharing feature in Dropbox.

Here's what I did in Ubuntu 12.04:

Share a folder on Linux

You can share a folder right from your computer if you've installed the Dropbox desktop application.
  1. Open your Dropbox folder.
  2. Right-click on the folder you want to share to bring up a menu.
  3. Select Share This Folder.... This will open the Sharing page on the Dropbox website.
    Share this folder option Select Share This Folder... from the contextual menu
  4. Enter the email addresses of the people you want to invite.
  5. Add a personal message if you'd like and click Share folder.
There are a couple of scenarios to stop sharing.
  1. You want to delete a file in the source dropbox and all of the shared locations:
  2. You want to delete a file only in the source and allow the copies to still exist
For scenario 1:
  • Stop sharing the folder(file) on the source dropbox
  • Delete the formerly-shared folder
For scenario 2:
  • Delete the shared folder (don't stop sharing first!)
  • The shared copies will still exist in other Dropbox accounts

Jun 23, 2014

CMoy Headphone Amp Build


A friend of mine told me about the Chu Moy (CMoy) headphone amp, sounded interesting - just google it, it's all over the web. If you just want a headphone amp, the FIIO E6 @$27.99 USD is highly recommended. Watch out for counterfeits, though! You won't save any money self-assembling from parts vs. buying a CMoy ready-made. 

I wanted to make my own just for the learning experience. I saved a few dollars out of pocket because I had all the resistors and some capacitors in inventory, also some heaphone jacks and an 8 pin IC socket. Here's a list of the parts I ordered:

Item
Cost (USD)
OPA2132PA Op Amp
$6.95
10K Potentiometer with
on/off switch
$2.80
Aluminum Knob
$2.33
0.15uF Film Capacitors (2)
$0.32ea
Fred's Amps Circuit Board
$5.46

Fred's has a good set of instructions here. The build is easy, less than an hour for an experienced builder, but you need to pay close attention to the polarity of the electrolytic caps and the battery leads.

Because the headphone jacks I used were taller than Fred's specs, I couldn't use the punch-out template he supplied. I made several attempts at drilling/punching holes, but somehow things were off a tiny bit and I couldn't achieve a nice, snug fit.

I looked around for an alternative in my inventory of saved tins. Hmn. The Trader Joe's "Extra Dark Chocolate Wedges" round tin seemed up to the job. I simply made crude cut guidelines on the side of the tin and cut a space out with a nibbler tool. Followed that up with a bit of sanding the rough edges with a rotary tool. For attaching the board to the tin, I turned to the magic go-to tool, Sugru. It insulates, it decorates, it attaches, it smooths! It's the wonder room-temperature curing silicone.



Now, I have a tin that not only fits my battery, but is a nice size and shape to store my coiled up ear buds and headphone cable. 

I really enjoy having a discrete volume control over fiddling with buttons on an iPhone or other device. The CMoy is a nice upgrade to the sound - definitely noticeable, but not hit-you-over-the-head dramatic. Instruments and voices are more defined, the bass is improved and the sound stage is a little fuller. Nice!

UPDATE: 7/12/2014
Made an acrylic case for the amp - laser cut 1/8 in green translucent.

Raster etch logo is clip art of a sound wave mirrored on each side of the text; text in Boombox TTF font, converted to curves. 




Jun 17, 2014

Back in Black - a DIY raspberry pi Boombox: Inspiration





One of the items on my geek bucket list has been to build my own version of a boombox. The boombox was introduced by Philips in 1969. Refinements were introduced by Japanese manufacturers and introduced to the US in the 70's. They became a hit with urban youth. By the 80's, boomboxes had reached an age of gigantism - bigger, blasty, bassy. See the Wiki for det's.

My desire was to build a box that echoed back to the old school days, but took modern design cues. I wanted a box that looked good, sounded good (well, loud, anyway) and I could customize easily.

As a prototype, I built the Day & Night Sampler, a little music player in a re-purposed tin box. The "Back in Black" (BinB) Boombox started with what I learned in that build and grew from there. This was a journey, where I made several prototypes to visualize what I thought the boombox needed.

I reached a point where I was happy with the basic frame of the BinB, but it was missing something - the magic something i like to call 'minimal viable blinkenlights'. It just had to have flashing LEDs.

I had read (and experimented with) John Boxall's tutorial on using the Sparkfun Spectrum Shield. The Spectrum Shield works with an Arduino to display two channels of 7 audio frequency bands each. I used a VFD to test the Spectrum Shield display. It worked, but not very dramatic.

About this time, I saw the work of David J. Watts on Adafruit's Show & Tell Hangout. David presented a very creative small boombox.  His used the MSGEQ7 IC, which is also the heart of the Spectrum Shield, to display the frequency bands on a matrix of LEDs. Hmn... John Boxall showed how to do that with a Freetronics Dot Matrix Display, also an LED matrix. "What a minute! I have a Sure 0832 LED matrix someplace in inventory...[rummages around for awhile]... Yeah, here it is. I can use that to look like the graphic equalizer on old boomboxes."

But it was still missing... something. Well, what if I put in some Adafruit Neopixel Rings where the tweeters would normally go on a boombox? Googled around a bit and discovered the work of Chris Wilson on youtube, using an Adafruit Neopixel Strip as a VU Meter.  Perfect. A few easy tweaks to Chris' code and I had Neopixel rings bumpin' in blue to the beat.

And the name... What could be more iconic of an era than the 1980 release of "Back in Black" by AC/DC? Plus, my boombox was black... REALLY black... extreme GLOSSY black. 

Bill of Materials - Next










Back in Black - a DIY raspberry pi Boombox: Bill of Materials

See the Inspiration section.

Bill of Materials

The BinB Boombox reuses many of the components from the Day & Night Sampler build:

  • raspberry pi; I got mine from mcmelectronics.com, $35 plus shipping
  • Patriot WiFi USB dongle, model PCWUSB1150, on sale at Fry's, $7.99; 
  • adafruit perma-prototype board, part ID 723 $5.95
  • adafruit Vacuum Fluorescent  Display 20 Char x 2 Lines, part ID 347 , $29.95 (Since Discontinued!)
  • adafruit panel mount 2.1 mm DC barrel jack, part ID 610  $2.95
  • Syba (C-Media) USB sound adapter, available at amazon.com $7.99
  • 3.5mm headphone extension, male-to-male, under $5 on ebay
  • USB Short Extension cable, Type A Male to Female, about $3-5 from ebay; use with the C-Media USB sound adapter
  • adafruit 8 Bit (TTL) Logic Level Converter for interfacing the VFD to the pi, product ID 735, $1.50
  • adafruit mini remote control, product ID 389 , $5; Or, any surplus remote control you have
  • IR Sensor, TSOP38238, available at adafruit, product ID 157 , $1.95; also Mouser and others
  • SDHC Card, available at adafruit and others, adafruit part ID 102, $7.95
  • Lighted push button switch, about $4.00
  • Misc jumpers and wire
New or changed for this build are:
  • Enclosure/Frame - I used an 18in x 24in sheet of 1/4in black cast acrylic, $45 at Tap Plastics
  • 12V Power Adapter - 3 A or above with 2.1MM DC Plug output (mine was from inventory)
  • Optional - battery; recommend a 12V SLA (Sealed Lead Acid), but will add significant weight
  • Adafruit UBEC - Universal Battery Elimination Circuit to step 12V down to 5V, $9.95
  • Sure Electronics 0832/3208 LED Matrix - under $20 on ebay
  • Adafruit 20W Class D amp, $19.95
  • Adafruit 20W 4 Ohm Speaker (two needed), $14.95
  • Adafruit Neopixel 12 Ring (two needed) for the "VU Meters", $7.50 each
  • Sparkfun Spectrum Shield, $24.95
  • Arduino Stackable Headers from Sparkfun for the Spectrum Shield, $1.50
  • Additional 3.5mm male to male headphone extension (Spectrum Shield to amp)
  • Arduino Uno (substitute can be Leonardo/Clone), $24.95
  • Sugru, Hot Glue, E6000, double-sided tape to fasten things
  • Cable ties. Lots of them. Corral those loose wires.
Required Skills, Next





Back in Black - a DIY raspberry pi Boombox: Required Skills

For this project, you'll need a working knowledge of :
  • Adafruit's Neopixels
  • Rotary Encoders
  • Sure Electronics 0832 LED Matrix (or similar, such as the ones Adafruit sells); or the newer 3208 LED Matrix (differences explained below)
  • Sparkfun Spectrum Shield
Adafruit's UberGuide is an excellent tutorial on Neopixels. If you haven't worked with them before, this is required reading before you proceed. Neopixels have particular requirements - you can damage them by mishandling. Fair warning, read the tutorial.

Bob Rathbone has an excellent treatment on using rotary encoders with the raspberry pi. It can be downloaded from his site (PDF).

For the Sure Electronics 0832, I pieced together information from several sources. Although Sure still makes this LED Matrix, they have rev'ed the hardware. I'm including my findings here as legacy documentation.

The models are confusingly referred to sometimes as 0832, but also as 3208. The older 0832 model uses libraries for the HT1632 chipset; the newer 3208 uses the HT1632C chip set. As far as I can tell, the changeover to the new HT1632C occurred somewhere in the 2010-2011 time frame.  Per this blog based on the setup routine I used successfully,  I was using the 0832. My matrix was identified on the back as DE-DP10XV110. Newer models sport a DE-DP13111 / DE-DP13211 number on the back.  A good write-up on the Sure LED Matrix is available at makehackvoid. The color-to-model designation for the older 0832 seems to be:

  • DP104 = Red
  • DP105 = Green
  • DP106 = Yellow
(from milesburton.com)

I used the HT1632_LedMatrix library available here, simply because I had used it before and it worked with the 0832.Adafruit has a library for the current (as of June 2014) Sure 3208 model.

The Spectrum Shield is straightforward to use - one 3.5mm jack is audio input, the other audio output. Remember to order stackable female headers for using this with an Arduino, available on the same page as the Shield. The code for using the shield in this project is included on github.

John Boxall has written an exhaustive book, Arduino Workshop. He's also provided the book sections online. For the boombox project, I learned from John's work in Chapter 48, MSGEQ7 Spectrum Analyzer, using the Sparkfun Spectrum Shield. We'll be using that chapter later on in the build as a source for a test Arduino sketch.



Initial Setup, Next

Back in Black - a DIY raspberry pi Boombox: Initial Setup

Start with the Software Installation for the Day & Night Sampler. Put a test system together with breadboard and wire jumpers - you can use that as a model to refer to when you make the real deal. Really. Not kidding, here...

Oh, back already? That was fast!

Let's keep going...

By this point, you should have a working raspberry pi mpd system. You need this first, before you proceed with the installations on this page. That gives you a known good starting point which will help when you need to debug things.
If you followed along with the previous build, you should have a raspberry pi, that will:
  • display "Now Playing" song title
  • respond to remote button presses
  • produce sound from speakers (either test speakers or the one's you'll end up using)
If not, troubleshoot it! Most common problems are loose or poorly connecting wires; insufficient power; something missing from the software installation.

It's working? OK, continue..

Make the following changes.

To install the code, download it from here: thisoldgeek rpi-boombox

For code running on the raspberry pi:
  • Delete /etc/init.d/rpi_boombox.
  • Install the python scripts for rpi_boombox_v2.py and rotary_class.py in /home/pi
  • You should haven already installed VFD.py in /home/pi if you followed the above instructions
  • Save the rpi_boombox_v2_init.sh script in a directory of your choice; instructions for installing this script are on this page
    • Make sure you change any reference in those instructions from rpi_boombox to rpi_boombox_v2
For code running on the Arduino:
    • Download the HT1632_LedMatrix Library from github (not my repository)
      • This is for the Sure LED 0832 Matrix. If you want to use a different LED Matrix, you will need to adjust which library you use and, most likely, some Arduino code
    • Copy the HT1632_LedMatrix lib to your sketchbook/libraries folder
    Gather the new Hardware
    There are three new pieces of hardware to get working:
    • Neopixel 12 ring(s) (two needed)
      • Solder wires to GND, +V and Data In
    • Sure 3208 LED Matrix
    • rotary encoder - you can solder a small protoboard like the picture below and reuse it again for your final build

    Also, there are added jumper wire connections to the GPIO's of the raspberry pi:
    • 3 pins for the rotary encoder
    • 1 pin for a HIGH/LOW toggle switch to the arduino
    Test the Spectrum Shield
    Solder up long female headers to the Sparkfun Spectrum Shield and plug it into your Arduino. By now, you should have read John Boxall's MSGEQ7 Spectrum Analyzer Tutorial, number 48 in his series of tutorials. Download example 48.1 to your Arduino. Connect a 3.5mm headphone extension cable from the USB sound dongle on the raspberry pi to the input of the Spectrum Shield. With a serial monitor running on your Arduino, do you see audio frequency values rolling by? Good!

    Test the Neopixels
    • Copy the sketch boombox_music_visualizer.ino to your sketchbook folder
    • Start Arduino and upload the boombox_music_visualizer.ino to your target Arduino board
      • The LEDs are set to ON on startup in the sketch. Change led_toggle to read like the following line to force them OFF on start;
        int led_toggle = 0; // takes input from Rpi to turn lights on/off
      • Unplug your Arduino
    • Run a jumper wire from raspberry pi pin  to pin X on the Arduino
      • This will toggle ALL the LEDs HIGH/LOW (ON/OFF) from the Arduino
    • Attach a single NeoPixel to the Arduino
      • DIN = Pin XX, GND to GND, +V to +V
    • Restart the Arduino, with the toggle jumper, NeoPixel and headphone extension in place
    • Play some music through the raspberry pi, gradually increasing volume; you should see the NeoPixel react

    Make the Frame, Next