Showing posts with label tutorials. Show all posts
Showing posts with label tutorials. Show all posts

Saturday, 23 November 2013

Arduino - Talking plant, with Twitter (how to tweet data with Arduino)

After I finished the first test with the Ethernet shield and serving your own page from Arduino (see post here) I said, ok, but if I don't have my own static IP address!?!? Most of us don't have a static IP address at home. Yeah it was fun with the other one to play in a LAN or use the university network to get an own IP, but at home this device renders useless. I tried with other social networks or email providers but it looks like Facebook, Yahoo mail and Gmail have quite some problems talking with Arduino and Arduino has some problems talking with them, the only one available remained Twitter.
Having as starting point http://arduino-tweet.appspot.com/ I modified my previous code to this one:


#include <SPI.h> // needed in Arduino 0019 or later
#include <Ethernet.h>
#include <Twitter.h>

// The includion of EthernetDNS is not needed in Arduino IDE 1.0 or later.
// Please uncomment below in Arduino IDE 0022 or earlier.
//#include <EthernetDNS.h>

// Ethernet Shield Settings
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

// If you don't specify the IP address, DHCP is used(only in Arduino 1.0 or later).
//byte ip[] = { 192, 168, 9, 122 }; // 192.168.9.122

// Your Token to Tweet (get it from http://arduino-tweet.appspot.com/)
Twitter twitter("please put here your token");

// Message to post - just to initialize the variable
char msg[] = "Hello, World! I'm Arduino!";

void setup()
{
  delay(10000);
  Serial.begin(9600);
    // start the Ethernet connection:
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
    for(;;)
      ;
  }
  Serial.println("connecting ...");
  if (twitter.post(msg)) {
    // Specify &Serial to output received response to Serial.
    // If no output is required, you can just omit the argument, e.g.
    // int status = twitter.wait();
    int status = twitter.wait(&Serial);
    if (status == 200) {
   
      Serial.println("OK.");
   
    } else {
      Serial.print("failed : code ");
      Serial.println(status);
    }
 
  } else {
    Serial.println("connection failed.");
  }
}

//Temperaturmessung
//*
int temp = 1;
int oldtemp = 1;
int val;

void loop()
{
  delay(30000);
  val = analogRead(0);

  if (val > 40) { temp = 1; }

  if (val <20 ) { temp = 0; }

  if (oldtemp != temp) {
    oldtemp = temp;
    if (temp == 1) {
      //Serial.println("FEUER!");
      sendTwitterUpdate("Im Gewächshaus brennt es!");
    }
    else {
      //Serial.println("Kalt!");
      sendTwitterUpdate("Es ist zu kalt für die Pflanzen!");
    }
  }

  fetchTwitterUpdate();
}


Now you can get more creative and do more out of it.

Arduino - Talking plant, with HTTP server (or how to see sensor data via internet)


One of the small assignments used for learning Arduino was the classical "talking plant". Actually was more of a build own humidity sensor, sensor reading and sending the data to the Ethernet shield and also use LED lights to display the status of the soil moisture. 

What?
First step is to build a sensor, very simple! Of course you can buy a humidity sensor, no one says not to do so, but makes more fun to built your own, cheaper and simpler.
After the sensor is build all you have to do is just to read the values and then use 3 LED (red, yellow, green) to visually display the soil moisture and at the same time send the values to the Ethernet shield so you can check the humidity of your precious plant over the internet.
Of course you can get more creative than this once you have the data, but I wasn't in the mood to invest money in more cooler ideas. I kept them for my mood lights.

How to build the soil moisture sensor
Actually this is the simplest part. You can use two nails, two thick wires or basically anything that is allowing electricity to pass. The trick is to pick a material that does not get rusty or oxides to quick, also must have a small electric resistance because we are talking here about very small values ... 5V and less than 1A. 
I used two fine steel nails about 5cm long with a 3mm distance between. The nails were fixed on a plastic base 5mm high (to keep the distance between the nails), you can use any material that is resistant to electricity (does not allow electricity to pass). Having a 5cm nail minus 5mm plastic base I remained with a 4.5cm for each nail as the sensing surface.
Note: the nails must be parallel with each other. 
Soldering a wire on each nail head is the only "hard part" of this sensor.

How it works
You need just to "stick" the sensor in the flower pot (you don't want to damage the roots of your precious plant so be careful where you stick it) connect it to the Arduino board like you will do with any other simple sensor (e.g. photoresistor see how to connect a photoresistor)
Unfortunately I have no drawing for this project but the wiring is not so hard. Actually you can get it only by reading the code.
Next step is to connect the 3 LED lights and then calibrate your sensor (see code). The values will differ from one soil type to the other ( depending on the pH value).
Plug your Ethernet shield, use your network values and have fun! (see in the code where)

The code
The code is well commented but if you have questions just ask :)

//#include <Wire.h>
#include <SPI.h>
#include <Ethernet.h>

// Ethernet shield attached to pins 10, 11, 12, 13
//analog sensor
int sensorPin = 0;     // 1st sensor is connected to a0
int sensorReading;     // the analog reading from the analog port

//status LEDs
int LEDred =7;              
int LEDyellow =8;  
int LEDgreen =9;

//threshold values - calibrate sensor
int RED = 200;
int GREEN = 500;

//string that holds the status
String Status ="";

//Server part

//define mac address for ethernet shield
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address
//define ip for ethernet shield
byte ip[] = { 192, 168, 1, 2 };           // ip in lan
//gateway - router ip address and mask
byte gateway[] = { 192, 168, 1, 20 };            // internet access via router
byte subnet[] = { 255, 255, 255, 0 };                   //subnet mask


// Initialize the server library and port (port 80 is default for HTTP)
Server server(80);                                      //server port


//byte sampledata=50;

void setup(void) {
  pinMode(LEDred, OUTPUT);  //set LED1 pin to output mode
  pinMode(LEDyellow, OUTPUT);  //set LED2 pin to output mode
  pinMode(LEDgreen, OUTPUT);  //set LED3 pin to output mode

  //start Ethernet
  Ethernet.begin(mac, ip, gateway, subnet);
  server.begin();

  //send debugging information via the Serial monitor
  Serial.begin(9600);
}

