Skip to content →

Category archive for: Intro to PCB

intro do PCB – project description

and we are back to the regular craziness ~~


for intro to PCB I’ll focus on last semester’s project I’ve done for Wearables Techonology class: an elbow patch for bikers. It has a fringe (fabric + fiber optic) that you could swipe (indicating if you are turning left/right) and lights up when it gets dark. for some reason vimeo is rotating the video but this is the last version of it:


even though it worked as it should, this is how the circuit was inside it:


it’s a mess and it’s tiny. this was the first time i did a perf board and it was really fun but i was kind of scared of soldering things wrongly and shortening the circuit. I had a lilytiny (just a attiny85 on a pcb) connected to a: photoresistor, a tiny servo motor and an LED. and the lilytiny was also connected to an energy converter (i needed more amperage to make the servo work) + the LiPo battery.

list of materials/components:

ATtiny85 (lilytiny PCB board)
HS-35HD Servo
Super bright LED
Toggle Switch
Lithium Ion Battery (3.7v / 500mAh)
PowerBoost 500 Charger



Code :

#include <Adafruit_SoftServo.h> // SoftwareServo library

#define SERVO1PIN 4 // Servo control line (orange) on Trinket Pin #0

Adafruit_SoftServo myServo1; //create servo object

int pos = 0; // variable to store the servo position

int photoPin = 3;
int ledPin = 1;
int brightness;
int sensorValue;

void setup() {
// Set up the interrupt that will refresh the servo for us automagically
OCR0A = 0xAF; // any number is OK
TIMSK |= _BV(OCIE0A); // Turn on the compare interrupt (below!)

myServo1.attach(SERVO1PIN); // Attach the servo to pin 0 on Trinket
pinMode(ledPin, OUTPUT); //LED on Model A or Pro
pinMode(photoPin, INPUT); //photosensor

void loop() {
sensorValue = analogRead(photoPin);
brightness = map(sensorValue, 0, 1023, 255, 0);
analogWrite(ledPin, brightness);

for (pos = 0; pos <= 180; pos += 10) // goes from 0 degrees to 180 degrees
{ // in steps of 1 degree
myServo1.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
for (pos = 180; pos >= 0; pos -= 10) // goes from 180 degrees to 0 degrees
myServo1.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position

// We'll take advantage of the built in millis() timer that goes off
// to keep track of time, and refresh the servo every 20 milliseconds
// The SIGNAL(TIMER0_COMPA_vect) function is the interrupt that will be
// Called by the microcontroller every 2 milliseconds
volatile uint8_t counter = 0;
// this gets called every 2 milliseconds
counter += 2;
// every 20 milliseconds, refresh the servos!
if (counter >= 20) {
counter = 0;
Leave a Comment