how to make [almost] anything mas.863.12   work about
   
 
                   
 
 
   
 
                   
 
output devices_week 10  


electronics drivers

The focus of this week was to continue to expand on the skills developed during previous electronics design and programming weeks. In thinking about preparing potentially needed tricks and tips for the electronics needed for the final project I Thought it would be best to develop a motor control interface, in this case a stepper motor driver.


   
   
 
 
   
 
                   



I am impressed week by week with the quality and consistency of the fab modules to modella workflow. After getting the hang of it during the first milling assignment it really makes board prototyping quick and easy.
   
 
 
 
   
 
                   



Milling the traces and the outline with 1/64" and 1/32" bits respectively. A good reminder here is to make sure you hold down on the bit while tightening the set-screws to get good contact with the material while milling the boards. There were some issues with getting a consistant cut in the arch shop but this method seemed to fix the issue all together
   
 
 
 
   
 
                   



Picking the parts to stuff the board this week was a little bit tricker than prior weeks. The ATTiny, capacitors and resistors were fairly straight forward. The new component for me this week were the transistors which can also be referred to as MOSFETs While I was pulling my parts I realized that there are both N and P Mosfets and without any visual cues on the marts themselves I had to do a bit of searching the web to figure out what was what. A quick search found me at wikipedia which has some great diagrams and text to explain Mosfets. The key is to know that N Mosfets sink power and P Mosfets source power. Meaning.. you can determine which you need by reviewing the routing of the board. The N Mosfets in this case were grounding the stepper where the P Mosfets would be pulling the power high. In this case I used N Mosfets, 4 to be exact and they are small and tricky to solder (Take your time and get a good solder joint on them)
   
 
 
 
   
 
                   



The finished board.
   
 
 
 
   
 
                   



This week proved to be quite the challenge in respect to getting the board up and running. With the help of Charles I added a new twist to things by trying to program using a the AVR Dragon. There is a good tutorial on his page that documents this. A few lines of code to add to gain access through the Arduino environment. After several trys and checking connections with the voltmeter I finally narrowed it down to the dragon itself. Every time I tried to burn the boot-loader to the board it would fail. (tip use process of elimination and when in doubt default to the mkII programmer to get up and running.)
   
 
 
 
   
 
                   



Then it was on to programming. I used Neil's example C code compiled in the Arduino environment to get the step program uploaded to the chip. This also proved to be difficult this week. The code compiled and uploaded fine but the behavior of the motor was non-existent. First I checked for power and shorts through the board. I reflowed a few solder joints that looked questionable. Still no movement. I checked the lead pairing on the stepper motor as I had cut off the original in-line connector to add the 2x3 connector, everything checked out. At some point in powering and de-powering the board the 5v regulator got hot and fried, so I replaced that part. With no luck again I decided to replace the chip, and in doing so desoldered the tiny Mosfets as well, in turn giving me a nearly brand new board but soldering onto a board with 3 headers is tricky and my traces were beginning to suffer their original cleanliness. With a nearly rebuilt board I went back to programming with still no luck. WIth a tip from Will I began to adjust the pin mappings to see if got things stepping and after a few tries I at least got the stepper to jitter... while not stepping or making a wave pattern I was happy to see it jitter. Some more pin remapping but still only different degrees of jitter. After essentially giving up, the last option was to build a fresh board, burn the boot-loader, upload the step code and it worked on the first try. It may seem wasteful but in the future after an hour or more of trying to debug it might be best to start with a new board especially if you have hacked parts on and off of the current board a few times, as there is a good chance that you have a short or bad connection somewhere.
   
 
 
 
   
 
                   



The half step code worked on the new board.
   
 
 
 
 
   
 
                   



The full step code also worked fine after the discovery.
   
 
 
 
   
 
                   



The final programed board with stepper and 9v power supply.
   
 
 
 
 
   
  -- jared laucks -- © 2006-2012 --