10 ms·
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
by acidburnNSA 9y ago
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.
- 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).
- bilkow 9y agoIt 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-coin-cell https://hackaday.io/project/28527-solved-esp8266-powered-by-...
- Kelbit 9y agoDo 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.
- fest 9y agoI 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).
- paulie_a 9y agoIs your project open source. I've been wanting to build that exact sensor network for a hunidor
- fest 9y agoIt is now: https://github.com/festlv/esp32-temperature-humidity-sensor https://github.com/festlv/esp32-temperature-humidity-sensor
- egwynn 9y agoOne 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-Battery-with-X5-5in1-green-Charger-for-JJRC-H8-Mini-Eachine/32795774607.html 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-5V-to-3-3V-DC-DC-Step-Down/32653810603.html https://www.aliexpress.com/item/5pcs-Ultra-mini-DC-3-7V-4-5V...
- rcarmo 9y agoFunny 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?
- egwynn 9y agoFunny 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.
- rcarmo 9y agoWell, I'm running a test with 2xAA batteries. With a modified version of https://github.com/rcarmo/azure-iot-esp-01-minimal-cpp 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 :)
- dws 9y agoWall warts. Most of mine are deployed in places where recharging a Lipo would be a nuisance.
- JshWright 9y ago$7? Where are you spending that much on them? The D1 Mini is my favorite breakout, and it's half that price.
- acidburnNSA 9y agoGuess 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?
- azdle 9y agoThey'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+mini https://www.aliexpress.com/wholesale?SearchText=wemos+d1+min...
- sowbug 9y agoAbout 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.
- sergers 9y agoI 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.
- bloopernova 9y agoI 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!
- feistypharit 9y agoAgreed, 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.
- SEJeff 9y agoYou 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/ 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).
- jadbox 9y agoCurious what are the uses for this kind of thing? Large properties that need basic wifi coverage?
- IgorPartola 9y agoIf 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!
- sunsetMurk 9y agocan you share some links to where to buy? where to learn some basics? thanks!
- heegemcgee 9y agoTayda and SmallBear market to the hobbyist maker. They stock common ICs and components, and don't mind small / single unit orders.
- IgorPartola 9y agoAliExpress.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_257103054.html https://www.aliexpress.com/store/group/WeMos/1331105_2571030... https://m.aliexpress.com/s/item/32765214054.html?spm=a2g0n.search-cache.0.0.654b53c7bIPB6N https://m.aliexpress.com/s/item/32765214054.html?spm=a2g0n.s... https://m.aliexpress.com/s/item/32454217006.html?spm=a2g0n.search-cache.0.0.7cd925064YMgE 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.
- 9y ago
- carbocation 9y agoOne 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 https://github.com/espressif/arduino-esp32/issues/653
- sergers 9y agoThey are both cheap, but the esp8266 based boards are considerably cheaper. Unless you need Bluetooth, most people are going with the cheaper board
- ktta 9y agoESP32 also has 2 cores, which might affect how you design your application.
- carbocation 9y agoAs 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.
- Klathmon 9y agoAlso, 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/ https://www.espruino.com/
- traverseda 9y agoMicropython 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.
- Klathmon 9y agoI'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?
- Rebelgecko 9y agoMongoose 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
- matt_the_bass 9y agoI 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.
- jdietrich 9y agoThere 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-guide/installing-the-esp8266-arduino-addon https://learn.sparkfun.com/tutorials/esp8266-thing-hookup-gu...
- stctgion 9y agoThere's also micropython https://docs.micropython.org/en/latest/esp8266/esp8266/tutorial/intro.html https://docs.micropython.org/en/latest/esp8266/esp8266/tutor...
- curioussavage 9y agoI 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.
- komali2 9y agoElectric 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.
- m-p-3 9y agoThe 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.
- jcun4128 9y agoDoes 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.
- acidburnNSA 9y agoYes, 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.
- jcun4128 9y agoThanks I look forward to it.
- sergers 9y agoCheck out https://home-assistant.io 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
- jcun4128 9y agoThanks 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"
- tzs 9y agoThe 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.
- rcarmo 9y agoOn 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 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.
- 9y ago
- nightsd01 9y agoThat’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?
- user5994461 9y ago>>> 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.