how to make [almost] anything mas.863.12   work about
   
 
                   
 
 
   
 
                   
 
electronics programming week_6  


electronics programming

The focus of this week was to develop a better understanding of programming, custom electronics programming in particular. Before getting to deep into the code though I knew from the circuit design week that the board I designed was still giving me an error when trying to initiate it. The first step was to revisit my eagle design from week 4. Neil noticed during the week 4 review that there were a few pads and traces on my board that were too close. I went back to eagle and spaced things out a bit to make sure I could get a clean mill this time. It also helps to preview the .ps file from the fab modules a few times to make sure the tight spots look ok. Just to be safe I reduced the number of passes around the traces to 3 rather than 4. I would rather spend a bit more care soldering than make a larger board.


   
   
 
 
   
 
                   



Milling the new traces. Note: An extra thanks to the person who fabbed the double sacrificial layer set up. There is a top layer with corner and thumb reveals that is sized to accept the stock size copper boards we start from with a typical sacrificial layer underneath. It is not a huge time saver but an nice addition for fixturing to the modella.
   
 
 
 
   
 
                   



While waiting for the board to mill I spent plenty of time checking my schematic and picking the parts. A nice trick for keeping your parts from getting lost is to use a strip or two of the double sided tape and some scrap paper or card stock from the recycling bins and sticking each part down with a quick note of what it is. This saves some back and forth time checking the part under the magnifying lens etc.
   
 
 
 
   
 
                   



I was then extra careful to use the flux pen on the board to prevent unwanted solder jumps, double check all of the orientations of my components and get shinny clean solder joints. I am also suspicious that the button on my previous board was soldered on in the wrong direction. Allowing a little extra time pays off.
   
 
 
 
   
 
                   



During week 4 when I was having trouble figuring out what was going on with my initial board there was some discussion about the Arduino code to ATTiny workflow so being somewhat familiar with processing I decided to take the Arduino programming route. Although I am much more comfortable than I was previously running things in the terminal can sometimes result in me breaking things that I am not sure that what I am doing. While floundering in the wilderness it is sometimes nice to at least have one or two tools you at least have an idea of how to use.
   
 
 
 
   
 
                   



David's page has super clear and detailed instructions on how to interface with the ATTiny chips as well as what is happening on the pins. For more in-depth reading read the documentation for your chip.
   
 
 
 
   
 
                   



Follow David's link github to grab the things you will need to place in your Arduino libraries folder. By now the things that are scattered around git hub make much more sense after spending a few weeks interacting with mercurial.
   
 
 
 
   
 
                   



With the github package installed into your libraries folder you should see something like this. Be sure to specify your matching board and clock speed.
   
 
 
 
   
 
                   



I opted to limit my variables when trying to get my board to work this week and used the AVRISP mkii programmer from the arch shop.
   
 
 
 
   
 
                   



After burning the bootloader to the board I was able to open a simple arduino blink sketch and modify the pins to match up with my board as well as adjust some of the variables of the blink.
   
 
 
 
   
 
                   



I also wrote a code that would blink the led in a fading affect like that on the front of a non-retina macbook.
   
 
 
 
   
 
                   



The revised board running code from arduino. The button was set to interrupt the led's power.
   
 
 
 
 
   
  -- jared laucks -- © 2006-2012 --