Arduino serial reset

A project log for R'lieh - Aquarium/ closed ecosystem management

An automated and connected aquarium management system

Audrey RobinelAudrey Robinel 05/22/2015 at 17:500 Comments

I encountered something that caused me trouble today. I set up the system for real world use, but each time i was sending a command to the arduino, i was having the relays turning of prior to everything.

Here is a quick test code :

from time import sleep
import serial

print("opening serial")

ser = serial.Serial("/dev/ttyUSB0", 9600)

print ("waiting")
print("sending cmd")
This one turns off the relays, and there is another file for turning them on.

The problem was that on connect, all relays shut down. I figured out that when a serial connection is established to the arduino, it resets. Hence the shutdown of the relays. in order to handle that, the solution is to put a capacitor between the vcc line and the reset pin :,28723.0.html

I don't yet know the minimal value that can be used, but it works with 220µF.

Thanks to this, i was able to have the commands working without resetting anything. I thus don't have to have a daemon connected to the arduino handling requests from other programs.