void HTTPserv () {
// listen for incoming clients
  Client client = server.available();
  if (client) {
    // an http request ends with a blank line
    boolean currentLineIsBlank = true;
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        // if you've gotten to the end of the line (received a newline
        // character) and the line is blank, the http request has ended,
        // so you can send a reply
        if (c == '\n' && currentLineIsBlank) {
          // send a standard http response header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println();
 
    //---------------HTML----------------------------
 //set background color
          client.print("<body style=background-color:yellow>");
          //send first heading
          client.println("<font color='red'><h1>Soil humidity</font></h1>");
          client.println("<hr />");
          client.println("<hr />");
          client.println("<br />");
          client.println("<br />");
 //drawing simple table
          client.println("<font color='black'>Simple table: </font>");
          client.println("<br />");
          client.print("<table border=1><tr><td>Humidity</td>");
 client.print("<td>");
 client.print(sensorReading);
 client.print("</td></tr>");
          client.println("<tr>");
 client.print("<td>Status</td><td>");
 client.print(Status);
 client.print("</td></tr></table>");
          client.println("<br />");
          client.println("<hr />");
 //text variant
          client.println("<hr>");
          client.print("Humidity ");
          client.print(" = ");
          client.print(sensorReading);
          client.println("<br />");
          client.print("Status ");
          client.print(" = ");
          client.print(Status);
          client.println("<br />");
          client.println("<hr>");
          break;
        }
        if (c == '\n') {
          // you're starting a new line
          currentLineIsBlank = true;
        }
        else if (c != '\r') {
          // you've gotten a character on the current line
          currentLineIsBlank = false;
        }
      }
    }
    // give the web browser time to receive the data
    delay(1);
    // close the connection:
    client.stop();
  }
}

void loop(void) {

  digitalWrite(LEDred,LOW); //initial state
  digitalWrite(LEDyellow,LOW); //initial state
  digitalWrite(LEDgreen,LOW); //initial state

  sensorReading = analogRead(sensorPin);

  Serial.println(sensorReading);

  if (sensorReading <= RED) {
   digitalWrite(LEDred,HIGH);
   digitalWrite(LEDyellow,LOW);
   digitalWrite(LEDgreen,LOW);
   Status = "needs urgent attention";
   HTTPserv () ;
 }
 else if (sensorReading > RED && sensorReading < GREEN ) {
   digitalWrite(LEDred,LOW);
   digitalWrite(LEDyellow,HIGH);
   digitalWrite(LEDgreen,LOW);
   Status = "needs attention";
   HTTPserv () ;
 }
 else if (sensorReading >= GREEN ) {
   digitalWrite(LEDred,LOW);
   digitalWrite(LEDyellow,LOW);
   digitalWrite(LEDgreen,HIGH);
   Status = "needs no attention";
 }
 else {
   digitalWrite(LEDred,LOW);
  digitalWrite(LEDyellow,LOW);
  digitalWrite(LEDgreen,LOW);
  Status = "";
  HTTPserv () ;
 }
 delay(1000);
}


Tuesday, 22 January 2013

Speed measurement with Arduino (2)


To continue my first post on speed measurement I will show how I made the arduino part more "interesting" and connected it to flash and as3.

At the end of the post I will attach the files for download.

For connecting arduino with flash I used TinkerProxy, has instructions on how to use it so I will not get into details. 
The flash file will receive the speed value and will capture a picture from the webcam. (Note, for my project I used a webcam to take pictures of the objects that passing). Also it adds to the picture the time stamp and the speed. (processing the image at the runtime). The picture is then saved to the server with a php script.

You can get creative and set a certain threshold :)

AS3 script:

//File downloaded from www.riacodes.com
// Modified by Claudiu Cristian on 28.11.2011
import flash.display.Bitmap;
import flash.display.BitmapData;
import com.adobe.images.JPGEncoder;
import flash.net.FileReference;
import com.SerialPort;
var finalSpeed:Number = 0;
var cam:Camera = Camera.getCamera();
var video:Video = new Video(320,240);
var phpPath:String;
var sendReq:URLRequest;
/*
Connecting with arduino
*/
//Character that delineates the end of a message received from the Arduino
const EOL_DELIMITER:String = "\n";
// accumulates data coming from arduino
var sensorData:String = "";
var speed:Number=0;
// connects to arduino board
var arduino:SerialPort = new SerialPort();
arduino.addEventListener(DataEvent.DATA, onArduinoData );
arduino.connect( "127.0.0.1", 5331 );
function onArduinoData( event:DataEvent ):void {
//trace( "onArduinoData", event.data );
// add to sensor data
sensorData +=  event.data;
// if it finds newline the packet of sensor data is done
if (sensorData.indexOf(EOL_DELIMITER) > 0 ) {
// process sensor data
//trace(parseFloat(event.data));
speed = parseFloat(event.data);
computeSpeed();
}
}
function computeSpeed() {
if (isNaN(speed) == false &&  speed % 1 != 0 ) {
finalSpeed = speed * 3.6;
captureImage();
saveImage();
}
else {
finalSpeed=0;
}
trace(roundDecimals(finalSpeed, 2));
sensorData="";
}
function roundDecimals(num:Number, numDecimalPlaces:int):Number {
return Math.round(num * Math.pow(10, numDecimalPlaces) ) / Math.pow(10, numDecimalPlaces);
}
video.attachCamera(cam);
video.x = 20;
video.y = 20;
addChild(video);
var bitmapData:BitmapData = new BitmapData(video.width,video.height);
var bitmap:Bitmap = new Bitmap(bitmapData);
bitmap.x = 360;
bitmap.y = 20;
addChild(bitmap);
function captureImage():void
{
bitmapData.draw(video);
//render the text
drawString(bitmapData,fileName1 + roundDecimals(finalSpeed, 2),10,200);
// display the result...
//addChild(Bitmap (bitmapData));
}
var i:Number = 1;
var fileRef:FileReference = new FileReference();

