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:
port='/dev/ttyACM0' #port that arduino is plugged in to
global tank_temp, led_temp, blue, white #variables to monitor
flag = False
start = 0
ser = serial.Serial(port,9600)
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