Ultrasonic Distance Sensing

I really should have a running list of these mini-projects I have been cranking out. This one: using a PING))) sensor from Parallax Inc to drive LEDs for a set of values. Sounds boring, but it is sort of cool. Oh cool.

Picture time:

doing work at work, again

doing work at work, again

Follow the bump for a vid / snippet
Continue reading

Ping Sensor Project Preview

Parallax Ping))) sensor in the house. Literally.

ping ping ping ping ping ping ping ping

pong

This dapper-looking little guy can accurately measure distance from a few to a few hundred cm. It is very simple by design…basically just a sonar setup. My sketch sends out a signal and listens for the signal’s signature upon return…calculates time elapsed and interpolates distance using the approximate speed of sound. Slick like Rick.

I hugged the sensor on my binary-project-having breadboard, as this is going to be incorporated in some way. My fr1st thought is to turn those LEDs into range holders, and output according to range. Could be awesome. Stay tuned.

Driving Multiple LEDs with an Arduino

I have had a bunch of white LEDs in my Amazon shopping cart for quite some time. I was tossing around the idea of doing a 5×5 cube a while ago, but ran out of steam on that project. I blame the PowerSwitch Tail…I had relays on the brain, big time. Still drafting out my big project on that front; stay tuned for some sweet garage door action. I rarely find my self with two projects in flight, that may actually turn into something, but I just might have stumbled back into the LED arena.

Long story short, I had my Arduino, Mini 9, some white LEDs, and exactly seven jumper wires in my backpack. I stepped upstairs at work for lunch, and decided to horse around with them…see what it takes to run multiple LEDs. Seems basic, and it is. Fortunately…

Here is he setup…

six shooter

not much to it

I put together a little sketch. I managed to grab the time-stamp notion from this sketch that is included with the IDE, and run with the rest of it. There will be snippet, but snippet will follow A SWEET VIDEO FTW

Video / snippet / wrap-up after the bump
Continue reading

Arduino Servo Fan Control

Before you try to dr this, I have included a video to combat the tl crowd. You’re quite welcome. See below.

Now I’ll explain. I may even toss in a snippet…who knows.

Basically, I found myself with a few free hours, an Arduino, a bunch of random components in my lab (read: garage) at my disposal, and no real plan of attack. Result? Arduino/servo motor controlled fan.

Jump off component…silver spray painted Altoids can. Nice…chop that sucker up so I can smash a servo motor in there.

minty

+1 minty

Well done. See…

works well

dang, son

Lady Ada uses these for some random projects. If you can stomach a whole bunch of crappy mints, you have a nice little Arduino-sized metal casing. Of course, it poses a grounding threat, which I experienced working with my motor shield a while back. That said…keep a few around. I have put this one to use before.

Next step…testing the servo

wires

wires for the win

For this, I broke out my motor shield. It doesn’t have any features that would benefit this project…the servo areas are basically just power, ground, and control. Control pumps into the 16B 10 port, like a jumper…that works for my debug.

Next, implement a fan.

big fan

I'm a big fan.

I snagged this fan from an old tower, I think. I really don’t know. It seemed to react well to a 9V battery, so I tried it with a 5V source…same deal. Awesome. I used a zip tie to fasten this to that, that being the Altoids enclosure.

This thing needs a base…man-clamp to the rescue:

secured

man-clamp

I picked this up, to use it as a soldering base. That ‘x-tra’ hands piece of shit that I have previously posted in pictures didn’t cut it. This is the manly version. And, it works great for this project, I believe…you can decide based upon the vid. Here is what it looks like, with some more detail.

fan

clamp in action

Let’s add some code…oh no…sounds like we’ve reached the BALLIN ASS SNIPPET ZONE

#include

Servo myservo; // servo opbect

int pos = 0; // initialize

