ARDUINO plugin discussion

Posted on
Thu Dec 29, 2016 1:15 am
kw123 offline
User avatar
Posts: 7038
Joined: May 12, 2013
Location: Dallas, TX

ARDUINO plugin discussion

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

Posted on
Tue Jan 10, 2017 4:23 am
Hank.wheeler offline
Posts: 34
Joined: Nov 24, 2015

Re: ARDUINO plugin discussion

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?

Posted on
Tue Jan 10, 2017 7:35 am
kw123 offline
User avatar
Posts: 7038
Joined: May 12, 2013
Location: Dallas, TX

Re: ARDUINO plugin discussion

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

Posted on
Sat Feb 25, 2017 12:03 pm
bkmar1192 offline
Posts: 274
Joined: Sep 12, 2015

Re: ARDUINO plugin discussion

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.
Attachments
IMG_0147 2.JPG
IMG_0147 2.JPG (93.65 KiB) Viewed 2294 times

Posted on
Sun Feb 26, 2017 2:25 am
kw123 offline
User avatar
Posts: 7038
Joined: May 12, 2013
Location: Dallas, TX

ARDUINO plugin discussion

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

Posted on
Sun Feb 26, 2017 2:48 am
kw123 offline
User avatar
Posts: 7038
Joined: May 12, 2013
Location: Dallas, TX

Re: ARDUINO plugin discussion

Also the nodemcu and e.g. Adafruit devices have different mappings of the gpios I believe.


Sent from my iPhone using Tapatalk

Posted on
Sun Feb 26, 2017 10:14 am
bkmar1192 offline
Posts: 274
Joined: Sep 12, 2015

Re: ARDUINO plugin discussion

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

Posted on
Sun Feb 26, 2017 10:29 am
kw123 offline
User avatar
Posts: 7038
Joined: May 12, 2013
Location: Dallas, TX

Re: ARDUINO plugin discussion

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

Posted on
Sat Apr 01, 2017 8:59 pm
exos offline
Posts: 57
Joined: Feb 02, 2016

Re: ARDUINO plugin discussion

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.

Posted on
Sat Apr 01, 2017 9:58 pm
kw123 offline
User avatar
Posts: 7038
Joined: May 12, 2013
Location: Dallas, TX

Re: ARDUINO plugin discussion

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

Posted on
Sat Apr 01, 2017 10:31 pm
kw123 offline
User avatar
Posts: 7038
Joined: May 12, 2013
Location: Dallas, TX

Re: ARDUINO plugin discussion

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 ...

Posted on
Sun Apr 02, 2017 12:32 pm
kw123 offline
User avatar
Posts: 7038
Joined: May 12, 2013
Location: Dallas, TX

Re: ARDUINO plugin discussion

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 !!!

Posted on
Tue Jul 18, 2017 9:31 pm
dawson1331 offline
Posts: 14
Joined: Oct 22, 2012

Re: ARDUINO plugin discussion

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")


Posted on
Tue Jul 18, 2017 9:35 pm
kw123 offline
User avatar
Posts: 7038
Joined: May 12, 2013
Location: Dallas, TX

Re: ARDUINO plugin discussion

Will check tomorrow


Sent from my iPhone using Tapatalk

Posted on
Tue Aug 22, 2017 10:15 pm
mcfarlde offline
Posts: 3
Joined: Nov 12, 2016

Re: ARDUINO plugin discussion

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

Who is online

Users browsing this forum: No registered users and 0 guests