LoRa - Long-Range R...
 
Notifications
Clear all

LoRa - Long-Range Radio for IoT | Arduino, ESP32, RPI Pico

82 Posts
5 Users
34 Likes
4,198 Views
(@davee)
Member
Joined: 3 years ago
Posts: 1709
 

Hi @inq,

   Regarding the wake-up methodology, there was indeed a rather lengthy forum discussion, (and if my failing grey cell is correct, that discussion was a spin off from another one), but in terms of 'what to do', I started a new thread, which includes a back reference to its predecessor, should you have trouble sleeping.

Power Off Sleep Circuit based on Real Time Clock (DS3231)  to be found at

https://forum.dronebotworkshop.com/technology/power-off-sleep-circuit-based-on-real-time-clock-ds3231/

Hopefully, that will explain what I know and  what I don't know.

In short:

For me, it started as providing some help for @byron, who wanted to use an external Real Time Clock (RTC) to boot up an R-Pi Pico W, when its alarm time matched a preset time.

On boot, the Pico would then run a short (seconds at the most)  webserver session, send some status information by WiFi, set the next boot up time on the RTC, and reset the RTC to cancel the present alarm and cut the power to the Pico.

It relies on an external real time clock ... based on DS3231, which is now an Analog Devices part, part of the legacy acquistion of Maxim. For cheapness, it (maybe a clone, who knows) can be bought for about £3 from the usual bazaars EBay. etc on a module, including coin cell battery (or at least the holder). e.g. https://www.ebay.co.uk/itm/295634923723?_ul=GB

Note there are other modules with the same chip around .. from the adverts, I don't see any major advantages of the others. Maybe a minor advantges of not needing to remove the unwanted resistor array or slightly smaller PCB, depending on which one you choose. But they are usually more expensive...

It is necessary to remove (and discard) at least one tiny surface mount part, a 6 legs - 3 resistors array. Probably do it with an ordinary soldering iron, but a hot air  soldering tool is more genteel.

The actual circuit is trivial, essentially 1 tiny FET and a resistor. For some reason, I could only find small FETs in tiny SMD packages. Hence hot air soldering tool, and an SMD to DIP pin converter PCB, also from eBay or similar, are needed. (It is feasible that a bipolar transistor could be used, but I am not sure if it would pass more leakage current, and it requires another resistor.)

In principle, almost any microcontroller board can be used instead of the Pico, provided it has an I2C interface to control/preset the RTC. The Pico battery supply was 4.8V, but it has 3.3V regulator on board, so the I2C interface was 3.3V which suited the RTC.

The RTC is not directly connected to the microcontroller battery, and so only the external FET needs to be rated at the microcontroller battery voltage.

I haven't checked if there are any issues with a 5V microcontroller. I suspect it will be fine, but be aware of the I2C interface voltage must stay within the RTC and microcontroller limits. I suspect you will be using a 3.3V microcontroller, so this shouldn't even be an issue.

Except when the microcontroller board is booted, the RTC clock is only powered by its coin cell, and when not booted, I couldn't detect any current flow to the Pico (from the Pico's battery) with my multimeter, so microcontroller battery discharge is effectively only that used whilst it is in the booted state. Time for next boot can be set to any future time from a few seconds later to about a month later, with 1 second resolution.

To show that it 'works', I adapted some Arduino C++ library code to boot up the Pico, and set the alarm, etc. It is messy and unoptimised disgrace, but hopefully shows the basics of what must be achieved.

I hope that, is enough for you to evaluate whether it is likely to meet your needs. As always, I'll try to answer any questions.

Good luck and I hope you have a good bee keepers suit. Best wishes, Dave


   
Inq reacted
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7076
 

@inq It's not solid yet, but it's coming. Today it is 43/6. We don't get access to the garden until next spring, so still some time. My health will be the limiting factor. I see my Dr Dec 5, and hopefully, he will give me a referral to the cardiologist (I want an Electrophysiologist, but that requires a multi-day trip to Toronto) but that could take 6 months.

Ver 1.0 will just be moisture so I should be able to get that done and can add in the other pieces when I can.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
Inq
 Inq
(@inq)
Member
Joined: 2 years ago
Posts: 1900
 

Posted by: @davee

should you have trouble sleeping.

I can always use good sleeping material from you.  😉 

I really don't have a feel for how much power is needed to run these things and certainly not LoRa.  I'm now seeing posts of running ESP8266 on a watch battery type things or for years on a AA.  I'm not really needing that hard core of a minimum solution.  I thought all these processors had a sleep mode and an RTC that would re-awake it at some given time already integrated into it and I'd only have to do software research and programming.  I get the feeling you're circuit is trying to go for the minimalist world record.

