swan tron dot com

Command Line LCD Arduino Interface

Liquid crystal displays are pretty awesome. Command line interfaces are very awesome. Hmm…

I started daydreaming at work about how to go about making hardware interface with an RSS feed. I have seen some projects that use Arduinos with ethernet shields to check Twitter, for example, but they seem unnecessarily bulky. Or clumsy. I spend a lot of time working on the command line, and love to put together dirty little scripts to solve problems. It sort of goes along the lines of ‘when you have a hammer, everything looks like a nail’…I figured that the same thing could be implemented with a little shell scripting and my trusty Arduino, sans anything complicated.

So far, so good.

bad lab mobile

I put together a sketch (after the bump) to drive my LCD, writing serial output to the screen. After verifying that the sketch worked via the Arduino IDE’s serial monitor, I popped open a CLI and got to work. FWIW, I am using Ubuntu 11.04 still…ctrl-alt-t pops open a terminal window…unity has me all over shortcuts these days. Anyhow, I was able to verify that I could echo text and direct it to the USB port that the Arduino was mounted to. No sweat.

As a proof of concept, I decided to display the number of times that I had the word “awesome” on swantron.com. Once the LCD was shown to work, the sky is the limit…see some regex, pipes, wget, and so forth in action:

CLI FTW

Survey says:

+11 awesome

Eleven “awesome"s. Awesome.

So that is that. You could link two of these together for 160 characters…toss together a shell (or Python, etc.) and have a Twitter display, for example. Whatever you want to…gosh.

I did notice an odd “feature” of the Liquid Crystal library I used. For some reason, it wraps lines in an interesting fashion…

command line usage: **

echo “why does this library I am using wrap text wonky as hell?” > /dev/ttyUSB0** 1 > 3 > 2 > 4

No idea why this is. Sort of confusing. Anyhow, the entire sketch is pretty straight forward. Did somebody say snippet?

// LCD sandbox
// https://swantron.com
// driving LCD from command line
// 2011

#include <LiquidCrystal.h>

// **Define pins**
// LCD RS - pin 12
// LCD R/W - pin 11
// LCD ENABLE - pin 10
// LCD BACK+ - pin 13
// LCD DATA4 - pin 5
// LCD DATA5 - pin 4
// LCD DATA6 - pin 3
// LCD DATA7 - pin 2
// LCD VSS, CONTRAST,  BACK- - ground

LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);

int backLight = 13;    // Define pin for backlight

void setup()
{
  pinMode(backLight, OUTPUT);
  digitalWrite(backLight, HIGH); // Backlight level (LOW / HIGH)
  lcd.begin(20,4);               // (Columbs, Rows)
  Serial.begin(9600);
}

void loop()
{
  // when characters arrive over the serial port...
  if (Serial.available()) {
    // wait a bit for the entire message to arrive
    delay(100);
    // clear the screen
    lcd.clear();
    // read all the available characters
    while (Serial.available() > 0) {
      // display each character to the LCD
      lcd.write(Serial.read());
    }
  }
}

We’ll see where this one ends up. This one might be a launching pad for a bigger and better thing. Stay tuned.

Upside of My Coffee Intake

I have always felt a touch of guilt in regards to the amount of coffee I throw down the colloquial hatch on a daily basis. I drink the stuff out of a pickle jar…I kid you not: coffee vs cancer It cools quicker. Bonus. My guilt was nuked from orbit today. I saw on /. this morning that the Oxford Journals published some National Cancer Institute findings, linking extreme coffee intake with a decreased chance of getting prostate cancer. The non-science-y results are as follow:

Conclusions: We observed a strong inverse association between coffee consumption and risk of lethal prostate cancer. The association appears to be related to non-caffeine components of coffee. Granted, they used caffeine-free coffee for their test…so that may offset some of my apparent benefits. I am still counting this as a huge win. Especially since this was all about the prostrate…I’ll tip a cup to that. Or a jar.

Inexpensive Ink Cartridges

