My Bluetooth Ambient ORB



This web page details a journey I once took that added the ability for my computer to relay email status information to my ambient orb over bluetooth.  This may sound silly since the ambient orb already does this (minus the bluetooth), but I hope after reading this you understand my motivation. 

Once upon a time (about three days ago, err, probably much longer by now) I was given an ambient Orb as a gift.  Lately, I have been obsessed with these sorts of devices as I am on a quest to add “smart insides” to everything that I can.  For those of you who don’t know about the ambient orb, checkout their website www.ambientdevices.com .   Yes, it is over priced and maybe even slightly useless, but it is a neat idea.  What could possibly be better then LEDs and glass??? I’ll tell you what. LEDs, glass and a service that actually works… Unfortunately for me, when I tried to register with AMBIENT devices DOT COM,  I was denied.  Not a valid serial number!!!  Bastards... The one time I actually pay for something (or someone does on my behalf) I am denied.  Even so, to get personalized email, you have to pay an extra fee!!! This taught me a lesson.  So instead of calling them up and complaining, I decided I would take things into my own hands.  It took me about 45 seconds before I reached for a screw driver and cracked the sucker open.


           
                      3 Pieces of the ORB                                                                   The Heart of the ORB


                     
                                            Glow Circuit board glow...                                                           Weapon of Choice


The above picture details what I found.  To my surprised, the people at ambient devices want people to hack around with the orb!  Okay cool, they just dissipated any built up hostility from the early denial of my right to service.  Check out this nice website they made for people who want to know more about the guts of the orb: http://www.ambientdevices.com/developer/  There is a simple ( yet strange,since they want everything to be ASCII visible ) serial protocol.  Check out the “Documentation” document (yeah, I don’t know) for the orb.  Once you get passed all of the spelling mistakes (can’t blame them, I can’t spell either) you find that they have made it fun and easy to control over serial.  They even sell you a “DIY serial port adapter”.  I would say you are better off making it yourself, but it would be nice to have their cable. I decided to skip that intermediate step and just install a serial Bluetooth module that would use the TTL signal instead of the level shifted serial.  Below is a picture of the bottom of the board with some key points that you might want to solder wires onto.  Also, here is the header schematic from their documentation.


                                

                                          The Bottom of the ORB                                                                        ORB debug port schematic


After some more reading, I discovered that I would have to pay a service fee if I wanted to have developer access to the orb.  Granted it would work anywhere, but it always just sits on my desk.  I could just run a wire, but that would be lame.  The ONLY option was to add Bluetooth.  Then I could use the JAVA C or even PERL to control it. The key was finding a Bluetooth module that supported serial and the 19,200 baud that the orb would use.  Turns out, I already had one made by AirCable that could do just that.  You can get this guy from www.aircable.net. Then you have to crack it open and do a bit more hacking.  You wouldn't believe how hard it was to open this little plastic box! At first it may resist, DON'T LET IT. I used a standard off of the shelf acetylene torch to light some thermite and a baseball grenade stolen from an army surplus camp to get things moving. Hopefully just some hard prying with a screw driver will work for you.


                         

    AirCable Module                      Thermite                           Grenade                                Oh yeah....                                    Ta DA!!!

Now, that we have the module, we just wire it up to the orb.  Below you can see a photo that illustrates some key wire placements... Click here for closeups


           


The tricky part is getting the board back in.  Sometimes it can be hard to force the board back into the narrow opening on the bottom of the orb.  Its especially hard now that it has that bluetooth dongle hanging off of it.  Try hard.  Don't give up. Use Velcro. Always wear protection. See the photo below.


            

                                      VELCRO!!!!!                                                                                   NATURE'S CHOICE!!!!!


Once the board has been inserted into the orb, you must screw it back down.  This is can be tough, but trust me it is worth while.  This is where the real magic happens.  You turn on the orb only to find that the power draw of the bluetooth causes the main microcontroller to brown out hence generating a flicker.  We need MORE power.  Smooth pure power.  Not the type you get from coffee, but the type you get from the wall.  Remember, volts are for jolts, its the mills that kill.  What we need here is more current.  Don't mess with the voltage, you could hurt yourself, or worse, the ORB.  Go out and find another 10-11 volt AC adapter and make sure it can pump out as much current as you can afford.  I got one from Radioshack that does about 850 mA at 10 volts.  However, I am just a poor graduate student.  For the rest of you in the real world, you should build something similar to what is shown below.


              Power ( *do not really use this on the ORB )


I think I finally settled on putting a 25 volt 3300uF  capacitor  across power and ground.  You could always run the bluetooth off of its own supply if you are really anal. So now we are just left with a programming issue.   I want my ORB to change color based on email, as well as maybe some other sensors laying around my office.  For now, I will just focus on the email because if I stop answering email, then for all intents and purposes I am gone.   Sadly, I don't really know how to program (not at this level anyway), so I decided to consult Adam Goode.  Please feel free to contact him at a moments notice for help with any sort of computer related problem.  He told me to use PERL... So I did, and it works.   Below are a few short random linux passages that enable bluetooth and the IMAP perl stuff.  Use this as a hint or something to search for on google.  Bear in mind that this was my second first perl program ever, so it may be terrible (isn't it always ) 

BlueZ bluetooth linux:
modprobe hci_usb
modprobe rfcomm
hciconfig hci0 up
rfcomm bind 0 00:80:37:B5:A8:3A 1
chmod 664 /dev/rfcomm0
chgrp uucp /dev/rfcomm0

PERL IMAP info:
http://search.cpan.org/~robm/Mail-IMAPTalk-1.02/IMAPTalk.pm#NAME

Below is my PERL program....

use Mail::IMAPTalk;
use Term::ReadKey;

$PORT_NAME = '/dev/rfcomm0';
$solid[0] = "~A *";
$solid[1] = "~A /";
$solid[3] = "~A 4";
$solid[4] = "~A 9";
$solid[5] = "~A C";
$pulse[0] = "~A\"q";
$pulse[1] = "~A\"v";
$pulse[2] = "~A\"{";
$pulse[3] = "~A#\"";
$pulse[4] = "~A#'";
$pulse[5] = "~A#+";

open(PORT,">$PORT_NAME");
print PORT "~GF";
print PORT "~R1";
close(PORT);
print "Name: ";
chomp($NAME = ReadLine(0));
print "Password: ";
ReadMode('noecho');
chomp($PASS = ReadLine(0));
ReadMode('normal');
$first=0;
while( true )
  {
    $IMAPServer = 'cyrus.andrew.cmu.edu';
   
    if($first==0)
      {
    $IMAP = Mail::IMAPTalk->new(
                    Server => $IMAPServer,
                    Username => $NAME,
                    Password => $PASS,
                    Uid => 1 )
      || die "Failed to connect/login to IMAP server";
      }
    $first=0;
    my $Res = $IMAP->status('INBOX', '(MESSAGES UNSEEN)') or next;
    $first=1;
    $msg_tot = $Res-> {"messages"};
    $msg_unseen = $Res-> {"unseen"};
   
    for($i=0; $i<3; $i++ )
      {
    if($msg_tot>5) { $msg_tot=5; }
    open(PORT,">$PORT_NAME");
    if($msg_unseen==0){ print PORT $solid[$msg_tot]; }
    else { print PORT $pulse[$msg_tot]; }
    close(PORT);
    sleep(10);
      }
  }




Last Updated:  12 / 17 / 04