-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ESP8266 with Arduino firmware for nRF24 network, IoT hidden sensor layer #125
Comments
Well, from the github link you provided, it looks like Arduino IDE integration is pretty much all there, including full SPI functionality of the new IDE. In this case, I think it will work "out of the box" as long as it is detected as an Arduino and not something else, and you use the hardware SPI pins. From there it kind of gets interesting, because I'm not quite sure of the best solution, but it has a TCP/IP stack, and could probably work as a router to some degree. All in all, I think it could be as simple as modifying a few things to have it working with RF24,RF24Network and RF24Mesh. It might take some doing to look at how it could work as a master RF24Ethernet node, but the lower layers should be easy. |
yes it seems like a perfect fit, in fact, I don't want to change anything on lower layers.. they don't have to know whats changed, lol. I just want to deactivate Raspberry Pi from the network (because I'll be expanding the network to 250 nodes soon, I have to get 4 more raspberry pi to safely keep up with their logging and routing. my nodes using dual IDs and dual Channels to communicate with the base, one for 1 raspberry pi A+ which has usb memory as logger, and another name tag for Raspberry Pi B+ which routes data to the SQL server. I'll be testing other features of the ESP8266 chips, unluckily one of my ESP-03's ceramic antenna damaged and I don't know if it still works. from what I can see it is impossible to set nRF24 routing with ESP-01 modules (because they have 2 GPIO pins available - but that also reminds me this -> http://nerdralph.blogspot.com.tr/2014/01/nrf24l01-control-with-3-attiny85-pins.html we've seen many impossibilities become reality with nRF24s thanks to developers like you) I'll be ordering some ESP-03's which seems to have perfect price to range ratio and test the codes one by one.. |
Hello, In file included from /home/potok/sketchbook/libraries/RF24/RF24.cpp:9:0: Sorry for posting here, I cant find your email. |
I didn't, not yet, I'm compiling my thesis now. |
I got the same error as @ppotok and was able to fix it (and a bunch of other compile-time errors) by hacking on the RF24 library. To address @ppotok's issue above, I replaced I then made some additional changes to RF24.cpp to deal with some Then I had to disable the watchdog timer on the ESP8266 in the setup block of my code. Now it's compiling and printing If it's helpful here is 1) my code on the ESP8266 with NRF24L01+, 2) serial output from ESP8266, and 3) code on ATmega328P+nRF24L01+ sensor node I'm using to send test data to the NRF24L01+ on the ESP8266: https://gist.github.com/crcastle/93ebe3b42f3ab021639b I'm a bit stuck now, so any help would be appreciated. |
Made some progress. I can now use the nRF24L01+ with the ESP8266 as the MCU!!! In addition to:
I made a mistake with CE pin wiring and I also "sprinkled" some |
Thanks @TMRh20! I will test this out when I get some extra time, but I have decided that I will need to use an ATmega328P MCU to interface between the ESP8266 and nRF24L01+ (instead of using the ESP8266 as the MCU). The problem for me is power consumption -- my requirements are for this module to run >300 days on user-replaceable batteries. Even using D cell batteries with 15000 mAH I'll only get a week to a couple weeks. The ESP8266 cannot be woken up from deep sleep with an interrupt, deep sleep being necessary to get idle power consumption to <100μA. It's not clear to me if this is a hardware limitation or a software limitation in Espressif's SDK. I'm hoping it's the latter, but for now, I'm going to use the ATmega328P to switch ESP8266 power on and off as the nRF24L01+ receives sensor data. Regardless, @ppotok, I bet the Updates build will fix your problem! |
developments! great! it is possible to wake up ESP8266 using ch_pd or sth interrupt but need to load the same software or wait for the connection to the WiFi. since 328p costs less than $1.3 (smd) and been tested relentlessly for almost a year at network, it is possible to use. my main intention was to replace Raspberry Pi's job with it and from what I've seen, its almost done ps. the perfect battery match to use them with 18650 in parallels with ebay item -> 291487681101 cases 3 of them perfectly fits on a board if you design yourself with either end as an antenna |
Wow, I love you guys! It do reset even if the module is not connected :-( just to be sure with connection I am sorry fort bothering you, but I didn't find anyone else with same problem :-( |
@ppotok I connected as described here http://d.av.id.au/blog/esp8266-hardware-spi-hspi-general-info-and-pinout/ and had to add one additional pin for CE. I used GPIO2. Then in my code, I instantiate the RF24 library object like this:
|
@WERAQS it seems odd that you would need to delete those folders, can you post the compile errors you get with them restored? |
@TMRh20 Don't worry, I have multiple versions of Arduino software installed on this os, some of the older versions seems to work better and compile faster. On the debug side, disabling printf.h makes all codes compile. In file included from pingpair_ack.ino:20:0: Multiple libraries were found for "SPI.h" |
I've connected it as per http://d.av.id.au/blog/esp8266-hardware-spi-hspi-general-info-and-pinout/ : load 0x4010f000, len 1264, room 16 Exception (0): ctx: cont How to solve this ? |
@maribeiro As a guess, have you tried changing the PROGMEM related stuff, ie: |
@TMRh20 Thank you for your great work on RF24 and RF24Network libs and sharing your expertise! RF24Network/examples/helloworld_tx/ I suppose it's not power related (using external battery pack - tested 2 different types). |
Use the needed files(RF24.cpp, RF24.h, RF24_config.h, nRF24L01.h) |
@cacatpunctro Thanks much for the info regarding the mySensors fork, but I would encourage users to contribute the needed changes to this repository instead of copying specific files to support certain hardware. Based on the provided info, I just corrected what I'm sure is a mistake regarding using %S instead of %s regarding the ESP8266, and there seems to be only one other main change regarding the use of progmem in openReadingPipe whatHappened and stopListening functions. If the ESP works with the current mysensors fork and still has problems with this for, then the remaining changes would be very easy to include here. Please let me know! |
RF24/examples/GettingStarted Exception (3): ctx: cont
ets Jan 8 2013,rst cause:2, boot mode:(3,7) load 0x4010f000, len 1264, room 16 So it doesn't get rebooted right away, it reboots at the other functions like you said. |
I'm trying to send data from/to esp/arduino using esp>nrf24 --- nrf24<arduino There is something really broken with the esp8266 arduino implementation or with this port of the library. It all seems related to PROGMEM or stdio redirection. Using the mysensors lib, alltough it doesn't crash my esp8266, GettingStarted example allways fails to send/receive packets. Now, using the pingpair_ack example I am able to send data from arduino to esp, but esp crashes when switching to transmit mode. Up until now I've only had success with the somewhat bland Mirf lib. Hope it helps |
Yeah, this is a big help. Since the two forks are still pretty closely aligned, I decided to try two ways of doing things.
Also, if printf works, you could try recompiling with So, two more things to try if anybody is interested. |
Maybe some data types may be differently defined and/or aligned in memory in esp8266 ? |
With the Updates branch I got the exact same as with the mysensors: GettingStarted no longer crashes the ESP but it doesn't work (packet failed to transmit), pingpair_ack crashes the ESP as soon as T is pressed, but works if it receives. With the gist copied over the updates branch it crashes the ESP when you press T in pingpair_ack. printf doesn't work since there is no fdevopen on the esp8266 arduino implementation. (with serial_debug enabled it enters a continuous reboot loop) load 0x4010f000, len 1264, room 16 Exception (2): ctx: cont
ets Jan 8 2013,rst cause:2, boot mode:(3,6) As a side note, i've noticed that esp randomly crashes if you disconnect your cs/csn pins from board, or if you declare wrong pins. Im seriously thinking of adding stuff missing to Mirf (ie, autoack and whatnot) :D |
@cacatpunctro The thing that bugs me is that @crcastle seems to report ok operation, without any crashing. I would begin to assume that, with it working on one and not the other, something else has to be different. ( pins, config, etc, I dont know?? ) Beyond me speculating or you reviewing pins etc, it might be worth adding some debugging code using serial print to find out where or what is the cause. It will take me some time to do this, so it might just be easier for me to order an ESP at this point. I probably should lol. |
That wouldn't be a bad ideea :) Get a nodedevkit since it's got pins soldered and stuff :) |
Thanks for the info, now its mostly a matter of shipping time. Also, just a thought, because I'm not sure if that made any difference for @maribeiro , and nobody has specified I think, but if using the examples, ensure removal all progmem and printf related references including |
Hi guys, just saw I got mentioned. If it's useful in debugging, here's my setup so you can compare. I've had this running for over a month non-stop now. I'm using an Adafruit Huzzah and this nRF24L01+ radio. It's serving as my RF24Network gateway. It receives sensor data from other nRF24L01+ nodes (currently just 3 nodes plus the gateway) and sends that sensor data to an HTTP API. Wiring details: |
Well, here is my setup, not as pretty as @crcastle I downloaded RF24 + RF24Network, opened "examples/rf24network/helloworld_tx" and changed pins to RF24 radio(2,15); There is no module to receive what it's beeing sent ... It gets to Sending... then loops n 1264, room 16 ctx: cont |
I've managed to get it working by using only the RF24Network examples. |
Hi all,
It seem's that all the pgm_read_write stuff is dangerous. Edit:
|
So I finally received my NodeMCU and tested it out with RF24, and I have no problems using the master branch. I'm using a nodemcu v0.9 (ESP-12) module & followed this tutorial to get up and running. Once working with Arduino. I connected the SPI pins as shown in this pinout and used the same RF24 config as shown above ( RF24 radio(2,15) ) Gettingstarted (RF24)
helloworld_tx (RF24Network):
The main thing I'm not understanding about the different changes folks are making, is that the defines such as ??? All seems good to me |
@TMRh20 I can confirm that GettingStarted example now works fine on my nodemcu too ;) |
- Route printf through serial via Serial.printf - Remove device specific defines & replace with PRIPSTR define for string ( use of %s vs %S ) - Per @maribeiro #125 - Updated Doxyfile
@maribeiro Added in master branch. |
@TMRh20 many thanks for your work, I really appreciate it!!! |
a small trick but it works, if you are complaining about 0x707070707E radio channel default, just run setup twice on your nodes. radio.begin(); void loop.. |
I've been playing around a bit with these ESPs, and they are pretty cool, but I wish development was a bit further along. It seems to support Station + AP mode at once, but its looking like handling routing etc. is mostly out of the question for now, which is a bit of a bummer. I was hoping to chain some together and have routing similar to RF24Network. It also looks like they recently released the source code for the IP stack, but not for the full interface?? With that in mind, I just managed to get the latest git version working with the whole RF24 stack and have been playing around with dual network interfaces on the ESP using RF24Ethernet. Out of curiosity, I'm probably going to have to look at the LWIP stack now, since this would provide two interfaces, and could be adapted to other hardware etc, or the ESP itself once/if the code is made available. I've searched and tested etc., and I can't seem to make anything happen with IP forwarding or routing between a softAP and a wifi connection to my router. I'm guessing this just isn't possible right now?? *edit to add: I can ping the softAP from my network, but not the clients, and the clients have no connectivity regardless of what I do. |
Not sure if this helps at all, but I wrote a library for RFM69 modules (referenced above), for use with the Native Espressif IoT SDK (1.4). It's capable of doing OTA flashing of a remote Moteino node (~15 kB) in one go so it works pretty well, albeit the code being sloppy. As @boguslawb mentioned, the ESP8266's SPI interface (and RAM) must be read form/written to with 32-bit aligned data. Not sure if the Esp-Arduino platform handles this or not, but definitely something to consider (if it hasn't been already). The SPI library linked to in my repo is a good example of how to do this. Also as mentioned, it is best to avoid blocking loops wherever possible so as not to trip the WDT. It looks like esp-Arduino has a timer scheduler but to be safe you could always use something like SimpleTimer (http://playground.arduino.cc/Code/SimpleTimer) to help you set up timers and then just call the polling function timer.run() in your main loop. If execution of your .ino is paused by delay() then doing this could speed up code in your main loop. |
I have Wemos D1, still geting error pls help. What should I download or what pins I should connect. |
@kartakur we use google and "reading" yes! actual reading! |
For those who are struggling with the different version of nodemcu and the pin configurations of spi i suggest you look at this: |
@TMRh20
Kindly update to save others |
@kalibatta |
No I am using 2.3.0 Ok will try updating the esp core and i see. Otherwise thanks for the nice library am just praying that you apply the same stack on espwifi mesh - i like the addressability in your library than the painless mesh for esp |
using raspberry pi became too expensive on my sensor networks to carry information to the web and I want to try something simpler and cheaper, I think it is possible to burn code to esp8266 modules with new arduino bootloader and use nRF24L01 with them. nRF24 connected to the ESP will collect data and upload to the internet over simple wifi connection, I'm browsing through codes and wanted to get your ideas on it..
https://learn.adafruit.com/adafruit-huzzah-esp8266-breakout/using-arduino-ide
https://github.com/esp8266/Arduino
*for anyone never heard of ESP8266, they might seem small, but they can beat the Arduino :)
The text was updated successfully, but these errors were encountered: