{"id":357,"date":"2014-08-27T04:37:54","date_gmt":"2014-08-27T04:37:54","guid":{"rendered":"http:\/\/bitcows.com\/?p=357"},"modified":"2014-08-27T04:37:54","modified_gmt":"2014-08-27T04:37:54","slug":"atiny85-breathing-light-using-an-arduinio","status":"publish","type":"post","link":"https:\/\/bitcows.com\/?p=357","title":{"rendered":"Program a ATtiny85 SOIC 8 using an Arduino"},"content":{"rendered":"<p>I like small electronics so when i found a sketch to make a Apple like breathing light (thanks <a href=\"http:\/\/thecustomgeek.com\/2011\/06\/17\/breathing-sleep-led\/\" target=\"_blank\" rel=\"noopener noreferrer\">Jeremy Saglimbeni<\/a>) I decided I wanted to make it, but small. So I looked around and found a SOIC sized tiny85 chip I had laying around. <\/p>\n<p><strong>THE SKETCH<\/strong><\/p>\n<pre class=\"prettyprint\">\/*\n\"Breathing sleep LED, like on a Mac.\nJeremy Saglimbeni 2011\nthecustomgeek.com\nModified by Darren Mason 2014 bitcows.com\n\nLED is attached to pin 11 in series with a 5.6K resistor\n*\/\nint i = 0;\nint LED_PIN = 0; \/\/tiny85 pin 6\nvoid setup() { \/\/ bring the LED up nicely from being off\n  for(i = 0 ; i <= 15; i+=1)\n  {\n    analogWrite(LED_PIN, i);\n    delay(5);\n  }\n}\nvoid loop()\n{\n  for(i = 15 ; i <= 255; i+=1)\n  { \n    analogWrite(LED_PIN, i);\n    if (i > 150) {\n      delay(4);\n    }\n    if ((i > 125) && (i < 151)) {\n      delay(5);\n    }\n    if (( i > 100) && (i < 126)) {\n      delay(7);\n    }\n    if (( i > 75) && (i < 101)) {\n      delay(10);\n    }\n    if (( i > 50) && (i < 76)) {\n      delay(14);\n    }\n    if (( i > 25) && (i < 51)) {\n      delay(18);\n    }\n    if (( i > 1) && (i < 26)) {\n      delay(19);\n    }\n  }\n  for(i = 255; i >=15; i-=1)\n  {\n    analogWrite(LED_PIN, i);\n    if (i > 150) {\n      delay(4);\n    }\n    if ((i > 125) && (i < 151)) {\n      delay(5);\n    }\n    if (( i > 100) && (i < 126)) {\n      delay(7);\n    }\n    if (( i > 75) && (i < 101)) {\n      delay(10);\n    }\n    if (( i > 50) && (i < 76)) {\n      delay(14);\n    }\n    if (( i > 25) && (i < 51)) {\n      delay(18);\n    }\n    if (( i > 1) && (i < 26)) {\n      delay(19);\n    }\n  }\n  delay(970);\n}<\/pre>\n<p><strong>THE SOFTWARE<\/strong><\/p>\n<p>The next we need to do is put the bootloader on this chip. To do this you will need to place the <a href=\"https:\/\/code.google.com\/p\/arduino-tiny\/downloads\/detail?name=arduino-tiny-0150-0020.zip\" target=\"_blank\" rel=\"noopener noreferrer\">attached code<\/a> in the following location. The default location on a MAC is \/Users\/[YOUR USER NAME]\/Documents\/Arduino\/hardware<\/p>\n<p><strong>ARDUINO<\/strong><\/p>\n<p>Now lets open up the Arduino programmer app.<\/p>\n<p>You need to set up your arduino first in order to program by choosing the sketch ArduinoISP:  <code>File > Examples > ArduinoISP<\/code><\/p>\n<p>Make sure you have your Arduino board correctly choosen: <code>Tools > Boards > Arduino UNO<\/code><\/p>\n<p>Then make sure your programmer is set to Arduino as ISP: <code>Tools > Programmer > Arduino as ISP<\/code><\/p>\n<p>Then load the sketch to your Arduino <Command+U><\/p>\n<p>Once that is complete you  are ready to bootload your chip. Assuming everything is connected correctly choose your ATtiny85 board from the Boards menu: <code>Tools > Boards > ATtiny 25\/45\/85<\/code><\/p>\n<p>Then run the Burn Bootloader command: <code>Tools > Burn Bootloader<\/code><br \/>\nThis will set up the chip to run correctly.<\/p>\n<p>You should see your Arduino\u2019s lights flicker for a few seconds with no errors in the console and that\u2019s it. You have bootloaded your ATtiny85 chip. Now with this same set up you can put any program you like on that chip. Then disconnect the Arduino and you should see your program running with only power supplied to it.<\/p>\n<p>Lastly put your sketch on the chip<br \/>\n<code>File > Upload Using Programmer<\/code><\/p>\n<p>Ok i know this is an RGB LED with one source so its white but its just the light i had.<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/bitcows.com\/wp-content\/uploads\/2014\/08\/Untitled-Sketch_bb.png\" alt=\"tiny85 breather\" width=\"1590\" height=\"639\" class=\"alignnone size-full wp-image-364\" \/><br \/>\n<img decoding=\"async\" src=\"http:\/\/bitcows.com\/wp-content\/uploads\/2014\/08\/IMG_7444.jpg\" alt=\"Breath Light\" width=\"450\" class=\"alignnone size-full wp-image-362\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I like small electronics so when i found a sketch to make a Apple like breathing light (thanks Jeremy Saglimbeni) I decided I wanted to make it, but small. So I looked around and found a SOIC sized tiny85 chip I had laying around. THE SKETCH \/* &#8220;Breathing sleep LED, like on a Mac. Jeremy&hellip;<\/p>\n<p class=\"more-link\"><a href=\"https:\/\/bitcows.com\/?p=357\" class=\"themebutton\">Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":362,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"class_list":["post-357","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-electronics"],"_links":{"self":[{"href":"https:\/\/bitcows.com\/index.php?rest_route=\/wp\/v2\/posts\/357","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bitcows.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bitcows.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bitcows.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bitcows.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=357"}],"version-history":[{"count":0,"href":"https:\/\/bitcows.com\/index.php?rest_route=\/wp\/v2\/posts\/357\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/bitcows.com\/index.php?rest_route=\/"}],"wp:attachment":[{"href":"https:\/\/bitcows.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=357"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bitcows.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=357"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bitcows.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=357"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}