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.

Next step - Interface it with a flash application, soon.

Friday, 27 January 2012

University project teaser

During this winter semester at H-DA we had to develop a product (later I will reveal the product). For this product we had to make a teaser (to tease our teachers) before the final presentations.

The teaser should be a bit teasing and makes you want to know more about the product if not event own one. Also, it should reveal small info about the character of the product.

The available time (for some other reasons) for making this short teaser was short (24h) the script, images and animation were done during the night. Music is "freeware" so it does not infringe any copyright laws.
As a first-timer in this "teaser" and teasing stuff, I hope that it can be considered a teaser.




Grapevine teaser for "wired in" from Claudiu Cristian on Vimeo.


More about the product ... next days.

Wednesday, 14 December 2011

List of "soon to be" tutorials

As I am more working for my school than for my hobby, here is a short list of the tutorials that will go live starting with january / february:


1. Speed detection / speed camera with arduino, AS3 and PHP
2. Arduino real-time GPS tracking
3. C++ and OpenCV face detection and recognition (if is not too simple for my teachers)
4. Indoor navigation system for Android (for the moment is under discussion if the wheel should be reinvented or just use some services that are on the market)
5. Other small PHP stuff

Infected Rain - No idols

continuing the series of hard music combined with hardcore programming :)

 




Sunday, 11 December 2011

Infected Rain - Judgemental Trap

They made my day! This girl knows how to rock!


I took a break from photography since my university studies require a lot of time this semester.
Soon I will post some tutorials on Arduino and Flash, after I will have a working project.

Until then … just coffee and Hardcore (in this case is just Nu Metal, or at least the "specialists" say that it is Nu Metal) can save me from madness!

Monday, 17 October 2011

X-Men Mystique bodypaint

I just run over Mystique form X-men, by accident. Fortunately was just a bodypaint version of Mystique. Great job done by the artist, from the distance was looking like a real X-Men costume.

 X-Men Mystique bodypaint




Wednesday, 28 September 2011

IAA 2011 Frankfurt: Ford Focus & Fiesta

Ford Focus and Ford Fiesta: two cars that I like very much, one day I will buy a Focus (but I am sure that the guys from Ford will give me one for free, just because they like my smile)











IAA 2011 Frankfurt: Ford EVOS Concept

Ford did it again and presented the Evos concept at Frankfurt auto show, I can't wait to see this concept put into production and in traffic.














IAA 2011 Frankfurt: Chevrolet BelAir

And I can say just: "Hello sexy!" this Chevrolet BelAir is quite good looking, or should I say Chevy? Just to be more friendly with this nice muscle car. Just imagine yourself driving this car on the highway on your way to the beach or to a fancy restaurant.






 ... hello lady! ...


Monday, 26 September 2011

IAA 2011 Frankfurt: Chevrolet Miray


Chevrolet Miray or how to be aggressive, sexy and ugly. Its appearance made me think at Alien and Predator in the same time, technology and ugliness, appeal and aggressive look; a bizarre combination that makes it attractive.














More to come ....