Arduino remote firmware upload with raspberry pi

This just clicked: what if I put a raspberry pi together with an arduino at a remote site? If I have dynamic IP service on the RPI or router, I can remotely log on to the RPI, upload new firmware to the arduino, and also possibly log debug information while I am away. I'm not too sure about command line firmware upload on linux, which is probably not too hard. I can find out once I have arduino in linux and enable verbose mode and then try a few times.

This pi may also serve as a means to reset arduino, if I find out how to trigger reset on command line. Any hint on how to send DTR signal?

I found this python script from themgames.net in case there is no more direct way with avrdude

#! /usr/bin/python

#    Serial Reader for ARDUINO
#    usefull when tail -f /dev/ttyXXXX doesn't work
#
#    Change ttyACM0 for your own tty interface

import serial
import time

# The second argument is the baudrate, change according to the baudrate you gave to your Serial.begin command
ser = serial.Serial("/dev/ttyACM0", 115200)

# To avoid communication failure due to bad timings
ser.setDTR(True);
time.sleep(1);
ser.setDTR(False)

http://www.themgames.net/arduino-from-the-command-line/

I am working on the same idea. Using promini, i have sorted the ground and reset with a transistor and using the GPIO on the py and a python script. Using "INO" to handle uploading to the arduino, I call "ino upload -m pro328". It keeps saying out of sync so I guess the timing isn't right. Doesn't work but if someone is trolling around for the same path..... well then.

import RPi.GPIO as GPIO
import time
import os

pReset = 20

# set up GPIO w/ BCM numbering
GPIO.setmode(GPIO.BCM)

#GPIO to use for arduino reset BCM GPIO 20
GPIO.setup(pReset, GPIO.OUT)

GPIO.output(pReset,True)

time.sleep(10)
GPIO.output(pReset,False)
os.system("ino upload -m pro328")
GPIO.cleanup()

liudr:
This just clicked: what if I put a raspberry pi together with an arduino at a remote site?

I thought that is what you were considering in your other Thread

Why the duplication?

...R

liudr:
This pi may also serve as a means to reset arduino, if I find out how to trigger reset on command line. Any hint on how to send DTR signal?

Assuming the Arduino is using the normal reset circuitry that just opening the serial port should reset it.

Riva:
Assuming the Arduino is using the normal reset circuitry that just opening the serial port should reset it.

I think this illustrates the unwisdom of starting a new Thread.

AFAIK the OP wants to be able to control the reset process so it only happens when he wants it to.

...R

Robin2:
I think this illustrates the unwisdom of starting a new Thread.

AFAIK the OP wants to be able to control the reset process so it only happens when he wants it to.

...R

You have lost me?
Opening the serial port (with hardware flow control enabled) will reset the Arduino so just open a serial port when needed to reset and/or re-program.

Riva:
You have lost me?
Opening the serial port (with hardware flow control enabled) will reset the Arduino so just open a serial port when needed to reset and/or re-program.

Read the OP's other Thread that I linked to in Reply #2

...R

I apologize for the duplicate. I posted this one in early November and was just using it to tell other members of my thoughts. It got lost, i.e. nobody replied ever. I went ahead and learned how to upload .hex files in command line and some basics of bash scripts. That was when I started realizing the arduino always resets if I open serial port. By that time this thought has been executed. I should have come back to this to post how I did it but I forgot.

The other thread continues on the reset issue and was posted much later, 2 months later to be exact. That one deals with how to NOT make arduino reset on port opening. I think I got a lot of good tips and possibly came up with one solution thqt would work for me.

Well, thanks for reading this. Could everyone leave this thread alone?