One more time…

Another demonstration of the Arduino based Camera Trigger – Time Lapse function…  Shot taken every 10 seconds for about 2.5 hours.

Advertisements
Posted in Arduino Camera Trigger v2, Projects, Unfinished | Leave a comment

Arduino Camera Trigger v2 – First demonstration

So, after some significant coding help from a friend, the time-lapse portion of my Arduino based Camera Trigger project is fully operational!   I threw my camera on a tripod and aimed it out my back window to watch the sun set.  It’s a photo every 5 seconds for about 2.5hours.   Images compiled using VirtualDub

Turn down the resolution of the video if it’s too choppy for your machine!

Another demonstration is here.

Posted in Arduino Camera Trigger v2, Projects, Unfinished | Leave a comment

Arduino Based Camera Trigger – Components

I thought I’d make a list of components included so far in the Camera Trigger project.  Keep in mind that things might change at any time and so this list could be updated…  If you have any questions about why I chose something, or what something is, don’t hesitate to leave a question in the comments…

And without further ado, the components list:

  • Atmel ATmega328 for brains
  • HD44780-compatible LCD – Yellow text on blue background – backlit.
  • Quadrature Encoder with switch from Seeedstudio.com
  • PS2501 4-channel Opto-isolator (I think from Sparkfun)
  • 24LC256 – 256 kbit I2C EEPROM
  • 16Mhz Crystal and two 22pF Ceramic Capacitors for a clock input.
  • Push button for microcontroller resets
  • 0.1μF Ceramic Capacitor for the microcontroller reset pin
  • 10K Potentiometer – control LCD contrast
  • IR and Yellow LEDs – for infrared transmission and monitoring
  • NPN Transistor for LED switching
  • Serial Port for connecting to camera cable – Cable is sourced from DealExtreme.
  • 2 3.5mm Audio Jacks – for connecting to external flashes
  • On/Off switch
  • Resistors of various values for LEDs, LCD backlight, the optoisolator inputs, and two 10K for the pull-ups for the reset switch and rotary encoder button.
  • LM7805 5v Voltage Regulator
  • Electrolytic decoupling capacitors 100uF/25V, and 10uF/25V
  • 1N4001 1A/50v rectifier diode
  • PTC resettable fuse because I sometimes accidentally try to blow things up
  • FTDI 5v Breakout board from Sparkfun (only used for programming the microcontroller – will not be included in final board)
  • Lots of wire to be replaced by traces on a PCB when designed and etched…

Once I have the software where I want it, and have worked out any bugs in the hardware I’ll put a schematic up.  The board design will go up as well when it’s completed…

If you’re new to powering electronics, it may be worthwhile to check out Sparkfun’s Power Supply Tutorial.  That’s all for now!

More to come…

Posted in Arduino Camera Trigger v2, Projects, Unfinished | Leave a comment

Touch-Sensing Dual Bed-Side Light Switch

I was out shopping for a bedroom set with my partner a little while ago and one of the sets that was shown to us by an anxious sales-person had a bed frame with an interesting feature.  It had a thin metal bar running along the back of the headboard that acted as a touch-sensor and would switch on and off a bedside light plugged into an outlet attached to the side of the bed.  I didn’t have a lot of time to check it out, but it made me wonder, maybe I could put something together like that for our new bed.

My plan was to expand on the bedroom set’s functionality however.  I’m not the only one that sleeps in the bed and there is a light on either side.  Wouldn’t it be nice if there were two sensor bars, only above each of our sides of the bed that controlled our individual light?  Better yet, how about having the sensor differentiate between a tap and a hold to control the opposite light as well.  So, a light and a sensor bar on each side of the bed.  A tap to a sensor bar would toggle on/off its respective light, while a hold would toggle the other side’s light.  The other side’s bar would do the same, but a tap would toggle its own light and a hold the opposite.  Get that?

