{"id":1940,"date":"2021-02-18T14:22:38","date_gmt":"2021-02-18T08:52:38","guid":{"rendered":"https:\/\/judepereira.com\/blog\/lessons-learnt-from-esp-now\/"},"modified":"2021-02-18T14:31:21","modified_gmt":"2021-02-18T09:01:21","slug":"lessons-learnt-from-esp-now","status":"publish","type":"post","link":"https:\/\/judepereira.com\/blog\/lessons-learnt-from-esp-now\/","title":{"rendered":"Lessons learnt from ESP NOW"},"content":{"rendered":"\n<p>For those of you who aren\u2019t aware of ESP NOW, it\u2019s a communication protocol developed by Espressif for their ESP modules. <\/p>\n\n\n\n<p>What began as a simple \u201chook up my plant lights to HomeKit\u201d, turned into a massive home grown firmware, but more about that in another post. <\/p>\n\n\n\n<p>I\u2019ve successfully setup a bunch of ESP 8266 modules to talk to one \u201chub\u201d ESP 8266 module, which then talks to my WiFi network and exposes everything as HomeKit accessories. <\/p>\n\n\n\n<p>While doing so, I learnt:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>It\u2019s not possible to go back to light sleep with GPIO interrupt enabled after sending a payload via ESP NOW.<\/li><li>ESP NOW really really likes WiFi channel 1. On the transmitter side, setting the channel via esp_now_add_peer() doesn\u2019t seem to be a reliable way of having it transmit on the desired channel. u\/cperiod on Reddit confirmed this. His\/her solution was to spawn an AP temporarily to switch the channel: <a href=\"https:\/\/www.reddit.com\/r\/esp8266\/comments\/lj953m\/poor_esp_now_range_if_no_line_of_sight\/gnemjps\/\">https:\/\/www.reddit.com\/r\/esp8266\/comments\/lj953m\/poor_esp_now_range_if_no_line_of_sight\/gnemjps\/<\/a><\/li><li>Since the channel needs to be fixed, ensure that your hone WiFi network doesn\u2019t jump. I configured my router to keep to channel 6 (the best for apartment) always.<\/li><li>ESP NOW payloads are usually delivered at their first attempt, but it doesn\u2019t hurt to add an automatic retry feature in your firmware. For me, my low power motion sensors attempt up to ten times. <\/li><li>It\u2019s incredibly efficient when it comes to range. Payloads were delivered across two walls in my apartment. No additional antenna was used, just the standard one on the Wemos D1 Mini. Somebody on Reddit claimed four walls in their apartment :) <\/li><\/ul>\n\n\n\n<p>That\u2019s it! I\u2019ll write a post about the entire setup + my home built plug and play firmware later. <\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>For those of you who aren\u2019t aware of ESP NOW, it\u2019s a communication protocol developed by Espressif for their ESP modules. What began as a simple \u201chook up my plant lights to HomeKit\u201d, turned into a massive home grown firmware, but more about that in another post. I\u2019ve successfully setup a bunch of ESP 8266 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[504],"tags":[669,666,667,654,665,650,668],"class_list":["post-1940","post","type-post","status-publish","format-standard","hentry","category-hardware","tag-d1","tag-esp","tag-esp32","tag-esp8266","tag-espnow","tag-mini","tag-wemos"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pqtyx-vi","jetpack-related-posts":[{"id":1648,"url":"https:\/\/judepereira.com\/blog\/openwrt-wont-bring-my-wifi-interface-up-unless-the-other-is-up\/","url_meta":{"origin":1940,"position":0},"title":"OpenWRT won&#8217;t bring my WiFi interface up, unless the other is up","author":"Jude Pereira","date":"September 25, 2015","format":false,"excerpt":"I recently bought a D-Link DIR 505 router. So far, I've got a DLNA server running on it, along with Transmission, a bit torrent client. Life is awesome so far. I set it up to repeat another WiFi router in my house, the one connected to the internet - using\u2026","rel":"","context":"In &quot;another snippet | code&quot;","block_context":{"text":"another snippet | code","link":"https:\/\/judepereira.com\/blog\/category\/code\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1918,"url":"https:\/\/judepereira.com\/blog\/sending-ota-updates-over-wifi-to-your-esp8266\/","url_meta":{"origin":1940,"position":1},"title":"Sending OTA updates over WiFi to your ESP8266","author":"Jude Pereira","date":"December 21, 2020","format":false,"excerpt":"This Christmas, I added a whole bunch of lights powered by 5V power sources. My goal was to switch them on at sunset, and switch them off on sunrise, by using a MOSFET for power control :) While I was doing this, I wanted to send OTA updates of my\u2026","rel":"","context":"In &quot;another snippet | code&quot;","block_context":{"text":"another snippet | code","link":"https:\/\/judepereira.com\/blog\/category\/code\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":64,"url":"https:\/\/judepereira.com\/blog\/faunos-shadow\/","url_meta":{"origin":1940,"position":2},"title":"FaunOS Shadow","author":"Jude Pereira","date":"January 20, 2009","format":false,"excerpt":"It's a distribution based totally on Arch Linux... specialized for USB Portable installs and can also be used as primary OS has over 600 packages pre-installed (I know... it reminds you of Fedora and me too!). So that's to say that it comes with definitely all the packages you would\u2026","rel":"","context":"In &quot;gnu linux&quot;","block_context":{"text":"gnu linux","link":"https:\/\/judepereira.com\/blog\/category\/linux\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/judepereira.com\/blog\/wp-json\/wp\/v2\/posts\/1940","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/judepereira.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/judepereira.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/judepereira.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/judepereira.com\/blog\/wp-json\/wp\/v2\/comments?post=1940"}],"version-history":[{"count":3,"href":"https:\/\/judepereira.com\/blog\/wp-json\/wp\/v2\/posts\/1940\/revisions"}],"predecessor-version":[{"id":1943,"href":"https:\/\/judepereira.com\/blog\/wp-json\/wp\/v2\/posts\/1940\/revisions\/1943"}],"wp:attachment":[{"href":"https:\/\/judepereira.com\/blog\/wp-json\/wp\/v2\/media?parent=1940"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/judepereira.com\/blog\/wp-json\/wp\/v2\/categories?post=1940"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/judepereira.com\/blog\/wp-json\/wp\/v2\/tags?post=1940"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}