diff --git a/Gemfile b/Gemfile index 0e6f09e..6ec7031 100644 --- a/Gemfile +++ b/Gemfile @@ -33,3 +33,7 @@ gem "wdm", "~> 0.1.1", :platforms => [:mingw, :x64_mingw, :mswin] gem "http_parser.rb", "~> 0.6.0", :platforms => [:jruby] gem "webrick", "~> 1.7" + +group :jekyll_plugins do + gem 'jekyll-diagrams' +end diff --git a/Gemfile.lock b/Gemfile.lock index 60e37d8..616d317 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -29,6 +29,8 @@ GEM rouge (~> 3.0) safe_yaml (~> 1.0) terminal-table (~> 2.0) + jekyll-diagrams (0.10.0) + jekyll (>= 3.8, < 5.0) jekyll-feed (0.16.0) jekyll (>= 3.7, < 5.0) jekyll-sass-converter (2.2.0) @@ -72,6 +74,7 @@ PLATFORMS DEPENDENCIES http_parser.rb (~> 0.6.0) jekyll (~> 4.2.2) + jekyll-diagrams jekyll-feed (~> 0.12) minima (~> 2.5) tzinfo (~> 1.2) diff --git a/README.md b/README.md index 5b09d0b..a6049c0 100644 --- a/README.md +++ b/README.md @@ -1 +1,3 @@ -Run server with step 5: https://jekyllrb.com/docs/ \ No newline at end of file +Run server with step 5: https://jekyllrb.com/docs/ + +Uses https://github.com/zhustec/jekyll-diagrams for block diagrams as well as circuitz, somehow \ No newline at end of file diff --git a/_config.yml b/_config.yml index 31b6089..1277db8 100644 --- a/_config.yml +++ b/_config.yml @@ -30,6 +30,7 @@ github_username: jmdevy theme: minima plugins: - jekyll-feed + - jekyll-diagrams # Exclude from processing. # The following items will not be processed, by default. diff --git a/_posts/2022-12-18-Designing a Gamecube Controller PCB from Scratch Using ESP32-S3.markdown b/_posts/2022-12-18-Designing a Gamecube Controller PCB from Scratch Using ESP32-S3.markdown deleted file mode 100644 index e6dc279..0000000 --- a/_posts/2022-12-18-Designing a Gamecube Controller PCB from Scratch Using ESP32-S3.markdown +++ /dev/null @@ -1,51 +0,0 @@ ---- -layout: post -title: Designing a Gamecube Controller PCB from Scratch Using ESP32-S3 -date: 2023-6-13 00:10:00 -0500 -categories: jekyll update ---- - -## Introduction - -This tutorial will go through the steps to design a PCB for a Nintendo Gamecube contoller, from scratch using the internet. - -## Features - -The extra features I wanted to see this controller have are: -* USB-C port for computer and console connection -* Wireless connection through Bluetooth and 2.4GHz connection (2.4GHz connection handled with ESP-Now API and another ESP32-S3 part on the console) -* Li-ion battery and charging through USB-C port when connected to computer or console - -## Software - -Kicad will be used to create the schematic and layout the PCB. - -## Background -# ESP32-S3 -This is the heart of the controller. - -# Joysticks - -# Triggers (LR, RL, and Z) - -# Buttons - -# Software - -# Wires - -
-$$ -\begin{circuitikz} - \draw[color=white] - (0,0) to[battery] (0,4) - to[ammeter, l=2mA] (4,4) -- (4,0) - to[lamp, l=20W] (0,0) - (0.5,0) -- (0.5,-2) - to[voltmeter] (3.5,-2) -- (3.5,0) - ; - \end{circuitikz} -$$ -
- -+$$ +\begin{circuitikz} + \ctikzset{ + sources/fill=black + } + \draw[color=white] + (0,0) to[american voltage source, invert, l=5V] (0,4) + to[short] (4,4) + to[normal open switch, l=$S_1$] (4,2) + to[normal open switch, l=$S_2$] (4,0) + to[short] (0,0) + (4,4) to[short] (8,4) + to[normal open switch, l=$S_3$] (8,2) + to[normal open switch, l=$S_4$] (8,0) + to[short] (4,0) + (4,2) to[Telmech=M, l=M1, fill=black] (8,2) +\end{circuitikz} +$$ +
++Figure 1: Basic H-Bridge Using Manual Switches +
+ +The next two figures depict driving the motor forwards and backwards: ++$$ +\begin{circuitikz} + \ctikzset{ + sources/fill=black + } + \draw[color=white] + (0,0) to[american voltage source, invert, l=5V] (0,4) + to[short] (4,4) + to[color=red, short, l=$S_1$] (4,2) + to[normal open switch, l=$S_2$] (4,0) + to[short] (0,0) + (4,4) to[short] (8,4) + to[normal open switch, l=$S_3$] (8,2) + to[color=red, short, l=$S_4$] (8,0) + to[short] (4,0) + (4,2) to[Telmech=M, l=M1, fill=black] (8,2) +\end{circuitikz} +$$ +
++(a) +
+ ++$$ +\begin{circuitikz} + \ctikzset{ + sources/fill=black + } + \draw[color=white] + (0,0) to[american voltage source, invert, l=5V] (0,4) + to[short] (4,4) + to[normal open switch, l=$S_1$] (4,2) + to[color=red, short, l=$S_2$] (4,0) + to[short] (0,0) + (4,4) to[short] (8,4) + to[color=red, short, l=$S_3$] (8,2) + to[normal open switch, l=$S_4$] (8,0) + to[short] (4,0) + (4,2) to[Telmech=M, l=M1, fill=black] (8,2) +\end{circuitikz} +$$ +
++(b) +
++Figure 2: Rotate motor clockwise (a) and counterclockwise (b) using H-bridge +
+ +[Wikipedia](https://en.wikipedia.org/wiki/H-bridge){:target="_blank"}{:rel="noopener noreferrer"} has similar depictions and extra information on the subject. In the figures above, the polarities of the DC motor can be reversed using the switches and therefore the rotation will also reverse. + +Although this circuit could be implemented with discrete components, the cost and size of the circuit will likely be larger than needed. The easiest solution is to use a brushed DC motor driver IC from [Digikey](https://www.digikey.com/en/products/filter/motor-drivers-controllers/744?s=N4IgjCBcpgTAnFUBjKAzAhgGwM4FMAaEAeygG0RYBmANgHYqAWEI2AVjYA42qXK6EbCK041Y1PmDDw6bAAx9GHNoiKNOVOnT4c5jYSC6d4bPjTnww2omHormN9nLoLH8UdfBUwPA2Fpyenywcj7wDuB05nQR4nTSsMGMWnI0wTRiNAYImrARVHrGiAC6RAAOAC5QIADKFQBOAJYAdgDmIAC%2BrFFIIKiQmLiEJOSGbFppaqKccIo0bLBgEVlU45I0xkrr8IGT4DQ7IZKw8RI2BQWe-oucnJJU4nK85%2BJW9693L9QR1yeJX5wrg8Cv8vOpGM8waJVFCtPdGDsfkxwkCEfN4d5snITjtgtjOIxYviGCBSiBKtU6k02p0iFpEtA%2BuhsPgiKRIBQqPBzAZxpwjlMNrMiFkTntGPNFst-GsbBtwpDbJtTHLjLL9jsnttdtqBRrsYqDtigTdPl5FvAYb9nO9Fq5zX93iD4QTFUxoS64ecIVI8bACUT-STWHIPCVylVILUGi12l19jRmIz%2BoNWSMOSBgVzeGSKVGqbHaSAALQMlBQBoAV2G7IoKpAJXjxbSyYr9WrbNGOY68YZFAAtsQKsR6gACAAmTQAbnh6qSRb1GuPqsWwKE%2BHmQHwKgBPMp4aoYHCoHtAA){:target="_blank"}{:rel="noopener noreferrer"}. The [A3910EEETR-T (IC MOTOR DRIVER 2.5V-5.5V 8DFN)](https://www.digikey.com/en/products/detail/allegro-microsystems/A3910EEETR-T/3973532){:target="_blank"}{:rel="noopener noreferrer"} can provide 500mA at supply voltage + 1V. If the 3.7V battery is used, then ideally the motor could be driven with 3.7V + 1V = 4.7V. That may be close enough in the ideal case but the battery can drain to 3.2V. This will have to do for now and can be switched out later + + +# Buttons + +# Software + +# Wires + +# Battery and charging +A very common rechargeable battery to see nowadays in consumer products are [these](https://www.epectec.com/batteries/prismatic-pouch-packs.html){:target="_blank"}{:rel="noopener noreferrer"} li-ion pouch batteries. Another example are [these](https://tinycircuits.com/collections/batteries){:target="_blank"}{:rel="noopener noreferrer"} that include built-in protection circuitry. + +The implementation used for charging teh li-ion battery in this circuit will be derived from [this](https://www.youtube.com/watch?v=wy516po6uVU){:target="_blank"}{:rel="noopener noreferrer"} video. + +## Battery requirements +As explained throughout the rest of the page, the battery should be able to provide a decent amount of current. For example, just the motor alone can draw 290mA. Also, the bigger capacity of the battery the better. Looking at the [datasheet](https://github.com/TinyCircuits/LaTex-Battery-Datasheets/raw/main/Datasheet_500mAh.pdf){:target="_blank"}{:rel="noopener noreferrer"} for [this](https://tinycircuits.com/products/lithium-ion-polymer-battery-3-7v-500mah){:target="_blank"}{:rel="noopener noreferrer"} battery shows the following: +* Nominal 500 mAh capacity +* Nominal 3.7V voltage +* Maximum Discharge current of 1.0C therefor 1.0 * 500mAh = 500mA + +This works work well because a USB device can request 500mA from a charger too. + +## Battery Safety, NO Fires +Obviously, the controller shouldn't catch on fire, and unprotected lithium-ion cells definitely can. Luckily, the 500mAh cell mentioned earlier has protection circuitry for the following conditions (see pages 3 through 5 of the datasheet): +* Charge cut-off voltage protection (do not want to overcharge if charging circuit fails): cuts off charging at 4.2V +* Discharge cut-off voltage protection (do not want to discharge so slow that battery chemistry becomes unstable and shorts): cuts off output at 2.45V +* Thermal chock protection (do not want battery to explode if battery changes relatively quickly and is hot for a while): can survive at ~90.0 degrees Fahrenheit for at least 30 minutes. Separately, the IEC62133 certification this battery has indicates it also received a test where the battery experienced 130 Celsius (266 Fahrenheit) for at least 10 minutes without explosion or fire. See [page 17 here](http://www.nrccsafety.com/upload/portal/20200811/2466b1d6cac677ccbdeb6588b02136f5.pdf){:target="_blank"}{:rel="noopener noreferrer"} for details on that part of the certification +* Over-charge protection: Can survive 3C charge (3*500=1500mA) at 4.6V with no fire or smoke +* Over-discharge protection: can survive being lowered to cut-off voltage (2.45V) and then connected to external load for 24 hours without smoke or fire +* Short Circuit protection: can survive terminals being shorted with low impedance wire for 6 hours without fire or smoke + +This seems pretty thorough and like a good candidate. Depending on the charge IC and potential voltage regulators, there could be options for a second layer of protection to help limit current. For example, a simple fuse could be put inline with the + terminal of the battery to disconnect it permanently if a short occurs. it should be good practice to try to stay well under the limits of even the battery protection circuitry. + +## Battery Charging +There are a bunch of ways to charge a li-ion cell. This [video](https://www.youtube.com/watch?v=wy516po6uVU){:target="_blank"}{:rel="noopener noreferrer"} outlines a couple different ways of handling battery charging, especially when connected and charging but power is still needed for the device. + + + + ++$$ +\begin{circuitikz} + \draw[color=white] + (0,0) to[battery] (0,4) + to[ammeter, l=2mA] (4,4) -- (4,0) + to[lamp, l=20W] (0,0) + (0.5,0) -- (0.5,-2) + to[voltmeter] (3.5,-2) -- (3.5,0) + ; + \end{circuitikz} +$$ +
+ +