MBDuino says "Hello" to Arduino Forum (w/ Project Summary I)

Just wanted to put up a quick [first] post to say hello and post my first Arduino sketch that I'm actually quite proud of (there are others) as well as a summary of my recent projects. Been tinkering with the ARDX Experimeter's kit I ordered from Solarbotics for Christmas with a 16x2 LCD and have essentially run out of things to do that are retaining my interest. There's only so much you can do with a servo motor :stuck_out_tongue:

Just to set some ground rules for my interests: I come from years of PHP/MySQL development as a web application developer and am interested in getting into electrical engineering as a hobby and a means of extending my application of software development. I'm not as interested in industrial or mechanical engineering. Robots are okay and I'll eventually find myself building one at some point for the kids I'm sure, but some projects I've researched or engineered myself that perhaps describe a little better what has peaked my interest to spend the time in include:

  • Crimped jumper wires to LCD pins for more flexible breadboard prototyping (e.g. use with shift register and ShiftLCD.h library)
  • Voltmeter using Ohm's law and a 10k resistor to display Voltage, Resistance, and/or Current when I didn't have a multimeter to test my potentiometers
  • PHP programming interface: Wrote scheduled script to retrieve remote JSON data every few minutes and send it to the Arduino over COM3 serial port using fopen('com3', 'w')
  • EEPROM Branding & Address Lookup (source below)
  • USB cable breakout for providing external power to Zoom H1 handy recorder - just as easily done with spliced Android USB wall charger
  • Built Ti Graph Link over Serial few years back for Ti-83+
  • Desoldered electrical components from devices lying around the house that I might be able to recycle (capacitors, diodes, LEDs)
  • Landed PIR sensor and Ultrasonic sensor from Radioshack going out of business (both 50% off brand new). I'm interested in using them for security applications.
  • Basic security system using LCD for status ("==MOTION DETECTED=="), PIR sensor to detect movement, LED for armed status blinker and alert indicator, Ultrasonic sensor to detect additional movement.

I'm also interested in USB, HDMI (not likely to happen though as it's a licensed protocol with adopter requirements, licensing fees, etc), security applications, and encryption. I've already put in an order at Circuits@Home for a USB Host shield to begin playing with USB devices. I also have a 256 MB Raspberry Pi I'll probably look into poking at those pins with Arduino at some point.

So there you have it. My name is Matt, and hello to everyone! Please feel free to reply and let me know, based on these things, what ideas you have for my next project. I'm always looking for something challenging (qualifier: something genuinely interesting. e.g. reading the entire USB host specification document is not eligible for being considered challenging).

/* EEPROM Branding & Address Lookup */
#include <EEPROM.h>

#define EEsize 1024 // ATmega328 (Arduino Uno)
#define BUFFER_SIZE  4 // 4 characters (e.g. 1024)
#define BRAND_SIZE 15 // Includes null terminator
#define BRAND_ADDR 513

#define WRITE_EEPROM 0 // 1 = yes / 0 = no (e.g. already written)

char brand[BRAND_SIZE] = "PROPERTY OF ME";
char input[BUFFER_SIZE-1];

unsigned int addr;
unsigned int brand_pos = BRAND_ADDR;
int val;

void setup()
{
  Serial.begin(9600);
  Serial.println();
  Serial.println("===================================");
  Serial.println("EEPROM Brander & Address Lookup 1.0");
  Serial.println("===================================");
  Serial.println();
  Serial.println("Branding Tag (Details)");
  Serial.println("----------------------");
  Serial.print("Message:");
  Serial.print("\t");
  Serial.println(brand);
  
  Serial.println("Encoded As: ");
  for(int i=0; i<BRAND_SIZE-1; i++)
  {
    Serial.print("\t");
    Serial.print("\t");
    Serial.print(brand[i]);
    Serial.print(" (");
    Serial.print((int)brand[i]);
    Serial.print(": B");
    Serial.print((int)brand[i], BIN);
    Serial.print(") \tat address ");
    Serial.print(brand_pos, DEC);
    Serial.print(" (B");
    Serial.print(brand_pos, BIN);
    Serial.println(")");
    
    // Write EEPROM data
    if(WRITE_EEPROM == 1)
    {
      EEPROM.write(brand_pos, (byte)brand[i]);
    }
    
    brand_pos++;
  }
  
  Serial.print("Size: ");
  Serial.print("\t");
  Serial.print("\t");
  Serial.print(sizeof(brand));
  Serial.println(" bytes");
  Serial.println();
  Serial.println("Enter an address (decimal) to read:");
}

void loop()
{
  if(Serial.available())
  {
    delay(100);
    
    int i = 0;
    for(int i=0; i<BUFFER_SIZE; i++)
    {
      if(!Serial.available()) break;
      input[i] = Serial.read();
    }
    
    /*
    Serial.print("atol: ");
    Serial.println(atol(input));
    
    Serial.print("(int)atol: ");
    Serial.println((int)atol(input));
    
    Serial.print("atol (dec): ");
    Serial.println(atol(input), DEC);
    
    Serial.print("(int)atol (dec): ");
    Serial.println((int)atol(input), DEC);
    
    Serial.print("atol (bin): ");
    Serial.println(atol(input), BIN);
    */
    
    addr = (int)atol(input);
    val = EEPROM.read(addr);
    
    Serial.println("================");

    Serial.print("Address: ");
    Serial.print("B");
    Serial.print(addr, BIN);
    Serial.print(" (");
    Serial.print(addr, DEC);
    Serial.println(")");
    
    Serial.print("Data: ");
    Serial.print((char)val);
    Serial.print(" (");
    Serial.print(val, DEC);    
    Serial.print(": ");
    Serial.print(val, BIN);
    Serial.println(")");
    
    
    // Clear input array
    memset(input, 0, sizeof(input));
  }
  
  /*
  val = EEPROM.read(addr);
  
  Serial.print(addr, BIN);
  Serial.print("\t");
  
  Serial.print(val, BIN);
  Serial.print("\t");
  
  Serial.print(sizeof(val));
  Serial.print(" bytes");
  
  Serial.println();
  
  addr++;
  if(addr >= EEsize)
  {
    addr = 0;
  }
  */
  
  delay(1500);
}