// script taken from http://www.beautifycode.com/webcam-flash-php-upload-to-server
//and modiffied
function saveImage():void
{
var encoder:JPGEncoder = new JPGEncoder(90);
var ba:ByteArray = encoder.encode(bitmapData);
    var sendHeader:URLRequestHeader = new URLRequestHeader("Content-type","application/octet-stream");
phpPath = "http://localhost/saveimg.php"

    sendReq = new URLRequest(phpPath);
    sendReq.requestHeaders.push(sendHeader);
    sendReq.method = URLRequestMethod.POST;
    sendReq.data = ba;

    var sendLoader:URLLoader;
    sendLoader = new URLLoader();
    sendLoader.load(sendReq);
}
function drawString(target:BitmapData,text:String,x:Number,y:Number):void
{
var tf:TextField = new TextField();
tf.width = 300;
tf.text = text;
var myFormat:TextFormat = new TextFormat();
//Giving the format a hex decimal color code
myFormat.color = 0xFF0000;
//Adding some bigger text size
myFormat.size = 12;
//Last text style is to make it bold.
myFormat.bold = true;
//Now the most important thing for the textformat, we need to add it to the myTextField with setTextFormat.
tf.setTextFormat(myFormat);
var bmd:BitmapData = new BitmapData(tf.width,tf.height,true,0x00000000);
bmd.draw(tf);
var mat:Matrix = new Matrix();
mat.translate(x,y);
target.draw(bmd,mat);
bmd.dispose();
}
var my_timer:Timer=new Timer(1000);
my_timer.addEventListener(TimerEvent.TIMER, onTimer);
my_timer.start();
var fileName:String;
var fileName1:String;
var txtDisplay:TextField = new TextField();

//Here we add the new textfield instance to the stage with addchild()
addChild(txtDisplay);

//Here we define some properties for our text field, starting with giving it some text to contain.
//A width, x and y coordinates.
txtDisplay.x = 20;
txtDisplay.y = 360;

//Here are some great properties to define, first one is to make sure the text is not selectable, then adding a border.
txtDisplay.selectable = false;
txtDisplay.border = true;

//This last property for our textfield is to make it autosize with the text, aligning to the left.
txtDisplay.autoSize = TextFieldAutoSize.LEFT;

function onTimer(e:TimerEvent):void {
var today_date:Date = new Date();
var thismonth:uint = today_date.getMonth();
var today_time;
var currentTime:Date = new Date();
var minutes = currentTime.getMinutes();
var seconds = currentTime.getSeconds();
var hours = currentTime.getHours() * 30 + currentTime.getMinutes() / 2;
var monthArr:Array = new Array('Jan','Feb','March','April','May','June','July','August','September','October','November','December');
fileName = (today_date.getDate()+ " " +monthArr[thismonth]+ " " +today_date.getFullYear()+"  "+currentTime.hours + ":" + currentTime.minutes + ":" + currentTime.seconds);
txtDisplay.text = "Date & Time "+fileName + " | " +"Object speed:" + roundDecimals(finalSpeed, 2) ;
}
PHP script:

<?php
if ( isset ( $GLOBALS["HTTP_RAW_POST_DATA"] )) {
    $uniqueStamp = date(U);
    $filename = $uniqueStamp.".jpg";
    $fp = fopen( $filename,"wb");
    fwrite( $fp, $GLOBALS[ 'HTTP_RAW_POST_DATA' ] );
    fclose( $fp );

    echo "filename=".$filename."&base=".$_SERVER["HTTP_HOST"].dirname($_SERVER["PHP_SELF"]);
}
?>


Flash file  PHP file



Resources
http://code.google.com/p/tinkerit/wiki/TinkerProxy
http://www.riacodes.com/flash/captures-images-from-the-webcam-and-save-them-to-thedesktop/
http://www.beautifycode.com/webcam-flash-php-upload-to-server#php
http://www.ladyada.net/learn/sensors/cds.html




Monday, 6 February 2012

Speed measurement with Arduino

I will begin with my first experience working with Arduino and Arduino IDE. I made a speed detection "device" using 2 laser pointers and 2 LDR sensors connected to an Arduino UNO.

Building the schematics is very easy.


The resistors are used as pull-down resistors and I wired the sensors and put them in a case, to avoid them detecting surrounding light. For each case, a hole was drilled so that the laser beam can light the sensor while the ambient light does not affect the sensor.
The working principle is easy: an object that passes by will "cut" the laser beams, this means the LDR sensor will detect this sudden drop of light intensity. First I defined a threshold value under which the sensor is considered triggered, once the value is under threshold for the first sensor then Arduino waits for the second one to be triggered. During this waiting time it counts the elapsed time between the two events. When the second beam is interrupted, the timer stops and now is just simple math. The distance between the 2 sensors is known, the time between the two events is known, and speed can be computed as speed = distance/time.

Below you can find the Arduino code:

/*
by Claudiu Cristian
*/

unsigned long time1;
int photocellPin_1 = 0;     // 1st sensor is connected to a0
int photocellReading_1;     // the analog reading from the analog port
int photocellPin_2 = 1;     // 2nd sensor is connected to a1
int photocellReading_2;     // the analog reading from the analog port
int threshold = 700;        //value below sensors are trigerd
float Speed;              // declaration of Speed variable
float timing;
unsigned long int calcTimeout = 0; // initialisation of timeout variable

void setup(void) {
  // We'll send debugging information via the Serial monitor
  Serial.begin(9600);  
}
 
void loop(void) {
  photocellReading_1 = analogRead(photocellPin_1);  //read out values for sensor 1
  photocellReading_2 = analogRead(photocellPin_2);  //read out values for sensor 2  
  // if reading of first sensor is smaller than threshold starts time count and moves to calculation function
  if (photocellReading_1 < threshold) {
   time1 = millis();
   startCalculation();
 }
}

// calculation function
void startCalculation() {
  calcTimeout = millis(); // asign time to timeout variable 
  //we wait for trigger of sensor 2 to start calculation - otherwise timeout
  while (!(photocellReading_2 < threshold)) {
    photocellReading_2 = analogRead(photocellPin_2);  
    if (millis() - calcTimeout > 5000) return;
  }
  timing = ((float) millis() - (float) time1) / 1000.0; //computes time in seconds
  Speed = 0.115 / timing;  //speed in m/s given a separation distance of 11.5 cm
  delay(100);
  Serial.print(Speed);
  Serial.print("\n");  
}

I think the code is more than well commented and needs no further explanation.


