WEEK8 Electronics design
WEEK8 Electronics design
Group Assignment
use the test equipment in your lab to observe the operation of a microcontroller circuit board
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.
Open the Library Manager by following the steps Library->Open Library Manager, download the necessary libraries, and register them.
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.
PCB Layout
Select the "SWITCH" icon in the top-left corner to switch to the "PCB Document" mode.
Set the grid before placing the components.
Set the design rules. Change all items in the Different Signals section of the Clearance tab to 17mil.
Change the Minimum Width in the Sizes tab to 16mil.
Place each component in the appropriate position and create paths using the Route command.
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".
Select layer 100 and use the line command.
Draw a closed shape using lines.
Shortcuts -> SET FILL_LAYER 116 1;run drill-aid 0 -> press F12 to assign the key
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".
Select the miscellaneous tab in the set command and uncheck "Display singal names".
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.
Export the TOP&Pad layer.
Export the outline¢erDrill layer.
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
Press "calculate" button to generate G-code files.
Milling
For milling operations using gSender, proceed following the instructions described at Group assignment4.
Testing
XIAO_RP2040 x 1
MPU-6050 x 1
PINHD-1X04 x 1
I had just finished soldering.
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.
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.
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.
It's recognized now.
Going back to running the sample code.
Success!
I learned the importance of carefully soldering in this process.