Oct 25, 2013

iBeacons

      I was trying something new several weeks ago. There is a new implementation in iOS 7 called iBeacons. My dad had a plan of using this capability; but upon searching the internet, we found only 2 or 3 Bluetooth LE "beacons" that we could purchase. And they were all for pre-order. My dad wanted to exhibit his plan at an event very soon and the beacons would not arrive till several weeks after he needed them. So we decided to make our own. Much like the pre-order beacons, we had trouble finding plans for these beacons. But after much searching, we came across an interesting blog. (Blog) On it we found a schematic, board design, and firmware code for making this device. My grandfather came over and we put this device together. This video explains very clearly how to make a circuit board: Circuit Skills: Circuit Board Etching. Here is our almost finished device. (We made 2) 





Unfortunately, we did not finish making the devices in time for my dad's exhibition, but we plan to finish them soon. 

This is the materials list:
- Bluegiga BLE112 LE Module
- 5 pin header
- 1 layer photosensitive circuit board
- Ferric Chloride and Positive Type Developer (for etching)
- laser printer and a transparency sheet for printing out the circuit design
- ceramic capacitor
- diode
- CC Debugger from TI instruments

We ordered most of our parts from Mouser Electronics and they arrived in about a week. We had a problem with the header and the circuit though. We should've gotten a smaller header and with ten pins instead of five. The debugger had a 10 pin configuration that couldn't just plug right into the device. As we couldn't upload the firmware they have no ID's yet and don't show up. We'll hopefully get it working soon; and if we do, I'll show you all what we did. If you have any ideas of how we could fix it, leave your ideas in the comments below.

Mar 16, 2013

Arduino Morse Code

So, this evening, my dad and I (mostly my dad) had a go at Arduino and made this life-saving device called a morse code signaller. Ok, it might not really be life saving considering you have to have a computer to tell it what to say. But anyway, it's still pretty cool, right? Here's the code,


// By James Taverne, 3/15/2013
// Morse Code Signaller for Arduino
// Connect led to pin 13 or use built-in led.
// Open Serial Monitor and select Newline from drop-down at bottom. 
// Type in a  message and hit Send. 
// Your message will flash on the led in Morse code.
// The letters and corresponding dots and dashes should be displayed on the serial monitor as well.


int incomingByte = 0;
int morseOutput = 13; //Pin for receiving Morse output - attach LED to this pin
int interval = 120;   //length of time for one dot - basic unit of measurement;  one interval occurs between each dot or dash; dash is equivalent to 3 dots; 7 dots between words

String alphabet = "abcdefghijklmnopqrstuvwxyz1234567890 ";
String ALPHABET = alphabet;

String morseCode[] = { 
    ".-", // A
    "-...", // B
    "-.-.", // C
    "-..", // D
    ".", // E
    "..-.", // F
    "--.", // G
    "....", // H
    "..", // I
    ".---", // J
    "-.-", // K
    ".-..", // L
    "--", // M
    "-.", // N
    "---",  // O
    ".--.", // P
    "--.-", // Q
    ".-.", // R
    "...",  // S
    "-", // T
    "..-", // U
    "...-", // V
    ".--", // W
    "-..-", // X
    "-.--", // Y
    "--..", // Z
    ".----", // 1
    "..---", // 2
    "...--", // 3
    "....-", // 4
    ".....", // 5
    "-....", // 6
    "--...", // 7
    "---..", // 8
    "----.", // 9
    "-----", // 0
    " "   //space character
};

void setup() {
  
  Serial.begin(9600);
  pinMode(morseOutput, OUTPUT);
  
  ALPHABET.toUpperCase();

}

void loop() {
 if (Serial.available() > 0) {
    incomingByte = Serial.read();
    char c = (char) incomingByte;
    sendLetter(c);
 } 
    
}

void sendLetter (char c) {
   int i;
   for (i = 0; i < alphabet.length(); i = i + 1) {
       if (alphabet[i] == c || ALPHABET[i] == c) {
           Serial.print(c);
           sendMorseCode(morseCode[i]);
           return;
       }
   }
   if (c == '\n')
      Serial.println();
}

void sendMorseCode (String tokens) {
   int i;
   for (i = 0; i < tokens.length(); i = i + 1) {
       switch (tokens[i]) {
           case '-':
               sendDash();
               break;
           case '.':
               sendDot();
               break;
           case ' ':
               sendEndOfWord();
               break;
       }
   }
   morseOutputOff(2);
   Serial.print(" ");
}

void sendEndOfWord() {
   morseOutputOff(4);
   Serial.print("  ");
}

//basic functions - Morse code concepts  
void sendDot() {
   morseOutputOn(1);
   morseOutputOff(1);
   Serial.print(".");
}
void sendDash() {
   morseOutputOn(3);
   morseOutputOff(1);
   Serial.print("-");
}


//Low level functions - how the actions are accomplished
// n = number of intervals 
// interval is a fixed length of time determined at start, for example 200 milliseconds
void morseOutputOn (int n) {
//   example: morseOutputOn(1) means turn output on and keep it on for 1 interval 
//            morseOutputOn(3) means turn output on and keep it on for 3 intervals 
//   
   digitalWrite(morseOutput, HIGH);
   delay(n * interval);
}

void morseOutputOff (int n) {
   digitalWrite(morseOutput, LOW);
   delay(n * interval);
}






Are impressed yet? Probably not. We also made some other stuff, not as life-saving though. Like led's you can turn on and off using your computer. There's also a fading led sketch. That's not all I'm going to do though, expect more life-changing programs to be made in the near future.