Wednesday, 7 September 2011

Photography rules (5)


Metering Modes
The camera’s exposure sensor, known as an exposure meter, does the majority of the work when figuring out how to shoot a picture. It decides how much light is needed to adequately expose your picture. So it should come as no surprise to learn that cameras distinguish themselves by the kind of meter they use. Some meters are better than others at metering a scene and applying the right exposure.

Center-Weighted Meters

This meter measures the light throughout the image, but applies more weight, or importance, to the central part of the scene in the viewfinder. The assumption, usually a good one, is that you are most interested in the stuff in the front of the picture, so the camera tries to get that part of the scene exposed properly. Most digital cameras rely on this for ordinary picture taking.

Matrix Meters

The matrix meter is famous for its ability to properly expose tricky scenes by balancing the lighting needs of five or more discrete regions within a picture. Instead of concentrating primarily on the middle, matrix meters gauge the light in many parts of the scene at once. If your camera has a matrix meter mode, you should use it most of the time.

Spot Meters

The last major kind of light meter is called a spot. The spot meter is never the only kind of meter in a camera; instead, it’s an option that you can switch to if the center-weighted or matrix meter fails you. The spot meter measures light exclusively in the center one percent of the screen, ignoring the rest of the frame completely. That can come in handy on occasion, but a meter that only measured the light in the central one percent of the frame would typically take very poor pictures, either highly under- or overexposed depending upon the situation.
So when should you use the spot meter? Any time you are trying to photograph a scene in which a small subject must be exposed properly for the picture to work and its lighting is different enough from the rest of the scene that you’re worried it won’t come out right otherwise.

Imagine, for instance, that you are trying to photograph someone who is standing in front of a brightly lit window. If you let the camera decide the exposure, the bright light from the window will radically underexpose the subject. So switch on the spot meter and expose the picture based on the subject. Yes, the window light will be overexposed, but that’s okay, the important part of  the picture is the person.
Varying the metering mode, especially the spot meter, is best used in conjunction with the exposure lock.

Using Exposure Lock

Exposure lock is almost always achieved by applying slight pressure to the shutter release, not enough to activate the shutter and take the picture, but enough that you feel the button move and the camera itself respond.
The magic of exposure lock is that as long as you continue applying light pressure to the shutter release, the camera will use that “locked-in” exposure information regardless of where you later point the camera. You can lock in exposure information for the sky and then point the camera at your feet and snap the shutter release all the way. You’ll take a picture of your feet using the sky’s exposure data. You probably wouldn’t want to do that since the result will be totally underexposed, but it gives you an idea of the potential.

Exposure lock is a great tool for telling the camera that you’d like to take a picture with the exposure data from one specific part of the scene.

When to Take Control

You may often be perfectly satisfied with the results you can get from the automatic exposure controls in your camera. But there will be times when you can do better on your own.

Very Bright Sunlight
Very bright sun can overwhelm your camera, especially if the scene is filled with brightly colored clothing, reflective surfaces, or other tricky subjects. You can reduce the exposure for better effects. Underexpose the scene by EV –1 for starters, and see if that helps.

Backlit Subjects
If you are taking a picture of someone or something and the sun is behind the subject, you’re usually in trouble—the bright background will cause the camera to underexpose the scene. That means the subject itself will look like it’s in shadow. The best way to shoot an outdoor portrait is to put the sun over your shoulder. Nonetheless, if you find the sun behind your subject, overexpose the scene, such as with an EV +1.

Low Light
In low light, such as at night, indoors, or under thick cloud cover, you can often get better results by overexposing the scene slightly, such as with an EV +1. Vary the EV level depending on how dark the scene actually is.

Using Exposure Compensation

Most digital cameras come equipped with an exposure compensation control, usually referred to as the EV adjustment. The EV control allows you to lock in and use the camera’s recommended automatic exposure setting, but then adjust that value up or down based on factors that you’re aware of but the camera may not be smart enough to see. Each Exposure Value (EV) corresponds to changing the exposure by one stop, such as going from 1/60 to 1/30 (this is a change of +1 EV since it doubles the exposure) or 1/15 to 1/30 (this is –1 EV since it reduces the exposure by half). 


to be continued

Saturday, 13 August 2011

Photography rules (4)



Using the exposure modes
Every digital camera on the market makes it easy to take quick-and-dirty snapshots using an automatic exposure mode. Automatic exposure is great much of the time, but when you want to get a little more creative you may need to adjust the exposure settings.
Usually digital cameras have automatic exposure modes as well as manual, priority, and program settings. Here’s what each of these settings does, and when you would want to use them:
- Automatic: In this mode, both shutter speed and aperture settings are selected by the camera to match the current lighting. Some digital camera automatic modes try to select the fastest shutter speed possible in order to minimize camera shake when you take a picture, while most choose something in the middle, a compromise between speed and depth of field. There’s generally nothing you can do to change the settings that the camera chooses when set to fully automatic, except for adjusting the exposure compensation (EV) to over- or underexpose the scene.
- Program: The program mode (usually indicated by the letter P on your camera’s dial or LCD display) is similar to an automatic mode. Although the camera selects both the aperture and shutter, on some cameras you can modify the camera’s selection by turning a dial or pressing a button. The effect: you can increase or decrease the shutter speed, and the camera will adjust the aperture to match. This is a good compromise between fully automatic operation and manual selection. Use this mode if you don’t want to worry about devising your own exposure values, but still want some say over the shutter speed or aperture.
The program exposure mode is often the best all-around setting for your camera. In this mode, the camera chooses a good exposure setting, but you can tweak the shutter speed. The camera will instantly compensate by changing the aperture setting, keeping the overall exposure the same.
- Shutter priority: Using this mode, you can dial in whatever shutter speed you like, and the camera accommodates by setting the appropriate aperture to match.
This mode is ideal for locking in a speed fast enough to freeze action scenes, or slow enough to intentionally blur motion.
- Aperture priority: Using this mode, you can dial in the aperture setting you like, and the camera accommodates by setting the appropriate shutter speed. Use this mode if you are trying to achieve a particular depth of field and you don’t care about the shutter speed.
- Manual: The manual mode (typically indicated with an M) is like an old-style
noncomputerized camera. In manual mode, you select the aperture and shutter speed on your own, sometimes with the help of the camera’s recommendation. This mode is best used for long exposures or other special situations when the camera’s meter is not reliable.

