seb821 / espRFLinkMQTT

ESP8266 gateway between RFLink and MQTT server
96 stars 32 forks source link

Not working on Robotdyn Mega #2

Closed dmqgit closed 5 years ago

dmqgit commented 5 years ago

Hi,

I have the following board:

https://robotdyn.com/mega-wifi-r3-atmega2560-esp8266-flash-32mb-usb-ttl-ch340g-micro-usb.html

I like this firmware a lot - unfortunately it is not working with this board. Did maybe already someone test it with this board?

Dip-Switches are on:

USB <-> ATmega2560<-> ESP8266 ON ON ON ON OFF OFF OFF To RXD3/TXD3

I can see the output of the RFLink firmware on serial but nothing reaches the firmware on the esp.

Thanks in advance

agsochi commented 5 years ago

I use this board, works fine, setting are: on on all other off, rxd0/txd0

dmqgit commented 5 years ago

Thanks - I will try it. But I thought the communication is cut off between the two units in this mode? I'll post feedback shortly.

dmqgit commented 5 years ago

Could not wait for it: just tried it - unfortunately it does not work. Maybe I did a mistake in the overall procedure?

  1. I flashed the Mega with the current RFLink firmware (through avrdude)
  2. I modified the relevant parts in the Common.h (wireless + mqtt stuff)
  3. I flashed this firmware onto the ESP-Part through Arduino IDE: Board: ESP8266-Generic, ESP12E, Wemos (already tried different types)
  4. I set the dip switches to On On all other Off and rxd0/txd0
  5. Booted up and went to Web-UI
  6. Nothing :(

Would you mind telling me, what was your procedure?

The unit is not defect - I already managed to access i.e. the onboard LED through a customized ESP sketch.

Did you modify the serial parameters?

Thanks for your help.

agsochi commented 5 years ago

Seems you do all right. I have 2 this boards, one Robotdyn and one copy, both works fine. I can make bin file for you for testing, if u want to try fill this lines: WIFI_SSID WIFI_PASSWORD MQTT_SERVER MQTT_PORT MQTT_USER MQTT_PASSWORD

dmqgit commented 5 years ago

Thanks - good idea. Let's try it.

WIFI_SSID: staging WIFI_PASSWORD: staging MQTT_SERVER: 10.3.3.2 MQTT_PORT: 1883 MQTT_USER: leave blank (no auth) MQTT_PASSWORD: leave blank (no auth)

agsochi commented 5 years ago

https://www.dropbox.com/s/njsbpjuvubf3yit/espRFLinkMQTT.ino.generic.bin?dl=0 use RXD0/TXD0

agsochi commented 5 years ago

I use this FW for receive only, and now i see that command buttons do not work - Ping, Version, Status and commands from commands text field. Commands from mqtt do not work too.

dmqgit commented 5 years ago

First and foremost: thank you very much for all your effort. I owe you a coffee / beer. I am such a fool. I forgot that the minimum characters for a WPA(2) PSK are 8 - "staging" has only 7 characters. I tried 2 AP's both force the limit :(

Would you mind to send me a firmware with passphrase: staging1

I am really sorry :( Stupid mistake.

I use this FW for receive only,

This would be totally fine fore me.

agsochi commented 5 years ago

https://www.dropbox.com/s/njsbpjuvubf3yit/espRFLinkMQTT.ino.generic.bin?dl=0 no problem

dmqgit commented 5 years ago

Thanks again.

Unfortunately it is the same situation as before. Maybe I have got a faulty unit. Already put many hours in debugging. Maybe I have to get another unit to get sure.

agsochi commented 5 years ago

Post your board photo

agsochi commented 5 years ago

https://www.dropbox.com/s/iz2fsti7cplcm6e/%D0%A4%D0%BE%D1%82%D0%BE%2030.01.2019%2C%2021%2007%2030.jpg?dl=0

dmqgit commented 5 years ago

img_5389

dmqgit commented 5 years ago

On this picture I had set RXD3 and dip switch On, On, On, On rest Off.

dmqgit commented 5 years ago

I have a RXB6 module connected to GND, 16, 19. It works in general. I can see the output in the 2560 serial connection.

dmqgit commented 5 years ago

I've tested all units with the code I found here ( see below (1) - it is in russian, but this is the only tutorial I found which is well structured and logical and actually works):

But with RF-Link and espRFLinkMQTT, ESP-Easy, (...) I can not get it to work.

Do you have another idea what I could do? Maybe I connect an extra ESP-01 to the board...

(1): http://www.sysengineering.ru/blog/%D1%8D%D0%BB%D0%B5%D0%BA%D1%82%D1%80%D0%BE%D0%BD%D0%B8%D0%BA%D0%B0-%D0%BA%D0%BE%D0%BD%D1%82%D1%80%D0%BE%D0%BB%D0%BB%D0%B5%D1%80-arduino-mega-%D1%81-esp8266/

dmqgit commented 5 years ago

So I integrated an ESP-12 module. It is working. So it seems that my interconnection between the 2560 and the ESP part in my Robotdyn is defective.

agsochi commented 5 years ago

Check switch RXD3-RXD0, cheap switches may be defective. Try original Robotdyn board, from Robotdyn store.

dmqgit commented 5 years ago

Thanks. I will try it and control the switch - could be the issue. The dip switches are ok.

agsochi commented 5 years ago

I found transmite issue, this is correct lines:

// Serial configuration

  SoftwareSerial softSerial(4, 2, false,BUFFER_SIZE+2); // software RX from GPIO4/D2 pin (unused pin on ESP01), software TX to RFLink on GPIO2/D4 pin
  auto& debugSerialTX = softSerial;                         // debugSerialTX is to show information - use Serial to write on hardware serial (ESP TX pin) 
  auto& rflinkSerialRX = Serial;                        // rflinkSerialRX is for data from RFLink - use softSerial to listen on software serial, use Serial to listen on hardware serial (ESP RX pin)
  auto& rflinkSerialTX = Serial;                    // rflinkSerialTX is for data to RFLink - use softSerial (GPIO2/D4) to write on software serial, use Serial to write on hardware serial (ESP TX pin)
agsochi commented 5 years ago

@dmqgit if onboard esp work, you can connect rx/tx to mega tx0/rx0 through level converter (3.3>5v), and set dip switches to all OFF.

dmqgit commented 5 years ago

Thank you very much @agsochi

The tapping of rx/tx of the ESP8266 onboard is a great idea.

For now I think I will go with the extra ESP-01. I am quiet happy and the "defective" unit costed me many hours. I will print a housing. I can switch the ESP-01 with an ESP-12 if I need the SMA Antenna connector... so in the end it's ok. Power consumption is not ideal - the onboard ESP has to go to sleep mode.

Thanks again - hope I can give it back to you sometime.

img_5391

agsochi commented 5 years ago

Be careful, arduino rx/tx is 5v and esp is 3.3v. Better use level converter.

dmqgit commented 5 years ago

Yes, already integrated one. Further I exchanged the ESP-01 with a Wemos D1 Mini. The ESP-01 delivered not all entries from Serial - the Wemos runs more stable.

Maybe I will switch to a Mega Pro from Robotdyn in the near future: better Efficiency and Form Factor.

seb821 commented 5 years ago

Hello,

Indeed, if you use the Robotdyn board with Mega + esp8266, you need to change some settings to use ESP RX/TX as explained in the note on the main page. And I think the switch should be on RXD0/TXD0 with DIP switches setup like that ATmega2560<->ESP8266 ON ON OFF OFF OFF OFF OFF

With some core version, it seems that sending commands from the ESP to RFLink mega does not work. I believe this is due to some issues with serial software. It should not happen if you use ESP RX/TX. Though, I compiled with core 2.4.2 recently and it worked fine.

I shall this issue as I do not believe it is software related.

fragolinux commented 4 years ago

hi, i just flashed my wemos mega with espRFLinkMQTT_generic_core_263_1MB_DOUT_rflink-wifi-board.bin put in wifi+mqtt info and it's working as expected, and it seems faster than the previous tasmota in reporting the rf remote button pressed... anyone knows which is the pin to be set on this board for the "mega reset"? thanks

seb821 commented 4 years ago

anyone knows which is the pin to be set on this board for the "mega reset"? thanks

There is no direct link on the Robotdyn Mega to reset the Mega with the ESP. But you can wire a pin from the ESP to the MEGA Reset. I did it with gpio16. Please note that in theory you should use a logic level converter as one board is using 5v and the other one 3.3v.