Monday, March 21, 2011

New Project: HD Clock - Intro

So this week, I got DirecTV installed and I finally got rid of Comcast.  Were i live, the Comcast service is a joke and I'm paying a lot for their HD service that doesn't include much.  DirecTV on the other hand gives me a ton of HD and for the first year, I'm saving like $20 a month on my bill which includes all the movie channels.  Just in time for "Game of Thrones" Next month on HBO! (OMG!!!)  Well, one of the downsides is that my girl and I had really got used to seeing the time displayed on our Comcast receivers and the new DirecTV ones don't display the time, which ended up being very annoying.  The only other clocks in the house are our phones, our computers, or the clock on the stove in the kitchen.  This got me thinking as to what i could do with my Arduino to display the time.  My first though was, "Hell yes, a reason to do the Nixie Clock!" but my Girl told me i was on a tight budget for this project and i was all <sadface>.

So I've got $20 ish to spend on making each clock I need so I headed on over to Sparkfun.com.  Originally I planned on taking a look at LED matrix's to see what i could do with that.

My first though was to use a LOLshield since the led's were individually addressable and it fits right over a Arduino.  But as I was looking around sparkfun, i found these guys:

                                
They are a led matrix built into one common cathode housing that I think look awesome.  The tricolor one was bigger and a lot more expensive then the red and green version so as much as i'd like to get the tricolor it was out of my price range.  So i started looking up code for a LED clock.  In my search, i found this:


Its a Pong Clock using a version of the Arduino with the Real Time clock chip built in.  Each side looses on purpose as the time changes.  Hell yes!  A clock and a nod to my gamer roots, what more could you want?  So i dug up a version of the instructions and was dismayed to see how much I needed to get.  Because there were so many LED's to activate, i needed either a larger micro controller like the Arduino Mega or a bunch of stuff that was going to raise the roof on the price well outside my budget.  Poop.  So i dug around some more and was intreged to find these little gems.



The one of the left, the creator calls a Strobeshnik Digital Clock and it involves etching out numbers on a hard drive platter and spinning the disk so fast that the blinking led's underneath only turn on when the right number is over top them.  This happens faster that the human eye cant perceive and you see the correct time. That sounded awesome but the engraving part was something out of my area of expertise (note: my boss, Van, does metal engraving.  See what he might be able to do.).  The one on the right however uses a RGB led strip around the outside of the disc area and a notch, dremeled out of the platter which, because of the same high frequency blinking leds, show an Analog style clock with Hour, Minuit, and Second hands.  Now that sounded like something i could do and on the cheap since i have a huge stack of old dead drives at work.  Plus the parts required were dirt compared to everything else i saw.  I got enough parts to make three of these guys for $30, minus the Arduino controllers (forgot them this order), and two day shipping.  Right in budget!  Find a quiet enough drive in my stack and huzzah! heres our new clock.  Im going to be following the instructions from this Instructables documentation and documenting my success's and failures.  Once i get things the way I like, I plan on getting a few Arduino Mini Pro's  and work on packaging up this guy real nice like.  Thats it for now, I'll post again once i get the parts I need and can start working on this guy.  Later! 

Thursday, March 10, 2011

The Bluetooth Joystick Project Part 2

Its finally done! It needs a few tweaks here and there to clean it up some but for all purposes, its good to go.  This post is going to be long winded and light on the pictures, but I'm going to try to convey what I've learned over the last few days.



Ok quick recap! When we last left off, I needed to look into the software side of interfacing between my Arduino and my Android Phone.  I needed to be able to assign keys in the SNES Emulator app, SNesoid, it looked like I needed to emulate a hardware keyboard. Theres an option for Bluetooth controllers in the app, but unfortunately its for devices that are identified as an input devices like keyboards. All I had was the modem so I needed to work around that.

After some digging around and finding some guys that had tried something similar but with actual Nintendo controllers, I had come up with a basic idea of what i needed to do. First, I had to get and install the Amarino Toolkit on my android phone. What Amarino does basically is receive data over the Bluetooth connection from my Arduino and present it to my Android phone as data it can use. Second I needed to take that data and use it to act like button presses on a keyboard. For this, I needed a keyboard app on my phone to take the data I was sending, read it, and press a button depending on what data it saw. Luckily for me a lot of this was already done and I just needed to modify it for my application.

The following files are needed before we continue if your following along.  Get them from the Amarino Toolkit website.
Amarino - Android Application
Amarino Plug-in Bundle 
MeetAndroid - Arduino Library

The Arduino side
Ok so I said I had found some guys that had already done a similar project using actual controllers.  This Forum Post and this guy's code basically explains the output from the NES controller.  How a NES controller communicates is by sending 8 bits of data (1 byte) to the console every button press and refreshing the information via a "heartbeat" timer every 16 milliseconds.  Each bit relates to a button press on a NES Contoler as there were only 8 buttons.  Up, Down, Left, Right, A, B, Start, and Select.   That data was sent in a string and looked like the following:
01111111 = A
10111111 = B
11011111 = Select
11101111 = Start
11110111 = Up
11111011 = Down
11111101 = Left
11111110 = Right
Notice the "0", thats the bit being turned off to represent the button press. Alright now I have the format of the data I needed but the code in that forum post was no good to me because it relied on the controller to send the data already formatted and timed.  I didn't have that so my Arduino would need to take care of that on its own.  My Next problem was that I needed a SNES controller instead of the NES.  Luckily, Nintendo didn't stray too far from the tree in that regard.  Easier to do what you know right?  The SNES controller was designed off the original NES but since it had four more buttons, the original 8 bit data couldnt handle it, so they bumped it to 16 bit.

01111111 11111111 - B
10111111 11111111 - Y
11011111 11111111 - Select
11101111 11111111 - Start
11110111 11111111 - Up
11111011 11111111 - Down
11111101 11111111 - Left
11111110 11111111 - Right
11111111 01111111 - A
11111111 10111111 - X
11111111 11011111 - L
11111111 11101111 - R

Notice that there are four more bits that can be used, that never were on the official controller.  I think they might have been left there for expansion, or for third party developers.  But in reality, its more likely that its just cheaper and easier to do the 16 bit processing that computer devices were already being designed around instead of developing a whole system around 12 bit processing.  Not to say it cant be done, but why not use what already being mass produced for the commercial market and save yourself the money. Plus it allowed for expansion and third party developers that you could make money off of without having to reinvent the wheel.  Those four bits would come in handy for me as I ended up needing them for diagonal directions.

The next part was coding the Arduino.  In my initial tests with the NES config, i was able to send char data and covert it to binary in the send command.  But once i had two bytes of data, i couldn't do the conversion anymore.  The way the meetAndroid library works it seems, is that for every send, its one line, and i needed to put two strings of data in one output.  Or at least, thats what I thought.  Then I realized, it didn't matter how I sent it, it was going to only be string data anyway because thats how the meetAndroid Library sends data.  So I cut out the middle man and put my string in a variable, then sent the variable.  This is what i came up with:

Note: dont load this code just yet...we still need to make one more change.

// Load the meetandroid Library
#include <MeetAndroid.h>
MeetAndroid meetAndroid;

// Store the Arduino pin associated with each input
// Select button is triggered when joystick is pressed

int PIN_BUTTON_SELECT = 2;
int PIN_BUTTON_START = 7;
int PIN_BUTTON_A = 3;
int PIN_BUTTON_X = 4;
int PIN_BUTTON_B = 5;
int PIN_BUTTON_Y = 6;
int PIN_ANALOG_X = 0;
int PIN_ANALOG_Y = 1;

// creat intergers to store the state of each button press
int VAL_SELECT;
int VAL_START;
int VAL_A;
int VAL_X;
int VAL_B;
int VAL_Y;
int VAL_updown;
int VAL_leftright;

void setup() {
  //start serial communications at 9600 baud rate
  Serial.begin(9600);

  // Initiate which pin is being read and internal pull-ups for that pin

  pinMode(PIN_BUTTON_A, INPUT);
  digitalWrite(PIN_BUTTON_A, HIGH);

  pinMode(PIN_BUTTON_Y, INPUT);
  digitalWrite(PIN_BUTTON_Y, HIGH);

  pinMode(PIN_BUTTON_X, INPUT);
  digitalWrite(PIN_BUTTON_X, HIGH);

  pinMode(PIN_BUTTON_B, INPUT);
  digitalWrite(PIN_BUTTON_B, HIGH);

  pinMode(PIN_BUTTON_SELECT, INPUT);
  digitalWrite(PIN_BUTTON_SELECT, HIGH);

  pinMode(PIN_BUTTON_START, INPUT);
  digitalWrite(PIN_BUTTON_START, HIGH);
}
// SNES Button Reference
// 01111111 11111111 - B
// 10111111 11111111 - Y
// 11011111 11111111 - Select
// 11101111 11111111 - Start
// 11110111 11111111 - Up
// 11111011 11111111 - Down
// 11111101 11111111 - Left
// 11111110 11111111 - Right
// 11111111 01111111 - A
// 11111111 10111111 - X
// 11111111 11011111 - L
// 11111111 11101111 - R
// My additions to it for this project
// 11111111 11110111 - Up Left
// 11111111 11111011 - UP Right
// 11111111 11111101 - Down Left
// 11111111 11111110 - Down Right

