Group Assignment

Use the test equipment in your lab to observe the operation of a microcontroller circuit board.
Send a PCB out to a board house.

Individual Assignment

Use an EDA tool to design a development board to interact and communicate with an embedded microcontroller, produce it, and test it.
Extra credit: try another design workflow.
Extra credit: design a case for it.
Extra credit: simulate its operation.


Table of Contents


Week 8 Work Plan


Hero Shot

Group Assignment Result

📌
For the group assignment page click here.

Basic Electronics Concepts

Resistors

A resistor is a fundamental electronic component that restricts or limits the flow of electric current in a circuit. It's designed to introduce a specific amount of resistance into the circuit, which is measured in ohms (Ω).

An ohm is the resistance that occurs when a current of one ampere (A) passes through a resistor with a one volt (V) drop across its terminals. The current is proportional to the voltage across the terminal ends. This ratio is represented by Ohm’s law.

V=IRV=IR
💠
Resistors are used for various purposes in electronics:
Current LimitingResistors are commonly used to limit the amount of current flowing through a particular part of a circuit, thus protecting sensitive components from damage due to excessive current.
Voltage DivisionThey are used in voltage dividers to create specific voltage levels within a circuit.
Adjustment In some circuits, resistors are used to fine-tune or adjust the voltage or current levels.
Signal ConditioningResistors are often used in signal conditioning circuits to modify signal levels, impedance matching, and filtering.
Temperature SensingCertain types of resistors, such as thermistors, change resistance with changes in temperature, making them useful for temperature sensing applications.
Pull-up and Pull-down Resistors These are used in digital circuits to ensure a well-defined logic level when a signal is not actively driven by a device.

Resistor Color Code

⬇️
Follow the link below for the resistor calculator
Resistor Calculator
This resistor calculator converts the ohm value and tolerance based on resistor color codes and determines the resistances of resistors in parallel or series.
https://www.calculator.net/resistor-calculator.html

SMD Resistor Code

Pull-up and Pull-down Resistors

A pull-up resistor is connected between the signal line and the positive supply voltage, usually VCC.

A pull-down resistor is connected between the signal line and ground (GND).

Capacitors

A capacitor is an electronic component that stores electrical energy temporarily. Think of it as a small, rechargeable battery for electricity. It's made of two conductive plates separated by an insulating material called a dielectric.

When you connect a capacitor to a power source, such as a battery or an electrical outlet, it charges up by accumulating electric charge on its plates. Once charged, the capacitor can hold onto this energy until it's needed.

💠
Capacitors used in electronics for various purposes:
FilteringThey smooth out fluctuations in voltage, ensuring a more stable power supply.
TimingCapacitors can control the timing of circuits, for instance, in oscillators and timing circuits.
CouplingThey allow AC signals to pass while blocking DC signals, useful for coupling stages of amplifiers.
Energy StorageCapacitors can store energy, used in applications such as flash photography, where a sudden burst of energy is required.
⬇️
The video on the basic working principle of capacitors is linked below
Capacitors Explained - The basics how capacitors work working principle
Capacitors Explained, in this tutorial we look at how capacitors work, where capacitors are used, why capacitors are used, the different types. We look at capacitors in Power factor and full bridge rectifiers to convert AC to DC.
https://www.youtube.com/watch?v=EvAq9zqRB5I&t=4s

Clamp Meter

A clamp meter, also known as a clamp-on ammeter or current clamp, is a specialized type of electrical testing instrument used to measure electric current in a circuit without the need to disconnect wires or make direct contact with them. It's particularly useful for measuring current in large or high-voltage circuits where traditional methods may be impractical or unsafe.

⬇️
A video on how to use a clam meter is linked below.
How to Use a Clamp Meter
AC Clamp Meter Uni-T UT202A https://toolboom.com/en/digital-clamp-meter-uni-t-ut202a/
https://www.youtube.com/watch?v=Bc_EQea0mKY

Mixed Signal Oscilloscope

A mixed signal oscilloscope (MSO) is a type of digital storage oscilloscope that can display and compare analog and digital signals. It has input channels for both types of signals, with analog signals displayed as voltage levels that vary continuously over time, and digital channels measuring logic values (0 or 1). 