Me... I'm only talking about it booting, running just enough time to gather sensor data and LoRa to the server, wait for a reply and shut down.  I'd think the whole thing would be way less than a second and I'd probably only do it once every 15 minutes.  And I'm quite willing to put an 18650 cell on it.  I'd have it check the voltage too and send it as part of the package so I could go out and replace it.  From what we're learning with the Bee-Keepers Association meetings, I'm suppose to open them up at least every other week anyway.   If it ran for say a month without having to change the battery out, I'd be happy with that.  I was trying to avoid dink'n around with solar cells and all that charging circuitry.

VBR,

Inq

3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, WiFi Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266...
Even usable on ESP-01S - Quickest Start Guide


   
ReplyQuote
Inq
 Inq
(@inq)
Member
Joined: 2 years ago
Posts: 1900
 

Posted by: @zander

Today it is 43/6.

I thought you were metric dude.  Those can't be C... and for my money, I don't do anything sub 20F outside.  6 would freeze this southern boy solid a few steps outside the house.

Posted by: @zander

referral to the cardiologist (I want an Electrophysiologist, but that requires a multi-day trip to Toronto) but that could take 6 months.

That's what I hear is coming our way with our medical industry.  I got a taste this morning and just spent 3 hours in a waiting room, just to get my blood drawn for my semi-annual checkup.  On the flip side, by the time I got home, they'd already run it, my doctor evaluated it and put his notes on my patient portal that I was good to go!  

3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, WiFi Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266...
Even usable on ESP-01S - Quickest Start Guide


   
ReplyQuote
(@davee)
Member
Joined: 3 years ago
Posts: 1709
 

Hi @inq,

   The RTC suggestion was aimed at the "power up ... do something quick .... power down" style of operation.

  I didn't measure the time taken on each wake up, or care too much, but my demo code only prints a few lines to the Arduino serial monitor each time it wakes up. My intention was only to show something that could power up and power down when required.

I was leaving it to @byron to figure out his web server code, etc.

By eyeball, it looked like 3 or 4 seconds on screen. That is longer than the code I personally wrote would have taken to execute, (except perhaps the serial printing slowed it down), but would have included any Pico boot up time, etc. My understanding is that Byron was going to use a 'reasonable' size battery and only a few wakes per day, so the ultimate in minimising power demand whilst booted was low priority compared to removing power loss during the power down time.

---------

The alternative is indeed to use the built-in timer facilities. There is another (also lengthy) discussion on the forum along those lines, about using ESP32 to issue an animal call to keep the animals recently moved to the area happy, although I am not sure you will learn much from it.

-------------

In principle, using a microcontroller's built-in timer looks attractive, and if you  are hoping to sell a million or more, avoiding the need for an extra chip becomes a no brainer, but quite often, such low power modes seem to require a lot of reading of long data sheets, etc., and don't always work as well you hope.

Part of the side discussion referred to the Pico low power mode not working correctly, and I think I recall limitations with the ESP32 as well. Remember, most of the boards discussed on this forum include things like USB connections for programming, voltage regulators, and so on, all of which demand power 100% of the time the board is powered. The units that run for years on a coin cell have all of that infrastructure ripped off, and they even have to make sure the PCB doesn't have any fingerprints that may conduct as much current as the sleeping processor, to achieve the full battery life. 

----------

So I can see the advantages for someone just wanting a few units, using a separate RTC, and only powering the microcontroller for the 'active' period, and for that reason tried to help Byron achieve that.

--------

Hence, if you can make an ESP8266 or similar do the whole job in one go, and achieve the theoretical power savings, then fine. You have a much better understanding of the ESP8266 at the 'low level' than most of us on this forum, which I am sure puts you in a stronger position.

Alternatively, you may wish to consider using a separate RTC, and have the microcontroller completely unpowered, except for when it needs to do something. Since the whole microcontroller board is only powered when needed to do its 'measure and chat' work, the extra drain from voltage regulators, etc. are less important. This thread just suggests a practical solution for a few dollars. It may well give a reasonable life from 3-4 AA cells or an 18650.

--------

I don't mind which way you choose, but I recommend you think through the pros and cons before rushing to the keyboard. Battery powered, 'always on' systems using low power sleep modes require some extra steps that can be tricky.

Hope this helps a little. Good luck with the project.

BTW I am trying to catch up with Inqegg, etc. but I clearly need to catch up with my background reading!

Best wishes, Dave


   
ReplyQuote
Inq
 Inq
(@inq)
Member
Joined: 2 years ago
Posts: 1900
 

Posted by: @davee

I don't mind which way you choose, but I recommend you think through the pros and cons before rushing to the keyboard. Battery powered, 'always on' systems using low power sleep modes require some extra steps that can be tricky.

Ahh!   That explains it.  I've been looking at the code and the sleep call is a u32 in µSeconds.  So max sleep period is ~1.2 hours.  I see he needs some kind of outside control to do larger sleep periods.

Posted by: @davee

'reasonable' size battery and only a few wakes per day, so the ultimate in minimising power demand whilst booted was low priority compared to removing power loss during the power down time.

