Fab Academy 2018

Wk7. Electronics Design



What’s in electronic design?

Electronic design workflow generally involves:

Neil's board

I think it is good to first have a look a Neil’s board, and get an understanding of what components are in it, why and what they do. I found great documentation and help from Pip, a past fabstudent from whom I sourced this image. Thanks Pip! Going clockwise up from the ATTiny44, this is what we have:

Getting Started with Eagle

For convenience sake, and because most of our instructors are familiar it, I choose to do this assignment in Eagle. EAGLE is owned by AutoDesk and stands for Easily Applicable Graphical Layout Editor and is free on a limited licence, but this is enough for what I need to do. With more time, I would like to explore KiCad as it is free and open source.

To get myself started, I followed the Fab tutorial here. Eagle can also seem clunky and annoying at first, so I recommend Jeremy Blum’s tutorials to get the hang of the tool. Also essential reading are the Sparkfun Eagle tutorials, how to read a schematic and integrated circuits.

After downloading and installing Eagle, I downloaded the fab library (fab.lbr) file and drop it into the libraries folder in Mac OS under, Applications/Eagle/lbr. To activate the library launch Eagle and go to libraries/use.

Schematics

Once inside Eagle, I created a new project, and new schematic. This layout allows me to start adding in my components. To do this I used the add button on the left toolbar, which pops up the library window with millions of components. They are listed alphabetically, so under the fab library I was able to locate and choose all the components for my board. See below:

Schem1 Schem2

Connecting the components on the schematic is not so intuitive, but once you get the hang of it, it’s pretty straight forward. To do this we use the NET tool.

You don’t need to draw direct lines to each pin or connection as this will inevitably lead to cross-overs and spaghetti junctions. Creating a path with the NET from a component, and naming it will suffice. Do this by right clicking the path and selecting NAME. Remember to LABEL the path the same way.

NET -- NAME -- LABEL

Some components will need connect to both ground GND and power VCC so it is normal to have more than one connections to both VCC and GND.

It is also good practice to put values on our resistors and capacitors, as in this exercise we will be using different size resistors with the LEDS and they are easily confused.

Finally, in TOOLS: ERC (electronic rules check) I made sure my board will actually work. When I first did this it presented a few problems that I had to remedy. See here:

ERC

Laying out the circuit

When you open up the board layout, Eagle should have linked it to the schematic. If you by mistake opened a board before the schematic it may not recognise it. The connection points should show up as red rectangles in the board window and the connections between components should appear as yellow lines.

I now re-arranged the components on the board using the select and the move tool. Once selected, right clicking will rotate the selected component. Bring the components as close as possible to their connecting parts. By using the move tool and you can also move components in groups.

Once components are more or less aligned and as close to their corresponding connections, draw the traces using the traces tool. Click in the centre of a component to start a trace, then right-click to change angles.

The traces will snap according to a preset grid, which is annoying when trying to route through narrow spaces like under the ATtiny. Type the command: GRID FINEST to bring allow for more tolerance and then rest it with GRID LAST.

This part took some patience. Below you can see how I redesigned the board added two LEDs and corresponding resistors.

NOTE: It is good to turn the various layers on and off using the layers tool, at the top left of the toolbar. This allows you to see which component is which, or can turn off labels to help you concentrate with those traces.

Fails, errors, lessons:

Using the DRC or design rules check (back in board view) I made sure all the default settings were in 16 mil. This showed me multiple errors where the traces were too close together, and where I did not have them properly connected. I also realised that I hadn’t been using the fab resistors which are of a different pad size, so I had to go back and replace those.

Schem1

At first I also had mis-connected the RXD and the TXD between pin 12 and 13 on the Micro controller and FTDI connector as these all look the same, and my dyslexia doesn’t help. MOSI and MISO are also easily confounded. I recommend doing a thorough pin to pin check through the circuit once you are done tracing.

Export, Import

