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.


+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 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:



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.


clamp in action

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


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:


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!


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…


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.

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.


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 |
// 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
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.

Solar Cell Teaser

+1 doing Arduino proofs of concept at work on lunch break


+1 capaciters as jumpers

I packed a solar cell and a little breadboard to work today…put together a little sketch together over my lunch break to control LED brightness with solar cell analog readings.

I shot a little vid that I will toss on YouTube. Expect a full write-up soon. You suckers might even get a snippet…


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.

Arduino Proof of Concept Vid

As promised, behold the much-anticipated footage of my Arduino AC Interface proof of concept. It was dark in my ‘lab,’ so the footage leaves something to be desired.

So, if anyone is in need of a strobe light, hit me up. I’m all over that.

Stay tuned…I am working on the web-side of the Android dev kit, so hopefully I will have another test coming soon. Ethernet shield, Android, Arduino, and 120V…I’m getting giddy.

Arduino AC Interface

I finally got around to throwing out a little proof of concept with my new toy. I managed to utilize a PowerSwitch Tail to gain control of 120V AC with Arduino…and I did it without electrocuting myself. Not getting electrocuted, FTW.

Long story short, the PowerSwitch Tail is a simple switch. 120V AC in, and either 0V AC out or 120V AC out, with the later being the case when a 5V DC signal is introduced to the unit. Here is what it looks like…

switch tail is switchy

Activity: locate brass monkey

I used some jumper wires I had sitting around “the lab.” You can feed anything into that sucker; speaker wire would throw the switch. Moving on…

Well, it turns out that the Arduino loves to dump 5V signals…like it was made to do so. So, this switch setup is perfect for my microcontroller projects…whatever they may turn out. Anyhow, all you need to do is pick a digital out and ground from the Arduino board, and hooks it up. Hooks it up like this…

bonus url

shameless plug

One of the best things (most handy?) is that the IDE makes pushing code to the unit quick. Plug a USB cable in, crank out some code, and there you go.

hook up them shits

hook up them shits

Good news.
It’s MF-ing snippet time!

Relay Switch proof o’ concept

// Assign digital pin 12 for chatting

int ledPin = 12;

// Define setup method

void setup() {

// Define pin 12 as output

pinMode(ledPin, OUTPUT);

// Define loop

void loop()
digitalWrite(ledPin, HIGH); // Switch on
delay(406); // wait
digitalWrite(ledPin, LOW); // Switch off
delay(406); // wait

That is all there is to it…signal for a while, no signal for a while. 406 is a random value, chosen because I like the 406.

I plugged one of Katie’s lamps into the switch…which was plugged into my “lab” power strip.


protip: use discarded tube TVs as experiment stations

Uploaded the code to the controller, and there you have it…

darkness was upon the face of the deep

darkness was upon the face of the deep

Survey says…

let there be light

let there be light, mofo

There it is. I shot a video, but YouTube puked during my upload. Not too upset, seeing as how it was just a video of a DIY strobe lamp. The cool part of this lies in the possibilities to extend upon the concept. Throw a web interface in the mix, and you can have a web-controlled lamp. Replace the lamp with something more useful, and you get the point.

EDIT: 1/24

I uploaded the video I snapped to YouTube…here is a hard-link, and I’ll toss the vid in a post shortly. I think I need to enable video embedding, but if you really have a hankering to watch the thing, knock yourself out.

New Toy in the Mail

I stumbled across this product, that I honestly had no idea existed.


from sparkfun

It is pretty much an AC switch, that can be ‘switched’ via a 5V signal.

Let me see…what do I have that can push 5V? ARDUINO, Y’ALL. My project scope is about to get greatly wider. Stay tuned.