Hacker News new | past | comments | ask | show | jobs | submit login
ESP 8266 Wi-Fi Repeater with Mesh Networking (github.com/martin-ger)
491 points by rcarmo on Dec 26, 2017 | hide | past | favorite | 165 comments



Very 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.


I think these are great for people with experience using embedded electronics and comfortabke with soldering and low level programming (I.e probably a significant portion of HN readers).

However for those that don't have a background other than simple programming experience, I strongly recommend paying g more for a platform with good infrastructure. For example , I'm really impressed with particle.io.

Board costs are <$20 but come with cloud infrastructure and lots of examples and documentation. For those that value time over money I recommend them.


I'm probably biased because I got started programming with a 48K ZX Spectrum when I was around 12, and low-level stuff followed.

But I started getting interested in "hardware" about this time last year. Soldering was a bit fiddly since I'd only rarely done it in the past, but the programming side was pretty simple to handle. I found tutorials which were very beginner, even non-programmer, friendly.

Of course it helps that I've programmed in C for 20+ years, and I can still do assembly-stuff if I must, but I don't think it is unreasonable for a complete beginner to do useful/fun things given enough willpower.

The only downside for me is ordering kit from AliExpress which takes ~1 month to arrive to me. I'm currently waiting on some E-Paper, which I was recently surprised to discover is very affordable..


Can you or someone recommend tutorial programming esp8266 "natively"? Most of the tutorial I cam across uses a mix of arduino IDE, nodemcu or micropython. I want to interact with esp8266 and the on-board mcu directly using C. I feel like these tools abstract away a whole lot of fundamental concepts, rendering most projects out there hobby-ish.

But I have limited knowledge on embedded programming. Hope someone can shed some material programming esp8266 from scratch. Thank you!


Which e paper did you get? I was planning to order some soon


I went for a Waveshare 400x300 module for approximately €25.

The 800x600 module is perhaps the better size, for €46, but this is just for me to experiment with. I have no particular use for the paper, I'm just impressed that it is suddenly "cheap".


I am interested in hearing about this as well.


Uh...

It doesn't get any easier than an ESP8266 and Micropython. https://docs.micropython.org/en/latest/esp8266/esp8266/tutor...


There are plenty of good entry-level tools now available for the ESP8266. There's an Arduino bootloader, with full support in the Arduino IDE including TCP/IP and HTTP APIs. You can serve a "hello world" over HTTP in about 20 lines of code. I wouldn't suggest it for someone with zero microcontroller experience, but it's not terribly difficult to make the leap from basic Arduino projects to the ESP8266.

https://learn.sparkfun.com/tutorials/esp8266-thing-hookup-gu...



I didn't find it that hard to figure out. You can do pretty much anything you want with lua on the esp boards. Soldering was a little tricky, I also have to do it outside now with my kids. I think the material for beginning electronics online rivals programming tutorials in quality though not quantity.


> I think these are great for people with experience using embedded electronics and comfortabke with soldering and low level programming (I.e probably a significant portion of HN readers).

Those days are over. The new chips come with a high level language like python, pip. You can program it like you would with a digital ocean box but with a lot more constraints in hardware.

I haven't done any soldering but I don't see why that should turn people off. I mean I am worried about the toxic fumes but I'm sure theres way to mitigate that.

The whole point of having my own chip and programming it is the experience itself. Particle.io does not make sense to me as it seems to be another commercialization via platforming of this space which might make sense in enterprise but for the hobbyist, I doubt it.


nodemcu is a variant of esp8266. here is a great case from thingiverse[1] that you can get printed on 3dhubs for cheap. the case design lets you avoid soldering, the gpio feet just sink into the case, and make contact with any wires you want. not sure how solid this is compared to soldering, but i think for most use cases it's fine, and keeps things very simple.

as others have said, those days are over. micropython with esp8266 is insanely easy[2].

1. https://www.thingiverse.com/thing:1128026 2. https://docs.micropython.org/en/latest/esp8266


