{"id":23382137,"url":"https://github.com/chiefenne/attiny85-servo-control","last_synced_at":"2025-04-08T08:44:45.287Z","repository":{"id":75755267,"uuid":"163573676","full_name":"chiefenne/ATTINY85-Servo-Control","owner":"chiefenne","description":"Interrupt based servo control with full 8-bit resolution","archived":false,"fork":false,"pushed_at":"2018-12-31T22:26:16.000Z","size":557,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-14T05:41:20.662Z","etag":null,"topics":["atmel","attiny85","avr","rc","servo-controller"],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chiefenne.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-12-30T08:41:35.000Z","updated_at":"2022-11-19T17:57:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"f49c400d-0bbb-41a8-b95d-a87decc0c449","html_url":"https://github.com/chiefenne/ATTINY85-Servo-Control","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chiefenne%2FATTINY85-Servo-Control","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chiefenne%2FATTINY85-Servo-Control/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chiefenne%2FATTINY85-Servo-Control/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chiefenne%2FATTINY85-Servo-Control/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chiefenne","download_url":"https://codeload.github.com/chiefenne/ATTINY85-Servo-Control/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247808083,"owners_count":20999653,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["atmel","attiny85","avr","rc","servo-controller"],"created_at":"2024-12-21T21:17:39.750Z","updated_at":"2025-04-08T08:44:45.277Z","avatar_url":"https://github.com/chiefenne.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# ATTINY85 Servo Control\n\n[![GitHub](https://img.shields.io/github/license/mashape/apistatus.svg)](https://en.wikipedia.org/wiki/MIT_License)\n\nAn RC servo control using an [AVR ATTINY85 microcontroller](https://www.microchip.com/wwwproducts/en/ATtiny85). The control offers an interrupt driven full 8-bit resolution for a standard RC servo. The control is setup via the *8-bit Timer/Counter1* as it offers the the required prescaler (CK/32) to get a 250 kHz timer frequency from an 8 MHz clocked CPU. This allows for approximately 256 steps (8-bit) over a 1 millisecond period.\n\n## Features\n - The servo can be moved to 256 positions within its 1ms-2ms duty range\n - A standard RC servo normally operates a total angle of approximately 90° (+/- 45°)\n - This is done via a 50 Hz PWM signal with a duty cycle of 5% (minimum position) to 10% (maximum position)\n - This means a 20 millisecond PWM signal with a duty cycle of 1 ms to 2 ms\n - To get the full resolution of the 8-bit microcontroller, the *8-bit Timer/Counter1* is setup so that it takes the 8-bit range (256 steps) for the complete duty cycle variation, i.e. 1 millisecond\n - With this setup a resolution of 0.35° per step is possible which is enough for a smooth servo motion\n - A potentiometer can be attached (configured in function *Init_ADC* via the MUX bits for PB3) and used to control the servo position (tested with a 10k\u0026Omega; potentiometer)\n - An LED attached to LED_PORT indicates the servo center position (use a 200\u0026Omega; resistor for the LED)\n - The pins for servo and LED can be configured by the corresponding macros (SERVO_PORT, LED_PORT). Do not use VCC, GND and RESET pins\n\n## Example Breadboard Configuration\n\nObviously, before use, the code **main.c** needs to be programmed on the device via any ISP programmer.\n\n![](images/Fritzing_Layout_1.png)\n\n## Credits\n - The idea was found in the [AVR Freaks Forum](https://www.avrfreaks.net/comment/810846#comment-810846) posted by user **JimK**\n\n## Prerequisites\n - For the code to work the CPU needs to run at 8 MHz (this is NOT the factory default)\n - The fuse **CKDIV8** has to be unset, otherwise the CPU would run at 1 MHz\n - As an alternative the **CKDIV8** could be left as is (factory default), but then the prescaler for the *8-bit Timer/Counter1* has to be set to **4** (using the CS1x bits in the *8-bit Timer/Counter1* control register TCCR1). This alternative is untested.\n\n\u003c!--- HTML code used in order to be able to resize image --\u003e\n\u003cimg src=\"images/Fuse_Settings.png\" alt=\"drawing\" width=\"600\"/\u003e\n\n**Setting of fuses in ATMEL Studio 7 - CKDIV8 unchecked for 8 MHz clock speed**\n\n## Additional information\n - Official MICROCHIP [ATTINY85 datasheet](http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-2586-AVR-8-bit-Microcontroller-ATtiny25-ATtiny45-ATtiny85_Datasheet.pdf)\n\n\u003cbr\u003e\u003c/br\u003e\n\nDistributed under the MIT license. See [LICENSE](https://github.com/chiefenne/ATTINY85-Servo-Control/blob/master/LICENSE) for more information.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchiefenne%2Fattiny85-servo-control","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchiefenne%2Fattiny85-servo-control","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchiefenne%2Fattiny85-servo-control/lists"}