hello....
In my project, I need to read data input from a pressure sensor npc 1220, and send some sort of indication to arduino everytime when the output of the sensor changes.I have done the first part. Is it possible to create interrupt,to inform the microcontroller when the sensor value changes? or is there any other method?
i have attached the sensor datasheet if necessary.
thankyou
I'm not an expert so take my advice lightly. In your case I would write code that compares the difference between what the sensor was and what it is. set your current value to a variable and then delay some amount of time then save the value again to a different variable. Then take the two and subtract them. If the answer is not 0 it has changed. Depending on how sensitive the sensor is, you may not want to make it compare it to 0 but say if the absolute value of the difference is greater than some value. For instance start your comparison at 1,( if firstValue - secondValue > 1 then do blah) if it is still too sensitive move that number up incrementally to adjust until you are happy with it. As far as actually writing code to read the sensor, I cant really help you. This part of the code should be relatively simple compared to actually getting the data. Hope this helps!
hi to read data from my code i wrote the code as below, void setup() { Serial.begin(9600); } void loop() { int sensorValue1 = analogRead(A0); int sensorValue2 = analogRead(A1); Serial.println("voltage value="); Serial.println(sensorValue1); Serial.println(sensorValue2); delay (1000); } am getting the output as below. It is very inconsistent and random...as per theworking of my sensor he voltage values must increase when the pressure increases. Is there any mistake in prgramming or the way that i have connected the sensor to board? i connected +out pin to A0 and -out pin to A1. any suggestion will be helpful thankyou my output: voltage value= 374 379 voltagevalue= 359 365 . . . . . voltage value= 42 43
yes sir I have connected the sensor outputs directly to arduino.......
can you please tell me what the bridge exciter circuit is.?
Also I wanted to know if the PC can detect two arduino boards simultaneously connected to it?
thank you
On page 2 of the data sheet at the top there is a diagram. Everything inside the dotted line is your sensor. Everything outside the dotted line is your exciter circuit. In this case it consists of an amplifier and voltage reference that powers or excites the bridge circuit.
However the data sheet also says you get 50mV full scale output from the bridge. That means that at the maximum pressure output you will only get a reading of 10 from the arduino's A/D converter. So it is not very suitable for direct connection.
This sort of sensor needs an amplifier if it is to be of any practical use.
This is a link to the sort of amplifier circuit you need:-
Also I wanted to know if the PC can detect two arduino boards simultaneously connected to it?
Yes it can but only one can talk to the serial monitor built into the arduino IDE. The second will have to use another terminal emulator like freeTerm.
i connected 2 arduino uno boards to laptop and tried loading blink sketch by opening 2 arduino IDE windows. it worked on one board with COM 15. but for the other its not. i tried selecting COM 4,5,6,9,10,11. but it is showing the error as "avrdude: stk500_getsync(): not in sync: resp=0x00" what should i do so that I can work on both boards simultaneously?
The connections + and - of the sensor, you should connect the -ve to your arduino ground and the +ve to your arduino analog input pin.
You will then read the voltage output by the device.
The other problem is, the output of this device is 50 millivolts at full scale. On the arduino analog input, this will give you a reading of between 0 and 10 ( counts out of 1023 ) only, because the full range of this device is only 1/100th part of the full analog input range 0 to 5 volts.
The actual values you got, are the difference between your sensor1 and your sensor2 , which is 5 or 6 counts on the examples you got, so it actually looks like it is working.
You can improve the effective A/D range by understanding and using the arduino AREF pin. You could also use an external amplifier circuit using an op-amp to increase the size of the signal which the arduino is receiving.
The connections + and - of the sensor, you should connect the -ve to your arduino ground and the +ve to your arduino analog input pin.
That is not how one reads a low level differential output from a Wheatstone bridge circuit. Grounding the -ve pin will just severally unbalance the bridge. See the ground connection at the bottom of the circuit, that is the only connection to be made to an arduino ground pin. The measurement to be made is the difference between -ve and +ve, not the absolute voltage of either of those pins, as they are both at nominally 1/2 of the excitation voltage applied to drive the bridge. An instrumentation type op-amp circuit is needed to both perform the differential measurement between -ve and +ve plus to add gain and also to convert the resulting analog output measurement voltage to a single ended type suitable for reading with an arduino analog input pin.
You will then read the voltage output by the device.
The point is that there is no voltage output from this sensor because the OP has not connected any excitation voltage to the other two ends of the bridge.
I am not sure why he and michinyon are ignoring the links to my diagrams, I went through all this in the late 80s, but if you want to find out for your self then go ahead. Just don't copy what I said and pretend it is your own work, and then get it wrong to boot.
sir, i connected a simple opamp amplifier as per the circuit diagram in the data sheet and verified the result. Am still getting random interger values.(both positive and negative)and i referred the circuits in the link that you sent me. but can you please tell me which circuit to use among them?
i have attached the circuit i tried to read the sensor with. The amplifier A1 that i used was non inverting opamp . output was random integers. can you please suggest any modifications?
thankyou
ok sir, one last doubt, should i connect the amplifier circuit thatyou suggested in place of A1 in the datasheet or at the output of the sensor?
thankyou for your replies and patience
thankyou sir..
now that I have the sensor readings, i have two questions.
1.I want to read the data from arduino to matlab,so once the arduino is programed to read the sensor ,if i disconnect and connect it again can i directly read it to matlab or do i need to run the program on arduino through arduino IDE again and again?
2. any information on how to read and plot the data on matlab will be helpful...am not satisfied with whatever i got from browsing.
thankyou.
Once an arduino has a program in it that program will run every time power is applied. There is no need to keep reloading it.
Sorry but I do no use matlab.