Week 4 – Marquee Letter PCB Fab
Over the last week I took my PCB design from Eagle to Bantam Tools for PCB milling.
I ended up having to mill the board twice. My first attempt had a short that I wasn’t able to locate. Milling on my second attempt went much better!
Next I moved on to SMD soldering with solder paste and heat gun.
To program my board I ended up using an SOIC8 test clip I ordered from Amazon that fit nicely into the programming jig we made in class.
Since my board includes a piezo buzzer my intention was for it to generate sound in response to registering a touch from the capacitive sensor. Taking inspiration from Rick and Morty the buzzer plays “Human Music” when touched.
Here is my Arduino sketch:
/*
Marquee Assigment
by Brandon Roots
Homemade Hardware
ITP Spring 2022
*/
#include <CapacitiveSensor.h>
CapacitiveSensor cs_4_3 = CapacitiveSensor(3,4);
const int buzzer = 2; //buzzer to ATTINY85 pin 2
long touchCounter = 0;
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(0, OUTPUT);
cs_4_3.set_CS_AutocaL_Millis(0xFFFFFFFF); // turn off autocalibrate on channel 1 - just as an example
}
// the loop function runs over and over again forever
void loop() {
long total1 = cs_4_3.capacitiveSensor(30);
if(total1 > 100){
if(touchCounter == 0){
touchCounter = millis();
}
digitalWrite(0, HIGH); // turn the LED on (HIGH is the voltage level)
humanMusic();
}
else {
//digitalWrite(0, LOW); // turn the LED off by making the voltage LOW
pulseLight();
noTone(buzzer); // Stop sound...
if(touchCounter > 0){
touchCounter = 0;
}
}
}
void humanMusic(){
int tempo = 120;
int millisTempo = 60000/tempo;
int beat = millis() - touchCounter;
if(beat%(millisTempo*4) < (millisTempo * 0.25)){
tone(buzzer, 523); // Send signal... (523, 587, 523)
}
else if(beat%(millisTempo*4) > (millisTempo * 1) && beat%(millisTempo*4) < (millisTempo * 1.25)){
tone(buzzer, 587); // Send signal... (523, 587, 523)
}
else if(beat%(millisTempo*4) > (millisTempo * 2) && beat%(millisTempo*4) < (millisTempo * 2.25)){
tone(buzzer, 523); // Send signal... (523, 587, 523)
}
else{
noTone(buzzer);
}
}
void pulseLight(){
int brightness = millis()%2000;
int mappedBrightness = 0;
if(brightness < 1000){
mappedBrightness = int(map(brightness, 0, 1000, 1, 50));
} else {
mappedBrightness = int(map(brightness, 1000, 2000, 50, 1));
}
analogWrite(0, mappedBrightness);
}



