This is my make-through for the Module's assignment. Grab a cup of coffee!
In this module we make a game controller as the last module but smaller and more user-friendly and make it like a real product.
Bill of material:
ATtiny85
small Push-Button X6
Tilt Switch Module (Mercury Switch) X2
We didn't use Arduino or breadboard, instead we use ATtiny85 and design our PCB
USB, Connected to pin 3 & 4 in ATtiny85 to send and receive data
pin header, we will used later to program the ATtiny85
Two 90 degree female pin headers for the two sensors, one is connected to analog pin 0 and the other is connected to analog pin 1
Voltage divider to make a different output for each button. the output is connected to the digital pin (pin 2).
There is a defect in this connections that I discovered during programming which is that the user cannot press to button at the same time as the output voltage will return only one value regarding one button and ignoring the other. however I could manage this problem in coding.
ATtiny85 is connected to 5V and GND, one pin for reset, pins 3 & 4 for USB, and pins 0 & 1 & 2 for programming pushbuttons and the two sensors
After designing the schematic I start designing the game controller in fusion 360 and export a DXF file for the pushbuttons dimensions and spacing and import it in eagle to design the PCB properly and to put the pushbutton in their right place in the PCB.
And I place the two sensors making an empty space under them in the PCB to avoid any problem while soldering the components, and to be free to control the orientation of the two sensors
After placing all component in the right place, I start the auto router and choose the best output. Then there was four air wires for isolated grounds so I connected then in eagle in the top layer with the red color, but in soldering I used zero ohms resistors because I use Sign-Layer PCB
Step 1: export Gerber files from eagle
Step 2: use Gerbview application to open the CAM outputs from eagle and then export the Profile, Bottom, and Drill layers as PDF
Step 3: use any photo editor program as photoshop or Gimp to edit Gerbview output... open the three layers then flip all of them horizontally and convert all colors to Black & White... invert the color of the profile only which has traces to make traces white
Step 4: send each image to fab modules... I start this fabrication with drills then traces and then the outline
I export an STL file of the side for 3D printing and send it to lab to fabricate it, and this was the result...
the bottom layer here is Acrylic and not 3D printed
Then I export a DXF file from fusion for the top and bottom layer
I make a tolerance of 0.2 millimeter at the beginning using offset for the sketch then I tried to cut it in Plywood first put it didn't fit with the 3D printed part so I make the tolerance 0.15 millimeter and try on Acrylic and fortunately it fitted will with the 3D printed part
Following these 3 links below I manage to program the ATtiny85
Step1: Configuring Arduino Uno as an ISP.
Since the ATtiny85 is just a microcontroller, it requires an ISP (In-System Programming) to be programmed. So to program the ATtiny85, we need to first configure Arduino Uno as ISP to act as a programmer for the ATtiny85. For that, connect the Arduino Uno to Laptop and open the Arduino IDE. After that, navigate to File > Example > ArduinoISP and upload the Arduino ISP code.
Step 2: Connecting Arduino with ATtiny85
Then plug-in the Arduino Uno to the laptop and open Arduino IDE. Find what COM port the Uno is connected to. In my case, it's COM3.
Step 3: Download the bootloader
After this, download the ATtiny85 Boot-loader files from the given link. Open "Burn_AT85_bootloader.bat" and change the COM port number "PCOM5" with whatever COM port number your Uno is connected to. Save the changes before exiting.
Now move the edited "Burn_AT85_bootloader.bat" and "ATtiny85.hex" files into the Arduino IDE root folder (C:\Program Files (x86)\Arduino).
After that, right-click on "Burn_AT85_bootloader.bat" and select "Run as Admin".
If all went well, you should receive this message "AVRdude done. Thank you. Press any key to continue...".
After that the Boot-loader is successfully installed onto the ATtiny85 Chip. Now it’s time to connect USB with ATtiny85 so that we can program it directly.
Step 4: Installing Digispark Drivers
To program the ATtiny85 using USB, you must have Digispark Drivers installed on your laptop, if you don’t have them, you can download it using the link given above. Then, extract the zip file and double click on the “DPinst64.exe” application to install the drivers.
To program the ATtiny85 Board with Arduino IDE, first, we need to add the Digispark board Support to Arduino IDE. For that, go to File > Preferences and add the below link in the Additional Boards Manager URLs and click ‘OK.’
After that, go to tools > Board > Board Manager and search for ‘Digistump AVR’ and install the latest version.
After installing it, now you would be able to see a new entry in the Board menu titled 'Digispark'.
Then I started typing my code...
What I learned this week is...
This module was exciting and full of challenges. we start by designing an Arduino UNO enclosure and then designing Arduino Leonardo board using ATmega32 microcontroller and upload the code using programmer.