A number of our class MACOS users had trouble getting a good enough resolution PNG when exporting an image directly from EAGLE. I tired using the CAM PROCESSOR file: Cam Processor to create an EPS file. To do this make sure in Eagle board view I only had top, pads and vias selected. Then when setting the file location to save, make sure to write the extension .eps before clicking PROCESS JOB.

This however, failed to work so I ended up exporting from Eagle as a PNG as usual, recording the file dimensions and resizing the image (not the canvass) in Photoshop.

The process is as follows:

Schem1

Making an outline in Photoshop

Milling on the Roland Modela

Milling on the Roland Modela a little more tricky than the Roland SRM-20 I used in Week4. It runs on our Linux Ubuntu desktop which means you have to run FabModules from the Terminal which takes getting used to.

Once launched, the Python program of Fabmodules works much the same as the online one. Select the .png image in the format and then in process select our friend Roland Modula. Then click: make.png_rml. The PNG (let’s start with our traces using the 1/64 bit) should appear on the left. When you click MAKE:PATH the milling outline will appear. As with the Roland Mill, you can define the offests, or have none by sticking to -1.

Modula is not as friendly setting the X/Y as the fancier Roland. Basically, you have to add values in the Xmin and Ymin boxes, under the to:rml panel. Depending on where you stuck your PCB on the mill floor this will vary. The Z axis can only by found using the arrow keys on the machine. Once you have the X/Y more or less, bring down the Z (with the right size bit added a-priori) then as with the Roland, un tighten and gently bring the bit down to board.

With all three axes defined, only then select: MAKE RML. This will set the 0 axis. When you are ready, hit SEND IT in the right panel and the machine will start.

pcbmilling

Milling and Stuffing

First, make an “organised” list of all your components. Name them and MAKE SURE YOU CHECK YOUR RESISTOR VALUES.

List

Now I really recommend to put on some concentrating beats and get soldering!

Dry testing on the digital multimeter (DMM)

First step before programming, we must use the digital multimeter to check that all our connections are working. The multi-meter is your best friend because it will save you going crazy debugging if you know that your circuit is not working as it is supposed to.

Checking for continuity

Programming Hello World

The first step is to connect the newly created Hello Board to the computer using an FTDI ←→ USB cable. The FTDI head looks like this:

FTDI

TO check which usb port our hello board is connected in MacOs go to terminal and run:

$ ls -l /dev/cu*

This gives me:

/dev/cu.Bluetooth-Incoming-Port
/dev/cu.usbserial-A505DVC9

This is my computer telling me what peripherals I have connected. I am looking for /dev/cu.usbserial-A505DVC9.

Connecting the ISP programmer

Now connect the ISP programmer (we made in week 5) to the other USB port. Use the ribbon cable to connect the FabISP and the Hello World board using the two six-pin headers soldered on each. Usually there is a twist in the cable because GND and VCC need to be aligned. Check the board layout from Eagle to make sure. It looks something like this:

List

Notice the black of the ribbon cable is connecting to the same side of the six pin header of both ISP and Hello boards.

For a very first blink test I will use Arduino Integrated Development Environment. If you have not downloaded Arduino IDE do so NOW. This has a number of prebuilt sketches for us to use. However, first we need to enable Arduino Boards Manager to find the ATtiny board we are using.

IDE

Now I am ready to program my board.

This diagram is SUUUPER helpful to figure out which pin to define within the Arduino sketch.

ATtiny44

Here is my Arduino blink sketch:

#define LED 7
#define BUTTON 2

void setup() {
  pinMode(LED, OUTPUT);
  pinMode(BUTTON, INPUT);
}

void loop() {
  if (digitalRead(BUTTON) == LOW) { // IF the button is NOT pressed
      digitalWrite(LED, HIGH);   // turn the LED on
  } else {
      digitalWrite(LED, LOW);   // turn the LED off
  }              
}

Whoop Whoop! Is it on? Is it working?

For more on programming jump ahead to Embedded Programming Week where we get really crahayssy with bits and bytes, trying to figure out how these wee little Attiny’s work.