⬇️
Video on overview of mixed signal oscilloscope is linked below
5 Series MSO Mixed Signal Oscilloscope: 5-minute Overview
Gary, Product Planner for the 5 Series MSO, gives a 5-minute demonstration of the instrument. In just a few minutes you'll learn everything you need to know to use the new touch interface. Get a quick introduction to FlexChannelTM inputs that adapt to either analog or digital logic signals simply be changing the probe.
https://www.youtube.com/watch?v=AwhF2enymhs&t=558s

Thermal Camera

A thermal camera, also known as an infrared camera or thermographic camera, is a type of imaging device that captures and visualizes the infrared radiation emitted by objects and surfaces. Unlike conventional cameras, which rely on visible light to create images, thermal cameras detect heat signatures emitted by objects based on their temperature.

SAM D11C

The SAM D11C is a microcontroller from Microchip Technology, which is part of their SAM D11 family of ARM Cortex-M0+ based microcontrollers. These microcontrollers are designed for low-power applications and offer a balance between performance, power efficiency, and peripheral integration.

⬇️
The SAM D11 C pinout is illustrated below.

PCB Design Nomenclature

PCBStands for Printed Circuit Board, the physical board onto which electronic components are mounted and interconnected.
SchematicA diagrammatic representation of the electrical connections and components in a circuit.
ComponentsElectronic parts such as resistors, capacitors, integrated circuits (ICs), connectors, etc.
Pads Metalized areas on the PCB surface for soldering components or making electrical connections.
TracesCopper conductive paths on the PCB connecting various components and pads.
ViasPlated-through holes connecting traces on different layers of the PCB.
SilkscreenPrinted text, symbols, or markings on the PCB surface for component placement, orientation, and identification.
FootprintThe physical layout of a component on the PCB, including pad locations and dimensions.
NetA named electrical connection between two or more points on the PCB.
Layers The individual copper or substrate layers that make up the PCB, typically including signal layers, power planes, and ground planes.
RoutingThe process of defining and creating the paths for traces on the PCB.
DRC (Design Rule Check)Automated checks performed by PCB design software to ensure the design meets specified design rules and constraints.
Gerber filesStandard file format used to describe the PCB design to PCB manufacturers, including information on copper layers, silkscreen, solder mask, etc.
BOM (Bill of Materials)A list of all components required for the assembly of the PCB, including part numbers, quantities, and references to the schematic.
IPC standardsIndustry standards published by the Association Connecting Electronics Industries (IPC) that define guidelines for PCB design, manufacturing, and assembly.
Copper Weight The thickness of the copper layers on the PCB, typically measured in ounces per square foot (oz/ft²) or micrometers (µm).
Solder Mask A protective layer is applied over the copper traces to prevent unintentional solder bridges and oxidation.

KiCad

KiCad is a free open-source software suite for electronic design automation (EDA). It is used for designing schematics of electronic circuits and printed circuit boards (PCBs).

KiCad is a comprehensive toolset that facilitates the process of designing professional grade PCBs. The suite includes a project manager and four main independent software tools:

  1. Eeschema: A schematic capture editor.
  1. Pcbnew: A PCB layout program.
  1. Gerbview: A Gerber file viewer.
  1. Bitmap2Component: A converter from BMP images to photo-realistic images for use in 3D view.

The software also supports a wide range of design formats, making it a versatile choice for different design needs. Its open-source nature means it is continually evolving and improving, thanks to the contributions of its user community.