// NES Button Reference:
// UP = 11110111
// DOWN=11111011
// LEFT=11111101
// RIGHT=11111110
// SELECT=11011111
// START=11101111
// A=01111111
// B=10111111

void loop() {

  // reads the current value of each digital pin

  VAL_SELECT = digitalRead(PIN_BUTTON_SELECT);
  VAL_START = digitalRead(PIN_BUTTON_START);
  VAL_A = digitalRead(PIN_BUTTON_A);
  VAL_B = digitalRead(PIN_BUTTON_B);
  VAL_leftright = analogRead(PIN_ANALOG_X);
  VAL_updown = analogRead(PIN_ANALOG_Y);
  VAL_X = digitalRead(PIN_BUTTON_X);
  VAL_Y = digitalRead(PIN_BUTTON_Y);

  // start of the if/elseif/else chain to determin if the button is pressed and to send the string data to the Android Phone

    if (VAL_SELECT == LOW)
    {
      char controller_select[] = "11101111111111111";
      meetAndroid.send(controller_select);
    }
    else if (VAL_START == LOW)
    {
      char controller_start[] = "11110111111111111";
      meetAndroid.send(controller_start);
    }
    
    else if (VAL_A == LOW)
    {
      char controller_a[] = "11111111101111111";
      meetAndroid.send(controller_a);
    }
  
    else if (VAL_B == LOW)
    {
      char controller_b[] = "10111111111111111";
      meetAndroid.send(controller_b);
    }
    else if (VAL_X == LOW)
    {
      char controller_x[] = "11111111110111111";
      meetAndroid.send(controller_x);
    }
    else if (VAL_Y == LOW)
    {
      char controller_y[] = "11011111111111111";
      meetAndroid.send(controller_y);
    }
  
    // this part checks joystick position and sends the string data based on if conditions are met
    
    else if (VAL_leftright < 256 && VAL_updown > 256  && VAL_updown < 768)
    {
      char controller_left[] = "11111110111111111";
      meetAndroid.send(controller_left);
    }
  
    else if (VAL_leftright > 728 && VAL_updown > 256 && VAL_updown < 768)
    {
      char controller_right[] = "11111111011111111";
      meetAndroid.send(controller_right);
    }

    else if (VAL_updown > 768 && VAL_leftright > 256 && VAL_leftright <768)
    {
      char controller_up[] = "11111011111111111";                                                                                                                                
       meetAndroid.send(controller_up);}
  
    else if (VAL_updown < 256 && VAL_leftright > 256 && VAL_leftright < 768)
    {
      char controller_down[] = "11111101111111111";
      meetAndroid.send(controller_down);
    }

    else if (VAL_leftright < 256 && VAL_updown > 768)
    {
      char controller_upleft[] = "1111111111110111";
      meetAndroid.send(controller_upleft);
    }

    else if (VAL_leftright > 768 && VAL_updown > 768)
    {
      char controller_upright[] = "1111111111111011";
      meetAndroid.send(controller_upright);
    }

    else if (VAL_leftright < 256 && VAL_updown < 256)
    {
      char controller_downleft[] = "1111111111111101";
      meetAndroid.send(controller_downleft);
    }

    else if (VAL_leftright > 768 && VAL_updown < 256)
    {
      char controller_downright[] = "1111111111111110";
      meetAndroid.send(controller_downright);
    }
  
    // Final string data to be sent.  this says no buttons were pressed, do nothing.
  
    else  {
      char controller_null[] = "11111111111111111";
      meetAndroid.send(controller_null);
          }
  
  }
  
If you notice, theres actually 17 bits of data.  This is because when expanding the Keyboard app code to except 16 different if else statements from the original 8, something went wrong and my string being sent for the letter "B" wasn't being accepted.  I'm still not 100% sure why but I'm terribad at Java coding and don't understand the code very well.  It works, thats all i'm saying.  This code also doesn't have the Left and Right Shoulder buttons but using the data from the reference, it can be added with ease.  Its already been setup in the keyboard app for the phone.

The last part I needed to do is change the baud rate on the Bluetooth to match my code.  I had to slow it down to 9600 for two reasons.  1) the meetAndroid/Amarino app doesn't work well if you have you baud rate higher then 57600 and 2) the Arduino Uno SMD i was using apparently has a small issue that I was having intermittently running at 57600.  So I just dropped it to 9600 since its a good safe speed.  To change the baud rate on the Bluesmirf Bluetooth modem, you have to terminal into it.  For this I just used the BlueTerm app on my phone i used earlier.  Then i followed the following steps then loaded the sketch into my Arduino.  Again, when uploading to the Arduino, don't connect the Bluetooth to the TX/RX pins.  It wont work.

