Go Down

Topic: serial interface with raspberry pi (python) (Read 2733 times) previous topic - next topic


Hi everyone,

i have an arduino MEGA which controls my aquariums light, pumps and also senses temperatures via 2x ds18b20... The sketch runs good but when I connect the mega via the USB to the raspberry pi in order to send email alerts, monitor and other userful, the mega reboots everytime the serial port is opened by the python script...

The script runs 24/7 and is monitored by a supervisor so  when the process dies off for some reason it starts back up again, but everytime this happens the arduino reboots... I tried putting a 110ohm resistor as stated in this link: http://playground.arduino.cc/Main/DisablingAutoResetOnSerialConnection
the resistor didnt work, I also tried disabling hangup on the linux terminal with no luck: stty -F /dev/usbTTY0 -hupcl

anyone know what else I can try?

Here is the open serial function from the python script:

Code: [Select]
port='/dev/ttyACM0' #port that arduino is plugged in to
global tank_temp, led_temp, blue, white #variables to monitor
global start
flag = False
start = 0

def Open_serial():
    global ser
    ser = serial.Serial(port,9600)

    global child
    fd = os.open(port, os.O_RDWR|os.O_NONBLOCK|os.O_NOCTTY)
    child = fdpexpect.fdspawn(fd) # Note integer fd is used instead of usual string.
    child.logfile_read = sys.stdout
    child.logfile_send = sys.stdout


I added a 1uF cap to the reset-gnd pins, it hasnt rebooted since... hopefully it stays that way


it's working... the 110 resistors didnt work, or the hangup on close disabling... but the cap worked like a charm! Hope this helps someone else!


Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Go Up