I've been reading some of these "1 yr on a AA" and the ESP8266 is only 20 µA, but the bigger issue is the voltage regulator usage during that time powering that minuscule 20 µA.  I see that is the big waster... not the MPU. 

For instance, I have these in my parts bins https://amz.run/7HuA and it no-load rating is 0.65mA.  Even with these and an 18650, and if my calculations are correct, says it'll go over several months.  Since, I'll also monitor voltage, I'll know long before it goes out.

But I can see why you designed an external depowering device for @byron and his design.

VBR,

Inq

3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, WiFi Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266...
Even usable on ESP-01S - Quickest Start Guide


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7076
 

@inq I am not sure what code you are looking at, but I do recall a misunderstanding about that and the actual sleep call is u64. Keep in mind this is only a vague recollection so could be off, but I look at these things and say if I was doing this would I have used a u32?

Ahh!   That explains it.  I've been looking at the code and the sleep call is a u32 in µSeconds.  So max sleep period is ~1.2 hours.  I see he needs some kind of outside control to do larger sleep periods.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
Inq
 Inq
(@inq)
Member
Joined: 2 years ago
Posts: 1900
 

Posted by: @zander

@inq I am not sure what code you are looking at, but I do recall a misunderstanding about that and the actual sleep call is u64. Keep in mind this is only a vague recollection so could be off, but I look at these things and say if I was doing this would I have used a u32?

The article I just finished reading said the u32, and I just now checked the ESP8266 horse's mouth... and it say...

image

So, yes it's a u64, but reading the fine print... it still says the maximum is 2^31 - 1... which is really an s32 maximum... thus 35 minutes.  So it's even worse than I thought. 😉 

 

3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, WiFi Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266...
Even usable on ESP-01S - Quickest Start Guide


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7076
 

@inq I speak both F and C. So that was 43F or 6C. If it weren't raining cats and dogs, I would have gone out today to check the marsh water levels. I would wear a long-sleeved shirt and a light (no insulation) jacket in the Spring and Fall. For us northern dudes, 20C is quite comfortable; it is on the low side of inside room temperature. If I am outside walking and there is no wind, temperatures down to 50F 10C is comfy in a long-sleeved shirt and if blue sky, then even a short-sleeved shirt. My windows face south, but like I said, there is no sun today. Still, my heat has yet to turn on since 0500. I have my house set to 73 (not calibrated) and 55 overnight so that less than 2 hours of heat (anticipation turns it on ahead of the 5 AM wake-up) is all we have used today. We have just entered golden hour, and sunset is at 1708. The thermostat is set to 73, and the room temp is 74. I use F still because there are 180 divisions between freeze and boil, while C has only 100. That means F is 9/5 finer divisions, which means the room temperature has fewer fluctuations.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7076
 

@inq A test is in order. I will bet that u64 is correct.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
Inq
 Inq
(@inq)
Member
Joined: 2 years ago
Posts: 1900
 

I need to ask a stupid question and it's embarrassing.  I know nothing, zero, nada about RF.   The external antennas with the little socket...  

 

image

That fine little wire from the socket to the antennal... is that coaxial???  It looks like there are two contacts in the connector.  Most of these boards only have one pin for the antenna.  Even @dronebot-workshop's video shows just a single piece of wire for the antenna.  If I need a better coax antenna in the future... how do I connect a coax to one pin?

3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, WiFi Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266...
Even usable on ESP-01S - Quickest Start Guide


   
ReplyQuote
Inq
 Inq
(@inq)
Member
Joined: 2 years ago
Posts: 1900
 

Posted by: @zander

@inq A test is in order. I will bet that u64 is correct.

Are we talking about the same MPU?  

... so you don't trust a 10+ year old document by the company that designed and sells the chips... that's in revision 4.0, released this year to have never corrected an oversight as drastic as confusing a u64 maximum versus an s32 maximum value???  

... and I thought I was cynical.  😋 🤣 

 

 

 

3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, WiFi Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266...
Even usable on ESP-01S - Quickest Start Guide


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7076
 

@inq All I can say is first of all who would design it that way, secondly I remember a discussion around that very topic. If search was working, a search for 64 would likely nail it down.

Maybe I am misunderstanding, but would not a common application of a deep sleep interval be 24 hours? 

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7076
 

@inq I just looked at my antennas. They use coax. The center pin is one half, the outside is the ground. An actual antenna can be only 1 wire but the coax has to be two that's why its called COax.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
Inq
 Inq
(@inq)
Member
Joined: 2 years ago
Posts: 1900
 

@zander... you know I'm teasing.  The emoji indicates that.  

I'd be willing to test the bottom end... at 30 odd minutes of 2^31... but a u64 is 585,000 years.  I'll leave that test to you.  🤣 

I've never used sleep modes... so I'm can't be a valid judge of what others might want.

VBR,

Inq

3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, WiFi Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266...
Even usable on ESP-01S - Quickest Start Guide


   
ReplyQuote
Page 2 / 6