-Power up BlueSmirf
-Make connection through your Terminal and get the green led
-Type "$$$" before 60 secs from the power up, and it should respond with "CMD" and the red LED will flash
-Type "H" -> list of commands
-Type "SU,9600" -> to change the baudrate and respond "AOK"
-Type "D" -> Display settings to see the new baudrate.
-Reboot the BlueSmirf to make the change happen.
The Android side
Im not going to get long winded about the Android side because, to be honest, there's a lot I do not understand.  Makes me really wish i would have tried harder when I was learning Java programing all those years ago.  Ok so at this point, I installed the Amarino app and plugin bundle on my phone.  You probably don't need the bundle but its got some neat stuff you can output with if you want to play later.

Now, this is where my knowledge got fuzzy.  I wont copy/paste the code here because theres a lot of it and it  would go on forever.  But i will say that if you want to follow along, you'll need the Android SDK and Eclipse for the next part.  The Android SDK is the developer tools for writing Android apps and Eclipse is the Java code writing app that the SDK has been linked up with.  Both are free and opensource, which is awesome.  Heres the modified Software keyboard for you to download that I modified from this guys.  To open this project, unzip the file and import the existing project into the eclipse workspace.  Then find the softkeyboard.java under the src folder.  This is where all the programing takes place.  The only thing i did, was expand the existing commands at the bottom from reading 8 different strings to 16 (nes to snes) and add the variables for the SNES buttons.  Also, and this is important if you want to use the app for your own.  You will need to change the following line to match your Bluetooth's mac address:
private static final String DEVICE_ADDRESS =  "00:06:66:42:07:DD";
This line is near the top of the code and should be easy to find.  If you look toward the bottom, you'll also see how the code checks for where the "0" is in the string being sent, i think.  I seriously had no idea what was really going on but it worked. I tried to just expand on what was there by following the original code and expanding the If/Else statements but I did have a problem with the first one and thats why I added the 17th bit on the Arduino side.  It works, thats all I'm saying.  Maybe one day i'll clean it up when I learn more about Android programing but for now, it will have to do.  Once you made your Mac Address changes, export the program as a Android Application which will provide you with an APK file that you can copy to your phone's sdcard and instill.

Now to get the code to work, you'll have to follow the following steps.  First, fire up Amarino and connect it to you Bluetooth.  If everything working, you can launch the monitor and watch the commands being sent.  Second, install the softkeyboard app and select it as an input method under your phones settings > language & keyboard settings.  This gives you the option to switch your input method.  Third, fire up a text editor like ColorNote, or even just a text message and hold your finder down on the text input area.  A popup will show asking if you want to change your text input method. Change it to Sample Soft Keyboard and watch the top bar on you phone for the device to connect.  Once thats done, you can can test the joystick by hitting the buttons and moving the joystick.  If its worked up to this point, you'll start seeing text and numbers being typed out.  Lastly, fire up SNesoid, and bind the buttons to the programs Input settings.  You can now play Legend of Zelda!  Huzzah!

Bugs and other stuff
So not everything is perfect, and this still needs work but it is playable.  Not bad for a few days work going in blind. The biggest play issue I have right now is that the Joystick needs to be re-centered in order to move in different directions sometimes.  I'm not really sure where thats coming from.  It could be my baud rate, or my Arduino code, the code in my Keyboard, or even be the emulator.  It looks good and smooth reading the data in the Amarino monitor but who knows.  At this point though, I'm happy with what I've accomplished enough to put it down for a while until I learn some more about Arduino and Android programing.

The controller is still not 100% complete though.  I need to get it in a housing to protect it while its in my back pocket as well as make it a little smaller.  My idea of powering the joystick off the phone looks like it wont work but there are lithium ion battery packs that can be had and attached to a shield that easily attaches to the bottom of the joystick and can be charged over usb when needed.  Also, theres versions of the Arduino like the Mini Pro thats the same size as the Bluetooth modem used in this kit, that can help shrink the footprint.  I may end up doing that one day.  Finally, theres the shoulder buttons.  There are plenty of digital pins left that can be used easily.  Just get a right angle header or two and attach two buttons to breakout boards, add the code to the Arduino sketch and your good to go.  I've actually already programed the data into the softkeyboard app so its ready for the info.  Well thats It for now, if you were trying to follow along and need help, leave me a message and i'll try to get back to you, otherwise, see you next project!

Saturday, March 5, 2011

