Thursday, June 28, 2012

Bullduino Unboxing

RedBullCreationFour days ago I learned of the Red Bull Creation contest.  I thought “Cool.  It’s great to see caffeine pushers out inspiring minds to be creative!”. 

Then I went to their website.  It was immediately clear that these guys mean business and they have some serious talent working on their behalf.  The retro OS site is probably the coolest thing I’ve ever seen on the web.  Have you ever been to a web site that has a command line shell for navigation???

shellIf you fill out the application and they pick you as a contestant then you get a really cool Red Bull custom Arduino microcontroller board.  So, I filled out the application without really thinking what I would build.

Yesterday, I received an email saying that they were sending me a Bullduino and I had until July 3rd to build something and submit a video!  That’s seven days to come up with an idea, build something, and then create a two minute video.  Two of those days are on a weekend.  I’ve spent that much time just putting together the video for other contests. 

My first thoughts were that the board wouldn’t even arrive in time to even start building.  Forget having time to order parts.  Then it occurred to me that this is all part of the plan.  In the final round, the top entries that are submitted will have Red Bull camera crews come to their house/shop/hackerspace to film them for 72 hours as they build their final entry.  This is not a contest where you have three months to polish something off.  This is a contest of off the cuff ingenuity.  Love it. 

So, it would seem that this first round has the same theme – think fast and build something great using only the parts you have lying around or can round up quick.  This wasn’t really in my schedule for the weekend before Independence Day but maybe a light bulb will go off and I’ll come up with an idea that I can do quickly.

To my amazement, the board was shipped overnight and arrived today!  Maybe there is hope that I can salvage a project out of it.  The packaging of the board and the board design continued the high quality precedent set by the website.  I’m starting to get a little excited about this now.

2012-06-27 22.11.41Inside a FedEx overnight envelope was a thin brown box with the wise words of Yoda laser etched into the brown cardboard cover – “TRY NOT.  DO, OR DO NOT.  THERE IS NO TRY.”  I’ll be framing that for my office :)

Awesome!  Getting a little more excited.  The cover is held on with some weak double-sided tape to reveal the Bullduino that hides inside.

2012-06-27 22.10.58

How cool is that?  Immediately, I’m thinking “Battarang?”  Down boy…we only have six days left.  Hmmm…

The case is a four-layer (plus the top) laser cut corrugated cardboard sandwich that’s taped on the edges.  Nice and simple yet very elegant.

Taking out the board, reveals yet another surprise.  Underneath the PCB, on the bottom of the box, is laser etched “YOU’LL NEED THIS TOO:  goo.gl/eB7on”.  Following the URL leads to a download for the Bullduino.inf driver file.

2012-06-27 22.09.07At this point, I just had to plug the board into a USB cable and install the driver.  Once it was plugged in, two green LEDs illuminated.  The top one started flashing a pattern that repeated after 10 seconds or so.  I realized this must be a Morse code message.

Despite over 15 years in Boy Scouting, I’ve never learned to read Morse code.  So, I made a video so I could slow it down.

Even by slowing the video down to 1/8th speed it proved to be a challenge for me.  After play/pause/rewind… for about 20 minutes, it then occurred to me that someone has probably already figured this out since I was so late to receive my board.  Sure enough…the folks over at the Harford Hackerspace already cracked the code and determined that it says “‘Wouldn’t lou prefer a good game of chess?”  They speculate that the “lou” may be a clue to something else hidden in the board.

2012-06-27 22.09.39Back to the board…well, actually the backside of the board.  The main processor is a ATMEGA3282012-06-27 22.10.20.  Of course, it has an Arduino pin form factor.  A few things immediately jumped out at me as unusual.  First are the three sets of pads in the middle of the board labeled “CONN5”, “CONN6”, and “CONN7”.  At first glance, I’m not sure what these are for.  They certainly aren’t standard on any Arduino I’ve seen.

Secondly, in the top left corner is a little yellow round part.  It is the reset button.  They definitely decided this would be a good place to save a few bucks.  It takes a little more effort to get a good press on it than it does a normal momentary switch used on most Arduino boards.

That’s all for now.  Now to figure out what to do with it!  Let the fun begin!

Monday, May 14, 2012

Love Letter to Plywood

by Tom Sachs

Some well illustrated tips for beginners.  I love the production.

Saturday, April 21, 2012