ah this is a perfect gateway for noobs like me! thanks for this.

I'm super excited about 3dhubs! I didn't know such service existed. Wonder what the pricing is like.


3dhubs is a market place. you choose from local printers, and if u go bottom of the barrel on price (as i do) it usually means u just wait longer for shipping. i printed x5 nodemcu cases and x5 raspi cases for ~$30 total, arrived a week later. pickup is also possible instead of delivery.


what software do you use to design the 3dhubs? do you need to know basic CAD? thank you.


i just used the stl files from thingiverse. no modifications.


You solder outside unless you've got a great exhaust fan.


The tiny amount of soldering involved in an 8266 etc project is not a concern. Use standard 63/37 lead/tin solder and wash your hands afterwards to be perfectly safe. The rosin flux fumes may be a bit annoying for some people, a small battery powered desktop fan will blow them away.


And use lead-free solder. Not much to worry about really.


For hobby-amounts of soldering, stick to leaded and save yourself lots of frustration. General stock lead-free solder is much harder to work with, and if you are new to soldering it can be a horrible introduction to the fine art.


I would heavily recommend against lead free solder as the other commenters have done. Unless you have a ton of experience with soldering, avoid it like the plague.


Lead was never the problem (just dont eat solder paste). Its the toxic fumes from fluxes needed to wet the metal, aka etch away oxidation layer. Very nasty stuff. The nicer te flux (RMA, no clean), the more toxic.


I've read another comment saying that actually produces more toxic fumes?


Lead free solder requires a higher temperature, so ther are more and more toxic fumes from embedded flux and from heated pcb and components.


Lead free solder in the long run damages solder tips and also is a lot more prone to the tin whiskers plague. Luckily I have a life time supply of leaded solder and hopefully will never have to touch the lead free junk.

http://www.militaryaerospace.com/articles/print/volume-16/is...

https://nepp.nasa.gov/whisker/background/


I see...seems like I'll just get one of these

https://www.amazon.ca/Aoyue-Benchtop-Solder-Smoke-Absorber/d...

and stick with lead when I get the chance....I'll be sure to do it in well ventilated area.


And don't lick your fingers after handling leaded solder. Wash them first (with soap and warm water). Otherwise, I totally agree: it is easier to use and less frustrating, and the dangers are overrated (or: the dangers from lead-free fumes are underrated).

Me: I use leaded solder, I have a fan, I don't lick my fingers (while soldering).


ESP32 is way better than a PCW 1512, with dual core and network capabilities.

Any programming language available for MS-DOS back in the PCW 1512 is doable in a ESP32.

Programming can be low-level like we used to do in Assembly, or high level Turbo Basic, Turbo Pascal, Modula-2, C, C++ style.


As of about 3 months ago, software support for the ESP32 was incredibly lacking. Many very important ESP8266 libraries were incompatible with the ESP32. I ended up having to switch chips mid project because I simply didn't have time (or the skills) to write the code for a modern networking stack from scratch. That being said, the ESP32 has incredible hardware.


Are these particle.io kits completely soldering-free? I've been looking to experiment a bit with some embedded projects purely for fun and I don't mind low level programming at all (if it has a C compiler or at least a decent assembly manual, I'm good), but soldering (presumably, the smell of the flux, but I've never cared to investigate and would rather just avoid it) is a strong migraine trigger for me.


There are some other devices out there that are made to allow alligator clips onto leads or to use conductive thread, so no soldering is required. Adafruit makes several great little boards, but if you're getting started I'd recommend the "Circuit Playground" board: https://www.adafruit.com/product/3333 It has a number of sensors and LEDs built in already as well and supports CircuitPython, Microsoft MakeCode, and the Arduino framework.


I have a few working without soldering; I just stripped wires and threaded them through the contact opening. I intended to solder after I confirmed it was working right but never got around to it.

So far I've got an Alexa controlled IR transmitter that controls my TV, an LED board showing the current bitcoin price, the temperature outside and the status of the local highway and I've got some led strips controlled by Alexa.

I haven't coded for years and it was a lot of fun.


There is a pretty good sized ecosystem from particle and other compatible products that all just plug together like Arduino shields. No soldering needed for those. They also have a Shield-shield which adapts to Arduino Uno shields.

One can, of course, build their own boards which requires soldering.


you can just plug it into a breadboard.


I started with Particle because it's so easy to get going, partly due to the OTA firmware loading. If I remember correctly I only needed an app on my phone and the in-browser IDE. No wires, no programming hardware, etc.

From there on I transitioned to more DIY things like the ESP over time, buying cheap stuff from AliExpress.


Electric Imp is another alternative, though I'm biased ;)

A bit better at scaling than particle in my opinion, not that that really matters for little diy one off projects though.


If you are interested in micro controllers, my recommendation is to get a $20 soldering iron, some lead free solder, flux, breadboard, jumper wires, Wemos D1 mini or Pro, LEDs, resistors, buttons, distance sensors (IR and ultrasonic), temperature and humidity sensors, relays, and some speaker wire. You can get all that from China for about $45. Get 2-3 of the Wemos boards as you’ll likely fry one.

If you are into home automation, look into Sonoff stuff. It uses these chips but comes nicely packaged into several different form factors. You can run open source firmware on them.

Plain Arduino (AVR) boards don’t have a ton of advantage over the ESP8266 and ESP32 chips. So I’d honestly mostly skip them except if you want a ton of GPIO pins or if you want to use the Uno form factor with the shields. Having Wi-Fi is such a huge thing that I think it outweighs the other considerations. Good luck!


Why the recommendation for lead-free solder? It's harder to work with, the fumes are more poisonous than leaded solder, you shouldn't eat/lick either, and the amount of lead is harmless for DIY solderers. I agree that lead-free solder is environmentally preferable for mass-produced products that eventually end up in a landfill somewhere in Africa, but for a DIY project, I don't see the advantage. I'd love to be proven wrong though :)


> the fumes are more poisonous than leaded solder

What do you mean?

> the amount of lead is harmless for DIY solderers.

To date, the FDA, CDC, and the WHO state that "no amount of lead is harmless". It's just that we can't get a sensitive enough handle on the neurological effects to determine a good metric for it.

On another note, does anyone know if the Respro masks are suitable for protection against lead (+ the stuff with lead) inhalation while soldering? The "techno" mask has a HEP-A filter and a charcoal mesh, which I would have thought would be enough for most of the lead particulate?


As far as personal harm during the actual soldering, it's not hard to use lead solder safely.

You have to breath it or ingest it for it be dangerous. In soldering it does not get anywhere near hot enough to vaporize, so really all you have to worry about is ingestion.

As long as you either don't touch the solder, or are careful after touching it to not touch anything that may find its way into you until you can thoroughly wash whatever parts of you touched the lead (or were touched by parts of you that touched the lead), you should be OK.

The biggest health risk during soldering is going to come from the flux. It's the flux burning that produces the smoke you see and smell during soldering.

Here's a document from LBNL on safe soldering practices that goes into the components of solder (leaded and lead-free) and their dangers: http://www2.lbl.gov/ehs/ih/pdf/safeSolderingFinal.pdf


My understanding is that there are no lead fumes. It becomes a gas at like 3200 degrees. Your soldering iron won’t make it into a gas and if you are inhaling fumes that hot you have bigger problems. My main issue with it is that I don’t want any residue on my work surfaces where my kids might play with it, or on any electronics they might touch.


It's lead, not ebola.

Although that degree of caution is more or less warranted when dealing with lead solder in paste form, I have to admit. That crap gets everywhere.


> It's lead, not ebola.

Exactly.

Fumbling around with a soldering iron and some leaded solder a little bit, few times a decade, won't give you cancer or any poisoning. Safety considerations are aimed at people doing lots of soldering, because at this point the amount of flux fumes they might breathe in (or risk of ingesting lead) becomes a possible risk.

(And to be honest, I believe most of this safety advice is aimed not at DIY people, and not even at people who occasionally have to solder something at work, but to have a stick that will prevent employers in soldering shops from creating very unhealthy conditions for their workers.)


The ESP chips are not trivial to hook up, unless you get something like a NodeMCU. The original breakouts are not breadboard friendly, and they have (comparatively) weird requirements for programming (e.g. some pins need to be pulled up, which means you need to breakout the breakout boards). They're also not 5V tolerant, which means you normally need a regulator and have to worry about interfacing. The documentation is OK, but it's a warren of official documentation, Wikis, Github and forum posts.

I would say that the Arduino advantage is that it's truly out of the box. ESP8266 is close, but it's not that easy.

If you want an easy IoT dev board, I will always recommend the Particle Photon (no affiliation). It's $20 and has really great documentation. It will do OTA updates out of the box once you've set it up on your network using a smartphone. It's a separate IDE (cloud based, or you can get an offline one), but you still use Wiring and they've retained the setup() / loop() constructs. I have had some issues with devices not connecting to networks using the chip antenna, so you probably need the external one.

Other minor issues - most ESP boards are not FCC/CE compliant. They're just fake stamps on the EM shield. Some of the boards are, but you need to be careful if you're trying to build a product or worry about interference. The Photon, on the other hand, is certified (and they also certified it with a suitable external antenna).


The nice thing about working on 3V is that they're stupidly easy to power using 2AA batteries, but I agree it's a bummer they're not 5V tolerant otherwise it would be as easy to power over USB.


They are 5V tolerent on the logic pins, just not on the power. LiFePO4 batteries work great for powering them as their voltage curve matches perfectly without regulation.


My understanding is that this is mostly a dangerous myth. Like it sort of works but you really shouldn’t unless you are ok frying the board. I have been sticking with mostly 3V components and have a separate set of rails and transistors to control that side of things.


No, that's wrong. The signal pins absolutely are 5V tolerant (confirmed by the CEO of Espressif) and work perfectly but if you put 5V to VCC it will fry instantly. I know from experience, in both cases.

It used to be the case that people were unsure if the logic pins were 5V tolerant or not due to ambiguity in the datasheet and the consensus was to be cautious, but it has since been officially confirmed that they are tolerant. Some other devices (e.g. relays, some MOSFET gates) might require a 5V output level to trigger, in which case you will need a level shifter/transistor, but 5V inputs to the pins are fine (and most digital devices that work at 5V logic levels will be fine with 3.3V logical high due to the way TTL levels are defined).


Thanks for the info. I stand corrected.


According to the CEO of Espressif, Teo Swee Ann, the I/O pins of the ESP8266 are 5V tolerant.

See discussion here: https://hackaday.com/2016/07/28/ask-hackaday-is-the-esp8266-... and official reply on Facebook (of all places): https://www.facebook.com/groups/1499045113679103/permalink/1...

> Teo Swee Ann i can reply officially here: it is 5V tolerant at the IO. while the supply voltage is at 3.3V.


And, the built in A/D will give you the current voltage reading with no additional wiring so you can post it to your MQTT instance and monitor when you need to change/charge your LiPO :-)


Wemos chips are breadboard friendly and while they require hat you solder the pins, that is pretty trivial and something you will need to learn anyways.

Yes there are loads of other breakout boards that suck but I found Wemos ones to be great.


There's a ton of decent boards:

Adafruit Huzzah https://www.adafruit.com/product/2471

NodeMCU is good, there's a ton on ebay.


+1 on the Wemos D1 mini recommendation. I have 5 or 6 and are great little boards. If you need some more pins the, you can get the NodeMCU boards.


can you share some links to where to buy? where to learn some basics? thanks!


AliExpress.com has it. Just search on there. Note that for Wemos specifically there are a ton of clones that don’t actually say “Wemos” on them. Get the branded ones as the price difference is negligible.

https://www.aliexpress.com/store/group/WeMos/1331105_2571030...

https://m.aliexpress.com/s/item/32765214054.html?spm=a2g0n.s...

https://m.aliexpress.com/s/item/32454217006.html?spm=a2g0n.s...

The soldering iron is the only thing I got state-side. I went with one that has temperature control so I can do lead-free solder.


Tayda and SmallBear market to the hobbyist maker. They stock common ICs and components, and don't mind small / single unit orders.


The ESP8266 is quite cool, but there is one annoying drawback if you are trying to run on batteries. It does not support waking from deep sleep on GPIO activity. Deep sleep only supports waking via timer or via reset.

I believe that the other two sleep modes (modem sleep and light sleep) support waking on GPIO activity, but they don't save as much power.

Modem sleep just disables WiFi between DTIM beacon intervals. In this sleep it draws between about 15 mA and 16 mA current average, depending on the DTIM beacon interval.

Light sleep is like modem sleep, but also turns off the system clock. That gets you down to an average of between 0.5 mA and 2 mA, depending ton the DTIM beacon interval.

In deep sleep, everything is off except the real time clock. That cuts current down to around 0.02 mA.

Two of the sensors I have don't fit in well with that kind of deep sleep.

One is a cup anemometer. It briefly closes a switch once per revolution. Wind speed = rotation rate times a constant. If I just wanted to check the average wind speed every so often, it would be fine--the ESP8266 could wake up and stay awake for a few resolutions to get the speed, send it, and go back to sleep.

It could be hooked up to reset the ESP8266 each time the switch closes, but in high wind that could generate resets so fast that the ESP8266 would not have time to connect to WiFi and send data.

Also, I'd like to get more information on wind gusts, and so really want to record the time of each switch closure.

The other is a tipping rain gauge. It briefly closes a switch for every 0.01" of rain. That one probably could be used directly with the ESP8266 by making it generate a reset on each switch closure. I don't think my area ever gets rain intense enough to make those resets happen fast enough to cause problems.

What I'm thinking of do is relegating the ESP8266 to just dealing with WiFi, and using something like an ATiny84 to handle the sensors.

The ATiny84 and ESP8266 can be connected via I2C or SPI or similar. The ESP8266 can then spend most of its time in deep sleep, being woken every so often by the RTC. When it wakes it can get the accumulated data from the ATiny84 and upload it.


On the topic of deep sleep, I've done it half a dozen times already on the ESP-01:

https://taoofmac.com/space/blog/2017/11/05/2130

There are hacks to trigger wake with auxiliary circuitry, but it would be nicer (if more demanding in terms of current) to monitor a GPIO pin.


You need something with a counter/timer, sum the anemometer into a register. Wakeup when it overflows. Some chips can run the counters while the MCU is in sleep.

Your idea to offline sensor handling to an ATTiny is perfect. I'd use

https://www.microchip.com/wwwproducts/en/ATtiny85

as it has timer/counter.


I believe the ESP32 has a much more capable deep sleep mode.


The ESP8266 is an awesome SoC for its price. I'm currently implementing a small connected "ringbell" for those looking for me at work using this, and it simply send an HTTP GET request to my IFTTT API key to warn me on my cellphone.


$7? Where are you spending that much on them? The D1 Mini is my favorite breakout, and it's half that price.


Guess I've been getting ripped off on Amazon. I know the chips themselves are like $1 so I just went with what I usually find them for in a nice package. I love the wemos D1 mini, where do you get yours?


They're < $3 shipped on aliexpress. Shipping is slow, but that's cheap enough to just have a few on hand for when you need them.

https://www.aliexpress.com/wholesale?SearchText=wemos+d1+min...


About a year ago I looked into buying a large number of Wemos Minis and selling them on Amazon FBA, more as a capitalist experiment with my kids than to make real money. Turns out they're priced very close to optimal for selling there with minimal profit. In other words, you're paying for the convenience of Prime shipping, but nobody is making a killing off your $7 purchase.


I bought too many and thought the same thing.

Thought I could compete against all the nodeemcu boards.

Once I looked into amazon fullfillment, the margins went way out and I wouldn't make anything... And lose money if didn't sell quickly.


