Output Devices

Week 12

Introduction

Introduction

While input devices could be called the sensory organs of circuit boards, output devices are it's means of communication or of affecting their environment. For my project, I need a lot of RGB LED's. 42 to be precise. I divided them onto three boards, each with 14 RGBs connected via charlieplexing to an ATtiny44, which manages the operation of each of these lights. The LED's can then be made to assume theoretically any color by flashing too rapidly for the human eye to perceive, creating the effect of a constant light in the desired color. For now, I have written code that allows the user to choose between red, green, blue and white.

Preparatory work Final result Code pack Circuit pack

Dual sided circuitry

Peaks, plateaus and pitfalls of dual sided circuitry.

Step 1: Read guides and tutorials, and test specs.

There is surprisingly little material available on making two sided circuits on the modela milling machine. There are a few things to consider: Holes, rivets, alignment, milling bits and how to actually draw the circuit in Eagle.

One of the most helpful tools to get started is the Fab tutorial on PCM rivets. It details the process for rivetting a circuit boards. The rivets we use for circuits are either 1 or 0.6mm in internal diameter. If you need to pass a wire through the hole, you probably need the bigger diameter, but for my project, the 0.6mm rivets work just fine. I decided to mill the test from the tutorial to see how it works on our machine. My conclusion was that a 0.69mm hole is the best size for our machine.

I also did a second test, to be certain of the drill diameter for Eagle.

Tutorial on PCB rivets

Step 2: Test the design parameters and match them to the specs.

Now that I had the best hole size, I felt pretty ready. I even drew, milled and soldered a test hello board, then programmed it. There were a few issues. Because I placed my vias haphazardly during the process, some of them weren't properly spaced, and I had to cut some copper away to remove a short from the board. Additionally, while the rivets worked, I had to do a lot of post-processing to my image after the eagle work was complete in order for the holes to work on the Modela.

Therefore, the proper "step 2" Is to draw up your own hole test in Eagle, where you find the correct diameter and drill settings for your vias before you draw your circuit. The goal is to draw them so that they can be exported directly, without any further need for processing.


Step 3: Mill your test

One of the issues with our modela during this process was that it looses the z axis aligment in between cuts. Normally, this is not an issue since we always send it to view mode, switch out the milling bits from 1/64" to 1/32" and back, depending on the job, but when making holes, you use the same milling bit for the holes and the outline, meaning that I did not see a need to re-zero the z-axis, resulting in a spectacularly broken milling bit.

Another issue can be that if your holes are drawn too small, the fabmodules won't be able to see them or see any way to mill them. They need to be "just right", so that it will drill them in the correct size. The test is not two-sided, so aligment is not an issue yet. We'll discuss alignment later on. For me, the best drill size setting is 37 mil, with the radius set to "auto".

Finally, the milling bit can get gummed up with the dust from the plastic and the copper that is being milled. I had to clear the flutes three times on average per board. If your milling bit just sort of taps down and makes a shiny little spot, it's a sign that your flutes are clogged and you need to stop the process, remove the bit and clean it, then replace it before continuing.


Step 4: Draw your circuit

Now that you have your preferred hole size and the correct settings for Eagle, draw up your circuit board. In order to activate the back layer of copper, go to the DRC menu and select layers. In the dialog box write (1*16) This designates the top layer as layer 1, the bottom layer as layer 16 (which is the standard layer for the bottom) and says that they have an insulating layer in between.

When routing your board, clicking the middle mouse button will allow you to go between layers, each middle mouse click will allow you to place a via, then you can continue the route on the other side. It takes a little while to get used to but is really quite fast once you get the hang of it.


Step 5: Milling and aligning

