{"id":42,"date":"2011-03-15T03:23:56","date_gmt":"2011-03-15T03:23:56","guid":{"rendered":"https:\/\/peterklemperer.com\/blog\/?p=42"},"modified":"2016-11-27T04:43:37","modified_gmt":"2016-11-27T04:43:37","slug":"led-matrix-assembled","status":"publish","type":"post","link":"https:\/\/peterklemperer.com\/blog\/2011\/03\/15\/led-matrix-assembled\/","title":{"rendered":"LED Matrix Assembled"},"content":{"rendered":"<p>The LED Matrix lives! This weekend I got it put together and blinking it&#8217;s blinkies!<\/p>\n<p><a href=\"https:\/\/peterklemperer.com\/blog\/wp-content\/uploads\/2011\/03\/LEDMatrix-assembled-3.jpg\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"44\" data-permalink=\"https:\/\/peterklemperer.com\/blog\/2011\/03\/15\/led-matrix-assembled\/ledmatrix-assembled-3\/\" data-orig-file=\"https:\/\/peterklemperer.com\/blog\/wp-content\/uploads\/2011\/03\/LEDMatrix-assembled-3.jpg\" data-orig-size=\"600,399\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}\" data-image-title=\"Assembled LED Matrix &amp;#8211; Lit View\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/peterklemperer.com\/blog\/wp-content\/uploads\/2011\/03\/LEDMatrix-assembled-3-300x199.jpg\" data-large-file=\"https:\/\/peterklemperer.com\/blog\/wp-content\/uploads\/2011\/03\/LEDMatrix-assembled-3.jpg\" class=\"aligncenter size-full wp-image-44\" title=\"Assembled LED Matrix - Lit View\" src=\"https:\/\/peterklemperer.com\/blog\/wp-content\/uploads\/2011\/03\/LEDMatrix-assembled-3.jpg\" alt=\"\" width=\"600\" height=\"399\" srcset=\"https:\/\/peterklemperer.com\/blog\/wp-content\/uploads\/2011\/03\/LEDMatrix-assembled-3.jpg 600w, https:\/\/peterklemperer.com\/blog\/wp-content\/uploads\/2011\/03\/LEDMatrix-assembled-3-300x199.jpg 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>More details after the cut.<\/p>\n<p><!--more--><\/p>\n<p>This project was my first time soldering surface mount components. The great <a href=\"http:\/\/www.sparkfun.com\/tutorials\/96\">SMD How To Tutorial<\/a> from Sparkfun to guided me through this process. \u00a0I did not use any specialized equipment. My cruddy Radio Shack soldering pencil, some flux cored solder, a little desoldering braid, a tiny pair of tweezers, my reading glasses, and a good light were perfectly adequate. \u00a0Next time I&#8217;m going to get some liquid flux. \u00a0I think that would make things <em>flow together<\/em> a bit easier.<\/p>\n<p>At first I only soldered the ATTiny, the 17th LED, and the programming header to verify operation before tackling the rest of the LED field. \u00a0The following command will verify the checksum of the ATTiny using the usbtiny Atmel programmer I assembled last week.<\/p>\n<pre>\/opt\/local\/bin\/avrdude -c usbtiny -p t25 -v<\/pre>\n<p>After sucessfully verifying the checksum, I moved on to making LED 17 blink. \u00a0I adapted <a href=\"http:\/\/paul.graysonfamily.org\/thoughts\/avrlinux\/\">Paul Grayson&#8217;s Linux Atmel AVR Tutorial<\/a> for use with my Mac, programmer, board, and application. I would recommend anyone who is interested in learning avr-gcc do the same.<\/p>\n<p>My program simply sets pins 3 and 4 of my ATTiny25 as outputs and then blinks the LED on and off at a 5% duty cycle.<\/p>\n<pre>\/\/ blink17.c\r\n\r\n#define F_CPU 10000000UL\r\n#include &lt;avr\/io.h&gt;\r\n#include &lt;util\/delay.h&gt;\r\n\r\nvoid delayms(uint16_t millis) {\r\n  \/\/uint16_t loop;\r\n  while ( millis ) {\r\n    _delay_ms(1);\r\n    millis--;\r\n  }\r\n}\r\n\r\nint main(void) {\r\n    DDRB |= 1&lt;&lt;PB3;\r\n    DDRB |= 1&lt;&lt;PB4;\r\n    while(1) {\r\n        \/\/ LED off - both low\r\n        PORTB &amp;= (1&lt;&lt;PB3);\r\n        PORTB &amp;= (1&lt;&lt;PB4);\r\n        delayms(1);\r\n        \/\/ LED on  - PB3 high PB4 low.\r\n        PORTB |=  (1&lt;&lt;PB3);\r\n        PORTB &amp;= ~(1&lt;&lt;PB4);\r\n        delayms(1*20);\r\n    }\r\n    return 0;\r\n}<\/pre>\n<p>The following Makefile will compile and program the device. \u00a0I had already installed avr-gcc on my mac using mac ports. \u00a0If you are attempting to use these instructions yourself you will have to update CC and OBJ2HEX to match the paths on your system.<\/p>\n<pre>CC=\/Applications\/Arduino.app\/Contents\/Resources\/Java\/hardware\/tools\/avr\/bin\/avr-gcc\r\nCFLAGS=-g -Os -Wall -mcall-prologues -mmcu=attiny25 -I\/usr\/local\/avr\/include\/\r\nOBJ2HEX=\/Applications\/Arduino.app\/Contents\/Resources\/Java\/hardware\/tools\/avr\/bin\/avr-objcopy\r\nTARGET=blink17\r\n\r\nall : $(TARGET).hex\r\n\r\n%.obj : %.o\r\n\t$(CC) $(CFLAGS) $&lt; -o $@\r\n\r\n%.hex : %.obj\r\n\t$(OBJ2HEX) -R .eeprom -O ihex $&lt; $@\r\n\r\nprogram : $(TARGET).hex\r\n\t\/opt\/local\/bin\/avrdude -c usbtiny -p t25 -U flash:w:$(TARGET).hex\r\n\r\nclean :\r\n\trm -f *.hex *.obj *.o<\/pre>\n<p>Next up, scrolling text!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The LED Matrix lives! This weekend I got it put together and blinking it&#8217;s blinkies! More details after the cut.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[19,6],"tags":[],"class_list":["post-42","post","type-post","status-publish","format-standard","hentry","category-led-matrix","category-projects"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p1VqWo-G","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/peterklemperer.com\/blog\/wp-json\/wp\/v2\/posts\/42","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/peterklemperer.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/peterklemperer.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/peterklemperer.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/peterklemperer.com\/blog\/wp-json\/wp\/v2\/comments?post=42"}],"version-history":[{"count":0,"href":"https:\/\/peterklemperer.com\/blog\/wp-json\/wp\/v2\/posts\/42\/revisions"}],"wp:attachment":[{"href":"https:\/\/peterklemperer.com\/blog\/wp-json\/wp\/v2\/media?parent=42"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/peterklemperer.com\/blog\/wp-json\/wp\/v2\/categories?post=42"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/peterklemperer.com\/blog\/wp-json\/wp\/v2\/tags?post=42"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}