Fab Academy 2024 Website

  • Home
  • About
  • WEEK1 Project Management / Principles and Practices
  • WEEK2 Computer Aided Design
  • WEEK3 Computer-controlled cutting
  • WEEK4 Electronics production
  • WEEK5 3D scanning and printing
  • WEEK6 Embedded programming
  • WEEK7 Computer-controlled machining
  • WEEK8 Electronics design
  • WEEK9 Output devices
  • WEEK10 Mechanical design, Machine design
  • WEEK11 Input devices
  • WEEK12 Molding and casting
  • WEEK13 Networking and communications
  • WEEK14 Interface and application programming
  • WEEK15 Wildcard week
  • WEEK16 System integration
  • WEEK17 Applications and implications, project development
  • WEEK18 Invention, intellectual property, and income
  • Final
目次
  • WEEK8 Electronics design
    • Group Assignment
    • Individual Assignment
      • Design my final project board
        • Schematic design
        • PCB Layout
        • Drawing Outline
        • Export to PNG files
      • Milling
        • Generate G-code
          • G-code Settings
        • Milling
        • Testing

WEEK8 Electronics design

  1. Fab Academy 2024 Website
  2. WEEK8 Electronics design
hito |


WEEK8 Electronics design

Group Assignment

use the test equipment in your lab to observe the operation of a microcontroller circuit board

Group assignment Page

Individual Assignment

use an EDA tool to design a development board to interact and communicate with an embedded microcontroller, produce it, and test it

Design my final project board

Circuit design is done in Fusion 360 Electronics.

Schematic design

Select "New Electronics Design" from the menu and start the Schematic design.
alt text
Open the Library Manager by following the steps Library->Open Library Manager, download the necessary libraries, and register them.
alt text
Select the necessary components from PLACE COMPONENTS and register them on the design screen.
Connect the components to each other. Make sure the components are securely connected to each other.
alt text

PCB Layout

Select the "SWITCH" icon in the top-left corner to switch to the "PCB Document" mode.
alt text
alt text
Set the grid before placing the components.
alt text
Set the design rules. Change all items in the Different Signals section of the Clearance tab to 17mil.
alt text
Change the Minimum Width in the Sizes tab to 16mil.
alt text
Place each component in the appropriate position and create paths using the Route command.
alt text
Run the DRC command to check for errors. Check the error message content and make corrections until there are no more errors.

Drawing Outline

Create a new layer and name it "outline".
alt text
Select layer 100 and use the line command.
alt text
Draw a closed shape using lines.
alt text
Shortcuts -> SET FILL_LAYER 116 1;run drill-aid 0 -> press F12 to assign the key
alt text

Export to PNG files

Select layer "20 BoardOutline" and move the green lines to show the entire outline shape Use Polygon Pour from Outline and click on the outlines to be filled on "100 Outline".
alt text
Select the miscellaneous tab in the set command and uncheck "Display singal names".
alt text
Select export->image. Enter the file name, check the Monochrome option, and then click OK. Export both the TOP layer and the outline layer as PNG files.
alt text
Export the TOP&Pad layer.
alt text
Export the outline&centerDrill layer.
alt text

Milling

Generate G-code

To create G-code from a PNG file, follow the steps as described on Group assignment4.

G-code Settings

for TOP layer: 1/64 bit,cut depth mm:0.2, max depth mm:0.2
for Outline layer: 1/32 bit,cut depth mm:0.2, max depth mm:0.2
alt text
alt text
Press "calculate" button to generate G-code files.
alt text

Milling

For milling operations using gSender, proceed following the instructions described at Group assignment4.

Fusion file(.f3z)

Testing

XIAO_RP2040 x 1
MPU-6050 x 1
PINHD-1X04 x 1

I had just finished soldering.
alt text alt text

For the Final Project, I will be using an accelerometer sensor. This time I will be using the MPU-6050. The MPU-6050 is a popular 6-axis motion tracking device that combines a 3-axis accelerometer and a 3-axis gyroscope on a single chip. It is a widely used sensor for measuring acceleration, tilt, and orientation in various applications such as robotics, drones, and wearable devices.

Download: MPU-6050 datasheet

I immediately connected it to the PC and tried running the following sample code that I downloaded.

