thank you for taking time to read my post
if i have missed something in my search of these forums please let me know
now for my project
i have a pressure sensor that i have converted to a regulated 5v output when the pressure gets to a certain level.
i would like to have the arduino uno send a text if the pressure gets to this pressure 3 times in less than 7 seconds.
i have another sensor that i have converted to a regulated 5v output when the coolant level drops below a certain level
i would like to have the arduino send a text when it gets to this level
preferably(hopefully?) send a text that reads "pressure" for the pressure switch and "level" for the coolant level
i have interfaced SIM900 to the arduino and have it send test texts. i am unsure on how to have the voltage inputs send the text,
thank you for your time and patience.
How have you converted the sensor output to "a regulated 5v output"?
Please put your code in its own window as seen in other posts. This can be done by placing [code] and [/code]
around the code or use the </> icon. This makes it easier for others to read.
How to use this forum
We can then see where to put the required code.
Weedpharma
i apologize for not including the code
i used a relay and a 120volt AC switched 5volt DC power supply to output the signal from the sensors. RFI is not a factor in this application
// send SMS
#include <SoftwareSerial.h>
SoftwareSerial SIM900(7, 8);
void setup()
{
digitalWrite(9, HIGH);
delay(1000);
digitalWrite(9, LOW);
delay(5000);
}
void sendSMS()
{
SIM900.print("AT+CMGF=1\r"); // AT command send SMS
delay(100);
SIM900.println("AT + CMGS = \"+15055555555\""); //my mobile number,
delay(100);
SIM900.println("TEST"); // message
delay(100);
SIM900.println((char)26); // End AT command with a ^Z, ASCII code 26
delay(100);
SIM900.println();
delay(5000); // give module time to send SMS
}
void loop()
{
sendSMS();
do {} while (1);
}
Do you mean that you have a regulated 5v supply to your sensors rather than the output being regulated to 5v?
What type of output do you get from your sensors? Analogue or digital? What pins are they connected to?
Weedpharma
The sensors are fed a/c voltage and output approx 40volts A/C analog but I am using relays to get the 5 volts the arduino uses as an input. I am unsure to use these as analog or digital inputs.
I think we need a link to these sensors, they sound most strange.
Do you mean that the sensor has to be high for 7 seconds continuously or it goes high and then low three times in seven seconds? You need to specify what happens for all possible input conditions.
yt400pmd:
The sensors are fed a/c voltage and output approx 40volts A/C analog but I am using relays to get the 5 volts the arduino uses as an input. I am unsure to use these as analog or digital inputs.
You might need to do a little more explaining how this setup works. Arduino pins usually accept 0v-5v DC input.
Are you saying that the supply to the sensor is AC voltage and when it is actuated, it outputs 40vac. You are then using this to turn on a relay that switches 5v to the Arduino input.
Weedpharma
Weedpharma you are correct
I need to know if the pressure spikes 3 times within 7 seconds. All other spikes are to be ignored.
I need to know if the level drops also
You still don't get it do you.
Please read this:-
How to use this forum
It will tell you how to ask a question and it will also tell you to answer questions asked.
Last time. Please provide a link to those sensors they are most unusual.
i do not know the brand or type of sensor as they are before my time.
if the pressure spikes 1 time every hour i do not need to know
if the pressure spikes 3 times in 1 minute i do not need to know
i only need to know if it spikes 3 times in 7 seconds that is when it needs to send a text
i need to know any time the level drops
What question should I be asking? How can I delete this thread and have a better title in a new one
I believe since I am using relays the signal should be considered digital as they are either on / off
Well...on the assumption you are getting a relay to cause an arduino pin to go HIGH:
I had a quick go...it checks if the state of the pin changes and increments a counter.
byte return_number_state_changes() {
long time_now = millis()
pin_state = digitalRead(pin);
byte counter = 0;
while (millis() - start_time < 7000) {
if (digitalRead(pin) != pin_state) {
counter++;
pin_state=pin_state*-1;
}
}
return counter;
}
Thank you!
I will try that.
Any advice? I am very new at this