README.rst 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. Power bank keep alive device
  2. ============================
  3. `https://bues.ch/cgit/pbwake.git/ <https://bues.ch/cgit/pbwake.git/>`_
  4. Pbwake is a small USB stick to prevent power banks from shutting off the outputs and falling into deep sleep mode.
  5. Pbwake uses tiny load pulses to simulate a real load on the power bank outputs. The lengths of the load pulse active (high) and inactive (low) phases are pseudo random within configurable bounds.
  6. Pbwake is in a low power state during the inactive (low) phases. Therefore it doesn't waste too much power and guarantees high battery life of the power bank.
  7. Tested power banks
  8. ==================
  9. Power banks this has been tested with are:
  10. * Anker PowerCore 20100 model A1271.
  11. * No-name power bank 2200 mAh / 11 Wh with integrated flashlight LED.
  12. Microcontroller
  13. ===============
  14. Pbwake supports the following microcontrollers:
  15. * ATTiny-13
  16. * ATTiny-25
  17. * ATTiny-45
  18. * ATTiny-85
  19. * ATMega-328P
  20. Hardware schematics
  21. ===================
  22. Schematics: `schematics/pbwake-attiny/pbwake.pdf <schematics/pbwake-attiny/pbwake.pdf>`_
  23. The hardware may be built manually on a simple prototype board.
  24. Board front side:
  25. .. image:: doc/pbwake_front.jpg
  26. Board back side:
  27. .. image:: doc/pbwake_back.jpg
  28. Prebuilt firmware images
  29. ========================
  30. The release archives of pbwake contain prebuilt `.hex` files for all supported microcontrollers in the `hex` directory. These hex files can be flashed directly to the microcontroller with a any tool of your choice (e.g. Atmel Studio or avrdude).
  31. The corresponding fuse settings can be found in the file `fuses.txt` in the same directory.
  32. Building the firmware
  33. =====================
  34. The firmware build needs the following tool chain:
  35. * Unix-like operating system
  36. * GNU make
  37. * AVR GCC
  38. * AVR Binutils
  39. * avrdude
  40. Run the following commands to build the firmware:
  41. .. code:: sh
  42. cd firmware
  43. make DEV=t85
  44. Please specify the target microcontroller using the DEV variable as shown above.
  45. Valid values are:
  46. =============== ===========
  47. Microcontroller make option
  48. =============== ===========
  49. ATTiny 13 `DEV=t13`
  50. ATTiny 25 `DEV=t25`
  51. ATTiny 45 `DEV=t45`
  52. ATTiny 85 `DEV=t85`
  53. ATMega 328P `DEV=m328p`
  54. =============== ===========
  55. Additional build options that can be passed to `make`:
  56. ================ ======= ================================================================
  57. make option default description
  58. ================ ======= ================================================================
  59. CONF_HIGH_MIN_MS 4 Minimum length of high-phase (in milliseconds).
  60. CONF_HIGH_MAX_MS 6 Maximum length of high-phase (in milliseconds).
  61. CONF_LOW_MIN_MS 40000 Minimum length of low-phase (in milliseconds).
  62. CONF_LOW_MAX_MS 55000 Maximum length of low-phase (in milliseconds).
  63. ================ ======= ================================================================
  64. Flashing the firmware after build
  65. =================================
  66. Run the following commands to flash the firmware to the target microcontroller:
  67. .. code:: sh
  68. cd firmware
  69. make DEV=t85 print_fuses
  70. make DEV=t85 write_fuses
  71. make DEV=t85 write_mem
  72. Or alternatively use any other of the available AVR flashing tools to program the .hex file and fuses.
  73. License
  74. =======
  75. Copyright (c) 2020 Michael Buesch <m@bues.ch>
  76. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
  77. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  78. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.