Thursday, September 27, 2012

Steampunk inspired USB stick

Now that I've got addicted to steampunk I've built my first device - a USB stick made from copper:




It seems that it needs still some pipes and wires!

Saturday, August 25, 2012

Wednesday, August 15, 2012

LED bar shield, Part II

F... I've pimped the LED bar shield with a second shift register, but there seems to be a bug with the soldering. The LED bar shows the first pattern, and nothing more happens.

Saturday, June 16, 2012

LED bar shield, Part I

The LED bar shield shall hold two shift registers 74HC595 and a LED bar with 20 LEDs; 16 LEDs of it will be used. The sketch shall choose randomly one of several patterns and run it five to ten times. Then it selects another one.

The first version of the shield was a disaster - the design was much too small. (And the distance were too small to be soldered by a smoker with old eyes ;-)). So I redesigned it with a larger PCB.

Here are some pictures of the first stage populated with one shift register:





Sunday, May 27, 2012

First shield: adaptor

After gambling around with shift registers (74HC595) I thought it could be a good idea to build the first shield. Two shift registers shall control the LEDs of a Knightbright LED bar graph.

The first step was an adaptor shield - thanks to Erik Bartmann for this idea (für die deutsch sprechenden Leser: "Die elektronische Welt mit Arduino entdecken" ist eine empfehlenswerte Lektüre). This way I have only one shield with bended pins, and use my future shields with the usual 2.54 mm distance of every pin header.

First step: milling the paths of the striped printed board.
Second step: soldering the pin headers.
Here you see the first header already soldered and the second one in position:



The two headers on the left side are only to keep the board parallel to the desk.


Finished, but not cut to size:


Now it's time to start with the "LED bar graph shield". At the moment there are only the headers:



And this is the result:















Thursday, May 3, 2012

Evil Spider 2

This is a new version of the evil spider. I've replaced the LED in the head with two smaller LEDs in the eyes. This way the brightening is easier to see.

video

Some close-up photos are at the end of this post - if you fear spiders, scroll slowly down to the image with breadboard ;-)

The source code is rather simple:



/*  Spider - sketch for spider control
 *
 *  12. Apr 2012   danimath   created
 *  02. May 2012   danimath   added blinking
 *
 **********************************************************************/
byte          usPin = 8;       // ultrasound pin
unsigned long usDuration;      // ultrasound duration
unsigned int  cm;              // roughly calculated cm
byte          ledPin = 3;      // LED pin
int           brightness;      // LED brightness
int           min_threshold =  15 ; // treshold for blinking LED
const int     max_threshold = 100; // treshold for brightning LED
const int     mesDelay = 250;  // msec between measurements

//#define DEBUG

/*   setup - initialise things
 *
 **********************************************************************/
void setup ()
{
#ifdef DEBUG
    Serial.begin (9600);
#endif
    analogWrite (ledPin, 255);
    usDuration = getDist ();  // warm up measurement
    delay (2500);
    analogWrite (ledPin, 0);
}

/*   loop - the ever lasting loop
 *
 **********************************************************************/

void loop ()
{
    usDuration = getDist ();
    cm = usDuration / 58;  // int is enough for this
#ifdef DEBUG
    Serial.print   ("usDuration: ");
    Serial.println (usDuration);
#endif
    if (cm < min_threshold)
    {
        if (brightness == 0)
            brightness = 255;
        else
            brightness = 00;
    }
    else if (cm < max_threshold)
        brightness = map (cm, 0, max_threshold, 200, 0);
    else
        brightness = 0;
    analogWrite (ledPin, brightness);
    delay (mesDelay);
}

/*   getDist - gets the distance from SRF05
 *
 *   return value: micro seconds
 *
 **********************************************************************/
unsigned long getDist ()
{
    unsigned long retVal;

    pinMode (usPin, OUTPUT);
    digitalWrite (usPin, LOW);
    delayMicroseconds (2);
    digitalWrite (usPin, HIGH);
    delayMicroseconds (10);
    digitalWrite (usPin, HIGH);

    pinMode (usPin, INPUT);
    retVal = pulseIn (usPin, HIGH);
#ifdef DEBUG
    Serial.print   (retVal);
    Serial.print   (", ");
    Serial.print   (retVal / 58.0);
    Serial.println (" cm");
#endif
    return (retVal);
}


The hardware is just as simple as the software. This image is created with Fritzing. Of course I didn't use a breadboard in the final construction.




As promised here are the close-ups: