13 ms·
ESP 8266 Wi-Fi Repeater with Mesh Networking
- kees99 9y agoTwo limitations here are worth keeping in mind: - Throughput is not stellar (less than 1 mbit/s in a realistic setup); - This is not a real IEEE 802.11s mesh, but rather some clever mechanism on how a node can select an "uplink".
- StavrosK 9y agoThanks for pointing that out. I'd also like to point out that the ESP8266 is a $2 stamp-sized MCU, and it's all you need to run this. Here's the smallest breakout for the ESP8266 that I know of, one I made: https://github.com/skorokithakis/tiny-ESP8266-breakout https://github.com/skorokithakis/tiny-ESP8266-breakout You'll need to connect a 2-3 resistors to the ESP to get it to boot, and that breakout makes it easy. Or you can buy a WeMos D1 mini, which has a USB to serial adapter on it as well, and makes things much easier.
- jacquesm 9y agoVery neat!
- StavrosK 9y agoThanks, Jacques! It came in handy, as it's the only one that would fit in my bus stop bus project: https://www.makerfol.io/project/3VanQzA-the-bus-stop-bus/build-log/ https://www.makerfol.io/project/3VanQzA-the-bus-stop-bus/bui... The alternative would be to have all the resistors and capacitors floating in the case, so it's much more tidy. Plus it's very fun to route.
- jacquesm 9y agoI absolutely love your little projects. Especially can't wait until that phone is finally done. Cue the next meeting where - to the sound of loud ringing - you pull an old fashioned phone out of an oversized pocket and start talking :)
- StavrosK 9y agoThank you! That's been done for years, though :) I've had more than a few stares, and people even came up and asked me if it was actually working. I even made a PCB for it, so it's much easier to convert a rotary phone to a mobile (haven't tested that yet, though). Unfortunately, the ringer was too high-voltage to make work, and the Arduino wouldn't fit inside the phone unless I took out the ringer. Maybe the new PCB will fit, I'll have to try it out. Maybe I'll send you the next prototype unit as a gift, if I ever complete it (or, if you're ever in Greece, drop me a line and we can build it together!).
- jacquesm 9y agoAh, I thought it was still work in progress. > the ringer was too high-voltage to make work But they don't use a lot of current. It's about 90V AC iirc to make it properly ring, and 20 Hz, you could do that with a switched capacitor network or, alternatively, by using a step up transformer (will be a bit heavier). Ugly solution would be to re-wind the coil so it works on a lower voltage and drive it directly.
- StavrosK 9y agoYeah, it's definitely doable on battery, it was just harder than not doing it/out of my league back then. I think I'll actually give it a shot on the next phone, as I think the PCB can easily fit now (it's only 5x5cm, as opposed to an Arduino Uno with shield on the first prototype). I loved your LEGO sorter, by the way, it was very large-scale and a very interesting project, well done. I greatly enjoyed reading the writeup. Do you still use it?
- jacquesm 9y ago> Do you still use it? Paid work has been absolutely insane the 2nd half of 2017, we are barely managing to recover before the next all-out job is landed so unfortunately no time to mess around with other stuff. I have a few more fun projects lined up, one of which has to be ready for next summer so I will definitely be making some time for play besides more work. Can't complain though.
- mtgx 9y agoIt's a shame the Wi-Fi Alliance is showing no interest in long-range mesh capabilities for its Wi-Fi standards. The mesh-like standards it does have currently are mainly focused on home automation, and they only cared about developing those because Bluetooth was becoming the de-factor standard for IoT, and now 6LoWPAN seems to be taking over. 802.11ax promised 5x the range of 802.11n in theory, but implementers will go up to 2x, at most, likely preferring to focus on increased performance/bandwidth instead. I think it would be really cool if we could have a Wi-Fi standard that would go through buildings over 1 mile even at 1Mbps speeds. And I think we now have the technology and know-how for how to deal with interference from similar Wi-Fi emitters. It would be nice if something like this was made by the Wi-Fi Alliance because then we could all have that capability in our phones within 5 years after release. Think how much that would help in cases of disaster: earthquakes, tsunamis, hurricanes, wars, and so on.
- blueprint 9y ago> Think how much that would help in cases of disaster: earthquakes, tsunamis, hurricanes, wars, and so on. Don't forget censorship… :)
- superkuh 9y agoThat's because long distance at UHF and up requires clear line of sight. And that requires at least one end of your setup being up very high on towers or buildings. Height is the reason the cell phone network works. And height is the reason mesh networks don't. Height costs money.
- ac29 9y ago>long-range mesh capabilities for its Wi-Fi standards >go through buildings over 1 mile even at 1Mbps speeds That sounds like a nightmare. WiFi is already nearly unusuable in high density situations. A recent trip to help a friend living in a medium density part of a large city showed ~100 access points, using the lousy WiFi antenna on my smartphone. Even every single 5GHz channel (which really doesnt travel well through objects) was taken, usually twice or more, including all the DFS channels. Mind you, this was inside. I cant begin to imagine how unusable WiFi (and its related unlicenced spectrum) would become if had 5x the range. Even in low-density suburban areas, 2.4GHz is crowded to the point of degraded performance (although 5GHz is pretty clear for now).
- acidburnNSA 9y agoVery cool. Most of you probably already know this, but the ESP8266 is a glorious microcontroller that costs about $7 in a nice package. It has Wifi and a bunch of GPIO ports, and the newer model ESP32 has bluetooth too. They can be programmed like an Arduino (using Arduino IDE among other tools) and are a really interesting way to get a bunch of very cheap, highly connected things going on. For instance, I have one rigged up across a zone valve on my mom's "dumb" furnace and it's now smart furnace that heats the house up before she wakes up and controls the temperature to whatever tolerance she wants. I have another one running the stepper motor that turns the screw of my $30 DIY star-tracking camera mount. Another is hooked up to a thermocouple that transmits readings from wherever through a MQTT server to processing equipment to characterize oven temperatures, water heaters, or anything else you want to measure. I have other ones hooked to reed sensors that tell my security system when things get opened or closed. The possibilities with this kind of cheap SoC are nearly endless. I love how many fun ideas become really practical (as in, "Ooh, I could set this up right now using my drawer of ESPs! Here I go...") with this kind of thing.
- bsilvereagle 9y agoHow're you powering the ESPs? It sounds like you have them distributed quite a bit. Are you running coin cells? Dedicated 5V wall warts?
- acidburnNSA 9y agoMost of mine are just using little wall-warts through micro-USB cables. The star-tracking camera mount (which I even lugged up a little foothill for the eclipse), is battery powered, usually using one of those USB battery packs designed to charge phones. I can also hook it to my deep cycle battery when I'm camping or whatever through a small 12V -> 5V circuit (it's used for other things too). ESPs do have super low power modes for things like the door sensors that only need to do anything when they're triggered an for those you can power them with lithium batteries for pretty long times.
- fest 9y agoCoin cells are not an option- it consumes around 200-300mA while actively transmitting, and around 10uA in (one of) sleep modes. I'm powering my custom temperature/humidity sensors with 18650 lithium batteries. I'm getting around 3-4 months of battery life with 3000mA batteries (waking up every 15 minutes to make a reading, associate with AP and transmit data to local influxdb server (which also runs Home Assistant to see the readings and control some AC outlets).
- escapologybb 9y agoHere's a quick question I hope somebody can shed some light on. I live in a small-ish town in Yorkshire, probably a couple of miles square and was wondering about the feasibility of using these little devices to create a mesh network to extend my home network. The reason being is that I have lots of Internet connected devices which watch over me whilst I'm in the house, being Quadriplegic it's much more comforting to have a computer watch over my health and do things for me than it is to have a potentially tired, angry and/or bored person doing it. However, that bubble ends as soon as I pass out of Wi-Fi range. So obviously I would like to extend coverage to cover my smalltown, but everything I've seen so far has been prohibitively expensive. It wouldn't need to have a massive amount of bandwidth available as it would be just me using it, but it would need to be fairly cheap and as near to 100% reliable as possible. Any insights, questions, comments? TIA Edited To Add: I've just measured it using Google Earth and I need to cover a circle with an area of about one square kilometre.
- mschuster91 9y agoUhhhh. I'd take a look at LoRaWAN or SigFox technology, but that needs appropriate support in your IoT stuff. The alternative would be a small battery-powered 4G hotspot like the Huawei E5573CS-322.
- escapologybb 9y agoI had never heard of either of those two technologies but I would definitely do some googling now, thanks for the tip. I would rather avoid a 4G hotspot attached to my wheelchair for a couple of reasons, chief among them is the data costs would be really high. If I were to extend my home Wi-Fi network I've already paid for my Internet connection, I'm just making my home Wi-Fi network WAY BIGGER than it was intended to be. :-)
- mcroydon 9y agoThe Heltec WiFi LoRa 32 (http://www.heltec.cn/project/wifi-lora-32/ http://www.heltec.cn/project/wifi-lora-32/) and clones are a solid place to start if you want to investigate LoRa. Pycom (https://pycom.io https://pycom.io) has several chips including one that does both LoRa and Sigfox. Espressif also have a shorter distance but lower power option that uses WiFi tech called ESP-Now that is worth looking at: http://espressif.com/en/products/software/esp-now/overview http://espressif.com/en/products/software/esp-now/overview
- pingec 9y agoThis sounds like a really fun thing to play with and could be useful for extending covered range where bandwidth requirements are low. Where I usually struggle is making it all small and robust enough. Does anyone know of any products which integrate power supply (mains or battery) and the esp8266 into a small, cheap enclosed product. The best candidate I have found so far would be the Sonoff products.
- kees99 9y agoBattery would probably be a no-go here. You can't put repeater into sleep mode[#], and in active AP+STA mode ESP8266 takes 70mA @3.3v, which is 3-4 times lower than best purpose-made wifi repeaters, but will still drain 3000mA*h battery in couple of days. [#] ...unless whole sensor network has scheduled "data upload" internals, something like 1-minute window twice a day. But even that is going to be very tricky due to notoriously poor precision of ESP's real-time clock - see for example https://github.com/micropython/micropython/issues/2724 https://github.com/micropython/micropython/issues/2724
- morsch 9y agoSchedule it more often than once per day and when it triggers, resync the clock with your neighbours? If you wake up and nobody else seems to be awake, go into degraded mode where you continually listen for the next scheduled interval.
- kees99 9y ago> when it triggers, resync the clock with your neighbours? Indeed. Periodic clock resync is a must here. Better from external NTP though, as neighbours have their clock badly drifting as well. > If you wake up and nobody else seems to be awake, go into degraded mode where you continually listen for the next scheduled interval. That'll defeat the purpose completely. Here's why: - "Listen" consumes full 70mA; - "wake up and no neighbours awake" will happen very, very often. Let's take simplest example of two nodes with drifting clock. When they both wake up (each by local clock), inevitably one will wake up first. That node will discover there's no neighbours awake. I a mesh, statistically this will happen to 1/N nodes each wake-up, where N is average number of neighbours. If we tighten requirement from "anybody awake" to "enough nodes awake to reach uplink" (so to make use of external NTP) probability of "not enough neighbours awake" even will come close to 100% on each wakeup. Slightly better approach would be - when each node wakes up, it stays awake for long enough to cover worst-case all neighbour's clock drift. Average clock drift seem to be +/-2%. Let's say +/-5% would be worst case. That means, all nodes have to be awake 10% of the time just to re-sync clock so that next wake-up will be not worse off than current one. And staying awake 10% of the time means average power draw of 70mA * 10% = 7mA, which is pretty darn high (3 weeks on a 3000mA*h Lithium cell. Even less if there is payload data transmitted on this mesh.)
- fulafel 9y agoWhy v4 NAT instead of IPv6?
- kees99 9y agoDynamic routing is the hardest part of mesh network. By using NAT martin-ger has side-stepped need to have routing altogether (it's just default gateway for each node like that). But that of course comes at cost - reaching your device from "outside" becomes much harder. Also, ESP8266's official SDK doesn't support IPv6.
- abraae 9y agoCould you elucidate on that? I don't get how a message is somehow routed through a thicket of say 1000 of these things to get from one node to another, because NAT?
- kees99 9y ago"Mesh" (in thick air-quotes) here is just a way for self-organizing for shortest uplink hop count. Strict uplink-downlink hierarchy still stays regardless of whether "manual uplink" or "mesh" mode is in use. Each repeater doing Source NAT still stays. Lack of "sideways" connectivity still stays (unless you configure manual DNAT which is incompatible with "mesh" mode to begin with). I.e., if you have 3 of those ESP8266 repeaters with two clients connected to different repeaters, there is no (easy) way to have those two clients talk to each other. Let's say this is our network diagram: {The Internet}----[Cloud Server] | [Wired AP]----[Local Server] | [ESP8266-R1] | | [ESP8266-R2] [ESP8266-R3] | | [Clinet 1] [Client 2] ...then, we have two options how to make Client 1 and Client 2 talk to each other: - each client talks to the same server (local or cloud) and server takes care of passing the message; or - we configure static destination NAT (option portmap add) on both ESP8266-R2 and ESP8266-R3, and disable "mesh" mode (i.e. manually configure uplinks for all 3 repeaters); ...and arranging 1000 of those in a single string and routing a single packet through that is better avoided. "Mesh" mode helps a lot with this, by selecting shorter path to the internet and bringing topology closer to a tree, where possible.
- geokon 9y agoIt's been quite a few years since my college networking class, but am I wrong to expect this to just kinda work out of the box? The ESPs can already act as routers and the MAC/IP protocols should already insure packets get routed around correctly. How is it different from, for instance, hooking up several WiFi routers at home? I'm curious about the challenges b/c I've been wanting to try to get a more long-distance mesh going with Lora. Some of the newer chips are incredibly affordable: https://www.cnx-software.com/2017/10/13/this-ttgo-board-combines-esp32-lora-radio-and-oled-display-for-just-10/ https://www.cnx-software.com/2017/10/13/this-ttgo-board-comb...
- jessaustin 9y agoThat's nice, but it would seem more useful at 915 mhz...
- geokon 9y agowhy?
- jessaustin 9y ago433 mhz isn't open for unlicensed use in North America.
- avesfan 9y agoCould you integrate a bitcoin address that I can pay to for bandwidth? Have the operator set the kB/satoshi and the rate at which withdrawls occur over the lightning network? When the address is empty the connection is terminated?
- lucaspiller 9y agoIUNGO is a blockchain based project to do exactly this: https://medium.com/@iungo/iungo-global-wifi-networks-is-about-to-disrupt-the-old-standards-d856880e04a4 https://medium.com/@iungo/iungo-global-wifi-networks-is-abou...
- jaytaylor 9y agoWhy can it only do about 5mbps?
- kees99 9y ago5mbps is about the best case (all 3 nodes on the same table). In more realistic deployment, it'll be much less. So, why so slow? TL;DR: Too little RAM on ESP8266. WiFi is half-duplex, i.e. in basic scenario (no MIMO; all stations close enough that each can hear at least some other), only one node can transmit at a time. [CSMA/CA] protocol is used to enforce this limitation. This protocol is susceptible to [Hidden node problem], which absolutely will be present for wifi repeater. Meaning that data in a single burst is transmitted fast, but any switch-over of who's transmitting is going to be really slow, with collisions, pauses, etc. In turn, that means that to achieve any decent throughput, WiFi repeater should buffer as much data as possible to minimize number of transmitter switch-overs. And that requites RAM - say to buffer half-second data burst at 54Mbps you'll need 3.5MB of RAM. Alas, ESP8266 only has 96KB of data RAM, out of which just 32KB is used as packet buffer with standard SDK. [CSMA/CA] https://en.wikipedia.org/wiki/CSMA/CA https://en.wikipedia.org/wiki/CSMA/CA [Hidden node problem] https://en.wikipedia.org/wiki/Hidden_node_problem https://en.wikipedia.org/wiki/Hidden_node_problem
- ferongr 9y agoThe amount of possible chained NATs gave me an aneurysm.
- conk 9y agoHas anyone actually tried to mesh a large number of ESP8266 chips in practice? I tried it, hooked a 7-seg display to each 8266 and started adding nodes 1 at a time. Each node would display the number of additional nodes available in the mesh (on the 7-seg). I found the mesh became unstable around 12+ nodes and would auto arrange into 2+ separate meshed networks. This was a while ago and maybe it's more stable today. I'm interested in anyone actually getting 20+ nodes working reliably.
- tuskan 9y agoThis solution was limited to 8. - Due to the limitations of the ESP's SoftAP implementation, there is a maximum of 8 simultaniously connected stations. (from the README)
- conk 9y agoInteresting, I remember reading some documentation from Espressif's website early on that claimed 50+, but can't seem to find it now.
- vog 9y agoIs this interesting (or at least relevant) for the freifunk project?
- feelin_googley 9y agoWhats up with NodeUSB? It was in Kickstarter some years ago. Anyone here have one? It is ESP8266 and can be programmed without grahical IDE, using only GCC toolchain and Lua?
- Corrado 9y agoFor those of you, like me, who don't know exactly what an ESP8266 is or how it might be used, check out this video by EEVBlog[0]. It gives a brief background on the chip and its alternatives and shows some simple programming examples. [0] https://www.youtube.com/watch?v=Q6NBnPfPhWE https://www.youtube.com/watch?v=Q6NBnPfPhWE
- Corrado 9y agoI'm trying to view the recent FCC Net Neutrality reversal in a positive light; will it finally force us to abandon traditional ISPs? Building a mesh seems like the proper solution to ISPs that won't treat our packets with respect. Given the correct cost/performance ratio I think we could see a mass of tiny devices scattered around the neighborhood/town/city/state/country with backhauls in as many places as possible. If they are cheap enough and self configuring then we could just plug them in to any available electrical outlet and go. Put a couple in your house and put a couple in your parent's/sister's/cousin's house. Talk to your neighbors and have them plug a couple in. Head to the local taco place and have them plug a couple in. It shouldn't be hard to get everyone on board: "Plug this in and get free {libre|beer} Internet access!"
- SunboX 9y agoDid you hear about Freifunk? https://en.m.wikipedia.org/wiki/Freifunk https://en.m.wikipedia.org/wiki/Freifunk It's more or less what you described.
- triangleman 9y agoDo Wi-Fi repeaters work in general? It would seem that if you had two AP's broadcasting with the same SSID, one of which is relaying back to the other, the computer or the AP's or both would get confused. I only saw it tried once and it didn't really work but what is the state of the art? Is this a solved problem?