I made the team! - The Make: Beta Team

I woke up this morning to a great surprise.  I received a letter from Make: magazine informing me that I’d been selected as one of the members of their new beta team. 

I’m honored and excited to be a member of this team of about 100 members worldwide that will have the privilege of building projects for the magazine before the articles are published as a way of beta testing the build instructions. 

Make: decided to start this team back in March and I thought it sounded very much in-line with what I do in my spare time anyway so I filled out the application.  Apparently, so did about 1100 other folks.  So, I feel very lucky to have been chosen.

Make: Volume 29 Cover ImageWhat does this mean?  Well, I don’t fully know yet.  What I do know is that I’ll randomly be delivered a project and all it’s parts & pieces and asked to build it and discover if the instructions need to be improved and report back.  We get to keep all the projects and part of our job is to show them off to friends & family and get input back.

We’re allowed to blog about our experiences building the projects. So, be looking to hear all about it here and I’ll be looking for feedback from you.  It’s not clear to me yet whether we can blog while we’re testing or after the magazine has been published.  So, check back every day just in case ;)

Make: can be considered the handbook of the Maker Movement.  If you’re not familiar with this movement, there’s a good overview of it here.  I’ve been a Maker all of my life.  In the past we’ve been called tinkerers, hackers, warranty voiders, nerds, geeks….  I like this new name and the positive movement that it has created. 

Get up and go make something!

Tuesday, April 17, 2012

Getting Started With a FEZ Hydra Basic Kit


I’m teaching a NETMF Gadgeteer lab for the Nashville .NET User’s Group this week.  Our gracious sponsors have purchased several FEZ Hydra Basic Kits made by GHI Electronics that we’ll be using to introduce everyone to the Gadgeteer world.

The FEZ Hydra Basic Kit consists of:
So, the challenge is what can we build with just these components?



THE PLAN
We’re going to build a simple project that will use the green LEDs on the outer ring of the LED7R module as a gauge to show the light level that is reported by the LightSense module.  In the center of the LED7R module is a bright red LED.  I’m going to use the Joystick module to vary the brightness of this LED.





CREATING THE PROJECT
Before we can start assembling pieces and writing code, there are some prerequisites that we need to ensure you have on your laptop.  Install all of these if you don’t have them already.  Make sure that you are running the latest versions.
  1. Visual Studio 2010 (or later).  Any flavor will do including Express.
  2. Microsoft .NET Micro Framework v4.1 SDK.
  3. GHI NETMF v4.1 and .NET Gadgeteer Package
imageNow that we have all of the bits installed, open Visual Studio and go to File –> New –> Project.  From the “New Project” dialog, we’ll choose the “Gadgeteer” section underneath the “Visual C#” group and we’ll create a new project using the “.NET Gadgeteer Application” template.

After we click “OK”, a new Gadgeteer project will be created and the Gadgeteer GUI designer appears showing an image of the FEZ Hydra mainboard.  If we open the Toolbox we will see a list of modules under the “GHI Electronics” section.  We’ll select the Joystick module and drag & drop it onto the white area somewhere around your mainboard.  Then we’ll do the same for the LED7R module and the LightSense module.

