Skocz do zawartości

Domoticz i arduino bramka USB


Pomocna odpowiedź

Napisano

Witam

Potrzebuję pomocy w uruchomieniu bramki mysensor gateway usb rs485 lub nrf24.

Posiadam clony arduino z atmegami 168p i 328p.

Domoticz tylko widzi to

MySensors: Using serial port: /dev/ttyUSB0

Na początku testowałem z układem ch340 doczytałem że domoticz nie obsługuje tego. Zmieniłem na układ FT232.

lsusb

Bus 006 Device 002: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC

ls -l /dev/ttyUSB*

crw-rw---- 1 root dialout 188, 0 Jan  6 22:22 /dev/ttyUSB0

Użytkownik domoticz jest w grupie dialout / ale nawet jak uruchomię jako root to nic nie pomaga.

dmesg | grep usb

[    0.183050] usbcore: registered new interface driver usbfs
[    0.183050] usbcore: registered new interface driver hub
[    0.183050] usbcore: registered new device driver usb
[    2.914131] usbcore: registered new interface driver usb-storage
[    2.936076] usbcore: registered new interface driver ums-alauda
[    2.947791] usbcore: registered new interface driver ums-cypress
[    2.959588] usbcore: registered new interface driver ums-datafab
[    2.971243] usbcore: registered new interface driver ums_eneub6250
[    2.983007] usbcore: registered new interface driver ums-freecom
[    2.994504] usbcore: registered new interface driver ums-isd200
[    3.000047] usb 6-1: new full-speed USB device number 2 using sunxi-ohci
[    3.018146] usbcore: registered new interface driver ums-jumpshot
[    3.029823] usbcore: registered new interface driver ums-karma
[    3.041101] usbcore: registered new interface driver ums-onetouch
[    3.052555] usbcore: registered new interface driver ums-realtek
[    3.063827] usbcore: registered new interface driver ums-sddr09
[    3.074966] usbcore: registered new interface driver ums-sddr55
[    3.086003] usbcore: registered new interface driver ums-usbat
[    3.554532] usbcore: registered new interface driver usbhid
[    3.564124] usbhid: USB HID core driver
[   14.664156] usbcore: registered new interface driver usbserial
[   14.676408] usbcore: registered new interface driver usbserial_generic
[   14.714047] usbserial: USB Serial Driver core
[   14.738997] usbcore: registered new interface driver ftdi_sio
[   14.751601] usb 6-1: Detected FT232RL
[   14.751611] usb 6-1: Number of endpoints 2
[   14.751619] usb 6-1: Endpoint 1 MaxPacketSize 64
[   14.751628] usb 6-1: Endpoint 2 MaxPacketSize 64
[   14.751636] usb 6-1: Setting MaxPacketSize 64
[   14.754410] usb 6-1: FTDI USB Serial Device converter now attached to ttyUSB0

Z tego co zauważyłem na porcie USB nie ma żadnych danych tak jak by było zero komunikacji.

to co wgrywam do arduino

/**
* The MySensors Arduino library handles the wireless radio link and protocol
* between your home built sensors/actuators and HA controller of choice.
* The sensors forms a self healing radio network with optional repeaters. Each
* repeater and gateway builds a routing tables in EEPROM which keeps track of the
* network topology allowing messages to be routed to nodes.
*
* Created by Henrik Ekblad <[email protected]>
* Copyright (C) 2013-2015 Sensnology AB
* Full contributor list:com/mysensors/Arduino/graphs/contributors
*
* Documentation:
* Support Forum: 
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* version 2 as published by the Free Software Foundation.
*
*******************************
*
* DESCRIPTION
* The RS485 Gateway prints data received from sensors on the serial link.
* The gateway accepts input on seral which will be sent out on
* the RS485 link.
*
* Wire connections (OPTIONAL):
* - Inclusion button should be connected between digital pin 3 and GND
* - RX/TX/ERR leds need to be connected between +5V (anode) and digital pin 6/5/4 with resistor 270-330R in a series
*
* LEDs (OPTIONAL):
* - RX (green) - blink fast on radio message recieved. In inclusion mode will blink fast only on presentation recieved
* - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly
* - ERR (red) - fast blink on error during transmission error or recieve crc error
*
* If your Arduino board has additional serial ports
* you can use to connect the RS485 module.
* Otherwise, the gateway uses AltSoftSerial to handle two serial
* links on one Arduino. Use the following pins for RS485 link
*
*  Board          Transmit  Receive   PWM Unusable
* -----          --------  -------   ------------
* Teensy 3.0 & 3.1  21        20         22
* Teensy 2.0         9        10       (none)
* Teensy++ 2.0      25         4       26, 27
* Arduino Uno        9         8         10
* Arduino Leonardo   5        13       (none)
* Arduino Mega      46        48       44, 45
* Wiring-S           5         6          4
* Sanguino          13        14         12
*
*/

// Enable debug prints to serial monitor
#define MY_DEBUG

// Enable RS485 transport layer
#define MY_RS485

// Define this to enables DE-pin management on defined pin
#define MY_RS485_DE_PIN 2

// Set RS485 baud rate to use
#define MY_RS485_BAUD_RATE 115200

// Enable this if RS485 is connected to a hardware serial port
//#define MY_RS485_HWSERIAL Serial1

// Enable serial gateway
#define MY_GATEWAY_SERIAL


// Enable inclusion mode
#define MY_INCLUSION_MODE_FEATURE
// Enable Inclusion mode button on gateway
#define MY_INCLUSION_BUTTON_FEATURE
// Set inclusion mode duration (in seconds)
#define MY_INCLUSION_MODE_DURATION 60
// Digital pin used for inclusion mode button
#define MY_INCLUSION_MODE_BUTTON_PIN  3

// Set blinking period
#define MY_DEFAULT_LED_BLINK_PERIOD 300

// Flash leds on rx/tx/err
#define MY_DEFAULT_ERR_LED_PIN 4  // Error led pin
#define MY_DEFAULT_RX_LED_PIN  5  // Receive led pin
#define MY_DEFAULT_TX_LED_PIN  6  // the PCB, on board LED

#include <MySensors.h>

void setup()
{
// Setup locally attached sensors
}

void presentation()
{
// Present locally attached sensors
}

void loop()
{
// Send locally attached sensor data here
}

deshipu, może się mylę, ale Forbot już nie ogranicza się do robotyki. Zobacz np. https://forbot.pl/blog/o-stronie

FORBOT.pl, to najpopularniejszy w Polsce blog regularnie publikujący poradniki dla elektroników i majsterkowiczów, których pasją jest samodzielna budowa urządzeń elektronicznych.

Więc Domoticz pasuje idealnie.

A gdzie ja piszę, że Forbot się ogranicza do robotów. Ja tylko sugeruję, że jeśli to jest duży projekt ze swoją społecznością, to być może lepsze odpowiedzi można uzyskać na jego oficjalnym forum.

Bądź aktywny - zaloguj się lub utwórz konto!

Tylko zarejestrowani użytkownicy mogą komentować zawartość tej strony

Utwórz konto w ~20 sekund!

Zarejestruj nowe konto, to proste!

Zarejestruj się »

Zaloguj się

Posiadasz własne konto? Użyj go!

Zaloguj się »
×
×
  • Utwórz nowe...