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:
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.
The following Eagle libraries were used in the design:
Schematic Design:
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.
PCB Design:
The Top and Pads layers routing were exported as an image:
Then the Dimension and Pads layers were exported also.
Dimension and Pads layers after editing with GIMP.
Prepeare for milling with Mods:
I used mods to geneeate the rml file for milling.
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.
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:
Circuit Routing:
Export for milling:
Show only Top and Pads layers and export them as an image.
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.
- Click on Options >> Set... >> Misc >> uncheck Display pad names and Display signal names on pads.
- Export as an image with the following settings.
- Exported image:
Edit cutting image with GIMP:
Open the exported image with GIMP. Then from the top bar menu, click on Image » Mode » RGB.
Click on Bucket Fill, select any color other than black and white, and click on the black space inside the holes.
Fill in the outer circle with black color.
Change Image Mode to Greyscale.
Fill in the inner circle with white color.
Export as png image.
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:You can download the traces rml file from here.
- Tool diameter: 0.22 mm
- Cut depth: 0.09 mm
- Max depth: 0.09 mm
- Outline .rml: 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:
Circuit Routing:
Export for milling:
Export for cutting:
After edit with 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.
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:
One of the traces was removed, so I have solved the issue by soldering a jumper wire.
Later, I have gathered all the components and soldered them on my printed circuit board.
Bill Of Materials (BOM):
Qty | Part number | Description | Supplier | Unit price |
---|---|---|---|---|
1 | ATTINY84A-SSU | AVR AVR® ATtiny Microcontroller IC 8-Bit 20MHz 8KB (4K x 16) FLASH 14-SOIC | Digi-key | $0.78 |
1 | XC1109CT | Digi20MHz Ceramic Resonator Built in Capacitor 15pF ±0.3% -20°C ~ 80°C Surface Mount | Digi-key | $0.63 |
1 | RN4871-V/RM118 | Bluetooth Bluetooth v5.0 Transceiver Module 2.4GHz Integrated, Chip Surface Mount | Digi-key | $7.03 |
2 | 445-1423-1-ND | 1µF ±10% 50V Ceramic Capacitor X7R 1206 (3216 Metric) | Digi-key | $0.03 |
2 | 311-10.0KFRCT-ND | 10 kOhms ±1% 0.25W, 1/4W Chip Resistor 1206 (3216 Metric) Moisture Resistant Thick Film | Digi-key | $0.1 |
1 | 311-499FRCT-ND | 499 Ohms ±1% 0.25W, 1/4W Chip Resistor 1206 (3216 Metric) Moisture Resistant Thick Film | Digi-key | $0.1 |
2 | 311-0.0ERCT-ND | 0 Ohms Jumper 0.25W, 1/4W Chip Resistor 1206 (3216 Metric) Moisture Resistant Thick Film | Digi-key | $0.1 |
1 | 160-1737-1-ND | White LED Indication - Discrete 3.2V 1206 (3216 Metric) | Digi-key | $0.63 |
1 | LM3480IM3-3.3/NOPBCT-ND | Linear Voltage Regulator IC 1 Output 100mA SOT-23-3 | Digi-key | $0.99 |
2 | WM17449-ND | Connector 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 | - | - |
1 | IMU | MPU-6050 Six-Axis (Gyro + Accelerometer) MEMS MotionTracking™ Devices | - | - |
1 | - | Lithium Ion Polymer Battery - 3.7v 1200mAh | - | - |
Circuit after soldering:
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:
Then connect my attiny84 board to Arduino UNO using SPI connection as following:
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.
Done burning bootloader
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:
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:
Circuit Routing:
Export for milling:
Export for cutting:
Bill Of Materials (BOM):
Qty | Part number | Description | Supplier | Unit price |
---|---|---|---|---|
1 | IMU | MPU-6050 Six-Axis (Gyro + Accelerometer) MEMS MotionTracking™ Devices | - | - |
1 | - | Vibrating Mini Motor Disc | adafruit | $1.95 |
1 | WM17449-ND | Connector 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 | 311-1.00KFRCT-ND | 1 kOhms ±1% 0.25W, 1/4W Chip Resistor 1206 (3216 Metric) Thick Film | Digi-key | $0.10 |
1 | 641-1331-1-ND | Diode Schottky 100V 1A Surface Mount Mini SMA/SOD-123 | Digi-key | $0.47 |
1 | FDN357NCT-ND | N-Channel 30V 1.9A (Ta) 500mW (Ta) Surface Mount SuperSOT-3 | Digi-key | $0.49 |
1 | 445-1423-1-ND | 1µF ±10% 50V Ceramic Capacitor X7R 1206 (3216 Metric) | Digi-key | $0.03 |
Circuit after soldering:
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.