imageIf we left-click on the socket (the orange box) on our module then compatible sockets on our mainboard will be highlighted in green.  We can then drag the connector to the compatible socket that we want to plug the module into and click.  The sockets will then turn blue and a blue wire will be drawn between them.  Repeat for the other modules.
image
Now we’ll connect our physical components & cables up to match the connection decisions we made in the GUI designer.  Also, we’ll plug our SP power module (the red one) into the D socket (#2) and connect the USB cable to it and to our computer.

image
TIP: The name below each module in the GUI is the variable name that you’ll use in code to reference the module. If you want to change it, you can do so by click the name in the GUI a couple times to get into edit mode. If you change it after code has been written then your code will automatically update.


Let’s write some code!!!


HELLO WORLD!
Now that everything is connected and powered up, we should see a red LED on our power module, on our mainboard, and on our LED7R module.

imageNext, let’s make sure that our project is configured to run on our Hydra and not the emulator.  In the Solution Explorer, we’ll right-click on our project and go to Properties.  In the Properties page, choose the “.NET Micro Framework” tab on the left.  We’ll choose the “USB” Transport option.  When we do this, the “Device” should automatically populate with “FEZ Hydra_Gadgeteer” (assuming we only have one mainboard connected to our PC).  Save your options and close the page.

Hit F5!  If everything is connected correctly, the default program should compile and deploy to the Hydra and in our Debug Window we should see a lot of memory information flash by and then finally you should see…
image

If you don’t then it’s time to call for help


imageLED7R MODULE
We’ll start by writing a quick test of our LED7R module.  Note that I have renamed my module from it’s default name to “led” in the code below. 

The LED7R module has the following methods available to it:image
Animate() Cycles through all the LEDs on the module in a circular pattern. There are parameters to determine speed, direction, whether the lights are to be turned on or off, and an option to leave the lights on or to turn them off before moving to the next one.
TurnLightOn() Turns an LED on. It has one parameter – the number of the LED to turn on. Note the “D” numbers printed next to the LEDs on the module. They are the index numbers.
TurnLightOff() Turns an LED off. Same parameter as TurnLightOn().

Let’s add some code to test out our LEDs.  In the Program.cs file in ProgramStarted() let’s add the following code below the Debug.Print line that was added automatically.
   1:  // Cycle through the lights to show we're alive.
   2:  led.Animate(100, true, true, false);
   3:  led.TurnLightOff(6);  // a bug causes the last light to stay on...

Hit F5 to compile, deploy, & run the code and you should see the LEDs on the module light up in a clockwise direction.


imageLIGHTSENSE MODULE
Now that we know our LED7R module is working fine, let’s do something with our LightSense module.  The LightSense module has two methods.  Both are used for polling the sensor to capture it’s settings.

ReadLightSensorPercentage()Returns the light level as a percentage value from 0.0 (dim) to 1.0 (bright).
ReadLightSensorVoltage()Returns the light level as a measure of voltage from the sensor (0V-3.3V).

As you can tell from the methods, to do anything with the meter we are going to have to poll it on a regular basis.  For this we’ll need a timer.  At the bottom ProgramStarted() let’s add the following:

   1:  // Light meter 
   2:  var timer1 = new GT.Timer(100);
   3:  timer1.Tick += OnLightMeterTick;
   4:  timer1.Start();

And let’s add a new function to our Program class…

   1:  private void OnLightMeterTick(Timer timer)
   2:  {
   3:      var lightLevel = (int) lightSensor.ReadLightSensorPercentage();
   4:   
   5:      for (var ndx = 1; ndx < 7; ndx++)
   6:      {
   7:          if (ndx <= lightLevel/100.0*7)
   8:          {
   9:              led.TurnLightOn(ndx);
  10:          }
  11:          else
  12:          {
  13:              led.TurnLightOff(ndx);   
  14:          }                
  15:      }
  16:  }

Run the code again and you should now see the LED7R do it’s initialization loop and then the number of LEDs lit should vary depending on the brightness that the LightSense is reading.  Try moving your hand over the LightSense module.  The number of LEDs lit should decrease.

Having fun yet?


JOYSTICK MODULE
It’s time to put our hands on this thing!  I bet you never thought you’d be able to actually touch a C# project :D 

The Joystick module moves in X & Y directions and has a button we can use when the stick is pushed downward.  We’re going to use the Y (up & down) direction of the Joystick to dim the red LED in the middle of our LED7R module.  Fully explaining the Joystick module is beyond the scope of this post.  I’ll do that in the near future.

But wait!  If we take another look at the LED7R module we’ll notice that there isn’t a method we can use to dim LEDs.  What to do?  We’ll use an optical trick called persistence of vision (POV) to make the LED appear dim by using a timer to pulse the light on & off many times per second and vary the length of time that it is on between pulses.

Add the following to ProgramStarted():

   1:  // Monitor joystick to update red LED brightness.
   2:  var timer2 = new GT.Timer(10);
   3:  timer2.Tick += OnRedBrightnessTick;
   4:  timer2.Start();

And let’s add this new function to our Program class…

   1:  void OnRedBrightnessTick(Timer timer)
   2:  {
   3:      led.TurnLightOn(7);
   4:      Thread.Sleep((int)(joystick.GetJoystickPostion().Y*100)/20);
   5:      led.TurnLightOff(7);
   6:  }

Run the program and now when you move the Joystick up & down you should see a slight variation in the brightness of the red LED in the middle of the LED7R module. 

Surely, you’re having fun now???

You may be asking yourself why we used Timers instead of just putting a loop in our ProgramStarted() event.  This is one area where Gadgeteer is very different than traditional NETMF projects.  Read this blog post for an excellent explanation and you’ll save yourself some frustration down the line.


WHAT NEXT?
Well, that’s up to you!  I’ve given you a simple example of a couple things you can do with the FEZ Hydra Basic Kit.  Now, take this example and improve it or come up with something better (a game maybe?).  Be sure to leave a comment on this post and tell me what you did or even better post a link to a video.

Have fun!

Download the complete project source here.

Wednesday, January 25, 2012

Quick Tip: Making Momentary Buttons Breadboard Friendly

2012-01-22 22.40.41Momentary buttons are probably one of the most common components in most projects.  Unfortunately, most buttons are not made to be inserted into a breadboard.  Most do line up and some will work if you are very nice to them.  However, the pins are normally curved and very short so their ability to connect with the breadboard is very marginal and can lead to problems that may at first seem like issues with your microcontroller or the button itself.  More than likely the issue is really just that the button isn’t making good contact with the circuit.

2012-01-22 22.42.58To eliminate this problem from my projects, I use the following process to make the buttons breadboard friendly.  I recommend keeping a set of these specifically for breadboarding to save you time down the road.  However, if you need to you can certainly reverse these modification later to use the buttons in your final product.

Basically, what I do is attach extensions to the “pins” coming from the button so that they fit tighter and deeper into the breadboard.  This is certainly not an original idea.  Many before me have done the same.  However, since I was making up several of these recently I decided it would be good to document and reference later for others getting started in electronics.

2012-01-22 22.45.29I start by getting a piece of male pin headers – one for each pin on the button.  Hold the plastic housing with your fingers or a pair of pliers and then using some needle nose pliers, pull the pins out of the plastic.  These pins are much more rigid than just wire and are easier to insert into the breadboard without worrying about them bending.
2012-01-22 22.52.11Once you have the pins out, find the holes on a spare breadboard that align with the pins of your button and insert the new header pins into these holes.  Only push them in far enough that they are secure and try to make sure they are all sticking up the same height.  We use this technique to ensure that when we solder the pins to our button that they will line up perfectly with the breadboard.

2012-01-22 22.57.48Next, we will place the button on top of the standing pins and align it so that the buttons pins are on the outside of the new pins.  We’ll next add some alligator clips to hold the two parts together to be soldered.  So, don’t be overly concerned about getting everything perfect at this point.  You may need to bend the pins on the button out just slightly to make them easily fit on the outside of all the new pins.

2012-01-22 23.05.09Using the alligator clips, secure one corner on properly.  Make sure that the new pin extends as high up on the button’s pin as possible so that we get good contact at least on the top & bottom of the button pin.  If there is a curve or loop in the button pin, don’t worry about trying to straighten it.  It will not be a problem.  That gap will easily fill in with solder.  Once you get one of the clips on then do the opposite corner and then the other two pins.

2012-01-22 23.10.07Now that you have everything secure, it’s a simple process of soldering all the pins together.  You may accidentally solder your clips to the pins.  This is not a problem.  A simple touch of the soldering iron will cause it to release without undoing the main solder joint if done quickly.  Be careful, the clips can get hot quickly in this process.

2012-01-22 23.10.37Now you have a button perfect for use in a breadboard that you can depend on to give you a good connection to the rest of your circuit and loosen with use. 

This same technique can be applied to many types of components with similar types of connectors that are not necessarily breadboard friendly. 
Enjoy and please share your projects or suggestions in the comments!

Wednesday, January 4, 2012

Making a Gadgeteer DaisyLink Extender Module

LEDModuleChainI’ve been working on designing a .NET Gadgeteer DaisyLink module for a project I’m working on and ran into a limitation of the GHI Extender module that I thought warranted an improvement (aka “hack”).  I’ll detail the steps I took to convert a GHI Extender module into a DaisyLink Extender module in this post.

In case you’re unaware of what DaisyLink is…in a nutshell, it’s a way to chain together Gadgeteer modules so that you only have to use a single socket.  An example of such a module is the GHI Smart Multicolor LED module.  On a DaisyLink module there are two sockets – the upstream socket (the one going toward the mainboard) and the downstream socket (the one going away from the mainboard). 

The communication for DaisyLink happens using the I2C protocol and a neighborhood bus.  It isn’t the intent of this post to explain in detail how DaisyLink works.  For that info, see the .NET Gadgeteer Module Builders Guide.  However, I mention this because the neighborhood bus is the reason for this hack.  All the pins in the two sockets on a DaisyLink module can be passed straight through from one socket to the next except the neighborhood bus (socket pin #3).  This pin has to be activated/deactivated independently as this is the mechanism that the mainboard uses to identify which module it is communicating.

ExtenderModuleThe GHI Extender module is in my opinion the most useful of all Gadgeteer modules since you can basically do anything with it.  Before I started understanding how DaisyLink worked, I always assumed that the Extender module had two sockets on it so that it could be used to develop DaisyLink applications since I otherwise see no application for the other socket except as a way to tie two cables together.  The pins on the two sockets are directly connected together and to a header on the edge of the module.  As I mentioned above, this is a problem since I need to be able to control the value of pin #3 independently on each socket.  So, it’s time to pull out the soldering iron!

2012-01-03 21.57.15.highlightedIf you flip the Extender module over and rub the solder mask a little to polish it, you will see the circuits.  I’ve highlighted in green the circuit for pin #3 that goes to both sockets and to the header pad.  Note that the left-most junction is where the circuit connects to what we will refer to from now on as the downstream socket.  We’re going to add an additional pin to the header called “P3*” (since * is used by Gadgeteer to denote downstream sockets) and make the header labeled “P3” only connect to the upstream socket pin #3.

2012-01-03 21.59.20

 

We’ll begin by using a box cutter or Xacto knife to scrape the solder mask off the circuit on both sides of the junction we want to bypass.

2012-01-03 22.05.37

 

 

 

Next, we’ll use the box cutter to make four deep cuts through the copper circuit we just exposed and then we will remove the sections.  The cuts to make are shown in red on the picture to the right.  Remove all the copper between each set of parallel cuts.

2012-01-03 22.28.37

 

Now that pin #3 of the downstream socket has been isolated, we need to connect the two circuits that we just cut back together so that the upstream socket pin #3 will be connected to the “P3” header.  Start by using the box cutter to scrape a little more of the solder mask off the copper on the right side of the top circuit we cut and below the bottom circuit we cut.  Now, take a thin wire and solder it to the two pieces of exposed copper.  If you have some Kapton tape to stick down the wire while soldering, it will make it a lot easier.  However, you can manage it w/o if necessary.  It also helps if you tin the wire with some solder before attempting to connect it to the PCB.  You will probably not get a large bead of solder to stick to the tiny piece of copper.  As long as you get enough so that the wire is secured that will be sufficient.

2012-01-03 22.37.32We’re done on the back side of the PCB.  Next we’ll attach the male headers to the board.  Although the module has 10 header holes, we will need a section of header that has 11 male pins.  To make it easier to solder every square, put the header into a spare breadboard and put the Extender module on top.  I also like to put an extra piece of header underneath the module on the other side to give it some support and help ensure it stays flat.

Take a small piece of thin insulated wire and strip a very small amount off one end and tin it with some solder.  We’ll solder this to pin #3 of our downstream socket.  Note that in the picture on the right, pin #1 is in the bottom left corner of the socket.  All the even numbered pins are in the top row and the odd numbered pins are on the bottom row.  So, pin 2012-01-03 22.47.16#3 will be the second pin on the bottom row.  It will greatly simplify soldering if you have a tiny alligator clamp that you can clamp the wire to the PCB so that the exposed end of the wire is lying on top of the pad for pin #3 as is shown in the picture.  If you have a flux pen, it would be a good idea to add a little flux to the SMD connectors before soldering.  However, if you take care and get it done in one heating you should have no problems w/o additional flux.  Use your soldering iron to heat the wire and pad so that the reflowed solder connects the two together.  You may need to add a tiny amount of additional solder.  Just be careful not to bridge any of the other pads.  Solder the other end of the wire to the extra header pin.

2012-01-03 23.14.05Let it cool a few seconds and then you can remove it from the breadboard.  Take caution when removing it as the extra header pin could easily snap off if torqued side-to-side.

Finally, to help protect the uninsulated wire we added to the bottom side of the board I created a label in Excel and printed and taped it to the underside of the board to help label the extra header in case some day years from now I forget why it’s there.

Now that I have a good way to prototype, it’s time to go finish my new DaisyLink module!  Thanks for stopping by.