Choosing exposure modes and lenses in special situations
Every situation is a little bit different, but here are a few general guidelines that can get you started.

Portrait Photography
Taking pictures of people can be fun but intimidating. It’s hard to get a natural pose from people when they know they are being photographed. The best way to capture good portraits is to work with your subjects so they are a little more at ease. If you’re trying to capture spontaneous, candid moments, then back off and try to blend in with the background. If you’re trying to capture a fairly formal-looking portrait, you have a little more work cut out for you. It’s up to you as the photographer to put your subjects at ease. Talk to your subjects and get them to respond. If you can get them to loosen up, they’ll exhibit more natural responses and look better on film. Take pictures periodically as you pose your subjects to get them used to the shutter going off, even if it isn’t a picture you intend to keep.
The best way to capture portraits is typically with the medium telephoto lens: in the 35mm world, that would be about 100mm. It is also recommended to work in aperture priority mode. Aperture priority will allow you to change the depth of field quickly and easily as you frame your images. Specifically, good portraits have very shallow depth of field.
You want to draw attention to the subject of your picture, and leave the background an indistinct blur.



Action photography
Action photography is often considered the most exciting kind of photography, but it’s also the most demanding for both your technique and your equipment. As in all kinds of photography, you can no doubt take some great pictures with anything from a wide-angle lens all the way up to the photographic equivalent of the Hubble telescope. And wide-angle lenses do, in fact, have a role in action photography. But the essence of many action shots is a highly magnified immediacy, something you can only get with the telephoto lens.
The shutter priority setting on your digital camera was born for action photography. To freeze action, you’ll need to use a fairly fast shutter speed. Luckily, this higher shutter speed works to your advantage by opening up the aperture and diminishing the depth of field; this focuses the viewer’s attention specifically on your subject. On the downside, of course, focusing is more critical since the depth of field is more shallow.
In general, is recommended that you use the fastest shutter speed available to capture action.
On the other hand, you can use a technique called panning to capture the subject in good, sharp focus and keep the background as a motion blur. Panning is convenient both when you want to make a somewhat artistic statement about the subject’s motion and when you know the camera can’t muster up a fast enough shutter speed to freeze the motion the ordinary way.
Panning involves some effort on your part. To create a good pan, you need to twist your body in sync with the motion of the subject as you press the shutter release. Here’s how:
1. Position yourself where you can twist your body to follow the motion of the moving subject without having the camera’s line of sight blocked by something else.
2. Set the camera’s shutter speed for about 1/60. Feel free to experiment with this, but if you set the shutter speed too slow, you can’t capture the subject effectively—it blurs.
And if the shutter is too fast, you won’t get the pretty blur in the background.
3. Twist your body with the motion of the subject and track it through the camera’s viewfinder or on the LCD display. Press the shutter release and continue tracking the subject until after you hear the shutter close again. Just like in baseball or golf, ensure that you follow through the motion even after the shutter releases. That way, you don’t stop panning in the middle of the exposure. You may need to practice this a few times to get the shot right.
The farther away the background is, the less motion blur effect you’ll get. For best results, get close to the object and its background. If the background is too far away, the blur will be minimal and it’ll just look out of focus.



Nature and landscapes
Unlike action photography and portraiture that rely on telephoto lenses to compress the action into an intimate experience, landscapes typically work best with wide-angle lenses that allow you to include huge, expansive swaths of land, air, and sea in a single frame. Zoom out for best results most of the time, and adjust the camera’s exposure in aperture priority mode to get deep or shallow depth of field, depending upon what works best for the picture in question.

A few special kinds of nature shots warrant special mention here:
Photographing a waterfall or running stream: The two ways to capture running water in a photograph are with a fast, freeze-framing shot or with a longer exposure that blurs the water into a continuous stream effect. Both effects can look good, but the latter is better. The effect looks great, and it’s easy to do: you simply need to take a long exposure of the water.
Here’s how:
1. You need to ensure that your camera will give you a long exposure, on the order of a half second. You can get this by shooting in automatic mode in the early morning or late afternoon, or using a manual mode.
2. Set your camera on a tripod (the long exposure requires a steady support).
3. Compose the image and take the shot.

Shooting wildlife: Wildlife photography is like action photography; it typically takes a telephoto lens, fast shutter speed, and a tripod. Try to fill the frame as much as possible.

Dealing with shutter lag

Older digital cameras had a “shutter lag” that lasted nearly a second, but even the newest digital cameras have some lag.
Shutter lag happens because digital cameras have a veritable checklist of tasks to perform when you press the shutter release. Not only does the camera need to measure the distance to the subject and lock in the proper focus, but it has to measure the ambient light, calculate the best exposure, and lock in an aperture setting and shutter speed. It also has computer-like “housekeeping” chores to perform, like initializing the sensor chip, flushing buffers, and reading white level.
If your camera’s lag doesn’t bother you, fine. But if you want to minimize the lag, there are a few things you can do. The biggest time-saver is auto focus. If you pre-focus your picture, you can save valuable milliseconds of lag. If you’re more adventurous, you can also try pre-setting the camera’s white balance. If the white balance is set on auto, the camera will have to adjust the colors in the image each and every time you take a picture. Instead, you can use the camera’s menu to set the white balance for whatever lighting conditions you’re actually shooting in, such as daylight, night time, fluorescent, or incandescent lighting. Just remember to change the white balance for every new lighting situation you find yourself in.


to be continued


Monday, 1 August 2011

Photography rules (3)

part2

Depth of field
Another important thing that is needed for proper composition is called depth of field. Depth of field refers to the region of proper focus that is available in any photographic image. Usually this is not a thin region of proper focus in an image; instead, there’s some distance in front and behind the subject that will also be in focus. This entire region of sharp focus is called the depth of field, or sometimes the depth of focus.

