Archive for October, 2009

Simple Analog Signal Meter

Posted by admin on October 25, 2009
Arduino, Projects, examples / Comments Off

I bought a couple of these signal meters from Maplin a few months ago and today I found some time to try them on an an arduino.

Maplin sell these for £4 each, which is probably quite expensive for what they really are, given the cheap plastic material and the overall quality: just to give you an idea: the transparent front cover is attached to the rest of the unit with a piece of tape…

Still, if you want to add a simple meter on your arduino, without messing around with lcds and their libraries, this is by far the easiest way.

In my test, I simply used a potentiometer and I attached the meter like this:

Simple Analog Signal Meter

Simple Analog Signal Meter

(btw, the battery underneath the meter has just a “supporting” role)

Here is a simplified version of Tom Igoe’s “AnalogueWriteMega.pde” example, that comes with Arduino 0017:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
const int thisPin = 5;
 
void setup() {
  pinMode(thisPin, OUTPUT); 
}
 
void loop() {
  for (int x = 0; x < 255; x++) {
    analogWrite(thisPin, x);
    delay(50);
  } 
 
  for (int x = 255; x >= 0; x--) {
    analogWrite(thisPin, x);
    delay(50);
  } 
 
  delay(100);
}

… and here is a video of how it works (apologies for the poor quality):

Simple Signal Meter from Arkadian.Eu on Vimeo.

Tags: ,

Arduino-based keyboard for Windows

Posted by admin on October 03, 2009
Arduino, Projects, examples / 3 Comments

Today, on the arduino.cc forums, a user had the following problem: he wanted to start video in quicktime by pressing a custom button on an arduino. Basically, the arduino board should act as a simple keyboard for the computer.

I found this problem interesting and I ended up solving it. Here is the link to the forum.

Basically this problem has three parts.
1. An arduino sketch which, when the button is pressed, sends a character on the serial.
2. A serial-to-keystrokes program, which takes the character from the serial connection and converts it to a real keystroke
3. A program on the windows machine that translates the keystroke to whatever we want to do.

Sounds tricky? It’s actually easier than it sounds.

1. The Arduino Sketch
This is quite straight forward. The simple arduino keyboard circuit looks like this:

arduino-keyboard

Here is a modified version of the Button.pde example that comes with the latest Arduino release. I have only added the lines required for the serial connection and a very long (2 sec) delay after the key is pressed; I used this 2 sec delay to keep things simple, but you may want to adapt the longer and more appropriate “Debounce.pde” sketch (also available as an example in the latest Arduino release) which takes care of the debouncing more efficiently.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const int buttonPin = 2;     
const int ledPin =  13;      
int buttonState = 0;         
 
void setup() {
  Serial.begin(9600); 
  pinMode(ledPin, OUTPUT);      
  pinMode(buttonPin, INPUT);     
}
 
void loop(){
  buttonState = digitalRead(buttonPin);
  if (buttonState == HIGH) {     
    digitalWrite(ledPin, HIGH);  
    Serial.print("a");
    delay(2000);
  }  
  else {
    digitalWrite(ledPin, LOW); 
  }
}

2. From Serial to Keystrokes
I found a very nice program, AAC Keys, which converts any characters the arduino sends to the serial port to actual keystrokes. This is available for both windows and Mac and it’s free to download; the download is a single executable file, which, when activated, stays in your system tray and monitors the serial port. The only thing you need to configure here is the port and the Baud rate:
aac_keys

Note that if AAC Keys is activated and configured, the arduino environment won’t be able to communicate with the arduino board, as the port cannot be shared.

At this stage, with the AAC Keys activated and configured, pressing the button on the arduino will create the character “a” on the computer.

3. Windows Shortcuts
What we need to do now is to somehow start playing a video with Quicktime. To play a video with QuickTime, all we need to do is to run the following command in a DOS window:

"C:\Program Files\QuickTime\QuickTimePlayer.exe" "C:\your video path\Video_A.avi"

If the video doesn’t start directly, then go to QuickTime >> Preferences >> Player Preferences… and select “automatically play movies when opened”.

My favourite windows program for these tasks is AutoHotKey. When AutoHotKey is installed, textfiles with the .AHK extension are executed by AutoHotKey.

The following AHK script, when executed, will stay in the system tray waiting for the “a” key (either from the keyboard or from the arduino board) to be pressed.

1
2
3
a:: 
Run "C:\Program Files\QuickTime\QuickTimePlayer.exe" "C:\your video path\Video_A.avi"
return

…and that’s it! A simple (1-key) Arduino keyboard, which, when pressed, launches the video we want in quicktime.

There are many ways to extend this idea. More keys can be added (many can be added on a single analog port with resistors), and, with a bluetooth adaptor on the arduino board and the computer, we could even design a bluetooth keyboard for the computer! :)

Tags: , , , ,

Arduino/Ikea Lamp – 4,000 views…

Posted by admin on October 02, 2009
Arduino, article / Comments Off

40 days ago, I added here a post about a “hacked” IKEA lamp; a simple lamp, fitted with 20 RGB leds, an arduino board and a push-to-make switch which I built as a gift to the 2 year old daughter of a good friend of mine.
combination

Now, the lamp has appeared on the front page of the blog of the :MAKE magazine, the video had over 4,000 views recorded on Vimeo and I’m still getting many hits every day.

The most important thing: my friend’s daughter loves this lamp! :)

Tags: , , , ,

3 hours in seconds…

Posted by admin on October 01, 2009
Projects, Videos / Comments Off

Here is a video I made using my home-made arduino intervalometer and my Fuji S9600 camera.

3 Hours in seconds… from Arkadian.Eu on Vimeo.

This video was created by taking 918 photos of a clock; the photos got converted to a video using MonkeyJam, a fantastic piece of software for stop-motion animation.

More exciting projects will be posted soon. A friend suggest a video with the title “Watching the paint dry…”.

Tags: , ,