I just got an Arduino Mega beginner plus 37 sensor kit for xmas. I'm really excited to try out some of these different tiny SoC gadgets, especially looking at trying to build a basic hand-held tricorder since that has been an obsession of mine for a while. I also want to try out the mesh networking with either the ESP8266 or ESP32.

All my gifts were bought from Amazon, mostly for the speed of shipping and arrival. But I may just look closer at aliexpress or banggood to see what they have.

Thank you for sharing the link!


>Shipping is slow

I bought 30 latest revision d1 mini plus a few other shields, payed AliExpress premium express shipping.

The express shipping came out to 20$ (you can play with quantities to maximize items for bulk shipping price from same seller... Like remove one d1 mini to add 4 components to keep shipping price the same or add a few d1 mini till price changes and go back down 1 quantity, it's tiered.).

Item arrived to Canada within 10 days (came DHL).

This was back in November.


I get mine on banggood because they take paypal. Probably in between amazon and the other chinese web retailers in price.


How're you powering the ESPs? It sounds like you have them distributed quite a bit. Are you running coin cells? Dedicated 5V wall warts?


Most 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.


Coin 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).


It may be an option if using (super)capacitors and only transmitting / receiving for a short fraction of time.

https://hackaday.io/project/28527-solved-esp8266-powered-by-...


I stand corrected. By combining that with low-leakage wakeup timer ICs and low-leakage supercap, one could indeed design a device that runs for months on a single coin cell (transmitting every few hours).


Do make sure to check the leakage specs on a supercap, though. They tend to have pretty high leakage current, which may clobber your power budget in low duty cycle applications.


Is your project open source. I've been wanting to build that exact sensor network for a hunidor



One option is to use 3.7v lipos[0] with a regulator[1], which can be done pretty cheaply:

[0] https://www.aliexpress.com/item/10pcs-3-7V-260mAh-Lipo-Batte...

[1] https://www.aliexpress.com/item/5pcs-Ultra-mini-DC-3-7V-4-5V...


Funny that I buy those exact same LiPos for my quadcopters, and never considered using them for an ESP8266. How much time do you get out of those if you're using a DHT22 sensor?


Funny enough, a battery-powered DHT22 is my next project, so I don’t know yet! But in my other experience the expensive part is powering on the radio, which spikes to 200-300mA at startup and then will sustain around 80mA as long as it’s on.


Well, I'm running a test with 2xAA batteries. With a modified version of https://github.com/rcarmo/azure-iot-esp-01-minimal-cpp that only wakes up every 15m to send a single multicast packet and the power LED removed, the battery's still at 3.08V after two months :)


Wall warts. Most of mine are deployed in places where recharging a Lipo would be a nuisance.


Agreed, awesome chips. Another neat option you can get in us or for a third the price from China, is the witty cloud board. Comes with esp, light sensor, and led, button, and removable USB programmer board. Plus USB power. For about $3.

I've used them for kids lights, a chicken coop door controller, remote temperature monitor, and garage door controller. It's nice as a software person to be able to control and monitor real world things exactly how I'd like too.


You can get bare esp8266 boards from aliexpress for ~$1.20 per unit shipped from china. You'll have to solder slightly more, but if you're building things with these, this is the way to go.

I did my prototyping on the much nicer (more features added out of the box) esp8266 Huzzah from adafruit. Once I got the code and everything working, I bought a bunch of the cheap ones + the sensors and then went to town. You can manage a fleet of them with the mongoose os stack https://mongoose-os.com/ (note that the fleet management of 40+ sensors is a paid service, but all of the libs otherwise are free and oss).


Curious what are the uses for this kind of thing? Large properties that need basic wifi coverage?


Also, I know it might be sacrilegious around here to suggest it, but it's also possible to program the ESP8266 with "javascript" [0] using Espruino [1].

It's worked very well in my experience, even just as a fun experiment to say that I could.

[0] Javascript is in quotes because it's not a fully compliant javascript engine.