I’ve had some long past experience switching line level power sources for use in lighting for stage and club settings so I had something of an idea on how to I would proceed (I would need to buy some triacs in the near future), but I had absolutely no idea how touch-sensors worked.  A little research revealed that a lot of the switches use capacitance to sense touch.  I spent probably hours looking into how I might rig something up to an arduino, and even purchased a relatively expensive capacitance sensor.  I never could get anything working though…

Then one evening I was visiting the Sparkfun’s IRC channel #sparkfun on irc.freenode.net and pitched the idea about making an arduino into a touch sensor.  Adam Greig there offered some excellent advice and provided some example code he had done in the past to control his computer’s media player and it really set me off in the right direction!  His ideas worked fantastically, with no extra hardware needed!

Code for the project can be found here:

//Dual Lamp Control By Capacitence Sensors
// Thanks to Adam Greig for the basic infos
// CC BY-SA-NC 3.0

int i;  //    for loop counter - also used to time the disipation of the charge on the sensor pin (if it's short, then the bar is being touched)
int leftState;  / status of the left outlet (either on or off)
int rightState; // status of the right outlet
int leftcount;  // counts the time the left touch bar was touched
int rightcount; // time the right touch bar was touched

void setup() {
 Serial.begin( 9600 );
 pinMode(11, OUTPUT);      // sets the digital pin as output
 pinMode(12, OUTPUT);
 leftcount = 0;
 rightcount = 0;
}

void loop() {

 //Pin5
 DDRD    = B11111110;
 PORTD    = B00000000;
 DDRD    = B00000010;
 PORTD    = B11111100;
 for( i = 0; i < 10; i++ ) {
   if( PIND & B100000 ) break;
 }
 if( i > 0 ) {
   Serial.println( "Left Sensor Touched" );
   leftcount++;
   delay( 50 );
 }
 else {
   if( leftcount > 3){
     Serial.println( "Left Sensor HOLD Detected" );
     rightToggle();
   }
   else if( leftcount == 1 or leftcount == 2 or leftcount == 3){
     Serial.println( "Left Sensor TAP Detected");
     leftToggle();
   }
 }

 //Pin7
 DDRD    = B11111110;
 PORTD    = B00000000;
 DDRD    = B00000010;
 PORTD    = B11111100;
 for( i = 0; i < 10; i++ ) {
   if( PIND & B10000000 ) break;
 }
 if( i > 0 ) {
   Serial.println( "Right Sensor Touched" );
   rightcount++;
   delay( 50 );
 }
 else {
   if( rightcount > 3){
     Serial.println( "Right Sensor HOLD Detected");
     leftToggle();
   }
   else if( rightcount == 1 or rightcount == 2 or rightcount == 3){
     Serial.println( "Right Sensor TAP Detected");
     rightToggle();
   }
 }

 delay( 100 );
}

void leftToggle()  // if left is on, turn it off, and vice-versa
{
  Serial.println("Toggle Left Light");
  if (leftState == LOW){
    leftState = HIGH;
    Serial.println("Left Light Is Off, Turn On");
  }
  else {
    leftState = LOW;
    Serial.println("Left Light Is not Off, Turn Off");
  }
  digitalWrite(11, leftState);  //update the output pin
  rightcount = 0;
  leftcount = 0;
}

void rightToggle() // if left is on, turn it off, and vice-versa
{
 Serial.println("Toggle Right Light");
 if (rightState == LOW){
   rightState = HIGH;
   Serial.println("Right Light Is Off, Turn On");
 }
 else{
   rightState = LOW;
   Serial.println("Right Light Is not Off, Turn Off");
 }
 digitalWrite(12, rightState);
 leftcount = 0;
 rightcount = 0;
}

Now the WAF on this project needed to be high as this was going to be attached to our lovely new bed that we had spent a fortune on.  So, I wasn’t going to be able to just breadboard something up and duct tape it on like I might have done in University.  No, I was going to have to make an actual printed circuit board.  Unfortunately, I’ve never done one before, but fortunately, I’ve been really interested in trying it out.

