Tuesday, December 31, 2013

Eagle PCB and Schematic Keypad Shortcut

I made an Instructable a while back about making a Programmable Keypad for your computer.  I have slightly modified that code to allow me a keypad for shortcuts when making schematics and PCBs in Eagle software.  That Instructable can be found here.  This is my new source code and I also added a switch to allow switching between schematic and PCB modes.
------------------------------------------------------------------------------------------------
//http://arduino.cc/en/Reference/MouseKeyboard

#include <Keypad.h>

//HIDKeyboard Keyboard; // Initialize HIDKeyboard object
char shift = KEY_LEFT_SHIFT;
char ctrl = KEY_LEFT_CTRL;
char alt = KEY_LEFT_ALT;
char f2 = KEY_F2;

const int schemBoard = 2;

const byte ROWS = 4;
const byte COLS = 3;

char Keys[ROWS][COLS] = {
  {'1','2','3'},
  {'4','5','6'},
  {'7','8','9'},
  {'*','0','#'}
};
byte rowPins[ROWS] = {4, 9, 8, 6};
byte colPins[COLS] = {5, 3, 7};

Keypad customKeypad = Keypad( makeKeymap(Keys), rowPins, colPins, ROWS, COLS);

void setup() {
  Keyboard.begin(); // Start communication
  delay(2000); // Wait for device to be found as a Keyboard
}

void loop() {
  char key = customKeypad.getKey();
 
  if (key != NO_KEY){
    if(schemBoard){  //schematic keys
      if     (key == '1'){Keyboard.press(shift);Keyboard.press(ctrl);Keyboard.press('a');}  //add
      else if(key == '2'){Keyboard.press(shift);Keyboard.press(ctrl);Keyboard.press('c');}  //copy
      else if(key == '3'){Keyboard.press(ctrl);Keyboard.press('d');}  //delete
      else if(key == '4'){Keyboard.press(ctrl);Keyboard.press('i');}  //info
      else if(key == '5'){Keyboard.press(ctrl);Keyboard.press('m');}  //move
      else if(key == '6'){Keyboard.press(alt);Keyboard.press('n');}  //net
      else if(key == '7'){Keyboard.press(shift);Keyboard.press(ctrl);Keyboard.press('n');}  //name
      else if(key == '8'){Keyboard.press(shift);Keyboard.press(ctrl);Keyboard.press('s');}  //smash
      else if(key == '9'){Keyboard.press(ctrl);Keyboard.press('t');}  //text
      else if(key == '0'){Keyboard.press(shift);Keyboard.press(ctrl);Keyboard.press('v');}  //value
      else if(key == '*'){Keyboard.press(ctrl);Keyboard.press('w');}  //wire
      else if(key == '#'){Keyboard.press(alt);Keyboard.press(f2);}  //window fit
    }
    else{  //board keys
      if     (key == '1'){Keyboard.press(shift);Keyboard.press(ctrl);Keyboard.press('a');}  //add
      else if(key == '2'){Keyboard.press(shift);Keyboard.press(ctrl);Keyboard.press('c');}  //copy
      else if(key == '3'){Keyboard.press(ctrl);Keyboard.press('d');}  //delete
      else if(key == '4'){Keyboard.press(ctrl);Keyboard.press('i');}  //info
      else if(key == '5'){Keyboard.press(ctrl);Keyboard.press('m');}  //move
      else if(key == '6'){Keyboard.press(alt);Keyboard.press('n');}  //net
      else if(key == '7'){Keyboard.press(shift);Keyboard.press(ctrl);Keyboard.press('n');}  //name
      else if(key == '8'){Keyboard.press(ctrl);Keyboard.press('r');}  //route
      else if(key == '9'){Keyboard.press(ctrl);Keyboard.press('t');}  //text
      else if(key == '0'){Keyboard.press(shift);Keyboard.press(ctrl);Keyboard.press('v');}  //value
      else if(key == '*'){Keyboard.press(shift);Keyboard.press(ctrl);Keyboard.press('r');}  //ripup
      else if(key == '#'){Keyboard.press(alt);Keyboard.press(f2);}  //window fit
    }
  }
}

Friday, December 27, 2013

Programmable Keypad

Check out this Instructable I made for creating a custom programmable keypad!  View it here.

Arduino Upload Speeds

I have compiled a list of the different upload speeds used on various Arduino boards.  This information is useful for when you are configuring Xbee modules for wireless uploading of Arduino sketches.  All of this information was taken from the Arduino website here.  An Instructable for using this information can be found here.

115200

  • Arduino Uno
  • Arduino Mega 2560
  • Arduino Ethernet (with USB2Serial module)
  • Arduino Mega ADK
57600

  • Arduino Duemilanove or Nano w/ ATmega328
  • Arduino Mega (ATmega1280)
  • Arduino Fio
  • LilyPad Arduino w/ ATmega238
  • Arduino Pro or Pro Mini (5V, 16MHz) w/ ATmega328
  • Arduino Pro or Pro Mini (3.3V, 8 MHz) w/ ATmega328
19200

  • Arduino Mini
  • Arduino Diecimila, Duemilanove, or Nano w/ ATmega168
  • Arduino BT w/ ATmega328
  • Arduino BT w/ ATmega168
  • LilyPad Arduino w/ ATmega168
  • Arduino Pro or Pro Mini (5V, 16 MHz) w/ ATmega168
  • Arduino Pro or Pro Mini (3.3V, 8 MHz) w/ ATmega168
  • Arduino NG or older w/ ATmega168
  • Arduino NG or older w/ ATmega8

Thursday, December 19, 2013

Raspberry Pi Home Control System

I have started working on a new project using my new Raspberry Pi.  When I bought the Pi I didn't have any idea what I was going to do with it, I just knew that for only $35 I was going to buy one just to have.  Well now I have had it for a while and have come up with an idea for how I want to use it.  I am going to create a little home automation system, complete with security and simple tasks such as weather advisement and personal alarms along with full control of lights and any other items I can think of.

I am only building this as a prototype for one bedroom within an apartment so I will not be implementing controls of the thermostat which would be a nice addition for version two if I am living in my own apartment or house without a roommate.  I plan to use reed switches on my bedroom door and two windows for part of the security system.  I would also like to include a camera pointed at the door that will capture a snapshot whenever the door is open.  I have also set up a private Twitter account for this project so that I can control my apartment using Twitter and also receive house updates via Twitter.  I will most likely be doing the whole project using Python and hopefully I will get some time to work on it while I am on my winter break.

Look back for updates soon to come!

--Jordan