// MPU-6050 Short Example Sketch
// By Arduino User JohnChi
// August 17, 2014
// Public Domain
#include<Wire.h>
const int MPU_addr=0x68;  // I2C address of the MPU-6050
int16_t AcX,AcY,AcZ,Tmp,GyX,GyY,GyZ;
void setup(){
  Wire.begin();
  Wire.beginTransmission(MPU_addr);
  Wire.write(0x6B);  // PWR_MGMT_1 register
  Wire.write(0);     // set to zero (wakes up the MPU-6050)
  Wire.endTransmission(true);
  Serial.begin(9600);
}
void loop(){
  Wire.beginTransmission(MPU_addr);
  Wire.write(0x3B);  // starting with register 0x3B (ACCEL_XOUT_H)
  Wire.endTransmission(false);
  Wire.requestFrom(MPU_addr,14,true);  // request a total of 14 registers
  AcX=Wire.read()<<8|Wire.read();  // 0x3B (ACCEL_XOUT_H) & 0x3C (ACCEL_XOUT_L)    
  AcY=Wire.read()<<8|Wire.read();  // 0x3D (ACCEL_YOUT_H) & 0x3E (ACCEL_YOUT_L)
  AcZ=Wire.read()<<8|Wire.read();  // 0x3F (ACCEL_ZOUT_H) & 0x40 (ACCEL_ZOUT_L)
  Tmp=Wire.read()<<8|Wire.read();  // 0x41 (TEMP_OUT_H) & 0x42 (TEMP_OUT_L)
  GyX=Wire.read()<<8|Wire.read();  // 0x43 (GYRO_XOUT_H) & 0x44 (GYRO_XOUT_L)
  GyY=Wire.read()<<8|Wire.read();  // 0x45 (GYRO_YOUT_H) & 0x46 (GYRO_YOUT_L)
  GyZ=Wire.read()<<8|Wire.read();  // 0x47 (GYRO_ZOUT_H) & 0x48 (GYRO_ZOUT_L)
  Serial.print("AcX = "); Serial.print(AcX);
  Serial.print(" | AcY = "); Serial.print(AcY);
  Serial.print(" | AcZ = "); Serial.print(AcZ);
  Serial.print(" | Tmp = "); Serial.print(Tmp/340.00+36.53);  //equation for temperature in degrees C from datasheet
  Serial.print(" | GyX = "); Serial.print(GyX);
  Serial.print(" | GyY = "); Serial.print(GyY);
  Serial.print(" | GyZ = "); Serial.println(GyZ);
  delay(333);
}

It doesn't seem to be getting data from the accelerometer sensor. alt text

To check if the serial connection is established, I ran the following i2c_scanner program:

// --------------------------------------
// i2c_scanner
//
// Version 1
//    This program (or code that looks like it)
//    can be found in many places.
//    For example on the Arduino.cc forum.
//    The original author is not know.
// Version 2, Juni 2012, Using Arduino 1.0.1
//     Adapted to be as simple as possible by Arduino.cc user Krodal
// Version 3, Feb 26  2013
//    V3 by louarnold
// Version 4, March 3, 2013, Using Arduino 1.0.3
//    by Arduino.cc user Krodal.
//    Changes by louarnold removed.
//    Scanning addresses changed from 0...127 to 1...119,
//    according to the i2c scanner by Nick Gammon
//    https://www.gammon.com.au/forum/?id=10896
// Version 5, March 28, 2013
//    As version 4, but address scans now to 127.
//    A sensor seems to use address 120.
// Version 6, November 27, 2015.
//    Added waiting for the Leonardo serial communication.
//
//
// This sketch tests the standard 7-bit addresses
// Devices with higher bit address might not be seen properly.
//

#include <Wire.h>


void setup()
{
  Wire.begin();

  Serial.begin(9600);
  while (!Serial);             // Leonardo: wait for serial monitor
  Serial.println("\nI2C Scanner");
}


void loop()
{
  byte error, address;
  int nDevices;

  Serial.println("Scanning...");

  nDevices = 0;
  for(address = 1; address < 127; address++ )
  {
    // The i2c_scanner uses the return value of
    // the Write.endTransmisstion to see if
    // a device did acknowledge to the address.
    Wire.beginTransmission(address);
    error = Wire.endTransmission();

    if (error == 0)
    {
      Serial.print("I2C device found at address 0x");
      if (address<16)
        Serial.print("0");
      Serial.print(address,HEX);
      Serial.println("  !");

      nDevices++;
    }
    else if (error==4)
    {
      Serial.print("Unknown error at address 0x");
      if (address<16)
        Serial.print("0");
      Serial.println(address,HEX);
    }    
  }
  if (nDevices == 0)
    Serial.println("No I2C devices found\n");
  else
    Serial.println("done\n");

  delay(5000);           // wait 5 seconds for next scan
}

There is a following message in the serial monitor.

Scanning...
No I2C devices found

Indeed, the connection doesn't seem to be established.

Upon checking the board, I found that one of the solder joints was not done properly. The procedure for identifying problem areas is described in Group assignment8.

I re-soldered it and ran i2c_scanner again.

Scanning...
I2C device found at address 0x68 !
done

It's recognized now.

Going back to running the sample code. alt text

Success!

I learned the importance of carefully soldering in this process.

Copyright 2024 Hajime Ito - Creative Commons Attribution Non Commercial

検索
キーワードを入力して検索を始めましょう