I visited a local electronics store, bought some copper-clad board, and some etchant, and then put it aside for a couple months.  Yup, I was too scared to use it.   I’ve never used pcb design software let alone ever etched anything.  I was overwhelmed.

Part two will be up shortly, in which I get over my fear by committing to going through with it all, even if I screw it up!

Posted in Projects, Touch-Sensing Dual Light Switch, Unfinished | Leave a comment

Arduino based Camera Trigger

A couple of years ago I built an Arduino based intervalometer for my DSLR.  It triggered the Canon EOS350’s focus and shutter at pre-programmed intervals.  I built it because I had seen some nice time-lapse photography and wanted to try some of my own.  I took apart a cheap, knock off, Canon trigger, which I probably sourced from DealExtreme.com, where I get most of my cheap, knock off stuff.  The innards of the switch revealed that it simply shorted one then the other contacts on the plug to the sleeve to first focus then trigger the shutter.  Info on how that plug works can be found here.

I used an Arduino (way overkill) hooked up to two optoisolators in something like this fashion to short the contacts and found it worked perfectly.  A simple script to trigger the focus and shutter did what I wanted it to do.

Examples of the test runs of that project are on YouTube here, here, and here.  Not very exciting, but a triumph in actually building something useful!

Unfortunately, this unit had no input or display system and timing had to be programmed in from the source code.  It worked extremely well at home, close to a computer, but was almost completely useless in the field.

With other projects on the go but going nowhere quickly, and ideas and dreams about this flying around, I thought there might be an off chance I could actually put together something functional.  My ideas included the following:

  • An 2×16 character LCD to display a menu and selection system to change parameters
  • Rotary Encoder w/ push button for Input
  • Optically isolated outputs for the Camera (Focus and Shutter) and two external flash triggers.

After a short time planning, the feature list grew considerably to include a more in-depth menu system to accommodate more crazy ideas:

  • Infrared LED array (3 or 4 LEDs) to output Canon (maybe other brands as well) remote trigger codes.
  • Sensor inputs to trigger the camera based on environmental events such as sound and light changes
  • an EEPROM to store settings over reboots (and just to learn how to interface with an EEPROM – I2C perhaps?)
  • Anything else I have room for (temperature module, light sensor?)

The plan was, and continues to be to create a highly flexible system to trigger, not only for my camera, but external flashes as well, based on multiple variables and inputs, including time for time-lapse, but also sensors such as sound, light, laser path breaks, etc.

As this project has grown and developed, I’ve learned of other similar projects.  The Camera Axe caught my eye as an open-source camera trigger.  It’s extremely well developed, but I’m no expert coder, and I have to admit, I have a lot to learn before I could understand what was going on there.  Since most of my projects are about learning, (and it feels cheaper to buy components as I add them one by one, instead of all in one package), I decided to forge on with my design.

The hardware design was fairly straightforward, and I got something breadboarded pretty quickly. One by one the LCD and quadrature encoder code was written, the optoisolators triggered the camera and flashes properly, and the EEPROM was hooked up and tested.   Like I said, I’m no expert coder, but with the help of some existing Arduino libraries and pouring through probably dozens of other people’s code for ideas, I cobbled together a fairly functional system. Unfortunately, as it grew, my poor coding was catching up to me.  I was having random crashes that I’m certain were a result of ram limitations.

I’ve recently shown my results to a friend, who works programming embedded graphic processing systems, and boy did she have a lot to offer.  Besides being good at everything, she is also incredibly helpful and enjoys working on this stuff.  She re-wrote a good deal of my work, reorganizing the system into a “state-machine“, then taught me just what that was.  Our work together is ongoing, but I should have some layout designs and code up shortly.

More to come…

Posted in Arduino Camera Trigger v2, Projects, Unfinished | Leave a comment

LED License Plate Frame – Remote Control Analysis

So, I’ve been trying to work out a way to quickly and easily reprogram those LED license plate frames you see on the backs of people’s cars.  Progress has gone well so far, and you can read about the plan and the process in previous entries… Part 1, and Part 2

