Page 31 of 34

ARDUINO plugin discussion

PostPosted: Thu Dec 29, 2016 1:15 am
by kw123
It means that the arduino/esp does not answer
And there are 2 tests.

It will then try again and should put it back into online status when it answers

The ESPs sometimes reboot themselves and might not answer.



Sent from my iPhone using Tapatalk

Re: ARDUINO plugin discussion

PostPosted: Tue Jan 10, 2017 4:23 am
by Hank.wheeler
I am considering setting up some Arduino sensors ... I am interested to know when using this Plug-In is there any delay from triggering of the Arduino sensor to when Indigo detects the state change?

Re: ARDUINO plugin discussion

PostPosted: Tue Jan 10, 2017 7:35 am
by kw123
the plugin is polling the arduino every xx seconds.
you can set the polling interval in the arduino device edit in the plugin (you create a device with type arduino, set ip # etc and set polling interval). The shortest interval is 1 second.


Karl

Re: ARDUINO plugin discussion

PostPosted: Sat Feb 25, 2017 12:03 pm
by bkmar1192
Trying to use a NodeMCU to control a motor (blind controller project). I am very new to Arduino so probably just have something setup incorrectly but I am hoping someone can help.

Below is how I have everything wired. However, when I plug the motor into Pin5 it continually runs regardless of the state the pin is in. When I plug into pin 4 it is always off regardless of the state. When I turn the pins on/off I seem to get valid responses (example of pin 5)

Action Group test arduino off
arduino action= wr:D5=0&
arduino returned= {'Status': 'Online, Configured', 'D5': {'cmd': 'ONoff', 'values': '0'}}
Action Group test arduino on
arduino action= wr:D5=1&
arduino returned= {'Status': 'Online, Configured', 'D5': {'cmd': 'ONoff', 'values': '1'}}

Any help would be really appreciated.

ARDUINO plugin discussion

PostPosted: Sun Feb 26, 2017 2:25 am
by kw123
You need to check if the gpio is available. Some of them have special functions.
Try #12 13 14.



Sent from my iPhone using Tapatalk

Re: ARDUINO plugin discussion

PostPosted: Sun Feb 26, 2017 2:48 am
by kw123
Also the nodemcu and e.g. Adafruit devices have different mappings of the gpios I believe.


Sent from my iPhone using Tapatalk

Re: ARDUINO plugin discussion

PostPosted: Sun Feb 26, 2017 10:14 am
by bkmar1192
So if I understand this correctly - based on the following chart:

https://nodemcu.readthedocs.io/en/maste ... ules/gpio/

I would use the 1 on/off parameter in the plugin to control pin 5 on the NodeMCU.


Sent from my iPhone using Tapatalk

Re: ARDUINO plugin discussion

PostPosted: Sun Feb 26, 2017 10:29 am
by kw123
I am not home and can't look at the docu -- only have my phone.

try some gpio numbers. And check which one works. I have been using mostly adafruit huzzah and i recall 12-13-14-15 worked. And again the modem have different mappings.
Check out the adafruit web pages.



Sent from my iPhone using Tapatalk

Re: ARDUINO plugin discussion

PostPosted: Sat Apr 01, 2017 8:59 pm
by exos
Is there any way you could add the code to allow for reconnections? As it is now, anytime WIFI is interrupted, the arduino will not automatically attempt to reconnect so i need to manually climb into the corner of my closet and unplug/replug in the arduino to go through the initial boot sequence. I attempted to at some code in the main void loop() method but it didn't seem to do the trick.

Re: ARDUINO plugin discussion

PostPosted: Sat Apr 01, 2017 9:58 pm
by kw123
I believe the arduino can not do this. But the ESP might be able to do this

But that is why I switched to rpi. They reconnect through software resets that can be programmed .. the pibeacon does that.


Sent from my iPhone using Tapatalk

Re: ARDUINO plugin discussion

PostPosted: Sat Apr 01, 2017 10:31 pm
by kw123
actually there is a software reset:
Code: Select all
asm volatile ("  jmp 0");


one could do (pseudo code):
1. lastWifi = currentTime in start

2. in loop:
every time the arduino gets a wifi connection : lastWifi = currentTime
if (lastWifi - currentTime )> 3 minutes{asm volatile (" jmp 0");}

that should do it.

If you like I can add it to the INO code and you can try it out .

Karl
minor problem: the arduino timer resets ~ every 2**32 milliseconds back to 0(~ 50 days) , then the number gets wrong and the arduino would reboot ...

Re: ARDUINO plugin discussion

PostPosted: Sun Apr 02, 2017 12:32 pm
by kw123
exes,

added the soft reset (v 1-11-6 INO file) ,, if you could try it out ..

there are 3 section I added they are all
#if defined(softReset)
..
#endif

you can just copy these 3 sections into your exiting code at the right places and it SHOULD work ..

Karl

not tested !!!

Re: ARDUINO plugin discussion

PostPosted: Tue Jul 18, 2017 9:31 pm
by dawson1331
Hi Karl,

I love the Arduino plugin. I have 5 successful Arduino implementations! Thanks.

I am running up against a small problem. I am trying to send a particular string from the plugin to the Arduino in a particular way and it does not go through.

I am using only S0 and S1, in this example, both set to OUTPUTS in the plugin configure menu. I am using the python 'setPins' and 'sendPins' functions. See example program. If the string that I am sending has the characters "not" anywhere in it, then the plugin does not send that command to the Arduino. This test case sends the string "ready" to S0 and the string "notready" to S1. The "ready" is transmitted. The "notready" is not transmitted. I think the plugin code is looking for the string "not" (for the other commands) and then rejecting it. Maybe I am doing something wrong but I can not find it. I am using an Arduino Mega with a wired ethernet shield. Thanks again for a great plugin.

Bill

Code: Select all
#!/usr/bin/env python

#    IndigoTestNOT.py

import indigo

k_myArduino = "1127449616"

def sendDataToArduino(s0, s1):
    plug = indigo.server.getPlugin("com.karlwachs.arduino")
    plug.executeAction("setPins", props ={"CMD":"analogWrite", "Pin" :"S0", "aValue": s0, "sendORset":"setOnly", "device": k_myArduino})
    plug.executeAction("setPins", props ={"CMD":"analogWrite", "Pin" :"S1", "aValue": s1, "sendORset":"setOnly", "device": k_myArduino})
    plug.executeAction("sendPins",props ={"device" : k_myArduino, "pinsToBeSend": "s0,s1"})


def testNOT():
    sendDataToArduino("ready", "notready")


Re: ARDUINO plugin discussion

PostPosted: Tue Jul 18, 2017 9:35 pm
by kw123
Will check tomorrow


Sent from my iPhone using Tapatalk

Re: ARDUINO plugin discussion

PostPosted: Tue Aug 22, 2017 10:15 pm
by mcfarlde
Hello,

I'm brand new to Indigo Domo. Will the Arduino plugin work with Sonoff 4CH and 4CH Pro flashed to Tasmota 5.6.1?

Thanks in advance,

Derek