Wednesday, April 14, 2010

So I bought a laser cutter...

Something I have always pushed for is to make prototyping and small scale manufacturing easy and cheap for the developing inventor. It's from this strong belief that I've developed quite a fascination in rapid prototyping machines and cnc devices.

I finally decided to purchase a laser cutter, since I already had access to the hackerspace's 3d printer. Unfortunately it's not exactly as easy as jumping on Amazon and reading a few reviews. It took over a week of internet research to come to my decision.

What follows is the what I looked at, and what I eventually decided to buy. Hopefully this will become a multi-post tale of success and glee, and not one of woe. And of course I plan to include a full write-up on setting up, and review of the laser, once I get it.

Monday, March 15, 2010

ATTINY2313 Checksum based serial - March Madness Entry 15

In the last entry, I set up a buffer based ATTINY2313 serial file. In this quick tidbit of code, I implement, using that code, a theoretical implementation of a checksum based serial communication.

Here's the idea - the master gives the slave, our ATTINY2313, a random byte between 0 and 255 (exclusive). It inverts that byte and returns it. It then waits for a SUCCESS or FAIL byte (decided by the implementer). This inversion is a checksum - if the master or the slave are not in sync, the slave would not return the correct checksum, telling both that they need to clear their buffer commands and start over and sync back up.

The modified Serial.c after the jump.

Sunday, March 14, 2010

AVR Serial Buffer - March Madness Entry 14

A little while back, I finally got the USART working on the ATTINY2313. Tonight I managed to adapt buffer code to the device.

The point of the buffer is to allow a host to send a series of commands and let them back up, so that the slave (the ATTINY2313) can deal with the commands as it can. This works best in a one directional setup, where the majority of the information being processed is the master talking to the slave. I will confirm that this works fine for some robotic applications, however. In retrospect I should have used a different system, as that was a robot that mapped an area and returned a heavy amount of data - but it still worked.

In my example, it would wait for 3 bytesCode after the jump.

Saturday, March 13, 2010

March Madness Entry 13

Finally got an Arduino of my own, so I figured while I'm traveling I'll get a simple Arduino program up and running. No video or pictures as I'm in Philly. Simple, short script to get myself up to speed with the Arduino.

The formula I used to calculate the actual distance is linearizing the otherwise cubic return of a typical Sharp IR rangefinder - a popular, easy to use rangefinder that simply returns an analog voltage. This formula can be found in a datasheet provided by Sharp. It may require some minor adjustments for different Sharp sensors.

/*
Sample simple program by Keith Chester

Just print out the distance read from a SHARP IR Rangefinder.
*/

int IR_signal_pin = 1;

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

void loop(){
  int IR_raw_read = analogRead(IR_signal_pin);
  int actual_distance = (6787 / (IR_raw_read - 3)) - 4;
  Serial.println(actual_distance);
}

Friday, March 12, 2010

Second Life - March Madness Entry 12

Some people shudder at the mere thought of it - others salivate at the mere potential of an essentially open world with open scripting and building tools. That's right, I'm talking about Second Life.

I fall somewhere in both camps. I was essentially graded on my immersion of it back in college during my Junior year, where I had to complete an "art project" for a Professor. The project required I write a number of scripts and help generate a lot of interactive content. I got the project done, but was so tired of the public areas of Second Life and the overall depressing reminder of what kind of humanity visits such a place.

It being a lonnnnnnnnnnng time since I've done anything in Second Life, I've managed to forget most of the LSL scripting language. With one of my fellow hackerspace members in charge of virtualizing NJ's state college of Rutgers into the Second Life world, I could hardly not check out the campus and give it a look-see. Heck - the above screen shot is taken in the campus's virtual stadium. Here's a quick hello world that changes a boxes color to red.

Thursday, March 11, 2010

ATTINY2313 Serial - March Madness Entry 11

At the micro controller study group, I decided to dedicate myself to getting a serial library that works on the AVR ATtiny2313 micro controller. I've used the serial ports on ATtiny25/45/85's, Atmega48/88/168/328s, and Atmega644s, etc... But the ATtiny2313 has a weird set of registers for serial port. Since I planned on using it later with a serial application, I realized that I would have to heavily adjust some of my code due to the 2313's odd choice in register names.

This code should work. Please note that the receive interrupt echoes the input - probably a good idea to change that if you're using it for an application.