Pulse rate with processing

hello

I am just trying to make a simple project like this done in makezine

but when I run processing code , I see the following :

https://fbcdn-sphotos-b-a.akamaihd.net/hphotos-ak-frc3/1458437_680880485267241_883925905_n.jpg

and surely not the expected pulse signal !! , moreover this signal exist even if i disconnect the input wire ( A(0)) to Arduino

any help is appreciated

and surely not the expected pulse signal !! , moreover this signal exist even if i disconnect the input wire ( A(0)) to Arduino

The best advice I can give you is to not read from a disconnected pin.

The second best advice I can give you is to post your code - for both ends. Don't expect us to guess what code you are using.

i used this serial monitor code to get data from the output of the circuit ,also i modified it to see it the problem is with code ,but nothing works

*/

// holds temp vals

void setup() {

Serial.begin(9600);
}

void loop() {

Serial.println(analogRead(0));
}

OK. So, the Arduino is jamming data out the serial port as fast as possible. Do you see anything on the Serial Monitor?

What is connected to analog pin 0? What values do you see in the Serial Monitor?

i also used this orginal code from the project link
i tryed to modify it as wekl , but there is only a small difference , but it is not the expected result after all

//Based on examples from Arduino's Graphing Tutorial and OscP5 documentation
import processing.serial.*;
Serial myPort; // The serial port
int xPos = 1; // horizontal position of the graph
float oldHeartrateHeight = 0; // for storing the previous reading

void setup () {
// set the window size:
size(600, 400);
frameRate(25);

// List available serial ports.
println(Serial.list());

// Setup which serial port to use.
// This line might change for different computers.
myPort = new Serial(this, Serial.list()[1], 9600);

// set inital background:
background(0);
}

void draw () {
}

void serialEvent (Serial myPort) {
// read the string from the serial port.
String inString = myPort.readStringUntil('\n');

if (inString != null) {
// trim off any whitespace:
inString = trim(inString);
// convert to an int
println(inString);
int currentHeartrate = int(inString);

// draw the Heartrate BPM Graph.
float heartrateHeight = map(currentHeartrate, 0, 1023, 0, height);
stroke(0,255,0);
line(xPos - 1, height - oldHeartrateHeight, xPos, height - heartrateHeight);
oldHeartrateHeight = heartrateHeight;
// at the edge of the screen, go back to the beginning:
if (xPos >= width) {
xPos = 0;
background(0);
} else {
// increment the horizontal position:
xPos++;

}
}
}

yes there is data ranging from approx 30 to 400 , but the confusing thing us the the serial monitor keeps showing data even if i disconnect the input wire to A0 !!!

but the confusing thing us the the serial monitor keeps showing data even if i disconnect the input wire to A0 !!!

Why is that confusing? You don't stop reading the pin when you disconnect the wire, so of course the Arduino is going to keep pumping out data.

Generally this works better if you quote the questions and provide answers to them.

pumping data from where !!

pumping data from where !!

From the Analog to Digital Converter. The ADC can't tell that there is nothing attached.

Speaking of which, it's time for you to post a picture showing what is really attached to analog pin 0 (and other pins).

bro have you seen the project in makezine ?
this what i get everytime i run the code even if nothing is attached to analog input, see the pic plz

the analog input supposed to recieve the pulse signal from the pair ir transmitter and detector
but it seems like nothing is read through the serial monitor !

bro have you seen the project in makezine ?

I'm not your brother (I hope), but I've looked at the project. What I can NOT see is proof that you constructed the device correctly or that you attached it correctly to the Arduino.

this what i get everytime i run the code even if nothing is attached to analog input,

I've said more than once that it makes no sense running the code with nothing connected to the analog input pin. But, if connecting, or not connecting, the device to the analog pin makes no difference, then the problem is NOT in the code on the Arduino OR the code on the PC. It means that the hardware connected to the Arduino is NOT functioning properly.

see the pic plz

The proxy server is refusing connections

Firefox is configured to use a proxy server that is refusing connections.

Check the proxy settings to make sure that they are correct.
Contact your network administrator to make sure the proxy server is working.

we here say bro to respect someone :slight_smile:

the device is construcred correctly ,and i tested it several times, i am very good in electronics :slight_smile:

actually i just run the code to check the response of the input signal and if the serial is getting data

I got the error like your
finally, I realized that the broblem is in the usb port, I plugged the usb port of arduino serial to the usb port of the laptop fan. so it makes so much noise. I plugged the usb port of arduino to another usb port of my laptop and it's really good display. (SORRY FOR MY SUPER BAD ENGLISH, I'M VIETNAMESE :smiley: )