We have moved at community.getvera.com

Author Topic: Arduino Sensor Plugin - Build your own wireless sensors!  (Read 262402 times)

Offline clippermiami

  • Hero Member
  • *****
  • Posts: 1394
  • Karma: +27/-6
Re: Arduino Sensor Plugin - Build your own wireless sensors!
« Reply #705 on: June 29, 2014, 04:45:14 pm »
Can you share a screen shot of the layout?

Herewith version 1.0.

This is a 3v battery powered sensor for Arduino Pro Mini using the MySensors Plug In. It supports 2@ Digital, 2@ Analog and 1@ L2C interface and will use miniature screw terminals for sensor connections. Power is from a CR123A 3v Lithium Battery and it has one of the 0.8v=>3v boost/regulator modules onboard to suck as much life out of the battery as possible. The battery monitor voltage divider is contained in a cutout in the battery holder to save some space. Each of the sensor terminal blocks provides +3v and GND on the outside terminals and the sensor input on the inside pair of screws. I'm thinking about adding a 3v=>5v boost/regulator to power 5V sensors but that may be in the version 2.0 board.

This was done before I created the Eagle Libraries for the "CR-123 Battery Holder", the "NRFL01" and the "0.8v
=>3v Boost/Regulator" and everything was done with pads and spacing so there is no silkscreen outline of those devices in this first cut.

This is my first project with Eagle and PCB fabrication so I'm sure it could be better, tighter, etc. Right now everything is spaced out so the board is larger than need be. Once I get the boards I'll be able to adjust for physical spacing and do a version 2.0 (assuming its wired right :) to begin with. )

I've started working on a 5V external power version right now while I wait for these PCBs.
Two Vera Plus UI7 Linked via HTTP, 90+ Devices. PlugIns: PLEG, DSC, Blue Iris, MySensors,  AutoVera, ImperiHome, VeraAlerts, EventWatcher

Offline zogg

  • Sr. Newbie
  • *
  • Posts: 38
  • Karma: +0/-0
Re: Arduino Sensor Plugin - Build your own wireless sensors!
« Reply #706 on: June 30, 2014, 02:55:31 pm »
I seem to be stuck in the starting blocks so I have a few questions:

1. When I uploaded all the files to Vera and created the device, I got "MySensors Plugin" but not an Arduino Gateway Plugin with the Arduino picture. Are these the same?

2. The MySensors Plugin is red and says "Lua Failure". I tried adding the IP:PORT to the Advanced tab of my Ethernet Gateway device but it doesn't work. I've rebooted Vera several times trying to get it to work.

3. I read earlier that the Arduino UNO can't be used as a gateway, even though the info on MySensors.org says you can use "almost any model". Is this my problem, using a UNO?

Offline C4Vette

  • Full Member
  • ***
  • Posts: 157
  • Karma: +3/-8
Re: Arduino Sensor Plugin - Build your own wireless sensors!
« Reply #707 on: June 30, 2014, 04:15:41 pm »
A UNO with ethernet is ok. If you want to connect via USB your only option is a Nano. Then you have to set the right serial speed. All info is on mysensors.org explaining this.
« Last Edit: June 30, 2014, 04:19:04 pm by C4Vette »
VeraLite UI7 1.7.649
Fan of: PLEG, DataYours, dutchSmartMeter, MySensors

Offline zogg

  • Sr. Newbie
  • *
  • Posts: 38
  • Karma: +0/-0
Re: Arduino Sensor Plugin - Build your own wireless sensors!
« Reply #708 on: June 30, 2014, 05:35:50 pm »
So it's not a Nano/UNO issue.

This is what I see in the Dashboard, the plugin is red and says Lua Failure. At the top, it says" MySensors plugin - Cannot send command - communications error". When I click "Start" a popup says "Device communication failure".

Is it showing Lua Failure because there is an actual error starting the code, or because it can't communicate with the Ethernet Gateway?

Offline C4Vette

  • Full Member
  • ***
  • Posts: 157
  • Karma: +3/-8
Re: Arduino Sensor Plugin - Build your own wireless sensors!
« Reply #709 on: July 01, 2014, 01:25:51 am »
What Vera UI-version are you running and what type Vera do you have?
On a VeraLite or Vera-3 it may not be higher than UI5, so if you upgraded to UI6 you should go back.
What are you using for Arduino? A UNO with ethernet? Then you should edit the EthernetGateway.ino for a static IP-address, connect it to a router/hub/switch and check if you can ping the device.
« Last Edit: July 01, 2014, 01:31:48 am by C4Vette »
VeraLite UI7 1.7.649
Fan of: PLEG, DataYours, dutchSmartMeter, MySensors

Offline zogg

  • Sr. Newbie
  • *
  • Posts: 38
  • Karma: +0/-0
Re: Arduino Sensor Plugin - Build your own wireless sensors!
« Reply #710 on: July 01, 2014, 09:41:47 am »
What Vera UI-version are you running and what type Vera do you have?
On a VeraLite or Vera-3 it may not be higher than UI5, so if you upgraded to UI6 you should go back.
What are you using for Arduino? A UNO with ethernet? Then you should edit the EthernetGateway.ino for a static IP-address, connect it to a router/hub/switch and check if you can ping the device.

I have a Vera 3 running UI5. I have not upgraded to UI6.

For the gateway I am trying to use my Arduino UNO. I wired it up with the Ethernet ENC28J60 and the wireless module per the instructions. I also edited EthernetGateway.ino per the instructions and put in the static IP. I have double checked my wiring and all appears to be correct.

Still getting the "Lua Failure". The log just says communication error.

Offline C4Vette

  • Full Member
  • ***
  • Posts: 157
  • Karma: +3/-8
Re: Arduino Sensor Plugin - Build your own wireless sensors!
« Reply #711 on: July 01, 2014, 04:42:03 pm »
Is the static IP in the same subnet as the Vera and your PC? I don't have an Ethernet module myself so I don't know if you should be able to ping it. You could connect the Uno's USB to your PC and look at the serial output for the debug messages.
VeraLite UI7 1.7.649
Fan of: PLEG, DataYours, dutchSmartMeter, MySensors

Offline zogg

  • Sr. Newbie
  • *
  • Posts: 38
  • Karma: +0/-0
Re: Arduino Sensor Plugin - Build your own wireless sensors!
« Reply #712 on: July 01, 2014, 05:01:37 pm »
Do you need an active client module before this works? I was trying to get the gateway up and working first, then get my first sensor client working, but maybe I need the client to be active.

And yes, static IP in the same subnet. I tried to ping it but it didn't work. And the ethernet gateway sketch only echoes messages it receives from the client to the serial port. I suppose I can add some debug statements though.

Offline C4Vette

  • Full Member
  • ***
  • Posts: 157
  • Karma: +3/-8
Re: Arduino Sensor Plugin - Build your own wireless sensors!
« Reply #713 on: July 02, 2014, 04:32:08 am »
It is not needed to have a working/active sensor.
You wrote: "the ethernet gateway sketch only echoes messages it receives from the client", but does this mean you see nothing at all from the serial port? The USB-version shows a message like "gateway started" or something like that.
And you are sure the "EthernetGateway.ino" is correctly edited, saved, compiled and uploaded? Then I'm out of ideas, sorry. Maybe search for a sketch to check the correct working of the ENC28J60 shield.
« Last Edit: July 02, 2014, 09:19:10 am by C4Vette »
VeraLite UI7 1.7.649
Fan of: PLEG, DataYours, dutchSmartMeter, MySensors

Offline Zooz

  • Jr. Member
  • **
  • Posts: 80
  • Karma: +1/-0
Re: Arduino Sensor Plugin - Build your own wireless sensors!
« Reply #714 on: July 02, 2014, 06:32:09 am »
I had similar problems when plugging the GW to Vera3. Solved it by connecting to the main router instead. And yes, changed the IP's in both cases to match the ones allocated by either VERA or the router.

Offline zogg

  • Sr. Newbie
  • *
  • Posts: 38
  • Karma: +0/-0
Re: Arduino Sensor Plugin - Build your own wireless sensors!
« Reply #715 on: July 02, 2014, 09:43:35 am »
It is not needed to have a working/active sensor.
You wrote: "the ethernet gateway sketch only echoes messages it receives from the client", but does this mean you see nothing at all from the serial port? The USB-version shows a message like "gateway started" or something like that.
And you are sure the "EthernetGateway.ino" is correctly edited, saved, compiled and uploaded? Then I'm out of ideas, sorry. Maybe search for a sketch to check the correct working of the ENC28J60 shield.

Sorry, yes, it does say "Arduino startup complete". I was looking in the sketch and the only Serial.print is to echo incoming client messages, which is what I was referring to.

I think your idea to try another ethernet sketch is the next thing to try. As Zooz suggested, I did connect it to the same switch as Vera but that didn't help either. So I need to make sure the ethernet is working.

I do appreciate the suggestions, thanks much!

Offline zogg

  • Sr. Newbie
  • *
  • Posts: 38
  • Karma: +0/-0
Re: Arduino Sensor Plugin - Build your own wireless sensors!
« Reply #716 on: July 02, 2014, 11:41:45 am »
SUCCESS!!!

I had a bad wire on one of the control pins to the Ethernet shield. When the basic EchoServer sketch wouldn't work either, I then started checking everything until it ran.

Lessons learned:

1. MySensors.org has old pictures. The MySensors Plugin device that shows up in the Vera dashboard, MySensors Plugin, looks totally different and has a different picture from the one shown on MySensors.org (Arduino Gateway Plugin). For a newbie this is very confusing.

2. The Ethernet Gateway WILL respond to pings, which is helpful.

3. When it says "Communication failure", it means it. And since Vera will try to communicate as soon as you create the device (in the Installing Vera Plugin section), it's better to have your Gateway on and ready to go before creating the Device.

Great work all and thanks for the help!

Offline C4Vette

  • Full Member
  • ***
  • Posts: 157
  • Karma: +3/-8
Re: Arduino Sensor Plugin - Build your own wireless sensors!
« Reply #717 on: July 03, 2014, 03:49:10 am »
Congratulations  8)
Now built those sensors!
VeraLite UI7 1.7.649
Fan of: PLEG, DataYours, dutchSmartMeter, MySensors

Offline ServiceXp

  • Sr. Member
  • ****
  • Posts: 342
  • Karma: +9/-6
Re: Arduino Sensor Plugin - Build your own wireless sensors!
« Reply #718 on: July 10, 2014, 12:31:18 pm »
Reading over much of this information...., its a little overwhelming for those who have no electronics background... 

Is there a "starter Kit" (includes everything needed) that can be purchased for Battery powered Temp/Humidity setup?


U.S.A Vera 3

Offline waynehead99

  • Sr. Member
  • ****
  • Posts: 296
  • Karma: +16/-1
Re: Arduino Sensor Plugin - Build your own wireless sensors!
« Reply #719 on: July 10, 2014, 12:33:29 pm »
Have you looked at the mysensors.org site? Might find what your looking for there. There isn't any kits really but it's broken down really well on what you need to buy, where to get it, and how to build it.