Milling PCB board

For this assignment I had to make my for pcb board with my own layout. I was assigned a G / g, as we are making a sign where all boards will be chained.

Here is the final board.

It blinks with a slow linear fade when it isn’t touched. However it has an onboard capacitive sensor, the line on the G. If you touch it, the 18 leds blink every 500 milliseconds.

Here is the Arduino code

#include <CapacitiveSensor.h>

/*
   Based on CapitiveSense Library Demo Sketch from Paul Badger 2008
   Uses a high value resistor e.g. 10 megohm between send pin and receive pin
   Resistor effects sensitivity, experiment with values, 50 kilohm - 50 megohm. Larger resistor values yield larger sensor values.
   Receive pin is the sensor pin - try different amounts of foil/metal on this pin
   Best results are obtained if sensor foil and wire is covered with an insulator such as paper or plastic sheet
*/

/*
  Code by Louise Lessél
  Blink based on capacitive sensor onboard the PCB board. Using a 1 Mega Ohm resistor.
*/
#define pin 0 // Lights on (MOSI) bottom right opposite of dot
CapacitiveSensor   cs = CapacitiveSensor(3, 4); // 1 megohm resistor between pins 3 and 4, pin 4 is sensor pin where capacitor links to

int currentLevel = 0;
int change = 1;

void setup()
{
  // lights
  pinMode(pin, OUTPUT);

  // Capacitive sensor
  cs.set_CS_AutocaL_Millis(0xFFFFFFFF);     // turn off autocalibrate on channel 1 - just as an example
  Serial.begin(9600);

}

void loop()
{
  long start = millis();
  long reading =  cs.capacitiveSensor(30);
  Serial.print(millis() - start);        // check on performance in milliseconds
  Serial.print("\t");                    // tab character for debug window spacing


  Serial.println(reading);

  if (reading > 500) {
    digitalWrite(pin, HIGH);   // turn the LED on (HIGH is the voltage level)
    delay(50);                       // wait for a second
    digitalWrite(pin, LOW);    // turn the LED off by making the voltage LOW
    delay(50);                       // wait for a second
  } else {
    // add change to brightness:
    currentLevel = currentLevel + change;
    // and constrain:
    currentLevel = constrain(currentLevel, 2, 254);
    // if brightness is at either extreme, change the
    // direction of fading:
    if (currentLevel == 2 || currentLevel == 254) {
      change = -change;
    }
    // change the light:
    analogWrite(pin, currentLevel);
    delay(5);
  }
}

The full project can be found here https://github.com/louiselessel/HomemadeHardware_git

Board design in eagle


The board is designed with the following components:

  • 1 x 1 mega ohm resistor (for the capacitive sensor)
  • 18 x leds
  • 18 x 470 ohm resistors
  • 1 x 10 k ohm resistor
  • 1 x 47 uF capacitor
  • 1 x 0.1 uF capacitor
  • 1 x transistor
  • 2 x Lipo battery connectors

The squares in the schematic are soldering points for programming the ATtiny. When attached in this way, all of the LEDs will flash as the board is programmed. Pretty smart!

pdf of the schematic https://github.com/louiselessel/HomemadeHardware_git/blob/master/HomemadeHardware_Letter/HomemadeHardware_Intro_sch.pdf

Milling

I followed this guide for milling http://homemadehardware.com/guides/bantam-setup/
I found that I did not need the engraving bit since I had made the traces wide (0.8 mm) almost all over the board. Except from under the ATtiny where I had to adjust it after telling EAGLE which bits I had to work with.

This was with the smallest bit in.
This was with all of the bits. Notice the change in the capacitive sensor bit part on the G.
It no longer has its pattern! So Bantam apparently solves for these things depending on bits.
This can change your design.

Process order

I followed this order that Andy told us in class.

My copper layer got ripped up as I was soldering.
At first I thought it would be a good idea to make the solderpoints larger or make the programming pins as via holes instead. But according to Andy these are even more prone to ripping the copper up. He also told me to ALWAYS use very flexible wire. Like stranded wire. and not the solid core I had used. I managed to chang the wires and salvage the soldring point

I tested the board while powered from my Arduino. And it had 4.76 V coming in and going out. So no voltage drop.

Programming

At first I encountered a lot of problems while programming.

I first tried to program it through the jig we made. But Andy showed me a much easier way. He also told me that most likely putting the connector wires into the breadboard like that would be wonky.

Don’t do the programming like this.
Programming the board should be done like this – much easier than what I had done!!!
Also, solder header pins on the soft wires! Here Andy helped me add in the extra capacitor between power and ground to reduce noise. But that actually ended up not being necessary.

Problems
I was able to burn the bootloader in the ATtiny, but then I kept getting a “content mismatch” error. I don’t know why I was getting this. I found the “enable verbose output” in settings and that still didn’t provide more information. And neither did google. So I kept trying to upload. Then I tried to double check the voltage on the board.

Here is a video of what I did at first:


Arduino: 1.8.12 (Mac OS X), Board: "ATtiny25/45/85, Disabled, CPU, ATtiny85, 8 MHz (internal), EEPROM retained, B.O.D. Disabled, Enabled"


Sketch uses 874 bytes (10%) of program storage space. Maximum is 8192 bytes.
Global variables use 9 bytes (1%) of dynamic memory, leaving 503 bytes for local variables. Maximum is 512 bytes.
avrdude: verification error, first mismatch at byte 0x0000
         0x00 != 0x1d
avrdude: verification error; content mismatch
avrdude: verification error; content mismatch

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Then I got a “Yikes” error. It was unable to locate the board. That usually means the chip is fried.
This might be due to static electricity – boards can be sensitive. Andy suggested to always touch something grounded before working on them. It might also be my voltage testing, I might have shorted it for a brief moment.

Solution: switching the chip fixed it. I also removed the transistor as suggested by Andy. But I am not sure if this had an effect. I put it back on as soon as I had uploaded the blink sketch.

Further solution (suggested by Andy) is to make sure there is a resistor between pin —— and the transistor. This should be done going forward!

Changes
Next time I make a board it is very important that there is a capacitor close to the power —- pin on the ATtiny “Most importantly, I’ll put a smaller capacitor between 0.047-0.2uF (micro-farad) as close to one of the microcontroller’s power pins. And then the other leg goes to a nearby ground.” As explained in http://homemadehardware.com/guides/arduino-uno-components/! I had moved this too far away. It is there to reduced noise. And we almost had to add another capacitor.

https://github.com/PaulStoffregen/CapacitiveSensor

Final sign