Using the Infrared Toy, I was able to sample some of the raw signals from the LED license plate frame’s remote.   The following output is from an “Enter” key tapped once:The protocol is instantly recognizable as NEC because of the leading 9ms HIGH followed by a 4.5ms LOW.  NEC has a 38khz carrier frequency, and bits are encoded by the time between the leading edges of the pulses as opposed to duration of a pulse.  Logical 0 is 1.125ms long from leading edge of one bit to the leading edge of the next and Logical 1 is 2.25ms.  Check out this excellent page about the NEC Protocol.  Ken Sherriff has posted on his blog an incredibly useful description for understanding Sony’s IR protocol, but most of his info applies to other protocols as well.  He has also developed an IR Arduino library which I may need to take a closer look at for this project!

With NEC, after the header, the bits are transmitted LSB (lowest significant bit) first.  The unit address is 8 bits long and then its inverse is transmitted as a form of error checking… The command address then follows, is also 8 bits, and is similarly repeated inverted.

The following is the “decoded” signal in binary:
| 0 0 0 0 0 0 0 0 | 1 1 1 1 1 1 1 1 | 1 0 0 1 0 0 1 0 | 0 1 1 0 1 1 0 1 |
|_ _Address __|  _!Address__|_ Command_|    !Command _|

Read backwards (LSB) and converted to hexadecimal we get:
Address – 0x00,  Command – 0x49

This doesn’t seem like it should be too hard to mimic with an Arduino based system.

Part 4 is up in which I rig up an Arduino with an IR sensor and an LED to test the recording and playback of the remote control IR codes…  It didn’t exactly go according to plan.

Posted in LED License Plate Frame, Projects, Unfinished | Leave a comment

Proof-of-Concept – LED License Plate Frame Rapid Automated Reprogramming

As I mentioned previously, I was being bitten by the bug of figuring stuff out, so I couldn’t resist going out to purchase one of those LED scrolling license plate frames.  I quickly got it hooked up to a 12V source and determined that indeed, there is absolutely no form of authentication required to change the messages on the display.  You simply push Edit on the remote, then Enter, then type in your message letter by letter, followed by another Enter.  I got out my IrTrans and started sampling the remote’s signals.

It took me only about 10 minutes to sample all the codes from the remote and write a quick bash script to throw them out again.  The following is a proof-of-concept demonstration of how quickly I can reliably re-program a message.  Warning: poor video and audio quality.  Poor camera, poor lighting, room full of noise…  Bad combo.  I’ll get a better one up when i get a better camera.

Through some quick testing, I learned that I can be standing over 20 feet away (in a relatively low light environment) and still get reliable communication from the IrTrans to the frame.  I’m not sure how negatively daylight or a windshield would affect transmission quality.  I’ll have to test outdoors soon.

The following are the IrTrans Remote Control Codes and the Bash script used to run the irclient program to send out the desired codes.  I will try to get some raw code data up soon.

IrTrans Remote Control Codes: LEDlicense.rem

<pre>[REMOTE]
 [NAME]LEDlicense

[TIMING]
 [0][N]5[1]8976 4520[2]536 592[3]608 1656[4]8976 2280[5]536 39936[RC]1[RP]0[FREQ]39[SB]