The Bluetooth Joystick Project Part 1

Huzzah!  I got my parts from sparkfun.com in the mail yesterday!  Weekend project, here we go!  For reference, the design of this project is to make a Bluetooth game pad to play The Legend of Zelda on my Android phone's SNES Emulator.



I started a few days ago planning out the details of my project.  Theres a lot that I don't know so its a total learning experience.  One thing i didn't consider before buying the parts was how i was going to connect everything up, theres only so many input pins.  So I put this together in paint to get a visual:



Ahh, good old mspaint.  Things look good and theres plenty of extra pins, no worries. 

If you can tell, theres a 5th Push Button Switch, identical from the others that wasn't in my original parts list.  This is because i totally forgot about the start and select buttons.  The joystick has a pushbutton built in that i'll use for select but i needed a separate start button.  Also, you may be wondering, if you are knowledgeable about SNES controllers, that theres no left or right shoulder buttons.  For now, i left them out but i do have room to put them in later. The original scope of the project though was to build a controller to play Legend of Zelda which happens to not utilize the Left or Right shoulder buttons.  Also, i'd need to find or make my own PCB in order to to place them in a spot that can be utilized as originally intended.  As for putting all the parts together for the Joystick, Sparkfun.com has a great tutorial on building the Joystick here.  I'm going to divert to this tutorial for this part of the project, they can explain thing and show them off better then I can anyway.

The next problem is where Im going to place the Bluetooth card in all this.  With luck the card is actually very small.  I guess i just didn't conceptualize it right but what i ended up doing was soldering it to the underside of the joystick PCB.  Like so:




Excuse my soldering job, I'm still learning.  As you can see in the pictures, i used some breakaway headers and attached it to the prototyping area.  Theres plenty of room, so much so that i was able to run lines around and under the Bluetooth modem.  Also as a note, the joystick board doesn't sit all the way down on my Arduino's headers due to the usb port, so i used that to my advantage while wiring.

Once i got the hardware all connected, i need to get configuation data from the joystick.  Sparkfun.com has an amazing tutorial to get started with their joystick here.  Again, i'm going to divert to their tutorial over explaining things here, its better then anything I work up as an amateur. 

The next part is getting the Bluetooth to connect to my phone.  For this project, I've found an app on the android market called BlueTerm by pymasde.es.  Its free and open source, which is awesome.  What we are going to do here is take what we've learned from Joystick tutorial and instead of outputting the data over the usb connection, we are going to forward it over the Bluetooth connection and see if the BlueTerm app will pick it up.  The great thing though is, we wont have to modify the code at all to get this to work.  The way I wired the Bluetooth modem is via the TX and RX pins on the Arduino board which should send everything we are doing to the modem.  One catch, you cant have the Bluetooth modem connected to the TX/RX pins while uploading, it wont work. I slightly modified their final code to add my new button and adjust the output:  
// Store the Arduino pin associated with each input
// Select button is triggered when joystick is pressed

const byte PIN_BUTTON_SELECT = 2;
const byte PIN_BUTTON_START = 7;
const byte PIN_BUTTON_RIGHT = 3;
const byte PIN_BUTTON_UP = 4;
const byte PIN_BUTTON_DOWN = 5;
const byte PIN_BUTTON_LEFT = 6;

const byte PIN_ANALOG_X = 0;
const byte PIN_ANALOG_Y = 1;


void setup() {

// Start the Serial connection

  Serial.begin(115200);

// Read the input from the digital pin (1 and 0)

  pinMode(PIN_BUTTON_RIGHT, INPUT);
  digitalWrite(PIN_BUTTON_RIGHT, HIGH);
  pinMode(PIN_BUTTON_LEFT, INPUT);
  digitalWrite(PIN_BUTTON_LEFT, HIGH);
  pinMode(PIN_BUTTON_UP, INPUT);
  digitalWrite(PIN_BUTTON_UP, HIGH);
  pinMode(PIN_BUTTON_DOWN, INPUT);
  digitalWrite(PIN_BUTTON_DOWN, HIGH);
  pinMode(PIN_BUTTON_SELECT, INPUT);
  digitalWrite(PIN_BUTTON_SELECT, HIGH);
  pinMode(PIN_BUTTON_START, INPUT);
  digitalWrite(PIN_BUTTON_START, HIGH);
}
// start the loop reading the pin data and printing that data over the serial conncetion

