• Home
  • Articles
  • Entertainment
  • Games
  • Hardware
  • Projects
    • CheerLights
    • Coffee and Tea
    • iPhone
    • MyToaster
    • ThingSpeak
    • TouchShield Slide
  • Security
  • Software
  • Space
  • Talks
  • Tweaks
  • Updates

I am ShadowLord

Interesting to me

    
  • CheerLights: my lights are linked to everyone else’s

    Dec 1st 2011

    No comments

    If you have been following my projects for the last 12 years, you probably figured out that I must have a master plan. And this plan involves connecting things to the Internet that may or may not turn against us in the future. Way back in 2001, my partners and I released FuzzBox – this technology allowed for artificial intelligence to be distributed to devices via the Web. Our thoughts were if the decision making could be made on the Internet the devices themselves could focus on their task vs. trying to be a super device on their own. This was way early on and the ideas were premature, but it started a series of events and failures that led to even more projects involving devices linked together over the web. I guess this is now called, “The Internet of Things“.

    Something that has emerged over the years is social networking. I have been fascinated by the idea of collective intelligence. It’s fun to follow a football game on Twitter or on Facebook’s live stream. You get to see the take other’s have on the same event that you are experiencing. If the Steelers score, you can feel it reverberate through social networks. These networks only work if there is lots of participation by many people. I have heard that people have predicted STD out breaks from Twitter status updates, food poisoning sources, and even where earthquakes have taken place. This is fascinating to me.

    The results are two-fold: you can learn from this data and that we are all connected. Enter in, CheerLights – CheerLights is my combination of distributed devices with social networking. This project that involves connecting multicolored lights to other people’s lights and allow Twitter keywords control them all. If someone tweets, “@cheerlights let’s go green” – every light connected to the project would change to green. To me this is a physical representation of a social network trending topic. It’s a way to share a moment in that moment. Just like with social networking, CheerLights requires scale to be very interesting.  If you check out CheerLights.com, you will see how to build a set of lights that are linked together with other people’s lights via Twitter. I have examples using things from ioBridge, Arduino, and Digi. Please let me know if you decide to build something and connect it to CheerLights.

    We are all connected. That’s my purpose for building all of this technology. Nothing else matters.

    Share this

    CheerLights

    arduino, internet of things, iobridge, thingspeak, twitter, web of things

  • Internet of Things Talk at Carnegie Mellon University

    Oct 11th 2011

    1 comment

    Last weekend was the Pittsburgh Perl Workshop hosted by Carnegie Mellon University in Pittsburgh, PA. I gave a talk on the Internet of Things and building apps using the Perl programming language as the connective tissue between devices and web applications. I covered the basics on how you interface devices to the real-world. I also hosted a Hardware Hackathon and got to discuss hardware, connecting things, and Perl. I introduced everyone to my remixed theory of innovation. Just get out there and copy a well documented project, learn by transforming some part of the project, and combine it with other ideas. This is the only way innovation has ever happened… Thanks for the awesome time at PPW!

    Hans Scharler at the 2011 Pittsburgh Perl Workshop

    Here are my slides from the 2011 Pittsburgh Perl Workshop:



    Share this

    Talks

    arduino, internet of things, iobridge, Perl, PGHPW, PPW, web of things

  • TouchShield Slide Two-way Communications

    Mar 21st 2010

    32 comments

    Over last summer, I got the GamePack from Liquidware which includes a touch screen display, joystick, microcontroller, and battery pack. With this kit you can make a GameBoy from scratch. With some blood, sweat, and tears, I was able to re-create some games like Asteroids and Tetris.

    The touch screen is called the TouchShield Slide which is a 320×240 OLED and resistive touch screen. The screen also has a microcontroller that is Arduino compatible and expands your program space. Since the screen is really a microcontroller in disguise, it can be used for many types of projects. Overall I am very happy with the screen, but I realized I didn’t know how to use it very well. I set out to learn and develop a protocol / reusable library that allows the screen to talk to a microcontroller and vice-verse. So I wanted to take a moment and explain what I learned – maybe you can get going faster than I did.

    The Goal

    My goal is to be able to display data on the screen that has been received from another device. The data requested would be initiated by a touch on the screen. The protocol has to be consistent and reliable, while being flexible enough to be the basis for future projects.

    Touch -> TouchShield Slide -> Arduino -> TouchShield Slide

    Touch -> TouchShield Slide -> Arduino -> TouchShield Slide

    Programming Tips and Tricks

    I found quite a few libraries and resources on liquidware.com.  I also discovered quite a few important things through my trial and error. My biggest frustration was with programming and figuring out the IDE. Here are some tips.

    • To program the screen use the Antipasto Arduino / Aardvark IDE
    • Program the screen and Arduino separately - make sure the IDE has the proper device selected
    • To put the screen in program mode, press the switch beside the power connector – it’s in program mode when the LED on the backside is red

    TouchShield Slide Serial

    Serial data sent and received by the TouchShield Slide uses the hardware serial lines.

    To setup the serial connection, place this line in your setup code block:

    Serial.begin(9600);

    Now you can read and write to and from the serial buffer. To read in a whole string, use a byte array to store bytes from the serial buffer when serial data is available. To write to the serial buffer, simply use serial print.

    char charIn = 0;
    byte i = 0;
    char stringIn[32] = "";

    while(Serial.available()) {
    charIn = Serial.read();
    stringIn[i] = charIn;
    i += 1;
    }

    Serial.print("A");

    Arduino Serial

    On the Arduino side, you have to use some form of Software Serial that sends and receives data on Pins 2/3. I have found that the Adafruit SoftSerial Library, “AFSoftSerial.h”, works the best. It seems to be reliable and produce consistent results when talking to the TouchShield Slide. Reading and writing from a software  serial buffer is about the same as a hardware one with this library.

    To use software serial, follow these steps:

    • Include the “AFSoftSerial.h” library in your Arduino code header space
    • Define the RX and TX pins
    • Instantiate the software serial
    • Initiate the software serial line
    #include <AFSoftSerial.h>

    #define RX_PIN  3
    #define TX_PIN  2

    AFSoftSerial touchSerial =  AFSoftSerial(RX_PIN, TX_PIN);

    void setup() {
    touchSerial.begin(9600);
    }

    Demo Project

    I took a moment to put together all of the things that I learned into a quick demo project. This project displays a random number on the screen. The random number is being generated by an Arduino, sent via serial, and requested by a touch of the TouchShield Slide.

    Visit Liquidware’s App Store to download the source code and library for this demo project.

    Random Number from Arduino Displayed after Detecting a Touch

    Random Number from Arduino Displayed after Detecting a Touch

    Share this

    TouchShield Slide

    app, arduino, liquidware, Projects, serial

  • Internet-enabled Message Center

    Jun 15th 2009

    7 comments

    What are you up to now?

    I took the leap and bought an Arduino from LiquidWare. An arduino is an open-source microcontroller that has a processor, some digital I/O pins, and analog inputs. You can create little standalone programs that monitor inputs, control LEDs, and pretty much anything that you dream up. My favorite projects are ones that involve the Internet. A microcontroller is rather simple by itself, but what if it could use the web to get answers, send email, maybe update my Twitter status? That means there is a unlimited number of projects ahead – Microcontrollers collaboarating in cyberspace. The missing link for the web part is the ioBridge IO-204. I know you are no stranger to the the IO-204, but for those of you who have not heard. The IO-204 sits on my network and relays data from its channels to ioBridge.com servers and back into my network. It allows for remote control and monitoring without network configuration and programming. One of the expansion boards is a two-way serial board that accepts serial strings and connects them to APIs of web services that ioBridge interfaces to and sends back responses. For instance, I can send the commands, “[[[calc|9*9]]]” and this returns 81. OK, maybe not impressive on the surface, but that result came from Google Calculator. Anything Google Calculator can solve, your microcontroller has access to those results. For more examples, visit the Serial Web Services API on the wiki.

    Message Center Project
    I wanted to combine these two worlds with a sample project – maybe it will inspire you to come up with something better, spark some ideas that you have. I have my arduino measuring my outside temperature here in Pittsburgh, which is an analog input scaled to Fahrenheit. At any moment I can press a button and get the temperature on the LCD screen – no Internet required. Since I have been planning a work trip to Atlanta, I also wanted to compare my temperature with hot-lanta’s. So, my project solves that. Using the “weather command”, I am able to get the weather anywhere in the world by zip code or city name.
    I added a few more things to the message center. With another button I can get the stock quote of Google. My strike price was $405, so I have been watching it close. If it gets below $405, I get an automatic email from my message center. The stock quote comes from the Yahoo Financials API.
    I have one more button that emails me a secret message when it’s pressed. I put this in here for when my mom comes into my room from when I am on the road. It’s aptly label, do not press. Next time, I will hook it to a light sensor in the basement to catch her when she turns on my lights. I am sure you all have the same issues with your mom.

    Source Code
    The arduino requires some c-like programming and I wanted to include the sketch for you to steal and use for your projects. You will see how I send the serial commands from the arduino to the IO-204 using the UART serial connection (pins 0/1) and recieve and parse the incoming results. I use a SoftwareSerial port for the LCD results. The push buttons are software debounced and use pull-up resistors for solid digital connections. The LED’s linked to each button use a 330 ohm resistor to protect them. I was aided by the Arduino Inputs tutorial on Ladyada.net, Debounce Tutorial, and the iobridge Wiki / Forum. Please let me know if you have any questions, maybe I can help. I have learned a lot about handling strings on the arduino.
    //
    // Message Center using Arduino and the ioBridge IO-204
    //
    // An open-souce Shadowlord Project
    // www.IamShadowlord.com
    
    #include <SoftwareSerial.h>
    
    // SoftwareSerial Pins
    #define rxPin 2
    #define txPin 3
    
    // Setup Software Serial
    SoftwareSerial softSerial = SoftwareSerial(rxPin, txPin);
    
    // Global Setup
    int middleLED = 11;
    int rightLED = 10;
    int leftLED = 12;
    
    int leftButton = 5;
    int leftButtonCurrent = LOW;
    int leftButtonReading;
    int leftButtonPrevious = HIGH;
    long leftButtonTime = 0;
    long leftButtonDebounce = 200;
    
    int middleButton = 4;
    int middleButtonCurrent = LOW;
    int middleButtonReading;
    int middleButtonPrevious = HIGH;
    long middleButtonTime = 0;
    long middleButtonDebounce = 200;
    
    int rightButton = 6;
    int rightButtonCurrent = LOW;
    int rightButtonReading;
    int rightButtonPrevious = HIGH;
    long rightButtonTime = 0;
    long rightButtonDebounce = 200;
    
    int tempPin = 5;
    int tempAnalog = 0;
    int tempF = 0;
    
    char* currentRequest = "";
    
    // Start up program
    void setup() {
    
    pinMode(rxPin, INPUT);
    pinMode(txPin, OUTPUT);
    
    pinMode(leftLED, OUTPUT);
    pinMode(middleLED, OUTPUT);
    pinMode(rightLED, OUTPUT);
    
    pinMode(leftButton, INPUT);
    pinMode(middleButton, INPUT);
    pinMode(rightButton, INPUT);
    
    softSerial.begin(9600);
    delay(100);
    
    Serial.begin(9600);
    delay(100);
    
    Serial.flush();
    delay(100);
    
    // Setup LCD
    clearLCD();
    setBacklightBrightness(9);
    delay(1000);
    
    // Test LEDs
    digitalWrite(leftLED, HIGH);
    digitalWrite(middleLED, HIGH);
    digitalWrite(rightLED, HIGH);
    
    delay(1500);
    
    digitalWrite(leftLED, LOW);
    digitalWrite(middleLED, LOW);
    digitalWrite(rightLED, LOW);
    
    }
    
    // Start main program loop
    void loop(){
    
    // Get Analog Input and scale as temperature for ioBridge temperature sensor on arduino
    tempAnalog = analogRead(tempPin);
    tempF = tempAnalog / 6.875;
    
    // Monitor left button status and debounce
    leftButtonReading = digitalRead(leftButton);
    
    if (leftButtonReading == HIGH && leftButtonPrevious == LOW && 
              millis() - leftButtonTime > leftButtonDebounce) {
    if (leftButtonCurrent == HIGH) leftButtonCurrent = LOW;
    else {digitalWrite(leftLED, HIGH);
    clearLCD();
    delay(100);
    softSerial.print("Outside: ");
    delay(100);
    softSerial.print(tempF);
    delay(100);
    moveCursor("02", "01");
    delay(100);
    softSerial.print("Atlanta: ");
    leftButtonCurrent = LOW;
    //Request temperature in Atlanta via ioBridge
    Serial.print("[[[weather|Atlanta]]]");
    digitalWrite(leftLED, LOW);
    }
    leftButtonTime = millis();
    }
    
    leftButtonPrevious = leftButtonReading;
    
    // Monitor middle button status and debounce
    middleButtonReading = digitalRead(middleButton);
    
    if (middleButtonReading == HIGH && middleButtonPrevious == LOW &&
             millis() - middleButtonTime > middleButtonDebounce) {
    if (middleButtonCurrent == HIGH) middleButtonCurrent = LOW;
    else {currentRequest = "Google";
    digitalWrite(middleLED, HIGH);
    clearLCD();delay(100);
    softSerial.print("GOOG: $");
    delay(100);
    middleButtonCurrent = LOW;
    //Request Google Stock Price via ioBridge  
    Serial.print("[[[stock|GOOG]]]"); 
    digitalWrite(middleLED, LOW);
    }
    middleButtonTime = millis();
    }
    
    middleButtonPrevious = middleButtonReading;
    
    // Monitor right button status and debounce
    rightButtonReading = digitalRead(rightButton);
    
    if (rightButtonReading == HIGH && rightButtonPrevious == LOW &&
                millis() - rightButtonTime > rightButtonDebounce) {
    if (rightButtonCurrent == HIGH) rightButtonCurrent = LOW;
    else {
    digitalWrite(rightLED, HIGH);
    clearLCD();
    delay(100);
    softSerial.print("Alert: ");
    delay(100);
    rightButtonCurrent = LOW;
    //Send email via ioBridge  
    Serial.print("[[[email|hans@nothans.com|Alert|Mom, is pressing your buttons]]]");
    digitalWrite(rightLED, LOW);
    }
    rightButtonTime = millis();
    }
    
    rightButtonPrevious = rightButtonReading;
    
    // Display serial messages
    if(Serial.available() > 0){
    
    delay(100);
    
    char charIn = 0;
    byte i = 0;
    char stringIn[32] = "";
    
    while(Serial.available()) {
    charIn = Serial.read();
    stringIn[i] = charIn;
    i += 1;
    }
    
    if (currentRequest == "Google") {
    
    softSerial.print(stringIn);
    int stockPrice = atoi(stringIn);
    delay(100);
    moveCursor("02", "01");
    delay(100);
    stockPrice = stockPrice - 405;
    softSerial.print("Change: $"); 
    delay(100);
    softSerial.print(stockPrice);
    currentRequest = "";
    
    }
    elsesoftSerial.print(stringIn);
    }
    
    // End program loop     
    }
    
    //
    // ioBridge Serial LCD Functions and Parameters (for SoftwareSerial)
    //
    
    void displayMessage(char* message){
    softSerial.print(message);
    }
    
    void clearLCD(){
    softSerial.print(0xFE, BYTE);
    softSerial.print("Z");
    }
    
    void setBacklightBrightness(int level){
    // level
    // 0=Off -> 9=Brightest
    
    softSerial.print(0xFE, BYTE);
    softSerial.print("B");
    softSerial.print(level);
    }
    
    void setBacklightTime(int level, byte seconds){
    // level
    // 0=Off -> 9=Brightest
    
    // seconds
    // 01 = 1 seconds => 06 = 60 seconds
    
    softSerial.print(0xFE, BYTE);
    softSerial.print("T");
    softSerial.print(level);
    softSerial.print(seconds, BYTE);
    }
    
    void moveCursorHome(){
    softSerial.print(0xFE, BYTE);
    softSerial.print("H");
    }
    
    void turnCursorOn(){
    softSerial.print(0xFE, BYTE);
    softSerial.print("J");
    }
    
    void turnCursorOff(){
    softSerial.print(0xFE, BYTE);
    softSerial.print("K");
    }
    
    void turnBlinkingCursorOn(){
    softSerial.print(0xFE, BYTE);
    softSerial.print("P");
    }
    
    void turnBlinkingCursorOff(){
    softSerial.print(0xFE, BYTE);
    softSerial.print("Q");
    }
    
    void scrollMessage(int row, int speed, char* message){
    // row
    // 1=First Line -> 2=Second Line
    
    // speed
    // 0=Slowest -> 9=Fastest
    
    softSerial.print(0xFE, BYTE);
    softSerial.print("S");
    softSerial.print(row);
    softSerial.print(speed);
    softSerial.print(message);
    softSerial.print(0xFE, BYTE);
    }
    
    void moveCursor(char* row, char* column){
    // row
    // 01=First Line -> 02=Second Line
    
    // column
    // 01=First Position -> 16=Last Position
    
    softSerial.print(0xFE, BYTE);
    softSerial.print("L");
    softSerial.print(row);
    softSerial.print(column);
    }
    
    void drawHorizontalGauge(int row, char* leftLabel, char* rightLabel, char* length){
    // row
    // 1=First Line -> 2=Second Line
    
    // leftLabel and rightLabel
    // 2 character labels
    
    // length
    // a=Empty -> k=Full (filled in from left to right)
    
    softSerial.print(0xFE, BYTE);
    softSerial.print("G");
    softSerial.print(row);
    softSerial.print(leftLabel);
    softSerial.print(rightLabel);
    softSerial.print(length);
    }
    
    void drawVerticalGauge(int height){
    // height
    // 0=Bottom -> 8=Top (filled in from bottom to top)
    
    softSerial.print(0xFE, BYTE);
    softSerial.print("V");
    softSerial.print(height);
    
    }
    Bonus Project

    It’s simple, but I hacked together a power supply for the Arduino, which gets power from USB or a coaxial input from a transformer. I wanted to only run one brick, wall wart, so I hacked a USB cable. There are 4 wires in the USB cable (from pinouts.ru):

    1 VCC Red +5 VDC
    2 D- White Data -
    3 D+ Green Data +
    4 GND Black Ground
    The IO-204 has a regulated 5VDC and ground (up to 1A – 4A total draw depending on supply) on each channel, so using a terminal strip, I connected the VCC and GND to a cut in half USB cable.

    It’s magic – look ma, only one power source.

    Share this

    Projects

    api, arduino, google, iobridge, liquidware, stock quote, usb, usb power cable, web 2.0

  • Recent

    • MyToaster: 10 Best Inanimate Objects on Twitter
    • A Kickstarter Christmas: Going Cardboard — a documentary about board games
    • Las 10 cuentas de Twitter más divertidas y absurdas
    • CheerLights: my lights are linked to everyone else’s
    • Greencastle Movie Stills
    • Internet of Things DCWEEK Workshop during DCWEEK
    • Greencastle, Independent Film on Kickstarter
    • EL Pumpkin is Spanish for Electroluminescent Pumpkin
    • Internet of Things Talk at Carnegie Mellon University
    • Thank You, Steve Jobs
  • Tags

    airport arduino cards comedy writing dating Dominion games google Greencastle hack halloween internet of things iobridge IT lan liquidware movies my toaster optimization packet analysis Perl printer drivers printing procedure Projects psychology pumpkin recieve-only reviews services sniffing social networking SparkFun steampunk tech support tessco thingspeak twitter ubernote web 2.0 web applications web of things windows windows vista wireshark
  • Archives

    • March 2012 (1)
    • February 2012 (1)
    • January 2012 (1)
    • December 2011 (1)
    • November 2011 (3)
    • October 2011 (3)
    • September 2011 (1)
    • June 2011 (1)
    • February 2011 (2)
    • September 2010 (4)
    • July 2010 (2)
    • June 2010 (2)
    • May 2010 (1)
    • April 2010 (2)
    • March 2010 (3)
    • February 2010 (1)
    • December 2009 (1)
    • October 2009 (2)
    • September 2009 (1)
    • August 2009 (1)
    • June 2009 (2)
    • May 2009 (1)
    • April 2009 (1)
    • January 2009 (1)
    • December 2008 (3)
    • October 2008 (1)
    • June 2008 (1)
    • May 2008 (1)
    • April 2008 (1)
    • December 2007 (2)
    • November 2007 (1)
    • October 2007 (1)
    • September 2007 (1)
    • July 2007 (1)
    • June 2007 (1)
    • May 2007 (1)
  • Latest Tweets

© Copyright I am ShadowLord. All rights reserved.

Theme designed by Nischal Maniar