README.rst 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. Simple PWM controller
  2. =====================
  3. `https://bues.ch/cgit/simplepwm.git/ <https://bues.ch/cgit/simplepwm.git/>`_
  4. Simplepwm is a small PWM brightness controller for LED lamps.
  5. Microcontroller
  6. ===============
  7. Simplepwm supports the following microcontrollers. Not all features are supported on all microcontrollers. See the table for details.
  8. ============================ =========== ========== ========= ========= ========= =========
  9. .. ATMega-328P ATMega-88P ATTiny-85 ATTiny-45 ATTiny-25 ATTiny-13
  10. ============================ =========== ========== ========= ========= ========= =========
  11. Number of analog pot. inputs 3 3 1 1 1 1
  12. Number of PWM outputs 3 3 1 1 1 1
  13. Battery power saving x x x x
  14. Battery voltage monitoring x x x x
  15. HSL color model x x
  16. Debugging via UART x x
  17. ============================ =========== ========== ========= ========= ========= =========
  18. Hardware schematics
  19. ===================
  20. Schematics for ATMega based setups: `schematics-atmega/simplepwm-atmega.pdf <schematics-atmega/simplepwm-atmega.pdf>`_
  21. Schematics for ATTiny based setups: `schematics-attiny/simplepwm-attiny.pdf <schematics-attiny/simplepwm-attiny.pdf>`_
  22. Prebuilt firmware images
  23. ========================
  24. The release archives of simplepwm 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).
  25. The corresponding fuse settings can be found in the file `fuses.txt` in the same directory.
  26. Building the firmware
  27. =====================
  28. The firmware build needs the following tool chain:
  29. * Unix-like operating system
  30. * GNU make
  31. * AVR GCC
  32. * AVR Binutils
  33. * avrdude
  34. Run the following commands to build the firmware:
  35. .. code:: sh
  36. cd firmware
  37. make DEV=t85
  38. Please specify the target microcontroller using the DEV variable as shown above.
  39. Valid values are:
  40. =============== ===========
  41. Microcontroller make option
  42. =============== ===========
  43. ATTiny 13 `DEV=t13`
  44. ATTiny 25 `DEV=t25`
  45. ATTiny 45 `DEV=t45`
  46. ATTiny 85 `DEV=t85`
  47. ATMega 88P `DEV=m88p`
  48. ATMega 328P `DEV=m328p`
  49. =============== ===========
  50. Additional build options that can be passed to `make`:
  51. =========== ====== ======= ================================================================
  52. make option values default description
  53. =========== ====== ======= ================================================================
  54. PWM_LIM 1-100 100 Limit the maximum PWM duty cycle to this percentage.
  55. PWM_INVERT 0-1 0 Invert the PWM output signal(s).
  56. ADC_INVERT 0-1 0 Invert the ADC input signal(s).
  57. ADC_HSL 0-1 1 Interpret the ADC input signals as HSL setpoints instead of RGB.
  58. =========== ====== ======= ================================================================
  59. Flashing the firmware after build
  60. =================================
  61. Run the following commands to flash the firmware to the target microcontroller:
  62. .. code:: sh
  63. cd firmware
  64. make DEV=t85 print_fuses
  65. make DEV=t85 write_fuses
  66. make DEV=t85 write_mem
  67. Or alternatively use any other of the available AVR flashing tools to program the .hex file and fuses.
  68. License
  69. =======
  70. Copyright (c) 2018-2020 Michael Buesch <m@bues.ch>
  71. 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.
  72. 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.
  73. 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.