void loop()
{
  Serial.print("left:");
  Serial.print(digitalRead(PIN_BUTTON_LEFT));
  Serial.print(" ");

  Serial.print("right:");
  Serial.print(digitalRead(PIN_BUTTON_RIGHT));
  Serial.print(" ");

  Serial.print("up:");
  Serial.print(digitalRead(PIN_BUTTON_UP));
  Serial.print(" ");

  Serial.print("down:");
  Serial.print(digitalRead(PIN_BUTTON_DOWN));
  Serial.print(" ");

  Serial.print("x:");
  Serial.print(analogRead(PIN_ANALOG_X));
  Serial.print(" ");

  Serial.print("y:");
  Serial.print(analogRead(PIN_ANALOG_Y));
  Serial.print(" ");

  Serial.print("select:");
  Serial.print(digitalRead(PIN_BUTTON_SELECT));
  Serial.print(" ");

  Serial.print("start:");
  Serial.print(digitalRead(PIN_BUTTON_START));
  Serial.print(" ");

  Serial.println();
  delay(500);

}
 
First thing I did was pair the device like normal under the phones Bluetooth settings.  The pass code for the Bluetooth modem is default "1234".  I Then fired up BlueTerm and connected to the Bluetooth modem:


Immediately I got the serial output just like i should which was very exciting.  I tested the range and i was getting signal from a lot further then i'd ever need it to be, even if i had it output to a TV.  


The last image shows me pressing one of the buttons while moving the joystick.  The delay in the code is set to half a second but if i pulled it out, you'd see x,y coordinates move more fluidly.  The next problem is getting the phone to take the input its receiving and act like its key presses on a keyboard.  This is where i hit a wall and where im going to have to come back.  Its looking like i may need to write my own, or "borrow" a software keyboard app that accepts the inputs and tags them to a alphanumeric key.  Luckily, Google has a example software keyboard in their Android SDK that I'm going to take a look at and see how it works.  Another lucky break is that theres a guy that wrote a toolkit called Amarino that makes it easier to interface my Arduino to my Android.  Hopefully it will be some help in this regard.  Now i need to go read up on everything.  Later!

Tuesday, March 1, 2011

Concepts for upcoming projects

Ok so I've come up with a few new ideas for projects I'd like to play with.

The Bluetooth Joystick Project
Concept and scope of use:
To create a handheld, usb powered game pad using the joystick kit from sparkfun.com with a Bluetooth modem in order to connect to my Droid Incredible Smartphone to play The Legend of Zelda on my phone's SNES emulator.  
Parts:
Both of the following items have already been purchased from Sparkfun Electronics.

Joystick Shield Kit
sku: DEV-09760
Description: The Joystick Shield kit contains all the parts you need to enable your Arduino with a joystick! The shield sits on top of your Arduino and turns it into a simple controller. Five momentary push buttons (4+ joystick select button) and a two-axis thumb joystick gives your Arduino functionality on the level of old Nintendo controllers



Bluetooth Modem - BlueSMiRF Silver

sku: WRL-10269
Description: The BlueSMiRF Silver is the latest Bluetoothwireless serial cable replacement from SparkFun Electronics! This version of the popular BlueSMiRF uses the RN-42 module which has a bit less range than the RN-41 module used in the BlueSMiRF Gold. These modems work as a serial (RX/TX) pipe. Any serial stream from 9600 to 115200bps can be passed seamlessly from your computer to your target.


Notes:
The basic problem is that the SNES emulator works great but my big thumbs cover most of the touchscreen and its difficult to use the on screen controls.  The idea for this project being, if can use my Ardunio to take the input from my joystick and buttons and then output those commands over bluetooth in a way that my SNES emulator will use them.  We will see how it all turns out when i get my parts in the next week.

Bonus points:  If the concept works, repackage it and see if its viable to use the phones battery over usb to power the joystick.

The Speedometer Project
Concept and scope of use:
To create a Digital Speedometer with a Odometer and Compass functions.
Parts:

Serial Miniature LCD Module 1.44"

sku: LCD-10090
Description: The uLCD-144(GFX) is a compact and cost effective  display module using the latest state of the art LCD (TFT) technology with an embedded GOLDELOX-GFX2 graphics processor that delivers ‘stand-alone’ functionality to any project. Powerful graphics, text, image, animation and countless more features are built inside the GOLDELOX-GFX2 chip.



Im actually buying this as individual parts instead of a kit.  

GPS Shield

sku: GPS-10102
Description: Adding GPS to your Arduino has never been easier. The multiple GPS receivers attach easily to the shield, and with the example sketch, you will be able to locate your exact position within a few meters.

20 Channel EM-406A SiRF III Receiver with Antenna

sku: GPS-00465
Description: The EM-406A GPS module from USGlobalSat based on the spectacular SiRF StarIII chipset. This complete module is built upon the same technology as the ET-301, but includes on-board voltage regulation, LED status indicator, battery backed RAM, and a built-in patch antenna! 6-pin interface cable included.