Most of the guides call for alignment brackets, but the best practice I've found for milling two-sided boards on the Roland mill we have is:

  • Back.traces. Mill this as normal, with a 1/64"bit.
  • Back.holes. Mill this with the 1/32" bit. If the holes are being calculated correctly, they should look like little blue dots on the path.
  • Interior. Re-zero the z-axis as if you changed the bit. Mill as normal with a 1/32" bit.
  • Front.traces. Carefully place the board back in the space you cut it out of. Mill as normal, but keep an eye on it.
  • Be careful to remove any dust that may have settled on either layer, remove any old tape and apply fresh tape for the second cut. You need the circuit board to be firmly fixed to the sacrificial layer before doing the front trace. On our mill, the board needs to be approx half a mm away from the edges on all sides of the hole.


    Step 6: Riveting

    If you followed the steps above you already riveted your tests, but for form's sake, I wanted to mention this step. Take your rivet, for my board, I need the 0.6mm rivets. Place it in its hole, then with a fine point, hammer it so it folds out, then with your hammer, whack the board, so the rivet becomes flat and beautiful. Whack it an extra time if you are frustrated because this took so long. Do it now, before you solder anything on it that can't handle a good whack. Repeat for every single hole on the board. All of them. Then solder your rivets to ensure good conductivity between the traces and the vias. Solder on both front and back. This is your life now.


    Step 7: Soldering

    It is helpful to cut a frame for your circuit board, so that once you have soldered components on one side, you can flip the board over and solder the back. If you only have components on the front, like I do in my example, solder as normal.

    Later, I created more dual-sided circuit boards, and I used a clamp to hold the board steady and off the table while I soldered it.


    Step 8: Troubleshooting

    I was in a hurry and soldered 6 resistors to the wrong pins before realizing. I then rushed the removal, ripping some of the ends off before resoldering the same resistors. This was bad, because that of course means that the resistors do not function any more.

    Once I resoldered the resistors, the board funtioned as well as could be expected. The traces are not all as thick as they should be, because I failed to use the correct drc settings. This means that I needed to connect some points with airwire, and others are still not working properly. Still, this is a functioning prototype of the LED boards I want in my final design, so the effort was worthwhile.


    The lights that give the wisp a function

    42 RGB leds controlled by 21 pins.

    Integrating and improving

    My first attempt was a moderate success, but it's neither pretty nor able to communicate with a sensor board, so I reworked the schematic to include rx and tx pins, and arranged the board to fit along the edge of my lamp. I had some difficulty exporting the images due to artefacts in hidden layers, but once those were removed, it became possible to make consistent, usable files.

    Creating these boards is much the same as my initial attempts. They are cymmetrical, so I can flip them lengthwise to mill the backside. I now mill the front first, then do the outline and holes in one go, flip and mill the backside. I continue to align it in the middle of the cutout hole, eyeballing the correct placement, and it has yielded good results.


    Charlieplex code

    The pins that control LED's in a charlieplex circuit have three possible states. They can be labelled as INPUTs, or OUTPUTs of either HIGH or LOW. In order to light a specific LED, you must turn on the outputs that connect to it, with one as HIGH and the other as LOW. All other pins must be set as INPUTS, to avoid lighting any additional LED's. What this means is that you can write nested "if" functions that go turn each pin into OUTPUT mode sequentially, in order to achieve what you want.

    For example, let's say I want to make D4 blue. I would need to set ROW4 to OUTPUT on HIGH, and set ROW2 to OUTPUT on LOW, while all other pins remain INPUTs. Likewise, if I want D5 to go red, I set ROW5 to OUTPUT and HIGH and ROW3 to OUTPUT on LOW. To avoid any other LEDs showing random unwanted colors, I set each one back to being an INPUT as soon as their job as an OUTPUT is done.


    Mapping and plotting

    To gain control of each individual LED, one needs to understand it. I created my schematic with certain patterns. For example, 6 of my green diodes need Row 1 to be set as an OUTPUT on LOW to light up, while 1 uses Row2, 4 use Row5 and 3 use Row4. This means that there are consistencies which allow us to use math and logic to create colors.


    Writing the code

    I included softwareSerial to enable my phototransistor board to control the LED boards, but if someone wanted a board with lighter code, it can easily be removed. As is, the user needs to write manually which color to use, but I aim to connect a ble board to the network at a later time, which would communicate the desired color to the ATtiny's controlling the LEDs.

    The code includes red, green, blue and white, not pictured. White was the simplest, as it simply needed all of them to be activated in rapid sequence, with no need to isolate individual LEDs.


    conclusion

    These boards required a great deal of troubleshooting. At first, I was getting a lot of errors. My red code created 2 blues, 1 inactive, 4 pinks and the rest were red. My blue code had one cyan, 9 blues, 1 red and 2 inactive LEDs, the green code was mostly all right, but 12 was inactive and 13 and 14 were blue. The culprits were in the logic I used in the code. I was defining ranges where I needed to say "if the number is between 2 and 6, do this" and used the wrong symbols to define the range. I discovered that one must define m as bigger that 1 first, then, sepparated by two ampersands, one defines that m is smaller than 7. Once I fixed this, most of my LEDs function properly. I believe that any misbehaving LEDs at this point are due to weak connections or faulty soldering.

    Next page Fab Academy