[1] https://www.espruino.com/


Micropython also exists, and works pretty well across a variety of microcontrollers, this one included. The big thing it lost was good tracebacks, but it seems reasonably performant.

There are also lua implementations that run on a variety of microcontrollers.

Maybe give ~anything else~ one of those a try instead.


I'm one of those insane people that actually likes Javascript, so I tend to actually flash espruino to my ESP8266 chips unless they need to be battery powered (where compiled is still the only way to get them to last long enough in most cases).

But I did try out lua and quite enjoyed it (lua being another of my preferred languages), and never really felt the need to tryout micropython. How is performance with micropython? and how does it differ from "regular" python?


Mongoose OS also let's you use a stripped down version of Javascript. It has some other really nice features (OTAs out of the box, MQTT, Bluetooth GATT on ESP 32, etc). Unfortunately it's a bit restrictive if you want to use it commercially


One issue with the ESP32 (which otherwise seems superior to the ESP8266 in many ways [BT, 2 cores, more RAM]) is that it doesn't yet reconnect to WiFi if it gets disconnected.

See this ongoing issue on github: https://github.com/espressif/arduino-esp32/issues/653


They are both cheap, but the esp8266 based boards are considerably cheaper.

Unless you need Bluetooth, most people are going with the cheaper board


ESP32 also has 2 cores, which might affect how you design your application.


As well as quite a bit more RAM, which was the key for me. The difference between ESP32 and ESP8266 in price for a few units is modest on AliExpress ($7 vs $2.50), relative to the price of the other components I'm putting together.


Does it transmit like a POST request? If so that is cool. I always feel bad using a Pi Zero for one purpose.

I had a project in mind of making a smart poster that was open buttons on a flat piece of paper that you shorted with your finger with an id. You'd bind this button to a server event and it would be powered by ambient rf signals.

Gotta read up on this.


Yes, you can do POST requests. I usually use a protocol called MQTT, originally developed for industrial pipeline telemetry and controls that's now getting a lot of use in the IoT world. Good luck, this stuff is super fun.


Thanks I look forward to it.


Check out https://home-assistant.io

Works great with mqtt, and one of biggest IoT home automation communities.

I use about 20 wemos d1 mini boards off AliExpress (esp8266 board) with various sensors


Thanks for the tip.

What I have to figure out forexample how to power this thing with semi-prolonged burst say through a cap. I was looking at the specs briefly it's like below 300mA but 3. Something volts for "load draw"


>>> 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.

One thing to keep in mind. Your fire insurance might not cover that.


That’s interesting! My ESP8266’s don’t have many GPIO’s, only 8 pins total.

Are you using some small SMD package or a breakout board?


Here'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.


LoRaWAN packet received at record distance of 702 km | https://news.ycombinator.com/item?id=15201692

Specifically mention of two Ubiquiti M900 (~$130 each) for line-of-sight internet from home.

Related discussions:

https://news.ycombinator.com/item?id=15246659

https://news.ycombinator.com/item?id=15480551


Maby contact these guys: https://wlan-si.net/en/

They are(were) deploying wifi mesh networks on the cheap in Slovenia. They've covered entire towns that did not have internet access in the past (mesh network in the town + string of directed antenna to get an uplink from a bigger town). Routers they used cost in the range of 15€ each, but the last time I talked to them they had trouble supplying new routers.


Thanks for the link, I will definitely get in touch with them. Paying for the equipment isn't the issue I don't think, it's the expertise and looking for.


Uhhhh. 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.


I 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. :-)


The Heltec 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) 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


Your links sent me down a rabbit hole of Iot stuff and now I'm super excited about it. Had no idea that lte-m is so widespread.

It's only a matter of time before it's easier and cheaper to get any kind of networked devices onto a carrier network than the users wifi. The implications are kinda scary though: does this mean it's only a matter of time before the majority of personal devices talk to their users with a telco/govement middle man network?


Is a cell phone based system an option?

Reliability is going to be the hard part.