⬇️
To download the KiCAD, follow the link below.
Download
A Cross Platform and Open Source Electronics Design Automation Suite
https://www.kicad.org/download/
⬇️
KiCAD hotkeys are mentioned below.
I found that learning and utilising hotkeys in KiCad can significantly enhance productivity by reducing the time spent navigating menus and performing repetitive tasks.
⬇️
Follow the steps mentioned in the video below to get a better understanding of the KiCAD environment.
KiCad 6 STM32 PCB Design Full Tutorial - Phil's Lab #65
Complete step-by-step PCB design process going through the schematic, layout, and routing of a 'black-pill' STM32-based PCB including USB in the *new* KiCAD 6. All the way from schematic creation, through to two-layer PCB layout and routing, as well as sending it off for manufacture and assembly via JLCPCB.
https://www.youtube.com/watch?v=aVUqaB0IMh4
➡️
After downloading and installing the KiCAD 8.0 software, open it, create a new project, save it, and open the schematic editor.
🚨
After opening the schematic editor a new blank sheet will appear which is shown below ⬇️.
🚨
Double-click on the bottom right corner box to modify the sheet name, title, date, and so on.
🚨
The size of the sheet can be altered by double-clicking the border of the sheet, and a new page setting window will appear to change the sheet size.

Fab Library Installation

📌
Follow the link below to proceed with the fab library installation.
pub / libraries / electronics / KiCad · GitLab
Fab electronics component library for KiCad
https://gitlab.fabcloud.org/pub/libraries/electronics/kicad
🚨
Click on the “code” button and select the “zip” that comes under the download source code section.

🚨
Now go to KiCAD and, from the “preference” menu, select “Manage Symbol Libraries”.
🚨
A symbol library window will appear. Select the “folder” icon and go to the “kicad-master” folder that was downloaded from the gitlab, which is mentioned just a few steps above.
🚨
Open the “fab.kicad_sym” file.

🚨
Click on “OK”

🚨
Then from the preference menu, select the “ Manage Footprint Libraries” .

🚨
Now go to the “kicad-master” folder and then select the “fab.pretty” folder.

🚨
Click on “OK”

Adding Components to the Schematic

🚨
Press “A” on the keyboard to open the symbol library and add symbols from it. Make sure to add symbols which comes under the “fab”.
🚨
Click on “OK”
🚨
Press “W” or select the wire tool from the vertical tool bar at the right side of the screen to wire the components.
🚨
Press “Ctrl+L” to add the global labels.
🚨
Press ”Q” to add the no-connection flags to all the non-connected pins.
🚨
Press ”P” to add the power symbols.
⚠️
Connect VCC flags to up and GNR (ground) flags to down on the schematic.

SAMD11C Eagle Board Schematic

🚨
Once the schematic is completed, click the “fill in the schematic symbol” option from the top menu bar.

Edit Values of Components

🚨
Select the components and press "V” or right-click the components and select “Edit Main Fields,” and then select “Edit Value”.
🚨
Add resistance and capacitance values.
🚨
Use the LED Series Resistor Calculator to calculate the resistance values for the LED.

LED Series Resistor Calculator

https://www.digikey.in/en/resources/conversion-calculators/conversion-calculator-led-series-resistor
🚨
Refer to the datasheet of the LED to know the values for the forward voltage and forward current of the LED that are used in the circuit.

🚨
Perform the electric rule check by clicking on the icon that is highlighted in the image below.
🚨
Click on “Run ERC”

🚨
In my circuit I used Type C connector to power my board and the footprint was missing. To assign footprint, Go to “Tools” and select “Assign Footprint”.
🚨
The footprint for type-C is provided under the “Resources and Downloads” section.
🚨
Copy and paste the footprint to the kicad-master → fab.pretty folder.
🚨
Double click the USB to assign footprint and select the footprint.

Bill of Materials [BOM]

S.NOReferenceValueFootprintQty
1C11uFfab:C_12061
2C2100nFfab:C_12061
3D1LED_1206fab:LED_12061
4D3LED_RGB_CreeLED_PLCC4fab:LED_RGB_CreeLED_CLV1A-FKB1
5J1USB_Afab:ProshPlay-Type-C-breakout-board1
6J2Conn_PinHeader_SWD_2x02_P2.54mm_Vertical_SMDfab:PinHeader_2x02_P2.54mm_Vertical_SMD1
7J4,J5Conn_PinHeader_2x03_P2.54mm_Vertical_SMDfab:PinHeader_2x03_P2.54mm_Vertical_SMD2
8R1499 Ohmfab:R_12061
9R25Kfab:R_12061
10R3,R4,R550 Ohmfab:R_12063
11SW2Switch_Tactile_Omronfab:Button_Omron_B3SN_6.0x6.0mm1
12U1Microcontroller_ATSAMD11C14A-SSUTfab:SOIC-14_3.9x8.7mm_P1.27mm1
13U2Regulator_Linear_3.3V_100mA_TexasInstrumentsfab:SOT-23-31

PCB Routing

🚨
To open the PCB in the board editor, select the icon below.
🚨
Press “F8” to update the PCB from the schematic 🙂 or go to “Tools” and select the “update PCB from the schematic”.
🚨
Click on “Board Setup” to set the design rules based on the PCB milling machine capabilities.
🚨
From the “Board Setup” select “Constraints”, and “pre-defined size” under the “Design Rules” and change the values to the values mentioned below for the Roland Modela MDX-20 machine.
🚨
For the outline for my board, I decided to go with the eagle, which is my favourite bird 🙂. I downloaded the image and imported it into Inkscape to get the outline and convert it to SVG format.
🚨
Go to “Path” and select the “Trace Bitmap”.
🚨
Select “Edge Detection”

🚨
Initially, I set the size to 50 x 50 mm, but the components were not fitting well, so I changed it to 70 x 70 mm.
🚨
I inserted the SVG file into Fusion and edited the outline a bit, then extruded the sketch and created another sketch for projecting the outline of the solid body, and then saved the sketch to a DXF file.
🚨
From the PCB Editor, go to File, and from Import, select “Graphics” to import the DXF file to the PCB Editor.

🚨
Make sure to select the “Edge Cuts” option.
🚨
Drag and drop the components into the board outline.
🚨
Try to place the components of each section close to each other; for instance, try to place the components of the voltage regulator close to each other. For better understanding, refer to your schematic.
🚨
I decided to make a double-sided PCB to explore how to make a double-sided PCB, which could be beneficial for my final project.
🚨
Hide the ”F.Fab” and “B.Fab” from the Appearance.
🚨
Press “X” to wire the components and press “V” to add Vias to move to Bottom layer.
🚨
For the 3D view, click on the icon mentioned below.

Interactive BOM Plugin

The Interactive BOM (Bill of Materials) plugin in KiCad is a powerful tool that helps users manage and customize their bill of materials directly within the KiCad environment. The plugin enhances the traditional BOM generation process by providing an interactive interface for viewing, editing, and annotating components in the BOM.

🚨
From the KiCAD main window, select “Plugin and Content Manager” and search for “Interactive HTML BOM”. Click “Install” and select the “Apply Pending Changes” option.
🚨
The go to the PCB Editor, and select “Generate Interactive HTML BOM” icon mentioned below.
🚨
Select the directory and click on “Generate BOM”.
🚨
Open the HTML file in any web browser.

AutoRouting Plugin

KiCad does offer an integrated auto-router tool called the "Interactive Router". This feature allows users to automatically route connections between components on a PCB layout.

🚨
From the plugin manager search for “Freerouting” and follow the same steps mentioned above for interactive BOM.

🚨
From the Board setup select “Net Classes” and change the values to the values mentioned below.
🚨
Select the “freerouting” icon mentioned below.

Gerber File Export

🚨
To export the gerber file. Go to “Tools” and from “Fabrication Outputs”, select “Gerbers”.
🚨
Select the “Output directory” and click on “Plot” and then click on “Generate Drill Files”.
🚨
Then select the same Output Folder and click on “Generate Drill Files”.
🚨
For me, the Gerber file generated is mentioned in the image below.

🚨 Gerber 2 PNG

GerberViewer is an open-source web application that serves as a versatile tool for viewing Gerber files and streamlining the conversion of Gerber files into PNG images. It was developed by web developer Mr. Midlaj of Superfablab Kerala

⬇️
Follow the link below to open the Gerber 2 PNG web app.
Gerber Viewer
https://gerber2png.fablabkerala.in/

Features

The tool offers a range of features for users, including the capability to convert Gerber files to PNG images with ease. It supports various Gerber file formats, ensuring compatibility with different design specifications. The web interface is intuitive and responsive, providing users with a seamless experience throughout the conversion process. With a straightforward conversion procedure, users can quickly navigate through the steps required to obtain their desired PNG images. Furthermore, the tool allows for the instant download of converted PNG images, enhancing efficiency and convenience for users.

🚨
The image below depicts the new page of the Gerber2PNG web app.
🚨
The image below highlights all the sections of the web app.
🚨
The “Quick Setup” section is the non-trivial section of the app.
🚨
The “Top” section is used to manipulate the view of the top layer traces, pads, and silk screen.
🚨
The “Bottom” section is used to manipulate the view of the top layer traces, pads, silk screen, outline, drill, and outer layer.

🚨
Drop your Gerber files generated from the few steps mentioned above into the highlighted area mentioned below, or click the “Choose Files” button to choose the Gerber files and upload them to the web app.
🚨
Select all the Gerber files that are generated from KiCAD and click on "Open”.
🚨
The “Double Side” toggle button is provided to switch between single-side and double-side mode.
🚨
When the toggle button is red, it is in single-side mode.
🚨
When the toggle button is green, it is in double-side mode.
🚨
Initially, after opening the Gerber files, the top-layer view will be shown.
🚨
Click on the “BOTTOM” button to view the bottom layer.
🚨
Click the “LAYERS” button to view the tracks of both the layers.
🚨
Click the “B/W” button to convert the image into black-and-white format.
🚨
Click the “INVERT” button to invert the black-and-white image.
⚠️
The above-mentioned images of the Gerber2PNG web app illustrate the overview of the app. Now get back to our main process.
🚨
From the “Quick Setup”, select “Top Trace” and click “Generate PNG” to generate the PNG of Top Trace.
🚨
The PNG of the top layer will be generated and can be deleted or downloaded by clicking on the respective icon mentioned below.
🚨
From the “Quick Setup”, select “Top Drill” and click “Generate PNG” to generate the PNG of Top Drill.
🚨
From the “Quick Setup”, select “Top Cut” and click “Generate PNG” to generate the PNG of Top Cut.
🚨
From the “Quick Setup”, select “Bottom Trace” and click “Generate PNG” to generate the PNG of Bottom Trace.
🚨
From the “Quick Setup”, select “Bottom Cut” and click “Generate PNG” to generate the PNG of Bottom Cut.
🚨
From the “Quick Setup”, select “Generate All” and click “Generate PNG” to generate the PNG of all the traces in a single click.
🚨
Once the required PNGs are generated, go to the download icon mentioned below and click on it to download all the generated PNGs as a zip file.
🚨
The images shown below consist of the PNGs extracted from the zip file, and later I thought to remove the holes provided for the eye and manipulate it using "Paint”.

🚨 Double Layer PCB

Software [ Mods CE ] & Machining Phase

🚨
The first step is to clean the sacrificial layer.
🚨
Stick the double-sided tap to the PCB and stick the PCB on top of the sacrificial layer.
🚨
Turn on the machine
🚨
The initial step is to mill the trace of the top layer.
⚠️
It is highly recommended to remove the watch before operating the milling machine. Watch may act as a barrier while changing the end mills for milling and cutting operations.
🚨
Change the end mill to (1/64”) for milling. Make sure to place 80% of the end mill inside the collet and tighten it using the hex key. 
🚨
From the Mods CE select “PCB”.
🚨
Select the PNG file of top layer trace, and open it.
🚨
Set the dpi to “1000”.
🚨
From mods ce select the mill outline (1/64”).
🚨
Click on “calculate”.
🚨
Now set the origin as required; I set it to 3mm-x, 3mm-y, and click on “move to origin”.
🚨
Now the end mill will come to the origin point. Loose the end mill and place the tip of the end mill to the PCB and apply a light pressure and tight the end mill properly.
🚨
Press the down button on the machine once.
🚨
From Mods CE, make sure the socket is open; if not, click on “open socket”.
🚨
Click on “send file”.
🚨
The photo illustrates the PCB after milling the top-layer traces.
🚨
Now the task is to drill holes for the vias on the top layer.
🚨
Change the end mill to (1/32”) for drilling.
🚨
Select the PNG file of “top layers invert”, and open it.
🚨
Set the dpi to “1000”.
🚨
From Mods CE select the mill outline (1/32”)
🚨
Click on “calculate”.
⚠️
After calculating the tool path, the drill holes are not generated. From the KiCAD, the via diameter was set to 8 mm, so it wouldn't be able to generate the too path, so I tried again by reducing the tool diameter to 0.75 mm, and it worked 🙂.
🚨
Move to origin.
🚨
Now the end mill will come to the origin point. Loose the end mill, place the tip of the end mill on the PCB, and tighten the end mill properly.
🚨
From Mode CE, make sure the socket is open; if not, click on “open socket”.
🚨
Click on “send file”
➡️
Similarly, perform for the top outer cut.
🚨
Now it’s time to flip the board 🙂.
🚨
Clean the board.
🚨
Take out the PCB from the sacrificial layer.

🚨
Remove the double-side tap from the bottom layer and apply a new double-side tap to the top layer.

🚨
The outer cut from the top layer was to make a press fit while flipping the board.
🚨
Now the task is to mill the traces of the bottom layer.
🚨
Change the end mill to (1/64”) for milling.
🚨
Select the PNG file of the bottom layer trace, and open it.
🚨
Set the dpi to “1000”.
🚨
From Mods CE select the mill outline (1/64”)
🚨
Click on “calculate”.
🚨
Move to origin.
🚨
Now the end mill will come to the origin point. Loose the end mill, place the tip of the end mill on the PCB, and tighten the end mill properly.
🚨
From Mode CE, make sure the socket is open; if not, click on “open socket”.
🚨
Click on “send file”
🚨
Change the end mill to (1/32”) for cutting outer of the bottom layer (actual outer of our PCB).
🚨
Select the PNG file of the bottom layer outer cut, and open it.
🚨
Set the dpi to “1000”.
🚨
From Mods CE select the mill outline (1/32”)
🚨
Click on “calculate”.
🚨
Move to origin.
🚨
Now the end mill will come to the origin point. Loose the end mill, place the tip of the end mill on the PCB, and tighten the end mill properly.
🚨
From Mode CE, make sure the socket is open; if not, click on “open socket”.
🚨
Click on “send file”
🚨
Remove the PCB. Remove the double-side tap, sand the tracks, and use a brush to clean the tracks to prevent short circuits.
😃
Final Result

🚨 FabLab Inventory

FabStash is a web-based app developed by superfablab Kerala for maintaining the fab inventory.

⬇️
Follow the link below to open the FabLab inventory web app.
FabStash | Fablab Inventory
The ATtiny1614/1616/1617 belong to the tinyAVR® 1-series, featuring an AVR® processor with hardware multiplier, running at speeds up to 20 MHz, and offering 16 KB Flash, 2 KB SRAM, and 256 bytes EEPROM in compact 14-, 20-, and 24-pin packages
https://inventory.fablabkerala.in/
🚨
Click the icon on the top right corner to log into the web app.

🚨
Each student receives login credentials, and logging in successfully is the only way to fully utilize the app.

🚨
Use the search bar to search for the components, and click on the component to view more details about that component.
🚨
Click on the + icon to add the components to the cart.
🚨
Once all the components are added to the cart, select the cart icon near the search bar and click on “REQUEST”.

🚨
Now the request for the components is sent to the instructor, and the instructor will check all the requested components and approve them.
🚨
The BOM can be downloaded once the instructor approves the list. To download the BOM, click on "PRINT”.
🚨
BOM 👇

Soldering

📌
To learn more about soldering, follow the link below.
Rayan Abdul Gafoor - Fab Academy
© 2024 Rayan Abdul Gafoor. All rights reserved. Students Agreement.
https://fabacademy.org/2024/labs/kochi/students/rayan-abdul/week04.html
🚨
I used a double-sided tap to stick all the components together before soldering.

Interactive BOM

😃
I used copper wire for connecting the via from top layer to bottom layer.
😃
Final Result.

Programming the Eagle Board

