#124

แชร์
ฝัง
  • เผยแพร่เมื่อ 25 ต.ค. 2018
  • Protect your Raspberry Pi from power cuts with help from this UPS (and an ATTiny85)
    All sketches, circuit diagrams and so forth in my GitHub:
    github.com/RalphBacon/Raspber...
    Power cut? No problem!
    Banggood have kindly supplied me with the Geekworm Power Pack Pro V1.1 Lithium Battery Power Source UPS HAT - a bit of a mouthful but basically, it's a UPS (Uninterruptable Power Supply) for your Raspberry Pi.
    I'm using a Pi Model 3B+ but it should work with any 40-pin header model. Here's the link:
    bit.ly/GeekwormUPS4Pi
    (This is an affiliate link - if you click it and order the item within 14 days I get a tiny commission!)
    Now, there is a well known "issue" with this board, inasmuch that if the battery becomes depleted it will not reconnect the power to the Pi once power is restored. Oops.
    But a simple ATTiny85 module and a resistor or two plus a simple NPN transistor and we have the PERFECT solution!
    The simple sketch I'm using to demonstrate this board, plus a circuit diagram can all be found on my GitHub.
    And DON't MISS the very IMPORTANT warning at the end of the video, I don't want your UPS to be a pile of molten metal on your desktop. SERIOUSLY.
    ---
    If you like this video please give it a thumbs up, share it and if you're not already subscribed please consider doing so :)
    My channel and blog are here:
    / ralphbacon
    ralphbacon.blog
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 86

  • @uweri_3851
    @uweri_3851 5 ปีที่แล้ว +2

    Excelent video like allways. Hope we get much more of these. Thanks for sharing knowledge.

    • @RalphBacon
      @RalphBacon  5 ปีที่แล้ว

      You are most welcome Uwe Ri_, I'm glad you like the videos. Nice to hear from you.

  • @andymouse
    @andymouse 5 ปีที่แล้ว

    nice solution Ralf...….quite surprised the manufacturer missed it

    • @RalphBacon
      @RalphBacon  5 ปีที่แล้ว +1

      I'm not sure they missed it, exactly, just didn't provide a solution for when the battery went flat. They probably thought, "What's wrong with pushing the button?".

    • @andymouse
      @andymouse 5 ปีที่แล้ว +1

      If its in the middle of a bloody beehive pushing the button IS a problem!...haha!

  • @hectorsegura1776
    @hectorsegura1776 5 ปีที่แล้ว

    As always helpful things from you ... this time I wish to ask about your "little device" started in minute 4, any info in the right direction (description, where to get, etc); maybe a video how to clone your way to have the raspi OS running?
    I apologize to be off topic but the "device not Stick" is too much interesting :)

    • @RalphBacon
      @RalphBacon  5 ปีที่แล้ว

      Cloning an SD card to a USB stick (we'll call it that even though it's not very stick-like any more) is easy. I'll add it to my list.

  • @IanSlothieRolfe
    @IanSlothieRolfe 5 ปีที่แล้ว +3

    Another interesting video Ralph. I suppose the next challenge is to measure the voltage from the UPS and send a signal to the RPi so it can shut down in an orderly manner! Then when the voltage rises above 4.5v restart it.....

    • @RalphBacon
      @RalphBacon  5 ปีที่แล้ว +2

      This seems a common theme in the comments today, Ian! Yes, I'm hoping to monitor the battery pack using I2C from the Pi itself. We shall see.

    • @mayukh4130
      @mayukh4130 5 ปีที่แล้ว

      @@RalphBacon Need video on this..

  • @michaelstevens630
    @michaelstevens630 5 ปีที่แล้ว

    Ralph that looks like a handy board. I wonder if has one of the Maxim I2C Charge indicator chips. At present could not quickly locate a circuit diagram for the actual board. Will be an interesting video when you get to this stage later on.

    • @RalphBacon
      @RalphBacon  5 ปีที่แล้ว

      It has _something_ on board, Michael, that allows comms via I2C to interrogate the state of the battery pack. I shall be investigating in a future video, I suspect...

  • @daveholden3935
    @daveholden3935 5 ปีที่แล้ว

    Great video Ralph, it resolved a lot of my issues with battery powering my Pi units.
    Please please re-visit I2C battery monitoring soon as (mentioned in my comment on the earlier video) I have fatally ruined a couple of uSD cards when crashing. The Pi will then be almost totally 'bomb proof'.
    Thanks again
    Dave

    • @RalphBacon
      @RalphBacon  5 ปีที่แล้ว

      I certainly want to explore the I2C comms from the Pi, Dave, in order that we can shut down tidily. Keep tuned...

    • @daveholden3935
      @daveholden3935 5 ปีที่แล้ว

      @@RalphBacon Apologies for taking more 'bandwidth'. Testing with my 'HAT' I've noticed that the 'lightning strike' only appears on a local monitor and not when running the Pi headless. Strange. The Pi power LED still flashes on and off however. So some attention needed to my UPS HAT. Keeping tuned for battery monitoring...

  • @vonries
    @vonries 5 ปีที่แล้ว

    Great video ad always of course. I always get excited when I see you're going to use an ATTiny. I keep hoping you're going to post the Gerber files to set the fuses (hopefully through hole components) I just couldn't make out the tracks and such on your old video where you showed us how to burn fuses and reset them again. If you don't have the time for Gerber files how about a schematic? Oh well, maybe next time. 🤔

    • @RalphBacon
      @RalphBacon  5 ปีที่แล้ว +1

      What a coincidence, vonries. I have now created the PCB (and schematic) for the ATTiny85 Fuse Resetter. Whether it works is another matter. It does use THT (I just couldn't face SMD for this project). When I have it all working I will publish a video on the entire process. If it works I might even send you a PCB for free!

    • @vonries
      @vonries 5 ปีที่แล้ว

      @@RalphBacon You are the man! I have a 14 pin ziff socket thay I bought when I was originally trying to build one from your original ATTiny fuse reseter video. Do I need to order a smaller one? So it will fit your board? Thank you so much for not giving up on this project/ chip.

    • @RalphBacon
      @RalphBacon  5 ปีที่แล้ว

      The boards have arrived! But not yet tested.
      They are sitting here on my workbench, calling to me. The 14-pin ZIF will fit, it's what I have designed the board to use. Keep your breath bated, it won't be long now. I just wish we had 30-hour days.
      BTW I will be giving a couple of the PCB boards away so you never know (unless one were to email me ahead of the video, but you wouldn't know that my email address is hidden in my About tab of my channel), oh well...

    • @vonries
      @vonries 5 ปีที่แล้ว

      @@RalphBacon I must be worse off than I thought. I can't find it in the TH-cam about (Mobil version), on your GitHub, or on your blog. I'll have to see if it looks any different on my laptop. My desktop burned out my power supply, I think. Is it safe for me to post my email here for you, or will I be flooded with junk mail?

    • @vonries
      @vonries 5 ปีที่แล้ว

      I sent an email to someone here's hoping it was you, lol.

  • @Hasitier
    @Hasitier 5 ปีที่แล้ว

    Nice board. And nice solution. What could be the next step is to measure the voltage of the battery and make a safe shutdown if it goes low. Also a button to manually shutdown the pi safe (and not booting it up again) would be helpful in some scenarios. I do myself plan to use a pi in a Fotobox for party’s and like to make it bulletproof for the dumb one that pulls the power plug but also have a dedicated button to shut it down manually when the job is done.

    • @RalphBacon
      @RalphBacon  5 ปีที่แล้ว +1

      The safe shutdown theme is running wild today, Michael. I shall certainly investigate that aspect. A manual shutdown that does not cause the Pi to be restarted by the Arduino ATTiny85 is do-able too. Hmm, food for (future video) thought.

    • @Hasitier
      @Hasitier 5 ปีที่แล้ว +1

      Ralph S Bacon thanks Ralph. Looking forward to it. Grüße aus Sachsen. Michael.

  • @gfodale
    @gfodale 4 ปีที่แล้ว

    I will eventually make one of these, thank you. However, if I can manage to read the voltage with a tight enough tolerance, I would also send a signal to the pi to have it do a proper shutdown. Ensuring it does not corrupt the ssd card or thumb drive by randomly shutting down during a write operation. ("shutdown -P now" with root privilege.)

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว +1

      If you watch my video #173 (and #176, not yet published) You will see a simple circuit to do this. Your Pi must monitor a GPIO pin that is set LOW by the µC, carry out housekeeping tasks, then the Pi sets it LOW again so that the µC circuit recognises the signal and shuts off the power. It will at least give you ideas on how to do this with a Pi.

  • @duncanx99
    @duncanx99 5 ปีที่แล้ว +2

    It may be a figment of my imagination but couldn't, what appears to be a couple of sets of 'prototyping pads' on the Banggood board, be used to accomodate the ATTiny85 and the other components - thereby making an 'all in one' solution?
    Great video as always...

    • @RalphBacon
      @RalphBacon  5 ปีที่แล้ว +2

      IMPORTANT! THEY ARE NOT PROTOTYPING PADS! I had to shout because others have made the same mistake. They are all connected to ground. No-one knows why they are there apart from possible cooling (ie allowing air flow). Phew, close shave, that one!

    • @IanSlothieRolfe
      @IanSlothieRolfe 5 ปีที่แล้ว +1

      They are almost certainly "thermal vias" that transfer heat from the regulator on the bottom to the copper on the top, increasing the "heat sink" area of the PCB. So they are there to improve heat flow, not air flow per se.

    • @RalphBacon
      @RalphBacon  5 ปีที่แล้ว +1

      Thank goodness someone understands what these holes are for. Mystery solved. I didn't detect it getting that hot, but then again I wasn't really paying attention to that aspect. Thanks for that Ian, now we all know.

    • @IanSlothieRolfe
      @IanSlothieRolfe 5 ปีที่แล้ว +1

      It doesn't get hot because the holes work :D

    • @deangreenhough3479
      @deangreenhough3479 5 ปีที่แล้ว

      Excellent work Ralph, I’m very much enjoying all your work and the in-depth explanations.
      I find your work always worth the time to watch. Fortunately I have enough experience under my belt to finally be able to understand and duplicate your work.
      You also have a very calming voice. Thank you kind sir. 🏴󠁧󠁢󠁥󠁮󠁧󠁿

  • @Ed19601
    @Ed19601 5 ปีที่แล้ว

    When I have some time, I got to try this with an attiny10

    • @RalphBacon
      @RalphBacon  5 ปีที่แล้ว +1

      Yes, there's no reason it won't work with other µControllers, Ed. If you get it working, let us know!

  • @Bill-cw1ei
    @Bill-cw1ei 3 ปีที่แล้ว

    Great source of knowledge thanks!
    It seems Geekworm released an upgrade a few months ago, and which comes with an "AUTO UPS" switch that would ensure to auto "push" the power switch by itself. If it's effectively working, it would simplify the scheme quite a lot. I'm just wondering how it would behave if we detect a power failure via the I2C channel, then we shut down the device, but during the shutdown phasis, power gets back. My guess is that the RPi will finish the shutdown process normally but will not boot again until a new power failure/recovery cycle is achieved. Actually, I'm wondering the same for the circuit of this video. Anyway, all of this is quite interesting!

    • @RalphBacon
      @RalphBacon  3 ปีที่แล้ว +1

      It's always the edge cases that cause problems, Bilel! I don't know what would happen with this circuit but it's worth mentioning it here, for sure.

    • @Bill-cw1ei
      @Bill-cw1ei 3 ปีที่แล้ว +1

      @@RalphBacon If I get to play with it I'll make sure to explain the behavior here! Thanks again for all your content!

  • @area46241
    @area46241 5 ปีที่แล้ว

    Excellence as always Ralph. Nice solution to restart the Pi. Is this setup for the autonomous robot?

    • @RalphBacon
      @RalphBacon  5 ปีที่แล้ว

      It's certainly something I want for my workshop automation. I don't want the Pi to be sitting there, waiting for power, when / if we just happen to have a power cut during the night!

  • @asagk
    @asagk 5 ปีที่แล้ว

    Nice Video, Ralph!
    I personally do not like any sort of Lithium Akkumulators, because they have a tendency to burn/explode, as well as they do not like any environmental condition below freezing point of water. I prefer Ni-Zn-Akkumulators [low self discharge / low temp. < 0°C capable / simple CCCV recharging scheme using controllers like e.g. ATtiny :-) ].
    But your application with the ATtiny is great! Well done!
    Btw. you could use a USB-to-TTL(3.3V !!!) adapter and use the debug console of the Raspberry Pi (via Putty) instead of using a Monitor + Keyboard + Mouse if anything goes wrong with the RPi.
    And a good alternative to VNC could be the "free version" of MobaXTerm. It is at least much faster than VNC and works with all graphic applications from any Unix System, not only from RPI/Debian, to bring onto your Windows desktop without hassle.

    • @RalphBacon
      @RalphBacon  5 ปีที่แล้ว +1

      Interesting points you raise Sebastian.
      I will look at Ni-Zn cells as I am not familiar with them. And I will also look at MobaXTerm, assuming I can run it on Windows and on the Pi. If it's quicker than VNC but just as reliable I may switch!
      I didn't know you could debug the Pi like that either so I will try it out. Thanks for all the info, good of you to share.

    • @asagk
      @asagk 5 ปีที่แล้ว

      @@RalphBacon Hey Ralph!
      Well, the MobaXTerm is just installed to Windows. The RPi does not need any installation for MobaXterm, since graphic applications as well as some of the text applications (e.g. xterm, EMACS, etc.) do already contain support of sending and receiving via X11 protocol for remote access. Perhaps you have to set the environmental variable "DISPLAY "to your windows computer where MobaXterm is used by some command like "export DISPLAY=:0.0". But that should be about it...
      Here some links about configuration/usage: www.raspberrypi.org/forums/viewtopic.php?t=21610 and th-cam.com/video/vyppO5_WnMU/w-d-xo.html
      Have fun!

    • @asagk
      @asagk 5 ปีที่แล้ว

      ps.: Here a link for some datasheets from two of the many nickel-zinc batteries about "constant current / constant voltage" charging cycles:
      cdn-reichelt.de/documents/datenblatt/D600/ANS_NIZN_4XAA_DB.pdf
      cdn.sos.sk/productdata/29/72/e34660c7/4aa2500mwh1-6v-bp4.pdf (a little strange that this document warns about possible explosion and fire since Ni-Zn do not contain flamable / explosive ingredients, which is one of their major advantages over most rechargable batteries)
      And here also some kind of more general information about Ni/Zn batteries: briefs.techconnect.org/wp-content/volumes/Nanotech2011v1/pdf/1392.pdf
      I am not sure if Ni/Zn batteries might also be charged using some pulse charge, where a ~1 sec pulse is applied and then during a break of like 1-2 seconds the cell voltage is controlled to decide if the charging process should continue. Or as an alternative method charges a cell with a ~1 sec pulse and then waits the cell to drop below a certain voltage again after some time while the pulse is cycled off, to then restart a new pulse charge cycle until this voltage drop does not take place within a certain time window, as well as it controls the temperature envelope of the cell at the same time.
      But this would perhaps be something to look into and have some tests about this I guess? At least such ideas can make up a very nice test and development field for arduinos...
      Found something interesting article about pulse charging Ni/Zn in a research document (section 4.3.1) in: d-nb.info/1119447232/34 ...concluding a "2 sec ON / 1 sec OFF cycle" for DC pulse charging of commercial Ni/Zn cells. Actually this document suggests that DC-pulse charging is actually better for life time expectance over the CCCV method. Interesting!

    • @RalphBacon
      @RalphBacon  5 ปีที่แล้ว +1

      I will have a good read of the links you sent, Sebastian. I've just read the Wikipedia article (en.wikipedia.org/wiki/Nickel%E2%80%93zinc_battery ) which was interesting so I need to dig further.
      The fact that they have a nominal voltage of 1.65v means they could be a better replacement for alkaline batteries than the Li-Ion 1.2v batteries, in many cases.

  • @UnrealVideoDuke
    @UnrealVideoDuke 4 ปีที่แล้ว

    How to add a safe shutdown to the attiny functionality when the battery is low without having it to restart the Pi?

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว

      If you watch my video #173 (and #176, not yet published) You will see a simple circuit to do this. Your Pi must monitor a GPIO pin that is set LOW by the µC, carry out housekeeping tasks, then the Pi sets it LOW again so that the µC circuit recognises the signal and shuts off the power. It will at least give you ideas on how to do this with a Pi.

  • @adamhun994
    @adamhun994 5 ปีที่แล้ว

    Ralph, thanks for your video, my HAT just arrived. I have a problem with it though: it can't deliver enough power to my Pi. I tested the board without any battery connected to it, and on boot there is the low voltage indicator. (and the lighting bolt appears when doing something)
    I charged the battery, and tried the system with it: the same issue. I tried multiple cables, my power source is a 2A Samsung charger which is perfect when I directly connect it to my Pi (even can handle my external hard drive).
    I'm using a 3b+ with a stock desktop image and my cpu can only run at 600mhz this way.
    Edit: I even have some reboots.
    Do you have any suggestions for my issue?

    • @RalphBacon
      @RalphBacon  5 ปีที่แล้ว +2

      By a process of elimination:
      1. Try another power supply. I know your Samsung charger works fine directly with the Pi, but it's not the official power supply, so try something else.
      2. Measure the input voltage to the HAT at the USB connector. Take care not to short anything out. My video shows where the 5v track is (underneath) @21:18
      3. Measure the voltage at the output of the HAT on the 5v pin (of the 40-pin header), is it below 5v? Don't short it to the 3.3v as you do this or your Pi will be toast.
      4. Have you got the red & white cables of the battery correctly (see my WARNING in the video that the connector was wired up the wrong way round @ 28:49)?
      5. Any obvious defects on the HAT PCB? Do the blue lights light up in sequence as they charge the LiPo battery?
      6. Try a different Pi if you have one.
      7. Google for any similar problems by others.
      8. Contact your seller.
      That's what I would do, Ádám, I hope you succeed in sorting this out.

    • @adamhun994
      @adamhun994 5 ปีที่แล้ว

      Ralph S Bacon thank you for your feedback, really appreciate it!
      First thing is that my battery wiring is good, that was the first thing what I checked when the board arrived (thanks for your video for the information)
      I'm going to borrow another, more powerful charger to test things out. Maybe I can test it with my friend's 3b+ also.
      In the following days I'm going to measure the voltage of the connectors. I only have a multimeter, I hope it'll be fine.
      My question is: can you clarify that your pi is a 3b+ one, and your HAT pcb is fully functioning with it? Even under some load?
      The site says it's compatible with pi 3 and I don't know how different is the b+ from the original one. To make sure that it should work.
      Thanks!
      Adam

    • @RalphBacon
      @RalphBacon  5 ปีที่แล้ว +1

      Yes, I'm using the new Pi 3B+ and it's working fine. When you say "under load", I just booted to the desktop GUI (Stretch) as you saw in the video, it was not doing anything special.
      A multimeter is fine to measure voltages, just be EXTRA CAREFUL when using it with the GPIO header pins, it's too easy to short the +5v and +3.3v together as I did and that will destroy your Pi. Ideally, use a suitable Dupont cable to do this. Good luck.

  • @mattivirta
    @mattivirta 4 ปีที่แล้ว

    little guestion, i have raspberry pi 3 B+ and additional board X820 hdd 2,5" in board, and this say normal raspi need minimum 2,5A power, and whit HDD disk board and hdd disk, need 5A power supply, now adding next time DAC board too, audio need be good, guestion have. CAN i use this ups board my raspberry pi, because need power lot more than genuine. and can i keep power wall adapter alltime to connected wall and IF elektric blackout cut battery working safety and no cut raspberry. i need table computer raspberry have alltime online because here elektric cut rain season manytime/day normal 4-5time/day cut elektric.

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว

      I don't know the answer, Matti, you need an answer from Raspberry Pi experienced users. Try their forum www.raspberrypi.org/forums/

  • @dikl2689
    @dikl2689 5 ปีที่แล้ว

    Is there a chance that your friends at Banggood could send you one of the Pi UPS they are now selling on their site? I bought one of the ones you featured in this TH-cam video and would be interested how the new one compares as I would like to buy at least one more. I can't find any reviews of this blue board UPS. Also holding my breath for the I2C video update for the red board. Cheers

    • @RalphBacon
      @RalphBacon  5 ปีที่แล้ว

      Can you give me a link to the product you mean, Dik?

    • @dikl2689
      @dikl2689 5 ปีที่แล้ว

      @@RalphBacon tinyurl.com/y2ywtn9h
      The red board you reviewed doesn't seem to be available any more. I ordered from two sellers on Aliexpress, both took the order then failed to deliver. Cheers

    • @adamhun994
      @adamhun994 5 ปีที่แล้ว

      @@dikl2689 I think the blue board is the older one. But I might be wrong.

  • @tablatronix
    @tablatronix 5 ปีที่แล้ว +1

    Those standoffs are stackable

    • @RalphBacon
      @RalphBacon  5 ปีที่แล้ว

      Do they allow the board to be properly plugged into the 40-way connector when stacked? If so, I shall mention it next time I do a video on the Pi. Thanks, tablatronix.

    • @tablatronix
      @tablatronix 5 ปีที่แล้ว

      @@RalphBacon hmm, no idea I assumed they provided the proper height, they do look a bit too tall, so maybe not..

    • @tablatronix
      @tablatronix 5 ปีที่แล้ว

      Looks like standoff for stacked boards without extended headers is M2.5 x 11mm, cannot confirm though my pi is in n enclosure on my 3d printer atm

    • @RalphBacon
      @RalphBacon  5 ปีที่แล้ว +1

      I'll take a closer look tomorrow. Right now, after 9 hours on my feet, I'm knackered! The mind is eager the body says have a beer and watch some TV. Guess which one is winning?

  • @salicosta5582
    @salicosta5582 หลายเดือนก่อน

    Nice works well, but I du not understand way attiny85 burn in less then a day and are use less then.

    • @RalphBacon
      @RalphBacon  หลายเดือนก่อน

      An ATTiny85 will last forever if it is treated correctly: 5V supply and no more than VCC + 0.3V on any of its GPIO pins. Max 40mA from any one GPIO (ideally

    • @salicosta5582
      @salicosta5582 หลายเดือนก่อน

      @@RalphBacon Hello Ralph,
      thanks for replaying. Well I do not know what happens. I used a digispark attiny85 with a usb hat on it,. This you can connect directly to the usb port of your pc and with the correct drivers program it via arduino ide. Works nice. I use it with a little bit different hardware. Raspberry b+ (the first one) shouldn't make any problems. The ups hat is frome Geekworm version 1.0. It comes also with a button to press for a few seconds to reboot once it shutdown and the battery still got power. And due to living in a country where it is difficult to get things even from China I use instead of 2N2222 bc547, which should work. When I put everything together it works fine for some hours, I can shutdown and it powers up again. Then everything on the attiny85 and I can not program it any more, connected directly via usb nor with an arduino as programmer. I guess, it has some kind of failure, I read somewhere that this digispark modules aren't very stable.
      On the actual project I could life with a pushbutton. All done by it self would be nice. The next one is more difficult. Or shouldn't I care to much on a power loss once a month? Would a arduino failure less? I just need the raspberry to switch on and off some relays, mayby Iater on I add some other things.
      Regards from Costa Rica
      Simon

    • @RalphBacon
      @RalphBacon  หลายเดือนก่อน

      Ah! Costa Rica! Mi pais favorito! I've travelled around Costa Rica far and wide, from near the border up North (with Nicaragua) over to Tortuguero in the East and Manuel Antonio in the South West. Funny thing is, whilst many, many people spoke English/American there were also many that did not, so I had to revert to my long forgotten Castilian Spanish (which they found quite amusing not least because of the way I pronounce the "c" as "th"). It's amazing how far you can get with "Dos cervezas, por favor, y algo para comer!"). Pura Vida!
      Anyway, back to your question. I've no idea why your ATTiny85 should give up like that, unless you "hat" somehow gives it more voltage than it can take, but your Pi also runs at both 5v and 3v3 so it seems unlikely. You don't burn the reset fuse at all, do you, to get more GPIO pins? (If that means nothing to you, then you probably are not doing this).
      Just to test things out you can use an Arduino Uno or Nano. If you can removed the onboard LED (or resistor to it) the battery will last much longer, but even so it won't last that long. Those Arduino dev boards are not designed for battery use. The newer ESP32-C3 modules ARE designed for that; check them out!
      Anyway, that's all I got right now, I wish you mucho éxito con este proyecto!

  • @daveholden3935
    @daveholden3935 5 ปีที่แล้ว

    Using the pouch cell supplied, with a Pi 3B+ (headless) showing 'home screen' via VNC - processor idle. Using a multi-channel logger , plotted Li-On Battery voltage, '5V rail' , and status of GPIO 26, at 1 minute intervals.
    The Pi was powered for 3hrs 31minutes before it shutdown - ( by pouch cell protection circuit)
    The graphs show:
    a) '5V rail' - (output of UPS - Pins 2 and 4) - constant at 5.17V (until shutdown)
    b) Battery output roughly linear discharge from 4.0V to 3.25.v at time 3hrs 22minutes. Then curve downward for 9 mins to shutdown at 3.05V
    c) GPIO 26 dropped from 3.28V to 1.5V immediately after external mains power (5V wall wart) removed. Varied between 1.5V to 0.9V until 0V at shutdaown. (Of interest only as not an input to ATtiny which is not powered at this time)
    The UPS blue 'lowest charge LED' flashed at 3.3V battery level.
    Suggest 3.25V as a 'gentle closedown' threshold ?.
    Hope the above may be of use/interest to anyone programming battery monitoring software for this configuration.

    • @RalphBacon
      @RalphBacon  5 ปีที่แล้ว

      Excellent information, Dave. I've been away with eye surgery and am only now catching up. I need to complete this video by using the I2C bus on this device to monitor the battery voltage. Thanks for sharing.

  • @Roy_Tellason
    @Roy_Tellason 4 ปีที่แล้ว

    I'm rather surprised that you didn't run into any issues with pushing the charge rate for the larger battery into that smaller one. The little modules I have for charging/protecting lithium batteries use a chip (can't recall the number offhand) and the datasheet for the chip shows you what resistor you would have to change to set different charge rates. Perhaps that could be investigated on this UPS board? I surely would, before just plugging in that tiny little battery...

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว

      I changed the resistor having been prompted by others (close call) and no damage appears to have been done. Just goes to show that attention to detail is required and the devil's in that detail!

  • @iffracem
    @iffracem 5 ปีที่แล้ว

    I think the red varnish stuff is called lacquer. And that's about teh extent of my knowledge. Cheers

    • @bbowling4979
      @bbowling4979 5 ปีที่แล้ว +1

      On a PCB it's called solder mask (or sodder mask in the US:) ).

    • @RalphBacon
      @RalphBacon  5 ปีที่แล้ว +2

      Both replies here are correct.
      Wikipedia says: "Printed circuit board with green [or red?] solder mask coating. Solder mask or solder stop mask or solder resist is a thin *lacquer-like* layer of polymer that is usually applied to the copper traces of a printed circuit board (PCB) for protection against oxidation and to prevent solder bridges from forming between closely spaced solder pads."
      I knew this. I just couldn't bring the word to mind. Really. Truly, I knew. Pinnochio nose? What do you mean?

  • @BerndFelsche
    @BerndFelsche 5 ปีที่แล้ว

    ATtiny could sink 20 mA... Perhaps eliminating the transistor.

    • @RalphBacon
      @RalphBacon  5 ปีที่แล้ว

      But would not that not present +5v at the pin whilst it was not low? I don't know how that switch on the UPS is configured and I would not want to start pushing 5v into it. What do you reckon, Bernd?

  • @jarilind78
    @jarilind78 4 ปีที่แล้ว

    Hi
    I think i don't understand something on the code...
    if i change
    if (loopDelay > 29) { -> if (loopDelay > 120) { . Is these seconds?
    And it would be enough loop once 10min
    delay(600000);
    whole program is not working at attiny85 after these changes . Should be have enough time to do fsck etc. if needed.
    Thank you for great videos thou! :)
    -Jari L
    // ------------------------------------------------------------------
    // This loop check to make sure Pi is UP
    // ------------------------------------------------------------------
    void loop() {
    static unsigned int loopDelay = 0;
    // Read the RasPi's output pin - should be HIGH if running
    if (digitalRead(PiHi) == 0) {
    // Only do something if the Pi has not had this pin HIGH for X seconds
    // to allow it time to boot up or we could be constantly resetting it!
    if (loopDelay > 29) {
    digitalWrite(UPS_Pin, HIGH);
    digitalWrite(Indicator, LOW);
    delay(5000);
    digitalWrite(UPS_Pin, LOW);
    loopDelay = 0;
    }
    else {
    // Start the countdown to a reset
    digitalWrite(Indicator, HIGH);
    loopDelay++;
    }
    }
    else {
    // Reset any part-delay we've counted
    loopDelay = 0;
    digitalWrite(Indicator, LOW);
    }
    // Loops every second, fine for demo
    delay(1000);
    }

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว

      I'm not sure what you are trying to achieve with those mods to my code, Jari? What my function does is to give the Pi enough time to boot up and bring that GPIO pin high. This lets the ATTiny85 detect that the Pi is running.
      The "29" in the loop is indeed seconds (due to the delay(1000) (that's 1000 milliseconds) at the very end of the loop). why are you trying to increase that, is your Pi super slow or something?

    • @jarilind78
      @jarilind78 4 ปีที่แล้ว

      @@RalphBacon My application for this is scenario...
      Raspi3 is functioning as surveillance camera, network connection with 3G USB dongle.
      USB dongle tends to go unresponsive after week or two, even after i reboot raspi, dongle gets no connection ever again. I have to poweroff raspi so dongle goes totally blank and then it's working again.
      So my plan is to poweroff raspi every night. And because SD cards is a bit unreliable, i would also do fsck at reboot every night. So there should be enough time, about 10mins raspi to do fsck. This surveillance camera is few hundred kilometers away, so i am no hurry, but everything should work reliable as possible. Now i have tried tiny85 1Mhz with this code, if i add 29 -> 600 (s), or any bigger value, i can't get any reliable operation. My first try with tiny85, so i am a bit baffled about is this code problem or something on my tiny85 setup?
      As i can understand code should work just to change 29 -> 600, to give 10mins time raspi to bootup.
      Right?
      Thank you for reply
      -Jari

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว

      10 minutes for a RasPI to boot seems excessive, Jan. If it's not there (running the startup code I showed, which sets that GPIO pin HIGH) within 30 seconds then something is wrong. I'd get all this working on the workbench first, using my (shutdown/reset) circuit so that the PI can do what it needs to before actually shutting everything off.
      Additionally, instead of writing to a flaky SD card, try using a USB memory stick - it's what I use to boot from and I've never had an issue. You can use it to write data to as well. No fsk routine requited! Just a suggestion!

    • @jarilind78
      @jarilind78 4 ปีที่แล้ว

      @@RalphBacon Of course i will setup at workbench first, and test that all is functioning correctly. Thou i think there should be more time to raspi to bootup. USB flash memory is a bit better than SD card, usb hdd best option.
      All i try now to troubleshoot, is code wrong if i change 29 -> 600, or is it something to do my tiny85 setup? Because if i change time, tiny85 is not working right, at 29 sec its working as intended.

  • @vonries
    @vonries 5 ปีที่แล้ว

    Ralph, it's hard to use your affiliate links if you don't give them to us. I've got an Amazon gift card from Christmas that I recently found, and it's burning a hole in my pocket. Actually to be honest, I want to use it before I lose it again.

    • @RalphBacon
      @RalphBacon  5 ปีที่แล้ว

      True, Steven, but I don't link to stuff I don't use (or recommend). But if you're set on using Amazon for Arduino-related stuff use *any* of my Amazon affiliate links and then navigate to the item you want to buy. It's supposed to work but until someone does it I'll never know! I await with bated breath...

    • @vonries
      @vonries 5 ปีที่แล้ว

      @@RalphBacon Don't they give you some sort of code that you add to the link, so it points to you? You might be able to just point to their homepage rather than to an item. If that works then you could just point to all of the affiliate links home pages. You could post that either at the end of every video or to the video #146 "How to Support My TH-cam Channel (at no cost $ to you!)." Then mention it at end of your videos.
      It's just an idea, do with it what you will.

  • @joachimbaumann731
    @joachimbaumann731 4 ปีที่แล้ว

    Dear Ralph,
    I bought some of the blue Geekworm UPS hats to try and experiment with an inexpensive UPS for the Raspberry.
    I bought some of them in the hope that they would work, but they did not charge the battery after a power outage. So I set out to modify the Geekworm hardware so that it automatically restarts charging the battery, and developed a small add-on board with an ATTiny that, together with a daemon running on the Raspberry, adds a lot of missing functionality.
    I would be very happy if you would have a look at it, give me your feedback, and in the best of all cases, feature it in one of your videos. :-)
    Here is the link: github.com/jbaumann/attiny_daemon
    Btw., everything is open source, and the overall cost including the Geekworm UPS is less than 20€.
    Kind Regards, Joe

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว

      I'll have a look at that link for sure, Joachim, thanks for sharing.