void setup()
{
myservo.attach(10); // digi pin 10

void loop()
{
for(pos = 0; pos < 180; pos += 1) // from 1 to 180 { myservo.write(pos); // moves servo delay(20); // waits 20 ms } for(pos = 180; pos>=1; pos-=1) // sweeps span between 180 and 1
{
myservo.write(pos); // moves servo
delay(20); // waits 20 ms
}
}

If that looks familiar, it is because it pretty much the sweep example from the Arduino IDE. No changes necessary…I like when that happens.

Here is the final product:

fan

I'm a big fan of this little fan. Sorry.

Not bad, for a quick slam-together exercise. It isn’t really robotic, since it has no sensors. I could bump this up a notch with some IR LEDs, or my PIR sensor, but that is for another time.

Blah blah blah, stay tuned, blah blah. Until then.

Alarm System In Progress

I suppose I should add a few words. I placed the images in an empty post several days ago, and sort of forgot to update the text on mi telephono.

Dios mio!

speaker

netbook action shot

Well, long story short. I put together the little POC using my PIR sensor a while back. The shit deal, is that the sucker only writes high and low. Easy, for the win. Limited, for the loss.

I may or may not have (I did) disassembled a few CRT TVs last month. Hence, have all sorts of components, such as small sub 9V speakers…

wires

the wires are wire-y

I’m trying to do something with a dual speaker setup, in order to shine up my bugler alarm project. The code is boring…stay tuned…I might be able to come up with something amusing.

State of Affairs

I’ve been busy. General business…not so much free time business. Here is a brief run-down of what is in the works:

Item: Environment updates

I am in the middle of re-purposing my computers. I have three flavors of Linux that I use on a regular basis. Gone will be that setup, along with all dual-boot machines. I am going to dedicate my Mini9 netbook as my ‘work at work’ machine…my old 17″ Dell will become my bench computer for my electronics projects…and my slick 15′-er will be my couch computer slash backup unit. All will run Ubuntu 10.10 with Gnome for the time being. I am toying with online storage options, so that I can drop files to and from my Droid without using swantron.com’s server space. More to come on that.

Action shot…updating the Mini 9 from Ubuntu 10.4 Netbook to Ubuntu 10.10 Desktop…

netbooky

little guy --------------------------------^

Bonus from above…real time apt-get Arduino V0022 action

Item: PIR sensor work on the Arduino

I actually had a little POC put together last week, before the system reboot. I made a generic little alarm, using the passive infrared module and a piezo. Once I can get the Arduino IDE up and running on all three boxes, I’ll snap some pics, clean stuff up, and let it rip. Stay tuned.

Item: General EE work.

I’ve been tearing apart all sorts of stuff. Two CRT TVs, some media players, etc. I didn’t document much, but managed to keep from discharging some big ass capacitors. For the win. The goal is to locate points of failure, and swap out components on the board level. This all stems from the flat-iron failure…for which I’m searching for a replacement switch and diode. Pretty cool.

That is about it. It looks like my wireless on the Mini is non-functional. Great. I’m off to track down an ethernet cord.

Arduino Solar Cell Night Light Concept

So, I’ve formalized the solar cell project I have been poking at for a while. I managed to clean up my code and mess with some initial conditions, etc., and now have a fairly solid proof of concept for a solar cell-centered night light.

lighty

you may want to ramp up that LED a bit

As was the case in my first few runs, my sketch incorporates a five second initialization phase. This acts to set both relative minimum and maximum values which act to provide “full light on” and “full light off” values, respectively. The generated power from the solar cell is read in to the Arduino via analog input, and the LEDs are driven via digital outs. The rest is some simple math that transforms the range of the analog signal into a digital range of zero to two hundo fifty five.

It’s giant-ass-text-having snippet time!

// Solar LED IO
// Joseph Swanson | http://swantron.com
// 2011

// Define constants
const int sensorPin = A3; // Solar cell Pin
const int ledPin = 5; // varuiable LED Pin

// Define variables
int sensorValue = 0; // wipe read value
int sensorMin = 0; // set initial min
int sensorMax = 1023; // set initial max

void setup() {

// turn on Pin 11 LED…indicates calibration period begin
pinMode(11, OUTPUT);
digitalWrite(11, HIGH);

// stay lit for five seconds
while (millis() < 5000) { sensorValue = analogRead(sensorPin); // adjust for real max if (sensorValue < sensorMax) { sensorMax = sensorValue; } // adjust for real min if (sensorValue > sensorMin) {
sensorMin = sensorValue;
}
}

// end Pin 11… calibration period finito
digitalWrite(11, LOW);
}

void loop() {
// read the solar cell analog
sensorValue = analogRead(sensorPin);

// apply a little calibration to the sensor reading
// bit from example sketch at http://arduino.cc
sensorValue = map(sensorValue, sensorMin, sensorMax, 0, 255);

// set constraint for outliers with respect to min/max
sensorValue = constrain(sensorValue, 0, 255);

// fade the LED from one to 255
analogWrite(ledPin, sensorValue);
}

Pretty straight forward. On to the vid…


It’s web2.0-too-many-script-ass-calling embedded video time!

Not too bad. Again, I used an Arduino Duemilanove and a Solar World panel. I might try to further this concept by incorporating my 120V switch and getting a lamp up in here. Stay tuned, as always.

Arduino Solar Cell-Based Detector

*Proof of Concept Warning*-*Proof of Concept Warning*-*Proof of Concept Warning*

Mission: Utilize a solar cell to vary the intensity of an LED

Supplies: Arduino Duemilanove <--> USB <--> Notebook (Linux, por supuesto)
Breadboard, Jumper Wires, Make-shift Jumper Wires (spare resisters), LEDs, Solar Cell

Setup: Here it is

work at work

I herd you like to work, I set you up so you can work at work

The setup is pretty straight forward: Read analog, write digital. The primary hurdle was figuring out the initialization step. Basically, I needed to provide a time-frame where you can read in minimum / maximum values from the cell. The LEDs in the awesome video below show the results… v

This project is full of take-off ideas. Reverse the range on the LED outputs, and you have a setup that powers up a light as the ambient light levels fall. Motion detector…you bet. You could implement a setup to run the initialization cycle at intervals, to provide a real-time average light level, and check for a delta of some size. Boom. There you go.

I’ll clean up the code, use some real jumpers, horse around with things in general, and throw up a post. With a snippet. Check back.

Woops

Nuked that LED from space…

blown led

and boom goes the dynamite

In my ongoing fight with my Ethernet Shield, I had a bright idea that the sucker might have some bad jumpers. Welp, I put together a little blinking LED code and let it rip…which worked. I then tried to run the LED through the 3V lead…but…plugged the bastard into the 5V slot.

Fire and brimstone. Long story short, the board is getting power, the jumpers are fine, and that sweet clear LED is toast.