⬇️
I followed the link below to use my XIAO Board as a programmer and burn the bootloader to my SAM D11C IC.
Files · main · pub / programmers / Quentorres. swd+uart adapter+hello board - xiao rp2040 · GitLab
Fab Cloud
https://gitlab.fabcloud.org/pub/programmers/quentorres/-/tree/main?ref_type=heads
🚨
To burn the bootloader to the board, I need to make a 10 pos and 4 pos connectors.

🚨
I connected the 10-pin connector to a pin converter, converted it into 4 pins, and finally to my board.

Eagle Board RGB LED Code


const int redPin = 5;
const int greenPin = 8;
const int bluePin = 9;

void setup() {
  // Initialize the RGB LED pins as OUTPUT
  pinMode(redPin, OUTPUT);
  pinMode(greenPin, OUTPUT);
  pinMode(bluePin, OUTPUT);
}

void loop() {
  // Example: Smoothly transition through RGB colors
  
  // Red
  setColor(255, 0, 0); // Set full intensity red
  delay(1000); // Wait for 1 second
  
  // Green
  setColor(0, 255, 0); // Set full intensity green
  delay(1000); // Wait for 1 second
  
  // Blue
  setColor(0, 0, 255); // Set full intensity blue
  delay(1000); // Wait for 1 second
}

// Function to set the color of the RGB LED
void setColor(int redValue, int greenValue, int blueValue) {
  // Map the color values (0-255) to the PWM range (0-255)
  analogWrite(redPin, redValue);
  analogWrite(greenPin, greenValue);
  analogWrite(bluePin, blueValue);
}

Different Design Workflow

EasyEDA

EasyEDA is a free, zero-install, web and cloud-based EDA (Electronic Design Automation) tool, integrating powerful schematic capture, mixed-mode circuit simulation, and PCB layout in a seamless cross-platform browser environment. It is suitable for users who need to design and simulate electronic circuits and layouts.

⬇️
Follow the link below to open the EasyEDA PCB design and simulator.
EasyEDA - Online PCB design & circuit simulator
EasyEDA is a free and easy to use circuit design, circuit simulator and pcb design that runs in your web browser.
https://easyeda.com/

3D View of the PCB

ESP32 Custom Board Schematic

IDNameDesignatorFootprintQuantitySupplier Part
1100nFC1,C2,C3,C4,C5,C10,C11,C12,C13C04029C1525
222uFC6C08051C602037
310uFC7,C8C04022C315248
44.7uFC9C04021C368809
5LESD5D5.0CT1GD1,D2,D3SOD-523_L1.2-W0.8-LS1.6-BI3C383211
6X6511WV-17H-C30D60H1,H2HDR-TH_17P-P2.54-V-M2C725949
7LED-0805_GLED1LED0805_GREEN1C84260
8LED-0805_RLED2LED0805_RED1C72037
9Header-Female-2.54_1x3P3HDR-TH_3P-P2.54-V-F1C146243
10SS8050-GQ1,Q2SOT-23-3_L2.9-W1.3-P1.90-LS2.4-BR2C164886
112N7002T-7-FQ3,Q4SOT-523-3_L1.6-W0.8-P1.00-LS1.6-BR2C139445
12R1,R2R04022C17168
1310kΩR3,R4,R5,R6,R14R04025C25744
1422.1kΩR7R04021C43473
1547.5kΩR8R04021C25896
161kΩR9,R15R04022C11702
175.1kΩR10R04021C25905
1822ΩR11,R12R04022C25092
19560ΩR13R04021C25905
20PTS645SH50SMTR92LFSSW1,SW2KEY-SMD_4P-L6.0-W6.0-P4.50-LS9.02C221869
21ESP32-WROOM-32E(8MB)U1WIFI-SMD_ESP32-WROOM-32E1C701342
22CP2102N-A02-GQFN28RU2QFN-28_L5.0-W5.0-P0.50-TL-EP3.31C964632
23AMS1117-3.3_C347222U3SOT-223-4_L6.5-W3.5-P2.30-LS7.0-BR1C347222
242-Pin-Male-Header-2.54mmU42-PIN-MALE-HEADER-2.54MM1

Simulation

Tinkercad

