Domoticz and Arduino sensors over usb

Subforum for the 'MySensors' project.
http://www.mysensors.org/
Sickboy
Posts: 3
Joined: Sunday 30 October 2016 19:50
Target OS: Linux
Domoticz version:
Contact:

Domoticz and Arduino sensors over usb

Postby Sickboy » Sunday 30 October 2016 20:11

Hi,
I have some question: can i connect arduino with sensors to domoticz over usb? I dont need radio transmission - I have UTP cable over in my house (for Deimic IoT system). I just want connect some sensors (like ds 18b20) to arduino. Arduino connect to computer with fedora linux OS over usb. Next I want to show temp in domoticz.
Zrzut ekranu z 2016-10-30 19-10-24.png
Zrzut ekranu z 2016-10-30 19-10-24.png (20.59 KiB) Viewed 1338 times

It is possible?

Flopp
Posts: 318
Joined: Sunday 03 January 2016 15:55
Target OS: -
Domoticz version:
Location: Sweden
Contact:

Re: Domoticz and Arduino sensors over usb

Postby Flopp » Sunday 30 October 2016 22:16

If you use MySensors it shall be possible with version 2.0. I am using version 1.5.4 so I have not tested it myself.

User avatar
gizmocuz
Posts: 8069
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi
Domoticz version: beta
Location: Top of the world
Contact:

Re: Domoticz and Arduino sensors over usb

Postby gizmocuz » Monday 31 October 2016 9:17

If you use a raspberry pi, you can use 1-wire with the 18b20 sensors, you can take away the arduino
But do you have utp everywhere ? (Bathroom, cellar, on the roof, ...?)
Quality outlives Quantity!

Sickboy
Posts: 3
Joined: Sunday 30 October 2016 19:50
Target OS: Linux
Domoticz version:
Contact:

Re: Domoticz and Arduino sensors over usb

Postby Sickboy » Tuesday 01 November 2016 12:10

Yeah, everywhere.
I think about raspberry, but it have only 20 outputs...arduino mega have much more...

Flopp
Posts: 318
Joined: Sunday 03 January 2016 15:55
Target OS: -
Domoticz version:
Location: Sweden
Contact:

Re: Domoticz and Arduino sensors over usb

Postby Flopp » Tuesday 01 November 2016 17:25

If you will use OneWire temperature sensor it only use one input

Sickboy
Posts: 3
Joined: Sunday 30 October 2016 19:50
Target OS: Linux
Domoticz version:
Contact:

Re: Domoticz and Arduino sensors over usb

Postby Sickboy » Tuesday 01 November 2016 18:31

Ok, so tell me which skecht i must use to domoticz see my one-wire sensor...

antwan
Posts: 277
Joined: Saturday 13 July 2013 13:28
Target OS: Linux
Domoticz version: Latest
Location: Hilversum, The Netherlands
Contact:

Re: Domoticz and Arduino sensors over usb

Postby antwan » Tuesday 01 November 2016 19:50

No sketch, but use the build in 1 wire support under hardware
Cubietruck: Aeotec Z-Wave USB, RFXtrx433E USB, RFXtrx868X, P1 Converter USB, TE923 display USB, Voltcraft CO-20 USB, SolarEdge proxy
Rasp Pi 2B: 3x DS18S20 (1-wire), BMP085 (i2c)

User avatar
Derik
Posts: 1515
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Domoticz and Arduino sensors over usb

Postby Derik » Wednesday 02 November 2016 0:03

Why not espeasy?
CB 2: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups

User avatar
still
Posts: 7
Joined: Sunday 11 December 2016 21:54
Target OS: Linux
Domoticz version: 3.6044
Location: Sweden
Contact:

Re: Domoticz and Arduino sensors over usb

Postby still » Saturday 07 January 2017 0:45

This is what I also want to do.... I also have a PC that is my Domoticz controller that doesn't have any IO that I can connect any 1 wire units on... So it is not possible to do as Flopp and antwan suggests. And I don't want to use a RPi of a lot of reasons.

@Sickboy..
Did you get it working? Did you find out how to create a Arduino project?

Flopp
Posts: 318
Joined: Sunday 03 January 2016 15:55
Target OS: -
Domoticz version:
Location: Sweden
Contact:

Re: Domoticz and Arduino sensors over usb

Postby Flopp » Saturday 07 January 2017 8:42

still wrote:This is what I also want to do.... I also have a PC that is my Domoticz controller that doesn't have any IO that I can connect any 1 wire units on... So it is not possible to do as Flopp and antwan suggests. And I don't want to use a RPi of a lot of reasons.


Go to www.mysensors.org and check how to build a gateway https://www.mysensors.org/build/serial_gateway then build a temperature sensor node https://www.mysensors.org/build/temp

Check on Build section and you see that you can build a node that can read almost any sensor, you can also combine different type of sensors to one node, and send the data to DZ.

If you have any questions about MySensors I can try to help you, check out MySensors forum https://forum.mysensors.org/

Good luck

User avatar
still
Posts: 7
Joined: Sunday 11 December 2016 21:54
Target OS: Linux
Domoticz version: 3.6044
Location: Sweden
Contact:

Re: Domoticz and Arduino sensors over usb

Postby still » Sunday 08 January 2017 15:28

@flopp
To use mysensor demands an Arduino that also must be a specific ones. I tried it with my Arduino micro pro but MySensor destroyed the bootloader + I don't have any need for a radio gateway.
So how to use MySensor without the radio interface and other "behind the scenes" things that happens in MySensors? Like only the serial interface?

Flopp
Posts: 318
Joined: Sunday 03 January 2016 15:55
Target OS: -
Domoticz version:
Location: Sweden
Contact:

Re: Domoticz and Arduino sensors over usb

Postby Flopp » Sunday 08 January 2017 15:31

still wrote:@flopp
To use mysensor demands an Arduino that also must be a specific ones. I tried it with my Arduino micro pro but MySensor destroyed the bootloader + I don't have any need for a radio gateway.
So how to use MySensor without the radio interface and other "behind the scenes" things that happens in MySensors? Like only the serial interface?

Hi, that I have not tried.

Search at MySensors forum and you will find information how to use MySensors in Domoticz without Gateway. I think it is still in development stage and I am now sure that DZ can handle that yet.

RidingTheFlow
Posts: 75
Joined: Friday 11 March 2016 19:23
Target OS: Raspberry Pi
Domoticz version:
Location: Essex, UK
Contact:

Re: Domoticz and Arduino sensors over usb

Postby RidingTheFlow » Friday 13 January 2017 11:42

MySensors serial protocol is extremely simple ( https://www.mysensors.org/download/serial_api_20 ). All you just need your Arduino sensor sketch to print simple strings like "12;6;0;0;3;My Light\n" to USB serial.

Then connect Arduinos to domoticz as mysensors serial gateways each. I also have most of my house using wired USB for sensor/actuator network and it works very well, and I don't even use mysensors library.

User avatar
still
Posts: 7
Joined: Sunday 11 December 2016 21:54
Target OS: Linux
Domoticz version: 3.6044
Location: Sweden
Contact:

Re: Domoticz and Arduino sensors over usb

Postby still » Thursday 02 February 2017 9:05

That is also my expression and I have tried it but I can't get it working

I have a power meter there I count the flashing LED. That detection and calculation works
I can see on the serial device that the Arduino sends watt,kwh and the counter values to Domotics but only the two last ones are received.
$ sudo cat /dev/ttyACM-ElCounter
0;1;1;0;17;1892
0;1;1;0;24;580825
0;1;1;0;18;580.8250

The Domoticz Node display look like below
Some stange things.

It seems that I have both messages at the start but then the watt message is ignored
And one strange thing... wattMsg have ID 0000000 and kwhMsg has ID 0000001
Should I have different child id in the messages??

Image


Its also looks that the only children (#1) inlcudes both data (watt and kwh)

Image

And when using the library I have seen during debugging that the presentation() function is never called.
Any ideas? Where to start?

RidingTheFlow
Posts: 75
Joined: Friday 11 March 2016 19:23
Target OS: Raspberry Pi
Domoticz version:
Location: Essex, UK
Contact:

Re: Domoticz and Arduino sensors over usb

Postby RidingTheFlow » Friday 10 February 2017 0:35

AFAIK node id 0 reserved for gateway - you should not use it for sensors.

I would recommend having different child Id per sensor, but same (non-zero) node Id - this should allow domoticz to know that they are for same meter.

Also I don't see the presentation message. Domoticz will try to auto-detect, but present is recommended on start to let it properly know that this is power measuring device.

And when using the library I have seen during debugging that the presentation() function is never called.

Can't help you with that, I don't use mysensors library - last time I've tried it, it didn't actually support such mode of operation (direct sensor connection), and its just a waste of memory for such simple use case, since it contains tons of unnecessary things (e.g. node discovery, routing, etc).

I just use a Serial.println :)

User avatar
still
Posts: 7
Joined: Sunday 11 December 2016 21:54
Target OS: Linux
Domoticz version: 3.6044
Location: Sweden
Contact:

Re: Domoticz and Arduino sensors over usb

Postby still » Thursday 16 March 2017 23:40

@RidingTheFlow Thanks but sorry.. I haven't seen your answer until some days ago...
I tested your suggestion. Changing node id didn't help but using different child id showed that both data is actually used. It is just hard to understand that both watt and kwh values are used in the same diagram in Domoticz. I had seen both values but I have thought the program itself calculated the watt value..
So the values are fine
I have also tried the to send the presentation message and also schematics name & version message but there is no difference in the node/sensor presentations seen in Domoticz. It seems it doesn't care about it. I have also seen there is both a command presentation (I have used that) but also an internal subcommand I_PRESENTATION. What to use?

And then so one thing that is more annoying thing is that Domoticz doesn't answer on C_REQ for a VAR1 questions..

PS.
This about the library size.... I would like to modulize it but it seems that no one thinks that is needed....
Maybe its time to write an own "communication library" that only contain the communication part....

RidingTheFlow
Posts: 75
Joined: Friday 11 March 2016 19:23
Target OS: Raspberry Pi
Domoticz version:
Location: Essex, UK
Contact:

Re: Domoticz and Arduino sensors over usb

Postby RidingTheFlow » Monday 20 March 2017 13:46

Don't use I_PRESENTATION. Commands starting with I_ are sent between nodes and gateway.
When direct USB connect, you actually making a gateway (which has nodes inside it).

User avatar
still
Posts: 7
Joined: Sunday 11 December 2016 21:54
Target OS: Linux
Domoticz version: 3.6044
Location: Sweden
Contact:

Re: Domoticz and Arduino sensors over usb

Postby still » Tuesday 21 March 2017 23:18

Ok that isn't easy to understand.. But how about the I_SKETCH_NAME and VERSION? Should I send them? In any case I don't get any different result. No indication in Domoticz. But it would be nice if I could see the version of the code....

One other this is this with C_REQ that doesn't seems to work. Domoticz doesn't answer :(

RidingTheFlow
Posts: 75
Joined: Friday 11 March 2016 19:23
Target OS: Raspberry Pi
Domoticz version:
Location: Essex, UK
Contact:

Re: Domoticz and Arduino sensors over usb

Postby RidingTheFlow » Wednesday 22 March 2017 16:45

I believe you can try sending sketch version, but it should be sent "from sensor" (not from gateway).
E.g.
Serial.println("1;1;3;0;12;2.0.1")

Not sure where domoticz will show it (and if it actually will show it anywhere at all).

mysensors seem to have lot of commands "for future use" that current domoticz does not (fully) support.


Return to “MySensors”

Who is online

Users browsing this forum: No registered users and 1 guest