What determines depth of field?
Three factors contribute to the depth of field.
- Aperture: The aperture of the lens is the first major factor that influences depth of field. Aperture is the size of the lens opening that determines how much light reaches the camera’s imaging sensor. Aperture is measured in f/stops, where lower f/numbers represent bigger openings and higher f/numbers are smaller openings. In addition, the smaller the aperture’s actual opening (or, in other words, the higher the f/number), the greater the depth of field will be.
- Focal length: Is just a measure of your lens’s ability to magnify a scene. The more you magnify your subject, the less depth of field you have available. When shooting with a normal or wide-angle lens, you have a lot of depth of field. If you zoom out to a telephoto magnification, your depth of field drops dramatically. Likewise, macro photography has very little depth of field as well, since you are greatly magnifying a small object.
- Subject distance: The distance from the subject determines how much depth of field you can get in your scene. If the subject is far away, the depth of field will be much greater than it is for a subject that is close to the camera. That means the region of sharp focus for a macro shot is extremely narrow, and you need to focus very, very precisely while for something very far away a vast region in front of and behind the image will be in sharp focus.

Applying depth of field in pictures
The three factors (aperture, depth of field, and subject distance) work together in any shooting situation.

“Specifically, suppose you try to take a picture with an aperture of f/5.6. At a given distance from your subject, and at a given focal length, that f/stop will yield a certain depth of field. But what happens if you change the other two factors? If you get closer to the subject, such as if you walk toward it, or if you increase the focal length by zooming in, the depth of field decreases.
So what is the point of all this? Why do you care about depth of field at all? The answer is that depth of field is an extremely important element in the overall composition of your photographs. Using depth of field, you can isolate your subject by making sure it is the only sharply focused person or object in the frame. Alternately, you can increase depth of field to make the entire image—from foreground to background—as sharp as possible. “

Using zoom lens
Zoom lens allows you to vary the focal length from a wide-angle or normal perspective all the way through some moderate telephoto length. Focal length is just a measure of the magnification that the lens provides. A larger focal length produces greater magnification; hence long focal length lenses are great for capturing fast action or enlarging objects that are moderately far away.

Important to remember is that the focal length of the given lens also affects the camera’s angle of view. Because a telephoto lens magnifies distant objects, it has a very narrow angle of view. As you reduce the magnification and zoom out toward smaller focal lengths, the angle of view likewise increases.

At the extreme end of the scale, for wide-angle lenses, the image is actually shrunk with respect to what the human eye can see. The angle of view becomes extreme, sometimes even greater than 180 degrees. This kind of wide-angle lens is known as a fish-eye lens due to the peculiar effect of the angle of view.
The focal length of your lens has one other important characteristic. Depending upon whether you have your lens set to wide angle, normal, or telephoto, you’ll get a very different depth of field. A telephoto setting yields minimal depth of field, while a wide-angle setting generates a lot of focusing depth.

Maximizing depth of field
The three ways to maximize the depth of field in your image are:
- Use a lens with a short focal length, such as the normal or wide-angle setting on your camera’s zoom.
- Focus on a distant subject. If you’re trying to get both a nearby tree and a more distant house in focus simultaneously, for instance, focusing on the house, rather than the tree, is more likely to deliver both subjects in focus.
- Use the smallest aperture you can, such as f/11 or f/16.
Not surprisingly, you can minimize the depth of field in a picture by doing exactly the opposite of these things.

to be continued

part 2

Saturday, 30 July 2011

Photography rules (2)


part1

Move the Horizon

This rule is related to the rule of thirds. If the rule of thirds is followed to the letter, probably this mistake won’t appear.
Probably you have seen photographs in which the horizon is right in the middle of the photograph. Actually, the photographer probably did not make a conscious decision to do this.
Running the horizon right through the middle of a photograph is boring because it violates the rule of thirds. Try putting the horizon along a rule-of-thirds line, that actually gives two choices for where to put the horizon in any picture, in the top third or the bottom third of the composition.
How do you decide which? It’s easy: if you want to emphasize the distant landscape and sky, put the horizon on the bottom third line.


If you are taking a seascape where you want to emphasize the foreground, the horizon belongs in the upper third of the picture. Of course, these are just guidelines so try to experiment.

Use lines, symmetry, and patterns
“Photographs are two-dimensional representations of three-dimensional scenes. The question, then, is how to best lead viewers through a picture so they get a sense of the real depth that the image is trying to depict.
The answer to that question is simpler than you might think. When you compose an image in the viewfinder, look for natural or artificial lines that might lead the viewer’s eyes through the photo. These lines can create a sense of depth and perspective that is often lost in the two-dimensional photograph. Lines can be formed in almost any situation: you might see a row of trees, the shape of a skyscraper from the ground, or the route of the backyard fence.
Personally, I enjoy using the natural flow of a stream or road to lead the eye from one end of the picture to the other. “
Dave Johnson, How to do everything with your digital camera

Another option is to look for repetition and patterns, and incorporate those into the image. Patterns can create interesting effects, they can add a sense of depth to images. Try combining these patterns with a sense of symmetry. When you employ symmetry, you are balancing both sides of the photograph. That can also help lead the eye through your image.

Use foreground to balance the background
When trying to photograph a distant subject (landscape or cityscape) a common trick is to place something of interest in the foreground to provide a sense of balance.
When done well, the viewer’s eyes are drawn immediately to the foreground object, and then they’ll wander to the background. This is an effective technique for adding a sense of depth and perspective to a photograph, as well as giving the foreground a sense of scale.

Every picture tells a story
When you press the shutter release, you’ve should created an image with depth, motion, and some sort of story. When you look at a good image, your eyes should naturally start in one place and move to another. That’s in sharp contrast to a typical snapshot that has no particular story to tell; the focal point is haphazardly placed, and it’s cluttered enough that there’s no obvious path for the eye to take.
Good artists can use techniques like lines, symmetry, patterns, and multiple focal points to lead the viewer in a specific way through an image. If you can create an image like that, consider it a success.

