-
Notifications
You must be signed in to change notification settings - Fork 2
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
Code adaptation for ESP32 ? #1
Comments
Hi @paulgreg, Thanks for your feedback. Good to hear that you have it up and running with an Arduino Uno. That's what I also used for testing transmit and receive. I did not test with an ESP32, so I looked at my code with dry-reading. I found one potential issue in the receive: An additional
void IRAM_ATTR rfPinChange(void) |
Thanks @Erriez for your answer and the the I’ve change it with a few minor adjustments in commit paulgreg@1dac24f. However, I’m still not getting values. Your receive example sketch is only displaying « Oregon THN128 433MHz temperature receive » on my esp32. I’ve seen a potential issue with By the way, I’ve tried a few GPIO but I’m currently using GPIO 4 on the esp32. Also, I’ve connected my RF Module to the 5V output on my esp32. Connecting to 3V3 didn’t entered into |
Errata : it works ! 🎉 I’ve merged my branch using Thanks again for your very nice library and help ! I can now adapt my esp32 weather station to display outside temperature. |
The range is however very limited (a few centimeters) but that’s not a software issue but rather an hardware one :-) |
Hi @paulgreg, That's good news about your progress. RF is sometimes magic. My suggestion is to start with an Uno board to determine the physical range of the RF receiver hardware. Some RF receivers simply have a short range. (and I've wasted a lot of time) The Uno has a stable 5V power source and less RF interference compared with the ESP32.
This is a gray area as the chip is 3.3V. It may work, but a level converter (or resistor network) is recommended. I use STX882 transmitters and SRX882S receivers with corresponding external antenna and have a good range (depends on the environment). They work between 3.3V and 5V. I also suggest to add a capacitor on the power and experiment with placing the receiver away from the CPU. Also the enclosure has influence on the range. Just some hints. Did you notice a difference between |
Thanks for the hints. Indeed, it seems more stable with the Arduino Uno. I tried again this morning using 3.3V and it works when the thermometer is near ! I may have tried when the thermometer was too far and thought that it didn’t work with 3.3V. I’ve ordered 2 more receivers, including a SRX882 (but it will take a few weeks to arrive) to try with them. I’ve also tried this morning with Thanks again for the help. I will post here progress but it may take weeks (or months) until I’ve got new hardware parts :/ |
That would be great. You're working on an interesting project. :-) |
Hello, Using a « RF module 433Mhz superheterodyne receiver », I was able to get data from the sensor from a longer range (about ~8 meters) on an arduino, an ESP32 (using 3.3V) and an ESP8266 (using 3.3V). It’s too short however in my flat to use it on my weather station. So I build a kind of relay, based on an esp8266, that I placed in sensor’s range. It gets temperature, displays it on an OLED display and post data as JSON to a custom server (using json-store, a simple server to save and get JSON). My weather station then fetches that local temperature, after getting weather data from openweathermap.org. I’m really grateful of your wonderful work about that library which made that possible. I’ve only had to make a few changes to make it work on an ESP32 or ESP8266. So I think it should be possible to make an universal library. Here’s my changes, mainly due to renaming, to be able to use both library : master...paulgreg:ErriezOregonTHN128-esp32:master |
Hi @paulgreg, Thanks for your update. ~8 meters is better than you started, but it is still a short range. I did not expect a similar range with different types of microcontrollers.
I'm curious, do you have a deepSleep problem on an ESP8266 or ESP32? I also spent a lot of time of research on ESP8266 as there are multiple causes for this. Great project on Hackaday. 👍 I'll check your changes and will try to add it to this library. (This will take some time as I need to setup the hardware first) Thanks for your contribution. |
About the range, there’s some walls between the sensor and the receiver and I live in a flat in a big city with, I think, many other sources of radio emission. So maybe that could be the cause ? The deepSleep problem is on the esp8266. I’m using sleep on multiple esp32 without issues. So I don’t know why it doesn’t works... Sometimes, it sleeps correctly the first time but not after 🤯 |
Yes, walls and other equipment drops the range. Around 50m is feasible in open field with these transmit/receivers with antenna.
One open and long thread which maybe related to your issue: esp8266/Arduino#6007. In my case I had bad luck with a counterfeit flash chip mounted on the ESP8266 PCB and it was not possible to fix by software. You can try some resistor tricks on the reset pin (don't have a link). Or maybe testing an ESP8266 from another batch and supplier which wakes correctly? Yes, the ESP32 works without issues, but requires a hardware redesign and porting the application (which is not 100% compatible with deepsleep). |
Thanks you for those tips. I’ll try to add a 220 resistor between MISO (d06) and 3.3V pin which seems to work for many people... 🤞 |
@paulgreg I've created a new branch https://github.com/Erriez/ErriezOregonTHN128/tree/add-esp-support with AVR, ESP8266 and ESP32 support based on your reported changes. I did not test on hardware yet, because I encounter a |
The previous reported issue has been resolved by adding build argument to command A new issue is introduced when calling a weak function from a C-Library on ESP32 espressif/arduino-esp32#7133. Stay tuned. |
For your information, I wasn’t able to fix my sleep problem on my esp8266. However, I tried again to connect it directly on my weather station (based on esp32) and it worked when I put the receiver/antenna a little away the esp32... Strange but since that worked, it’s perfect for my case. I was able to get local temperature and display it on that weather station. I’ve updated my project page and code. I would be happy to update my code to use and test your library when it’s available. |
I recognizable the behavior you describe. Another suggestion for the wake problem (all magic, but fixed for two of my devices):
Thanks! One remaining issue is the weak function callback from the C-library on ESP32. I did not see a reply yet. |
Finally I've added ESP8266 and ESP32 support in branch add-esp-support and tested all examples in combinations. Note: I think I'll squash commits Add ESP8266 and ESP32 support and Fix ESP8266 and ESP32 support before merging to Would it be possible for you to test it with your hardware and provide feedback? Then I'll merge MR #2. Thanks! |
I’ve just updated my 2 projects (one using an esp32, the other an esp8266) using your branch. They both compiled perfectly and worked as before ! 🎉 So I think your branch is ready ! Thanks for the amazing work ! 🙏 |
Thanks for testing and positive feedback! In the mean time I'm adding CI via Github Actions and automatically updating the documentation. I'll create a release soon and let you know. |
I've released v1.1.0! Thanks for your support! It was great to collaborate with you. 👍 |
Hello,
Thanks a lot for your library which works great with an Arduino Uno.
I would like to use it on an Espressif ESP32 to integrate it on my weather station.
I’ve tried to adapt your library but without success for now...
While debugging, it seems I am never entering
isPulseInRange
since_tPinHigh
is around ~450 or ~2250 but never into the correct range of 5100 ~ 5900. It works on Arduino so the problem isn’t from my thermometer.By any chance, do you have any idea what can be pose problem to ESP32 port or what to look for ?
Best regards
Grégory
The text was updated successfully, but these errors were encountered: