We have moved at community.getvera.com

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

Offline hek

  • Moderator
  • Hero Member
  • *****
  • Posts: 714
  • Karma: +60/-1
Re: Arduino Sensor Plugin - Build your own wireless sensors!
« Reply #60 on: September 25, 2013, 06:02:54 pm »
@axhill
What happens to the eeprom when re-writing/downloading a sketch? Will it be wiped?

If not wiped - We have a probelm if a new sketch containing a different set of sensors is written to the arduino. It will send its old id back to vera and it mill missmatch the devices in vera.

If it gets wiped -  We will create new vera device each time we update our sensor code because the sensor will request a new id.

Hmm...

The time variable was a good idea and i will implement it. It will work like the relay sketch does (when requesting state in startup).

Offline mitekdg

  • Sr. Newbie
  • *
  • Posts: 42
  • Karma: +0/-1
Re: Arduino Sensor Plugin - Build your own wireless sensors!
« Reply #61 on: September 26, 2013, 01:22:18 am »
2 hek: u r using Pro-Mini 5v now, but NRF24 module requires 3.3V power supply, how did u solve it?

EEPROM would not be wiped when u re-write a sketch.
To solve that problem, before upgrade the sensor, - delete an old one from vera.

Offline hek

  • Moderator
  • Hero Member
  • *****
  • Posts: 714
  • Karma: +60/-1
Re: Arduino Sensor Plugin - Build your own wireless sensors!
« Reply #62 on: September 26, 2013, 01:41:35 am »
I realized that a couple of days ago (when my pro minis arrived) also. I will buy some low drop power regulators.  Probably these:
http://www.aliexpress.com/item/FREE-shipping-10-PCS-LE33-TO-92-VERY-LOW-DROP-VOLTAGE-REGULATORS-WITH-INHIBIT/481626589.html

I have some large step down power supplies that I can use while waiting;
http://www.aliexpress.com/item/10pcslot-LM2596s-DC-DC-step-down-power-supply-module-3A-adjustable-step-down-module-LM2596-voltage/912126670.html

Will update the wiki...

Offline axill

  • Full Member
  • ***
  • Posts: 183
  • Karma: +3/-0

Offline hek

  • Moderator
  • Hero Member
  • *****
  • Posts: 714
  • Karma: +60/-1
Re: Arduino Sensor Plugin - Build your own wireless sensors!
« Reply #64 on: September 26, 2013, 05:16:15 am »
Yes, and MCP1700T or LD1117 also looks good.
But some of the are really tiny and hard to solder by hand I guess.. ?

Offline axill

  • Full Member
  • ***
  • Posts: 183
  • Karma: +3/-0
Re: Arduino Sensor Plugin - Build your own wireless sensors!
« Reply #65 on: September 26, 2013, 05:22:07 am »
MCP1700 is nice but LD1117 better to check for datasheet
I have AMS1117 - drop voltage is at minimum 1V while MCP1700 and the one I mentioned early are about 0.25V

yes - it will be hard to use them on breadboard but soldering is simple even without hotair

Offline hek

  • Moderator
  • Hero Member
  • *****
  • Posts: 714
  • Karma: +60/-1
Re: Arduino Sensor Plugin - Build your own wireless sensors!
« Reply #66 on: September 26, 2013, 05:32:00 am »
Ok, I'll also buy some 662K. 

100 pcs for $6 is unbeatable. It does not matter if soldering fails for a few of them...

« Last Edit: September 26, 2013, 05:34:06 am by hek »

Offline nullx8

  • Hero Member
  • *****
  • Posts: 870
  • Karma: +9/-3
  • Trouble !
Re: Arduino Sensor Plugin - Build your own wireless sensors!
« Reply #67 on: September 26, 2013, 05:36:39 am »
short question:
How many sensor elements can be served with one Arduino board ?
1 VeraLite, 2 RaspberryPI, Harmony Remote, openLuup, 85 Devices, 34Nodes, 63 Triggers, 49 Scenes

Offline hek

  • Moderator
  • Hero Member
  • *****
  • Posts: 714
  • Karma: +60/-1
Re: Arduino Sensor Plugin - Build your own wireless sensors!
« Reply #68 on: September 26, 2013, 05:44:26 am »
It depends...
You have 13 digital inputs and 5 analog on a arduino pro mini.  The radio uses 5 of the digital ports. So left is 8 digital inputs.

In the code i've set the limit to 128 child sensors per radio...



Offline nullx8

  • Hero Member
  • *****
  • Posts: 870
  • Karma: +9/-3
  • Trouble !
Re: Arduino Sensor Plugin - Build your own wireless sensors!
« Reply #69 on: September 26, 2013, 05:49:44 am »
so 8 digital and 5 analog left .. thats a word !

i'm serching for a affordable solution for serval motion and distance Sensors to get things more "automated".
my drawback was the expected cost of easy 400 bucks in z-wave hardware.

does that work with a VeraLite and a USB-Hub as well ? (i dont want to loose the logging and storage for datamine)
1 VeraLite, 2 RaspberryPI, Harmony Remote, openLuup, 85 Devices, 34Nodes, 63 Triggers, 49 Scenes

Offline hek

  • Moderator
  • Hero Member
  • *****
  • Posts: 714
  • Karma: +60/-1
Re: Arduino Sensor Plugin - Build your own wireless sensors!
« Reply #70 on: September 26, 2013, 05:50:33 am »
I have my arduino hooked up to a usb hub. So yes.

Offline Ludde

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
Re: Arduino Sensor Plugin - Build your own wireless sensors!
« Reply #71 on: September 26, 2013, 07:22:06 am »
Hi!

hek: Impressive work! Have done some testing with your code and it works fine! I have a few ideas that may be of interest;

* It is easy to connect a serial LCD to an arduino and in combination with a cheap PSU one could make small "info-frames/stations" around the house showing various Vera data. Or with Larger LCDs or dot-matrix displays one could make ?wall-clocks? showing whatever Vera data you like. Maybe a development of axill's clocks? Sending text strings to a "sensor"?

* A really low battery solution for one or two I/Os would be great to watch the mailbox (the physical one). I know it has been discussed but not sure if a good solution came up?

* As for the ID of the sensor, I believe Dallas has some one-wire chips with just a unique ID on (DS2401). Maybe something that can be used? Or if all sensors have a DS18x20, one could steal the ID from those. http://www.aliexpress.com/item/Ds2401-ds2401-to-92/892319599.html

Anywho, will continue to play with this system whenever there is some time leftover.
Keep up the good work! 8)

Offline hek

  • Moderator
  • Hero Member
  • *****
  • Posts: 714
  • Karma: +60/-1
Re: Arduino Sensor Plugin - Build your own wireless sensors!
« Reply #72 on: September 26, 2013, 07:39:06 am »
Thanks Ludde.

The Arduino vera plugin could very well relay messages to a sensor. It should be enough if I implement a sendMessage action where you can specify the (altId) of the sensor and a string message.
But bare in mind that there is a limitation of 29 bytes payload in each message to the sensors. So we will not be able to stream any video to a sensor :)

The sensor would then use the waitForMessage and do the needful when a message arrive. BTW right now waitForMessage is busywaiting.. I should probably do something about that aswell (or at least give an alternative).

The mailbox sensor should be pretty simple.  Just register the sensor as a door or motion sensor and connect a magnet sensor between +5 and on of the digital in:s of the arduino. Using interrupts this sensor would sleep most of the time (see soil moisture sensor for an example).

@All
I am open to contributors. Improving documentation or code. Just give me a nudge.

 
« Last Edit: September 26, 2013, 07:57:57 am by hek »

Offline nullx8

  • Hero Member
  • *****
  • Posts: 870
  • Karma: +9/-3
  • Trouble !
Re: Arduino Sensor Plugin - Build your own wireless sensors!
« Reply #73 on: September 26, 2013, 07:42:49 am »
I have my arduino hooked up to a usb hub. So yes.

thats great, i have a USB Hub in my "Router Room" already. but its connected to a Computer Power Supply for the 5 volts
serving the MiLight Bridge, and my in-wall Tablet (on the other side of the wall) and the Phone (3G Backup)
(the 12 volts serve all routers,switches, pbx, vera, hdd's and so on)

just need to figure out how to  have the vera use serial part of the usb hub with power coming from the Computer Power Supply
1 VeraLite, 2 RaspberryPI, Harmony Remote, openLuup, 85 Devices, 34Nodes, 63 Triggers, 49 Scenes

Offline Ludde

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
Re: Arduino Sensor Plugin - Build your own wireless sensors!
« Reply #74 on: September 26, 2013, 08:18:36 am »
Thanks for tip, see that the soil sensor uses interrupts, will be fine!

Ooops, forget about the DS2401 ID idea, the ID is 0-255... DS2401 will be too large (48-bit).

As for the message length, anyway one could send two messages, like A and B from Vera? Have the same node ID but different message IDs?

Is there a limit on how many serial devices that can be configured in Vera?

nullx8: Cut the red wire? Keep the D+, D- and Ground? Maybe?