Skip to content

Final Project Development

This page outlines my Final Project development process.

1. Planning

1.1 The Requirements

These were my initial list of requirements and potential design approaches.

  • The basic idea: a Portable shelf onto which original sockets can be attached and tested for connection.
  • Ability to compare at least 2 scenarios; plugging in from the side, and down from the top.
  • Size and number of sockets will be variable: so my main Circuit Board will be kept simple, and tiny boards will be added on for each Attachable Sockets.
  • The Attachable socket also needs an LED to signal successful connection; this will be the programmable-LED type, which only needs one line.
  • Made with Wood (MDF), so it will blend in naturally in a home environment for testing with actual users.

1.2 Overall Design

This is the basic Architecture.
alt text

This was the initial sketch.
alt text
I decided the length to be around 18 cm; to house 6-7 connector sockets of 2.5-3cm wide; enough to compare many options, but still relatively small and portable.

2. The Electronics

I drew a a basic circuit before getting into PCB design.
This is before factoring in circuit protection measures.
alt text

2.1 Main Circuit Board

I designed the Circuit Schematic and PCB layout on KiCad. My goal was to keep the board as small as possible.
alt text
Since I will be using the back-pad of the Xiao, I decided to flip the footprint so that the Xiao could be plugged in from the back of the PCB.

The circuits were milled onto Copper sheets at FabLab Kamakura.
alt text

I was also hoping to design a protecting casing with Acrylic, to protect the pins from accidental Short Circuits.

2.2 Tiny Circuit Boards for Attachable Sockets

Since I had very limited access to the Milling Machines at Fablab Kamakura, I experimented with fabricating Voltage Divider circuits using standard Pin Headers.
I tried a few different prototypes.
alt text

In the end I settled on this prototype which is simple to fabricate and can attach securely attachable to a wire-rack.
alt text

This will keep the wiring organized and the circuits safe from accidental Short-Circuits.
They unexpectedly turned out looking quite cute, like little Ninjas!🥷
alt text

I later made a much simpler and integrated version, with additional components to protect my Microcontroller, such as Capacitors and Resistors.
But I didn’t have the time to follow through with calculating the appropriate values.
alt text

3. The Exterior

Since CNC machines were not easily accessible, I decided to use layers of Laser-cut MDF sheets.

3.1 Shelf

All the modeling was done on Fusion 360.
alt text

Then Laser-cut them, and assembled them. alt text

I spent unexpectedly long time working on the top board; I didn’t like how the different layers showed through, so I tried to smooth it with glue mixed with saw dust. But the MDF absorbed the glue which changed the color making it even more ugly! In the end, I fixed it by covering it with a thin pice of wood.
alt text

I also added a base for extra stability.
alt text

3.2 Attachable Socket and Mystery Connector

For my first socket, I decided to go with standard off-the-shelf Type-A USB socket, in order to test that the System works as intended. I also designed a 3D printed case that fits around a Type-A USB connector and my mystery circuit.
alt text

alt text
Not visible here but I laser-engraved labels for the 4 programmable-LED pins.

alt text

4. Coding

I wrote and tested the AnalogRead part and LED part separately before integrating them into a Final If/else code.
alt text

The Code for LED was written with the help of this guide on Akizuki and this guide on Hokuto Electronic.

The Final Code:

int DIN_H = 0;
int DIN_L = 1;
int LED_MAX = 1;//Number of LEDs connected

int Potentiometer[] = {D2, D3}; //InputTag
const int numTags = sizeof Potentiometer / sizeof Potentiometer[0];
int TagValue[numTags];

void setup() {                
  pinMode(DIN_H, OUTPUT);     
  pinMode(DIN_L, OUTPUT);     
  LED_Init();
  analogReadResolution(12);
  Serial.begin(9600);
}

void loop() {
  for (int j = 0; j < numTags; j++){
      TagValue[j] = analogRead(Potentiometer[j]);
      Serial.print(TagValue[j]);
      Serial.print(",");
      if(TagValue[j]<3500){
      LED_Color_RGB(0x00,0x7f,0x00); //緑
      LED_Set();
      }else{
        for(int n=0;n<LED_MAX;n++)
        LED_Color_RGB(0x00,0x00,0x7f);
        LED_Set();
      }
  }
}
//for(int n=0;n<LED_MAX;n++)
//LED_Color_RGB(0x7f,0x00,0x00); //赤
//LED_Set();
//delay(800); 
//=========================================================//
// LED Initialise
//=========================================================//
void LED_Init() {
  digitalWrite(DIN_H, LOW);
  digitalWrite(DIN_L, HIGH);
  delay(50); 
}
//=========================================================//
// Send Set signals
//=========================================================//
void LED_Set() {
  digitalWrite(DIN_H, LOW);
  digitalWrite(DIN_L, HIGH);
  delay(5); 
}

//=========================================================//
// H1 signal
//=========================================================//
void LED_Hi_Bit() {
  digitalWrite(DIN_H, HIGH);
  digitalWrite(DIN_L, HIGH);
  delayMicroseconds(5);
  digitalWrite(DIN_H, LOW);
  digitalWrite(DIN_L, HIGH);
  delayMicroseconds(5);
}
//=========================================================//
// L0 signal
//=========================================================//
void LED_Low_Bit() {
  digitalWrite(DIN_H, LOW);
  digitalWrite(DIN_L, LOW);
  delayMicroseconds(5);
  digitalWrite(DIN_H, LOW);
  digitalWrite(DIN_L, HIGH);
  delayMicroseconds(5);
}

//=========================================================//
// Formula for converting RGB color for LED
//=========================================================//
void LED_Color_RGB(byte led_r, byte led_g, byte led_b) {
  for (int k = 0; k <= 7; k++) {  //青
    if ((bitRead(led_b, 7 - k)) == 1) {
      LED_Hi_Bit();
    }
    else {
      LED_Low_Bit();
    }
  }
  for (int k = 0; k <= 7; k++) {  //緑
    if ((bitRead(led_g, 7 - k)) == 1) {
      LED_Hi_Bit();
    }
    else {
      LED_Low_Bit();
    }
  }
  for (int k = 0; k <= 7; k++) {  //赤
    if ((bitRead(led_r, 7 - k)) == 1) {
      LED_Hi_Bit();
    }
    else {
      LED_Low_Bit();
    }
  }
}

5. Assembly and Operation

I assembled and wired up all the components.

alt text
alt text
The dilemma: shortening the wires would have made it look cleaner but harder to assemble

alt text

And it works!