[COMMANDS]
 [OnOff][T]0[D]S00000000111111110011100011000111320
 [Enter][T]0[D]S00000000111111110001001011101101320
 [Edit][T]0[D]S00000000111111111001001001101101320
 [Delete][T]0[D]S00000000111111110101001010101101320
 [Clear][T]0[D]S00000000111111111011000001001111320
 [>][T]0[D]S00000000111111110001000011101111320
 [<][T]0[D]S00000000111111111101000000101111320
 [Shift][T]0[D]S00000000111111110101000010101111320
 [Caps][T]0[D]S00000000111111111001000001101111320
 [Run][T]0[D]S00000000111111111111100000000111320
 [Speed][T]0[D]S00000000111111111110100000010111320
 [Invert][T]0[D]S00000000111111110010100011010111320
 [Insert][T]0[D]S00000000111111111101001000101101320
 [1][T]0[D]S00000000111111110000101011110101320
 [2][T]0[D]S00000000111111111000101001110101320
 [3][T]0[D]S00000000111111111100101000110101320
 [4][T]0[D]S00000000111111111000100001110111320
 [5][T]0[D]S00000000111111111100100000110111320
 [6][T]0[D]S00000000111111110100100010110111320
 [7][T]0[D]S00000000111111110100101010110101320
 [8][T]0[D]S00000000111111110000100011110111320
 [9][T]0[D]S00000000111111111010101001010101320
 [0][T]0[D]S00000000111111111110101000010101320
 [A][T]0[D]S00000000111111111011101001000101320
 [B][T]0[D]S00000000111111111111101000000101320
 [C][T]0[D]S00000000111111110011101011000101320
 [D][T]0[D]S00000000111111110111100010000111320
 [E][T]0[D]S00000000111111110111101010000101320
 [F][T]0[D]S00000000111111111011100001000111320
 [G][T]0[D]S00000000111111110001101011100101320
 [H][T]0[D]S00000000111111110101100010100111320
 [I][T]0[D]S00000000111111111101101000100101320
 [J][T]0[D]S00000000111111111001100001100111320
 [K][T]0[D]S00000000111111111101100000100111320
 [L][T]0[D]S00000000111111111001101001100101320
 [M][T]0[D]S00000000111111110101101010100101320
 [N][T]0[D]S00000000111111110001100011100111320
 [O][T]0[D]S00000000111111111100000000111111320
 [P][T]0[D]S00000000111111110100000010111111320
 [Q][T]0[D]S00000000111111111100001000111101320
 [R][T]0[D]S00000000111111111000000001111111320
 [S][T]0[D]S00000000111111110000001011111101320
 [T][T]0[D]S00000000111111111000001001111101320
 [U][T]0[D]S00000000111111110100001010111101320
 [V][T]0[D]S00000000111111110000000011111111320
 [W][T]0[D]S00000000111111110010001011011101320
 [X][T]0[D]S00000000111111110110000010011111320
 [Y][T]0[D]S00000000111111110110001010011101320
 [Z][T]0[D]S00000000111111110010000011011111320
 [!][T]0[D]S00000000111111111110000000011111320
 [?][T]0[D]S00000000111111111010001001011101320
 [#][T]0[D]S00000000111111111110001000011101320
 [$][T]0[D]S00000000111111111010000001011111320

Bash script to run irclient commands: testscript.sh
irclient usage: irclient [server] [remote] [button]

#!/bin/bash
# Script to Reprogram an LCD License Plate Frame

# Sends commands to edit currently scrolling message, then clears the previous message, confirming with a Y
./irclient localhost LEDlicense Edit
./irclient localhost LEDlicense Enter
./irclient localhost LEDlicense Clear
./irclient localhost LEDlicense Y

#Sends commmands to type new message
./irclient localhost LEDlicense T
./irclient localhost LEDlicense H
./irclient localhost LEDlicense I
./irclient localhost LEDlicense S
./irclient localhost LEDlicense \>
./irclient localhost LEDlicense I
./irclient localhost LEDlicense S
./irclient localhost LEDlicense \>
./irclient localhost LEDlicense A
./irclient localhost LEDlicense \>
./irclient localhost LEDlicense T
./irclient localhost LEDlicense E
./irclient localhost LEDlicense S
./irclient localhost LEDlicense T
./irclient localhost LEDlicense !

#Final Enter to Confirm and Run Message
./irclient localhost LEDlicense Enter

Next step is to build a self-contained, battery operated unit to broadcast pre-programmed messages.  I will probably build upon the work of Dangerous Prototype‘s Infrared Toy.

Check out Part 3, where I analyze some raw remote signals.

Posted in LED License Plate Frame, Projects, Unfinished | Leave a comment