In this page I will explain the process I went through to design, build, and test the cirucits I made for my final project.

Page content:

Files:


1. Thigh circuit

1.1. First version

I have used 8-bit AVR ATmega328P SMD to create my own micro-controller circuit. First of all, I have checked its datasheet summary to get the important information about it and to know its pin configiration. Later, I have reviewed the full data sheet.

Pin Configurations: Pin_Configurations

I used Autodesk Eagle to draw my circuit by referring to the minimal circuit for Atmega328 processor desgin provided in this website. However, I added more components as I need for my project.

minimal_circuit

The following Eagle libraries were used in the design:

Schematic Design: schematic

Circuit Routing:

I set all the routing widths to 16 mil, then I changed the routing width of the ATmega328P pads to 10 mil because it is mentioned in the datasheet that the miminum width of each leg is 0.30mm, which is equal to 11.811 mil.

Packaging DIMENSIONS

PCB Design:

The Top and Pads layers routing were exported as an image:

circuit9

Then the Dimension and Pads layers were exported also. frame4

Dimension and Pads layers after editing with GIMP. frame4_gimpEdit

Prepeare for milling with Mods:

I used mods to geneeate the rml file for milling.

  • Traces .rml: mods1 circuit9_rml You can download the traces rml file from here.
  • Outline .rml: mods2 frame4_rml You can download the traces rml file from here.

Circuit after milling:

As you can see in the following picture of my circuit, there are some traces not milled by the milling machine. So, I used a cutter to disconnect them. But, by accident I have removed the trace of pin 16 which is the AVR MISO pin. Therefore, I have decided to make some changes to my circit design in Eagle and mill it again.

circuit


1.2. Second version

I have re-designed my MCU circuit in a way that makes it as small as possiable with less traces and components. Changes made are as following:

  • Removed the reset button that is connected to reset pin 29.
  • Removed C3 and R1 that are connected to the reset button.
  • Removed the connection between the reset pin 29 and RTS pin 6 of the FTDI header.
  • Removed the digital 5 pins header.
  • Removed the vibration motor 3 pins header.
  • Reduced the second MPU6050 header pins to 4 (SCL, SDA, Vcc, GND) and added an extra pin for vibration motor output.
  • Added a jumper 0 ohm resistor to the vibration motor pin 1 to connect traces, becuase there is no place to make a direct route.

Schematic Design:

schematic_2

Circuit Routing: circuit_routing

Export for milling:

Show only Top and Pads layers and export them as an image. test3

Export for cutting:

Then the Dimension and Pads layers were exported also. To do that, below steps were followed:

  • Hide all layers, then show the Dimension and Pads layers. showLayers
  • Click on Options >> Set... >> Misc >> uncheck Display pad names and Display signal names on pads. displayPads
  • Export as an image with the following settings. export_settings
  • Exported image: MCU_frame2

Edit cutting image with GIMP:

Open the exported image with GIMP. Then from the top bar menu, click on Image » Mode » RGB. RGB

Click on Bucket Fill, select any color other than black and white, and click on the black space inside the holes. gimp

Fill in the outer circle with black color. fill

Change Image Mode to Greyscale. Greyscale

Fill in the inner circle with white color. fill_Inner

Export as png image. MCU_frame2_holeEdit

Prepeare for milling with Mods:

I used mods to geneeate the rml file for milling.

  • Traces .rml: As a first try, the traces milling file was produced with a number of unmilled traces. So, I searched about a method to solve it and I found this useful settings prvided here. In the Mill raster 2D block:
    • Tool diameter: 0.22 mm
    • Cut depth: 0.09 mm
    • Max depth: 0.09 mm
    mods1_secondTry traces_secondtry You can download the traces rml file from here.
  • Outline .rml: mods2_secondTry frame_secondtry You can download the traces rml file from here.

You can download my design files from here:


1.3. Third version

I have re-designed the circuit based on my instructor suggestion. The previous version is also big in size to fit on the human thigh. So I changed the MCU used from ATmega328P to ATtiny84A. In addition, there are multiple seperate components to be connected to the board using connectors, which may result in loose connections when moving the leg. Therefore, I have added the bluetooth circuit on my microcontroller board using a surface mounted part RN4871.

Schematic Design: schematic_3

Circuit Routing: circuit_routing_3

Export for milling: traces_3

Export for cutting: frame_3

After edit with GIMP: frame_3_gimp

Circuit milling:

Problem with cutting:

After cutting the outline, the circuit fly off the bed so I have stopped the machine immediately. The problem was due to that, there was not enough tape under the board to keep it stable.

3v_circuit

Since the board was removed from its location on the machine bed, therefore I wasn't able to do the cutting for the holes using the milling machine. So I have drilled the holes I need as shown in the following image:

3v_holes

One of the traces was removed, so I have solved the issue by soldering a jumper wire.

v3_jumper

Later, I have gathered all the components and soldered them on my printed circuit board.

Bill Of Materials (BOM):

