ragoth
Junior Member
Posts: 64
|
Post by ragoth on Oct 14, 2021 12:02:05 GMT
Ragoth,
Keep us posted on how your project is going & any improvements that you add.
|
|
|
Post by papa on Oct 14, 2021 19:24:34 GMT
Dear Papa, I am getting this error message while compiling: RFM_MQTT_GW_25.6_pub:133:37: error: 'IS_RFM69HW_HCW' was not declared in this scope RFM69X radio(RF69_SPI_CS, RF69_IRQ, IS_RFM69HW_HCW, digitalPinToInterrupt(RF69_IRQ)) ; ^~~~~~~~~~~~~~ C:\Users\ragot\DATA_FOLDER\Documents\RFM69_PAPA\RFM_MQTT_GW_25.6_pub\RFM69X.cpp: In member function 'bool RFM69X::initialize(uint8_t, uint8_t, uint8_t)': RFM69X.cpp:114:23: error: no matching function for call to 'SPIClass::begin(int, int, int, int)' SPI.begin(18,19,23,5); //void SPIClass::begin(int8_t sck, int8_t miso, int8_t mosi, int8_t ss) ^ In file included from C:\Users\ragot\DATA_FOLDER\Documents\RFM69_PAPA\RFM_MQTT_GW_25.6_pub\RFM69X.cpp:50:0: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI\src/SPI.h:159:15: note: candidate: static void SPIClass::begin() static void begin(); ^~~~~ C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI\src/SPI.h:159:15: note: candidate expects 0 arguments, 4 provided C:\Users\ragot\DATA_FOLDER\Documents\RFM69_PAPA\RFM_MQTT_GW_25.6_pub\RFM_MQTT_GW_25.6_pub.ino: In function 'void connectWifi()': RFM_MQTT_GW_25.6_pub:226:23: error: 'class IPAddress' has no member named 'toString'; did you mean 'fromString'? IP = WiFi.localIP().toString(); ^~~~~~~~ fromString
|
|
|
Post by papa on Oct 20, 2021 19:08:53 GMT
Updated, Oct. 20, 2021ragoth, I've looked things over & I think the following will help your compiling. First, in the post above, I provided a updated & better version of the main ESP32 Gateway sketch. (Ethernet code is removed.) Previously, I took the wrong approach to the line that begins with "#define IS_RFM69HW_HCW" I was using the method comment/uncomment for deactivate/activate the setting. I needed to leave the line always UNcommented & use the method false/true for deactivate/activate the setting. I updated this instructional post accordingly. As to your other compiling errors, for one thing, I wonder, in the Arduino IDE Tools/Board menu, did you select an ESP32 board that is compatible with your ESP32 board's pinout? For example, if you still have an Arduino board selected, you'd get the "to string" error because the Arduino would not normally have the WiFi code. (When I selected an Arduino board, I got the compiling error that you got.) If you had selected an ESP32 board, was your line still EXACTLY "IP = WiFi.localIP().toString();" Also I wonder, do you have the 3 RFM698 X files in the same sub-folder as the the ESP32 Gateway sketch? Make necessary changes based on this post & see if things work better.
|
|
ragoth
Junior Member
Posts: 64
|
Post by ragoth on Nov 1, 2021 16:24:01 GMT
13:10:47.106 -> 13:10:47.106 -> GW RF69 25.6.3 esp Nw2 13:10:47.106 -> 13:10:47.106 -> 433 Mhz... 13:10:47.106 -> 13:10:47.106 -> Connecting to Access 13:10:48.222 -> ... 13:10:52.223 -> WiFi connected 13:10:52.223 -> IP address: 192.168.86.250 13:10:52.223 -> connecting 13:10:53.212 -> no link 13:10:55.279 -> MQTT OK 13:12:49.724 -> MQTT msg: hom2/rfm_gw/nb/node06/dev99: NODE 6 WAKEUP 13:12:49.724 -> MQTT msg: hom2/rfm_gw/nb/node06/dev16: OFF 13:12:50.700 -> MQTT msg: hom2/rfm_gw/nb/node06/dev16: ON 13:12:52.697 -> MQTT msg: hom2/rfm_gw/nb/node06/dev16: OFF 13:12:54.683 -> MQTT msg: hom2/rfm_gw/nb/node06/dev16: ON
Dear Papa, It works fine now. Thank you soo much, with best regards.
|
|
|
Post by papa on Nov 1, 2021 19:06:43 GMT
ragoth, you are welcome.
Thanks for reporting back that the ESP32-RFM69 Gateway was working for you.
How about others? How are you using the new ESP32 Gateway?
If you have benefited from this project, the least you can do is report your results.
|
|
ragoth
Junior Member
Posts: 64
|
Post by ragoth on Nov 1, 2021 21:10:18 GMT
Dear Papa, I want to use this Gateway with Reyax.com server, to use that we have to enter not only server IP address, but MQtt_username and MQTT_password in the ESP32 Gateway code. Please advice how can I add MQTT username and password in the Gateway sketch.
|
|
|
Post by papa on Nov 2, 2021 21:45:47 GMT
ESP32 Gateway with MQTT Username & Password ??I have not used the username/password feature of MQTT, but looking at PubSubClient examples, that doesn't seem too complicated. RF69_MQTT_GW_25.6.4_esp_pub.ino (29.39 KB) << Members, download this, give it a try & let me know if it works. Early in the sketch are these 3 lines. Like it says, to use authentication, UNcomment lines 2 & 3 & give your MQTT Username & Password. // For secure, authenticated MQTT, UNcomment next 2 lines, give username & password // #define MQTT_USER "your_username" // #define MQTT_PASS "your_password" To see where else I added to the sketch, search for "client.connect" P.S. This version still needs the 3 RFM69 X files offered above.
|
|
ragoth
Junior Member
Posts: 64
|
Post by ragoth on Nov 2, 2021 23:44:22 GMT
Papa, you are great to give a helping hand spontaneously. Thanks with best regards.
|
|
|
Post by papa on Nov 3, 2021 0:41:53 GMT
You're welcome, ragoth.
Remember to report back how well the new sketch works.
|
|
ragoth
Junior Member
Posts: 64
|
Post by ragoth on Nov 4, 2021 8:07:31 GMT
Dear Papa, the new sketch also works fine with MQTT Username and MQTT Password credentials. Thank you.
Thanks, ragoth, for reporting back. I'm glad it worked.
|
|
ragoth
Junior Member
Posts: 64
|
Post by ragoth on Nov 5, 2021 15:41:54 GMT
Dear Papa, I have one more requirement i.e., can I have one to one communication between Node to Node without any gateway.
|
|
|
Post by papa on Nov 5, 2021 19:37:07 GMT
Sorry, ragoth, I'm too busy with other things to work on that project.
Besides I'm not sure I see a good reason for doing it. Yes, two RFM69 nodes could communicate with each other, but with no gateway, they could not communicate with openHAB or other coordinating system. With our forum's Gateway/Node networks, one can in effect "communicate" between any nodes, that is program openHAB rules to affect one node based on what happens to other nodes.
If you're really wanting Node to Node communication AND communication via a Gateway, I'm not sure an Arduino has enough program memory for the additional code necessary.
|
|
|
Post by papa on Apr 23, 2023 19:36:43 GMT
Update, WiFi_RFM69 Gateways in Operation
Recently, after several years of service, my Arduino Ethernet RFM69 Gateways became unreliable. Using Sparkfun ESP32 Things as described above, I created & deployed two new WiFI RFM69 MQTT Gateways. They seem to work well communicating with my Arduino RFM69 nodes, except that the computer hosting openHAB & Mosquitto is acting flaky in staying connected to my LAN.
While I was refreshing myself in building these WiFi gateways, I worked out how to implement gateways on ESP32 boards where the primary SPI bus is not available (like the HiLetgo OLED ESP32). The following posts will document necessary changes in wiring & coding.
Next, Wiring an ESP32 Gateway for the Secondary SPI Bus
|
|
|
Post by papa on Apr 23, 2023 19:47:49 GMT
A Two-Way RFM69 Gateway with WiFI & MQTT, Secondary SPI Bus Updated May 2, 2023 RFM69 DIO0 Interrupt Pin moved from ESP32 pin 5 (needed by OLED) to ESP32 pin 25
The following wiring diagram for the two way RFM69 Gateway (version 2) is similar to one above, EXCEPT the RFM69 radio is connected to the ESP32's secondary SPI pins. Especially for when the Gateway will be disconnected from the Serial Monitor, one steady-burning LED will signal that WiFi/MQTT is connected. The flashing LED signals when radio communication is happening. For each LED, the originally shorter pin goes into an ESP32 ground. Each originally longer pin goes into the ESP32 pin designated in the Gateway sketch. For hints about parts, code libraries, etc., see posts starting here. Disregard references to ESP32 pins (primary SPI bus). As able, you may change the ESP32 pins for the LEDs, but you must also change the pin numbers in the Gateway sketch (see below). Unfortunately the HiLetgo OLED ESP32 board seems to have limited pins available. << Members, click on pic for larger view. Next, Prepare to Program the ESP32-RFM69 Gateway, version 2
|
|
|
Post by papa on Apr 23, 2023 21:14:59 GMT
Prepare to Program the ESP32-RFM69 Gateway, Version 2 Latest Version
^^ slightly updated, May 2, 2023 RFM69 pin DIO0 moved from ESP32 pin 5 (needed by OLED) to ESP32 pin 25
Open the Arduino IDE (program for loading, editing, & uploading Arduino sketch programs). From the Arduino IDE, open the sketch (program) file downloaded above. Accept the sketch's being put in a subfolder. Before uploading (sending) the Gateway sketch to the Gateway, you must edit it to customize to your situation. Your IDE computer must also have the additional code library files that the Gateway sketch needs. The following offers guidance.Note: In editing a sketch, sometimes we are told to "comment out a code line" which means put two forward slashes ("//") at the start of the code line to make the rest of a line a "comment" (not programming code) & disables the code. To UNcomment a line means to remove the two forward slashes ("//") at the start of the line to make the rest of the line into working code except "//" later in the line still indicates comment there. For example in the Gateway sketch, see "// #define DEBUGRADIO" which is a comment, not active code. The line "#define DEBUG // uncomment for MQTT debugging" starts with active code & ends with a comment (after //). Adapt this post to download & install the RFM69X code library files. Place the files in the same file folder as the Gateway sketch. Then to this Gateway sketch, add this customization: To use the secondary SPI bus, find the line "#define Alt_SPI" & UNcomment it (remove // at the line's start). If commented, the sketch uses the primary SPI bus. To see the related programming, search for "ifdef Alt_SPI"
|
|
|
Post by papa on Apr 23, 2023 21:43:34 GMT
Followup Notes I assume the HiLetgo OLED ESP32 board uses the primary SPI bus for something. I don't know yet. I believe that one can use both of an ESP32's SPI buses.
Something like this post might help point the way.
|
|