hi guys,
i'm working on a project which required to have vibration sensor with arduino with Xbee module installed on it to send the vibration data it's quite simple but the problems happens when i connect arduino FIO with external 6 volts usb supply
i found that the vibration sensor is giving me voltage as if there is a vibration
i don't know why this happens but when i tried the battery only it works fine
when i try the supply from my PC by using usb cable to connect from my PC usb to the arduino no problem also
i checked the design of the FIO i found that the external power supply won't affect the arduino FIO board as it's working on 3.3 volts and it pass through regulator and many capacitors for smoothing the voltage
the Hardware design was very simple
the Positive pin of the sensor connect to pin 1
the negative to the ground
1 mega ohm resistor in parallel with the two pins of the vibration sensor
i need your help please
here is my code it may be something wrong on it
//arduino node ID
#define ID 10
///////////Vibration sensor//////////////////////
// these constants won't change:
const int knockSensor = 1; // the piezo is connected to analog pin 1
unsigned long threshold = 475; // threshold value to decide when the detected sound is a knock or not
//////////////////////////////////////////////////
void setup() {
Serial.begin(9600);
digitalWrite(vcc, HIGH); // sets the vcc on
analogReference(INTERNAL) ;
}
void loop() {
//check vibration sensor
vibration() ;
}
void vibration()
{
unsigned long sensorReading = 0 ;
// read the sensor and store it in the variable sensorReading:
sensorReading = analogRead(knockSensor);
// if the sensor reading is greater than the threshold:
if (sensorReading >= threshold)
{
Serial.print(ID);Serial.print(",UP,");
// send the string "Knock!" back to the computer, followed by newline
Serial.print("glass=knock.");
Serial.print(sensorReading);
Serial.println(";");
delay(2);
}
so i need to make some calibration ???
do i need to change the 1 meag ohm
any help would be appreciated