Uploading the software problem

Hi Guys,

Please help me how to upload the the software to Arduino UNO, because if the USB cable attached to my PC the program is working but when I use external power supply the software is no responding.

Thanks.

OK please post your code here but "ensure you use code tags"

If your sketch includes serial command there is a chance that may be the cause but until you give a little more info its hard to tell.

How did you connect the external power supply? Barrel, Vin, 5V? Specs of the external power supply?

What else is connected to the board?

Ballscrewbob:
OK please post your code here but "ensure you use code tags"

If your sketch includes serial command there is a chance that may be the cause but until you give a little more info its hard to tell.

Hi Sir,

Im beginner and i dont have idea of programming. I'm using Arduino Uno and arduino GSM shield, I copy the source code of Mr. UMESH DUTTA. Thank you.

Code:

CODE

#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins

LiquidCrystal lcd(12, 11, 7, 6, 5, 4);

//temporary variable to store the contents of the received sms

char temp[50];
int m;
int inByte =0;
void setup()
{
// initialize serial communication with baud rate of 9600 bps
Serial.begin(9600);
// wait for a while till the serial port is ready
delay(100);
// configure the gsm modemin sms mode
Serial.print("AT+CMGF=1\r");
delay(500);
// route the contents of the received sms on to serial port
Serial.print("AT+CNMI=2,2,0,0,0\r");
// initialize 20X4 the lcd
lcd.begin(20, 4);
//print inittial message on lcd
lcd.print("Device Control..");
//define pins 2 ad 3 as o/p pins
pinMode(2,OUTPUT);
pinMode(3,OUTPUT);
// make default status of pin 2 and 3 low
digitalWrite(2,LOW);
digitalWrite(3,LOW);
delay(500);
}
// loop function starts here
void loop()
{
// clear the temporary variable temp
m=0;
for(m=0;m<45;m++)
{
temp[m]=0;
}
// wait for the reception of the message
// " is a identifier for the start of the message
do
{
while ( !Serial.available() );
} while ( '"' != Serial.read() );

// read the sms which will have date, time, sms body and the senders number
for(m=0;m<45;m++)
{
while ( !Serial.available() );
inByte = Serial.read();
temp[m]=inByte;
}

// set the cursor position of the lcd
lcd.setCursor(0,1);

// after testing it is found that the main body of the sms willl start from psition 42 ie. for m=42
// I have used 3 digit code for the sms and so position 42, 43 and 44 will contain the main body of the sms
// print the received sms main body on the lcd screen

for(m=42;m<45;m++)
{
lcd.print(temp[m]);
}

//now write different conditions and required actions

/*codes are
D1N----------device 1 on
D1F----------device 1 off
D2N----------device 2 on
D2F----------device 2 off
DAN----------all devices on
DAF----------all devices off
*/
// device 1 is connected to pin 2 and device 2 is connected to pin 3 of the arduino

if(temp[42]=='D' && temp[43]=='1' && temp[44]=='N')
{
digitalWrite(2,HIGH);
lcd.setCursor(0,2);
lcd.print("device 1 on");
}

if(temp[42]=='D' && temp[43]=='1' && temp[44]=='F')
{
digitalWrite(2,LOW);
lcd.setCursor(0,2);
lcd.print("device 1 off");
}

if(temp[42]=='D' && temp[43]=='2' && temp[44]=='N')
{
digitalWrite(3,HIGH);
lcd.setCursor(0,2);
lcd.print("device 2 on");
}

if(temp[42]=='D' && temp[43]=='2' && temp[44]=='F')
{
digitalWrite(3,LOW);
lcd.setCursor(0,2);
lcd.print("device 2 off");
}

if(temp[42]=='D' && temp[43]=='A' && temp[44]=='N')
{
digitalWrite(2,HIGH);
digitalWrite(3,HIGH);
lcd.setCursor(0,2);
lcd.print("all devices on");
}

if(temp[42]=='D' && temp[43]=='A' && temp[44]=='F')
{
digitalWrite(2,LOW);
digitalWrite(3,LOW);
lcd.setCursor(0,2);
lcd.print("all devices off");
}
delay(1500); // give some delay before the next cycle starts
lcd.clear(); // clear the lcd screen
lcd.print("Device Control..");// print this message on lcd
}

