Show Posts
Pages: [1]
1  Using Arduino / Networking, Protocols, and Devices / Re: SIM900, net problem on: June 18, 2014, 09:35:33 am
Ok, I found a power supply : 15V 800ma

This works now, that means this was only a question of power!
Why sainsmart do not provide a clear reference?
2  Using Arduino / Networking, Protocols, and Devices / SIM900, net problem on: June 18, 2014, 09:11:28 am
Hello,

I recently bought this shield from sainsmart :
http://www.sainsmart.com/arduino/arduino-shields/wireless-shield/new-sim900-gsm-gprs-shield-module-development-board-for-arduino.html

And I connected it to my Arduino UNO.
I really lack documentation and I decided to use the RX/TX pins connected on 0 and 1
I used a very simple code (with a french cellphone and having disabled the PIN code):

Code:
#include <SerialGSM.h>
#include <SoftwareSerial.h>
SerialGSM cell(0,1);
void setup(){ 
 Serial.begin(9600);
 cell.begin(9600);
  cell.Verbose(true);
  cell.Boot();
  cell.FwdSMS2Serial();
  cell.Rcpt("+0605443322");
  cell.Message("ça marche ma caille?");
  cell.SendSMS();
}


void loop(){
  if (cell.ReceiveSMS()){
    Serial.println(cell.Message());
    cell.DeleteAllSMS();
  }

}
Here is my problem :

When I switch on the SIM900 power button on the shield, the status Led remains lighted (ok) and the NET Led blinks (5 x 800ms) and is switched off. Then, the shield is inactive again. The strange thing is that when I remove the sim card from the shield, the NET led continues to flash permanently.

That means I can't use the shield because it isn't active as sort to find an available network. I made several researches. Some people say that these kind of shield should need an external alimentation. However, there isn't a plug on it for the alimentation. I'm wondering if the problem is really related to the alimentation.

I asked Sainsmart support additionnal informations about this shield but without success.

Many thanks for your advices.
3  Using Arduino / Programming Questions / Re: Relay and temperature sensor on: November 20, 2012, 02:21:49 pm
I thought I could find a function for the hysterisis but none. However, I guess I can make one enough simple but wouldn't the problem be the same, if I set a new threshold, wouldn't I encounteer the same problem?
4  Using Arduino / Programming Questions / Relay and temperature sensor on: November 20, 2012, 01:57:00 pm
Hello everybody,

I have a temperature sensor which shouldn't exceed 37°. I have a relay which activates a heater.
When I reach the threshold, the heater should be stopped. When the temperature goes below, it should be reactivate.

I have a prublem. The first one is related to the threshold. When my values are decreasing or increasing around the threshold (36,8-37,2 ), the relay is flashing because the values are one time below the threshold, one time above.

So I tried to use an average function which outputs datas from a range of values. This works not so bad except when I reach the threshold, the relay is activated but the values aren't sent anymore to the serial termnial. The temperature then isn't red anymore and is increasing higher and higher without any limitations...


Here is my code. Does anybody have an idea where I'm doing wrong?
Code:
String inputstring = "";                                                       //a string to hold incoming data from the PC
String sensorstring = "";                                                      //a string to hold the data from the Atlas Scientific product
boolean input_stringcomplete = false;                                          //have we received all the data from the PC
boolean sensor_stringcomplete = false;                                         //have we received all the data from the Atlas Scientific product
byte PinChauffage = 2;
byte PinLumiere=3;
byte PinBullage = 4;
int tempSensor = 8;
float temp;               
//Aveage variables
const int numReadings = 10;
int readings[numReadings];      // the readings from the analog input
int index = 0;                  // the index of the current reading
int total = 0;                  // the running total
int average = 0;               


int led = 13;
byte val = 0;
// variable etat Relais 1
int etatRelais1;
boolean lock_temp = true;
int state = 0;
int sensorDelay=500;
// Threshold
int seuil = 37;
int tempMin = 20;





void setup() {
  Serial.begin(38400);
  pinMode(tempSensor, OUTPUT);
  pinMode(PinChauffage,OUTPUT);
  pinMode(PinLumiere,OUTPUT);
  pinMode(PinBullage,OUTPUT);
  pinMode(led,OUTPUT);
  etatRelais1=HIGH; 
  digitalWrite(PinChauffage,etatRelais1);
  digitalWrite(PinBullage,etatRelais1);
  digitalWrite(PinLumiere,LOW);
  // initialisation données à 0 pour le lisseur
  // initialize all the readings to 0:
  for (int thisReading = 0; thisReading < numReadings; thisReading++)
    readings[thisReading] = 0;       
}   





void loop() {
  temp = read_temp();
  total= total - readings[index];       
  readings[index] = temp;
  total= total + readings[index];     
  index = index + 1;                   
  if (index >= numReadings){       
    index = 0;         
  }   
  average = total / numReadings;   
  delay(1);        // delay in between reads for stability   

  Serial.println("Average :"); 
  Serial.println(average); 
  Serial.println("      ");
  Serial.println("Temp capteur :");
  Serial.println(temp);     //print the temperature data
  delay(500);   
  if (average <= seuil){
    digitalWrite(PinChauffage,LOW);
    digitalWrite(PinLumiere,LOW);

  }
  if (average > seuil){
    digitalWrite(PinChauffage,HIGH);
    digitalWrite(PinLumiere,HIGH);

  }
  delay(sensorDelay);
}


float read_temp(void){
  float v_out;  //voltage output from temp sensor   
  float temp;  //the final temperature is stored here
  digitalWrite(A0, LOW);  //set pull-up on analog pin
  digitalWrite(tempSensor, HIGH);  //set pin 2 high, this will turn on temp sensor
  delay(2);               //wait 1 ms for temp to stabilize
  v_out = analogRead(0);  //read the input pin
  digitalWrite(tempSensor, LOW);  //set pin 2 low, this will turn off temp sensor
  v_out*=.0048;         //convert ADC points to volts (we are using .0048 because
  v_out*=1000;          //this device is running at 5 volts)   
  temp= 0.0512 * v_out -20.5128;  //convert volts to millivolts the equation from millivolts to temperature 
  return temp;             //send back the temp
}

Pages: [1]