ARDUINO DOWNLOAD

Posted on
Fri May 08, 2015 11:16 pm
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

ARDUINO DOWNLOAD

===> new version from now on in the plugin store <======

new version 7.9.9 published on indigo store: https://www.indigodomo.com/pluginstore/74/





older versions===============
https://www.dropbox.com/s/fbqf03188732uno/arduino-v-7-9-8.zip?dl=1

https://www.dropbox.com/s/vu0l0x1vazprl48/indigo.ino-v-1-10-5.zip?dl=1
https://www.dropbox.com/s/5hvdh6r5zovaysd/indigo.ino-v-1-11-6.zip?dl=1 added soft reset for no wifi contact for 5 minutes

Version 7.9.8 and sketch version 1.10.5

Purpose: Integrate Arduino boards into Indigo via WiFi or Ethernet. It can set Pins and read Pin Values, make them available as indigo device states


What can it do:
1. read/write/ count input changes any enabled INPUT /OUTPUT analog or digital pin on an arduino UNO / mega with ethernet / wifi and ESP modules like ADAfruit HUZZAH or sparkfun thing
2. program pins:
== to be INPUT or OUTPUT or count 0to1 count 1to0 with/whithout INPUT_PULLUP internal resistor enabled or OFF
3. set output pins (GPIO) to
== HIGH/LOW
== analog write value 0..255 (0...1023 for ESP)
== ramp output up/down from a to b in x milliseconds( a..b: 0...1023 for ESP, 0..255 for arduino);
== ramp output up/down from a to b in x milliseconds continuously ( a..b: 0...1023 for ESP, 0..255 for arduino)
== send a(single) moment pulse up or down for xx milliseconds = switch output on / off for x miliseconds
== make output continuously go high/low for xx milliseconds up and yy milliseconds down
4. the states in the device listing will reflect the values of the enabled read pins and commands send to the output pins
5. An action in an action group (arduino Action / SetPin Value or Set Pin Mode) can do anything under # 2 & #3
6. through python calls (see below) set/program the pins (essentially the same thing as #5)
7. In Indigo/Plugin/Arduino/Menu you can set Pin Modes or Pin Values or functions (same as #6)
8. included in the INO file are examples for DHT and DS18B20 temp / humidity sensors
9. the plugin supports ESP 1/16/arduino uno/megae with wifi or Ethernet and a FREEdevice that has no limits/ constraints. with 50 D; 16 A and 20 S pins

In addition to the Analog and Digital pins the plugin supports "virtual Pins" (S0..S19). The are just text Strings that can be send to the arduino or send by the arduino.
You can use them as commands parameters in your own Sketch when you like to modify the sketch in this package.
See doMyStuff() in the attached sketches for some examples

Once setup you can then can set e.g. triggers on the device states like for any other device / state

The plugin will detect if the Arduino has been rebooted and needs to be newly configured and will execute the commands to do that.

sainsmart relay boards
the plugin now supports sainsmart relay boards 1...8 relays.https://www.sainsmart.com/products/rj45-ethernet-control-board-for-8-16-ch-relays
no specific config in the plugin is required, but the board needs to be setup with proper IP and port number at @http://192.168.1.4/30000/41
then enter the IP and port number into the device edit.
After that you can use the sainsmart device as a relay output device in indigo.




Setup Steps:
0.You must download the arduino.ino sketch attached in the zip file to your UNO/MEGA+ethernet/WIFI or ESP board . .. and set the proper IP number (and MAC# for ethernet) and or Wifi SSID/password in the sketch
1. setup one device per arduino/ESP in indigo
2. for each device you can/must define in the device edit menu
- ip number of device
- time between reads of arduino
- which analog pins should be read (on/off)
- which digital pins should be INPUT/OUTPUT/INPUT_PULLUP /OFF

After that the plugin will do an http to the ardino and update the proper states in the device depending on the schedule you set in the device config

here examples of the available Actions in python from action groups or any other plugin or python script. They can also be selected in the action menu manually
Code: Select all
## first get plugin
plug = indigo.server.getPlugin("com.karlwachs.arduino")
if not plug.isEnabled(): return   #### ARDUINO must be enabled, otherwise nothing here works

## execute actions to set pins / read pins etc.
## after each action a variable in ArduinoLastMessage folder gets updated with the reply / success from arduino
plug.executeAction("setPins" ,  ### send ON to D4 pin
   props ={
    "CMD":"ONoff"
   ,"Pin" :"D4"
   ,"lowHIGH":"1"  ## use "0" for OFF
   ,"device": "162205879"}  # indigo deviceId# or device name
   )
plug.executeAction("setPins" ,  ### ramp pin D4 up and down
   props ={
    "CMD":"rampUPDown"
   ,"Pin" :"D4"
   ,"msecUP":"1000"  ## 1 sec up
   ,"msecDOWN":"3500"  ## 3.5 sec down
   ,"minValue":"10"  ## from PWM value =10
   ,"maxValue":"200"  ## to PWM value=200 (max =255 with arduino, 1023 with ESP)
   ,"device": "arduino15"}  # indigo deviceId# or device name
   )
plug.executeAction("setPins" ,  ### ramp pin D4 up 
   props ={
    "CMD":"rampUp"
   ,"Pin" :"D4"
   ,"msecUP":"1000"  ## 1 sec up
   ,"minValue":"10"  ## from PWM value =10
   ,"maxValue":"200"  ## to PWM value=200 (max =255 with arduino, 1023 with ESP)
   ,"device": "arduino15"}  # indigo deviceId# or device name
   )
plug.executeAction("setPins" ,  ### ramp pin D4 down 
   props ={
    "CMD":"rampDown"
   ,"Pin" :"D4"
   ,"msecDOWN":"1000"  ## 1 sec down
   ,"minValue":"0"  ## to PWM value =0
   ,"maxValue":"200"  ## fromPWM value=200 (max =255 with arduino, 1023 with ESP)
   ,"device": "arduino15"}  # indigo deviceId# or device name
   )
plug.executeAction("setPins" ,  ###pulses up and down, digital write
   props ={
    "CMD":"pulseUp"
   ,"Pin" :"D4"
   ,"msecUP":"1000"  ## 1 sec up
   ,"msecDOWN":"1000"  ## 1 sec down
   ,"device": "arduino15"}  # indigo deviceId# or device name
   )
plug.executeAction("setPins" ,  ###pulses down and up , digital write
   props ={
    "CMD":"pulseUp"
   ,"Pin" :"D4"    
   ,"msecUP":"1000"  ## 1 sec up
   ,"msecDOWN":"1000"  ## 1 sec down
   ,"device": "arduino15"}  # indigo deviceId# or device name
   )
plug.executeAction("setPins" ,  ###pulses down and up , analog write
   props ={
    "CMD":"analogWrite"
   ,"Pin" :"D4"    
   ,"aValue":"100"  # write a 100 to D4 PWM
   ,"device": "arduino15"}  # indigo deviceId# or device name
   )
plug.executeAction("setPins" ,  ###on pulse up (moment)
   props ={
    "CMD":"momentUp"
   ,"Pin" :"D4"    
   ,"msecUP":"1000"  ## 1 sec up
   ,"device": "arduino15"}  # indigo deviceId# or device name
   )
plug.executeAction("setPins" ,  ###on pulse down (moment)
   props ={
    "CMD":"momentDown"
   ,"Pin" :"D4"    
   ,"msecDOWN":"1000"  ## 1 sec up
   ,"device": "arduino15"}  # indigo deviceId# or device name
   )
plug.executeAction("setPins" ,  ## reset count of pin D4
   props ={
    "CMD":"CountReset"
   ,"Pin" :"D4"    
   ,"device": "arduino15"}  # indigo deviceId# or device name
   )
plug.executeAction("setPins" ,  ## read value of D4
   props ={
    "CMD":"read"
   ,"Pin" :"D4"    
   ,"device": "arduino15"}  # indigo deviceId# or device name
   )
plug.executeAction("setPins" ,  ## read value of a0
   props ={
    "CMD":"read"
   ,"Pin" :"A4"    
   ,"device": "arduino15"}  # indigo deviceId# or device name
   )

### set 2 S pins at once: first set each with "setOnly" option, then do "sendPins" for S1,s0
plug.executeAction("setPins",
   props={
   "device" :"1780896723" # or device name
   ,"pin": "s0"  #
   ,"CMD": "analogWrite"
   ,"aValue":"123"
   ,"sendORset":"setOnly"
   }
)
plug.executeAction("setPins",
   props={
   "device" :"1780896723" # or device name
   ,"pin": "S1"  #
   ,"CMD": "analogWrite"
   ,"aValue":"987"
   ,"sendORset":"setOnly"
   }
)
plug.executeAction("sendPins",
   props={
   "device" :"megawifi" # or device id
   ,"pinsToBeSend": "s0,s1"  #
   }
)



Karl
some screen shots:

1. Indigo home menu with one Arduino device (an ESP)
Screen Shot 2015-08-29 at 10.47.36 PM.png
Screen Shot 2015-08-29 at 10.47.36 PM.png (62.97 KiB) Viewed 19435 times

2. Indigo device edit menu
Screen Shot 2015-08-29 at 10.48.51 PM.png
Screen Shot 2015-08-29 at 10.48.51 PM.png (165.66 KiB) Viewed 19435 times

3.Indigo menu:
Screen Shot 2015-08-29 at 10.52.34 PM.png
Screen Shot 2015-08-29 at 10.52.34 PM.png (53.8 KiB) Viewed 19435 times

set Pins Values or Functions
Screen Shot 2015-08-29 at 10.51.14 PM.png
Screen Shot 2015-08-29 at 10.51.14 PM.png (29.41 KiB) Viewed 19435 times



old versions:
https://www.dropbox.com/s/fggk95nkax2omy1/arduino-v-7-8-7.zip?dl=1
https://www.dropbox.com/s/6lzekuz8aq56ws7/arduino-v-2-8-6.zip?dl=1
https://www.dropbox.com/s/tst9f446jti9yqp/arduino-v-2-8-3.zip?dl=1
https://www.dropbox.com/s/u3ybicflyf9qxc0/indigo.ino-v-1-10-4.zip?dl=1
https://www.dropbox.com/s/rav1k0hwqcef5r8/indigo.ino-v-1-10-3.zip?dl=1
https://www.dropbox.com/s/ckawd05z0uitvbe/indigo.ino-v-1-10-2.zip?dl=1
https://www.dropbox.com/s/domtlc32be8yc9a/arduino-v-2-8-2.zip?dl=0
https://www.dropbox.com/s/0ce31eztfo14pzo/indigo.ino-v1.10.1.zip?dl=1
https://www.dropbox.com/s/mm5ms63ed7n9sys/indigo.ino-v-1-9-2.zip?dl=1
https://www.dropbox.com/s/pmquegxsuv20mdx/indigo.ino-v-1-8.2.zip?dl=1
https://www.dropbox.com/s/x1ka749or2sk7tc/indigo.ino-v-1.7.1.zip?dl=1
https://www.dropbox.com/s/gu989g4i1qk14tw/arduino-v-2-6-1.zip?dl=1
https://www.dropbox.com/s/za40frsgxatmmqr/arduino-v-2-4-1.zip?dl=1
https://www.dropbox.com/s/saxut9b0ofpcovi/indigo.ino.zip?dl=1
https://www.dropbox.com/s/9pot8uja0hvk83g/arduino-v-2-5-1.zip?dl=1
https://www.dropbox.com/s/zfxokdozkjf06ek/indigo.ino-v-1-7-1.zip?dl=1

Posted on
Wed Aug 26, 2015 11:45 am
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: ARDUINO DOWNLOAD

The Skecth/ plugin supports the ESP 8622. It was tested with adafruit Huzzah ==> select device = ESP16
with 8 + active GPIO pins ( 0* /2/4/5/12/13/14/15/16) with 3.3 volt logic and one analog in (A0) pin ( 0-1Volt max!!!)

It should also support the small version with 8 pins. use model = ESP1 (with one active pin GPIO-2)

== there are other version of the chip on the market i.e. spark fun, nodeMCU. They should work too. The challenge you have is to get the sketch onto the board.
The rest should be identical.
- nodeMCU the MCU requires a download of a different USB driver
- the spark fun does not have the reset buttons installed.
====>> and be aware these boards are 3.3 volt not 5volt. Some come with voltage regulators other not, some have level shifters others not...

The work is in the attached ARDUINO sketch.

here the steps you need to do:
1. open arduino environment
2. load the adafruit ESP library see https://learn.adafruit.com/adafruit-huzzah-esp8266-breakout/using-arduino-ide
3. use the attached sketch (ESP.ino) in the zip file
4. edit the sketch i.e. put your Wifi ssid and password info in.
5. attach the ESP, make sure you have the proper USB selected and hold down the GPIO0 and click reset button
6. upload sketch
7. click command/shift/m to open com port and note the ip-number assigned by your router
8. in arduino plugin add a new arduino device and put in the IP number in. Enabled / disable the pins you like.
Be careful with GPIO 0. this is used to reset the board if pulled down. So you could use it as output device BUT NEVER AS INPUT DEVICE!!

let me know how it works =>> in http://forums.indigodomo.com/viewtopic.php?f=178&t=14010&start=45
Karl

Posted on
Thu Sep 10, 2015 9:20 am
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: ARDUINO DOWNLOAD

posted new version. 2-0-3 only change: is in the unoMega sketch.
void printWifiStatus()
in now surrounded by
#if defined(WIFI)
#endif

karl

Posted on
Thu Sep 10, 2015 5:41 pm
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: ARDUINO DOWNLOAD

FIXED: V 2.1.1
writing to Sx variables did not work.

ADDED:
Example to integrate a one wire digital Temp/humidity sensor DHT22 using Sx variables
https://github.com/adafruit/DHT-sensor-library
Screen Shot 2015-09-10 at 6.37.18 PM.png
Screen Shot 2015-09-10 at 6.37.18 PM.png (91.13 KiB) Viewed 19357 times

Screen Shot 2015-09-10 at 6.36.22 PM.png
Screen Shot 2015-09-10 at 6.36.22 PM.png (287.16 KiB) Viewed 19357 times

This works also with 3.3 volt according to specs.

To get the temp and humidity into indigo:
do a schedule with an adruino set pin action to write "Temp" to S0, repeat once a minute (see attached screen shot)
Screen Shot 2015-09-10 at 6.03.01 PM.png
Screen Shot 2015-09-10 at 6.03.01 PM.png (32.31 KiB) Viewed 19357 times
setup S1 and S2 as read pins
and you will get:
Screen Shot 2015-09-10 at 6.03.13 PM.png
Screen Shot 2015-09-10 at 6.03.13 PM.png (13.99 KiB) Viewed 19357 times
where S1 is temp in C and S2 is humidity in %

the code is included in the sketches, look for lines with DHT or dht:
Code: Select all
// include the libraries:
#include "DHT.h"
#define DHTPIN 2     // what pin we're connected to
#define DHTTYPE DHT22   // DHT 22  (AM2302)

// add
DHT dht(DHTPIN, DHTTYPE);
int cc=0;
// in setup:
void setup() {
      dht.begin();   // add this line
...
}


void doMyStuff(){  // this is where we communicate with the DHT
      c+=1
      if (cc >10){ cc=0
      S[1] = String( dht.readTemperature());
      S[2] = String( dht.readHumidity());
      S[0] = "";
      }
}

and uncomment
      doMyStuff();
in loop()

this is tested with arduino and with ESP16 HUZZAH

Karl

Posted on
Sun Sep 13, 2015 1:16 pm
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: ARDUINO DOWNLOAD

new version: 2.2.2

added:
ramp voltage up/ down continuously. The fastest that works ok is ~ 0.1 seconds, if you go faster than that it runs into some internal processing that might make things slower once in a while. The general usage is like in the 1-10 seconds range(*)

fixed:
- when no pins are defined, now the "not configured" state is handled correctly ( you likely have always at least one pin defined..)
- the UNO/mega has a range for analog write 0..255, the ESP 0..1023 this is now handled correctly

improved:
added some more documentation to the ESP and MEGA sketches. The DHT example is now better documented. It can be used as an example to do other onewire or I2C setups:
(a) add the import library statements that apply to the sensor
(b) add the init variables statements before init()
(c) add the init command for the sensor in init()
(d) in doMyStuff() execute the sensor communication and populate the Sx variable to be picked up by the plugin - there are 2 versions shown:
=== one that continuously reads the sensor and the indigo plugin picks up the variable every xx seconds
=== or plugin sends a command to the sketch (e.g. "DHT" in S0) and only then the sensor is queried the and variables S1/S2.. are updated.
(e) in the plugin define the Sx variable as read/input and send the S0 command if you follow that example


Karl

(*) please be aware that the analog write is actually not an analog output but it is emulated by making the pin go up and down so that over time the average is corrected, see screen shots
for a value of 555 and 100 of 1023 max analog Value
you need to add a capacitor of ~ 1uF for 100k ohm load to make it smooth( ~ 0.1 second RC time constant )
if you drive an LED with it, the raw output without capacitor is actually perfect. It switches the LED on/off just the right amount of time. There a capacitor would be bad.
Attachments
Screen Shot 2015-09-13 at 12.34.35 AM.png
Screen Shot 2015-09-13 at 12.34.35 AM.png (27.67 KiB) Viewed 19315 times
Screen Shot 2015-09-13 at 12.48.26 AM.png
Screen Shot 2015-09-13 at 12.48.26 AM.png (14.26 KiB) Viewed 19315 times

Posted on
Sat Sep 19, 2015 12:47 am
BassMint offline
Posts: 105
Joined: Dec 24, 2013

Re: ARDUINO DOWNLOAD

kw123 wrote:
FIXED: V 2.1.1

and you will get:
Screen Shot 2015-09-10 at 6.03.13 PM.png
where S1 is temp in C and S2 is humidity in %

Karl


how are you getting this printout?

Posted on
Wed Oct 07, 2015 4:04 pm
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: ARDUINO DOWNLOAD

version 2.2.5 arduino plugin and version 1.4.1 arduino/ino sketch posted (first item in this thread)

fixed:
the continuous ramp up / ramp down was not properly defined.

added
plugin: the indigo/arduino/menu "set pin value" and "set output modes" now remember the last config: when you go out and back in you don't have to renter everything again.

changed:
The sketch is now ONE file for UNO MEGA ESP1 ESP16: indigo.ino
you need to set the parameters accordingly in the sketch to select the right board wifi/ether/ ip/mac numbers etc. Should be well documented


I tested the setup with "uno-wifi" and "adafruit Huzzah ESP"

Karl

Posted on
Sat Oct 17, 2015 8:15 pm
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: ARDUINO DOWNLOAD

version 2.3.1 arduino plugin and version 1.5.1 arduino/ino sketch posted (first item in this thread)


fixed:
after reboot / restart / power cycle of an arduino/ESP , all PIN program and PIN value setting are now done correctly
- fixed: rampUP / rampDOWN, MomentUp/Moment Down
- was correct for regular input and digital output (0/1) and analog write as well as continuous up down etc.

added:
plugin: digital pin mode INPUT_PULLUP
sketch: INPUT_PULLUP


for INPUT_PULLUP to work you need to load both: plugin and sketch

Karl

Posted on
Sun Feb 14, 2016 12:32 am
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: ARDUINO DOWNLOAD

version 2.3.8 posted

fixed:
- now supports the new Arduino wifi101 module
- added some more error control in both Arduino sketch and plugin
you must use the new sketch and the plugin to make it work for the wifi-101 module.


Karl

and a big thanks to Ryan for helping to debug this remotely

Posted on
Wed Feb 17, 2016 11:24 am
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: ARDUINO DOWNLOAD

posted version 2.3.10

fixed:
fixed bug introduced in 2.3.8, no input pins made it into the device-states

added
check if plugin name is NOT arduino.indigoPlugin (i.e. arduino-2.indigoPlugin which happens when you download into a directory that already has an older version)
It will give you a warning in the logfile in red and will wait for xxxxxxxxxx seconds. You will need to stop plugin, rename it, and restart it.
Some things will not work if you have the wrong name as it looks for some file in arduino.indigoPlugin/...

thanks to Ryan for helping to debug and test it.

Karl

I will be added the plugin name check in all my plugins as I release new versions

Posted on
Sat Mar 12, 2016 10:15 am
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: ARDUINO DOWNLOAD

posted v 2.3.12

added:
check if arduino device is fully configured in device/edit


Karl

Posted on
Sun Apr 10, 2016 10:18 am
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: ARDUINO DOWNLOAD

posted v 2.4.1

added:
in an action / or menu you now can trigger besides writing ON-off /pulse/ analogValues etc to an A-D_S Pin do a READ of any A-D-S- pin.
Normally the read is done on a scheduled time (every xx seconds). This allows to do a read at any time you like.

Create an action
-- select Arduino/ "setPin Value or Function"
-- then select your arduino/ESP device; set command=read and select the Pin you like to read.
then when you want to use it you execute the action you just created and the plugin will send a read request to the Arduino and fill the state Pin_x with the returned value

you could also manually do it one-time in the arduino menu, same settings


Karl

Posted on
Mon Apr 11, 2016 5:29 pm
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: ARDUINO DOWNLOAD

posted v1.5.1

added:

Dx pins can now be used to count changes: either 0->1 or 1->0 with or w/out pulp resistor enabled. You need to to set the function of the pin in device edit.
There you can select now for Dx pins between
>> input open
>> input pull high resistor
>> count 0to1 open
>> count 0to1 pull high resistor
>> count 1to0 open
>> count 1to0 pull high resistor
>> output

This mode can be used to check for changes in contacts states i.e. if the door is opens with a 0->1 pin Dx connected it will increase the value of the state Pin_Dx by one.
When the door closes nothing will happen.

When the door opens several times between the read of the Dx pin it will increment by the number of "opens".
Or if you use 1->0 you count the number of closes

This can be used in a trigger with" if state Pin_Dx has any change " you know that the door was opened at least once. You don't know though if it is still open-- for that you need to read one more Dx pin you connect to the same sensor. That will give you the current state.

This could replace any complicated triggers with timings and Sx variables that you will need to read and set depending on the state and timing of sensor and read.

The other usage for this: you could connect it to e.g. a power or gas meter that opens/closes a contact depending of consumed water/gas/ electricity.

In an action or the menu you can reset the counter


Karl

Posted on
Mon May 02, 2016 5:24 pm
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: ARDUINO DOWNLOAD

posted v 2.6.1 plugin and 1.7.1 INO file ( YOU MUST UPGRADE BOTH PARTS together !!)

added:
1. for output onD pins with analog write (PWM mode): ramp up/down now support Vmin/ Vmax i.e. ramp from 10 to 200 instead of fixed ramp from 0 to 255 (max on Arduino)
this can be used e.g. to set an LED dimmer to slowly ramp from 20% to 80% light and or back down.
2. added FREEdevice. It has no constraints in the plugin. YOU can/must adapt the parameters / settings in the INO file to make it work with your board.


fixed:
smaller behind the scenes fixes - formatting etc.

Karl

Posted on
Thu May 05, 2016 2:03 pm
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: ARDUINO DOWNLOAD

posted 2.6.2

fixed:
Traceback (most recent call last):
File "plugin.py", line 191, in validateDeviceConfigUi
KeyError: key Pin_D0 not found in dict

Who is online

Users browsing this forum: No registered users and 2 guests

cron