Know when to break the rules of composition*
After you master concepts like the rule of thirds and filling the frame with the focal point, however, you’ll find that you can take even better pictures by bending or breaking those same rules.
This is an area of photography that is best experimented with and learned on your own, but there are a few pointers to help:
- Change the perspective: Technically, this is not breaking any rules of composition, but this is something that few people think about, yet it can have a profound impact on the quality of your photos. Simply put, experiment with different ways to see the same scene. Try taking your picture by holding the camera horizontally, and then see how you might frame the picture by turning the camera vertically. Get low to the ground or stand up on a chair or table to get a higher perspective on the same scene.
You have a lot of options: try them.
- Ignore symmetry: Sure, symmetry is great, but just as often as symmetry works well in a photograph, sometimes you can get an even better image if you intentionally skew the photo to strip out the symmetry. When the viewer expects symmetry and doesn’t get it, you have introduced tension and drama into an image. And that’s not bad, especially if all you’ve done is photograph some road, train track, or river.
- Surprise the viewer: If you’ve seen one landscape, you’ve seen them all. That’s not really true, but it can sometimes seem that way. Go for the unusual by framing your picture in a totally unexpected way. One of my favorite tricks is shooting landscapes through the side view mirror of a car.
- Use several focal points: While most pictures rely on just one or two focal points, sometimes you need even more, especially when you’re shooting a picture like a family portrait. If you’re taking a picture with several people in it, you can often overcome a cluttered look by arranging the subjects into a geometric pattern. If the subjects’ heads form a triangle shape, for instance, you have introduced order into the photo despite the fact that there are a lot of people in it.

* Dave Johnson, How to do everything with your digital camera

To be continued

part1

Friday, 29 July 2011

Photography rules (1)

After many pictures taken without any theory knowledge about photography I decided to start reading books and take notes and see were and why I have failed taking good pictures.

I will begin my first series of “how to take pictures”, trying to share what I have learned.

What does it take to take a good picture? For sure, it requires more than a solid knowledge of camera’s various controls and settings. If that were all that is needed, anyone who had read a camera manual could be a great photographer, including me.
Unfortunately, taking good pictures demands creativity and a touch of artistry along a solid understanding of the rules of photographic composition and practical experience of when it’s okay to break the rules.


Photography composition

Composition is all about arranging the subjects in a picture and the ability to translate into a photo what is in your mind’s eye. The camera “sees” things very differently, and in order to take great photographs one must have to understand and learn how to see the world the way camera “sees” it.
Only through an understanding of composition the images will go from snapshots to potential works of art.

Why composition is so important?
All of us have been on vacation, seeing a picturesque view, pulled out the camera, and then been disappointed with the final results.

There are some reasons why what the camera “sees” is different from what our eyes see.
Our eyes aren’t just some lens and integrated circuits, all that we see is enhanced and interpreted by our brain and some of the beauty of the scene is added by our mind. Unfortunately, what we see in the viewfinder is what we get, without any enhancing.

A good example of how the eye sees different than the camera. The sky in my mind was a nice blue and the reflexion was not so obvious, I could barely notice it.



Rules of composition

Isolate the focal point
The focal point is the main point of interest that the viewer’s eye is drawn to when looking at one picture.
Always must be determined who or what is actually the focal point of the picture then the photo must be planed accordingly. Usually the single biggest problem with photographs taken by new photographers is that they fail to consider what their subject actually is. When you don’t know what you’re taking a picture of, it’s hard to emphasize that element in the final composition. That leads to muddy, confused arrangements in which there is nothing specific for the viewer to look at.
When the subject is too expansive to be considered a focal point then is recommended to add a secondary focal point.

As a general rule, is wanted a single focal point in the photograph. More than one main subject is distracting, and viewers won’t really know where to look. If you see a photograph in which several objects have equal visual weight, you probably won’t like it, even though you may not be sure why. It is certainly possible to include multiple focal points in an image, but this should be done with care.

Rule of thirds
The rule of thirds is the single most important rule of photography that must be learned and applied.

“Here’s what you should do: in your mind, draw two horizontal and two vertical lines through your viewfinder so that you have divided each plane—the horizontal and the vertical—into thirds. In other words, your image should be broken into nine zones with four interior corners where the lines intersect. It is these corners that constitute the “sweet spots” in your picture. If you place something—typically the focal point—in any of these intersections, you’ll typically end up with an interesting composition.
This really, really is the golden rule of photography. Thumb through a magazine. Open a photography book. Watch a movie. No matter where you look, you will find that professional photographers follow the rule of thirds about 75 percent of the time. And while the rule of thirds is very easy to do, you may find that it is somewhat counterintuitive. “
Dave Johnson, How to do everything with your digital camera

Many people, including me at the beginning, try to put the focal point of their picture dead smack in the middle of the frame.
And the experts are telling that “there are few things in life more boring than looking at a picture in which the subject is always right in the middle”. Fortunately, for many of us, some of the new cameras have the option to display the grid so you are not challenged to draw lines in your mind.

Fill the frame
Essentially, this rule says that the amount of dead space in a photograph should be minimized. Once the focal point of the image is decided there’s absolutely no reason to place it to a small portion of the picture. Get closer, use the zoom , walk over to it! Whatever is needed to do, do it, in order to keep the focal point from being a small part of the overall image.

to be continued

part2

Sunday, 1 May 2011

Stock Photography – refusals

I made an experiment with two stock photography providers after choosing 30 pictures, non commercial pictures good an bad, uploaded them and waited for their approval and I had a quite interesting response from both companies.
Where one company rejected a picture the other accepted it and vice versa. Of course that there are some pictures rejected or accepted by both companies. One thing was funny because one said that one specific picture is out of focus and blurry and not good while it was accepted on the other site the same with one image that was considered to be a snapshot or with other that was considered a low interest or too artistic.