Tinkercad Circuits is a free web app that allows users to simulate digital and analog electronics. It's popular with students, hobbyists, and makers. The simulator allows users to program and test circuits in a virtual environment, making it easier to prototype new ideas before building them in the real world. 

⬇️
Follow the link below to open the Tinkercad circuit.
Tinkercad - From mind to design in minutes
Tinkercad is a free, easy-to-use app for 3D design, electronics, and coding.
https://www.tinkercad.com/dashboard?type=circuits&collection=designs

BOM

Schematic of the Bionic Arm

Bionic Arm Code

#include <Servo.h>

// Define the number of flex sensors and servo motors
const int numFlexSensors = 5;
const int numServoMotors = 5;

// Array to store flex sensor pin numbers
const int flexPins[numFlexSensors] = {A0, A1, A2, A3, A4};

// Array to store servo motor objects
Servo servos[numServoMotors];

void setup() {
  // Initialize serial communication
  Serial.begin(9600);

  // Attach servo motors to corresponding pins
  for (int i = 0; i < numServoMotors; i++) {
    servos[i].attach(i + 2); // Pins 2 to 6
  }
}

void loop() {
  // Array to store flex sensor readings
  int flexValues[numFlexSensors];

  // Read the values from the flex sensors
  for (int i = 0; i < numFlexSensors; i++) {
    flexValues[i] = analogRead(flexPins[i]);
  }

  // Map the flex sensor readings to servo angles (0-180 degrees)
  for (int i = 0; i < numServoMotors; i++) {
    int angle = map(flexValues[i], 0, 1023, 0, 180);
    servos[i].write(angle);
  }

  // Print flex sensor readings for debugging
  for (int i = 0; i < numFlexSensors; i++) {
    Serial.print("Flex Sensor ");
    Serial.print(i + 1);
    Serial.print(": ");
    Serial.println(flexValues[i]);
  }

  // Delay for stability
  delay(100);
}

Wokwi

Wokwi is an online platform that provides a virtual hardware simulation environment for electronics enthusiasts, hobbyists, educators, and students. It allows users to design, simulate, and test electronic circuits and Arduino projects in a web browser without the need for physical components or hardware.

⬇️
Follow the link below to open the Wokwi simulator.
Wokwi - Online ESP32, STM32, Arduino Simulator
IoT and Embedded System Simulator: ESP32, STM32, Arduino, Raspberry Pi Pico, displays, sensors, motors and WiFi simulation.
https://wokwi.com/

Joystick-Servo Code

#include <ESP32Servo.h>

#define JOYSTICK_X_PIN 34 // Analog pin for X-axis of joystick
#define JOYSTICK_Y_PIN 35 // Analog pin for Y-axis of joystick
#define SERVO_PIN 25       // Pin to which servo motor is connected

Servo servoMotor; // Create a servo object

void setup() {
  Serial.begin(115200);
  servoMotor.attach(SERVO_PIN); // Attaching the servo to the pin
}

void loop() {
  int xValue = analogRead(JOYSTICK_X_PIN); // Read the X-axis value of joystick
  int yValue = analogRead(JOYSTICK_Y_PIN); // Read the Y-axis value of joystick
  
  // Map the joystick values (0-4095) to servo angle range (0-180)
  int angle = map(xValue, 0, 4095, 0, 180);

  // Move the servo to the mapped angle
  servoMotor.write(angle);

  // Print out the joystick values and mapped angle
  Serial.print("X-axis: ");
  Serial.print(xValue);
  Serial.print(", Y-axis: ");
  Serial.print(yValue);
  Serial.print(", Mapped Angle: ");
  Serial.println(angle);

  delay(100); // Delay for smoother control
}

Resources and Downloads

📁 KiCAD Hotkeys

📁 Eagle Board Schematic

📁 Eagle Board Gerber File

📁 Eagle Board PCB File

📁 Eagle Board Schematic File

📁 Eagle Board Step File

📁 Interactive BOM

📁 Type C Breakout Board Footprint

📁 ESP32 Custom Board Schematic

📁 ESP32 Custom Board BOM

📁 Tinkercad Bionic Arm Code

📁 Wokwi Joystick Servo Code