Real Time Clock Module

sku: BOB-00099
Description: This a custom designed module for the DS1307 Real Time Clock. The module comes fully assembled and pre-programmed with the current time.


Notes:
I really liked digital speedometers.  For example, like the ones currently in the Honda Civics.  Personally, I really don't understand why car manufactures don't utilize them more.  The old analog gages are completely outdated.  Seriously, its 2011, time to come into the future.  The Idea of this project is create a digital speedometer with extra features to use in my car, without input from the cars sensors.  This way i can use the project in a number of different situations.  I'll use the GPS receiver to get location data and time from the navsats.  Then take the data to show direction, speed, location(optional), distance traveled, date and time.  Then output that data to the LCD screen. You might be wondering why I even included the RTC chip since time-of-day and date can be received from the GPS data. The DS1307 RTC chip also has 56 bytes of non-volatile RAM. I'm using these registers for storing the trip meter and odometer values so they can be restored between power cycles.

Bonus points:  If the concept works, repackage it in a waterproof box and see if its viable to use alternative energy to power the device, be it wind or solar power.

The Nixie Clock Project
Concept and scope of use:
To create a clock using Nixie Tubes to display the time while also using wireless to keep the clock updated to the correct time. 
Parts:
Description: 50 mA NIXIE TUBE POWER SUPPLY 

OGI LUMEN provides this heavy lifter high voltage switch mode power supply pre-assembled. 

It is currently offered in a 50mA output version, adjustable from 150 to 220 VDC, from a 9 to 16 VDC source. There is sufficient power produced by one 50 mA NIXIE TUBE POWER SUPPLY to drive twelve NIXIE DUO boards (twenty-four IN-12A nixie tubes). Our 12 VOLT AC/DC ADAPTER will easily drive this nixie tube supply. 




Description: NIXIE DUO and NIXIE DRIVER KITs

Whoa! The NIXIE DUO and NIXIE DRIVER together for the first time!

nixie tubes, and all the other bits you'll need. The NIXIE DRIVER prepares a NIXIE DUO to receive serial input from an external microcontroller (Arduino), and power from a NIXIE TUBE POWER SUPPLY. You can further string these assemblies end-to-end for rows of humming digits. 





Description: NEON LAMP

Neon glows orange-red within these lens topped beauties. We've got hundreds more for when nothing but neon is the answer. 
















WiShield 2.0



This is the shield you need to get Wi-Fi connectivity to your Arduino-based project! This shield provides 802.11b connectivity and is a direct drop-on plug-and-play solution to your Arduino Diecimila/Duemilanove/Uno.
The second revision of this board has all the components in surface mount form.  The new and exciting feature of the second revision of this board is the addition of a 16Mbit serial flash for storing web pages and other data!  This additional storage space can be used for storing more complex and feature rich webpages, as well as sensor type data to be downloaded at a future time


Note:
What is a Nixie Tube?  A nixie tube is an electronic device for displaying numerals or other information. The glass tube contains a wire-mesh anode and multiple cathodes. In most tubes, the cathodes are shaped like numerals. Applying power to one cathode surrounds it with an orange glow discharge. The tube is filled with a gas at low pressure, usually mostly neon.  Nixies were used as numeric displays in early digital voltmeters, multimeters, frequency counters and many other types of technical equipment. They also appeared in costly digital time displays used in research and military establishments.  They have been made obsolete by LED technology.  In this project, I want to try to make a clock with a coldwar feel to it.  That and the added feature of always being up to date even during daylight savings thanks to the National Institute of Standards and Technology's time feed.

Bonus Points:  Make a nice wood cabinet for it so I can show it off in my living room.
Secondary Bonus Points: Backlight the tubes with leds similar to the following:

Getting Started

So I've been getting into electronics and programing again. This time i really wanted to learn what i could do with programing hardware.  After digging around on the internet to see how this was done, I ran across a website with a very easy sounding and detailed tutorial on how to get started programing a microchip on a board designed to do just that.  I eagerly ordered a Arduino Starter Pack and a LCD from adafruit.com and eagerly waited for its arrival.  Once i got it, I dove though the tutorial and completed it in just a few hours.  It was probably the most fun I've ever had learning...period.  But, like a fat kid with a pack of twinkies, the second twinkie was gone before I knew it, leaving me holding an empty wrapper.  Then, after cruising the internet for project ideas for a while, I came up with my first project, designed and implemented all on my own.  Before i get to that though, what is an Arduino actually?

