Aggressively Low Power with the ESP8266

Ғылым және технология

I wanted to see how low power the ESP8266 could be if it was no longer constrained by the infrastructure of 802.11. The results were shocking. Power savings was INCREDIBLE. Watch this video to see the results and my process.
To support projects like this and get early access, visit my patreon: / cnlohr
Repositories of interest:
github.com/cnlohr/tplink-raw-...
github.com/cnlohr/MinEspSDKLib
Watch my test, live: docs.google.com/spreadsheets/... (NOTE: I will be trying different calibration data periodically)
Here is a static image of the power usage: / 953020454939348993
Watch this test, in real time... docs.google.com/spreadsheets/...

Пікірлер: 201

  • @bdot02
    @bdot026 жыл бұрын

    I love some of the stuff Andreas had done. He's one of those hidden gems of KZread.

  • @n0sr3v

    @n0sr3v

    6 жыл бұрын

    Me too. When i heard CNLohr referring to Andreas i thought: Nice, things getting serious now! (My two favourites Tech-KZreadr's united

  • @Galeere2

    @Galeere2

    5 жыл бұрын

    @@n0sr3v dont forget Marco Reps. This Trio would be unstoppable

  • @norm1124
    @norm11246 жыл бұрын

    That's cool to see solutions accross channels being developed further.

  • @SeanHodgins
    @SeanHodgins6 жыл бұрын

    Awesome idea with the google sheets. I hadn't thought of that and will definitely be using it for future projects.

  • @nikita240s13

    @nikita240s13

    6 жыл бұрын

    That google sheets stuff blew my mind. Definitely going to use that.

  • @CNLohr

    @CNLohr

    6 жыл бұрын

    I've been looking for some way to do this for ages and it's almost like editing sheets programmatically is deliberately painful. I was SO GLAD to have found this!

  • @hopkinskong

    @hopkinskong

    6 жыл бұрын

    I made an AT firmware to submit data to Google Form long time ago, but seems no one using :) github.com/hopkinskong/esp8266-at-firmware-googleform

  • @KucharJosef

    @KucharJosef

    6 жыл бұрын

    Because nowadays almost everyone use the esp8266 as platform itself. It's not just WiFi arduino module for a long time

  • @joseluisbruquiles8934
    @joseluisbruquiles89344 жыл бұрын

    Fantastic work!! Love when all the knowledgment of serveral people mixes and gets improved to this levels. I haven't tested that router OS but certainly i will soon. Seriously really nice work!

  • @piero957
    @piero9576 жыл бұрын

    Each of your videos is a precious gem. Keep on so we can dream about living in the future.

  • @CNLohr

    @CNLohr

    6 жыл бұрын

    We're already living in it :-D

  • @photocromax
    @photocromax6 жыл бұрын

    Waking up the esp by a interrupt, it could become a responsive "raw-wifi" button using the router as mqtt client for home automation, skipping all the needed time for the handshake and IP protocol. Of course a kind of encryption to make raw packet "safe" for the system will be needed. As always...great job!

  • @CNLohr

    @CNLohr

    6 жыл бұрын

    Thanks!

  • @aerobyrdable
    @aerobyrdable6 жыл бұрын

    Keep going, CN. The world needs more of this.

  • @CNLohr

    @CNLohr

    6 жыл бұрын

    I will!

  • @tommihommi1
    @tommihommi16 жыл бұрын

    You could probably save power by taking off the LED ;-)

  • @CNLohr

    @CNLohr

    6 жыл бұрын

    I may, but as the voltage decays, the current going into the LED will be less and less. Plus it's only on during the early boot process. Actually... I probably will when I re-run the test with new batteries instead of all the used ones I keep finding.

  • @4.0.4
    @4.0.46 жыл бұрын

    You're awesome, man. Keep at it!

  • @holtzda
    @holtzda6 жыл бұрын

    Everything in this video is incredibly brilliant! Thank you.

  • @CNLohr

    @CNLohr

    6 жыл бұрын

    thanks

  • @AndersNielsenAA
    @AndersNielsenAA6 жыл бұрын

    OR you could use an attiny + nrf24l01+ and run it two years on a single CR2032 coincell (replacing the router with an ESP8266 with a nrf24l01+ slapped on it).

  • @murraymadness4674

    @murraymadness4674

    2 жыл бұрын

    Or a msp430 + nrf2401 not only physically smaller than a fingernail but uses even less power

  • @MikePoirier
    @MikePoirier6 жыл бұрын

    Awesome. Love it. Thanks for sharing.

  • @korishan
    @korishan6 жыл бұрын

    This is awesome!! Great video. I stumbled onto your video through the YT rabbit hole. This is a great project to add to my project of custom BMS for lithium based off-grid power storage. A few of use are building the BMS based off of TI's BQ76940 IC and want to be able to have communications via wifi with minimal impact to the packs voltages. Even if this wouldn't work for the powerwall application, it'd be great for remote and/or mobile projects like eSkateboards and eBikes, etc. Thanks for the info and hard work!! 🤠

  • @CNLohr

    @CNLohr

    6 жыл бұрын

    Thanks. Keep working away!

  • @Fifury161
    @Fifury1616 жыл бұрын

    Awesome work - thanks for sharing!

  • @CNLohr

    @CNLohr

    6 жыл бұрын

    Thanks

  • @deangreenhough3479
    @deangreenhough34796 жыл бұрын

    Stumbled across you😀 big fan of Andreas Spiess. Really caught my attention, you have another subscriber and thank you so much for sharing. 🙏

  • @CNLohr

    @CNLohr

    6 жыл бұрын

    Thanks!

  • @geochacon
    @geochacon6 жыл бұрын

    Pretty cool! It is mind boggling how many tools are available. This is the future, and it is a complex and fun future!

  • @zachreyhelmberger894
    @zachreyhelmberger8943 жыл бұрын

    LOVE this!!

  • @ProtoG42
    @ProtoG426 жыл бұрын

    Great video!

  • @CNLohr

    @CNLohr

    6 жыл бұрын

    thanks

  • @DigitalMetal
    @DigitalMetal6 жыл бұрын

    Awesome!

  • @CNLohr

    @CNLohr

    6 жыл бұрын

    I don't know how I never noticed your youtube channel until now.

  • @sellicott
    @sellicott6 жыл бұрын

    Really cool! I love your sneaky use of Google services for data acquisition. I would also like to thank you for being one of the few overtly Christian engineers on youtube that I have found.

  • @papaman1037
    @papaman10376 жыл бұрын

    Great stuff

  • @michelepace5972
    @michelepace59726 жыл бұрын

    this is amazing. thanks

  • @tiger12506
    @tiger125066 жыл бұрын

    Holy cow! Just when I think you're done coming up with game-changing ideas.... BAM. Right now I'm messing around with HC-06 modules, but I promise I'll some day be working off your stuff to make ESP8266 driven sensor nodes.

  • @CNLohr

    @CNLohr

    6 жыл бұрын

    I don't know what you're referring to with sensor-driven nodes.

  • @tiger12506

    @tiger12506

    6 жыл бұрын

    Right now, I'm thinking about having several, small, cheap wifi connected thermometers that I can strategically place where they might be useful, such as near pipes that might freeze, etc. Small and battery powered, stick some two sided tape to the back and forget it, yet sending me back data at regular intervals. A bunch of other things come to mind as well. Pilot light watchers, flow meters, relay actuators. Not having to run any cabling for any little thing I might want to control or sense is enticing. Just a really complicated way to say "thank you for the video". :-)

  • @UselessDuckCompany
    @UselessDuckCompany6 жыл бұрын

    Really cool

  • @jabalahkhaldun3467

    @jabalahkhaldun3467

    3 жыл бұрын

    hi verified man

  • @mj8ac
    @mj8ac4 жыл бұрын

    CNLohr I watched this video when it first came out, fantastic video. Love your other ones too. How long did the esp go for in the end?

  • @CNLohr

    @CNLohr

    4 жыл бұрын

    It was depressingly short. I believe it was something like 10 days. :(

  • @pasettodavide
    @pasettodavide6 жыл бұрын

    Super project, can't wit for a follow up video

  • @CNLohr

    @CNLohr

    6 жыл бұрын

    The current tests aren't going well. I'm going to have to figure this out.

  • @SatyajitRoy2048
    @SatyajitRoy20486 жыл бұрын

    Mesmerising

  • @WilliamDye-willdye
    @WilliamDye-willdye6 жыл бұрын

    Very cool. In some applications we can live without 802.11 if it gives us a big drop in power consumption.

  • @kevinmclane1201
    @kevinmclane12016 жыл бұрын

    Great work, I was a little bummed that the ESP-Now bit did not happen.

  • @CNLohr

    @CNLohr

    6 жыл бұрын

    I did get a chance to experiment a lot with ESP-NOW for this, because I thought that was going to be the right answer, but as I kept experimenting it ended up not doing all it was billed to do :-/

  • @kevinmclane1201

    @kevinmclane1201

    6 жыл бұрын

    I know that feeling!

  • @andrewyupetrov
    @andrewyupetrov6 жыл бұрын

    Oh, those Russians... =)

  • @aerobyrdable

    @aerobyrdable

    6 жыл бұрын

    Rasputin?

  • @CNLohr

    @CNLohr

    6 жыл бұрын

    Nope. PVVX (Victor)

  • @blockcamp

    @blockcamp

    4 жыл бұрын

    @@CNLohr Russia's greatest love machine

  • @Bravefsj
    @Bravefsj6 жыл бұрын

    super cool,as always

  • @CNLohr

    @CNLohr

    6 жыл бұрын

    thanks

  • @polskafan
    @polskafan6 жыл бұрын

    This is amazing. I wanted to take a look at ESPnow as the bootup and wifi logon times are too long for a little home automation project of mine. This is just so much better. How would you go about adding encryption or at least have messages digitally signed so you know they come from your ESP?

  • @CNLohr

    @CNLohr

    6 жыл бұрын

    If it were me, I'd use static keys. I'd kinda have a thing where you can set up the ESP to transmit with a given key and channel. Simply block-encode your message, provide an random seed, and the encrypted message every beacon, then decrypt it on your central receiver.

  • @shanerigsby9030
    @shanerigsby90306 жыл бұрын

    Great video with a ton of things to ponder. Correct me if I'm wrong, but what I understood is that you'll have a little esp8266+coin cell or similar traveling around with assets, broadcasting periodically, and if in range of one of your openwrt routers, they can talk. So, each particular router would be given a location name, e.g. "Warehouse B," and each esp will be identifiable, probably by MAC address, so that your google sheet will display that this esp (and by proxy its associated asset) is at this location (the range of the router). Is that correct? One hurdle would be that you have locations near enough to one another to have overlapping coverage. What's the plan for that? Do you have the flexibility to send whatever you wish, not just a voltage figure? I assume so and I suppose your wakeup cycle would send its broadcast and wait a given time for a response, which could include the router's location name to be stored to memory before resuming deep sleep. (Incidentally, Andreas did a video on storing data to RTC so it survives deep sleep.) Thus, the esp's broadcast could include the last known location as well as voltage, which is naturally useful for detecting when it finally runs out of battery. I've played around with an Amazon dash button that was well priced, maybe $2 including its battery, and could sniff its broadcast packets with a device in promiscuous mode. I was wondering if the openwrt router has to be in promiscuous mode as well? Got me wondering if the asset tracking is overt or covert...if overt, you could easily just "check in" an asset by tapping its dash button when it arrives at a new site.

  • @ShirishJadav162
    @ShirishJadav1626 жыл бұрын

    impressive stuff. well, I also worked with esp8266 coupled with atmega328 as a controller that handles and stores data in its EEPROM and certain wakeup policies were defined. We go the power very low and (watchdog timer waking every 4/8 seconds)RTC (rough as we did not require accurate timing and could sync again after some time). we achieved low power operations that could work for a long. But it can be said it wasn't real-time and that project was later abandoned and we moved over BLE. though we started that wifi thing to work with 3 coin cells but it never worked so we moved to highly efficient DC-DC converters (don't remember exactly) but I have with me battery operation data. In middle, we improved firmware just before we had abandoned project. In future, I wish to make that project open schematics and program. You work is impressive. definitely reducing up time helps. thus DTMI option is also a good solution. I didn't know Google sheet thing.. Can I use it with ESP32/ESP8266 directly sending data to sheets(no need of low power)?

  • @CNLohr

    @CNLohr

    6 жыл бұрын

    Hmm... I think I should do a video about the "secret" ESP8266 sleep mode, in which it is not connected to an AP doesn't go into deep sleep, but the processor remains alive (just waking up every few ms). It only uses about 1-2mA IIRC. AND you can send packets from this mode with minimal wakeup costs. Google sheets can absolutely can be used directly if no need for low power!

  • @saeedbafaqas8116
    @saeedbafaqas81166 жыл бұрын

    Thanks alot for the great video. That's so nice, but this is consider a modification into the esp and the router to work as Wireshark sniffer. Which I can understand it's not even connecting the router as the router catch the flying packets. I got an idea based on what you have done for people who have many of ESP's which battery powered and get it reporting to one ESP working as a sniffer (directly powered) and post thier data it may saves more power that the router. (I can think of it but I don't have the knowledge to do it) but you may search it out if you find it interesting.

  • @CNLohr

    @CNLohr

    6 жыл бұрын

    You could do that, but that's extra hardware. If you have a home router, why not use it to do everything. No extra hardware, or power!

  • @vladpuha
    @vladpuha6 жыл бұрын

    Amazing..

  • @Timothy3001
    @Timothy30016 жыл бұрын

    Seems like RAW wifi is a really interesting thing to look into... Would love to see it being used for FPV with drones. This might lower latency a lot and also enable digital video transmission in "real time".

  • @JamesChurchill

    @JamesChurchill

    6 жыл бұрын

    That's exactly what 'wifibroadcast' does, and for exactly that application - check it out!

  • @CNLohr

    @CNLohr

    6 жыл бұрын

    Indeed, and this shows it is possible to do on the ESP8266!

  • @Timothy3001

    @Timothy3001

    6 жыл бұрын

    That's really cool. It would be great to actually use one ESP8266 as a bridge or broker between low power ESP wifibroadcaster and the 'real' network. This would open up a whole new level of cheap and diy smart home devices. Not sure if there would be an advantage to LoRa though, except regarding the price. I have a question though, since I don't know much aboutthe wifi protocols: How safe is the communication? I mean, encryption wise I'd guess there is none or is there? The WPA is a shared secret though that could actually be easily used. But more important: Are there also acknowledge packets sent? Or is wifibroadcast fire and forget?

  • @peterkis4798
    @peterkis47986 жыл бұрын

    My code is doing the whole wifi connect, bme280/MAX44009 measurement, http post, enter deep sleep stuff around 653ms with arduino! I use fixed wifi ip(with dhcp!), modded the HTTPClient lib to exclude the dns request and use ip to connect to the server. On server side i also close the connection before the db insert. Sometimes the wake time goes up to about 1.5sec for some reason but its much better than the 5-10sec mentioned in the video.

  • @CNLohr

    @CNLohr

    6 жыл бұрын

    I have been able to see that kind of speed for those sorts of systems, but it's still an order of magnitude higher :-/

  • @tino6121

    @tino6121

    6 жыл бұрын

    Hi Peter, do you have an example on github ?

  • @peterkis4798

    @peterkis4798

    6 жыл бұрын

    Yes, github.com/nepeee/WifiEnvMeter

  • @peterkis4798

    @peterkis4798

    6 жыл бұрын

    Just for a try i done the same with arduino & esp8266 2.2.0 lib ~100ms with sensor stuff (something broken with deep sleep without rf cal above 2.2.0). Sample code: wifi_set_opmode_current(STATION_MODE); wifi_set_phy_mode(PHY_MODE_11B); wifi_set_channel(1); wifi_promiscuous_enable(1); while(1) { if (wifi_send_pkt_freedom((uint8_t*)&frame, sizeof(struct FRAME), 1)==0) break; yield(); } ESP.deepSleep(SLEEP_PERIOD * 1000000, RF_NO_CAL); With rf cal the wake time is about 250ms

  • @c2h7
    @c2h74 жыл бұрын

    Wouldn't it be easier to just send a single ICMP or UDP packet straight to the cloud server, saving requiring a custom modified accesspoint? I currently wakeup, measure temp (DS18) and send the data via http to an influxDB server, and goto deepsleep all in under 400ms, I assume moving from TCP to plain IP would be even faster, the data handling part is about 200ms.

  • @electrobob
    @electrobob6 жыл бұрын

    Andreas Spiess has a video about ESP Now, which is designed for such short messages. But i like your approach better and it seems to take half the time.

  • @CNLohr

    @CNLohr

    6 жыл бұрын

    ESP-NOW Really expects to be able to link to other specific ESPs. This is not feasible for situations where you would want to broadcast. Also, the ESP-NOW while supporting broadcast does not support unassociated reception, so that's out.

  • @pauldusa
    @pauldusa2 жыл бұрын

    My old 465 scope I use to use at Sony back in 1979

  • @CNLohr

    @CNLohr

    2 жыл бұрын

    Nice

  • @mindpixel3142
    @mindpixel31422 жыл бұрын

    روعة !!! +متابعة Just amazing !

  • @mohammadislm
    @mohammadislm3 жыл бұрын

    Very smart. Where can I find the latest solution to this? I see PVVX's MinEspSDKLib repo was not maintained for past 5 years. And your fork is about 3 years old. Do you still have that as the latest best solution? Or is there other better alternative in handling the power consumption of the ESP8266? Please advise.

  • @CNLohr

    @CNLohr

    3 жыл бұрын

    Sadly, still this. Who knows, maybe something new may be coming with the ESP32-C3

  • @IOANNISLEFTHERIS
    @IOANNISLEFTHERIS3 жыл бұрын

    Inspirational video! How is compared using ESPnow?

  • @CNLohr

    @CNLohr

    3 жыл бұрын

    It _basically_ is ESPNow, except that it can work more easily with other vendors' hardware.

  • @Pixel_K
    @Pixel_K6 жыл бұрын

    It seems there's no more "matching voltage since 1/15 21:38 (By the way Impressive work, as always :)

  • @CNLohr

    @CNLohr

    6 жыл бұрын

    I'm not sure what you're referring to... I did have to do a new run since I found out you just can't recal the esp on battery except when it first starts.

  • @michalchoma6112
    @michalchoma61126 жыл бұрын

    I make weatherstation with sleeping anbd esp12. After sleep, it measure temperature, connect to internet and send data to thingspeak. It takes around 4 seconds - 3 seconds. But definetely, here is much more better. Thanks.

  • @CNLohr

    @CNLohr

    6 жыл бұрын

    Yeah, I want to chase this down a little further but don't know where I want to be with it exactly.

  • @n0sr3v
    @n0sr3v6 жыл бұрын

    Have you considered using ESP-Now? (takes around 200ms with avg. of 80mA, i know this is a bit worse than your solution and requires a second ESP as Gateway, but wouldn't it have been easier? Apart from that the time maybe can be improved?) ESP-Now gets rid of the whole TCP-IP Stack and there are already some library's out there.

  • @CNLohr

    @CNLohr

    6 жыл бұрын

    ESP-Now's primary issue is that it expects to link to other ESPs, EXPLICITLY. I don't want to have things linked. I want to be able to use it like a walkie talkie and use broadcasts. Espressif says ESP-Now supports this, but after significant experimentation, I found that it was written to work, but there are lower-level issues with the type of packets that they send en broadcast that can be received by things like the TP-Link but not other esp's!

  • @n0sr3v

    @n0sr3v

    6 жыл бұрын

    Ah ok, i see, it was dumb to think you had not considered it :) Great work by the way, love your videos!

  • @Almighty11
    @Almighty116 жыл бұрын

    Have you thought about undervolting the ESP? This seems the kind of application where instability is tolerable (you're not computing any safety-critical values). Since power consumption scales as voltage squared, that could make a significant difference I imagine (I'm assuming the current also lowers with lower voltage, not sure if true). I believe the most important factor (other than voltage itself) affecting chip stability is temperature, so you might have to find out the worst case temperature and find a borderline-stable voltage (maybe you can accept like 30% failure to send package?) at such temperature. Edit: Oh if that power is being used to for wifi TX antenna (instead of digital processing) then I guess that wouldn't change much... although it might be worthwhile to see the minimum TX power you can get away with too.

  • @CNLohr

    @CNLohr

    6 жыл бұрын

    Check out the real time graph. The ESP is quite effectively undervolting itself! :-p Right now it's down around 2.5V when under draw. Actually you can see the temperature differences to when light his the batteries and ESP at around 9 AM.

  • @deadbeef16
    @deadbeef166 жыл бұрын

    Awesome. Does the phy layer still check, if the medium is busy before transmitting?

  • @CNLohr

    @CNLohr

    6 жыл бұрын

    I have no way to check for certain but my expectation is yes, because I am firing up the PHY in the normal powerup cycle.

  • @Mr.Unacceptable
    @Mr.Unacceptable6 жыл бұрын

    I'm so frustrated I don't have your skills. Cool idea to use the Google doc.

  • @CNLohr

    @CNLohr

    6 жыл бұрын

    Just start! Like start making. You can't jump from A to Z, but you can get another letter down the alphabet every few days!

  • @aajpeter
    @aajpeter6 жыл бұрын

    Supercool

  • @ismaelmercier6464
    @ismaelmercier64644 жыл бұрын

    Very cool. So how long can it last with the 2 coin cells?

  • @CNLohr

    @CNLohr

    4 жыл бұрын

    Waking up every minute, only about 1 week I think.

  • @norrischucknorris101
    @norrischucknorris1012 жыл бұрын

    im looking at a home automation project, was curious on why espnow didnt work? too much battery use? Also as a relative noob, this video is super helpful, but what if anything else would i need to add/change to get it to chirp out a sensor reading instead of just voltage? thanks!

  • @CNLohr

    @CNLohr

    2 жыл бұрын

    You can chip out anything you'd like. It's pretty straightforward. And I think the reason it didn't take off was because it didn't fit the mental model of what people were looking for. Not based on any technical issue.

  • @zhahaistewart6575
    @zhahaistewart65756 жыл бұрын

    I'm looking at the post-transmission power usage at about 5 minutes in. Since it seems to be sending a small unreliable one-way packet, is there any reason that it has to stay powered up at the 70mA level for around 15 ms after the packet is transmitted? You mention it staying powered up "in case" it needs to do something, but unless it's waiting to receive something after sending, it should be able to power down quickly - perhaps dropping the energy per packet by another 30-50%.

  • @CNLohr

    @CNLohr

    6 жыл бұрын

    For this application it could save that power, but, for my target application it would need to do that.

  • @dtesta
    @dtesta5 жыл бұрын

    Is it possible to use an esp8266 on the "receiving end"? I would imagine a "server" esp8266 that listens to the sender. When it gets a package, it changes itself to a wifi client and connects to the normal wifi network and send the data to the "cloud" and then goes back into server/monitor mode. This would remove the need of a modified/flashed router. Did you look into this? Is this possible? Thanks!

  • @rpavlik1
    @rpavlik16 жыл бұрын

    This is really, really cool. Now if only I had chosen better for my routers ("IoT/IP Cameras" dedicated is a linksys E2500v3 IIRC, main is TP-Link Archer C8 aka untweakable unlike C7)... I don't think my airspace can tolerate too many more networks, performance on everything dropped when I was setting up and testing the new router for my parents. This approach would be a lot more flexible than my current plan of wall-power-bound ESPs talking MQTT. Are you using "old" OpenWRT or LEDE? I'll have to look into how much flexibility I can get with the Google Forms data collection...

  • @CNLohr

    @CNLohr

    6 жыл бұрын

    LEDE _is_ OpenWRT now. It took a while but everything is being re-integrated.

  • @CNLohr

    @CNLohr

    6 жыл бұрын

    Oops didn't mean to hit submit. Also, you can directly talk to the google forms for data collection. But yeah, that's a bummer about the C8.

  • @rpavlik1

    @rpavlik1

    6 жыл бұрын

    CNLohr cool, good to know. (My next router I'll check third party firmware before buying, I foolishly assumed tplink was reasonably moddable since I'd heard good things about the series.). But I've still got a wrt54gs and two e2500s to work with. Just not enough oomph for a symmetric 300Mbit connection.

  • @electronash
    @electronash6 жыл бұрын

    Nice vid, as always. I'm hoping to use this to modify N64 and Dreamcast joypads with an ESP module. I already have a UDP joystick app on Android working great for controlling the N64, but I haven't had much luck getting an ESP32 working in an original joypad as yet. I was using the Arduino IDE for the ESP32, and while I could successfully send the request to the joypad (and see the returned data on the o'scope), I could NOT get interrupts to trigger on a pin change? I tried different input pins, made sure I set the pin as an input, and with the proper pull-up resistor, checked the GPIO matrix etc. Nope, no interrupt triggering. lol Probably something glaring that I missed tbh, but I'll try an ESP8266 next. I just need it to request the button / joystick values at say 100 Hz, then send a small packet. UDP seems fine for this so far, but obviously the methods in this vid would massively increase the battery life in the joypad, and it only needs to be picked up by the ESP on the N64, so no router needed. (I could probably just grab the response from the joypad in the main loop, but it made sense to me to use an interrupt routine to measure the bit widths. Also a modest data rate to receive, so I kept missing bit transistions when using a loop, believe it or not. Again, probably my crappy "code". lol) Andreas does some awesome vids on the ESP modules. Definitely a recommended channel for like-minded techie stuff.

  • @electronash

    @electronash

    6 жыл бұрын

    I just realised that even sending a packet within 100ms still won't be able to reach my refresh target of 60-100ms, but then you don't need anything near that rate for asset tracking etc. EDIT: Oops - 60-100 Hz, I meant. I'm interested to see which parts of the code take the longest to run after the ESP leaves Deep Sleep. I'll probably just need to keep the ESP running as normal, and just use some bigger batteries. :p

  • @CNLohr

    @CNLohr

    6 жыл бұрын

    I should find out if you can turn off the radio's RX and still transmit packets. I don't think you can but I should test it.

  • @electronash

    @electronash

    6 жыл бұрын

    CNLohr Interesting. I never thought of that. lol Yeah, it might not save a huge amount if the Rx can be disabled, but a saving nonetheless. It's possible the Rx amp is disabled when the Tx PA is active, and may have a flag bit for each? I don't know if WiFi always has the same receive freq as the Tx carrier pulse either, but perhaps there are two separate oscillators as well, and a bit to disable the Rx one? (Although, the PLL is probably fast enough just to switch between frequencies if need be, or do spread-spectrum?) I'm kind of addicted to using ESP modules after watching channels like yours. I use them in most projects now. I just designed a small board with an ESP8266 and some MCP4922 DACs (and SD slot), so I can finally make my RGB laser projector work via WiFi or stand-alone. ;) But, I STILL managed to swap two pairs of pins and screw up the SPI, due to silly "copy n paste" laziness. lol

  • @electronash

    @electronash

    6 жыл бұрын

    CNLohr This is the Mini N64 board I designed. Only 10cm square, but with HDMI, FPGA, and SDRAM (for eventual cart ROM "emulation"). My first ever 4-layer design, and definitely the most complex. Notice the same bodge wires for the ESP SPI pins, but yeah, it boots. lol... imgur.com/a/4RuNy For the earlier tests, the "UDP Joystick" app on the phone was just broadcasting via the router to the ESP on the main board. The onboard ESP then just writes those values to the Cyc III FPGA (on the underside), which handles all of the PIF chip stuff for the real N64 chipset. No noticeable added lag with the controls.

  • @jeffbeck6501
    @jeffbeck65016 жыл бұрын

    Fucking genius.

  • @photocromax
    @photocromax6 жыл бұрын

    Have you tried using another esp8266 to capture raw packets and then do the requests to an available router? It should work even with those routers can't have openwrt, or can't set the interface to monitor mode.

  • @CNLohr

    @CNLohr

    6 жыл бұрын

    That would work but why make something more complicated when you can make things simpler?

  • @photocromax

    @photocromax

    6 жыл бұрын

    CNLohr You're right, I was just thinking about a generic solution not related/constricted to any hardware already in place.

  • @0xbenedikt

    @0xbenedikt

    6 жыл бұрын

    This solution is also net generic as it is tailored for the esp8266. Just adding a modded router in the place of the second esp may be a lot more universal. This should also work with other models.

  • @sairfan06
    @sairfan063 жыл бұрын

    Did someone test in this scenario like how many devices can successfully submit the data, for example 100 or more ESP connected to such router and if there was any data loss?

  • @CNLohr

    @CNLohr

    3 жыл бұрын

    Data loss is probable but probably very low rate of data loss. As these chips still perform CSMA to reduce the change of them stepping on each other's transmissions.

  • @asdcdweadasd
    @asdcdweadasd5 жыл бұрын

    >watch it blink >cuts away from esp to a screengrab >aaaand blink yo...

  • @LorenzoClemente
    @LorenzoClemente2 жыл бұрын

    have you (or anybody else) tried to get data back to the ESP8266 with this approach?

  • @CNLohr

    @CNLohr

    2 жыл бұрын

    I have. It works. But it's trickier. I don't have any example code, unfortunately.

  • @unknown_channel_name
    @unknown_channel_name5 жыл бұрын

    Just curious what are the application of this ?

  • @LucasHartmann
    @LucasHartmann6 жыл бұрын

    I wonder how long will it take for IEEE to come up with a WiFi-LE standard.

  • @CNLohr

    @CNLohr

    6 жыл бұрын

    Please... No standard.

  • @BukkitViper
    @BukkitViper6 жыл бұрын

    How exactly would I send raw data from my ESP8266 to my computer without any network in between? Did you use a network connection in the video or are the packets just floating aimlessly through the air? Thank you

  • @CNLohr

    @CNLohr

    6 жыл бұрын

    Packets floating aimlessly through the air! Tis the perfect way to do it! Most wifi cards in computers also support monitor and managed mode.

  • @BukkitViper

    @BukkitViper

    6 жыл бұрын

    I've looked at your code. Which lines exactly are transmitting the data?

  • @CNLohr

    @CNLohr

    6 жыл бұрын

    The esp freedom line

  • @BukkitViper

    @BukkitViper

    6 жыл бұрын

    And how do I send data frames? I cannot finde the correct header

  • @CNLohr

    @CNLohr

    6 жыл бұрын

    Honestly, I just fire up wireshark, and dink with the packets until they look like what I want them to look like.

  • @c0r0y
    @c0r0y6 жыл бұрын

    So what do I do if I just want to get notifications from an ESP8266 for over a few years without changing/loading batteries and I want to use my casual AVM Fritzbox router? Means as a noob I am as dumb as I was before watching this video. :/ A sketch or something like this would be very appreciated.

  • @CNLohr

    @CNLohr

    6 жыл бұрын

    I don't know what a fritzbox is. It doesn't really work with Arduino as it is, really need to do the C thing, but, I can try to document more...

  • @Ruslan-ym4db
    @Ruslan-ym4db4 жыл бұрын

    Hello. Pls tell how to flash your Minimalist Sdk. Thank you

  • @CNLohr

    @CNLohr

    3 жыл бұрын

    You basically just build a normal ESP8266 project - I made a tutorial on building ESP8266 projects recently. You then take the minimal SDK in the same environment and build.

  • @eurobum2012
    @eurobum20126 жыл бұрын

    what if you didn't need to send your data to the cloud. Is it possible to record the data locally at the router?

  • @CNLohr

    @CNLohr

    6 жыл бұрын

    Absolutely! Sending to the cloud was just for fun!

  • @madrian_hello
    @madrian_hello5 жыл бұрын

    It would be great if someone make a version where Instead of router use regular wifi stick in a pc - probably with mqtt support. 😀

  • @CNLohr

    @CNLohr

    5 жыл бұрын

    If you use Linux, you can use a regular wifi thing in a computer, just switch it to "Monitor mode"

  • @con-f-use
    @con-f-use6 жыл бұрын

    Charles seriously, how do you manage to do so much stuff? Don't you work, or sleep? Ah, I see. "We live in the future", huh? You build a time machine, didn't you?

  • @CNLohr

    @CNLohr

    6 жыл бұрын

    It's the sleep thing. I'm down to around 5 hours a night. Work about 9 hours a day, work job #2 about 2 hours a day, sleep for 5. Church-stuff for on average 1.5... That leaves SIX POINT FIVE HOURS TO DO AWESOME STUFF.

  • @Svinogalya

    @Svinogalya

    6 жыл бұрын

    CNLohr, you seems a smart guy... how it possible you mess with such stupid thing created for stupid people as religion?

  • @CNLohr

    @CNLohr

    6 жыл бұрын

    It took me til I was 24 to finally dig in and find out how wrong my assumptions were about everything I thought and what drove me. After a pretty serious come to Jesus moment, dug in, and still haven't found a question worth answering without an answer.

  • @korishan

    @korishan

    6 жыл бұрын

    Ask me anything about it, and I can give you an answer, from scripture, and with explanations that make sense and have meaning. Not answers like "it's a mystery" or "we aren't meant to know" or the like. That is, thru PM, not thru comments. Too many hecklers that like to spam

  • @batarale
    @batarale Жыл бұрын

    Is there similar approach with ESP32 and router in monitor mode? Anyone can point in the right direction?

  • @CNLohr

    @CNLohr

    Жыл бұрын

    Yes. ESP32's support ESP-NOW. Not monitor mode, but close.

  • @punit_patel
    @punit_patel6 жыл бұрын

    Did you tried "Node-RED" and "mqtt" , for making automatic scripts in no time.(Flow Based Programming.)

  • @CNLohr

    @CNLohr

    6 жыл бұрын

    MQTT requires a network connection, so it won't really work in this application.

  • @punit_patel

    @punit_patel

    6 жыл бұрын

    ok got it. also check out my energy meter opi0.ddns.net/emeter/ (Hosted on OrangePi takes some time to load.)

  • @oliverisenschmid1332
    @oliverisenschmid13326 жыл бұрын

    hey. could anyone calculate the batterylife if using 3 rechargeable AAs (3.6V, 3900mAh) and transmitting once every hour? I'm too stupid edit: using this exact method of course

  • @jesuishalil
    @jesuishalil6 жыл бұрын

    Pair it with a op amp and you got yourself a wireless voltage meter!

  • @CNLohr

    @CNLohr

    6 жыл бұрын

    Indeed that would be possible! Either-or, though. You can't monitor the 3.3V rail _and_ external voltage.

  • @AlbySilly
    @AlbySilly6 жыл бұрын

    I'm gonna give a laptop a new life and looking for which OS I should use

  • @CNLohr

    @CNLohr

    6 жыл бұрын

    I recommend Mint Mate. Be sure to use Mate if running on older hardware.

  • @jamesgrimwood1285
    @jamesgrimwood12856 жыл бұрын

    4:16 - your scope was last calibrated how long ago? ;-)

  • @CNLohr

    @CNLohr

    6 жыл бұрын

    1978... but it's ok! I checked it against my Kelvin 50LE. It was in cal. I know because I haven't yet replaced its battery. (When the battery dies you throw them away)

  • @peekpt

    @peekpt

    6 жыл бұрын

    dude, old teks are awesome, I have a 7603 still going fine.

  • @iasenkostov6525
    @iasenkostov65254 жыл бұрын

    Nowadays it wakes up faster - less than a second while opening a TCP control socket and initializing OTA and uses about 16uA in deep sleep.

  • @CNLohr

    @CNLohr

    4 жыл бұрын

    That's ten times as long as 100ms.

  • @iasenkostov6525

    @iasenkostov6525

    4 жыл бұрын

    @@CNLohr Yea but you do not open a listening socket and setting up server and OTA :)

  • @CNLohr

    @CNLohr

    4 жыл бұрын

    @@iasenkostov6525 I'm doing what needs to be done. I still get full two-way communications.

  • @iasenkostov6525

    @iasenkostov6525

    4 жыл бұрын

    @@CNLohr I should test it with your setup to see the real difference. Btw I'm not even sure how long it takes coz it's repurposed code from another project with different idea. I can only be sure that it's less than a second.

  • @GoatZilla
    @GoatZilla3 жыл бұрын

    Have you run into any WiFi.status() bugs?

  • @CNLohr

    @CNLohr

    3 жыл бұрын

    I don't use or recommend arduino. Sorry.

  • @rwitriol
    @rwitriol Жыл бұрын

    "Milliamps of power" ??? I thought amps were for current and watts were for power. Precision in language makes one seem more authoritative.

  • @CNLohr

    @CNLohr

    Жыл бұрын

    Trivially convertible. milliamps at 3v is milliwatts.

  • @rwitriol

    @rwitriol

    Жыл бұрын

    Amperes are units of current Watts are units of power

  • @CNLohr

    @CNLohr

    Жыл бұрын

    @@rwitriol If you know the voltage then that's irrelevant. Because they will then mean the same thing.

  • @rwitriol

    @rwitriol

    Жыл бұрын

    @@CNLohr Amps are current Watts are power Because you can compute one from the other if you know the voltage doesn't change that

  • @davidmorabitofuentes1165
    @davidmorabitofuentes11655 жыл бұрын

    Here's the link of Andreas' video: kzread.info/dash/bejne/e42pu7aff5nPf9Y.html

  • @elucas1234
    @elucas12346 жыл бұрын

    Hi, I can’t find the tplink code at, github.com/cnlohr/tplink-raw-wifi. Did you remove it?

  • @CNLohr

    @CNLohr

    6 жыл бұрын

    SORRY! I totally forgot to switch it to a public repo!

  • @biker2k3
    @biker2k34 жыл бұрын

    ESP-NOW

  • @k1ngjulien_
    @k1ngjulien_6 жыл бұрын

    So the ESP basically just UDP's the shit out of its packets and hopes that there is an OpenWRT router nearby to look for its packets and recieve them, is that correct? Interesting approach :D

  • @CNLohr

    @CNLohr

    6 жыл бұрын

    Kind of but this is a level-and-a-half below UDP.

  • @pablok

    @pablok

    6 жыл бұрын

    Excellent pilot! It would be awesome to know how power usage is affected if UDP is used instead of raw IP packets, so the project is a better neighbor if running on a non exclusive wifi network. Did you test it somehow?

  • @kriskeersmaekers233
    @kriskeersmaekers2336 жыл бұрын

    I was working on something similar, and I managed to knock down the wifi connection time to about 0.3 seconds by saving last ip configuration and reconnecting as a 'static' ip (0.3 seconds after startup) This project is perfectly timed for me :D wait, you cheated by hacking the router, never mind :s

  • @peterkis4798

    @peterkis4798

    6 жыл бұрын

    I done almost the same but i also changed the http(using a remote server) lib to use ip instead of the host to save the dns request time but i'm only getting about 650ms time. Strange :S

  • @Jindraxx20
    @Jindraxx205 жыл бұрын

    So in order to get this working someone has to have a tp-link router and hack it up?? Isn't there any other solution ?!

  • @CNLohr

    @CNLohr

    5 жыл бұрын

    This uses a TP Link router out of convenience. However, you could put a Linux computer's wifi card into monitor mode.

  • @BlueBetaPro
    @BlueBetaPro6 жыл бұрын

    What do you mean by "acid tracking"?

  • @CNLohr

    @CNLohr

    6 жыл бұрын

    At what time?

  • @BlueBetaPro

    @BlueBetaPro

    6 жыл бұрын

    00:09. Did you say "asset tracking"? So tracking where things are?

  • @CNLohr

    @CNLohr

    6 жыл бұрын

    correct!

  • @qwertykeyboard5901
    @qwertykeyboard59013 жыл бұрын

    me: d cells, many d cells ALL THE D CELLS

  • @mcflapper7591
    @mcflapper75916 жыл бұрын

    Thanks for this vid. Comes handy, maybe we'd swap stock fw w/ your minEspSDKlib. In docs.google.com/spreadsheets/d/1oay41nWtpytSJAVGPSehMkfOp5g8D0GKNWIzqUzic_0/edit#gid=1212757165 you mention full RF cal wouldn't be feasible on bat. Have you tried adding bigger caps? Here it is possible to use a single 18650 with a big enough cap (here:1500uF) bridging the PWR spike on bootup/RF-cal. The spike has been determined to be at about 370mA. Then another problem keeps creeping up: every few PWR cycles (we do complete ones using a digispark and mosfet circuitry, still using a single 18650 cell) the esp8266 is locking in in a state where it is sucking 370mA continuously. W/o breaker this ruins bat life and probably before that it would be killing the esp8266. We need a complete PWR disconnect for the esp to recover from this kind of hickup. There's also this interesting page: www.ondrovo.com/a/20170205-esp-self-destruct/ . Did you experience this behaviour yet? edit: Using fixed IP makes wake-up/RF-cal and reconnect a 1-3 sec ordeal on PWR on. Better than 6-10secs for DHCP, anyway. Additionally, using DHCP in poor WiFi Rx/Tx risks dropping packets and running into re-Tx w/ timeouts involved. You certainly do not want this on a battery-run project. So, either fixed IP or your approach. Another thing worth mentioning is: espSDK now supports a complete WiFi stack kill button (and by this I don't mean the sleep mode thingy). Just for gaining some extra battery life, this alone might be a great try (i.e. an offline data logger). For projects that needs some kind of radio com it's not that big a deal. ;)

  • @CNLohr

    @CNLohr

    6 жыл бұрын

    I have honestly never seen any problem like the self-destruct thing. Even in our thousands of swadges... But on the other hand, I'd never consider de-powering an ESP once online. I have seen AVRs exhibit this behavior in rare cases, but generally I fix it by making sure we never slowly ramp-up voltage. Re: DHCP: If you use custom firmware on your router, you can actually wake up, do WPA2 + DHCP in about 1.6 seconds from power-on, but, most routers run awful DHCP servers. The problem with ESPNow is the lack of proper broadcast support. It can send no problem but without association nothing seems to be able to receive.

  • @mcflapper7591

    @mcflapper7591

    6 жыл бұрын

    Making the esp latch on on pwr up isn't actually that hard. Just pwr cycle it until it happens. here it's every 5 or 6 pwr cycles it latches on and keeps drawing 370mA continuously. We're building long-lasting sensors that boot every n seconds and we have to prevent that thing from latching on. It's complicating things considerably. re: boot up in less than 2 secs using DHCP is quite nice.

  • @MaggotNr9
    @MaggotNr95 жыл бұрын

    The problem is if you use this approach you will have to change batteries every 1.5 month for just that simple one packet tranfer. Current of deep-sleep = 20uA Current of booting = 30mA Current of loading = 40mA Current of pre execution = 20mA Current of execution = 70mA Current of going in deep-sleep = 10mA Time of deep-sleep = 9.9s Time of booting = 35ms Time of loading = 25ms Time of pre execution = 15ms Time of execution = 20ms Time of going in deep-sleep = 5ms Times of 10 second interval in minute: 60s/10s = 6 times Times of 10 second interval in hour: 6*60 = 360 times Time of deep-sleep per hour: (9.9s*360)/3600s = 0.99h Time of booting per hour: (35ms*360)/3600s = 0.0035h Time of loading per hour: (25ms*360)/3600s = 0.0025h Time of pre execution per hour: (15ms*360)/3600s = 0.0015h Time of execution per hour: (20ms*360)/3600s = 0.0020h Time of going in deep-sleep per hour: (5ms*360)/3600s = 0.0005h Power drained from deep-sleep: (20*10^(-3))mA * 0.99h = 0.0198mAh Power drained from booting: 30mA * 0.0035h = 0.105mAh Power drained from loading: 40mA * 0.0025h = 0.1mAh Power drained from pre execution: 20mA * 0.0015h = 0.03mAh Power drained from execution: 70mA * 0.0020h = 0.14mAh Power drained from going in deep-sleep: 10mA * 0.0005h = 0.005mAh Total power drainage: 0.0198mAh + 0.105mAh + 0.1mAh + 0.03mAh + 0.14mAh + 0.005mAh = 0.3998mAh R2032 capacity = 240mAh Lifespan with 2xR2032 batteries: (2*240mAh/0.3998mAh)/24h = 50 days without counting for external factors which can affect battery life.

  • @tablatronix
    @tablatronix6 жыл бұрын

    Why cant people say arduino ?

  • @CNLohr

    @CNLohr

    6 жыл бұрын

    forum.arduino.cc/index.php?topic=7016.0 ?

  • @philbowles3240
    @philbowles32403 жыл бұрын

    You really need to understand the difference between voltage, current and "power" which you use wrongly EVERY time you say it

  • @CNLohr

    @CNLohr

    3 жыл бұрын

    Just because I understand it, dooooesn't mean I'm going to remember it. That said, in general I have been trying to improve.

Келесі