Domoticz and Arduino sensors over usb

Moderator: leecollings

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

Domoticz and Arduino sensors over usb

Post by Sickboy »

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 16434 times
It is possible?
Flopp
Posts: 279
Joined: Sunday 03 January 2016 14:55
Target OS: -
Domoticz version:
Location: Sweden
Contact:

Re: Domoticz and Arduino sensors over usb

Post by Flopp »

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: 2482
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Domoticz and Arduino sensors over usb

Post by gizmocuz »

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 18:50
Target OS: Linux
Domoticz version:
Contact:

Re: Domoticz and Arduino sensors over usb

Post by Sickboy »

Yeah, everywhere.
I think about raspberry, but it have only 20 outputs...arduino mega have much more...
Flopp
Posts: 279
Joined: Sunday 03 January 2016 14:55
Target OS: -
Domoticz version:
Location: Sweden
Contact:

Re: Domoticz and Arduino sensors over usb

Post by Flopp »

If you will use OneWire temperature sensor it only use one input
Sickboy
Posts: 3
Joined: Sunday 30 October 2016 18:50
Target OS: Linux
Domoticz version:
Contact:

Re: Domoticz and Arduino sensors over usb

Post by Sickboy »

Ok, so tell me which skecht i must use to domoticz see my one-wire sensor...
antwan
Posts: 116
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

Post by antwan »

No sketch, but use the build in 1 wire support under hardware
Rasp Pi 2B: 3x DS18S20 (1-wire), BME280 (i2c)
Cubietruck 1: Aeotec Z-Wave+, RFXtrx433XL+P1, RFXtrx868, TE923 display, SolarEdge API
Cubietruck 2: Aeotec Z-Wave, Voltcraft CO-20
Derik
Posts: 1602
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Domoticz and Arduino sensors over usb

Post by Derik »

Why not espeasy?
Xu4: 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 20:54
Target OS: Linux
Domoticz version: 3.6044
Location: Sweden
Contact:

Re: Domoticz and Arduino sensors over usb

Post by still »

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: 279
Joined: Sunday 03 January 2016 14:55
Target OS: -
Domoticz version:
Location: Sweden
Contact:

Re: Domoticz and Arduino sensors over usb

Post by Flopp »

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 20:54
Target OS: Linux
Domoticz version: 3.6044
Location: Sweden
Contact:

Re: Domoticz and Arduino sensors over usb

Post by still »

@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: 279
Joined: Sunday 03 January 2016 14:55
Target OS: -
Domoticz version:
Location: Sweden
Contact:

Re: Domoticz and Arduino sensors over usb

Post by Flopp »

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: 72
Joined: Friday 11 March 2016 18:23
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Essex, UK
Contact:

Re: Domoticz and Arduino sensors over usb

Post by RidingTheFlow »

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 20:54
Target OS: Linux
Domoticz version: 3.6044
Location: Sweden
Contact:

Re: Domoticz and Arduino sensors over usb

Post by still »

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: 72
Joined: Friday 11 March 2016 18:23
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Essex, UK
Contact:

Re: Domoticz and Arduino sensors over usb

Post by RidingTheFlow »

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 20:54
Target OS: Linux
Domoticz version: 3.6044
Location: Sweden
Contact:

Re: Domoticz and Arduino sensors over usb

Post by still »

@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: 72
Joined: Friday 11 March 2016 18:23
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Essex, UK
Contact:

Re: Domoticz and Arduino sensors over usb

Post by RidingTheFlow »

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 20:54
Target OS: Linux
Domoticz version: 3.6044
Location: Sweden
Contact:

Re: Domoticz and Arduino sensors over usb

Post by still »

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: 72
Joined: Friday 11 March 2016 18:23
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Essex, UK
Contact:

Re: Domoticz and Arduino sensors over usb

Post by RidingTheFlow »

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.
User avatar
JohnnySK
Posts: 25
Joined: Thursday 28 May 2015 22:14
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Slovakia
Contact:

Re: Domoticz and Arduino sensors over usb

Post by JohnnySK »

Hi, did somebody solve something?
I want to have Arduino MEGA direct on Domoticz PC too..
It is some python-serial plugin with universal structure already developed or not?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest