README.rst 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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-88(P) 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. Power saving x x x
  14. Battery voltage monitoring x x x
  15. HSL color model x x
  16. Remote control via UART x x
  17. Settings in EEPROM x x
  18. Debugging via UART x x
  19. Firmware update via UART x x
  20. ============================ =========== ============ ========= ========= ========= =========
  21. Hardware schematics
  22. ===================
  23. Schematics for ATMega based setups: `schematics-atmega/simplepwm-atmega.pdf <schematics-atmega/simplepwm-atmega.pdf>`_
  24. Schematics for ATTiny based setups: `schematics-attiny/simplepwm-attiny.pdf <schematics-attiny/simplepwm-attiny.pdf>`_
  25. Prebuilt firmware images
  26. ========================
  27. 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).
  28. The corresponding fuse settings can be found in the file `fuses.txt` in the same directory.
  29. Building the firmware
  30. =====================
  31. The firmware build needs the following tool chain:
  32. * Unix-like operating system
  33. * GNU make
  34. * AVR GCC
  35. * AVR Binutils
  36. * avrdude
  37. Run the following commands to build the firmware:
  38. .. code:: sh
  39. cd firmware
  40. make DEV=t85
  41. Please specify the target microcontroller using the DEV variable as shown above.
  42. Valid values are:
  43. =============== ===========
  44. Microcontroller make option
  45. =============== ===========
  46. ATTiny 13 `DEV=t13`
  47. ATTiny 25 `DEV=t25`
  48. ATTiny 45 `DEV=t45`
  49. ATTiny 85 `DEV=t85`
  50. ATMega 88 `DEV=m88`
  51. ATMega 88P `DEV=m88p`
  52. ATMega 328P `DEV=m328p`
  53. =============== ===========
  54. Additional build options that can be passed to `make`:
  55. =============== ====== ============== ================================================================
  56. make option values default description
  57. =============== ====== ============== ================================================================
  58. CONF_PWMLIM 1-100 100 Limit the maximum PWM duty cycle to this percentage.
  59. CONF_PWMINVERT 0-1 0 Invert the PWM output signal(s).
  60. CONF_LOWSPFACT float 1.0 Correction factor for lower range PWM setpoint.
  61. CONF_ADCINVERT 0-1 0 Invert the ADC input signal(s).
  62. CONF_ADCHSL 0-1 depends on DEV Interpret the ADC input signals as HSL setpoints instead of RGB.
  63. FEAT_HIGHRES 0-1 depends on DEV Higher resolution in very low PWM setpoint range.
  64. FEAT_BATTERY 0-1 depends on DEV Battery voltage monitoring
  65. FEAT_POWERSAVE 0-1 depends on DEV Power saving / deep sleep
  66. FEAT_REMOTE 0-1 depends on DEV Remote control via UART
  67. FEAT_EEPROM 0-1 depends on DEV Store settings to EEPROM
  68. FEAT_BOOT 0-1 depends on DEV Enable bootloader and firmware updating via UART.
  69. =============== ====== ============== ================================================================
  70. Flashing the firmware via serial bootloader after build
  71. =======================================================
  72. Run the following commands to flash the firmware via serial bootloader to the target microcontroller.
  73. This only works, if there's already a previous version of SimplePWM running on the chip. If the chip is blank, refer to ISP flashing below.
  74. .. code:: sh
  75. cd firmware
  76. ./flash-usb.sh /dev/ttyUSB0
  77. Flashing the firmware via ISP adapter after build
  78. =================================================
  79. Run the following commands to flash the firmware via ISP (In System Programmer hardware adapter) to the target microcontroller:
  80. .. code:: sh
  81. cd firmware
  82. make DEV=t85 print_fuses
  83. make DEV=t85 write_fuses
  84. make DEV=t85 write_mem
  85. Or alternatively use any other of the available AVR flashing tools to program the .hex file and fuses.
  86. License
  87. =======
  88. Copyright (c) 2018-2021 Michael Buesch <m@bues.ch>
  89. 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.
  90. 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.
  91. 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.