Back in my college days, I did a lot of printing. As a math major, I probably printed a fraction of the amount of pages that most students had to rifle off. Most of our work was done either by hand on paper, or done utilizing math software of some nature (Matlab, Maple, etc.) and submitted directly into a professor’s shared folder. Call it old school or just plain old, but that is the nature of the beast. Even with that on my side, I wound up printing all of the time…between my core course work and math reports (no kidding) I was constantly hitting Ctrl - P. My sample size is sufficiently large to draw a parallel between ‘important printing task’ and ’empty ink cartridge.’ Every…single…time. I don’t know how many times I found myself trying to get to Staples before closing time, in order to buy a replacement cartridge. Too many. To add insult to injury, brick and mortar retail prices are the stuff of nightmares. Those markups still blow my mind. Pretty much outrageous. Like my octopus drawing: octopus ink Not to date myself, but online shopping was limited in my day. Amazon was around, but primarily for books. Specialty places were popping up…and then subsequently bursting when everything hit the colloquial fan. Comparative online shopping stuck, however. One of the things I am jealous of now are the deal pricing that you can find on ink cartridges. Very jealous…that would have put me in Cup of Noodle instead of Ramen. But, I digress. I have seen some creative stuff out there. You can buy bulk ink…shooting for the DIY fill-it-at-home crowd. Some models have cartridge reset units springing up…allowing the user to gain a few more prints per refill. The two main drawbacks of that are time (time is money) and quality. A lot of the replacements are prone to smudging…may as well pay for the real deal and do it right. At the end of it all, I have had good luck finding ink cartridges for my HP and Kodak printer online. Hit that link to see my go-to site.

Easy LCD Arduino Display

I am tired of looking at wobbly windows full of Eclipse. The best and worst part of the IOIO board is the fact that the libraries are Java-centric…unfortunately, I am in the middle of a ‘worst’ phase. I am sort of stalemated. Unfortunately, my issue lies in something that should be trivial, namely naming. Once I can figure out how to orient the crap out of these object-ass pins, I will be good to go. Until then…I am going back to the basics. Processing looks so safe and warm. Coziness, for the win.

How about a 20 by 4 LCD project? Okay.

+1 blue

I have had this sitting on the workbench of bad lab for a while. Time to get after it.

The unit came assembled, minus the jumpers I needed to plug this into my breadboard for prototyping. Coincidentally, my soldering station needed to come out of retirement. Sixteen pins…sounds about perfect.

those.

I snagged the unit from hacktronics.com. Their website has details on the pin-level for the LCD unit. Pretty straight forward…slam it together and feed it a string or four. Wiring as follows:

+ several wires

It has been a while since we have had a snippet. Fair enough; queue the snippet:

// LCD sandbox
// https://swantron.com
// 2011

#include <LiquidCrystal.h>

// **Define pins**
// LCD RS - pin 12
// LCD R/W - pin 11
// LCD ENABLE - pin 10
// LCD BACK+ - pin 13
// LCD DATA4 - pin 5
// LCD DATA5 - pin 4
// LCD DATA6 - pin 3
// LCD DATA7 - pin 2
// LCD VSS, CONTRAST,  BACK- - ground

LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);

int backLight = 13;    // Define pin for backlight

void setup()
{
  pinMode(backLight, OUTPUT);
  digitalWrite(backLight, HIGH); // Backlight level (LOW / HIGH)
  lcd.begin(20,4);               // (Columbs, Rows)
  lcd.clear();                   // Clear screen
  lcd.setCursor(0,0);            // Move cursor, print
  lcd.print("liquid      |   swan");
  lcd.setCursor(0,1);            // Move cursor, print
  lcd.print("crystal     |   tron");
  lcd.setCursor(0,2);            // Move cursor, print
  lcd.print("display     |    dot");
  lcd.setCursor(0,3);            // Move cursor, print
  lcd.print("(FTW)       |    com");
}

void loop()
{
}

That is that. Again, the potentials for this sucker are vast. I would like to to let this rip with my PING sensor, but need to throw some more effort towards the IOIO. Java schmava. Stay tuned for a bad assed project of some nature…even plan B is pretty awesome these days.

World’s Greatest Search Term

Tearing through my server logs, I have encountered the best search term in the world. nasa discovers new life in your butt I sure hope that the searcher found what he or she was looking for. In your butt.

Woot Bag-O-Crap FTW!

I’ve been trying to snag a Bag O’ Crap from Woot since 2007. At long last, victory is mine. woot bag o crap I verified that my card has been billed…it appears legit. I might have to post a nerdy un-boxing vid. Pretty excited here. For the record, I have used trackers in the past to no avail…this one was done with pure dumb-luck. No bots, for the win.

IOIO Android Breakout Board