The refusal messages were like this:
- Low interest: Probably little demand/selling potential for this image. Try for more marketable shots.
- Not usable. Only submit vertical images in vertical format not flipped sideways.
- Needs More Keywords: Please add as many applicable keywords as you can so that your photo can be easily found by users, the submitted keywords are not sufficient.
- Snapshot composition: This image is more of a snapshot than a marketable stock image. Overall problems can include poor lighting, poor composition, non-interesting subject matter, etc.
- Poor optical performance due to low lens quality, such as lens fringing, chromatic aberrations, uneven sharpness in focus area.
- Poor composition/Cropped subject: Chopping off part of subject makes photo harder to use generally
- Your image does not meet our current standards because its composition and lighting are below the average for this subject. Note that when it comes to well covered or low demand subjects the overall quality and concept of the image is very crucial and our requirements are higher. Otherwise your image will not stand the competition and may never sell. A well planned and executed commercial image needs to have an attractive and engaging composition which at the same time does not limit the image's potential use by the customers. The lighting in commercial images is also very important. Your image needs to be well lit according to its concept but in all cases retain proper detail throughout the entire frame. It is highly recommended that you see the quality aspects of our best selling images and strive to achieve similar or better results.
- The image contains elements that might be protected by copyright/trademark (logos, brands, specific buildings etc.), can identify a property/product (letters, numbers), or could raise usage problems, therefore it doesn't qualify as a RF stock image. Analyze the photo closely and remove these elements if possible or try to obtain a property release.
- The image contains a large amount of noise artifacts. Please fix this issue using noise-removal software and resubmit.
- White balance parameter was not correctly assigned.
- Image is not RF stock oriented or its sales potential is too low at this stage. Please note that Stock photography is a commercial type of imagery, so, snapshots are not Stock. There are several vital requirements that an image must meet in order to be stock oriented. An image must serve a purpose, must have a concept, must have a good technical execution in terms of composition, exposure, light setting, optical performance. Creativity is a keyword for a successful stock image, as well.
It is also very important to understand that Art and Stock are two fundamentally different categories of imagery, that only meet when an artwork can adapt to a wide range of commercial usage.
- Artifact Problems: Noise/Grain/Chromatic or other artifacts due to low light, blue or purple fringing, high ISO, over-sharpening or post processing techniques. Please view image at 100% prior to submission.

So, as a conclusion … acceptance rate was around 30%.

If you want to sell your pictures and score better than me then you should take pictures having in mind the commercial aspect not the art aspect. A very good artistic picture is not stock as they say “It is also very important to understand that Art and Stock are two fundamentally different categories of imagery, that only meet when an artwork can adapt to a wide range of commercial usage”.
They also have an interesting option if you want to sell your picture only with them or not, if you let them have exclusive right to sell your picture then you should not use it with other company and they will offer you higher rates per sale. Other option is to sell the rights of the picture and when you have a buyer you will lose any rights over that picture. I will treat this subject later.

Overall the interaction with both companies, until now was quite smooth and clear with small differences in their acceptance but hey, then they will have the same content and where will be the difference?

To be continued

Saturday, 23 April 2011

Stock photo tips

Tips for stock photography (out of my experience)

Quality – even if is a shitty photo the quality is important, must be a quality shit not a regular shit.

Composition / Idea – if your photo is more art than “buy me” is not good, they don’t accept images that don’t have potential to sell.

Noise – noise is a big NO, well it should be a big no for any wannabe photographer … if it has noise is trash.

JPEG artifacts – also a big NO.

Light - overexposure, lens flare or too much brightness is not acceptable also shadows that are not part of composition are a good reason to be rejected.

Ok, maybe the above are rules of common sense if you are a wannabe photographer and your photo will have good chances to be accepted. Next filter is what I like to call a commercial filter. Even if your friends are impressed by that particular photo and maybe you received some positive feedback from other photographers it doesn’t really matter. Your photo could win some photo contests and still not be good for stock photography. Why? Simple! It will not sell!!! Your photo is not what you can find on a flyer or website! Yeah, is true, art doesn’t sell! You must think commercial!

Some advices:
- Your photo must have a story behind, not just a snapshot, so that the web designer / print designer could find it useful.
- Can be used on multiple projects
- No logo or identifiable trademark
- Nudity is accepted with some rules regarding what is seen or not (no genitals, erotic pictures etc.)
- Pictures like autumn / winter landscapes or sunsets / sunrises are submitted in large numbers so your photo must stand out in order to be accepted.
- No recognizable faces unless you have written permission from those persons (even if is a big crowd and you can see clearly 20 faces you have to obtain permission from all 20 … yeah it is crap, I know).
- Landmarks only if they are different and not tourist-like photo (everybody has a picture with Eiffel tower that looks nice).
- Minimum 3MP at highest quality
- Minor Photoshop touch-ups can be accepted
- Good keywords and description.

Happy shooting everybody!

Keep you posted ;)

Earn money with your hobby

How to make money out of your hobby, out of photography … can be a reality or a dream?

How to earn money with photography? Well is a question I still ask but seems that there is room for everyone. Of course I am not rich and I don’t earn money out of my photography because I was quite ignorant and I am not really enjoying making photos that businessman will love … all that corporate bullshit we all see in bank, real estate, big companies, insurance, legal advice or other leaflet / flyer / promo material … all those fake smiles, business look, business related objects and so on.

BUT … because there is a big but (and maybe a big butt that will make big money on your back) … fortunately there is stock photography. Like its name suggests if you have a big stock (pile) of pictures you can make some money with no effort.
Why?!? Thanks god that are lazy people who prefer to buy than to make.
Who? Usually small businesses because is cheaper to buy stock photos than to pay a photographer (1$ for a photo versus more $)
Where? Internet, low budget printouts, local ads and the list can go on.
How much you can earn? Well, it depends can be almost near 0 or some internet sources like to brag that they earn 3 to 4 figures per month. May be, I’m not making their financial reports to see if it is true or not.

My own experience …. Using several stock photography providers and a shitty (yeah, it is crap) photo I manage in 5 years to gain the impressive amount of …. $1.98. If I think that if only one picture in the big ocean of pictures can perform like this ... Ok you can do the math ... 1 picture in 5 years results 1.98 … think now how many pictures having the same “success” like this one you should have in order to buy a meal. On the other hand I have done nothing and I have earned $1.98.

What is the catch? It is one big catch … because you receive around 25% of the real amount. If you think about it … it is outrageous … they earn 75% just for displaying your picture. At a second look you can think at the costs of maintaining a website as a beginner in this branch are quite high and maybe nobody will land on your page and even if they will and they will buy your photo it is quite hard to get that money out of one photo after 5 years. I don’t say that I like them very much but I still think that for a beginner it is a good start.

I really think about going to research more this opportunity as my camera is really old and I cannot afford to buy a new one so … I must try the sea with my toe in order to see if it is as advertised or not.

Below you can find two good websites for starters.


Stock Photos, Royalty Free Stock Photography, Photo Search














I will keep you posted with my research.