What is an Arduino?
from the Arduino.cc website:
Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software. It's intended for artists, designers, hobbyists, and anyone interested in creating interactive objects or environments.


Arduino can sense the environment by receiving input from a variety of sensors and can affect its surroundings by controlling lights, motors, and other actuators. The microcontroller on the board is programmed using the Arduino programming language  and the Arduino development environment. 

Arduino projects can be stand-alone or they can communicate with software on running on a computer.  The boards can be built by hand or purchased preassembled; the software can be downloaded for free.

Sounds neat huh?  For me, it sounded like the perfect gateway to dive deeper into the realm electronics by merging my love of hardware with the software side of things.  I've always had a head for programing, but I haven't been very productive in a classroom environment.  Plus i'm a perfectionist with my code which makes debugging and optimizing code take forever which isn't good for deadlines.  Doing things on my own, really lets me take my time, come back to things to tweak things as more ideas come to me.  It really is a liberating feeling.

First Project

For my first project I looked though what I had available in my kit:


The Main kit from Adafruit.com includes:
  • Arduino Uno SMD w/Atmega328 - The latest and greatest Arduino revision, assembled and ready to go, including 4 rubber feet
  • 3' USB cable - Perfect for connecting your Arduino to a computer
  • Protoshield Kit - One of ladyada's designs, its got everything you need to make prototype designs using an Arduino. Note that this comes unassembled
  • Tiny Breadboard - Fits on top of the protoshield, easy to use
  • 9V DC regulated wall adapter - You can power your Arduino from any wall socket. This switching regulator is efficient and small and works with US (110V) and European (220V) power.
  • 9V Battery case with switch and a 2.1mm plug- so you can power your arduino using a 9V battery. This case is much sturdier than just a battery clip and it has an on/off switch too! Note that this comes unassembled
  • Tutorial starter pack parts - Includes a 10K potentiometer1K potentiometer2 small pushbuttons5 red diffused bright LEDs, one each of red, green and blue ultra-bright LED5 100 ohm resistors5 1K resistors5 10K resistors, and a CdS photocell sensor.
  • Also includes 75 flexible breadboard wires in 8 colors, perfect for use with the solderless breadboard.
Plus i also perchaced a 16x2 Red and Black LCD.  The 16x2 stands for the numbers of character rows and column.  In this case, Two rows of sixteen characters.



After playing around with the LCD tutorial and getting simple outputs, I then started playing with the photocell sensor.  Simply, a photocell is a resistor (resistors being devices that "resist" the flow of electricity), whose resistance decreases the brighter things get.  After playing with the tutorials, i wondered if i could combine the two on my own and customize the output into something more unique.  So thats what i did, i wired up the two devices just like in the tutorial.

Then I merged the code and made some modifications based on what I wanted as an output.  Here is an example of the code I used.
/*
Light Sensor!
Reads Analog data from a light sensor and outputs the data in a form we can understand
*/

// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
int photocellPin = 0; // the cell and 10K pulldown are connected to analog pin 0
int photocellReading; // the analog reading from the sensor divider

void setup(void) {
lcd.begin(16, 2); // set up the LCD's number of columns and rows:
}

void loop(void) {
lcd.print("It is currently:"); // Prints the defult message to the LCD.
lcd.setCursor(0, 1); // changes cursor position
photocellReading = analogRead(photocellPin); // dumps the analog data into my varable
if (photocellReading < 5) { // start of if else statments to covert the analog intergers to text and output both.
lcd.print("Dark-");
lcd.print(photocellReading);
} else if (photocellReading < 20) {
lcd.print("Dim-");
lcd.print(photocellReading);
} else if (photocellReading < 100) {
lcd.print("Light-");
lcd.print(photocellReading);
} else if (photocellReading < 200) {
lcd.print("Bright-");
lcd.print(photocellReading);
} else {
lcd.print("Very bright-");
lcd.print(photocellReading);
}
delay(1000); // delays 1sec
lcd.clear(); // clears the screen, acting as a refresh
}
This is what i ended up getting.  (note: the picture was taken before the final version of the code was done.)

Basically whats going on is the photocell  is giving us a integer value via the analog input on the Arduino board. The Arduino board then looks at that integer and asks a few questions.  Is the number less the 5? If yes, print out the the string of text "Dark-" then print the number.  If not, is the number less then 20?  And so on.  Then the program waits one second to clear the screen and then repeats itself.

Im kinda proud of myself on this one.  I borrowed some code (the if/else portion) but the rest I did from memory or by looking up the language reference.  Since doing this, I've come up with three new projects ideas but i'll explain them in my next post.

http://burntelectonics.blogspot.com/2011/02/getting-started.html