~~~~ WARNING: AWESOME ~~~~ My new thing has officially arrived. Both in the literal sense and philosophically. I love my Arduino, and I love my Android…now I can have the best of both. Introducing, the IOIO breakout board… ioio breakout board I snagged this guy from SparkFun. You know how the Android is full of stuff? Accelerometers, touch screen, GPS receiver, WiFi…etc? Instead of having to start from scratch for each of my Arduino projects to introduce components, this board will allow me to use the Android/Java as the backbone of my code, instead of using Processing/C++. And that, my friends, is +++. Take a look at this awful-picture-quality-having video: Sorry about that…I had to use Katie’s old BlackBerry to record the demo. It leaves much to be desired. Anyhow, so far I have just managed to get Eclipse configured, and have uncovered several gotchas. The biggest obstacle was getting the permissions worked out and linking the libraries properly. When in doubt, chmod -R 777 * and let it rip. We’ll see what comes of this…could be cool once I dust off my Java skills. Of note: pretty sure I am the first person to get this working on a Droid 2, and likely the first to set this up on Linux. It just shipped yesterday, so the sky is the limit on this…I am very excited. Big props to Ytai and SparkFun.

Cheap Eyeglasses

Due to either poor eye genes or work related strain, my vision has really taken a turn for the worse. Let’s just go with work and call it a day…three monitors are certainly awesome, but can’t be helping things out much. Regardless, I find myself on the hunt for some [link removed}. My buddy Dock and I managed to sneak out to the golf course last weekend. It was my first round for years where I have managed to swing my driver all day (without giving in and hitting my three iron off of the tees) which was great. It was way less than great to need a spotter to figure out where I was ending up, due to my horrible eyesight. I can out drive the limits of my sight…for the win? Baseball is right around the corner…time to handle this thing. Zenni is the place to go for online eyeglasses. Quality eyewear without the gauging that you will see at the optometrist. If you can see your bill. You may be surprised by the actual prices… zenni opticalgreat specs …looking sharp. Head to the local WalMart, shell out a few bucks for your prescription, and holler at Zenni. Cheap enough for redundant backups.

LED…Matrix or Cube?

They’ve arrived… white leds 125 white LEDs. My first thought is 5*5*5 LED cube, powered by the Arduino. I am also thinking that a 6*20 LED matrix would be pretty slick. Either way, my soldering skillz will be put to the test, and awesomeness will surely ensue.

Electronics Recycling Info

Let me vent, briefly. My first cell phone was a mobile phone. Mobile, as in car phone. Car phone, as in ‘you can make calls from this faux leather bag that sits on the passenger seat with this gigantic handset’ apparatus. No kidding. The bonus to that phone, and to the candy bar Nokia phones that I had after that gem, was in the unit’s reliability. Believe me, I did my fair share of stress testing those first cellies…I was using those things, and using them hard. At some point along the way, mobile phones became disposable. Whereas you could probably still dig a Motorola StarTac out of your junk bin and power it on, an LG from three years ago would be absolutely worthless. Likely, it would be problematic within the first few months. To combat this, companies like Verizon jumped all over a marketing plan for ’new in two’ and similar schemes…wherein you look forward to getting a shiny new phone…often after your buggy unit started acting up out of the gate. Distraction? Yes. Term of the day: planned obsolescence. Stuff fails, which is fine, but the whole idea of moving products often shows itself on the back side of things. What to do with old electronics? old electronical components My workspace is full of old components. I am big into the ‘REUSE" side of the triple Rs. I can (and do) pull all sorts of awesome junk off of a scrapped piece of tech. But when that is done, one must figure out the whole electronics recycling aspect of the deal. There is a reason not to throw out an old tower or television…several chemical reasons, in fact. The big reason we see computer recycling companies is not for them to turn a profit selling used wares. There are lead, cadmium, beryllium, mercury, and bromine en mass in old components…good example being those wonky old CRT televisions and computer monitors that are quickly being replaced. Can’t exactly introduce that into a standard landfill. Those companies are keeping the lights on by grabbing usable components, true, but are doing better by selling the copper, steel, and plastic that they can reap from recycled goods. Win/win. Hit one of those links to see an example of how this is done (and done well.) If you don’t take me up on that advice, don’t toss your old electronics in the trash out of principle. All of that solder is mostly lead, and circuit boards are swimming in solder.