It's not totally out of the question but from what I can see it would be prohibitively expensive after a while, whereas an upfront cost for some low-cost networking hardware that would then get its Internet connection from my home router would be much cheaper in the long run. I think.


I bought a huawei 4g mobile wifi device off ebay for about 25 quid earlier this year, and have a 3 sim card (the huawei device is branded 3 anyway, but they don't lock them) with 20Gb/mo data for 15/mo but you can get cheaper contracts since you don't need that much data. I run it from 12v, pretty sure you could mount it on an electric weelchair..


curious how much you are paying for 15GB / month? just wanted to compare with Canada.


sorry I forgot the pound sign don't show on HN ..its 15 pounds sterling per month for 20GB


ah no worries...just wanted to see how much we are behind the rest of the world.

so 15 pounds in CAD is ~ $25

so 15 pounds for 500mb/month in Canada...


You can pick up three sim cards prepaid with 12gb data for about £23 on occasional sales which last 12 months if you don't use the data.


If you're not using a lot of data a mobile phone is a great way to do it. Low end Android phones are cheap and surprisingly powerful. Prepaid phone plans are inexpensive.


ee pay as you go offers 100mb for 30 days for £3.

Gonna be hard to beat that, cost-wise, with anything reliable and covering a large area.


Cost-wise Three.co.uk/datareward is pretty good. 200mb free every month.


Two 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".


Thanks 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

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.


Very neat!


Thanks, 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/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.


I 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 :)


Thank 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!).


Ah, 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.


Yeah, 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?


> 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.


Ah, lots of paid work is always good news. I'm looking forward to reading about your next project, it helps with my inspiration as well. Make sure you don't spend too much time working, fun is important.


It'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.


>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).


That'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.


> Think how much that would help in cases of disaster: earthquakes, tsunamis, hurricanes, wars, and so on.

Don't forget censorship… :)


Has 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.


This 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)


Interesting, I remember reading some documentation from Espressif's website early on that claimed 50+, but can't seem to find it now.


This 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.


Battery 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


Schedule 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.


> 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.)


External high accuracy RTCs with builtin alarms like the ds3231 can be had for cheap


I don't really see the need for external NTP. The mesh needs to coordinate internally, it doesn't need to agree with the world.

Staying awake 10% of the time seems like a decent improvement on staying awake all the time.


I'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!"


Did you hear about Freifunk? https://en.m.wikipedia.org/wiki/Freifunk It's more or less what you described.


For 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


Do 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?


It'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-comb...


That's nice, but it would seem more useful at 915 mhz...


why?


433 mhz isn't open for unlicensed use in North America.


Why v4 NAT instead of IPv6?


Dynamic 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.


Could 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?


"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.


Thanks! Will peruse over coffee


Why even use routing instead of switching (bridging network interfaces)?


L2 bridge of WiFi access point to anything else (like wired Ethernet, for example) "just works".

On the other hand, L2 bridge of WiFi station to anything else (including STA<->AP bridge for a repeater operation) is quite messy: it needs special "4addr mode" packets which are only sent in "WDS" mode, which should be enabled on corresponding uplink AP. And WDS is universally disabled out-of-the box. Many cheaper routers don't have WDS at all. Plus, there are different incompatible flavours of WDS. Finally, there is question of WDS/4addr mode support on ESP8266 itself - in theory, there is some support in SDK, but I haven't seen any working application code doing it.

Some in-depth discussion of WDS with diagrams:

https://wiki.openwrt.org/doc/howto/clientmode

https://www.dd-wrt.com/wiki/index.php/WDS#Note_about_WDS_and...


Is this interesting (or at least relevant) for the freifunk project?


Whats 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?


The amount of possible chained NATs gave me an aneurysm.


Why can it only do about 5mbps?


5mbps 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

[Hidden node problem] https://en.wikipedia.org/wiki/Hidden_node_problem


Could 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?


IUNGO is a blockchain based project to do exactly this:

https://medium.com/@iungo/iungo-global-wifi-networks-is-abou...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: