RS485/RS232/Serial transport class for mysensors.org
-
Hi,
I am new in mysensors and arduino however I already use domoticz with mysensors and rflink.
Everything is working fine however now I plan to renovate my house and I would like to put wire connection using max485 and arduino. Problem is that it is now working :( I have tried 1.5.4 version and also development branch. It seems that signal is not getting to gateway. I nothing see on arduino gateway except of initalization gateway. I have started to use two nano but I also tried combination nano and mega without success. I would be very appreciate if someone who done it could more describe how to make that it works.
I tried https://arduino-info.wikispaces.com/SoftwareSerialRS485Example and it works fine.
I use for nano combination pins 2 (de/re), 8 (ro),9(di) -
@m26872
I'm sorry and promises to improve :)@Mariusz
In my case the solution was in MyConfig.h file (in my case C:\Program Files (x86)\Arduino\libraries\MySensors):-
Disable function MY_DISABLED_SERIAL
commenting lines 49
// #define MY_DISABLED_SERIAL -
Disable function MY_DEBUG
commenting lines 36
//#define MY_DEBUG -
Correct connection is on my pictures enclosed in the above comment
Board | Transmit | Receive | PWM Unusable
Arduino Uno | 9 | 8 | 10 <----- Form https://www.pjrc.com/teensy/td_libs_AltSoftSerial.html .... (& other ATMEGA328)
Arduino Leonardo | 5 | 13 | (none)
Arduino Mega | 46 | 48 | 44, 45DE and RE -> Pin 2
RO -> Pin 8
DI -> Pin 9-
To check the hardware and connections run the "Example Program" from https://www.pjrc.com/teensy/td_libs_AltSoftSerial.html
-
Use development branch
-
-
Hi everyone !
I needed a wired solution for my several nodes.
Here is the serial rs485/rs232 wired network transport for mysensors.
https://github.com/leodesigner/mysensors-serial-transport
It is based on the Majenko ICSC serial library.
Can you please test it? It is a beta version - but it is working for me.
(However, I am still waiting for my rs485 boards to arrive)
You can find more technical information at
http://sourceforge.net/p/arduino-icsc/wiki/RS-485/To use it, you have to:
- Put SerialTransport.cpp and SerialTransport.h to folder/directory/path SerialTransport in your library.
- Add #include <SerialTransport.h> to your .ino sketch
- Replace transport class with:
MyTransportSerial transport(Serial,0,-1); // serial port, node, dePin (-1 disabled)
Please let me know about bugs and how it is working for you.
@LeoDesigner
Hi, I am trying to do almost the same, but I would like to use softwareSerial instead of altsoft. The reason why I would do this is that i can barely fit the arduino nano inside my case, and an additional rs485 module would not fit and that I have 8 nodes connected on the softwareserial . I have tested software serial on arduino and it seems to work fine up to 15meters, I also adjusted the baudrate to 9600 since my node does not send out/receive large amount of data. I read that you did some work on software serial and were wondering if you could take a look at this thread. -
Is there any how-to's on this transport class as far as the hardware goes? How does it work with multiple nodes? Is it like a ring pattern? or do all the nodes have to have a dedicated connection to the gateway.
-
Is it possible, to built a esp8266 wifi gateway and communicate GW to node with rs485?
In altsoft esp8266 is not decleared, so i can't use it out of the box.Btw: I tested my_rs485 with nano as GW and Pro Mini as node, and it worked great. Thank you :)
-
@hausinger if you know about coding..
- plain C lib for esp8266, it can be adapted to work with Arduino Esp: https://github.com/plieningerweb/esp8266-software-uart
- or use stock arduino esp8266 software serial lib (https://github.com/plerup/espsoftwareserial), and inspire yourself from lib above, and code your CE pin management..
-
How about adding the following define to use the Serial1/2 on Mega. I have not tested yet but assuming the AltSoftSerial lib has the same interface/functionality it should work.
#define MY_RS485_SERIAL Serial1diff --git a/core/MyTransportRS485.cpp b/core/MyTransportRS485.cpp index 814f721..ea35c9e 100644 --- a/core/MyTransportRS485.cpp +++ b/core/MyTransportRS485.cpp @@ -92,7 +92,11 @@ unsigned char _recSender; unsigned char _recCS; unsigned char _recCalcCS; +#if defined(MY_RS485_SERIAL) +HardwareSerial& _dev = MY_RS485_SERIAL; +#else AltSoftSerial _dev; +#endif unsigned char _nodeId; -
@hek Thanks for the quick response. I'm looking for some direction (this might not be the right forum).
I want to create a node to control my Itho Ecofan ventilation box. I now have a working program (thanks to the help of Rogier Reedijk The nodo now uses a CC1101 transceiver to control the box and thus uses the SPI bus. I'm looking for some direction to use this transmitter as part of my sensor network so I can control it from my Domoticz. Hope you can give me some directions how to proceed.