So, I tried the above change in the code, but that didn’t exactly do the job. If you change “off” to “on” then each time pimatic is restarted the default state is on, but the output still toggles.
In fact this is what we wanted to get rid off.
Maybe any idea, @Icesory @sweetpi ?
-
Arduino Relays Board on/off on start or restart pimatic
-
I’ve added a
defaultState
option for homeduino (v0.8.60). However I don’t think we can get rid of the toggle, because the arduino gets resetted, when the serial connection is established (I don’t know if this resets the pin state). -
Okay, if the board is getting a reset on the beginning of the serial session, we probably can not get rid of the toggle. But why is the Atmel µController beeing resetted?
I was checking the ino- and coffee-file, but didn’t find something on that. Maybe we have a chance to find a workaround for this. -
You can disable the auto-reset by putting a resistor on the +5V and RST pin
http://playground.arduino.cc/Main/DisablingAutoResetOnSerialConnectionBut I don’t know if this works with the Nano.
There is also info on disabling it by software/code http://forum.arduino.cc/index.php/topic,28167.0.html
Use at own risk!
Follow my domotica project on http://maredana.nl
-
Oh, I see. So the FTDI chip is the one pulling the reset, I’ll give this a try and will post what I found out here.
-
@incmve hey man you’re a genius!!! works perfect in my mega!!! know I can sleep knowing that my door wont open in outage!!! thanks!!!
-
it only works if you do a hard reset of raspberry, if you do a restart from pimatic it doesnt work!!! any solutions???
-
A link to the video to show what is happening to me!!!
https://www.youtube.com/watch?v=Y89tBTNZWB0If someone could help it would be awsome.
-
hm… that’s really a bad behaviour.
just for information, what are you switching with these relais?
pimatic v0.9 has been released!
Support Pimatic and get some free stickers
Like us on Facebookmake it so !
-
@leader21 I will be switching mainly lights. this happens only when the “system” is restarted or powered, when I added a 120 ohm resistor between 5v and rst, it only happens when I restarted with the soft.
some help please??? -
@hp I don’t know if pimatic or homeduino sends a reset on boot.
it’s a long shot but maybe you can try this:
sudo stty -F /dev/ttyUSB0 -hupcl
HUPCL set to 0
Does not lower modem control lines (and DTR) when closing the port.
If this bit is set, a modem disconnect is generated when all processes that have the terminal device open have either closed the file or exitedNow I don’t know if this would cause a problem for something else so in order to enable it again
sudo stty -F /dev/ttyUSB0 hupcl
Follow my domotica project on http://maredana.nl
-
@incmve said:
HUPCL
it only work the first time, something as you said is sending the reset command before the serial conection, I dont mind if it only were lights controlled by the relays, but if a put a central heater o o door, or a motor, its a big problem…
-
What did not worked for me (perhaps it works one some restart):
“stty -F /dev/ttyUSB0 -hupcl”, even putting it on a boot task!
120 ohm between 5v and rstNOW: This is what I am testing right now: an 10uF capacitor, between RST and GND
ON:
A) FIRST RUN / INITIAL BOOT (Raspberry and Arduino MEGA): Wrong Behaviour, All Relays Switch ON, for 1-2 seconds, then they on the right STATE……
B ) SOFTWARE RESET: (Only Raspberry And/or Pimatic) NO PROBLEMS, ALL RELAYS STATE OK
C) HARD RESET (Only Raspberry): NO PROBLEMS, ALL RELAYS STATE OKPlease tell me if you know a complete solution, or what to do to **avoid A) **behaviour
-
@flybysun any clue??? have a look on my video, some posts before and read my last post, my problem “now” is that ON initial boot, all relays are set to ON for 1-2 seconds… did you manage to solve this?
-
@flybysun @Icesory @sweetpi @leader21
Continue researching to solve the problem I found that:
Most the relay boards input controls are Active LOW, so setting a pin LOW turns them ON.
So to assure that no relays activate at Reset or Power-On, the initialization sequence in SETUP should be:
digitalWrite(Relay, HIGH);
pinMode(Relay, OUTPUT);So I take the risk and made a small modification to Homeduino.coffee, and now is working better on Power-ON / Initial Boot.
When reseting obviously all relays are set momentanealy to OFF by the modification I made, but I prefer this to all setting in ON (like before)
@flybysun you where very close!
class HomeduinoSwitch extends env.devices.PowerSwitch ... ... ... hdPlugin.pendingConnect.then( => //I ADD THE FOLLOWING LINE BELOW @board.digitalWrite(Board.HIGH) @board.digitalWrite(Board.HIGH) return @board.pinMode(attributeConfig.pin, Board.INPUT) ) ... ... ...
Correct me if i mage something wrong! Thanks
-
Hi @hp
What do you meany by “working better”? Sounds like sometimes you still have the switching issue.
! FIRST RUN / INITIAL BOOT (Raspberry and Arduino MEGA): Wrong Behaviour, All Relays Switch ON, for 1-2 seconds, then they on the right STATE…
I’m not sure what the initial cpu pin state is during the boot sequence. Maybe they are tristate. In this case some pullup/pulldown resistors would be needed on those outputs. But if you power up the device you always come from a reset state. Did you try pullups on the io’s?
How do you do a hard reset only with the raspberry pi?
I’m a little bit short of time right now to test these things, but I will have a look at it again.
-
@flybysun look my last post!!! I think is the active LOW fact of the relays boards, with that piece of code I solve it.
(Hardreset I mean unplugging it)
-
@flybysun any clue on this??? have you solve it?
-
I have the same problem …
One can expect with this problem at all with a permanent solution … otherwise I would consider my hardware to changethank you