Programming Arduino in Raspberry Pi

Hello,
I have a Raspberry Pi connected to the home wifi, and an Arduino nano connected to Raspberry by usb, to collect data from weather sensors. I connect to Raspberry by remote access VNC.

I have installed the Arduino IDE in Raspberry. I was able to upload a short sketch and run on Arduino and see the output by console; but when I try to upload a longer sketch, I get an error:

avrdude: stk500_recv(): programmer is not responding

After this happens, I can not load the short sketch either.

I appreciate any help.

Does that happen if the short program is the Blink example?

What happens if the big program is the first one you try after restarting the RPi and the Arduino?

Have you checked that you are using the correct serial port for uploading to the Nano - maybe it changes?

...R

curro92:
... but when I try to upload a longer sketch, I get an error ...

Hi,
How much longer is the long one?
Have you tried a "medium sized" one?
Regards.

That sounds like it’s losing the USB port.
This seems a hard way to do things - why not just program the Arduino from a PC of Mac ?

Hello,
thanks to all. I'll start with the last one:

hammy:
That sounds like it’s losing the USB port.
This seems a hard way to do things - why not just program the Arduino from a PC of Mac ?

I have the Arduino and the Raspberry in a watertight boxes on a mast where the anemometer, the wind vane and the rain gauge are located. Raspberry is connected to the wifi of the house. And I connect to Raspberry by VNC remote access. It is very comfortable, I have the Raspberry desktop on the screen of my Linux PC. To program on my PC I would have to disconnect the connections, remove from the box, reassemble ...

I will try the other options that suggest me in the answers.

My program is this, and I'm copying it over and over again.

Serial.println("on!!");
delay 1000);
Serial.println("off...");
delay(1000);

A) In a series of tests:

Done uploading.
Binary sketch size: 2,150 bytes (of a 30,720 byte maximum)

Done uploading.
Binary sketch size: 2,198 bytes (of a 30,720 byte maximum)

Binary sketch size: 2,294 bytes (of a 30,720 byte maximum)
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_cmd(): programmer is out of sync
avr_read(): error reading address 0x0000
read operation not supported for memory "flash"
avrdude: failed to read all of flash memory, rc=-2
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x9ev

B) In another series of tests:
Done uploading.
Binary sketch size: 2,150 bytes (of a 30,720 byte maximum)

Done uploading.
Binary sketch size: 2,198 bytes (of a 30,720 byte maximum)

Done uploading.
Binary sketch size: 2,294 bytes (of a 30,720 byte maximum)

Done uploading.
Binary sketch size: 2,486 bytes (of a 30,720 byte maximum

Binary sketch size: 2,870 bytes (of a 30,720 byte maximum)
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_cmd(): programmer is out of sync
avr_read(): error reading address 0x0000
read operation not supported for memory "flash"
avrdude: failed to read all of flash memory, rc=-2
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x6e

I do not see an exact limit, it's quite random.

curro92:
My program is this, and I'm copying it over and over again.

Serial.println("on!!");
delay 1000);
Serial.println("off...");
delay(1000);

Hi,
I work everyday with arduino and Raspberry: although I do not use daily the Ri to program arduino (I used it long time ago) your program is so small (by the way: an opening parenthesis is missing; sure this is not the problem) that it shouldn't pose any problem to be compiled and uploaded.
I'd try to do it by using a PC (just to make sure it works); then, I'd download the arduino IDE again (to Linux). Perhaps you are using the on line version; I've never used it, so I cannot give you any advice if this is the case. I am a native skeptical, so I'd rather prefer using local software ...
Regards

curro92:
A) In a series of tests:

Done uploading.
Binary sketch size: 2,150 bytes (of a 30,720 byte maximum)

Done uploading.
Binary sketch size: 2,198 bytes (of a 30,720 byte maximum)

Binary sketch size: 2,294 bytes (of a 30,720 byte maximum)

There is something strange going on. If you are uploading the exact same program why is the "Binary sketch size" increasing in multiples of 48 bytes?

Get all this working on your work bench before you put anything in a sealed box.

...R

Thanks, I will try again on my Mint 18 PC