www.homeseer.com    
 

Go Back   HomeSeer Message Board > Analog & Digital IO Device Plug-ins > Analog & Digital IO Discussion > Arduino Plugin (3P)

Arduino Plugin (3P) Discussions related to the Arduion plugin for HS3 by enigmatheatre

Reply
 
Thread Tools Display Modes
  #1  
Old November 30th, 2017, 12:52 PM
Archcantor's Avatar
Archcantor Archcantor is offline
Seer
 
Join Date: Dec 2016
Location: CT
Posts: 46
Heartbeat

I have deployed an Arduino Mega and everything seems fine. However I have had some instances of the Mega being disconnected and I can't reconnect without rebooting the Mega. This is a problem because the Mega is in a remote location.

I have been reading about using the Alive pin and also using a 555 timer that was pulsed from an event. My Mega is ethernet connected and running off a dedicated 5v supply. I can also control that power supply through Homeseer to reset the Mega.

I am seeking a foolproof and automatic way of keeping the Mega going. I was thinking about toggling an output pin, feeding the output to an input pin, and periodically examining the input for the changes. This is a closed loop process. If anything happens to disrupt the Mega then Homeseer won't see the input changing.

What have you all done and what are your experiences?

-Rick
Reply With Quote
  #2  
Old November 30th, 2017, 01:20 PM
usLEDsupply usLEDsupply is offline
Seer Deluxe
 
Join Date: Dec 2012
Location: Mercer, PA
Posts: 142
i was going to do something similar but after the first month or so whatever bug was causing the issue was fixed and over the past few years i have never had one quit working so never bothered (i think i still have an event i made that with disconnect and reconnect it if the status isn't connected but i think that was also included in an update so i think it will automatically do that now)
if you are having trouble you may want to try the builtin arduino watchdog reset (if it's the arduino that is freezing up) it is simple to add to the code and will reset it any time the processor freezes the down side is any time you change the sketch you will have to re-enter the code
the keep alive pin may a easy option as well but you would need a bit of additional hardware '
__________________
HS3 PRO 3.0.0.368, Arduino Plugin, BLBackup, BLLAN, drhsIpPlugIn to control DMX, EasyTrigger, HSBuddy, JowiHue, Pushover 3P, Restart, RFXCOM, UPBSpud, Z-Wave,
Reply With Quote
  #3  
Old November 30th, 2017, 09:03 PM
Archcantor's Avatar
Archcantor Archcantor is offline
Seer
 
Join Date: Dec 2016
Location: CT
Posts: 46
Thanks for your comments. I will look into the Arduino reset. Right now I can ping the IP of the remote Arduino but I can't make the plugin connect. I would imagine the Arduino is alive if it is responding to pings. I don't think the ethernet shield is smart enough to respond to pings if the Arduino is hung. If it's not hung, why can't the plugin connect? All I did to cause the problem was reboot the computer after a Windows update. Locally I also have a NodeMCU with an LCD display networked to the remote Homseer site. I also had to power-cycle that after the reboot to get HS to connect again. Very strange.
Reply With Quote
  #4  
Old November 30th, 2017, 09:21 PM
petez69's Avatar
petez69 petez69 is offline
Seer Master
 
Join Date: Oct 2005
Location: Alice Springs, Australia
Posts: 873
Rick

I too had connectivity issues and then things settled down. I am going to flash the MEGAs with later firmware and I suspect the issues will arise again. I plan to use an arduino nano as the reboot device, possibly something like a 5 minute timer on the nano and if it doesnt get reset it will power cycle the MEGA..

I've found the software watchdog not to work reliably as you need to power cycle the network board for things to work.,

What I think also helped is the Homeseer network sits on its own separate switch from the rest of my home network.

Cheers..pete
Reply With Quote
  #5  
Old November 30th, 2017, 10:29 PM
langenet's Avatar
langenet langenet is offline
OverSeer
 
Join Date: May 2003
Location: Ottawa, Ontario, Canada
Posts: 2,640
I also had the same issue. Firstly, I would make sure you're using 1.0.0.142 of the plugin. Second, be sure you have a good power supply which can source the power required.

Robert
__________________
HS3PRO 3.0.0.435 as a Fire Daemon service, Windows 2016 Server Std Intel Core i5 PC HTPC Slim SFF 4GB, 120GB SSD drive, WLG800, RFXCom, TI103,NetCam, UltraNetcam3, BLBackup, CurrentCost 3P Rain8Net, MCsSprinker, HSTouch, Ademco Security plugin/AD2USB, various Oregon Scientific temp/humidity sensors, Z-Net, Zsmoke, Aeron Labs micro switches, Amazon Echo Dot, WS+, WD+ ... on and on.
Reply With Quote
  #6  
Old November 30th, 2017, 10:46 PM
Archcantor's Avatar
Archcantor Archcantor is offline
Seer
 
Join Date: Dec 2016
Location: CT
Posts: 46
Thanks Pete and Robert. All good thoughts. Yes my power supply is a reliable 5.0v supply at 2A and I am using 1.0.0.142. I was thinking exactly about the ethernet shield possibly requiring a power reset and not simply a board reset signal. I may revert to a USB connection to test reliability. I can still ping the IP of the remote Mega but I can't get HS to reconnect. Sometimes restarting HS can cause a reconnect but even that doesn't work this time. I'll have to wait until Christmas week to get back there. Ugh. Fortunately it's only monitoring non-critical statuses.

I have another Mega on the bench now at home connected to the remote HS and blinking an LED. I plan to spend the next few weeks seeking how long it runs and how it reacts when it stops responding.
Reply With Quote
  #7  
Old November 30th, 2017, 11:19 PM
langenet's Avatar
langenet langenet is offline
OverSeer
 
Join Date: May 2003
Location: Ottawa, Ontario, Canada
Posts: 2,640
One more obvious thing - just checking of course, you've got auto connect set right?

For myself I use a 12 v power supply @2 A. The on board regulator sets the proper voltage to the board.

Edit: If on USB 5V works fine. However, if from a external power supply VIN pin of the board (7-12V). I remember having this same issue now...

Robert

Last edited by langenet; November 30th, 2017 at 11:30 PM.
Reply With Quote
  #8  
Old December 1st, 2017, 02:13 AM
petez69's Avatar
petez69 petez69 is offline
Seer Master
 
Join Date: Oct 2005
Location: Alice Springs, Australia
Posts: 873
Rick

I tried the USB for a while and found it missed events if there were too many at the same time. I used to flip 16 relays in succession when I was testing via USB, it wasnt reliable. Move back to ethernet, solid as.

I reckon you will need to power cycle the arduino, that was the only way I got it to work. I do reckon a Nano with a relay can easily be used to drop the power for a few seconds and let it restart.

I'm using v131 of the plugin. I went through some rough patches as I was logging the disconnects in the log, I would see them randomly, rebooting HS made no difference what so ever.....then it all settled down. I did have a few times when the board stayed off line and I had to go power cycle the remote cabinet.

AS I said my HS network is on its own switch and the whole thing has distributed UPSs on it. Last board reconnect was 17/09/2017
8:37:32 PM. Its been solid since then.

I know sometimes its challenging. Honestly it could be the quality of the clone ethernet board, I've tried various and touch wood, mine has all settled down and I'm loathe to change anything even though I want the functionality of the latter version.

Cheers..pete
Reply With Quote
  #9  
Old December 1st, 2017, 04:22 AM
fvhemert fvhemert is offline
Seer Deluxe
 
Join Date: Jun 2008
Location: The Netherlands
Posts: 296
Use two timers on a separate board. Timer one runs for 2 minutes but is reset on every change of the alive pin. If timer one reaches two minutes (the alive pin is no longer changing indicating some kind of problem) timer two kicks in and disconnects power for 10 seconds. (Do not want to do a quick flash)

Additionally use an event that triggers on disconnect or failed boards and initiates a reset/reconnect.
Reply With Quote
  #10  
Old December 1st, 2017, 06:22 PM
Archcantor's Avatar
Archcantor Archcantor is offline
Seer
 
Join Date: Dec 2016
Location: CT
Posts: 46
Thanks Guys. Interesting stuff. I set up a test Mega on the bench and ran into the problem of running it with a 5v supply, It ran fine when plugged into the computer's USB for programming but was acting strange on the power supply. Then I remembered about the onboard regulator and the ability to feed >5v to the Mega and that you really should. I have some 9v power packs that work great now and I can't remember if I used one at the remote site.

I am confused about the alive pin. I put an LED on this pin and watched it. When I unplug the ethernet the light comes on after a minute or so and it goes off after I reconnect. It does not seem to toggle like a heartbeat. So I am thinking if the Arduino crashes for some reason the alive pin will not change state. It seems to only tell you if the Arduino is connected and responding to the host and not if the Arduino is dead. If it's dead, how can it change state?

I think I would like to do two things. One is to use an event to toggle an Arduino output every 3 minutes or so and connect that pin to a 555 timer set to 5 mins. If the Arduino stops responding to the event for 5 minutes the 555 will push the reset button. Next I want to do something like a power control module on the Arduino power supply with another event looking at the Connected status of the Arduino with the plugin. This can also be used manually if ever needed. This should provide me with at least a 100% ability to get the board running remotely if not automatically.
Reply With Quote
  #11  
Old December 1st, 2017, 07:58 PM
logbuilder logbuilder is offline
Seer Master
 
Join Date: Nov 2016
Location: Pacific North West
Posts: 676
I use the API sketch so I have the flexibility to build my own logic. In my base app, I've built a heartbeat. Every 3 minutes each node will update a HS3 device corresponding to that node. That changes the timestamp. I have an event that runs for each node that looks at the timestamp of the heartbeat and if it is longer than 15 minutes, the event resets the node. I see this event run every once in a while mostly on my nodes that do not have the best wifi connectivity. I seldom have to do anything myself.
Reply With Quote
  #12  
Old December 1st, 2017, 09:29 PM
usLEDsupply usLEDsupply is offline
Seer Deluxe
 
Join Date: Dec 2012
Location: Mercer, PA
Posts: 142
yes i think you would want at least 7v power supply if you are using the built in regulator (barrel connector) you could use 5v if you use the usb port or the 5v pin but the regulator will drop the voltage a volt or two so if you only start with 5 you may be running a bit low

you are correct about the alive pin it is only there to let you know if the connection drops so won't help if it freezes

I think you are on track with a 555 timer and a output that blinks every few min but i think once you get it working you won't need it as i run Ethernet and usb arduino and they are one of the most reliable things on the system
Reply With Quote
  #13  
Old December 2nd, 2017, 08:07 PM
Archcantor's Avatar
Archcantor Archcantor is offline
Seer
 
Join Date: Dec 2016
Location: CT
Posts: 46
Thanks everyone for the feedback. Looks like I have a lot of good suggestions. I am bummed that I won't be at the remote location for two more weeks. Thanks for sharing your valuable experiences. -Rick
Reply With Quote
  #14  
Old December 8th, 2017, 01:58 PM
Archcantor's Avatar
Archcantor Archcantor is offline
Seer
 
Join Date: Dec 2016
Location: CT
Posts: 46
I have had a test Mega on the bench connected to HS at a remote location for about three weeks with no disconnects or need to reboot. The Mega is powered through the power plug with a 6V 1A wall wart. The input voltage to the Mega under load is 7.6V which is great. The other voltages on the board are 5.01V and 3.3V. This is a good step as a best practice for reliability. Either feed the power plug with more than 5V or feed the 5V input directly with a good 5V regulated supply. -Rick
Reply With Quote
  #15  
Old December 8th, 2017, 02:35 PM
langenet's Avatar
langenet langenet is offline
OverSeer
 
Join Date: May 2003
Location: Ottawa, Ontario, Canada
Posts: 2,640
Yeah.. been there myself. Again the spec for input power is 7-12v. Looks like you 6v in works.

https://www.arduino.cc/en/Products/Compare

Robert
Reply With Quote
  #16  
Old December 30th, 2017, 11:30 PM
Archcantor's Avatar
Archcantor Archcantor is offline
Seer
 
Join Date: Dec 2016
Location: CT
Posts: 46
The good news is that I connected a 5V 2A wallwart directly to the arduino +5V input (not the power plug input which needs more than 5V) and everything seems stable now. I measure 5.1V at that terminal. I set up an Event to email me whenever there is a status other than Connected. I can now reset the Arduino Mega through Homeseer which will interrupt the 5V power and reset the board. Now I have a fail safe and don''t have to drive there to reset. I could have automated this with a heartbeat and a 555 timer. I just want to see how long it will go. I can still easily automate this by causing a power reset with the email event.
Reply With Quote
  #17  
Old December 31st, 2017, 04:58 AM
petez69's Avatar
petez69 petez69 is offline
Seer Master
 
Join Date: Oct 2005
Location: Alice Springs, Australia
Posts: 873
Well done mate for sorting it. Putting the juice directly onto the Arduino 5V pin is the way to go. I found exactly the same with Raspberry PIs, rather than go in via the USB connector I go straight to the board.

Anyway look forward to more updates as you go....

Pete
Reply With Quote
  #18  
Old January 14th, 2018, 01:16 AM
Archcantor's Avatar
Archcantor Archcantor is offline
Seer
 
Join Date: Dec 2016
Location: CT
Posts: 46
Thanks Pete. The Mega and NodeMCU have been running flawlessly. The Mega is powered directly to the board (not the power jack) with a good 5v supply. I did not add any heartbeat or reset circuits. I am only monitoring the board connected status with an event that sends me an email when it's in a state other than connected. I only get an alert when I restart Homeseer or if I manually mess with the board's connection. I am looking at about 15 inputs, controlling one output and running an LCD display. As a failsafe I have the board's power supply on an X10 Universal Module. That way I can power cycle the Arduino remotely. That will ensure the ethernet shield gets the reset along with the Arduino. So far, so good. I have not had to reset it at all over the last 2 months. -Rick
Reply With Quote
  #19  
Old January 14th, 2018, 03:27 AM
petez69's Avatar
petez69 petez69 is offline
Seer Master
 
Join Date: Oct 2005
Location: Alice Springs, Australia
Posts: 873
Hi Mate....

I'm so tempted to go through the pain of upgrading the plugin, I have one board that I would have to pull out which is a big job and take it over to the Homeseer PC where I have the ide loaded :-) I have a spare Mega that I could code up and just go and swap the board out, this I need to think about some more :-)

I've been playing with tasmota firmware on the WeMOS using mqtt. I need to get some led light strip control happening and the arduino plugin has an excellent interface to mix colours. The tasmota firmware needs a "middleman" like node-red and I dont want yet another device in the middle....

I plan to deploy a few NodeMCU's into places I cant get the cat5 cable to for the lighting control of led strips.

Thanks for the feedback on NodeMCU, its good to know it works well
Reply With Quote
  #20  
Old January 28th, 2018, 01:01 PM
Archcantor's Avatar
Archcantor Archcantor is offline
Seer
 
Join Date: Dec 2016
Location: CT
Posts: 46
Quote:
Originally Posted by petez69 View Post
Hi Mate....

I'm so tempted to go through the pain of upgrading the plugin, I have one board that I would have to pull out which is a big job and take it over to the Homeseer PC where I have the ide loaded :-) I have a spare Mega that I could code up and just go and swap the board out, this I need to think about some more :-)

I've been playing with tasmota firmware on the WeMOS using mqtt. I need to get some led light strip control happening and the arduino plugin has an excellent interface to mix colours. The tasmota firmware needs a "middleman" like node-red and I dont want yet another device in the middle....

I plan to deploy a few NodeMCU's into places I cant get the cat5 cable to for the lighting control of led strips.

Thanks for the feedback on NodeMCU, its good to know it works well
Hi Pete,

My NodeMCU is actually remote from the Homseer location. I have the two houses linked with the routers running DD-WRT firmware and using Ethernet over IP (EoIP) to allow the two houses to see each other's network. With this I can ping both houses' IP addresses from either house. The NodeMCU is only running an LCD display that shows the Homeseer security system status and time. It updates every minute. It has been just as reliable as the Mega and running for about 3 months now without needing any attention. I updated to the most recent beta plugin 1.0.0.147 but it was running fine on the previous one.

Good luck with your projects!

-Rick
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
xAP Heartbeat donstephens xAP Discussions 2 March 16th, 2014 09:40 PM
Use SIP Connector as heartbeat for PBX simonmason SIP Connector 0 October 8th, 2013 07:59 PM
Heartbeat for PLM skimis Insteon Plug-in (Mark Sandler) 6 January 29th, 2011 10:34 AM
DS-10 Heartbeat Wadenut ACRF Processor (3P) 41 June 21st, 2008 07:56 AM
xapProcess - Heartbeat only itanic xAP Discussions 2 July 14th, 2007 12:53 PM


All times are GMT -4. The time now is 09:06 AM.


Copyright HomeSeer Technologies, LLC