2

so I'm using a promini running on solar power. For some reason, after sometime it gets stuck with the green led flashing and only by cutting power can I reset the promini. Even the reset button doesnt work. Exactly like in this post "Watchdog timer stuck in restart loop? (green led flashing)". However, the strange thing is that I am not even using a watchdog timer. So what could be the cause of it? Could it be due to the lack of power from my solar panel?

Here is my code

#include <SPI.h>
#include <RF24.h>

int green = 8;
int red = 6;

// ce,csn pins
RF24 radio(9,10);

// init data buffer to hold a sensor type byte and one uint16_t sensor data
unsigned char data[3] = {
  0};
unsigned long count=0;

void(* resetFunc) (void) = 0;//declare reset function at address 0
void setup(void)
{
  pinMode(4, OUTPUT); 
  digitalWrite(4,HIGH); 
  pinMode(5, OUTPUT); 
  pinMode(green, OUTPUT); 
  pinMode(red, OUTPUT); 
  pinMode(3, OUTPUT); 

  Serial.begin(57600);
  Serial.println("**************V1 Send Sensor Data***********");
  radio.begin();
  radio.setPALevel(RF24_PA_MAX);
  radio.setChannel(0x4c);

  // open pipe for writing
  radio.openWritingPipe(0xF0F0F0F0E1LL);

  radio.enableDynamicPayloads();
  radio.setAutoAck(false);
    radio.setDataRate(RF24_1MBPS);
  radio.powerUp();
  Serial.println("...Sending");

}

void loop(void)
{
  digitalWrite(5,HIGH); 
  delay(50);
  uint16_t sensorValue = analogRead(0);
  digitalWrite(5,LOW); 

  Serial.println(sensorValue);
  if (sensorValue > 600){
    digitalWrite(red,LOW );
    digitalWrite(green,HIGH);
  }
  if (sensorValue >= 0 && sensorValue <= 300){
    digitalWrite(red,HIGH);
    digitalWrite(green,LOW);
  }   

  //assign identification to the node.
  // In use = A & B;
  data[0] = 'B';
  //do the bit shift to put uint16 into uint8 array
  data[1] = sensorValue >> 8;
  data[2] = sensorValue;
  Serial.print(count);
  Serial.print("   |   Identity: ");
  Serial.print(data[0]);
  Serial.print("   |   ");
  Serial.print(" data[1]: ");
  Serial.print(data[1]);
  Serial.print("  |  data[2]: ");
  Serial.print(data[2]);
  digitalWrite(3,HIGH);
  // print and increment the counter
  radio.startWrite(data, sizeof(uint16_t)+1);
  Serial.print("  | Temperature sent:  ");
  Serial.println(sensorValue);
  digitalWrite(3,LOW);
  // pause 5 seconds
  delay(5000);
  resetFunc();  //call reset
}

Thank you so much!

2
  • 1
    Have you measured the Vin voltage when this happens? Feb 11 '15 at 13:44
  • Your solar system must not provide more voltage than the Arduino is designed for, and when the voltage falls too low the system must reset properly - usually by using a brownout detector function. Feb 11 '15 at 14:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.