domenica 22 settembre 2013

Arduino ultrasonic distance measurement

Hi guys' today I'm here with a tutorial about interfacing arduino with ultrasonic distance meter like the HC-SR04.
First of all, the theory:

If we know that the sound take a time to reach the obstacle and come back and that
speed s is equal to s=d/t where d is the distance then d=s*t .
We consider that speed of sound is 340.29 meters/seconds that is equal to
0.034029 centimeters/microseconds.

Now let's see the hardware parts, which is very simple:



To start measuring distance you just have to upload this code to the arduino
int trigPin = 2;
int echoPin = 4;

void setup() {
  Serial.begin(9600);
}

void loop(){
  long duration;
  float cm;
  pinMode(echoPin, INPUT);
  pinMode(trigPin, OUTPUT);
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);
  duration = pulseIn(echoPin, HIGH);
  cm = microsecondsToCentimeters(duration);
  Serial.print(cm);
  Serial.print("cm");
  Serial.println();
  delay(100);
}
float microsecondsToCentimeters(long microseconds){
  return (microseconds*0.034029)/2;
}


Here is a video of me testing this project:


I hope you like this post, if you have any question please comment or send me an email to damianoandre@gmail.com

Bye,Dami

mercoledì 4 settembre 2013

Use Arduino with RF Modules

Hi guys, today I'm here with a really cool project.
If you have ever wondered how to make 2 arduinos communicates without using expensive shield, here is the solution: there are some RF modules sold for about 2$ (transmitter + receiver)  that offer one way, easy-to-use communication with a range of about 150 meters.
In this post I'll explain how to use this modules.

First of all you'll need:
-2 arduinos
-a rf transmitter
-a rf receiver

STEP 1: the transmitter
Connect the transmitter to arduino this way:




Upload this code to the arduino connected to the transmitter:
 
#include <VirtualWire.h>
void setup(){
  vw_setup(2000); // bps
  }
void loop(){
  send("hello world"); //your message
  delay(1000);
  }
void send (char *message){
  vw_send((uint8_t *)message, strlen(message));
  vw_wait_tx();
  }

STEP 2: the receiver
Connect the receiver to the arduino this way:





Upload this code to the arduino connected to the receiver:

#include <VirtualWire.h>
byte message[VW_MAX_MESSAGE_LEN];
byte messageLength = VW_MAX_MESSAGE_LEN;
void setup(){
  Serial.begin(9600);
  Serial.println("Device is ready");
  vw_setup(2000); //bps
  vw_rx_start();
  }
void loop(){
  if (vw_get_message(message, &messageLength)){
    Serial.print("Received: ");
      for (int i = 0; i < messageLength; i++){
        Serial.write(message[i]);
        }
      Serial.println();
    }
  }

STEP 3: test ;)
Connect the 2 arudino and check with the serial monitor if it works


I hope you like this post, if you have any question please comment or send me an email to damianoandre@gmail.com

Bye, Dami

martedì 3 settembre 2013

Where to buy electronic parts for cheap

Hi guys Today I'm here with a tip about where to buy electronic parts(Arduino boards, LED, ICs, Arduino Shields, RF modules ecc...) for cheap.
 It's an ebay store located in Hong Kong, here is the link to the ebay page, I think it's a good seller beacuse it offers:
-really low prices
-good quality items
-more than 3000 items
-free shipping
The just thing I found not perfect is the slow shipping, but it's free so however it's good.
I hope you like this post,

Bye, Dami

domenica 25 agosto 2013

mercoledì 21 agosto 2013

Use android phone as webcam

Hi guys, today I'm here with a short but useful tutorial about using your android device as webcam:
-first of all download on your phone the app "IP Webcam"
-then start the server from the app (be sure to be connected on the same network of your computer)
-finally download the camera adapter from here.
If you have any problem when you start the server open broswer on your pc and go to http://192.168.1.40:8080 you will see the guide for using the camera.

I hope you like this post,
Bye, Dami

domenica 18 agosto 2013

Update android on Xperia ray

Hi guys this is just a little tip for everyone who wanna update android OS on an Xperia device: unlike previous updates now you will have to update your phone via pc.
Go to sony PC-Companion download page and download the software, then just follow the instructions to update your phone.
I know it's a short post but I hope you'll find it useful ;)
Bye, Dami

venerdì 16 agosto 2013

Humble Bundle

Hi guys, today I'm posting about a site I found really interesting: humble bundle.
In that site you can pay 1$ a game like "medal of honor warfighter" or 5$ "battlefield 3"
A part of your money will go to a charity, another to game developers and another to Humble Bundle Inc.
I hope you enjoy that site,
Bye, Dami

martedì 13 agosto 2013

Where to buy for cheap xbox live membership

If you are looking for cheap xbox live gold membership I suggest to check this site.
I tested it in Italy but I think that memberships can work in every country.
The price is about 35€ for 13 months membership.
I hope you like this post even if it's short, if you have any question comment or send me an email to damianoandre@gmal.com

Bye, Dami