QtyPart numberDescriptionSupplierUnit price
1ATTINY84A-SSUAVR AVR® ATtiny Microcontroller IC 8-Bit 20MHz 8KB (4K x 16) FLASH 14-SOICDigi-key$0.78
1XC1109CTDigi20MHz Ceramic Resonator Built in Capacitor 15pF ±0.3% -20°C ~ 80°C Surface MountDigi-key$0.63
1RN4871-V/RM118Bluetooth Bluetooth v5.0 Transceiver Module 2.4GHz Integrated, Chip Surface MountDigi-key$7.03
2445-1423-1-ND1µF ±10% 50V Ceramic Capacitor X7R 1206 (3216 Metric)Digi-key$0.03
2311-10.0KFRCT-ND10 kOhms ±1% 0.25W, 1/4W Chip Resistor 1206 (3216 Metric) Moisture Resistant Thick FilmDigi-key$0.1
1311-499FRCT-ND499 Ohms ±1% 0.25W, 1/4W Chip Resistor 1206 (3216 Metric) Moisture Resistant Thick FilmDigi-key$0.1
2311-0.0ERCT-ND0 Ohms Jumper 0.25W, 1/4W Chip Resistor 1206 (3216 Metric) Moisture Resistant Thick FilmDigi-key$0.1
1160-1737-1-NDWhite LED Indication - Discrete 3.2V 1206 (3216 Metric)Digi-key$0.63
1LM3480IM3-3.3/NOPBCT-NDLinear Voltage Regulator IC 1 Output 100mA SOT-23-3Digi-key$0.99
2WM17449-NDConnector Header Surface Mount 6 position 0.100” (2.54mm)Digi-key$0.59
1-Right Angle Header Female Surface Mount 1X6 position 0.100” (2.54mm)Digi-key-
1-2.0mm pitch 90° SMT wire to board connector--
1IMUMPU-6050 Six-Axis (Gyro + Accelerometer) MEMS MotionTracking™ Devices--
1-Lithium Ion Polymer Battery - 3.7v 1200mAh--

Circuit after soldering: v3_final_circuit

Testing the board:

After soldering, I have tested my circuit by programming it using Arduino UNO. To do that:

First upload ArduinoISP example code to Arduino uno with the following settings: ArduinoISP

Then connect my attiny84 board to Arduino UNO using SPI connection as following: SPIconnection

If you don’t have attiny84 library, go to week 7 to know the steps of adding attiny84 board library.

Set the following and click on Burn Bootloader. attinysettings

Done burning bootloader burnbootloader


2. Shank circuit

The second circuit will be placed on the shank and connected with the microcontroller circuit (on the thigh) using ISP connector. This circuit contains two main components, which are mini vibrating motor and Inertial Measurement Unit (IMU) - MPU6050.

I have followed this tutorial to learn how to build a vibration motor circuit. It says that the vibration motor has 2 terminals, red and blue wire. The polarity does not matter for motors.

Based on the data sheet, this vibration motor has 2.5-3.8V operating voltage range; So, it will vibrate by supplying it with 3V. However, I want to control it using my microcontroller (ATtiny84) by coding to reduce the current draw/strength and turn it ON at some intervals. To do that, I have referred to the following circuit design from Learning about Electronics website.

Vibration Motor Circuit: vibration_circuit

Circuit components:

  • Diode connected in parallel to the vibration motor to allow current to flow in one way only and protect the microcontoller from reverse voltage spikes .
  • Capacitor also connected in parallel to the vibration motor to absorb the voltage peeks.
  • N-channel MOSFET to provide current amplification since the microcontoller can't provide enough current to drive the motor.
  • Resistor to prevent high current to flow through the MOSFET and damage it.

When designing my circuit, some of the components shown in the previous schematic are not available in SMD (Surface Mounted) packaging. Therefore, I have replaced them with other alternatives.

Schematic Design: shank_schematic

Circuit Routing: shank_routing

Export for milling: shank_traces

Export for cutting: shank_frame3

Bill Of Materials (BOM):

QtyPart numberDescriptionSupplierUnit price
1IMUMPU-6050 Six-Axis (Gyro + Accelerometer) MEMS MotionTracking™ Devices--
1-Vibrating Mini Motor Discadafruit$1.95
1WM17449-NDConnector Header Surface Mount 6 position 0.100” (2.54mm)Digi-key$0.59
1-Right Angle Header Female Surface Mount 1X6 position 0.100” (2.54mm)Digi-key-
1311-1.00KFRCT-ND1 kOhms ±1% 0.25W, 1/4W Chip Resistor 1206 (3216 Metric) Thick FilmDigi-key$0.10
1641-1331-1-NDDiode Schottky 100V 1A Surface Mount Mini SMA/SOD-123Digi-key$0.47
1FDN357NCT-NDN-Channel 30V 1.9A (Ta) 500mW (Ta) Surface Mount SuperSOT-3Digi-key$0.49
1445-1423-1-ND1µF ±10% 50V Ceramic Capacitor X7R 1206 (3216 Metric)Digi-key$0.03

Circuit after soldering: Vibrating_Motor


3. Problems

I couldn't program my ATtiny84 circuit because there was a piece of copper between xtal and reset pin. After removing the extra copper and cleaning the circuit, it works.

problem