sterretje:
How did you connect the external power supply? Barrel, Vin, 5V? Specs of the external power supply?

What else is connected to the board?

Hi Sir,

I connect the arduino to my battery bank 5v 1amp and the gsm shield is connected to 5v power supply 1amps.
I think the program only the main issue,I upload the program using Arduino ISP. I don't have good idea because im new in this type of project. My board is arduino uno and arduino gsm shield. Thank you.

Original sorce code of Mr. UMESH DUTTA

CODE:

#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins

LiquidCrystal lcd(12, 11, 7, 6, 5, 4);

//temporary variable to store the contents of the received sms

char temp[50];
int m;
int inByte =0;
void setup()
{
// initialize serial communication with baud rate of 9600 bps
Serial.begin(9600);
// wait for a while till the serial port is ready
delay(100);
// configure the gsm modemin sms mode
Serial.print("AT+CMGF=1\r");
delay(500);
// route the contents of the received sms on to serial port
Serial.print("AT+CNMI=2,2,0,0,0\r");
// initialize 20X4 the lcd
lcd.begin(20, 4);
//print inittial message on lcd
lcd.print("Device Control..");
//define pins 2 ad 3 as o/p pins
pinMode(2,OUTPUT);
pinMode(3,OUTPUT);
// make default status of pin 2 and 3 low
digitalWrite(2,LOW);
digitalWrite(3,LOW);
delay(500);
}
// loop function starts here
void loop()
{
// clear the temporary variable temp
m=0;
for(m=0;m<45;m++)
{
temp[m]=0;
}
// wait for the reception of the message
// " is a identifier for the start of the message
do
{
while ( !Serial.available() );
} while ( '"' != Serial.read() );

// read the sms which will have date, time, sms body and the senders number
for(m=0;m<45;m++)
{
while ( !Serial.available() );
inByte = Serial.read();
temp[m]=inByte;
}

// set the cursor position of the lcd
lcd.setCursor(0,1);

// after testing it is found that the main body of the sms willl start from psition 42 ie. for m=42
// I have used 3 digit code for the sms and so position 42, 43 and 44 will contain the main body of the sms
// print the received sms main body on the lcd screen

for(m=42;m<45;m++)
{
lcd.print(temp[m]);
}

//now write different conditions and required actions

/*codes are
D1N----------device 1 on
D1F----------device 1 off
D2N----------device 2 on
D2F----------device 2 off
DAN----------all devices on
DAF----------all devices off
*/
// device 1 is connected to pin 2 and device 2 is connected to pin 3 of the arduino

if(temp[42]=='D' && temp[43]=='1' && temp[44]=='N')
{
digitalWrite(2,HIGH);
lcd.setCursor(0,2);
lcd.print("device 1 on");
}

if(temp[42]=='D' && temp[43]=='1' && temp[44]=='F')
{
digitalWrite(2,LOW);
lcd.setCursor(0,2);
lcd.print("device 1 off");
}

if(temp[42]=='D' && temp[43]=='2' && temp[44]=='N')
{
digitalWrite(3,HIGH);
lcd.setCursor(0,2);
lcd.print("device 2 on");
}

if(temp[42]=='D' && temp[43]=='2' && temp[44]=='F')
{
digitalWrite(3,LOW);
lcd.setCursor(0,2);
lcd.print("device 2 off");
}

if(temp[42]=='D' && temp[43]=='A' && temp[44]=='N')
{
digitalWrite(2,HIGH);
digitalWrite(3,HIGH);
lcd.setCursor(0,2);
lcd.print("all devices on");
}

if(temp[42]=='D' && temp[43]=='A' && temp[44]=='F')
{
digitalWrite(2,LOW);
digitalWrite(3,LOW);
lcd.setCursor(0,2);
lcd.print("all devices off");
}
delay(1500); // give some delay before the next cycle starts
lcd.clear(); // clear the lcd screen
lcd.print("Device Control..");// print this message on lcd
}

Please answer sterretje's questions.

No need to us the "quote" option use the "reply" button.

Oh and PLEASE PLEASe PLEASE PRETTY PLEASE learn to use code tags They are right there on the top left of the box you type in. (</>)