OBD-II Reader for Scion TC

Last semester I had to design a CAN-BUS transceiver to read OBD-II codes using a PIC microprocessor.  I never actually got the chance to hook up to a car, but I figured this summer I would finally get the chance.  And today I discovered that my car doesn’t even have a CAN-BUS!

Slightly discouraged, I knew there had to be a way for the car to output OBD-II data (this has been a requirement in the US since 1996).  That was when I learned about the ISO K-line.

A project was started about 5 years ago, called OBDuino, and I hope to use that resource as much as possible to get a real time OBD reader going in my car.

Thoughts on Poetry and Verbatim Memorization Techniques

For a long time, I’ve been trying to figure out the best way to efficiently memorize poetry (including capitalization and punctuation, since this is what is required at the US memory championships).

I think I’ve finally come to the conclusion that the best way to do it is to have pre-memorized images for common words.  Words like the, a, an, but, or, so, etc.  Also, if there is a period or a capital letter, one should have pre-set images for that as well, interacting with the word.

The word itself can actually be an image of whatever the word is, if it is a noun.  Verbs and non-concrete nouns could be trickier.  For example, how would you try to memorize “fearful”?  How would you go from “fear” to “afraid” to “fearful”.  I guess I would try to break down the word further.  There is both “fear” and “ful”.  ”Ful” –> “full”, so perhaps a bunch of screaming kids afraid of being forced by their mothers to eat more because they are already so full.  They’re so full they’re puking up everywhere around the room while screaming how fearful they are.  You get the picture, hopefully.  Heh.

So I think right now the best way to do it is would be to have a one locus for each word, including punctuation and grammar.  By merit of having nothing else in the locus, that would mean a space, which makes intuitive sense.

I guess for words like a and an those could be including with a word’s locus, too.

Interesting…more later.

I2C (TWI) Communication Between Arduino and an LCD Screen

Yesterday I started this project and I just now finished it.  Here’s the end result, a screen that can print anything I want:

From a hardware standpoint, these two devices have to be connected together in a certain way.  The screen needs a 3.3V power voltage to turn on, which the Arduino conveniently provides.  The screen also needs to be grounded, so that’s the black wire to the Arduino.  I2C works by using two more lines, SDA and SCL (for the data you want to send and the clock timing for that data, respectively).  SDA is the A4 pin and SCL is the A5 pin on the Arduino Uno.  So once you hook those 4 wires up to their right slots on each component, you’re good to go other than setting two jumpers on the side of the screen to configure the screen for I2C and not some other protocol (I may try a different protocol later on to see if I can get it to work, such as UART).

From a software standpoint, the Arduino has some great library files for I2C.  The basic one I used was “Wire.h”.  Basically, for any I2C communication, you have to start with a Wire.begin(), and then a Wire.beginTransmission([address of peripheral you want to talk to]);.  In our case, the screen requires a 0×48 address.  After that, you’re good to write whatever you want to the screen with a Wire.write().

Essentially, from looking at the documentation for the Arduino and the LCD screen itself, anything that is sent from the micro-controller to the screen will be printed to the screen, unless it encounters a 28 (or in hex, 0x1B, which is what I used in my code).  This special character is called “an escape character”, and allows you do fancy things, such as turn on a cursor, the backlight, or reset the screen.  After the escape character you need a “[” character and then you can do all sorts of fancy things given by the table found in the datasheet for the screen:

As you can see from my code below, I used a couple of these special instructions (to clear the screen when you first turn on the Arduino, and a cursor just for kicks and giggles):

/*
Ben Schoeler - 6/4/2012

Writing to a screen using I2C

This example shows how to write to a screen given an address
And other important instructions per the datasheet.
*/
#include "Wire.h" //gives us handy I2C functions
#define lcd_address 0x48 //found in the datasheet

void setup()
{
Wire.begin(); //required to begin talking
Wire.beginTransmission(lcd_address); //required to know what to talk to

Wire.write(0x1B); //escape instruction
Wire.write("[j"); //instruction to clear the screen
Wire.write(0x1B); //escape instruction
Wire.write("[0h");//insruction to wrap line at 16 characters
Wire.write(0x1B); //escape instruction
Wire.write("[2c");//instruction to turn the cursor on and blink

//what we actually want to write to the screen
Wire.write("This is a test of I2C protocol");

Wire.endTransmission(); //required to stop the talking
}

void loop()
{
//this is empty because I don't want to repeat anything
}

Ultimately I want to use this screen as a user interface for a keylocking mechanism. More on that later.

Posted in LCD

Brainstorming Ideas

Today I’ve been exploring possible projects I want to make with Arduino.

I think making a cell phone jammer would be a really cool project to work on, but there seems to be nothing on the net about it for Arduino.  However, I found a very documented cell jammer but it uses only hardware: The Wave Bubble.

Another idea I think that would be simpler to start out with would be a door-lock with a keypad.  I did something with a keypad for school, but that was on PIC architecture and in pure C code.  I would have to do some work to get it to work on Arduino.

 

2 LED’s with Arduino

So for my first project with Arduino, I made 2 LED’s fade and get brighter in a loop.  Basically when one LED is at its brightest the other should be off, and vice versa.

It wasn’t too hard, and the example code provided with the compiler helped me to get started.

/*
Ben Schoeler - 6/1/2012

Fade with 2 LED's

This example shows how to fade LED's on pins 9 and 10

The brightness of each LED will be opposite of the other LED
*/

int yellow_led = 9;
int red_led = 10; // the pin that the LED is attached to
int yellow_brightness = 0; // how bright the LED is
int fadeAmount = 5; // how fast to change the LED's brightness
int red_brightness = 0;

// the setup routine runs once when you press reset:
void setup() {
// declare pin 9 and pin 10 to be outputs:
pinMode(yellow_led, OUTPUT);
pinMode(red_led, OUTPUT);
}

// the loop routine runs over and over again forever:
void loop() {
// set the brightness of pin 9 (yellow):
analogWrite(yellow_led, yellow_brightness);

// set the brightness of pin 10 (red):
analogWrite(red_led, red_brightness);

// change the brightness for next time through the loop:
yellow_brightness = yellow_brightness + fadeAmount;

// reverse the direction of the fading at the ends of fade:
if (yellow_brightness == 0 || yellow_brightness == 255) {
fadeAmount = -fadeAmount;
}

//set red brightness to be the opposite of yellow brightness
red_brightness = 255 - yellow_brightness;

// wait for 30 milliseconds to see the dimming effect
delay(100);
}

I hope to do one of these Arduino projects every day.  I think tomorrow I’m going to set out working on an I2C interface with an LCD screen I have.

Sneak peak:

The Start

Looks like this is my first post.

My Arduino Uno came in today so I think I’m gonna mess around with it a little bit.

This blog will mainly have stuff about Arduino projects, Ableton Live 8 doodlings, mnemonic techniques and some other random stuff that interests me.  Oh yeah, and check out my other website that I’ve been working on for the club I made at school: www.vtmemory.org.

That’s about it for now.  Stay frosty my friends.