#214
ฝัง
- เผยแพร่เมื่อ 21 พ.ย. 2024
- Using a battery for an outdoor project without it running down in a few hours or days?
JLCPCB Only $2 for PCB Prototype any colour: jlcpcb.com/cyt
Please take a few moments to visit JLCPCB and see how well it integrates with EasyEDA.
Let's just go through a few options for my outdoor, battery-controlled project. Although I have a specific use in mind, this could apply to any number of projects that have a mechanism to switch a signal line to ground: burglar alarm pad, PIR detector, push switch... and plenty of others, I'm sure.
We need the following:
1) Battery power, so the device must switch off, whenever possible
2) Monitor the battery voltage so we know when we must change (or charge) the battery
3) Provide the correct voltage to each part of the system
4) Send a wireless signal to a receiver within a few meters
5) Work reliably with no false triggering
Watch video and see the options available to us - and how easy it is to do each part. I'm not providing any code right now as it will change considerably over the forthcoming weeks.
List of all my videos
(Special thanks to Michael Kurt Vogel for compiling this)
bit.ly/TH-camV...
Roger Meier has released version 1.9.0 of his excelled CoolTerm.
I'll talk about the new features in a future video but in the meantime have a look at it:
freeware.the-me...
Remember this is freeware, but if you do find it useful a fiver or any amount donated will ensure the long term longevity of this product. No, this is not an affiliate link!
If you like this video please give it a thumbs up, share it and if you're not already subscribed please consider doing so and joining me on my Arduinite journey
My channel, GitHub and blog are here:
------------------------------------------------------------------
/ ralphbacon
ralphbacon.blog
github.com/Ral...
------------------------------------------------------------------
Please don't forget to use the link to my sponsor: jlcpcb.com/cyt
Stop me if you have heard this before: Teaching, or the transfer of knowledge from one mammal to another, when done well, appears like a very simple process. The receiver or pupil, can actually believe that he/she is putting all the effort into the process. He/she may even feel a sense of achievement that the transfer went so well. In reality, the process isn't simple at all. The pupil is drawn into the subject very subtly and he curiosity is continually being triggered. He WANTS and is eager to know the next step. Can anybody learn to do this? Well, no,; no more than somebody can learn to know how to be the life and soul of a party. You are good at this youTube thing, Ralph, and you are so welcome back!
I'm flattered, Michael, by your kind words. Slightly worried too, as I have no idea what it is that I do, or how I do it. I just tell my audience "stuff". That said, my mum, now 93 and still going pretty strong, always said I should be a (school) teacher. Maybe that's what I've become, after all? Whatever, I'm glad you think it's all worthwhile.
This is a great little project, I need to put a notification on my back garden shed door. My wife gets fervently mad at me when I forget the door open and I can't see it from the house but its only 5 meters away. Its great to see you again, I hate TH-cam notifications because this is the first video notification I got of yours in 5 months. I went back and realized there has been a whole batch of video's...
Well, 3 videos is hardly a whole batch, but I guess it's a good hour's viewing for you, Gene. My wife, too, gets mad at me. That's it. No particular reason 😂
@@RalphBacon lol...right but it was a good watch for the night. Love the new "man cave".
Very nice demonstration of several components Ralph. Thanks. And I use the 'eating an elephant' metaphor with my CompSci students constantly. May have to go to 'How do you eat a bushel of kale?' eventually once global warming makes carnivorism unsustainable. Of course, the answer to, "How do you eat a bushel of Kale?" is, "Feed it to an elephant". :-)
Hang on, Gord, I wouldn't want to eat a _real_ , kale-fed elephant. They taste like chicken, anyway. Glad you liked the video.
Interesting project and nice to be able to appreciate the thought process through the design - things that come to my mind are a daily ‘ping’ from the sensor reporting its battery level and unique sensor number so you add more sensors later and can put the effort in to a central hub which can plot or threshold-trigger for recharging as well as set off reminder klaxons when a lid is left open.
Thx for all your great content.
Great point! As I have 3 bins I will have three of these units and they will have to be uniquely identifiable, not least for the battery level. Which I'll do each time they are opened which is "often". The neighbours might object to the klaxons, though, Chris. I'll tell them it was your idea.
For monitoring my garage doors I use a little Zigbee magnetic switch, linked to home Assistant. Works on cr2032 for years, even notifications on my phone when left open…. But I agree, this is more fun to make 😉. Thank you for making these videos!
Indeed, Freddy, others have also suggested various magnetic solutions but as my bins are not as solid as a garage door they might not be triggered correctly (or reset when closed). A tilt switch is going to be hopefully more reliable in this instance - and more fun to build, just as you say!
Interesting video, I think I would take a different approach though. Assuming you didn't just want to run a wire the 6 feet to your shed (!) I would have the battery connected directly to the Arduino, with the mosfet switching the nRF on and off. By using the power down mode and switching off unwanted sections of the arduino you can get the standby current down to a few tens of microamps, and then you could make the arduino wake up every few minutes, check the tilt switch, measure the battery voltage and then switch on the radio, transmit the data then power down the radio and go back to sleep. This would still give you a good battery life, but you wouldn't need to restart the arduino each time, and your monitoring station would receive regular "lid closed" messages verifying the system is still working, perhaps raising an alarm if the battery voltage drops too low or it doesn't receive a message for 5 minutes or so. Just a thought!
I agree. If Ralph leaves the lid closed for a year and the battery dies he would never know it. Then if he left it open with a dead battery he would not get an alarm. I like to make my projects a little more 'active'. I agree a twisted pair of wires is the better and low tech solution.
"If Ralph leaves the lid closed for a year" 😁
The bins get opened several times a day. Including when it's raining like today! Even if I was on holiday (I remember those, good times) for a couple of weeks it seems unlikely the battery would go from "good (enough)" to "dead" by my return. I'll be sending the battery voltage each time the lid opens. What I do with that is yet to be determined.
@@RalphBacon Looking forward to see the project come to fruition. Lots of good ideas even if I would do it differently.
Happy to see I am not the only one who loves the WIFI radio systems I decided to build another a few weeks ago. That's when the problems began. You see I stopped when I began to believe that there must have been a problem in the design of the EPS32's I was using. They would work for a couple of times but then simply stop. I could upload the software to them again, and then copy my channel setup over, they would play fine but once shut down would start again but with no program and I would have to re-upload. I had a pile of esp32's laying on my desk that I had declared DOA and ordered a different type from a different seller. When the new ones got here, they began to do the same thing. I threw up my hands in disgusts and stopped playing with them, moving on to something else. Then one day I decided to see if that pile of ESP 32's were indeed dead. I grabbed one and loaded the blink program and sure enough it began blinking the onboard LED! So I once again loaded up my radio sketch and played with it, just using the built in stations and it worked fine, I could reboot, no problem. So once again, I loaded my list of stations that I had built up over the months that worked fine in my flat pack build with external speakers, and once again, on reboot, it had NOTHING! Then it dawned on me, perhaps I had to many stations, so I cut out about 12 of them, then reloaded and suddenly I was back in business. There was nothing wrong with the esp32's it was, what we called in the gunsmithing world OPERATOR HEADSPACE! My list of stations was to large and was overwriting that little bit of RAM that contained the setup files` Guess you are never to old to learn, and having just turned 70 last month, this became my living proof of the adage. Oh, 95 degrees F here today, it has been a bright and sunny day till a few minutes ago when the black clouds developed. There have been some horrid tornadoes south of here, hope they stay South of here! Oh thanks a million for the videos, I believe I learn something from each of yours that I watch. It is my firm belief that if you learn something new every day , your mind should stay young and nimble despite the drugs the damn doctors keep pumping in my system to fix this and that, then the ones to counteract the side effects of this one and that one, it's a never ending line of drugs, I keep the drug store alive on just my line of meds. Workers comp is getting angry that I am on so many but screw them. Thanks a million for the great videos any how and keep up the great work.
Happy belated birthday, Jerry, for last month. If I recall correctly, you were married to your late wife for 51 years which means you got married at 19? Wow! At least you stayed together all those years. That's some achievement. And no wonder you miss her.
So back to your "hardware" problem. In effect, then, Jerry, it was a software error that caused the problems with your ESP32s? If there had been some kind of check within the code to limit the number of stations it would never have become a (so called) hardware problem?
As you say, never too old to learn!
@@RalphBacon Yes indeed, when we had our fifty'th the kids threw a big party and invited all the old gang that they knew about and we had a great time. Of course then we had no idea that my wife was developing cancer. It was a coincidence but the day we wed in 1969 was the second day of Woodstock, that big musical concert in New York that made all the news papers, and they were still looking for that Manson Family that cut a bloody path through Hollywood murdering rich white folks and trying to get the news to blame the blacks, thus starting Helter Skelter, the song that Charlie Manson believed was a message from the Beetles to start the battle. He believed that if he could get it going, the blacks would win, and that they would not have the smarts to run things, so he and his family would come out from their underground hiding place in Death Valley and Charlie, being ever so much smarter then the blacks despite his 6 grade education and rule the nation as king. Ah well another dream unfulfilled by another idiot. Indeed, we had a great run, Judy and I, I still tear up a bit when I remember the good times, and our winters alone in Arizona the last few years. What wonderful memories to have and keep. One day, I guess I will feel better and get on with my life although none of us know how long we shall go on, I will live like I will live for ever, and dream like I will die tomorrow. Something like that anyhow. Thanks for remembering.
Interesting, look forward to the 2040 being used!
Not in this project, unfortunately, as the PICO's sleep current is too high. Well, unless the bare chip was used (now only $1 a piece I see). But I know I can get the Arduino down to 0.2uA in Deep Sleep so it will have to do.
@@RalphBacon - Thanks Ralph!
I'm literally on the edge of my seat waiting for more! I can't stay this way forever. 😃
My apologies. I can wait for your creations. I can't sit on the edge of my seat forever. Just to be clear.
Glad you clarified that! But you will have to wait for part 2, 3... 4 who knows how long this will run. Next week, RP2040 thoughts and experiments. But not for bin lids. Hmm, on the other hand...
@@RalphBacon No worries. Just wanted to voice my excitement.
There are many solution to this, depending on your requirements and what you have already. As my HA is all node-red based I tend to use tasmota to monitor a switch state, granted these aren't small battery powered sensors as the either have a mains powered usb supply, or a multi kWh solar charged powerwall. Alternatively I use 433MHz magnetic sensor from banggood and I pick these signals up on an sdr stick using rtl_433, they run on a single aaa for months/years and send a low battery signal too. Bitluni, Kevin Darrah and mr ca diy have good battery powered sensor solutions. The fun comes in seeing what others have done, and then working out a solution that works for us. Great video as always
If I had ever progressed my Node-Red/MQTT project I guess I would be publishing the state of my bins lids and letting other parts of the overall system deal with it. But, as I never did (but never say never) some sort of other wireless signalling has to be used and magnetic sensors would work if I could ensure they were always aligned correctly (which I can't, as they are rickety, but solid, plastic bins, which have a certain amount of "freedom" in where they choose to close!)
Hey Ralph. Welcome back :) (yeah I'm a little late to that party lol) I'm building a sensor network (to monitor various things around the house) with the nRF24L01 radios. I'm using tmh20's library and using the mesh network for easy communication, and then I think my connection to ThingsBoard will have a nRF24L01 on an ESP8266 as the gateway to the ThingsBoard server. tmh20's nrf24 library has some decent support for sleep for devices that don't need to be on either using an interrupt or using the watchdog timer.
Hang on, I used to know someone called Jess. Is that you? 🤣 I've never used a mesh network (isn't there a limit of six devices?). Anyway, I'll speak to you later. 📧
@Ralph S Bacon Only 5 can directly connect to the Master, but the others (up to 255) can connect via the other nodes :) Anyway, I sent an email since TH-cam is really finicky about when it will let me send a comment. It's really annoying :(
love it but if only 6 feet away just hard wire a limit switch to show when closed..lol...hey you need to build a rain detector too! oh and how about a motor driven lid closer...I know your point is really to teach and get people thinking..keep it up...proof it works! Always look forward to your whimsical inventions.
A rain sensor (heated, so we know when it stops raining too) is (sort of next) on my list of things to do as part of this project, as that would be critical. Open lids are one thing; open lids when it's raining is a big problem!
@@RalphBacon DO I foresee a workshop expansion in your near future?
Really useful video Ralph. Opened up some interesting new concepts for me.
Great to hear! We'll continue with this in a few weeks' time.
Interesting. I want something similar for my post box, so I know when the postman has been. Of course what I really want is a camera so I can see what's in the box, and a robot to go down the drive to collect the post, but something like you're doing will be fine to start with!
You forgot the butler to open the post and serve it on a silver platter. On the other hand...
@@RalphBacon The robot would do that! Actually I want this as an early step in creating an IoT, using MQTT and Node Red, but all that stuff would be handled by the receiver, and wouldn't affect what's used in the post box.
Nice project.
Good to see that some failsafe is built it. How would you check if the wires, for the switch, is not broken?
If the wires are broken or battery gone bad, you never get the signal "Lid is open" and you would never know.
Seems someone has been testing DIY skills with a hammer of is it nail polish?
Remember that we have yet to design the receiver, Flemming, and what kind of (visual) indication there will be for lid status. At the very least, I'd expect an active "lid closed" indicator (or "open") on bins I've opened/closed that day so I should realise something was amiss if nothing was shown (eg dead indicator panel). And we haven't even discussed the rain alert...
Yes, I tried to remove my nail whilst building the workshop, taking a long time to repair itself. Didn't hurt one bit. 🤥🤥
Love your videos Ralph as they always get me thinking. So many different options for this project as far as sensors but the template is the same
Great point! Many have commented about mail delivery detection so I'll devote some thought to a fool-proof way of detecting that as the trigger (eg long lever microswitch).
@@RalphBacon Funny that. I have a mailbox at the end of my drive... I await your solution with baited breath... tho I was thinking as mine is within my wifi range I was going to use an esp32 with a hall sensor just to light an LED on one of my desk projects
Hi there just a quick one to say that 18650 has a voltage range for 2.5v to 4.2v I try to only go 2.6v to 4.1v as this does not stress the cells and the number of charging circles is a better. I realise that this is below the the threshold for the Arduino and nrf24 but is a significant amount of charge especially if you have 2 in parallel
That is _very_ low indeed, Paul. But if the datasheet for your particular battery says it's OK then it is. But mine are no-name (or Chinese name) with huge 5,000 or higher capacity (stop laughing) so who knows how low they can go without being damaged. I'm going to be transmitting the voltage whenever the bin lid is opened; I can decide later at what point I replace/recharge the battery.
@@RalphBacon hi there that is a standerd for the chemistry it's not a lipo (bag) stile that extra. 5v mack's a difference
Coincidence of timing ? ...
For a long time, I've been thinking and planning a monitor for my detatched garage. And then a week before you uploaded this, I started working on the wiring writing some code.
Just like a lot of us, I have multiple arduinos and a bunch of NRF24L01 modules lying around, so that's what I'll be using.
My monitor will tell me;
- the open/closed state of three doors
- if the lights are on
- if either heater is running
- if the air compressor is running
- and (with a PIR & sound sensor) if it seems somebody's cat got trapped in there.
I'm also going to report the battery voltage, as well if as if mains power is still charging the battery. And just because I have a few, enough unused pins, I've added a real time clock.
The unit in the house will show the state on an LCD display module and flash & beep if any of the alarm conditions exist.
There's nothing new under the sun, for sure. What I can think of, so can many others too. It would be interesting to see how you get on.
The SCA60C sensor will measure the angle of the bin lids.
They would, indeed. Unfortunately they won't act as a (mechanical) trigger to switch the circuit on, so they would not be suitable for my particular design. But good call.
Great practical and basic project video. Thanks!!!!
Glad it was helpful!
Welcome back, Mr. Bacon. :)
Thanks, Christian, good to be here. Again.
Be interesting to see how much below just the bare MCUs you can get it. :)
Indeed it will. I'm banking on less than 1uA. Any takers?
Great project Ralph. I find the new Arduino ide black screen very hard to see both in live use and on the video.
Hmm, I thought black was the new, er, black when it came to computer screen themes, Mark? I've just tried out the "light" theme and it does look brighter if not clearer. I'll try it that way next time and see what responses I get.
@@RalphBacon Why not green on black like an IBM3270 terminal ?
In a DOS box type color 2 and see what I mean.
Not a mention of your mashed pointer finger, in the video or comments. A bin lid accident?
A workshop build accident that is taking _forever_ to heal (or fall off). Not my finger, just the nail. 😂
@@RalphBacon if its painful you can use a needle to relive the pressure..make small hole in fingernail..
Glad your back with informative videos.
Question: could a Wemos D1 derivative be used in place of the Arduino and NRF?
You _could_ do that, but the design would be quite different.
The Wemos D1 would (presumably) act as a mini web server and a client (another piece of equipment) would then query from that server the state of the bin lids (or whatever it is we're detecting). So instead of a push protocol (from the nRF24L01) it becomes a pull request (from whatever wants to know the state).
Alternatively, the Wemos could log the switch state into the Cloud (eg using ThingSpeak, which is exactly what I do with my mum's activity monitor) for a client (app on my phone) to retrieve at leisure.
As I said, a different topology but logically it could be done.
@@RalphBacon Thank you for your reply.
The ESP8266 used in Wemos D1 has a sleep mode by grounding one pin (16?) There are tutorials with ESP8266 in deep sleep mode out there. Google for ESP8286 sleep mode.Not so low power as in this example but still lower than self discharge of a 18650.
Hi Ralph, have you looked at the rf-nano, 328p with micro usb and built in radio
I glanced at one, but it's (relatively) pricey, don't you think? And whilst I considered using the WiFi it was more complicated than a simple nRF24L01 setup. Let's hope I don't regret that decision!
@@RalphBacon Fair enough, My use case was for a small rc tank project, but I liked the micro usb and not having the kludgey adapter between the nano and nRF24L01, I think I got two for about £16 ish but that was pre-cov. Cheers
Why not add a solar battery charger so no need to change the battery.
Thank for another good video
I _could_ do but I'm not sold on the benefits (yet). If the 18650 battery lasts 6 months then it's not very onerous to change it twice a year. On the other hand, if it runs down every month (geez, I hope not) then that's something else. We shall see. Maybe I need to leave room on my PCB for this "upgrade"?
The nrf has a vrm board which solves the voltage issue
Indeed it does, and which I strongly recommend everyone to use for free-standing projects. However, I'm doing much the same as that board, with that MCP1700 voltage regulator which has just a couple of hundred millivolts cost, so I think it's a better, and more compact, solution. Keep tuned to see the final result.
@@RalphBacon I bought a pack of 10 on sale and when further researching them I discovered the adapter which happened to also have a 10 pack on sale haha. I have yet to use one since I've started using esp32 boards. I have a large collection of extra nano, uno and megas so I'm sure I'll use them now I have a decent 3d printer on the way to make enclosures. My first printer destroyed itself in spectacular fashion so I hit return on Amazon and immediately bought a better one. I was hoping the cheap one would work because I just need it as a tool and not for novelty prints. The original one I knew had a 50 50 chance of working or being crap so I rolled the dice. I'm doing a lab reno myself soon. It's going to be epic haha
Ralph, my gut tells me this might be overkill. I need to think about it.
It could be overkill if I was prepared to string wires into and around my bins. Something I really want to avoid. So with the absence of signal or power wires, please do think about/suggest a simpler solution, John, and we'll compare notes.
@@RalphBacon lol Gas Struts??
very cool video, thanks!
but I have a question.
What is better in the long term?
Rebooting the Arduino every time or going into deep sleep so that setup doesn't run every time?
Also for projects in which you have to communicate with several other chips.
This project will do _both_ things, Felix. When the lid is raised it's like a cold boot/switch on. Whilst the lid remains raised it will go to sleep and wake periodically to check the state until the lid is closed.
use 3 NiMH batteries that would be about 3.6 volts and use solar power to charge them:-)
3.6v is pushing it for the nRF24 though. And I'm sure the 18650 has a better capacity than 3 NiMH batteries. Well, reasonably sure. It says 5000mAh on the battery 🤣 What do you mean, that breaks the laws of all known battery chemistry and physics? Solar power? Wait for the next part!
Seems like a reed switch and magnet would be a simpler solution.
Hang on, William, simpler than a tilt switch?
A magnet and reed switch would have to be carefully aligned (like the ones in my house for the burglar alarm). These bins are not that well made and I could not guarantee that they would always close in the same place. At least a tilt switch can be mounted internally to the unit and is self-contained.
I forgot that those RubberMade type bins seem a little too flexible. I used the reed switch/magnet for a truck camper shell alarm, but, , it is rigid. Love your practical approach to this adventure. Praying for your continuing success with your eyesight.
i do love your videos. i like the way the teach lol.. maybe a new ob for you lol.. nice one :)
Glad you like them!
Nice !....cheers.
Thanks for the visit, Andy!
After long time sir
Well, Yogesh, this is my *third* video this year! How many do you want? Oh. I see. Well, enjoy!
@@RalphBacon ok sir😍
hammered you nail Ralph?
Well, I did put something very sharp into the nail bed, which as you can imagine didn't hurt one bit. But the nail is slowly getting replaced, I'm amazed it didn't just all off!
if i was worried about my bins filling with water i'd simply drill i few pin holes in the underside
The trouble is that the crates inside (containing electronics and power tools etc) also fill with water. And anyway, your solution doesn't use an Arduino, so doesn't count 😁😮
@@RalphBacon ah you could have the arduio control the drill
@8:04 I'll bet that hurt. Been there, done that.
It was quite painless, jabbing an inch-long something under my nail bed. Didn't feel it. At all. Yes, of course I'm lying.
Sir plz make a 3 axis smartphone stabilizer compact and accurate with audrino nano as I needed for my drone so it must be lightweight I hope you will make it sir I hope you may reply
Not a chance! You must find out how to do this yourself but watching videos and learning. No shortcuts, I'm afraid.
@@RalphBacon thanks for advice and love from India
#1 why only 1 tilt switch ?
#2 Seem to remember a "radar" like sensor that could sense thru walls, could be used in the workshop to check on the lid outside (alu foil inside lid). (spiess?) outside the battery will suffer in cold winter.
#3 rp2040 + nrf... : usb 5V powerbank to rp2040, easily replaced/recharged, rp2040 has 3.3v out (amps?)
datasheets.raspberrypi#org/pico/pico-datasheet.pdf ( replace #org with .org ) page 4
So many options! Yes, I had considered the poor battery performance once the cold weather sets in; but time will tell whether this is an issue or not. Perhaps I can wrap it in some insulation.
The auto-off referenced at 5:22, I think: th-cam.com/video/g1rbIG2BO0U/w-d-xo.html
Yes, that's a variant of one of my circuits.
While I don't worry about my 2 trash bin lids being open, I would like to know when mail is delivered. I can't see the street mailbox from the house because we are up a small rise and behind some trees.
Or I am away and would be interested in knowing that there is mail in my mailbox.
This project would work, if you modified the sensor part so that it didn't remain LOW as otherwise you cannot shut off the MOSFET and it would stay transmitting (or, at least, in a non-dormant state). I'm pretty sure it could be done, I shall think about it, as others have mentioned snail-mail detection.
@@RalphBacon
One smart mailbox project that I saw here on TH-cam had a pair of IR transmitters + a pair of receivers inside the mailbox in a large "X" pattern. If any mail was in the box, one or both of the IR beams were broken.
Other smart mailbox features needed:
* some sort of indicator that mail is in the box: LED, pop-up/down flag, etc. This would help us at night so we would not have to get out of the car in the dark. In our case, a large deep puddle forms when it rains and there is nothing worse than getting one's feet wet only to discover there is no mail in the box.
* one white LED deep inside the mailbox that illuminates when the lid is opened. Needed at night so we can see that we removed all of the mail.
When I build my smart mailbox, I am going to put most of the electronics either under the box or on the back in a weatherproof box. Then I will run any needed wires up from the bottom to the inside through rubber gromets. That way no rain can get inside unlike it might if I drilled holes in the side or top.