diff --git a/docs/index.md b/docs/index.md
index 31623acf465d719b9cfa08728c84f31d519194d0..861b5a36cca7139f26348c5088c0ee1c5e8c7968 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -100,7 +100,7 @@ Two out of three Icelanders taking the Fab Academy this year got sick right afte
 
 There is a before and after the Fab Academy. I now know how an [aluminum profile feels](https://hackaday.com/2020/08/13/under-pressure-how-aluminum-extrusions-are-made/). You know, they don't heat the material that much, they just push it with enormous force until it deforms and takes on the shape of the die. Before I was a disorganized scatterbrain. Now I'm a scatterbrain who talks about designing things in spirals and documenting everything, not because I'm being forced to do it anymore but because I enjoy the process. What is happening to me?
 
-## Becoming a Fab Academy instructor
+## Becoming an instructor
 
 ![2024 Fab Academy Instructor Bootcamp in León](images/leon_2024.jpg){ : style="width:100%" }*The 2024 Fab Academy Instructor Bootcamp in León, Spain. My contributions: [BLDC Modular Thing](https://academany.fabcloud.io/fabacademy/2024/bootcamp-instructors/workshops/BLDC-Modular-Thing/) and [Chat with your repo](https://academany.fabcloud.io/fabacademy/2024/bootcamp-instructors/workshops/Chat-with-your-repo/). Image from [Frosti Gíslason](https://www.fablabs.io/labs/vestmannaeyjar).*
 
@@ -118,7 +118,17 @@ I used to be prejudiced against free and open source engineering software, but [
 
 ![CNC furniture](images/cnc-furniture.jpg){: style="width:100%"}*Part of the furniture that my students made in the fall of 2024.*
 
-When I realized that Ondsel is a capable CAD program, I no longer needed Windows. So I've been daily driving Linux Mint since March of 2024 ([my settings](https://files.svavar.cc/computers/thinkpad/)) and Þórarinn joined me this fall. Mint is the friendliest distro, without sacrificing any power or compatibility.
+I received a group of primary school students who were interested in 3D printing, so I showed them TinkerCAD and asked if they had email addresses to sign up. Some did, some couldn't remember, so instead of TinkerCAD I opened up the Part workbench in Ondsel and showed them how to make basic shapes, resize and move them to assemble what they wanted. After a little less than two hours, they had produced this:
+
+![Primary school work in Ondsel ES](https://www.fabisa.is/N%C3%A1msefni/Grunnskoli/images/ondsel-primary-school.gif)
+
+I'm also enjoying [distilling CAD principles](https://www.fabisa.is/N%C3%A1msefni/Pre-Fab/5-tolvuteikning/) for the Pre Fab course:
+
+<video controls width=100% autoplay muted loop>
+        <source src="https://www.fabisa.is/N%C3%A1msefni/Pre-Fab/images/coincident-constraint.mp4" type="video/mp4">
+    </video>
+
+When I realized that Ondsel/FreeCAD is a capable CAD program, I no longer needed Windows. So I've been daily driving Linux Mint since March of 2024 ([my settings](https://files.svavar.cc/computers/thinkpad/)) and Þórarinn joined me this fall. Mint is the friendliest distro, without sacrificing any power or compatibility.
 
 ## My rune
 
diff --git a/public/index.html b/public/index.html
index 0f64b6cd629e7cc230a4e00029f9bf28f3fc656c..7816b6a031bb74e1974a5899b16917176d57070f 100644
--- a/public/index.html
+++ b/public/index.html
@@ -420,9 +420,9 @@
 </li>
       
         <li class="md-nav__item">
-  <a href="#becoming-a-fab-academy-instructor" class="md-nav__link">
+  <a href="#becoming-an-instructor" class="md-nav__link">
     <span class="md-ellipsis">
-      Becoming a Fab Academy instructor
+      Becoming an instructor
     </span>
   </a>
   
@@ -1578,9 +1578,9 @@
 </li>
       
         <li class="md-nav__item">
-  <a href="#becoming-a-fab-academy-instructor" class="md-nav__link">
+  <a href="#becoming-an-instructor" class="md-nav__link">
     <span class="md-ellipsis">
-      Becoming a Fab Academy instructor
+      Becoming an instructor
     </span>
   </a>
   
@@ -1690,7 +1690,7 @@
 <p><img alt="The Icelandic students in Fab Academy 2023" src="https://fabacademy.org/2023/labs/isafjordur/students/svavar-konradsson/assignments/images/week10/team.jpg" style="width:100%" /><em>The Icelandic students in Fab Academy 2023: Yours truly, <a href="https://fabacademy.org/2023/labs/akureyri/students/andri-semundsson/">Andri Sæmundsson</a> and <a href="https://fabacademy.org/2023/labs/isafjordur/students/hafey-hallgrimsdottir/">Hafey Viktoría Hallgrímsdóttir</a>.</em></p>
 <p>Two out of three Icelanders taking the Fab Academy this year got sick right after their final project presentation, because the pressure had been so high. Was it worth it? It was. I would hardly dare make electronics before but now I'm considering taking an electronic product to market. </p>
 <p>There is a before and after the Fab Academy. I now know how an <a href="https://hackaday.com/2020/08/13/under-pressure-how-aluminum-extrusions-are-made/">aluminum profile feels</a>. You know, they don't heat the material that much, they just push it with enormous force until it deforms and takes on the shape of the die. Before I was a disorganized scatterbrain. Now I'm a scatterbrain who talks about designing things in spirals and documenting everything, not because I'm being forced to do it anymore but because I enjoy the process. What is happening to me?</p>
-<h2 id="becoming-a-fab-academy-instructor">Becoming a Fab Academy instructor</h2>
+<h2 id="becoming-an-instructor">Becoming an instructor</h2>
 <p><img :=":" alt="2024 Fab Academy Instructor Bootcamp in León" src="images/leon_2024.jpg" style="width:100%" /><em>The 2024 Fab Academy Instructor Bootcamp in León, Spain. My contributions: <a href="https://academany.fabcloud.io/fabacademy/2024/bootcamp-instructors/workshops/BLDC-Modular-Thing/">BLDC Modular Thing</a> and <a href="https://academany.fabcloud.io/fabacademy/2024/bootcamp-instructors/workshops/Chat-with-your-repo/">Chat with your repo</a>. Image from <a href="https://www.fablabs.io/labs/vestmannaeyjar">Frosti Gíslason</a>.</em></p>
 <p>I've set up <a href="https://www.fabisa.is/N%C3%A1msefni/Pre-Fab/0-yfirlit/">Iceland's first Pre Fab course</a> (you'll need to translate that page). I think it's essential that prospective Fab Academy students try a few things before starting the course itself, so that they know what they're getting into! Before I started the Fab Academy, <a href="https://fabacademy.org/archives/2015/eu/students/gunnarsson.thorarinn_b.b/about.html">Þórarinn</a> taught me to mill on the ShopBot, <a href="http://archive.fabacademy.org/fabacademy2016/fablabreykjavik/students/272/index.html">Hafliði</a> walked me through making a simple capacitive sensor and <a href="https://fabacademy.org/2022/labs/isafjordur/students/arni-bjornsson/about/">Árni</a> helped me set up a website. It was unplanned and informal, but it helped me a lot. </p>
 <p>I've also been scratching my head over how <a href="http://archive.fabacademy.org/2016/charlottelatin/students/999/about.html">Tom Dubick</a> takes  a cohort of high school students through the Fab Academy every year. We need at least one Tom in every country. I noticed in his students' documentation that they go through a short Pre Fab course before starting the Fab Academy. So I thought it couldn't hurt to try it here, too.</p>
@@ -1699,7 +1699,14 @@
 <p>I used to be prejudiced against free and open source engineering software, but <a href="https://fabacademy.org/2023/labs/isafjordur/students/svavar-konradsson/assignments/week02.html#on-free-and-open-source-engineering-software">I changed my mind during the Fab Academy</a>. Now I <a href="https://fab-lab-island.github.io/FLI_Boot_Camp_2024/projects/ondsel/">teach CAD using Ondsel ES</a>, using the Part workbench (which is simpler and more powerful than Part Design) and the Laser Cut Interlocking workbench:</p>
 <p><a href="https://www.youtube.com/@FabLabIsa/videos"><img alt="Ondsel CAD lessons" src="images/ondsel-lessons.jpg" style="width:100%" /></a><em>The LCInterlocking workbench is great for CNC milling and laser cutting interlocking parts, but it lacks parametric input and a few other things. Since this workbench hasn't been maintained for a few years, I'm considering forking it and learning enough Python to make the necessary changes (when I have the time!).</em> </p>
 <p><img alt="CNC furniture" src="images/cnc-furniture.jpg" style="width:100%" /><em>Part of the furniture that my students made in the fall of 2024.</em></p>
-<p>When I realized that Ondsel is a capable CAD program, I no longer needed Windows. So I've been daily driving Linux Mint since March of 2024 (<a href="https://files.svavar.cc/computers/thinkpad/">my settings</a>) and Þórarinn joined me this fall. Mint is the friendliest distro, without sacrificing any power or compatibility.</p>
+<p>I received a group of primary school students who were interested in 3D printing, so I showed them TinkerCAD and asked if they had email addresses to sign up. Some did, some couldn't remember, so instead of TinkerCAD I opened up the Part workbench in Ondsel and showed them how to make basic shapes, resize and move them to assemble what they wanted. After a little less than two hours, they had produced this:</p>
+<p><img alt="Primary school work in Ondsel ES" src="https://www.fabisa.is/N%C3%A1msefni/Grunnskoli/images/ondsel-primary-school.gif" /></p>
+<p>I'm also enjoying <a href="https://www.fabisa.is/N%C3%A1msefni/Pre-Fab/5-tolvuteikning/">distilling CAD principles</a> for the Pre Fab course:</p>
+<video controls width=100% autoplay muted loop>
+        <source src="https://www.fabisa.is/N%C3%A1msefni/Pre-Fab/images/coincident-constraint.mp4" type="video/mp4">
+    </video>
+
+<p>When I realized that Ondsel/FreeCAD is a capable CAD program, I no longer needed Windows. So I've been daily driving Linux Mint since March of 2024 (<a href="https://files.svavar.cc/computers/thinkpad/">my settings</a>) and Þórarinn joined me this fall. Mint is the friendliest distro, without sacrificing any power or compatibility.</p>
 <h2 id="my-rune">My rune</h2>
 <p align="center">
        <img src="images/SK_logo_transparent.svg" width="200" alt="My rune">
diff --git a/public/search/search_index.json b/public/search/search_index.json
index 48d121ead85b01820689a730ee0a5a43a9ee066c..d16a9af341120c921a39a97069ab640fc3506832 100644
--- a/public/search/search_index.json
+++ b/public/search/search_index.json
@@ -1 +1 @@
-{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"index.html","title":"Svavar's Fab Academy Journey","text":""},{"location":"index.html#hi","title":"Hi","text":"<p>My name is Svavar Konr\u00e1\u00f0sson. Welcome to my home on the web. </p> <p>This is the living and evolving documentation of my studies at the amazing Fab Academy, class 2023. I have the good fortune to work at Fab Lab \u00cdsafj\u00f6r\u00f0ur, Iceland. My instructor is \u00de\u00f3rarinn Bjartur Brei\u00f0fj\u00f6r\u00f0 Gunnarsson, director of Fab Lab \u00cdsafj\u00f6r\u00f0ur. My global evaluator is Pablo Nu\u00f1ez, a part of the dream team at Fab Lab Le\u00f3n.</p> <p>If you're technically inclined, you may find some useful stuff on this site. The documentation is lengthy and seems chaotic; but that's because we're encouraged to document everything as we go along, mistakes and all. The best resource for a Fab Academy student is the documentation from other Fab Academy students.</p>"},{"location":"index.html#final-project","title":"Final Project","text":"<p>My final project in the Fab Academy is Baksi the educational robot. </p> <p>Baksi is meant to be small, inexpensive, simple and safe. You can see all the electronics, and yet it has a clean look. You can make one yourself in a Fab Lab anywhere in the world, and the local staff will help you learn the skills that you need to pull it off. So, what are you waiting for?</p> <p>Get started building a BLDC robot from scratch</p> <p></p> <p>A big part of modern technology is in this robot in one way or another; microchips that control motors and communicate with each other, digitally fabricated parts, software to control the robot from the computer and more. I want to use this little bot to get students interested in mathematics and technology. And maybe paint candles.</p> <p>1 minute video about Baksi:</p> <p>I was invited to participate in How to Make Something that Makes (almost) Anything in the spring of 2024! I'm making Baksi more capable there:</p> <p>Baksi on my MIT Machine Class page</p>"},{"location":"index.html#fab-academy-assignments","title":"Fab Academy Assignments","text":"Principles and Practices Computer Aided Design Computer Controlled Cutting Embedded Programming 3D Scanning and Printing Electronics Design Computer-Controlled Machining Electronics Production Output Devices Machine Week Input Devices Molding and Casting Networking and Communications Interface and Application Programming Wild Card Week Applications and Implications Invention, Intellectual Property and Business Models Project Development"},{"location":"index.html#what-is-the-fab-academy","title":"What is the Fab Academy?","text":"<p>First thing: The Fab Academy is open for anyone who wants to make things. There are no prerequisites, and it's basically the same as the legendary MIT class How To Make (almost) Anything. Because of the world wide network of Fab Labs, anyone in the world can apply to the Fab Academy and drink from the firehose of cutting edge technology and whimsical stories that is Professor Neil Gershenfeld, the director of the MIT Center for Bits and Atoms. </p> <p>Presenting my final project.</p> <p>The Fab Academy is the most remarkable educational program I know of. Every year, engineers like me, artists with no technical background, PhD students, high school students and students of the school of life meet up online every Wednesday for the Fab Academy class. Everyone starts at different levels and everyone is required to go outside their comfort zone every week. I'm familiar with mechanical CAD, so in CAD week I tried artistic polygon modeling in Blender. After Neil's dizzying lecture on the week's subject, you have until next Wednesday to make something that works, and document it thoroughly.</p> <p>I spoke about my Fab Academy experience to new students at the 2024 Student Bootcamp:</p> <p> My advice to Fab Academy students (I made a robot and I almost went mad)</p> <p>My experience? It was like getting an acceptance letter into Hogwarts. A vast world opens up to you full of outstanding people who, working together, can make (almost) anything. You have the support of a group of unassuming people around the world who are actually technology wizards, but also appreciate the human element in art and design. It's the only online school where I've actually got to know the people taking part in it. </p> <p>The evolution of my electronics design skills over the course of the Fab Academy. The course puts a heavy emphasis on digital electronics, because that's what makes things come alive!</p> <p>Already I've made a contribution to a Spanish-Icelandic project and I'm only just getting started in the Fab Lab network. I've made friends, laughed and cried and yet the Fab Academy somehow only exists inside my laptop and I struggle to convey how significant this thing is to outsiders. Currently there are 2500 places like this in the world where I can now walk in and start making things (and so can you!) and share stories of struggling to make things work. And the number of Fab Labs in the world doubles every 18 months. Isn't that wild? Something's going on here.</p> <p>I had a fun meeting with Team FMCU. See my contribution here.</p> <p>The Fab Academy has existed in a side reality for a long time, but it's invisible to Muggles. They have their peculiar speech and conventions that are impenetrable to outsiders. They've been videoconferencing since ancient times. You Google the Fab Academy and find a cryptic website full of bare HTML links to technical resources without any explanations. Ah, my friend, but you lack the guidance and the context! Come on in. Check out the meme channel in the Mattermost chat.</p> <p>\u00de\u00f3rarinn, the undisputed Fab Academy meme master. See an example at the bottom of this page. Image from Adri\u00e1n Torres.</p> <p>An introduction to modern technology as we know it might realistically be taken on in a ten-year period, but we rush through it in six months. You'd better keep up, because you need to make microcontroller boards that talk to each other- wait, now you must mill a 3D shape and make a casting- hold on, now it's time for web programming, but lay that to one side because now you need to stay up all night to finish your final project and present it to a hundred faces on your laptop screen that are in all time zones and climates and circumstances in the world and you are now a part of this group, which shares a traumat- I mean a transformative experience. </p> <p>The Icelandic students in Fab Academy 2023: Yours truly, Andri S\u00e6mundsson and Hafey Viktor\u00eda Hallgr\u00edmsd\u00f3ttir.</p> <p>Two out of three Icelanders taking the Fab Academy this year got sick right after their final project presentation, because the pressure had been so high. Was it worth it? It was. I would hardly dare make electronics before but now I'm considering taking an electronic product to market. </p> <p>There is a before and after the Fab Academy. I now know how an aluminum profile feels. You know, they don't heat the material that much, they just push it with enormous force until it deforms and takes on the shape of the die. Before I was a disorganized scatterbrain. Now I'm a scatterbrain who talks about designing things in spirals and documenting everything, not because I'm being forced to do it anymore but because I enjoy the process. What is happening to me?</p>"},{"location":"index.html#becoming-a-fab-academy-instructor","title":"Becoming a Fab Academy instructor","text":"<p>The 2024 Fab Academy Instructor Bootcamp in Le\u00f3n, Spain. My contributions: BLDC Modular Thing and Chat with your repo. Image from Frosti G\u00edslason.</p> <p>I've set up Iceland's first Pre Fab course (you'll need to translate that page). I think it's essential that prospective Fab Academy students try a few things before starting the course itself, so that they know what they're getting into! Before I started the Fab Academy, \u00de\u00f3rarinn taught me to mill on the ShopBot, Hafli\u00f0i walked me through making a simple capacitive sensor and \u00c1rni helped me set up a website. It was unplanned and informal, but it helped me a lot. </p> <p>I've also been scratching my head over how Tom Dubick takes  a cohort of high school students through the Fab Academy every year. We need at least one Tom in every country. I noticed in his students' documentation that they go through a short Pre Fab course before starting the Fab Academy. So I thought it couldn't hurt to try it here, too.</p>"},{"location":"index.html#free-software","title":"Free software","text":"<p>Free and open source software is a part of the culture of Fab Labs.</p> <p>I used to be prejudiced against free and open source engineering software, but I changed my mind during the Fab Academy. Now I teach CAD using Ondsel ES, using the Part workbench (which is simpler and more powerful than Part Design) and the Laser Cut Interlocking workbench:</p> <p>The LCInterlocking workbench is great for CNC milling and laser cutting interlocking parts, but it lacks parametric input and a few other things. Since this workbench hasn't been maintained for a few years, I'm considering forking it and learning enough Python to make the necessary changes (when I have the time!). </p> <p>Part of the furniture that my students made in the fall of 2024.</p> <p>When I realized that Ondsel is a capable CAD program, I no longer needed Windows. So I've been daily driving Linux Mint since March of 2024 (my settings) and \u00de\u00f3rarinn joined me this fall. Mint is the friendliest distro, without sacrificing any power or compatibility.</p>"},{"location":"index.html#my-rune","title":"My rune","text":"<p>This is the rune that I made for myself in grade school, made up of my initials SK. To start my Fab Academy journey, I made it digital, using Inkscape.</p>"},{"location":"about-me/agreement.html","title":"Fab Academy Student Agreement","text":"<p>The Fab Academy is responsible for:</p> <ul> <li>Teaching principles and practices of digital fabrication</li> <li>Arranging lectures, recitations, meetings, and events for the class</li> <li>Evaluating and providing feedback on student work</li> <li>Offering clear standards for completing assignments</li> <li>Certifying and archiving student progress</li> <li>Supervising class preparation</li> <li>Reviewing prospective students, instructors, and labs</li> <li>Providing central staff and infrastructure for students, instructors, and labs</li> <li>Fund-raising for costs not covered by student tuition</li> <li>Managing and reporting on the program's finances, results, and impacts</li> <li>Publicizing the program</li> <li>Promoting a respectful environment free of harassment and discrimination</li> <li>Encourage a diverse, accessible, and equitable community</li> </ul> <p>I am a Fab Academy student, responsible for:</p> <ul> <li>Attending class lectures and participating in reviews</li> <li>Developing and documenting projects assigned to introduce and demonstrate skills</li> <li>Allowing the Fab Academy to share my work (with attribution) in the class for purposes compatible with its mission</li> <li>Honestly reporting on my work, and appropriately attributing the work of others (both human and machine)</li> <li>Working safely</li> <li>Leaving workspaces in the same (or better) condition than I found them</li> <li>Participating in the upkeep of my lab</li> <li>Ensuring that my tuition for local and central class costs is covered</li> <li>Following locally applicable health and safety guidance</li> <li>Promoting a respectful environment free of harassment and discrimination</li> </ul> <p>Signed by committing this file in my repository,</p> <p>Svavar Konr\u00e1\u00f0sson</p>"},{"location":"about-me/bio.html","title":"Bio","text":""},{"location":"about-me/bio.html#im-svavar-konrasson","title":"I'm Svavar Konr\u00e1\u00f0sson.","text":"<p>I have a BSc in Mechanical Engineering. The only thing I have left in my Master's degree is the thesis. I'm working on it now.</p> <p>Here's a video where I tell Neil Gershenfeld a little bit about myself during random review.</p>"},{"location":"about-me/bio.html#team-spark","title":"Team Spark","text":"<p>I took part in starting Team Spark, the Icelandic Formula Student team, which designs and fabricates electric racing cars and competes against other university teams at Silverstone circuit in England every year. </p>"},{"location":"about-me/bio.html#ts11","title":"TS11","text":"<p>We got the help of Rafnar employees to make the composite shell of the TS11, our first racing car. The big protrusions on the sides are battery boxes. Because of time constraints, the steel spaceframe was simply covered with plastic sheets and then we draped fiberglass fabric over them and painted them with resin. And then Snorri offered me a job at Rafnar!</p> <p>Our first time at Silverstone Circuit. The car didn't drive, but we learned a lot!</p>"},{"location":"about-me/bio.html#ts12","title":"TS12","text":"<p>This model worked!</p> <p>Building the spaceframe of TS12, our second car (and the first one where we had some idea of what we were doing). Lots and lots of tube cutting and positioning. \u00cdvar (in the middle) designed the square tube jig that positions the main members for welding. We got help from Tekn\u00eds to fabricate it.</p> <p>I'm near the middle, in a teal shirt. We worked with three students from the Icelandic Academy of the Arts, who came up with the name Team Spark, made the logo and chose the team and car colors and designed and made this amazing composite shell which was inspired by the electric eel. This is the unveiling at their graduation exhibition. They even embroidered the logo into the headrest, can you see it?</p> <p>Team Spark at Silverstone circuit with TS12. I'm in the middle.</p> <p>I took TS12 for a spin on a go-kart track. My first time driving an electric car!</p>"},{"location":"about-me/bio.html#rafnar-boatyard","title":"Rafnar boatyard","text":""},{"location":"about-me/bio.html#drofn","title":"Dr\u00f6fn","text":"<p>My first task at Rafnar was to finish the design of this 6m pleasure boat.</p>"},{"location":"about-me/bio.html#leiftur","title":"Leiftur","text":"<p>I did the structural design and Lloyd's Register certification of an innovative RIB at Rafnar boatyard, a boat that is now manufactured in five countries around the world.</p> <p>Pilot house simulation of Leiftur, the most popular Rafnar boat. The first unit, in grey, went to the Icelandic Coast Guard. You really have to take this thing for a spin to see how unique it is.</p> <p>My desk at Rafnar boatyard. The first orange Leiftur being delivered to an Icelandic search and rescue team. Its weight distribution was spot on!</p>"},{"location":"about-me/bio.html#jokla","title":"J\u00f6kla","text":"<p>J\u00f6kla the 15m yacht. I'm casually laying my hand on the boat as though it's my baby, but I had almost no part in its design.</p> <p>One of the double-curved windows in J\u00f6kla broke during construction and the CAD model had also broken, so I got the help of our purchasing manager to measure it very precisely, model it and order a new one. It took ten weeks, cost a million ISK and arrived from Germany perfect, except it was bent the wrong way. </p> <p>I had accidentally set the document to the American orthographic projection standard instead of the European one! I then changed the setting to First angle projection and ordered another glass pane and they let me keep my job. And the yacht turned out beautiful, but this was most of my contribution to it. Drawing standards are important for getting the build right!</p>"},{"location":"about-me/bio.html#kol-carbon","title":"KOL Carbon","text":"<p>A coworker came to me with an idea for a luxury belt and I helped him take it all the way:</p> <p>I designed this compression molded carbon fiber belt buckle. It's an unnecessarily high-performance material, but I like how the fibers catch the light. This design was a good exercise in double-curved modeling.</p> <p>Yours truly modeling the belt.</p> <p>Version 2 of the compression mold, very much simplified and improved. Nice and shiny! The first mold included the hole for the belt, which made the geometry complicated and full of sharp edges which made it tricky to put the SMC material into the mold. With V2 the hole was milled afterwards.</p>"},{"location":"about-me/bio.html#skenkir","title":"Skenkir","text":"<p>This is my favorite university class project:</p> <p>Building Skenkir the robot with Gu\u00f0j\u00f3n Bergmann for a university course. The robot's only purpose in life is to lift a wine glass and give the professor a sip. Skenkir means 'someone who decants' in Icelandic.</p> <p>Because I'm Gyro Gearloose's biggest fan, the robot had to have an actuated hand.</p>"},{"location":"about-me/bio.html#fab-lab-isafjorur","title":"Fab Lab \u00cdsafj\u00f6r\u00f0ur","text":"<p>Now I work at Fab Lab \u00cdsafj\u00f6r\u00f0ur and I'm interested in ways to introduce students to computer-controlled machines.</p> <p>Myself on the left and \u00de\u00f3rarinn Bjartur Brei\u00f0fj\u00f6r\u00f0 Gunnarsson, my Fab Academy instructor and the director of Fab Lab \u00cdsafj\u00f6r\u00f0ur, on the right.</p> <p>I like to think of myself as an inventor. I realize that in many people's minds the word \"inventor\" is almost synonymous with \"crackpot\", but as a child I thought Gyro Gearloose was the coolest character and I always wanted a shed full of tools and inventions like he has. Now I work in a Fab Lab! I've even referred to myself as an inventor in public:</p> <p>Interview in Icelandic about my work and studies</p> <p>I agree with mixtela's thoughts on being an inventor. For me it's like being a writer. You don't have to be a successful published writer to call yourself a writer. You just sit down and write.</p> <p>You can decide to be an inventor. You don't need to have invented a world-changing device, all you need is to make things that you haven't seen before.</p> <p>Note</p> <p>I still need to add more details to the bio. I need to figure out the way to copy text documents from my father's antiquated Tandy 102 portable computer, on which I wrote more text about myself.</p>"},{"location":"about-me/desk.html","title":"My desk","text":"<p> My desk.</p>"},{"location":"about-me/desk.html#video","title":"Video","text":"<p>Video where I tell Neil about myself and the stuff you can see on my desk</p> <p>He was particurlarly interested in the historical Tandy computer.</p>"},{"location":"about-me/desk.html#the-candle","title":"The candle","text":"<p>During the dark winter months I light a candle on my desk every day to keep my father with me.</p>"},{"location":"about-me/desk.html#the-simplest-plywood-laptop-stand","title":"The simplest plywood laptop stand","text":"<p>My ThinkPad laptop can become totally flat! So I milled a simple stand out of two pieces of birch plywood and lasered the Fab Lab \u00cdsafj\u00f6r\u00f0ur logo onto it.</p> <p>On the right is a vertical monitor that I use for coding, reading documents and browsing the internet. Not many people use a vertical monitor, but I quite like it.</p>"},{"location":"about-me/desk.html#beam-robotics","title":"BEAM robotics","text":"<p>In the window on the left are two BEAM bots that I made from salvaged components using instructions in Mark Tilden's book Junkbots, Bugbots and Bots on Wheels. They collect sunlight and store it in capacitors. When the capacitors are full, they release the energy into the motor and the bug moves a little bit. In the summertime, my bugs go wild and sometimes fall off the windowsill. I got the little solar cells from Solarbotics.</p> <p>Around 2012 I was fascinated with a take on AI called situated robotics that started with a paper called Elephants Don't Play Chess. This was long before the large language models. The paper argues that higher level cognitive functions like logic came very late in evolution and therefore our AI efforts should focus on the basics of perception and motion that nature has mostly focused on for billions of years. A BEAM bot has a simple nervous network made of a few analog components that make up a special ring oscillator that Mark Tilden invented. This oscillation can generate crawling and walking motion. The robot is put into its environment, where it does a random walk and hopefully finds some light, and subsequent generations are improved using the roboticist as the force of evolution.</p>"},{"location":"about-me/desk.html#first-3d-prints","title":"First 3D prints","text":"<p>Also in the window is the second thing I ever 3D printed, the Stormtrooper Buddha. The first thing I 3D printed was a replacement knob for a drill press, which Bas Withagen asked me to document.</p>"},{"location":"about-me/desk.html#vinyl-cut-sensors","title":"Vinyl cut sensors","text":"<p>Lined up next to the Stormtrooper Buddha are vinyl cut touch sensors on little acrylic plates, made by my students in the Fab Lab course at \u00cdsafj\u00f6r\u00f0ur Secondary School. I had the group make these sensors the week after I did it myself in the Fab Academy. </p> <p>The step response sensor design comes from Hafli\u00f0i \u00c1sgeirsson. Hafli\u00f0i took me through making a step response touch sensor when we had the Fab Lab Iceland Bootcamp in \u00cdsafj\u00f6r\u00f0ur in 2022. That was my first time milling a circuit.</p>"},{"location":"about-me/desk.html#fab-academy-components-arrive","title":"Fab Academy components arrive","text":"<p>The image below shows my desk when all the components for the Fab Academy arrived. Yay! Outside the window you can see \u00cdsafj\u00f6r\u00f0ur harbor and the mountain Ernir. Ernir is also the name of my older son.</p> <p>My desk when the parts for the Fab Academy arrived. Can you spot the good old Tandy 102 computer?</p>"},{"location":"about-me/desk.html#tandy-102","title":"Tandy 102","text":"<p>Sometimes I use a Tandy 102 laptop from 1985 for writing, because it has the best keyboard I've ever used by far.</p> <p>The Tandy 102 was my father's first laptop. It was one of the first laptops, period.</p> <p>My dad ordered a device that plugs into the computer's RS232 port and allows me to put the files onto an SD card. They're in the ancient .DO format. First came .DO, then .DOC and finally .DOCX. When I insert the SD card into my modern laptop I run a little converter program and voil\u00e1! I can put the text on the web. </p>"},{"location":"about-me/desk.html#the-oscilloscope-watch","title":"The Oscilloscope Watch","text":"<p>The Oscilloscope Watch by Gabriel Anzziani is a marvel, ten years in the making! I backed the Kickstarter in 2013 and received the watch in August 2023! I have enormous respect for Gabriel for completing the project and sending out all the rewards despite all the hurdles along the way.</p>"},{"location":"assignments/overview.html","title":"Fab Academy Assignments","text":"Principles and Practices Computer Aided Design Computer Controlled Cutting Embedded Programming 3D Scanning and Printing Electronics Design Computer-Controlled Machining Electronics Production Output Devices Machine Week Input Devices Molding and Casting Networking and Communications Interface and Application Programming Wild Card Week Applications and Implications Invention, Intellectual Property and Business Models Project Development"},{"location":"assignments/week01.html","title":"Principles and Practices","text":""},{"location":"assignments/week01.html#assignment","title":"Assignment","text":"<ul> <li>Set up a documentation website using GitLab.</li> <li>Plan and sketch a potential final project.</li> </ul> <p>See more info and recording of the lecture here.</p>"},{"location":"assignments/week01.html#final-project-sketch","title":"Final project sketch","text":"<p>Here I am describing my final project idea to Neil Gershenfeld and the students and instructors in Fab Academy cycle 2023. Link to the video.</p> <p>This week, I set up an ideas page with the three ideas that I have for a final project in the Fab Academy. Check them out, they're quite fun! I ended up picking the friendly little educational robot arm called baks. It's powered by brushless servomotors and has a structure made entirely of PCBs! So the robot consists of motors and PCBs and nothing else! I may not be able to get all the way there during the Fab Academy, but I do want to make that happen eventually.</p> <p>I put the Student Agreement on my About page. This is a document that I sign by committing it to my repository and it states the code of conduct that I will abide by during my Fab Academy studies.</p>"},{"location":"assignments/week01.html#image-compression-for-the-web","title":"Image compression for the web","text":"<p>This is the string of ImageMagick commands that I use to compress images for this website on a Linux machine:</p> convert input_image.png -resize 1000 -quality 80 output_image.jpg <p>Note</p> <p>While I was in the Fab Academy I used Windows, and there the command is 'magick' instead of 'convert'.</p> <p>Tip</p> <p>Sometimes I want to convert a PNG with a transparent background to a compressed JPEG with a white background. To do that, I add the commands '-background white -flatten -alpha off'. Otherwise, the background becomes black by default.</p> <p>To compress all the images in a folder on a Windows machine (I rarely use this):</p> magick mogrify -resize 1000 -quality 80 -format jpg *.png <p>You can edit the text right here in the text boxes and then copy it into your terminal to compress your image. That's what I do. If you've installed ImageMagick, all you have to do is click in the address bar in the folder containing your image, type <code>cmd</code> and Enter and paste the commands from the text box into the Command Prompt. I learned how to make the text box here, it's just basic HTML.</p> <p>How to open the Command Prompt in your image folder.</p> <p>I always use -quality 80, but I vary the -resize based on how big the original image is and how much detail I need to show. The resolution is based on how big the image is displayed, which is determined by the width of the central column on my site. I think it's about 690 pixels wide.</p> <p>Note</p> <p>Hang on! I just discovered that I can copy the ImageMagick commands straight into the address bar in Windows Explorer and press Enter. Now that's convenient.</p>"},{"location":"assignments/week01.html#video-compression-for-the-web","title":"Video compression for the web","text":"<p>This is the string of FFMPEG commands that I use to compress videos for this website:</p> ffmpeg -i input_video.mov -vcodec libx264 -crf 25 -preset veryslow -movflags +faststart -vf scale=-2:360 -c:a aac -b:a 128k output_video.mp4 <p>If you've installed FFMPEG, you do the same thing as with the images above, you just type <code>cmd</code> and Enter into the address line of your image folder and copy the commands from the text box above into the Command Prompt. Now you have a much smaller video! </p> <p>I'm quite ruthless about lowering video resolution for my website. The standard resolution I use is 360 lines, this is defined by the scale command. When I just need to show that something blinks or moves, I go down to 240 lines and when I need to show text or other details I go up to 480 lines. I used to use:</p> <pre><code>ffmpeg -i input_video.mov -vcodec libx264 -crf 25 -preset medium -vf scale=-2:360 -acodec libmp3lame -q:a 4 -ar 48000 -ac 2 output_video.mp4\n</code></pre> <p>But I got no audio on iPhones.</p> <p>I found a solution to the no audio on iPhone problem on this website.</p> <p>User DLCom said:</p> <p>ffmpeg -i input -c:v libx264 -b:v 2600k -pass 2 -c:a aac -b:a 128k output.mp4   from the official ffmpeg documentation.</p> <p>So I took the \"-c:a aac -b:a 128k\" and put it instead of the \"-acodec libmp3lame -q:a 4 -ar 48000 -ac 2\" that I had been using and I got sound on the video on my iPhone.</p> <p>Then I added from the official FFmpeg documentation:  https://trac.ffmpeg.org/wiki/Encode/H.264 \"veryslow\" instead of \"medium\", to get better encoding quality I also added \"-movflags +faststart\" so that the video starts playing before it's fully loaded in the browser. The final video compression command is the one in the text box above.</p> <p>Recently I've discovered that I can't move the slider to go forwards and backwards in my latest videos. I can do it in the older ones. I need to look into that.</p>"},{"location":"assignments/week01.html#setting-up-this-website","title":"Setting up this website","text":"<p>I love Material for MkDocs. I use a lot of its features on this website. But one thing is a little annoying: I store all the images and videos and design files in the <code>docs</code> folder and when MkDocs builds the site, it copies all those files over to the <code>public</code> folder! So everything I put on this site gets doubled. I suspect that this is how all static site generators work. It would be really nice to get away with having only one copy of each media file. But even with this drawback, I will continue to use Material for MkDocs, because I'm really happy with this site.</p> <p>The rest of this page is dedicated to how I set up this website using Material for MkDocs. The website is hosted on Gitlab and deployed automatically using this file. But you can also easily deploy an MkDocs website to GitHub Pages. I did that before starting the Fab Academy, to get a little bit of a head start. You can check out the test site. I experimented with lots of different colors, but ended up finding black and white cleaner and more elegant. I also added a dark mode that you can toggle, but removed it again when it didn't work very well with the color scheme I ended up with. I really liked trying all the features in Material for MkDocs, it's a really well designed package and superbly documented.</p> <p>In a video call a few months before the Fab Academy started, \u00c1rni Bj\u00f6rnsson showed M\u00f3ses and me how to set up MkDocs and Git. I've summarized all the steps here, with a few extra resources I found along the way:</p>"},{"location":"assignments/week01.html#mkdocs-setup-from-scratch","title":"MkDocs setup from scratch","text":"<p>First, I installed the VSCode editor.</p> <p>Then, as \u00c1rni Bj\u00f6rnsson suggested, I created a folder called <code>code</code> directly in my C: drive, so that Dropbox and OneDrive don't try to sync the folder and mess up my GitHub connection.</p> <p>I followed this tutorial to set up MkDocs. There are a few steps to it:</p> <ol> <li>It starts with installing the Python extension for VSCode.</li> <li>The <code>pip</code> package manager is included with the Python extension, but for some reason you don't always get the latest version. It may be a good idea to check the version. I opened a new terminal in the top menu in VSCode (<code>Terminal -&gt; New Terminal</code>) and typed  <pre><code>pip --version\npip 22.3.1 from C:\\Users\\your_username\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\pip (python 3.10)\n</code></pre> and if it says it's out of date you can upgrade pip like this: <pre><code>pip install --upgrade pip\n</code></pre></li> <li>Now it was time to install MkDocs: <pre><code>pip install mkdocs\n</code></pre></li> <li>Then, as the tutorial suggests, I typed <code>mkdocs --version</code> to see if the installation went OK: <pre><code>mkdocs --version\nmkdocs, version 1.2.0 from /usr/local/lib/python3.8/site-packages/mkdocs (Python 3.8)\n</code></pre></li> <li>(optional) I also installed the Material theme because it seemed nice and it includes expandable code annotations: <pre><code>pip install mkdocs-material\n</code></pre></li> </ol> <p>Note</p> <p>To enable notes like this one in MkDocs, I added Admonitions to the extensions in the mkdocs.yml file: <pre><code>  markdown_extensions:\n      admonition\n</code></pre> Then, to create a note, start with <code>!!! note</code> and then indent the note text: <pre><code>  !!! note\n    Note text\n</code></pre></p>"},{"location":"assignments/week01.html#mkdocs-test-drive","title":"MkDocs test drive","text":"<p>I followed this tutorial to set up a small test website and get a live preview. </p> <ol> <li>After installing Material for MkDocs, I made a folder called Mkdocs. Then I opened a terminal and made sure that it was in the right folder: <pre><code>cd C:\\code\\Mkdocs\n</code></pre> Then I simply typed <pre><code>mkdocs new .\n</code></pre> and that was enough to create a simple site! Well, there are a few extra steps to view the site and deploy it, but this whole process is very simple.</li> <li>Then I added the following lines to mkdocs.yml: <pre><code>theme:\n  name: material\n</code></pre> This is geared towards the Material theme for MkDocs, so if you're using a different theme, the only thing you need to change is the the theme line in the mkdocs.yml file.</li> <li>Set up autocomplete. The tutorial suggests adding a line to settings.json, but it doesn't mention where that file is in VSCode. But it does provide a link to instructions. You go into <code>File -&gt; Preferences -&gt; Settings</code>, scroll all the way down to Yaml: Schemas, and click <code>Edit in settings.json</code>.  Then you add the line <code>\"https://squidfunk.github.io/mkdocs-material/schema.json\": \"mkdocs.yml\"</code>, so in the end it looks like this: <pre><code>{\n    \"workbench.colorTheme\": \"Default Dark+\",\n    \"files.autoSave\": \"afterDelay\",\n    \"yaml.schemas\": {\n\n        \"https://squidfunk.github.io/mkdocs-material/schema.json\": \"mkdocs.yml\"\n    }\n}\n</code></pre></li> <li>OK, now we're yearning for something to happen. Type the following into the terminal: <pre><code>mkdocs serve\n</code></pre> Now open your browser and write localhost:8000 in the address bar. Voil\u00e1! We have a live preview for an MkDocs website!</li> </ol> Material themeDefault theme <p></p> <p></p> <p>The source code for this site, written in Markdown, looks like this:</p> <p><pre><code># Welcome to MkDocs\n\nFor full documentation visit [mkdocs.org](https://www.mkdocs.org).\n\n## Commands\n\n* `mkdocs new [dir-name]` - Create a new project.\n* `mkdocs serve` - Start the live-reloading docs server.\n* `mkdocs build` - Build the documentation site.\n* `mkdocs -h` - Print help message and exit.\n\n## Project layout\n\n    mkdocs.yml    # The configuration file.\n    docs/\n        index.md  # The documentation homepage.\n        ...       # Other markdown pages, images and other files.\n</code></pre> As you can see, Markdown is simple and readable. Writing <code>#</code> gives you the biggest heading, <code>##</code> gives you heading 2, and so on. Put <code>*</code> in front of text to make a bullet point. To add a link, you do this: <code>[mkdocs.org](https://www.mkdocs.org)</code> and to add an image you do the same, but with an exclamation mark: <code>![Material theme](./images/material.png)</code> 5. Finally, to build a static site, write this in the terminal: <pre><code>mkdocs build\n</code></pre> I tried this and got an index page that works fine. But when I clicked the Setup page (this page) I got this:  Hm. Apparently you need to put the structure of the site into your <code>mkdocs.yml</code> file to explicitly state the site navigation. So I opened it up and added <pre><code>  nav:\n    - 'index.md'\n    - 'code.md'     # The code page is just a few code block tests in different languages.\n    - 'setup.md'\n</code></pre> No, that didn't work either. After some looking around I found a solution. I added the following line to <code>mkdocs.yml</code>: <pre><code>use_directory_urls: false\n</code></pre> It works! And the first solution is unnecessary; MkDocs will infer the site navigation based on the pages you create in the docs folder.</p> <p>Setting up MkDocs and getting the live preview working took me an hour in the morning. Writing up how I did it took me the rest of the day. Writing this documentation was a great way to learn Markdown. I like Markdown, with one exception; I don't have the ` symbol  on my keyboard. I need to use this symbol quite a lot for code snippets. I did a bit of searching and found that the shortcut <code>Alt-96</code> is bound to the ` symbol. Now I use that shortcut all the time.  And this page serves as my Markdown reference, when I start to forget how to format things.</p> <p>Note</p> <p>To enable code highlighting (coloring the code, similar to how it looks in the VSCode editor), I added the following lines to <code>mkdocs.yml</code>: <pre><code>markdown_extensions:\n- pymdownx.highlight:\n    anchor_linenums: true\n- pymdownx.inlinehilite\n- pymdownx.snippets\n- pymdownx.superfences\n- pymdownx.details\n</code></pre> I'm not sure if all these lines are necessary, but I'm just following this tutorial. The last line comes from somewhere else, I don't remember where. Anyway, now I can make a code block by enclosing the code with ``` at the top and bottom and including the name of the language at the top: <pre><code>    ```python\n    # This program prints Hello, world!\n    print('Hello, world!')\n    ```\n</code></pre> This results in: <pre><code># This program prints Hello, world!\nprint('Hello, world!')\n</code></pre> You can use this reference to write the name of the programming language correctly at the top of your code block.</p> <p>One more thing, I also added</p> <p><pre><code>markdown_extensions:\n  - attr_list\n  - md_in_html\n</code></pre> to add the ability to align images, add captions and mark large images for lazy loading, as per this tutorial.</p>"},{"location":"assignments/week01.html#customizing-the-theme","title":"Customizing the theme","text":"<p>There is a way to toggle between light and dark mode. This tutorial says that it's enough to copy the following code into <code>mkdocs.yml</code>:</p> Light/dark toggleLight/dark toggle + Color change <pre><code>theme:\n    palette: \n\n    # Palette toggle for light mode\n    - scheme: default\n      toggle:\n        icon: material/brightness-7 \n        name: Switch to dark mode\n\n    # Palette toggle for dark mode\n    - scheme: slate\n      toggle:\n        icon: material/brightness-4\n        name: Switch to light mode\n</code></pre> <pre><code>theme:\n    palette: \n\n    # Palette toggle for light mode\n    - scheme: default\n      toggle:\n        icon: material/brightness-7 \n        name: Switch to dark mode\n      primary: red\n      accent: red\n\n    # Palette toggle for dark mode\n    - scheme: slate\n      toggle:\n        icon: material/brightness-4\n        name: Switch to light mode\n    primary: red\n      accent: red\n</code></pre> Source code for the content tabs above<pre><code>    === \"Light/dark toggle\"\n        ``` yaml\n        theme:\n            palette: \n\n            # Palette toggle for light mode\n            - scheme: default\n            toggle:\n            icon: material/brightness-7 \n                name: Switch to dark mode\n\n            # Palette toggle for dark mode\n            - scheme: slate\n            toggle:\n                icon: material/brightness-4\n            name: Switch to light mode\n        ```\n    === \"Light/dark toggle + Color change\"\n        ``` yaml\n        palette: \n\n            # Palette toggle for light mode\n            - scheme: default\n            toggle:\n                icon: material/brightness-7 \n                name: Switch to dark mode\n            primary: red\n            accent: red\n\n            # Palette toggle for dark mode\n            - scheme: slate\n            toggle:\n                icon: material/brightness-4\n                name: Switch to light mode\n            primary: red\n            accent: red\n        ```\n</code></pre> <p>Note</p> <p>How to enable content tabs in <code>mkdocs.yaml</code>: <pre><code>markdown_extensions:\n- pymdownx.superfences\n- pymdownx.tabbed:\n      alternate_style: true \n</code></pre></p> <p>I also discovered that if you select a command, right click and select Change All Occurrences in VSCode, you only need to write the new color once, instead of four times. Nice! Finally, I made a logo in Inkscape. I designed this logo in grade school, it's a kind of Icelandic rune that combines my initials S and K. Then I added two lines to <code>mkdocs.yml</code> to change the logo in the top left corner and also the favicon (the icon you see in the browser tab). <pre><code>theme:\n  logo: images\\SK_logo.svg\n  favicon: images\\SK_logo.svg\n</code></pre> First I wrote the path as <code>/images/SK_logo.SVG</code> and VSCode complained about the formatting. I found that you can right click the image and select Copy Relative Path to get the right formatting. That gave me <code>docs\\images\\SK_logo.svg</code>, which didn't work, but when I changed it to <code>images\\SK_logo.svg</code> it worked. I also enabled two navigation options: <pre><code>theme:\n  features:\n    - navigation.instant    # Instant loading (page behaves like a single-page application, search persists between pages)\n    - navigation.tabs       # The pages are visible as tabs at the top instead of on the left hand side.\n</code></pre></p>"},{"location":"assignments/week01.html#page-source","title":"Page source","text":"<p>The Markdown code for the View page Source button is like this: <pre><code>[View page source](setup.txt){ .md-button }\n</code></pre> I'm going to put it on every page of my documentation. If you see an interesting element in the page, you can then easily see how to set it up. Pointing to a <code>.md</code> file doesn't work, so my workaround is to make a copy of the Markdown source file and change its extension to <code>.txt</code>.</p> <p>I made a Python script using this tutorial and put it in the MkDocs folder. The script copies all the .md files in the docs folder to another folder called textfiles and converts their extension to .txt. The View Page Source button at the bottom of each page links to its respective .txt file. The Python code has some bug, so that it only converts code.md to code.txt, but I'm happy that I was able to get that far.</p> <p>To change the theme for just the home page, I followed tmeuze's advice in this issue. To <code>mkdocs.yml</code> I added <pre><code>    custom_dir: docs/overrides\n</code></pre> and created a <code>docs/overrides</code> folder. Then I was unsure how to set up a custom theme, so I stopped there.</p> <p>To enable the Github Repository button in the top right corner, I followed this example and added the following to my <code>mkdocs.yml</code>, just below <code>site_name</code>: <pre><code>repo_name: Github Repository\nrepo_url: https://github.com/svavarkonn/MkDocs\n</code></pre></p> <p>I added <pre><code>theme:\n    features:\n        - navigation.tracking\n</code></pre> so that the URL in the address bar changes as you scroll down the page. If you copy the URL, the page will open in the section where you were when you copied it. Might be convenient if someone wants to link to something on this site.</p> <p>I also added</p> <p><pre><code>theme:\n    features:\n        - navigation.tabs\n        - navigation.tabs.sticky\n</code></pre> to make the top navigation follow you as you scroll down the page.</p> <p>By default, an \"Edit this page\" symbol is added to the right of the headline of every page.   When you click it you just get a 404 error. I followed this to remove the edit button. I just add the CSS code <pre><code>&lt;style&gt;\n  .md-content__button {\n    display: none;\n  }\n&lt;/style&gt;\n</code></pre> to the .md file of each page and voil\u00e1! The edit button disappears.</p> <p>To enable icons and emojis, I followed the Material for MkDocs documentation on icons and emojis and added the following to <code>mkdocs.yml</code>: <pre><code>markdown_extensions:\n  - attr_list\n  - pymdownx.emoji:\n      emoji_index: !!python/name:materialx.emoji.twemoji\n      emoji_generator: !!python/name:materialx.emoji.to_svg\n</code></pre> Now I can make faces :smile: (Hmm, apparently this isn't working anymore.)</p> <p>To enable keyboard keys like Ctrl+Alt+Del, I added the following to <code>mkdocs.yml</code>: <pre><code>markdown_extensions:\n  - pymdownx.keys\n</code></pre> Now I can add keyboard keys into the text by enclosing the expression with ++, and using one + between keys. The buttons above are made by typing <code>++ctrl+alt+del++</code>. Here is the key reference.</p> <p>There is no way to make image captions in Markdown. This seems like a glaring omission. I used this method of putting the caption in the next line after the image tag and enclosing the caption with **. Like this:</p> <pre><code>![Git discussion](images/hategit.PNG)\n*Some sentiments about Git*\n</code></pre> <p>The image and caption are displayed like this:  Sentiments about Git</p> <p>The caption is inline with the image, which is not great, but the workflow is simple, so I'm keeping it. If the caption doesn't work, put it inline with the image tag.</p> <p>View page source</p> <p>I've stopped using the page source button above, which links to a text file that I need to update manually. I've instead added an icon next to the page title at the top. I got the icon from Iconify. The icon links to the page source in the Github repository.</p>"},{"location":"assignments/week01.html#mathjax","title":"MathJax","text":"<p>I installed MathJax by following the steps in the Material for MkDocs documentation. Now I can display beautiful equations on my website, using LaTex syntax.</p>"},{"location":"assignments/week01.html#git-setup","title":"Git setup","text":"<p>I cloned my Fab Academy repository on Gitlab to my computer with  <pre><code>$ git clone https://gitlab.fabcloud.org/academany/fabacademy/2023/labs/isafjordur/students/svavar-konradsson.git\nCloning into 'svavar-konradsson'...\nremote: Enumerating objects: 15, done.\nremote: Counting objects: 100% (15/15), done.\nremote: Compressing objects: 100% (14/14), done.\nremote: Total 15 (delta 1), reused 0 (delta 0), pack-reused 0\nReceiving objects: 100% (15/15), 28.91 KiB | 7.23 MiB/s, done.\nResolving deltas: 100% (1/1), done.\n</code></pre> Then I edited index.html a little bit and tried pushing the change to the online repo on Gitlab: <pre><code>git push\nwarning: missing OAuth configuration for gitlab.fabcloud.org - see https://aka.ms/gcm/gitlab for more information\nremote: HTTP Basic: Access denied. The provided password or token is incorrect or your account has 2FA enabled and you must use a personal access token instead of a password. See https://gitlab.fabcloud.org/help/topics/git/troubleshooting_git#error-on-git-fetch-http-basic-access-denied\nfatal: Authentication failed for 'https://gitlab.fabcloud.org/academany/fabacademy/2023/labs/isafjordur/students/svavar-konradsson.git/'\n</code></pre> I looked up how to get an access token and my instructor \u00de\u00f3rarinn asked \u00c1rni at Fab Lab Akureyri if tokens are the thing to use. \u00c1rni recommended using an SSH key instead. I managed to generate an ssh key using this tutorial:</p> <p><pre><code>$ ssh-keygen -t ed25519 -C \"generate an ssh key for gitlab to clone my repository\"\nGenerating public/private ed25519 key pair.\nEnter file in which to save the key (/n//.ssh/id_ed25519): \nEnter passphrase (empty for no passphrase): \n</code></pre> Then I wasn't able to type anything as a passphrase. Then I found that I was able to type, but the Git Bash terminal just didn't show anything. I wrote a phrase twice and hit Enter. I got an SSH key.</p> <p>OK, I have an SSH key, but what do I do with it? And why? Why is this so complicated? I just want to upload some files to the internet.</p> <p>Then I found this tutorial on adding an SSH key to my Gitlab account and followed it blindly.</p> <p>I used <code>$ cat ~/.ssh/id_ed25519.pub | clip</code> to copy the contents of the SSH key file.</p> <p>Put it into the Gitlab account under profile -&gt; SSH keys -&gt; Add an SSH key.</p> <p>Then went into C:/code and said `git clone \"the thing I copied when I pressed clone in gitlab\"'</p> <p>Then I got the message: <pre><code>*** Please tell me who you are.\n\nRun\n\n  git config --global user.email \"you@example.com\"\n  git config --global user.name \"Your Name\"\n\nto set your account's default identity.\n</code></pre> I set the identity: <pre><code>PS C:\\code\\svavar-konradsson&gt; git config --global user.email \"my@email.com\"\nPS C:\\code\\svavar-konradsson&gt; git config --global user.name \"Svavar Konradsson\"\n</code></pre></p> <p>and then said <code>git clone</code></p> <p>That worked! I opened index.html, put my name into the title and saved. That appeared under Source control in Gitlab, I wrote a comment in a field and clicked Commit. Then a Sync button appeared and I pressed that and it pushed the site onto the online repo.</p> <p>Now I need to type my passphrase twice every time that I push files to the online repo. That's annoying, so I'm going to generate a new SSH key and skip the passphrase. I followed \u00c1rni Bj\u00f6rnsson documentation to generate an RSA key and put it into my Gitlab profile.</p> <p>Every time I made major changes in Windows Explorer; deleted lots of files and moved others, I needed to generate a new SSH key. The last one was</p> <p>ssh-keygen -t rsa -b 2048 cat ~/.ssh/id_rsa.pub | clip</p> <p>The MkDocs convention is to put the built web page into a folder called site, but Gitlab needs the web site to be in a folder called public.  Finally I found the site_dir setting, which I can change in mkdocs.yml so that I can rename the <code>site</code> folder to <code>public</code>.</p> <p>At first I manually renamed site to public and pushed the files to the Gitlab repo. I got into trouble when the dot in front of the file <code>.gitlab-ci.yml</code> was erased somehow and the site wasn't deployed. My instructor \u00de\u00f3rarinn found the problem and after that the site worked.</p>"},{"location":"assignments/week02.html","title":"Computer-Aided Design","text":""},{"location":"assignments/week02.html#assignment","title":"Assignment","text":"<ul> <li>Model (raster, vector, 2D, 3D, render, animate, simulate, ...) a possible final project,</li> <li>compress your images and videos,</li> <li>and post a description with your design files on your class page.</li> </ul> <p>See more info and recording of the lecture here.</p>"},{"location":"assignments/week02.html#raster-image-editing","title":"Raster image editing","text":"<p>My instructor \u00de\u00f3rarinn gave me a quick demo of how to isolate an object in an image and make the background transparent. That will probably come in handy in many situations. We'll use Photopea, a free online (and downloadable) photo editor that closely resembles Photoshop. You can even go through Photoshop tutorials in Photopea. </p> <p>Let's start by taking a picture of a roll of tape with flat lighting, and we'll try to avoid having shadows. I'll use the magic wand to select pixels with the a similar color as the pixel under the mouse. Then I'll invert the selection and finally I'll make a mask.</p> <p></p> <p>Next I will use the brush tool to remove the rest of the background. I can hold Alt and the right mouse button to adjust the size and softness of the brush. </p> <p></p> <p>Now I brushed away the rest of the background. But sometimes I accidentally brush away part of the object.</p> <p></p> <p>Tip from \u00de\u00f3rarinn: If you brush away too much, you can press X and switch to the other color in the mask. Then you can brush the object back into the picture.</p> <p></p> <p>Finally, it can be good to add a color fill layer. It can make it easier to see spots that you missed with the brush. You need to drag the color layer below the image layer in the menu on the right. Then the color is behind the image.</p> <p> Missed a bit!</p> <p>Raster image compression To compress the images for the web I installed ImageMagick for Windows from the website. The installation included FFmpeg. I couldn't find any info on the website on how to get started (for someone who doesn't use command line tools), but then I came across Aaron Logan's Fab Academy site from 2022. He recommended following along with this video and that did the trick for me. It was useful to see the trick of writing <code>cmd</code> in the address bar of the folder that includes the images, and then the Windows Command Prompt opens in that directory. </p> <p>Failure</p> <p>I entered <pre><code>magick convert 2023-02-02 15_22_45-Photopea _ Online Photo Editor.png -resize 40% -quality 80 output2.jpg\nconvert: unable to open image '2023-02-02': No such file or directory @ error/blob.c/OpenBlob/3569.\nconvert: no decode delegate for this image format `' @ error/constitute.c/ReadImage/741.\nconvert: unable to open image '15_22_45-Photopea': No such file or directory @ error/blob.c/OpenBlob/3569.\nconvert: unable to open image '15_22_45-Photopea': No such file or directory @ error/blob.c/OpenBlob/3569.\nconvert: no decode delegate for this image format `' @ error/constitute.c/ReadImage/741.\nconvert: unable to open image '_': No such file or directory @ error/blob.c/OpenBlob/3569.\nconvert: unable to open image '_': No such file or directory @ error/blob.c/OpenBlob/3569.\nconvert: no decode delegate for this image format `' @ error/constitute.c/ReadImage/741.\nconvert: unable to open image 'Online': No such file or directory @ error/blob.c/OpenBlob/3569.\nconvert: unable to open image 'Online': No such file or directory @ error/blob.c/OpenBlob/3569.\nconvert: no decode delegate for this image format `' @ error/constitute.c/ReadImage/741.\nconvert: unable to open image 'Photo': No such file or directory @ error/blob.c/OpenBlob/3569.\nconvert: unable to open image 'Photo': No such file or directory @ error/blob.c/OpenBlob/3569.\nconvert: no decode delegate for this image format `' @ error/constitute.c/ReadImage/741.\nconvert: unable to open image 'Editor.png': No such file or directory @ error/blob.c/OpenBlob/3569.\nconvert: unable to open image 'Editor.png': No such file or directory @ error/blob.c/OpenBlob/3569.\nconvert: no images defined `output2.jpg' @ error/convert.c/ConvertImageCommand/3342.\n</code></pre></p> <p>I guess ImageMagick didn't like the file name that the Greenshot screen grabbing tool generates. My instructor \u00de\u00f3rarinn recommended Greenshot to me, it's lightweight and because it freezes the screen, you can grab screenshots where your mouse shows up. I tried renaming one of the files to 1.png and then the ImageMagick compression command worked: <pre><code>C:\\code\\FabAcademyImagesUncompressed\\week02&gt;magick convert 1.png -resize 40% -quality 80 output1.jpg\n</code></pre> But I wanted to convert a whole folder of images with one command. This batch resize tutorial showed my how to set the width of the resized image while keeping the original aspect ratio. Now I put all the uncompressed images for the week in one folder and run <pre><code>magick mogrify -resize 560 *.png\n</code></pre> to resize all the images in the folder to be 560 pixels wide. I didn't even have to rename them this time. Then I run <pre><code>magick mogrify -format jpg *.png\n</code></pre> to convert all the images in the folder to JPEG format. Be aware that <code>mogrify</code> doesn't copy the images but changes the originals. So I just make copies of them first and put them all in one folder before running the <code>mogrify</code>. Here's the mogrify documentation.</p> <p>To resize and compress single images as I go along, I use <pre><code>magick convert image.png -resize 560 image.jpg\n</code></pre></p>"},{"location":"assignments/week02.html#design-file","title":"Design file","text":"<p>Here is the finished product:</p> <p></p>"},{"location":"assignments/week02.html#3d-modeling-in-blender","title":"3D modeling in Blender","text":"<p>Since I can generally get Fusion 360 to do what I want it to, I decided to learn a little bit about Blender. I've been missing a way to edit STL meshes and model organic stuff, so here we go.</p> <p>Right after you click Download, this Youtube tutorial series appears on the Blender website. So I got started and acquainted myself with the viewport navigation. Remember that you can press F to go to full screen on Youtube.</p> <p> Rotate by pressing and holding the XYZ axes in the image.</p> <p>You rotate by holding down the scroll button on the mouse, just like in SolidWorks. So that's convenient. There's also a set of XYZ axes in the top right corner that you can grab and rotate like the Autodesk ViewCube. You can also click top, side and front views. Nice. Clicking and holding the little hand button next to the axes moves the center of rotation. And you zoom by scrolling the wheel.</p> <p>The little camera symbol next to the axes lets you look through the camera that you've put into the scene (you can also press 0 on the number pad). Someone in the Youtube comments mentioned that F12 renders the camera view. So 0 and then F12 is a quick way to render the model. Next to the camera icon is a grid symbol, which switches between orthographic mode (good for modeling) and perspective mode (good for rendering realistic images).</p> <p>It's good to keep an eye on the status bar on the bottom, which shows you the context you're working in at the moment. Ctrl+Space is a convenient way to maximize any viewport or panel in the interface, and then you can press Ctrl+Space again to return to the default setup:</p> <p> Default interface (left) and Ctrl+Space to maximize side panel (right).</p> <p>There are several tabs at the top that represent different workspaces. In each workspace, the panels in the Blender interface have been set up for that particular task:</p> <p></p> <p>All the viewports and panels can be resized. To choose a different panel, click the symbol with the down arrow in its top left corner:</p> <p></p> <p>In the Layout workspace, pressing T will open commonly used tools like Move and Scale, and pressing ++N++ will open info about the selected object, tool-specific options and view options.</p> <p>  Left menu is toggled with T, right menu is toggled with N.</p> <p>Notice the little tabs on the right side of the right menu called Item, Tool and View. In the View tab, you can edit the position of the 3D cursor, which acts as the spawning point for new objects and you can do things like pivot objects around it.</p> <p>In the Layout workspace, the Timeline below the viewport controls the playback of the animation. You can scroll to zoom in and out and hold the scroll wheel to pan. You can define start and end points and add key frames.</p> <p>Warning</p> <p>DON'T MAKE TUTORIALS</p> <p>In our weekly local Fab Academy meeting in Iceland, I mentioned how long the documentation was taking and that I wasn't getting anywhere with Blender. My instructor \u00de\u00f3rarinn said that I shouldn't be making a tutorial on how to use Blender but rather summarize what I did, what was interesting and then link to the tutorial that I used. That's a relief. The rest of this page will be more concise and interesting.</p> <p>I ended up quitting the official Blender tutorial after the third video and starting the doughnut tutorial by Blender Guru on Youtube. I remember things much better when I have a goal in mind and just use the tools I need to achieve it. I followed videos 1 through 6.</p> <p>I haven't modeled anything organic before, so it was interesting to try make the doughnut lopsided and kind of realistic. It goes against my engineering training, where you usually want things to be symmetrical. I liked getting to know subdivision modeling, to make smooth object using relatively few polygons. And I really liked that my  3D mouse works in Blender.</p> <p>The few times when I've attempted to edit a mesh, I've moved single vertices, resulting in gnarly, pointy looking objects. So I always gave up! But now that I know about proportional editing in Blender, I can select a single vertex and the vertices close to it will follow, while those further away will be affected less. This is much quicker and more effective. I love it! And thinking about my final project, the robot arm, it would be lovely to make a keypoint editor to move it, and use proportional editing to move the keypoints around the moved point, to get a smooth rolloff. I also want to remember the Alt+S shortcut to make the faces move directly outward (normal to the faces).</p> <p> </p> <p>I still have some way to go before I'll be confident in my mesh editing skills. Here's my first attempt to make the icing on the doughnut droop:</p> <p> Side view looks good, top view reveals what's actually going on.</p> <p>After some backtracking, the icing started to look good by direct editing of the vertices. Next I tried a bit of sculpting. That means using brushes to edit the mesh. I was able to make drops in the icing by sculpting it.</p>"},{"location":"assignments/week02.html#rendering-in-blender","title":"Rendering in Blender","text":"<p>I tried adjusting the camera view and the light to get a good result. I tried bot the Eevee real-time rendering engine and the more realistic, but much slower, Cycles ray-tracing rendering engine. The rendering was quite slow until I enabled the CUDA graphics card in the laptop.</p> <p>Final result</p>"},{"location":"assignments/week02.html#design-file_1","title":"Design file","text":"<p>The doughnut Blender file is 6.8 MB, so I won't include it here. But I uploaded it to Sketchfab:</p> <p>  Doughnut made in Blender  by  svavarkonn  on Sketchfab</p>"},{"location":"assignments/week02.html#blender-simulation","title":"Blender simulation","text":"<p>I also went through a really quick tutorial on cloth simulation. Here is the result:</p> <p></p> <p>It's fascinating! There are doors opening for me left and right! Blender is a pretty incredible piece of sofware. </p>"},{"location":"assignments/week02.html#design-file_2","title":"Design file","text":"<p>The Blender file is 20.2 MB, so I won't include it here. But I uploaded it to Sketchfab:</p> <p>  Monkey + dish rag cloth simulation  by  svavarkonn  on Sketchfab</p> <p>You can make your own in ten minutes plus maybe 30 minutes of render time.</p>"},{"location":"assignments/week02.html#2d-design-in-inkscape","title":"2D design in Inkscape","text":"<p>I've started using Inkscape a bit since I started working at Fab Lab \u00cdsafj\u00f6r\u00f0ur. But I haven't used the Clone tool before. Here's a little experiment with cloning a rectangle:</p> <p></p> <p>I didn't save the Inkscape file, it wasn't very interesting.</p>"},{"location":"assignments/week02.html#antimony-modeler","title":"Antimony modeler","text":"<p>I set up a Raspberry Pi in the case that I need to use Linux during the course. I used this tutorial to enable cloud connection. That way I can connect to the Raspberry Pi from outside its network. When I connected remotely for the first time, the screen resolution was tiny because the Raspberry Pi wasn't connected to a monitor. I followed this tutorial to hardcode the screen resolution into the boot config text file. </p> <p>I tried to build Matt Keeter's Antimony modeler on the Raspberry Pi, but without luck.</p> Failure <pre><code>sudo apt install git build-essential libpng-dev python3-dev libboost-all-dev libgl1-mesa-dev lemon flex qt5-default ninja-build cmake\nReading package lists... Done\nBuilding dependency tree... Done\nReading state information... Done\nPackage qt5-default is not available, but is referred to by another package.\nThis may mean that the package is missing, has been obsoleted, or\nis only available from another source\nE: Package 'qt5-default' has no installation candidate\n</code></pre> <p>I tried to install qt5 instead of qt5-default, but it didn't work.</p> Failure <pre><code>sudo apt install git build-essential qt5\nReading package lists... Done\nBuilding dependency tree... Done\nReading state information... Done\nE: Unable to locate package qt5\n</code></pre> <p>I don't know where to go from there.</p>"},{"location":"assignments/week02.html#update-after-fab-academy","title":"Update after Fab Academy","text":"<p>I installed Linux Mint in a virtual machine using VirtualBox, which was really easy. When browsing the software manager I came across Antimony, already built and ready for download! I tried a few operations and connected them together using the node view. I always find node software like this intimidating, but it didn't take long for it to become intuitive. Here's what I made:</p> <p>Simple test where I combined features.</p> <p>You can easily do things that are hard in other CAD software. Here I made a cone, rotated it and put a twist on it.</p> <p>I'd like to 3D print these models. I tried to move the files from the virtual machine to my Windows 10 desktop but the drag and drop feature didn't work. I also tried setting up a shared folder between the two operating systems, which appeared in Windows but I couldn't see it in Linux Mint.</p> <p>I find it really cool that the world's most advanced 3D printed rocket nozzles are being designed in CAD software that's based on Matt Keeter's geometry kernel.</p>"},{"location":"assignments/week02.html#antimony-in-windows","title":"Antimony in Windows","text":"<p>I set up the Windows Subsystem for Linux. Now I have Ubuntu running inside Windows at near-native speed. I installed Antimony inside WSL and now I can open this unusual Linux-based CAD program from the Windows Start menu. From an free software perspective the WSL is kind of grotesque, but it's just so convenient. Here's how you can do it:</p> <p>You need WSL2 to run Linux apps with a graphical user interface. Here are the instructions that I followed to set up WSL2. It's super simple if you have a recent enough version of Windows, just open up Command Prompt by opening the Start menu and typing <code>cmd</code>, and then type in:</p> <pre><code>wsl.exe --install\n</code></pre> <p>After a few minutes the Windows Subsystem for Linux is installed on your machine and you can open the Ubuntu terminal.</p> <p>After a bit of searching I found this page, which told me how to install Antimony on Ubuntu 22.04 using the Debian apt package manager. Open the Start menu in Windows and type Ubuntu to get the Ubuntu terminal running. This is what you put into the Ubuntu terminal to install Antimony:</p> <pre><code>sudo apt-get -y install antimony\n</code></pre> <p>That's it! Now you can open Antimony like a Windows app and play around with it any time!</p>"},{"location":"assignments/week02.html#kokopelli-modeler","title":"Kokopelli modeler","text":"<p>I also tried to build Matt Keeter's Kokopelli from source on the Raspberry Pi, but also without luck:</p> Failure <pre><code>sudo apt-get install python python-dev python-pip gcc g++ libpng12-dev make bash cmake\nReading package lists... Done\nBuilding dependency tree... Done\nReading state information... Done\nNote, selecting 'python-is-python2' instead of 'python'\nNote, selecting 'python-dev-is-python2' instead of 'python-dev'\nPackage libpng12-dev is not available, but is referred to by another package.\nhis may mean that the package is missing, has been obsoleted, or\nis only available from another source\n\nPackage python-pip is not available, but is referred to by another package.\nThis may mean that the package is missing, has been obsoleted, or\nis only available from another source\nHowever the following packages replace it:\n  python3-pip\n\nE: Package 'python-pip' has no installation candidate\nE: Package 'libpng12-dev' has no installation candidate\n</code></pre>"},{"location":"assignments/week02.html#voxel-modeling","title":"Voxel modeling","text":"<p>I tried the MagicaVoxel program without looking at a tutorial, and made this figure:</p> <p></p> <p>I'm not sure how to make anything useful with this modeling method. Maybe I'll think of something later.</p>"},{"location":"assignments/week02.html#design-file_3","title":"Design file","text":"<p>Here's the voxel guy I made:</p> <p>Download voxel guy</p>"},{"location":"assignments/week02.html#solvespace-parametric-3d-cad","title":"Solvespace parametric 3D CAD","text":"<p>I went through a Solvespace tutorial and quite liked the experience. I like the dark 8-bit look of it. I was also surprised to find that my 3D mouse works in Solvespace. The program is lightweight and modeling seems quick, once you've memorized a few keyboard shortcuts and familiarized yourself with how the sketch constraints work. In the time that it took Fusion 360 to open, I saved the bracket and exported it as STEP, STL and a triangle mesh with a Three.js html viewer. You can open the 3D model in the browser below!</p> <p>Open bracket 3D model in browser</p> <p>Solvespace was written by Jonathan Westhues and he's made other impressive things too. This tube joint pattern generator would have been a lifesaver when we were building the steel tube spaceframe for the first and second Team Spark electric racing cars back in 2011 and 2012. Solvespace was maintained for a few years by M-Labs. M-Labs wrote the Three.js export feature, among others. Jonathan says himself that Solvespace's NURBS operations are not as good as OpenCASCADE's but they're much smaller. The constraint solver is a remarkable achievement though, and it works well. Jonathan originally made a 2D CAD program which was superseded by Solvespace, but the paper he wrote on the sketch solver is an interesting read. The Solvespace solver library is the solver behind CAD Sketcher in Blender. The Solvespace feature list mentions G-code export with cutter radius compensation and path traced with mechanism, exportable into a spreadsheet. These two are interesting. The next thing I want to try in Solvespace is to make a movable assembly.</p> <p>For me the killer feature in Solvespace is the Three.js export. The in-browser Three.js model even has the Solvespace look! The file includes the whole Three.js library, which means that the file for this simple bracket is 0.7 MB. So if you want to display more than one model they will take up a lot of space. In that case you may want to export only the js model geometries from Solvespace and then manually link them to the three.js file. The bracket model geometry is only 52 KB.</p>"},{"location":"assignments/week02.html#design-file_4","title":"Design file","text":"<p>Here's the Solvespace model for download:</p> <p>Download Solvespace bracket</p>"},{"location":"assignments/week02.html#rhino3d","title":"Rhino3D","text":"<p>Rhino can do pretty much everything. A full license costs a thousand euros and you keep that version of Rhino for life. Even better, students and educators can get a license for 200 euros. But first, I'm going to get the trial version, which lasts for 90 days (all of the Fab Academy). I've wanted to try Rhino for quite some time, but all those unfamiliar tools and menus are a bit intimidating. I know solid extrude must be there, but where?</p> <p>I didn't like the official Getting Started tutorials very much, because the first videos just show you things but not making you do anything in the software. So I went to Youtube and found a 40 minute introduction to Rhino for architecture students. I followed along for 17 minutes.</p> <p> Selecting a surface with Ctrl+Shift left mouse in the first image and dragging the black dot on the red axis. That leads to the extrusion in the second image.</p> <p>I learned to make lines, curves, surfaces, solids and how to manipulate them.Now that I've turned on the Gumball tool, I can just select a surface and extrude it by pulling on the dot on one of the Gumball tool axes. Nice!</p> <p></p> <p>In the above picture I'm rotating a surface, which changes the whole shape.</p> <p>Rhino seems to have many more tools than Fusion 360, so it's interesting for making complicated shapes. I especially like the ability to grab any point, line or surface and move and rotate them with the Gumball tool. That's a really quick way to make interesting shapes that I would find difficult to model in Fusion 360. But I still haven't learned how to model precise things in Rhino with dimensions and constraints.</p>"},{"location":"assignments/week02.html#design-file_5","title":"Design file","text":"<p>Here's the Rhino file I made (it's just nonsense like you see in the images):</p> <p>Download Rhino model</p>"},{"location":"assignments/week02.html#rhino-grasshopper","title":"Rhino + Grasshopper","text":"<p>I went through a quick tutorial and made a nice Voronoi pattern! I really like the possibilities in Grasshopper. I've wanted to try it for some time. And I like the simplicity of the Voronoi method, you just make a line midway between every point and its next neighbor, and then trim the lines. A random distribution of points results in a cellular-like pattern.</p> <p></p> <p></p>"},{"location":"assignments/week02.html#design-file_6","title":"Design file","text":"<p>Here's the Rhino file with the extruded Voronoi surface.:</p> <p>Download Rhino + Grasshopper Voronoi model</p>"},{"location":"assignments/week02.html#freecad","title":"FreeCAD","text":"<p>After watching this video, I got excited about learning FreeCAD, but I'm 20 minutes in to a tutorial and I've only learned how to enable dark mode, and I've discovered that my 3D mouse doesn't work well with the program. Or maybe I haven't found the right settings.</p> <p>Update: Now I've started modeling and I'm starting to like FreeCAD. It's incredibly capable. I only stuck with it because Neil Gershenfeld is so adamant that it's a good tool and that his Fab Academy students should try it. </p> <p>The feature tree is very similar to Inventor and SolidWorks. You can go back in time and change features that control features later in the tree. I could get used to this.</p> <p>Hold on! There's an HTML export option! And it uses native WebGL, without the Three.js library on top of it. And the bracket model is a tiny 60 KB, including the viewer! Look!</p> <p>Open FreeCAD bracket in browser</p> <p>The HTML file is human-readable, so I could easily go into it and change the background gradient colors. The bracket itself still has a yellowish color on the bottom, but this is good enough for now.</p> <p>Open FreeCAD bracket with greytone background</p>"},{"location":"assignments/week02.html#design-files","title":"Design files","text":"<p>Here's the FreeCAD bracket model:</p> <p>Download FreeCAD bracket model</p> <p>Update: I also tried setting up a parametric model based on a spreadsheet. I followed this tutorial.</p> <p></p> <p>Here's the model that includes a few configurations:</p> <p>Download configurable FreeCAD cube</p> <p>I would also like to try Python scripting in FreeCAD when I have the time.</p>"},{"location":"assignments/week02.html#on-free-and-open-source-engineering-software","title":"On free and open source engineering software","text":"<p>I must admit that I've been prejudiced against free and open source versions of the engineering software that I've been using. If it's free there must be something wrong with it. I've assumed that it must be missing lots of features and that it must have a bad user interface and be riddled with bugs. Not so! And there are features in the free software that are not found in paid software at any price. Autodesk and Dassault Syst\u00e9mes, the makers of the CAD software I use most, have thousands of employees. FreeCAD is developed by like three people and it can do finite element analysis! How is this possible? Because of the ecosystem of open-source packages that get integrated into FreeCAD, like the Open SCAD workbench, for example. And the open nature of the software ensures that those who are interested can learn everything about it, down to the lowest level, and improve it and make their own versions of it. This is similar to the original purpose of published patents, to disseminate technology for everyone.</p> <p>It's interesting to note that an old open source project that was developed in the late 1960s is still the state of the art in structural Finite Element Analysis. Nastran is a million lines of FORTRAN code written for NASA by the company that would become MSC. Nastran is the core in the most advanced FEA solvers in Autodesk Inventor and even in more exotic and cutting-edge software like ADINA, which is used for the most difficult multiphysics problems like simulating nuclear reactors before they are built. I came across ADINA in my quest to understand shock absorbers. They are surprisingly complex. ADINA makes an FEA solver that is more advanced than the Siemens NX solver, and that is saying something. NX is arguably the most advanced CAD software in the world. Its geometry kernel is also the basis of the Onshape, Shapr3D and Altair CAD software.</p>"},{"location":"assignments/week02.html#cadtron","title":"CADtron","text":"<p>I didn't try Kevin Lynagh's  CADtron because it hasn't been released yet, but it's an interesting gesture-based 2D CAD program based on the Solvespace library. Here's an example of a perpendicular constraint drawn with a stylus (from Kevin's video):</p> <p></p>"},{"location":"assignments/week02.html#fusion-360","title":"Fusion 360","text":""},{"location":"assignments/week02.html#final-project-mockup","title":"Final project mockup","text":"<p>I made a mockup of my final project in Fusion 360. I connected the parts together with joints, so that I could move the arm realistically. This arm has six axes. I imported a few electronic components from GrabCAD and put them on the arm to show how I envision the design. </p> <p>I want to make the arm out of printed circuit boards. The are fiber reinforced, so they are quite stiff. If I place some rigid foam between two circuit boards I have a very stiff and light part that also contains the microcontroller and motor driver to control the joint. I haven't seen a robot arm made of PCBs anywhere, so that's what I want to make. </p> <p>My instructor \u00de\u00f3rarinn suggested that I think about designing the arm in such a way that it could also be laser cut or 3D printed, depending on the fabrication tools that people have access to. So here are three versions, rendered in the Fusion 360 rendering environment:</p> <p>Tan colored FR1 circuit board arm Red 3D printed arm Transparent acrylic laser cut arm</p>"},{"location":"assignments/week02.html#motion-study","title":"Motion study","text":"<p>I had trouble figuring out the Fusion 360 Animation environment, so I did a motion study instead.</p> <p>Before making the motion study, I needed to create rotational joints between the parts using the Joint operation (see in the menu above).</p> <p>OK, let's go back and define all the joints first, and make the base fixed to the ground, so that it doesn't rotate with the other parts.</p> <p>It's quite simple to select the hole on each part to rotate around and that's it, really. You may need to play around with some of the settings until you get what you want. But there aren't that many settings.</p> <p>All the joints that I defined automatically appear in the motion study as a colored line. I can place keypoints on those lines at certain times to create motion in those joints. Then it's just a matter of figuring out which joint is which and its extents of motion and playing around with the interface until the movement looks good.</p> <p>Note</p> <p>To capture short animated GIFs of what I'm doing in software, I use LICEcap. It's available for Windows and MacOS. It's lightweight and produces much smaller GIFs than any other screen capture program that I've used. Because of this recommendation, I used the command line tool Gifsicle to resize the GIF after recording it with LICECap. I tried double-clicking gifsicle.exe, but nothing happened. I found this Reddit discussion, where it was explained that Gifsicle is a command-line tool, so you just enter the commands. But where? I tried the same method as with ImageMagick. I put the GIF into the folder with Gifsicle and typed <code>cmd</code> Enter, which opened the Command Prompt in that folder. Then I ended up using the command <pre><code>gifsicle motion_study5.gif --resize 660x220 --colors 256 --optimize &gt; motion_study5_resized.gif\n</code></pre> and that worked! The GIF went from 844 KB to 200 KB.</p> <p>I quite like the control interface for the motion study. Each line controls a joint. You click the line to make a keypoint and enter the position of that joint. This is more intuitive than the robot control software that I've tried. It would be nice to control the arm in this way. Someone on the internet said that Fusion 360 is not the right tool to control robot arms, and they're probably right. They recommended Blender. I've been thinking about writing a Python script for Blender that uses the animation environment to control my robot arm. Or I could try a browser-based solution. I saw something like this when searching the Fab Academy archives.</p>"},{"location":"assignments/week02.html#design-file_7","title":"Design file","text":"<p>Here's the robot arm Fusion 360 file, including the conveyor belt and motion study:</p> <p>Download robot arm mockup</p>"},{"location":"assignments/week03.html","title":"Computer-Controlled Cutting","text":""},{"location":"assignments/week03.html#assignment","title":"Assignment","text":""},{"location":"assignments/week03.html#group-assignment","title":"Group assignment","text":"<ul> <li>Characterize your laser cutter's focus, power, speed, rate, kerf, joint clearance and types </li> </ul>"},{"location":"assignments/week03.html#individual-assignment","title":"Individual assignment","text":"<ul> <li>Cut something on the vinyl cutter</li> <li>Design, laser cut, and document a parametric construction kit,</li> <li>accounting for the laser cutter kerf,</li> <li>which can be assembled in multiple ways,</li> <li>and for extra credit include elements that aren't flat </li> </ul> <p>See more info and recording of the lecture here.</p>"},{"location":"assignments/week03.html#parametric-construction-kit","title":"Parametric construction kit","text":""},{"location":"assignments/week03.html#design","title":"Design","text":"<p>I wanted to make a minimal parametric construction kit that was made up of only one piece. You can see the design taking shape in the hand-drawn sketches below  as I was thinking about the design specifications. When I had decided on the specs, the design was fully defined. The piece can have no other shape.</p> <p></p> <p>I wanted four pins and four pockets, so that defined the shape of the piece. The plan was to have the dimensions of the pins and pockets equal on all three axes, so that the pieces can be assembled every which way. This ultimately means that all the dimensions in the 2D sketch are controlled by the material thickness.</p> <p></p> <p>I made a sketch in FreeCAD and set up a spreadsheet inside the part file. In the spreadsheet I defined two main parameters that I use to control the design; the material thickness and the kerf. There I am editing the value of the kerf:</p> <p></p> <p>I made two test pieces (see the image at the top of the page) and decided to make the hole in the middle a star instead of a square. That way you can assemble the pieces at a 45\u00b0 angle, which is necessary because the angle between every pin and pocket is 45\u00b0.</p>"},{"location":"assignments/week03.html#laser-cutting-the-pieces","title":"Laser cutting the pieces","text":"<p>Then I made a series of kerf tests, which was easy because I only needed to change one parameter. I wound up making the fit tighter than I usually do (kerf = 0.24 mm) because the fit is tighter when the pieces are assembled in-plane than when they are perpendicular to each other. The 90\u00b0 perpendicular fits were always too loose and I didn't understand why. </p> <p>Kerf tests</p> <p>Then I thought about the way that the kerf tapers, so that more material is removed at the bottom of the material than at the top surface. This is because the laser has only one focus point, which is set at the top surface of the material. Below that point, the laser beam diverges, causing the sides of the pieces to not be completely perpendicular to the surface of the sheet. </p> <p>My instructor \u00de\u00f3rarinn said that there isn't really anything we can do about that, so I tried setting the focus in the middle of the material, by focusing on a 2 mm thick sheet and then cutting a 4 mm thick sheet. I was hoping that the cut would have more of an hourglass shape than a simple taper, but it didn't work out that way. Changing the focus didn't make that much of a difference, but I ended up cutting all the pieces with it set in the middle of the material.</p> <p>Here's a full plate of construction pieces, patterned by hand in Inkscape: </p> <p></p> <p>I used the Epilog Mini 24x12 laser cutter to cut my construction kit. In Inkscape, I set the line width to 0.02 mm and made the lines red (RGB 255,0,0). This is the code that the Epilog laser driver uses to determine that it should cut these lines. Then I export the drawing to PDF.</p> <p>On the computer next to the Epilog laser cutter, I open the PDF document and select File -&gt; Print.</p> 1. File -&gt; Print2. Properties <p>It doesn't really matter whether I select only Vector or Combined, because the document contains no raster (engraving) features. I set the Piece size to 600 by 300 mm. I only need to set the Vector settings in the bottom right corner because there is no rastering.</p> <p>I used vector (cutting) settings of 5% speed, 100% power and 5000 Hz laser frequency.</p> <p>The Epilog Mini 24x12 hard at work.</p>"},{"location":"assignments/week03.html#playtime","title":"Playtime","text":"<p>The construction kit was very well received by my family. After an evening of play, these are the resulting shapes. Wall-E, a drone, an axle with wheels, a cube, a coaster, a giraffe, a magic wand, an I-beam, and a tool to measure the curve of your spine. It works really well, it might be a handy tool for physiotherapists.</p> <p>I'm holding up Wall-E, which my older son Ernir (4 years old) made.</p> <p>Here's Hj\u00f6rtur's (1 year old) hand touching something that my wife A\u00f0albj\u00f6rg made.</p> <p>This could be a template to measure spine curvature.</p> <p>Ernir playing with the laser cut pieces and coloring some of them with a marker. Incidentally, I later melted down the rest of the Icelandic cat candle in this picture to make the FMCU button.</p> <p>My son was also quick to start using the laser cut pieces with his beloved garbage truck.</p> <p>My wife looking through a sheet of laser cut pieces.</p>"},{"location":"assignments/week03.html#design-files","title":"Design files","text":"<p>Download spreadsheet-driven FreeCAD design</p> <p>Download DXF file (one piece)</p> <p>Download SVG cutting file (462 pieces)</p> <p>Download PDF cutting file (462 pieces)</p>"},{"location":"assignments/week03.html#circuit-cut-with-vinyl-cutter","title":"Circuit cut with vinyl cutter","text":"<p>I wanted to cut a copper sheet and make a circuit in the vinyl cutter. This hasn't been done before at my lab. I wrote it up for my secondary school students in Icelandic and had them make vinyl cut sensors the week after I tried it myself.</p> <p>I got the design for a simple step response sensor from Hafli\u00f0i who was working at Fab Lab Reykjav\u00edk.</p> <p>My instructor \u00de\u00f3rarinn led me through the ins and outs of the vinyl cutter. He disassembled the knife to show me the tiny bearing that needs to be cleaned and lubricated when it jams:</p> <p></p> <p>Then he explained the way to adjust the knife. You start by retracting the knife fully and then cutting manually into the material. If nothing happens, you extend the knife a little bit and cut again. You want to cut fully through the material and scratch the backing, but you don't want to cut through the backing. Then you would damage the rubber that is underneath, and that's part of the machine.</p> <p></p> <p>You cut tabs like you see below and then bend the material and see if they come loose. When it looks like you're getting close, you start paying attention to the ticks on the knife. A course adjustment is two ticks, a fine adjustment is one tick. If the material comes loose when you bend it, but you're not cutting deep into the backing, you're golden:</p> <p></p> <p>\u00de\u00f3rarinn suggested a methodology of testing to get good cuts in the copper. First I would adjust the knife as discussed above. The next step would be to vary the cutting force and the speed until I get a good result. However, after he adjusted the blade and the force for the regular vinyl, I made a test and it cut quite well through the copper! So the systematic testing ended up being just three tests. </p> <p>The first test didn't work out because the copper was crumpled on top of the backing. The second test I cut with 90 grams of force and it was almost there. The third test I cut with 120 grams of force and it looked good.</p> <p>The Roland CAMM-1 Servo GX-24 vinyl cutter. I used a force setting of 120 grams to cut the copper sheet.</p> <p>We use a very simple interface for the vinyl cutter; a printer driver. We export a PDF file from Inkscape with 0.01 mm thick red lines (RGB 255,0,0) and open it in Adobe Reader. I simply go into File -&gt; Print to cut the file on the vinyl cutter. There's only one thing I need to adjust, which is the cutting area:</p> 1. File -&gt; Print2. Properties3. Ready to cut <p>In the Print dialog, I click the Properties button at the top.</p> <p>In Properties, I input the Document size which is under the Summarize Comments button. I need to enter the numbers with periods instead of commas, because this software is from the USA.</p> <p>Now I can press print and the vinyl cutter makes an electronic circuit in under a minute!</p> <p>Here's my first try at weeding copper sheet:</p> <p>It worked, but could be better.</p> <p>Neil recommended sticking everything to the final surface and then weeding. I will definitely try that next time. But this time I weeded first and then glued the copper pads to the laser cut acrylic. I forgot to add holes for pins, so I drilled them afterwards:</p> <p>When I had my students make sensors like these, I added the holes to the laser cutting file.</p> <p>The only component on the board is a 10k resistor.</p> <p>I grabbed a 10k resistor and soldered it to the pads. I'm surprised that the tiny pads survived my rough handling. Then I measured the resistance from one pin to the touch sensitive pad, to check if the solder connections were OK:</p> <p></p> <p>The soldering was fine, and the next step was to open a capacitive touch sensor example sketch in the Arduino IDE and connect my new sensor to a SparkFun RedBoard:</p> <p>Note</p> <p>I used <pre><code>ffmpeg -i input_video -vcodec libx264 -crf 25 -preset medium -vf scale=-2:1080 -acodec libmp3lame -q:a 4 -ar 48000 -ac 2 output_video.mp4\n</code></pre> to compress the video from my phone. Fab Lab Kannai put this into a tutorial. It works!</p> <p>Here's the Arduino sketch, which I modified a little bit (just commented out what I didn't need):</p> <pre><code>#include &lt;CapacitiveSensor.h&gt;\n\n/*\n * CapitiveSense Library Demo Sketch\n * Paul Badger 2008\n * Uses a high value resistor e.g. 10M between send pin and receive pin\n * Resistor effects sensitivity, experiment with values, 50K - 50M. Larger resistor values yield larger sensor values.\n * Receive pin is the sensor pin - try different amounts of foil/metal on this pin\n */\n\n\n//CapacitiveSensor   cs_4_2 = CapacitiveSensor(4,2);        // 10M resistor between pins 4 &amp; 2, pin 2 is sensor pin, add a wire and or foil if desired\nCapacitiveSensor   cs_4_6 = CapacitiveSensor(4,6);        // 10M resistor between pins 4 &amp; 6, pin 6 is sensor pin, add a wire and or foil\n//CapacitiveSensor   cs_4_8 = CapacitiveSensor(4,8);        // 10M resistor between pins 4 &amp; 8, pin 8 is sensor pin, add a wire and or foil\nint LEDpin =13;\n\nvoid setup()                    \n{\n//   cs_4_2.set_CS_AutocaL_Millis(0xFFFFFFFF);     // turn off autocalibrate on channel 1 - just as an example\n   Serial.begin(9600);\n}\n\nvoid loop()                    \n{\n    long start = millis();\n  //  long total1 =  cs_4_2.capacitiveSensor(30);\n    long total2 =  cs_4_6.capacitiveSensor(30);\n   // long total3 =  cs_4_8.capacitiveSensor(30);\n\n   // Serial.print(millis() - start);        // check on performance in milliseconds\n  //  Serial.print(\"\\t\");                    // tab character for debug windown spacing\n\n //   Serial.print(total1);                  // print sensor output 1\n    Serial.print(\"\\t\");\n    Serial.println(total2);                  // print sensor output 2\n   // Serial.print(\"\\t\");\n   // Serial.println(total3);                // print sensor output 3\n\n    delay(10);                             // arbitrary delay to limit data to serial port \n\n //   if (total3 &gt; 40) \n //   {\n  //    digitalWrite(LEDpin, HIGH); \n  //  }\n  //  else\n  //  {\n  //    digitalWrite(LEDpin, LOW); \n  //  }\n}\n</code></pre>"},{"location":"assignments/week03.html#design-files_1","title":"Design files","text":"<p>Download sensor vinyl cutting file</p> <p>Download outline laser cutting file</p>"},{"location":"assignments/week03.html#rubber-stamp","title":"Rubber stamp","text":"<p>For the rubber stamp engraving, I used this reference. I was able to cut through the rubber at 5% speed and 100% power with our 40W Epilog Mini 24x12 laser cutter:</p> <p></p> <p>The engraving test that looked cleanest to me was at 30% speed and 100% power. I then engraved the Fab Lab \u00cdsafj\u00f6r\u00f0ur logo with two such passes and cut out the outline:</p> <p></p> <p>As you can see, this makes for an awful stamp. I both forgot to mirror the logo and invert it, to make it stick out. I haven't had time to make a proper stamp yet, but the tests look promising.</p>"},{"location":"assignments/week03.html#design-files_2","title":"Design files","text":"<p>Download rubber test file</p> <p>Download failed rubber stamp logo</p> <p>Download failed rubber stamp outline</p>"},{"location":"assignments/week03.html#characterizing-our-vinyl-cutter","title":"Characterizing our vinyl cutter","text":"<p>We have a Roland CAMM-1 GS-24 vinyl cutting machine. It can cut with a force of up to 350 g. I've only gone up to 120 g with the copper sheets. The maximum cutting width is 584 mm and the maximum length is effectively unlimited (25 meters). It can cut up to 1 mm thick materials.</p> <p>The vinyl cutter has optical sensors which it uses to measure the size of the sheet. It has a fast and powerful servomotor. It cuts really quickly, so it's a good machine to use when introducing a large group to the Fab Lab.</p> <p>This vinyl cutter has an optical registration system, so you can for example print stickers, include some registration marks on the sheet, pop it into the vinyl cutter and have it cut the outlines of the stickers. I haven't tried this feature yet.</p> <p>For those who want to dive deep into how computer controlled machines work, Fransisco Sanchez made a video on making machines move with mods CE. He starts with this vinyl cutting machine, which is a standard machine in the Fab Lab Inventory. I've watched part of it, it's really interesting. If you learn to speak the machine's language then you can make all sorts of new interfaces with it that don't exist today.</p>"},{"location":"assignments/week03.html#characterizing-our-laser-cutter","title":"Characterizing our laser cutter","text":"<p>Our laser cutter is the 40W Epilog Mini 24x12. It's a CO2 laser with a 610 x 305 mm work area. It can cut up to 5 mm acrylic and MDF and engrave acrylic, MDF, glass and stone. I've also used it to mark metals using Laser Ink. I always open up this Instructable which Sun-Olkkonen wrote while she was an intern at Fab Lab \u00cdsafj\u00f6r\u00f0ur in 2018. Her guide has become quite popular. </p> <p>It's important to watch the machine while it cuts, because it's always just seconds away from starting a fire if something goes wrong. And things do go wrong somtimes. And you must never laser cut any plastic material that contains chlorine, like PVC for example. When it vaporizes such a material, chlorine gas is created, which is deadly.</p>"},{"location":"assignments/week03.html#kerf-test","title":"Kerf test","text":"<p>The missing width when I've laser cut these ten lines is exactly 2 mm. That means that the laser's kerf (or the diameter of the laser point) is</p> \\[\\frac{2mm}{10}=\\underline{0.2mm}\\] <p>So when I design a press-fit joint, I need to offset all lines outward by 0.1 mm.</p>"},{"location":"assignments/week03.html#design-file","title":"Design file","text":"<p>Download kerf test</p>"},{"location":"assignments/week03.html#raster-test","title":"Raster test","text":"<p>I used the same raster test as I did with the rubber stamp. I set the laser power to 100% and the frequency to the maximum 5000 Hz. Then I enabled Color Mapping in the Epilog Laser settings within the Print dialog in the PDF viewer.</p> <p>The Color mapping dialog. You press the triple arrow to save the setting.</p> <p>Red is 60% speed, green is 50%, blue is 40%, yellow is 30%, magenta is 20% and cyan is 10%. That goes for both rastering (top row) and cutting (bottom row).</p> <p>Here's how the 4 mm MDF reacted to these settings:</p> <p>To get a clean raster, the speed must be above 30%. To cut through the material, the speed must be 10% or slower. I usually use 5% speed to make sure that the laser cuts through.</p>"},{"location":"assignments/week03.html#design-file_1","title":"Design file","text":"<p>Download raster test file</p>"},{"location":"assignments/week04.html","title":"Embedded Programming","text":""},{"location":"assignments/week04.html#assignment","title":"Assignment","text":""},{"location":"assignments/week04.html#individual-assignment","title":"Individual assignment","text":"<ul> <li>Browse through the data sheet for your microcontroller</li> <li>Write program for a microcontroller development board<ul> <li>to interact (with local input &amp;/or output devices)</li> <li>and communicate (with remote wired or wireless devices)</li> <li>extra credit: use different languages &amp;/or development environments</li> <li>extra credit: connect external components to the board</li> </ul> </li> </ul>"},{"location":"assignments/week04.html#group-assignment","title":"Group assignment","text":"<ul> <li>Compare the performance and development workflows for other architectures</li> </ul> <p>See more info and recording of the lecture here.</p>"},{"location":"assignments/week04.html#the-rp2040-datasheet","title":"The RP2040 datasheet","text":"<p>I read the Raspberry Pi RP2040 datasheet loosely. This is one of the more interesting microcontrollers to me, because of the flexible Programmable Input/Output (PIO), two fast cores and you can program it in the Arduino IDE or in the friendly Python language. The datasheet also looks friendlier than datasheets for other microcontrollers. Still, that may only be the graphic design, because the actual content is cryptic. I understood like 0.5% of what I read. </p> <p>But I did pick up some interesting tidbits. The RP2040 has a built-in Real Time Clock. That would be useful for my wake-up mask. It has a dormant state which uses almost no power and it can be woken up by the RTC. That also sounds good for the wake-up mask. But in that case, the RTC needs to use an external clock source, which can be as slow as 1 Hz. Hold on, the RTC needs an external crystal. That's good to know. I thought you didn't need to add a crystal, but the only truly internally generated clock is the Ring Oscillator. Its speed varies with process, voltage and temperature, so it can't be used for RTC, USB communication or analog to digital conversion.</p> <p>When reading the RP2040 datasheet and testing the Xiao RP2040, I wondered: Does the tiny Xiao board have a crystal? I don't see one on the board. Is it underneath the metal cover with the RP2040? If it doesn't have an external oscillator, then the Real Time Clock doesn't work and I can't use it in my wake-up mask. I looked around and found the schematic for the Xiao RP2040 and there is a crystal and Flash memory. Good. They must be underneath the cover. </p> <p> So there is a crystal.</p> <p>But maybe the internal RTC in the RP2040 isn't good enough and I need to use something like the DS3231 chip.</p> <p>Update: My instructor \u00de\u00f3rarinn showed me a picture of what's underneath the metal cover. The picture was actually on the same page as the schematic that I had found, but I hadn't looked at the whole page. So here it is, and you can see the crystal marked with 12.000:</p> <p></p> <p>I watched a video that stated that computers are horrible at division. So I was glad to see that the Raspberry Pi Foundation decided to implement a hardware division unit in the RP2040. I wondered why there was no hardware multiplier until I got to the section about the Arm Cortex M0+ cores inside the RP2040. The Arm specification has hardware multiplication built in.</p> <p>I watched another video that shows how you can easily overclock the Raspberry Pi Pico. Overclocking has always sounded to me as if you're going to overheat the device and damage it, or make it unstable, but the datasheet says that overclocking processors in general is usually fine. In the video, a maximum speed of 250 MHz is recommended.</p> <p>I was interested in the example programs provided under the Programmer's Model headings in the datasheet but I have no idea where to put them or how to run them. There are also lots of tables with registers and commands and stuff like that but I can make neither heads nor tails of them. What are they? What would I do with them? The mysteries continue.</p> <p>The RP2040 chip has 36 General Purpose Input/Output pins. That's quite a lot. Typically, a few of those pins are connected to an external flash memory chip, as in the Raspberry Pi Pico board. The Pi Pico board has 26 user-accessible pins. Three of them can be used for reading analog signals and converting them to digital numbers. The ADCs are officially 12 bit but the effective resolution is I think something like 10 bits because of an error in the chip design. </p> <p>The RP2040 has plenty of communication interfaces (SPI, UART, I2C, USB), and if you need something else, you can make it yourself with the Programmable IO blocks. It has eight two channel PWM generators (they're called slices). So can it generate 8 PWM signals, or 16? The PIO machines can always see the states of all pins. That's interesting. I think I remember reading that the DMA channels share a similar view.</p> <p>My Master's thesis advisor said that when programming in C, you get much more access to all the computer's devices and peripherals. When the University stopped paying the license for his vibration meter, he wrote a driver for it in C. That sounds like wizardry to me, and more than a little fascinating. But the C code examples in the RP2040 datasheet don't look fun to me.</p>"},{"location":"assignments/week04.html#pio","title":"PIO","text":"<p>This is the most interesting part, the Programmable IO. There are two PIO blocks in the RP2040 and each has four state machines. That means that you have eight simple, deterministic and precisely timed cores that are specialized for input and output. Each state machine has two 32 bit shift registers. Jakob Einar, a frequent guest at Fab Lab \u00cdsafj\u00f6r\u00f0ur, made a cnc plotter using old DVD drives. He said that a shift register enables a slow Arduino Uno to control all the steppers in sync. I'm curious about how a shift register works.</p> <p>There are two PIO blocks with four state machines each. Each state machine has:</p> <ul> <li>Two 32-bit shift registers (I need to find out what they do)</li> <li>Two 32-bit scratch registers (you can think of them as variables, they're called x and y)</li> <li>4x32-bit bus FIFO in each direction or 8x32 in a single direction (data flows in and out using these and gets stored in the two variables x and y)</li> <li>Fractional clock divider (if you want the PIO to run slower than the main clock speed)</li> <li>DMA interface (to get lots of data from memory without using the processor, or put data into memory)</li> <li>IRQ flag set/clear/status (I think this is to alert the main processor that the PIO has finished an operation)</li> </ul> <p>The state machine has only nine instructions: <code>JMP</code>, <code>WAIT</code>, <code>IN</code>, <code>OUT</code>, <code>PUSH</code>, <code>PULL</code>, <code>MOV</code>, <code>IRQ</code> AND <code>SET</code>. Each instruction takes exactly one cycle. It's interesting to try programming at this level. I like the fact that the first three bits of each instruction is like this: <code>JMP</code>: 001, <code>WAIT</code>: 010 and so on. I understand that labeling system!</p> <p>Precise timing is what microcontrollers are good at! You can get PIO programs from the Raspberry Pi Pico PIO library, you can write them yourself or (and this is the most interesting case) you can generate them programmatically. I wouldn't know how to do that, though. All the supplied code examples are written in C. This may be a good introduction. I'm putting this here for myself to discover later. Here's some more stuff.</p> <p>I did find one example of using DMA in MicroPython code. The iosoft blog says that MicroPython doesn't have built-in functions to support DMA and doesn't provide a simple way to access the ADC, DMA and I/O pin registers. But there is a way to define these registers using the obscure <code>uctypes</code>. And then you need to be familiar with the RP2040 datasheet. Here someone has written some code based on the iosoft blog. This should be easy to try out, because it's Python code. Here's a resource with good pictures that goes into PIO + DMA.</p> <p>Most instructions are executed from the instruction memory, but there are a few other sources. The most versatile of these is the <code>OUT EXEC</code> instruction. You can use this to embed instructions in the data stream passing through the FIFO.</p> <p>I didn't understand the Wikipedia entry on shift registers. The Sparkfun article says that they're used to add more I/O pins to a microcontrollers. But that's not what's happening in the PIO. Apparently, you load one bit into the shift register at a time (a 1 or a 0). When a new bit enters, all the bits inside the shift register are shifted to make room for it. Then you can use the latch pin to output all the bits at the same time from the shift register. So you're turning a serial port into a parallel port. I guess this is useful for synchronized CNC movements, but how does it work inside the PIO block in the RP2040?</p> <p>The output of the PIO assembler is shown, and it consists of hexadecimal numbers. They look scary and incomprehensible. I noticed that they all have an x in them, so I asked Google why hexadecimal numbers all start with 0x. Turns out it's just to let the parser know that it's a hexadecimal base number instead of other bases.</p> <p>I've seen a lot of definitions and explanations, but what I really need is an example that I can run. I still don't understand how the data flows and how the operations are carried out. To see what's going on inside the chip, I probably need something like PicoReg. It's a debugger for the Raspberry Pi Pico. The advantage is that it's written entirely in Python I can set it up on a Raspberry Pi. I can wrap my head around that.</p> <p>I'd like to try to implement a PIO+DMA stepper controller with acceleration ramping. But I likely won't have time for that this week. V. Hunter Adams at Cornell has implemented it, but to use it you need to set up a toolchain for C. This forum post is also interesting. <code>cleverca22</code>'s comment on this post may also hold clues. Seemingly unrelated, but there may also be some clues in the servo easing algorithm. There are stepper control PIO programs here and here. But they don't implement ramping. And again, you need to use the C/C++ SDK. The RP2040 datasheet says that if you want to get started with PIO, a walkthrough of writing your first PIO program is in the Pico C/C++ SDK. It also covers using PIO with DMA. But I want to use Python. Or at least I want to be able to make a library for Python. Is it possible to do that in C/C++? Yes. But if you build an external C module for MicroPython, you have to build your own MicroPython firmware to put on the RP2040. There's another possibility, which I like better:</p> <p>An alternative approach is to use Native machine code in .mpy files which allows writing custom C code that is placed in a .mpy file, which can be imported dynamically in to a running MicroPython system without the need to recompile the main firmware.</p> <p>I flipped quickly through all the communications protocols but read PWM more carefully. If I will use brushless motors in my robot arm, I need to get to know Pulse Width Modulation. It's interesting how flexible the pin mapping on the RP2040 is, the PWM slices can use any of the GPIO pins, and so can PIO. I actually understood a part of the description of how a PWM slice works. It's a 16-bit counter that the wraps back to zero. Wrap is a command in pioasm that enables you to jump back to the beginning without using a <code>JMP</code> command, and it takes 0 cycles. I'm beginning to understand a little bit, even if I can't use these things yet. I guess I could DMA to push a sine wave from a lookup table to three PWM outputs to control a three-phase brushless motor. Then the main processors would be free to do other tasks. This arbitrary wave generator using PIO and DMA may be worth taking a look at when I have some time.</p> <p>There's a lot going on inside this $1 chip. It's like a whole city, complete with different neighborhoods connected together with highways and smaller roads to move data between places.</p> <p>All roads lead to the C/C++ SDK, it seems. Here are community libraries for the SDK. There are also lots of examples in the Raspberry Pi GitHub repo. I will have to jump in at some point.</p> <p>One question remains: What is the OSR?</p> <p>There is a bit of programmer humor in the datasheet, on page 359 it says that I2C is an ubiquitous serial bus first described in the Dead Sea Scrolls, and later used by Philips Semiconductor. On page 364 it is conjectured that the PIO can run DOOM with a high enough clock speed. On page 365 it says that a full 32-bit addition takes the PIO only around one minute at 125 MHz. What? So using the PIO for mathematical operations takes hundreds of millions of cycles?</p>"},{"location":"assignments/week04.html#dma","title":"DMA","text":"<p>Direct Memory Access is the other interesting feature in the RP2040. It's a memory controller that can copy data from one place to another very fast without the processor's intervention. Throughout the RP2040 datasheet there are mentions that this and that part of the chip has a DMA interface. It looks like it's important to learn to use DMA if you want to make things run fast. Could DMA be used to feed a PIO state machine with acceleration ramps for a stepper? I would like to learn a little bit about how DMA works and how to set it up, but it seems that it's not possible in MicroPython. The Raspberry Pi Pico C/C++ SDK instructions mention that you can use DMA by including a library called hardware_dma. Setting up a C/C++ toolchain sounds intimidating, but maybe I have to do it if I want to try using DMA. I think DMA programming is too complicated to get into for now.</p>"},{"location":"assignments/week04.html#adc","title":"ADC","text":"<p>The Analog to Digital Converter takes 96 clock cycles to make a 12-bit measurement. That's good to know. The RP2040 ADC has a few errors, most notably that the quantization error looks like a sawtooth. Also, because the wrong size of capacitor was used in one part of the ADC, there are big spikes in differential non-linearity. I won't pretend to know what that is, but it means that there will be spikes in the measured values in four places. The scaling factor for the internal temperature sensor is specified here in the datasheet. You can see it an example code in the Chip temperature section below.</p> <p>I looked at the Raspberry Pi Pico Python SDK and found it a bit thin. I also skimmed Getting started with Raspberry Pi Pico, which shows how to set up a C/C++ programming environment for the Pi Pico, and it looks extremely complicated. But that's where the juicy stuff is.</p>"},{"location":"assignments/week04.html#programming-the-xiao-rp2040","title":"Programming the Xiao RP2040","text":"<p>The Xiao RP2040 has a reset button, so it's more convenient to use in that respect than the Raspberry Pi Pico.</p>"},{"location":"assignments/week04.html#hello-rp2040","title":"Hello RP2040","text":"<p>I tried Neil Gershenfeld's Hello RP2040 Python program:</p> <p>I like having an RGB LED to play with. It could serve as a simple interface for the wake-up mask or the robot arm if I assign a different meaning to every color.</p>"},{"location":"assignments/week04.html#chip-temperature","title":"Chip temperature","text":"<p>I did this one with the Raspberry Pi Pico. Setup and programming is identical to the Xiao RP2040. I found a nice tutorial on using the temperature sensor which is built into the RP2040 chip. It's useful to make sure that the chip doesn't overheat, but it's also a good exercise in measuring an analog voltage. Since I've tried blinking the onboard LED already, I'm going to use that knowledge to modify this program to turn on the LED when the temperature crosses a threshold:</p> <pre><code>from machine import ADC, Pin\nimport time\nled = machine.Pin(\"LED\", machine.Pin.OUT)\nadc = machine.ADC(4) \nwhile True:\n    ADC_voltage = adc.read_u16() * (3.3 / (65535))\n    temperature = 27 - (ADC_voltage - 0.706)/0.001721\n    print(\"Temperature: {}\u00b0C\".format(temperature))\n\n    if temperature &gt; 26:\n        led.value(1)\n    else:\n        led.value(0)\n\n    time.sleep_ms(100)\n</code></pre> <p>I added the if statement and removed the temperature in Fahrenheit. You can see that you need to scale the analog measurement to get the temperature in degrees Celsius. I suspect that that every chip will give a slightly different value because of manufacturing variability. So it might be better to measure the temperature with a better sensor and put that value into the scaling factor. But since this sensor isn't meant to be super precise, we'll let it be.</p>"},{"location":"assignments/week04.html#interfacing-with-lcd-screen","title":"Interfacing with LCD screen","text":"<p>I connected a classic 16x2 character LCD screen to the Raspberry Pi Pico, but it didn't work. I needed to use the 4-bit mode (where you connect the LCD directly to the microcontroller) because I didn't have an LCD driver chip. Aby Michael's Fab Academy site had a useful diagram with the LCD pins. The ElectronicWings diagram was even more useful. After some Googling I found that the screen needs 5V signals. The RP2040 is a 3.3V chip, so that's why I'm getting glitchy results. Its strange that it worked with a Pico in the tutorial that I used (click the link in the video description for a connection diagram). I'd like to try the small OLED screen that is in the Fab Lab inventory next. That one is 3-5V tolerant, and much smaller and versatile than the 16x2. And it only needs four pins. Look at that nest of wires above! The OLED will be a great improvement.</p> <p>Here are the files I used, you just open each of them in Thonny and save them to your Pico. The <code>main.py</code> file runs automatically when you power the Pico on. The other two are a library for interfacing with the LCD. Beware, this didn't work for me.</p> <p>Download main.py</p> <p>Download lcd_api.py</p> <p>Download gpio_lcd.py</p>"},{"location":"assignments/week04.html#interfacing-with-oled-screen","title":"Interfacing with OLED screen","text":"<p>I used Kevin McAleer's simple code example for the SSD1306 OLED screen. It just writes Test 1 to the screen. It was exhilarating to see the tiny letters light up on the screen on the first try! I then changed the text to something more useful, a prototype display for the Frankenstein MCU, which Fran and my instructor \u00de\u00f3rarinn are working on. The plan is to make a WiFi connected button in every Fab Lab and the staff push the button every day to show that the lab is active. The connections between labs appear on a spinning globe made in Three.js, which runs in the browser.</p> <p>Download oled.py</p>"},{"location":"assignments/week04.html#stepper-control-with-rp2040","title":"Stepper control with RP2040","text":"<p>This one I also did with the Raspberry Pi Pico.</p> <pre><code>from machine import Pin\nfrom time import sleep\n\nIN1 = Pin(2,Pin.OUT)\nIN2 = Pin(3,Pin.OUT)\nIN3 = Pin(4,Pin.OUT)\nIN4 = Pin(5,Pin.OUT)\n\npins = [IN1, IN2, IN3, IN4]\n\nsequence = [[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]\n\nwhile True:\n    for step in sequence:\n        for i in range(len(pins)):\n            pins[i].value(step[i])\n            sleep(0.01)\n</code></pre> <p>Controlling the stepper is surprisingly simple. It has four phases, so you connect it to four pins on the Pico. Then you just alternate which pin is HIGH while the others are low. The stepper motor has 64 steps per rotation, but it also has a 1/64 gearing ratio, so in total it has 64 * 64 = 4096 steps per rotation. That's pretty good for a 3 dollar stepper! I bought a set of five 28-BYJ-48 steppers with ULN2003 drivers for $15. They're cheap and precise!</p> <p>But there are two drawbacks. They're quite weak. For a motor with 1:64 gearing, it's surprisingly easy to make it skip steps. Also, the gearbox introduces backlash which is much bigger than the step size. The step size is 0.09\u00b0 but the backlash seems to be a few degrees. Maybe it's possible to correct for the slop in software every time the motor changes direction. But that won't work 100% and definitely not with small motions. I wonder if these motors are a good fit for my robot arm.</p> <p>In the video above I changed the sleep value and then ran the program. First it was 0.1 s, then 0.01 s and finally 0.001 s. When I went below 0.01 s, the stepper stalled. It's fun to have status LEDs on all the phases. At slow speeds you can see how the phases are turned on and off. I want to have status LEDS on every output pin on every microcontroller board! It's a really handy debugging tool. I laser cut a press-fit acrylic arrow to see the motor's movement better.</p> <p>Since I have the 12V version of the 28BYJ-48 motors, I can run them on a 9V battery. So here's my first foray into battery-powered electronics. The Pico is still powered by a USB cable, though. I need to learn how to make a 5V regulator board, so that I can also power the Pico using the 9V battery.</p>"},{"location":"assignments/week04.html#pio-stepper-control","title":"PIO stepper control","text":"<p>I followed a tutorial and wrote a program that controls a stepper with PIO, without using the processor at all. I then modified it to include four PIO state machines that run the same program but are clocked at different frequencies:</p> <p>Here's the code:</p> <pre><code>from machine import Pin\nfrom rp2 import PIO, StateMachine, asm_pio\nfrom time import sleep\nimport sys\n\n@asm_pio(set_init=(PIO.OUT_LOW,) * 4)\ndef prog():\n        wrap_target()\n        set(pins, 8) [31] #8\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        set(pins, 4) [31] #4\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        set(pins, 2) [31] #2\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        set(pins, 1) [31] #1\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        wrap()\n\nsm0 = StateMachine(0, prog, freq=100000, set_base=Pin(2))\nsm1 = StateMachine(1, prog, freq=50000, set_base=Pin(6))\nsm2 = StateMachine(2, prog, freq=25000, set_base=Pin(10))\nsm3 = StateMachine(3, prog, freq=12500, set_base=Pin(18))\n\nsm0.active(1)\nsm1.active(1)\nsm2.active(1)\nsm3.active(1)\nsleep(5)\nsm0.active(0)\nsm1.active(0)\nsm2.active(0)\nsm3.active(0)\nsm0.exec(\"set(pins,0)\")\nsm1.exec(\"set(pins,0)\")\nsm2.exec(\"set(pins,0)\")\nsm3.exec(\"set(pins,0)\")\n</code></pre> <p><code>nop()</code> is no operation, and you can optionally add a delay after every command, like this: <code>[1]</code>. That was a delay of one clock cycle. I think 31 cycles is the maximum.</p>"},{"location":"assignments/week04.html#adding-a-reset-button","title":"Adding a Reset button","text":"<p>The Raspberry Pi Pico has no reset button, but it resets if you connect the RUN pin to ground. So I just connected a jumper to the RUN pin on the breadboard and make the other end of the jumper touch the GND pin that is one pin over to reset the Pico. That's more convenient than unplugging the USB cable and plugging it in again.</p>"},{"location":"assignments/week04.html#overclocking-the-rp2040","title":"Overclocking the RP2040","text":"<p>I tried Chris DeHut's RP2040 overclocking video. He has lots of good stuff about the Pico. Here's his program which changes the clock speed a few times and measures the time it takes to do 100.000 sets of the calculations in the Do_Stuff function:</p> <pre><code>'''\nPICO default clock speed is 125 MHz\nDemo to show time to make a bunch of basic math calculations\nat varaious clock speeds that the PICO can handle\n'''\nimport machine\nimport time\nimport machine\n\nled_onboard = machine.Pin(25, machine.Pin.OUT)\n\ndef Do_Stuff():\n    st = time.ticks_ms()\n    Y = 0\n    while Y &lt; 100000:\n        Y += 1\n        Z = 57\n        Z1 = Z + Y\n        Z2 = Z - Y\n        Z3 = Z * (Z + Y)\n        #print(Y, Z1, Z2, Z3)\n    led_onboard.value(0)\n    #print(Y)\n    et = time.ticks_ms()\n    #print(et, st, et-st)\n    return et-st\n\n\ncntr = 0\nwhile cntr &lt; 2:    #run whole test several times for observation\n    cntr += 1\n\n    machine.freq(125000000)  #set clock to 125 MHz\n    x = machine.freq()\n    t = Do_Stuff()\n    print(\"\\n@\", x, \" time to run =\", t, \"ms\")\n\n\n    machine.freq(140000000)   #set clock to 140 MHz\n    x = machine.freq()\n    t = Do_Stuff()\n    print(\"\\n@ \", x, \" time to run =\", t, \"ms\")\n\n\n    machine.freq(200000000)  #set clock to 200 MHz\n    x = machine.freq()\n    t = Do_Stuff()\n    print(\"\\n@ \", x, \" time to run =\", t, \"ms\")\n\n    machine.freq(250000000)  #set clock to 250 MHz\n    x = machine.freq()\n    t = Do_Stuff()\n    print(\"\\n@ \", x, \" time to run =\", t, \"ms\")\n\nmachine.freq(125000000)  #set clock to 125 MHz to clean things up\nprint(\"\\n All Done Folks!\")\n</code></pre> <p>The loop runs a few times so that you can take the average of the time measurements. This is one set of measurements:</p> <pre><code>@ 125000000  time to run = 1167 ms\n\n@  140000000  time to run = 1042 ms\n\n@  200000000  time to run = 729 ms\n\n@  250000000  time to run = 583 ms\n</code></pre> <p>That's a big difference by varying the clock speed, and the RP2040 datasheet says that overclocking is usually safe. I will keep this in mind when my programs are running slowly. Then I tried going a bit higher. It worked at 280 MHz, but at 290 or 300 MHz, I got no response from the microcontroller. So this is the best time:</p> <pre><code>@  280000000  time to run = 521 ms\n</code></pre> <p>I think I will not go above 250 MHz. That's a lot, twice as fast as the standard RP2040 with a 12 MHz crystal, like in the Pico and the Xiao RP2040. There are instructions online on how to go up to 420 MHz and there is at least one commercial board that runs the RP2040 at 400 MHz.</p>"},{"location":"assignments/week04.html#custom-performance-test","title":"Custom performance test","text":"<p>I modified the PIO program to control four steppers at different speeds, by modifying the clock dividers in each of the state machines. The state machines all run the same program. It works, and there should be no load on the main processor. The video looks the same as the four stepper video above.</p> <p>Now let's verify that there is no load on the main processor. I'll take Chris DeHut's 100 thousand calculation routine and put it into the PIO stepper program. Here are the results while driving four steppers at different speeds at the same time:</p> <pre><code>@ 125000000  time to run = 1167 ms\n\n@  140000000  time to run = 1042 ms\n\n@  200000000  time to run = 729 ms\n\n@  250000000  time to run = 584 ms\n</code></pre> <p>Those are the same times as the first case, which had no steppers. Wow! I then increased the number of calculation loops to 300 thousand, so that we can see what happens to the steppers as we increase the main clock frequency from 125 MHz to 140, 200 and finally 250 MHz. As you can see from the video below, the steppers speed up until the fastest stepper stalls when the clock speed goes up to 250 MHz.</p> <p>For comparison with the PIO routine, I also tried to mix the 100k calculation code with code where the processor controls four steppers at the same time, but i couldn't get those two things to happen at the same time. But I could probably run those things on core0 and core1 with good results. Let's try, using this tutorial to learn how threads work in Python:</p> <pre><code>@ 125000000  time to run = 1181 ms\n\n@  140000000  time to run = 1053 ms\n\n@  200000000  time to run = 734 ms\n\n@  250000000  time to run = 587 ms\n</code></pre> <p>It worked! My first dual-core program! The steppers just kept on running on core1 after the calculations finished on core0. And the calculation times are good! They're just a few milliseconds longer the 4 stepper PIO + 100k calculation routine.</p> <p>Here's  the code:</p> <pre><code>import machine\nimport time\nimport machine\nfrom machine import Pin\nfrom rp2 import PIO, StateMachine, asm_pio\nfrom time import sleep\nimport sys\n\nled_onboard = machine.Pin(25, machine.Pin.OUT)\n\n@asm_pio(set_init=(PIO.OUT_LOW,) * 4)\ndef prog():\n        wrap_target()\n        set(pins, 8) [31] #8\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        set(pins, 4) [31] #4\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        set(pins, 2) [31] #2\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        set(pins, 1) [31] #1\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        wrap()\n\nsm0 = StateMachine(0, prog, freq=50000, set_base=Pin(2))\nsm1 = StateMachine(1, prog, freq=25000, set_base=Pin(6))\nsm2 = StateMachine(2, prog, freq=12500, set_base=Pin(10))\nsm3 = StateMachine(3, prog, freq=6250, set_base=Pin(18))\n\nsm0.active(1)\n\nsm1.active(1)\nsm2.active(1)\nsm3.active(1)\n\n#sleep(5)\ndef Do_Stuff():\n    st = time.ticks_ms()\n    Y = 0\n    while Y &lt; 300000:+\u00f0\u00f0\u00f0\u00f0\n        Y += 1\n        Z = 57\n        Z1 = Z + Y\n        Z2 = Z - Y\n        Z3 = Z * (Z + Y)\n        #print(Y, Z1, Z2, Z3)\n    led_onboard.value(0)\n    #print(Y)\n    et = time.ticks_ms()\n    #print(et, st, et-st)\n    return et-st\n\n\ncntr = 0\nwhile cntr &lt; 2:    #run whole test several times for observation\n    cntr += 1\n\n    machine.freq(125000000)  #set clock to 125 MHz\n    x = machine.freq()\n    t = Do_Stuff()\n    print(\"\\n@\", x, \" time to run =\", t, \"ms\")\n\n\n    machine.freq(140000000)   #set clock to 140 MHz\n    x = machine.freq()\n    t = Do_Stuff()\n    print(\"\\n@ \", x, \" time to run =\", t, \"ms\")\n\n\n    machine.freq(200000000)  #set clock to 200 MHz\n    x = machine.freq()\n    t = Do_Stuff()\n    print(\"\\n@ \", x, \" time to run =\", t, \"ms\")\n\n    machine.freq(250000000)  #set clock to 250 MHz\n    x = machine.freq()\n    t = Do_Stuff()\n    print(\"\\n@ \", x, \" time to run =\", t, \"ms\")\n\nmachine.freq(125000000)  #set clock to 125 MHz to clean things up\nprint(\"\\n All Done Folks!\")\n\nsm0.active(0)\nsm1.active(0)\nsm2.active(0)\nsm3.active(0)\nsm0.exec(\"set(pins,0)\")\nsm1.exec(\"set(pins,0)\")\nsm2.exec(\"set(pins,0)\")\nsm3.exec(\"set(pins,0)\")\n</code></pre>"},{"location":"assignments/week04.html#xiao-samd21","title":"Xiao SAMD21","text":"<p>The SAMD21 runs at 48 MHz, which is considerably slower than the RP2040. But it's easy to solder. I'll probably use it because of that. It also has a DAC output.</p> <p>For hobbyists, the SAMD21 can only be programmed in the Arduino IDE and CircuitPython. For professionals, you can use Microchip Studio or set up your own toolchain. So I set up the board in the Arduino IDE the way you would set up any new board: I added the proper link into \"Additional Boards Manager URLs\" in Preferences, and then I could find Seeed SAMD21 Boards in the Boards Manager and install them. It's as easy as that, and then selecting the right board (Seeeduino Xiao). The setup is covered in this tutorial.</p> <p>I tried connecting it to the Arduino IDE but it didn't work.</p>"},{"location":"assignments/week04.html#xiao-esp32-c3","title":"Xiao ESP32 C3","text":"<p>The ESP32 C3 runs at 160 MHz, which is fast, but it's not possible to overclock it. But the most amazing thing is that this tiny microcontroller has WiFi and Bluetooth built in!</p> <p>This is my first RISC-V chip. As Neil says, RISC-V will probably take over the world. It's an open source architecture, so unlike the ARM chips that are found in microcontrollers, billions of smartphones and all the way up to supercomputers, manufacturers don't have to pay huge licensing fees to make RISC-V chips.</p> <p>I tried connecting it to the Arduino IDE but it didn't work.</p>"},{"location":"assignments/week04.html#esp-32-cam","title":"ESP-32 CAM","text":"<p>ESP-32 CAM is a 10 dollar WiFi camera! I had to have one and try it out. It might play well with my robot arm.</p> <p>I followed this tutorial to set up the ESP32-CAM board. To install the ESP32 boards in the Arduino IDE, I followed that tutorial. Then I tested the board with this tutorial. I uncommented the AI-Thinker CAM definition in the setup and input my WiFi credentials in the sketch.   When the Arduino IDE had uploaded the code, the following message was left hanging: <pre><code>Leaving...\nHard resetting via RTS pin...\n</code></pre> But then I checked and saw that above it, the status bar said \"Done uploading\". I also found this explanation, which said that this isn't an error at all.</p> <p>First I saw nothing in the serial monitor. Then I removed an extra #define camera line. Still nothing. Then I switched to the 5G network, the same as my laptop is on. Then I saw a series of dots form .... but no IP address. But when I did in the opposite order from the tutorial (first pressed RESET, then removed the jumper) I got this message: <pre><code>ets Jul 29 2019 12:21:46\n\nrst:0x1 (POWERON_RESET),boot:0x3 (DOWNLOAD_BOOT(UART0/UART1/SDIO_REI_REO_V2))\nwaiting for download\nets Jul 29 2019 12:21:46\n</code></pre> Something's happening! I removed the jumper and pressed reset again: <pre><code>rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)\nconfigsip: 0, SPIWP:0xee\nclk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00\nmode:DIO, clock div:1\nload:0x3fff0030,len:1344\nload:0x40078000,len:13836\nload:0x40080400,len:3608\nentry 0x400805f0\n\n.\nWiFi connected\nCamera Ready! Use 'http://192.168.1.32' to connect\n</code></pre> Success! After scrolling down and pressing \"Start stream\", I could see a live stream from the camera over WiFi to my browser! At QVGA resolution (320x240), the stream is smooth. At UXGA resolution (1600x1200), the stream stutters. SVGA (800x600) is the highest resolution where lag isn't very noticeable. That's pretty good for a microcontroller! I love it. And I find that in low light, greyscale looks a lot better than a color image.</p> Note <p>This time I used <code>ffmpeg -i esp32-cam_test1.mp4 -vf scale=400:-2 -vcodec libx264 -an -crf 20 esp32-cam_test1_web.mp4</code> to compress the video and remove the audio as shown here.</p> <p>This video shows ways to control the image capture just by typing URLs into the browser. If you have a computer nearby at all times, you can also stream video from the ESP32-CAM to any browser in the world. And here's a guide to modifying the HTML code inside the Arduino code. It's not obvious how to do it, since the HTML has been converted to hex code in the Arduino sketch.</p> <p>I checked whether it's possible to overclock the ESP32, but 240 MHz seems to be the maximum clock speed.</p>"},{"location":"assignments/week04.html#fpga","title":"FPGA","text":"<p>I bought an FPGA development board from Seeed Studio. It is the Runber board, which contains a Gowin FPGA. I took the plunge because it is the cheapest FPGA board I've found that still has a set of tutorials. I looked at some of the documentation and it looks intimidating. I applied for a software license on a Friday and got it in the beginning of the next week. I haven't had the time to set it up and go through a tutorial, though.</p>"},{"location":"assignments/week05.html","title":"3D Scanning and Printing","text":""},{"location":"assignments/week05.html#assignment","title":"Assignment","text":""},{"location":"assignments/week05.html#group-assignment","title":"Group assignment","text":"<ul> <li>Test the design rules for your 3D printer(s)</li> </ul>"},{"location":"assignments/week05.html#individual-assignment","title":"Individual assignment","text":"<ul> <li>Design and 3D print an object (small, few cm<sup>3</sup>, limited by printer time)<ul> <li>that could not be made subtractively</li> </ul> </li> <li>3D scan an object (and optionally print it)</li> </ul> <p>See more info and recording of the lecture here.</p>"},{"location":"assignments/week05.html#benchmarks","title":"Benchmarks","text":"<p>I made a few test prints to characterize the Ultimaker 2+ and Ultimaker 3. </p> <p>These are our two workhorses.</p> <p>The classic 3D printing benchmark is the 3D Benchy by Creative Tools in Sweden. It came out well, with only a tiny bit of drooping in the top of the doorway.</p> <p>A nice 3D Benchy.</p> <p>I printed this tolerance test by 3D Maker Noob. The clearance test turned out well, with only the tightest clearance (0.1 mm) getting fused together. I would say that's very good.</p> <p>I've 3D printed professionally for years, but I'm still amazed how precise these computer-controlled hot glue guns can be. A hot glue gun is actually the origin of FDM 3D printing, by the way.</p> <p>And here's a test of many things, including overhangs, small text, stringing and bridging:</p> <p>Pretty good, I think.</p>"},{"location":"assignments/week05.html#3d-scanning","title":"3D scanning","text":"<p>I couldn't think of anything to 3D scan but just at the right time, an artist came into the lab with a small sculpture and asked if we could 3D scan and print it. I gave it my best shot.</p> <p>The sculpture to be scanned.</p> <p>The creature is based on a picture of the old Icelandic mythical beast Fj\u00f6rulalli, which looks mostly like a seal and lives on the beach. It's most commonly found in the West Fjords and Brei\u00f0afj\u00f6r\u00f0ur.</p> <p>It looked like a seal and acted like a seal. The Fj\u00f6rulalli is probably our least mysterious mythical creature. But I really like Angela Muenther's sculpture of it.</p> <p>I followed Christopher Barnatt's excellent tutorial in this project. We started by clearing a table and closing the blinds, because you want nice, even light for photogrammetry. We placed the little guy on some fabric with a pattern, because that helps the algorithm locate the pictures in space afterwards and stitch them together. Then we took pictures on a small point-and-shoot camera all around the sculpture in circles with increasing height. Then I loaded the images into the excellent Meshroom, which is free and open-source. I had tried Meshroom once before, but it didn't work for some reason, so I gave up. This time there was time pressure, so I became more resourceful. I found that the path to the images contained Icelandic characters. Once I had fixed that, the program started running, the computer started humming and in about an hour and a half, I had a 3D point cloud!</p> <p>Raw point cloud in Meshroom.</p> <p>Then I took the mesh into Meshmixer and deleted everything that I didn't want to include.</p> <p></p> <p>The final 3D processing step was in Blender, where I filled in the bottom of the model to make the mesh watertight and then smoothed it in a few places, using my new Blender skills from having gone through the donut tutorial last week.</p> <p>Loop select and fill in Blender.</p> <p>The smoothing tool in the sculpture environment in Blender.</p> <p>Then I 3D printed two sculptures in almost exactly the same gray color as the original sculpture. One had smoothing, the other had none. When Angela came to examine them the next day, she said she wanted something in between, so I started again and did the smoothing with more finesse this time. Then I printed some more of them, in a few different materials. One in transparent PETG and one in glow-in-the-dark PLA.</p> <p>The output of this week.</p> <p>I used this tip to get the printing temperature right for PETG, for the transparent sculpture print.</p> <p>PETG print with Lighning infill in Cura.</p> <p>Angela really liked the glow-in-the-dark version. So do I.</p> <p>Angela, far left, describing her exhibition.</p> <p>The exhibition at Galler\u00ed \u00dathverfa.</p>"},{"location":"assignments/week05.html#design-for-3d-printing","title":"Design for 3D printing","text":"<p>The next task was to design and 3D print something that you can't make subtractively (e.g. using milling). I've been interested in lattice structures for a while, so I took a stab at making one.</p> <p>The 3D sketch in Fusion 360. I sweep the circle along the line to make a cylinder. Then I repeat.</p> <p>I made a rectangular pattern of this lattice and 3D printed it.</p> <p>The red one is hard PLA and the white one is soft TPU.</p> <p>Download lattice test file</p> <p>I really liked the soft lattice, so I wanted to make a bigger version of it.</p> <p>I made a much bigger rectangular pattern in Fusion 360.</p> <p>Then I modeled a ball and used it to cut the pattern. Fortunately my laptop is quite powerful, so it went without a hitch.</p> <p>This is probably the biggest pattern I've made.</p> <p>Then I thought about how to print this thing. It needs support on the bottom side, but will regular supports generated by Cura be good enough? I decided to model the supports myself. To decide on the gap between the model and support structure, I used this reference. I decided to go for a 0.2 mm air gap, so I offset the circle by 0.4 mm.</p> <p>Support bowl for the lattice structure.</p> <p>Removing the supports went really smoothly! After cutting with scissors, I could tear the ball away from the bowl.</p> <p>\u00de\u00f3rarinn immediately suggested that I turn the ball into a lamp.</p> <p>I used this guide from Creality to adjust the Generic TPU profile in Cura for the CR-10 printer. The CR-series printers are OK for tinkerers but not for Fab Labs or other professional users. I would not let anyone use the CR-10 printers unsupervised. You have to level the bed almost every time you print, and often make adjustments after you start printing. Usually I need to start printing two or three times. It's not an enjoyable experience. </p> <p>Contrast that with the Ultimaker 2+ (I have one myself and it's my favorite 3D printer). It just prints, and you rarely have to level it. It's a real workhorse. I've printed for over 2000 hours on my machine and it's still printing like it's new. I don't like the direction Ultimaker is taking, however, with super expensive printers for professional users.</p> <p>I printed the ball using TPU (thermoplastic polyurethane) and it bounces and works great as a ball to play with! I used 1.75 mm TPU on the Creality CR-10, which has a Bowden extruder. What that means is that it pushes on the filament and it acts like a long, soft spring. So to get good results I had to print really slowly. The print took five days to complete.</p> <p>The lattice ball has become one of the favorite objects to play with in the lab. You can even bounce it off the floor without breaking it. Here are my students in the Fab Lab course at the local high school:</p>"},{"location":"assignments/week05.html#design-file","title":"Design file","text":"<p>Unfortunately the Fusion 360 file is 65 MB, so I can't include it here. But I've put the STL file on Sketchfab.</p> <p>  Lattice ball  by  svavarkonn  on Sketchfab</p>"},{"location":"assignments/week06.html","title":"Electronics Design","text":""},{"location":"assignments/week06.html#assignment","title":"Assignment","text":""},{"location":"assignments/week06.html#group-project","title":"Group project","text":"<ul> <li>Use the test equipment in your lab to observe the operation of a microcontroller circuit board</li> </ul>"},{"location":"assignments/week06.html#individual-project","title":"Individual project","text":"<ul> <li>Use an EDA tool to design a development board to interact and communicate with an embedded microcontroller</li> <li>Extra credit: try another design workflow</li> <li>Extra credit: design a case for it</li> <li>Extra credit: simulate its operation</li> </ul> <p>See more info and recording of the lecture here.</p>"},{"location":"assignments/week06.html#designing-a-simple-board-in-kicad","title":"Designing a simple board in KiCAD","text":"<p>Here's a video where I describe what I did in Electronics Design week to Neil Gershenfeld during random review.</p> <p>A few months ago I went through a short KiCAD tutorial, to get to know the program a little bit. But I got a lot more out of designing a little PCB with an LED and a button and making it on the vinyl cutter this week. Designing something without making it doesn't get me excited to do more stuff. After making the little circuit, I really want to make more. Let's get into it.</p>"},{"location":"assignments/week06.html#the-fab-library","title":"The fab library","text":"<p>I cloned the Fab Lab parts library for KiCAD from the Gitlab repository. It's maintained by Krisjanis Rijnieks in Finland. To use the library, I needed to upgrade to KiCAD 7.</p> <p></p> <p>I started by going into Preferences and Manage Symbol Libraries. There I clicked the + symbol to import a new library and navigated to the location of the fab library, which is called fab.kicad_sym. Then I went into Preferences and Manage Footprint Libraries and did the same, but that file is called fab.pretty.</p> <p>KiCAD has many parts in its libraries, but the fab library has been the most useful by far.</p>"},{"location":"assignments/week06.html#the-schematic","title":"The schematic","text":"<p>Having imported all the components in the Fab Lab Inventory, I could get started with my design. I created a new design in a new folder. In the Schematic editor I pressed A on the keyboard to add components, and added a 1206 diode, a 1206 resistor to go with it, the Xiao RP2040 module and a pushbutton. I also added a power symbol and a ground symbol. Then I used the wire tool on the right side of the interface to connect the components together in a way that made sense to me.</p> <p>My first schematic.</p>"},{"location":"assignments/week06.html#routing-the-pcb","title":"Routing the PCB","text":"<p>Next, I opened the PCB Editor. I placed the components there all at once. They were connected by thin lines called a rat's nest, but the routing of the physical traces requires a second step. I moved the parts into a pleasing arrangement and then connected them together with the wire tool in the toolbar on the right.</p> <p>After selecting Update PCB from Schematic, I got the parts all in a bundle.</p> <p>Then I realized that I probably had the wrong button, so I swapped it out. Then I arranged the parts in a pleasing way routed traces between them by pressing X on the keyboard.</p> <p>Arranged and routed.</p>"},{"location":"assignments/week06.html#3d-viewer","title":"3D Viewer","text":"<p>Then I tried the 3D Viewer (View -&gt; 3D Viewer) and got a warning that I needed to define a board outline.</p> <p>Board outline missing.</p> <p>So I added a board outline to Edge Cuts. A day or two earlier, my elder son Ernir said that he wanted to make an electric thing in the shape of a circle, and close it off on all sides except one, so that we could connect it to another circle. So I made the outline a circle. </p> <p>Circular board outline.</p> <p>I moved the components around some more until I was happy. Then I pressed Alt+3 on the keyboard to get a 3D preview. That was underwhelming, since none of the components I used have a 3D model associated with them. I wanted at least to have the Xiao module, so that I could design an enclosure around its USB connector (if I had the time). I found the model on the SeeedStudio web site. It includes a Fusion 360 design file, but I only need the STEP file. I put the STEP file into the fab.3dshapes folder in the fab library and used this tutorial to connect it to the KiCAD footprint. Now we're talking!</p> <p>I can see the 3D model being useful when designing enclosures.</p>"},{"location":"assignments/week06.html#a-few-fixes","title":"A few fixes","text":"<p>I exported the design as an SVG and opened it in Inkscape. It wasn't until I saw it there that I realized that the traces were too thin to cut on the vinyl cutter.</p> <p>I needed to go back into the PCB Editor and use a quick and dirty way to change the track width. I selected one part of each trace, then pressed U to select the whole trace and then pressed E to open the trace properties. There I could change the trace width from 0.25 mm to 1 mm. </p> <p>That's better.</p> <p>Next time I'll set the track width from the start in the proper way using Netclasses in File -&gt; Board Setup. That's much more convenient, since every new trace will have the width that I've defined.</p> <p>This is how you set the trace width properly for the whole board.</p> <p>Now I have a completed design in the PCB editor, ready to export to Inkscape:</p> <p>Xiao RP2040 LED board with a button.</p>"},{"location":"assignments/week06.html#design-files","title":"Design files","text":"<p>Here are the KiCAD files for this project, including the PDF file that is ready for cutting:</p> <p>Download KiCAD project</p>"},{"location":"assignments/week06.html#selecting-a-resistor-for-the-led","title":"Selecting a resistor for the  LED","text":"<p>Now I needed to find the right resistor to use with the blue LED. I found a very useful tutorial from Digikey, which is where I got my parts from.</p> <p>Diodes are a one-way valve for electrons. Electrons can go one way, but not the other. When diodes let current through, they have almost no resistance, and that's great. Then someone discovered that diodes can emit light. Now LEDs are everywhere and they have one caveat: You can't just connect one to a power source and have it work. Because it's such a good conductor, it will let more current through that it can handle. It will burn up, or even blow up! So we need a helper component. Every LED needs a current limiting resistor in order to survive. So, how do we select the right resistor for our blue LED?</p> <p>Let's use Ohm's Law:</p> <p> Ohm's Law pyramid. Coincidentally, VIR means 'wire' in Icelandic.</p> <p>It's fun to be able to make graphics like these in Inkscape and render them easily on a web page. Ok, I need to know the</p> <ul> <li>Source voltage: 3.3 V</li> <li>LED forward voltage: 3.2 V (max 3.5 V)</li> <li>LED's recommended operating current: 30 mA</li> </ul> <p>But there's a catch: After reading the datasheet, I know that RP2040 can only supply 16 mA from each GPIO pin. So that's the number I'll use.</p> <p>The voltage drop across the resistor needs to be</p> \\[V_{source}-V_{forward}\\] \\[3.3 V - 3.2 V = 0.1 V\\] <p>Now let's use the pyramid to get an expression for the resistor:</p> \\[R = \\frac{V}{I} = \\frac{0.1V}{0.016A} = 6.25 \u03a9\\] <p>I have the resistance! But there's one more step: I need to make sure that the resistor can take the heat. I'll use the power formula to see the power dissipated by the resistor:</p> \\[P   =   I\u22c5V\\] \\[ =   0.016 A \u22c5 0.1 V \\] \\[    =   0.0016 W \\] \\[    =   1.6 mW \\] <p>That's insignificant.</p> <p>At the Fab Lab I have 4.99\u03a9 and 10\u03a9 resistors. Let's check the current through the LED:</p> <p>4.99\u03a9:  </p> \\[I   =   \\frac{V}{R} =   \\frac{0.1V}{4.99\u03a9}  =   0.02A \\] <p>10\u03a9:    </p> \\[I   =   \\frac{V}{R} =   \\frac{0.1V}{10\u03a9}    =   0.01A\\] <p>OK, I'll use the 10\u03a9 resistor.</p>"},{"location":"assignments/week06.html#using-an-oscilloscope","title":"Using an oscilloscope","text":"<p>I programmed a Raspberry Pi Pico to output stepper motor control signals. This is the same MicroPython code as I used in Embedded Programming week. It's a very simple way of creating signals for a 28BYJ-48 stepper motor.</p> <pre><code>from machine import Pin\nfrom time import sleep\n\nIN1 = Pin(2,Pin.OUT)\nIN2 = Pin(3,Pin.OUT)\nIN3 = Pin(4,Pin.OUT)\nIN4 = Pin(5,Pin.OUT)\n\npins = [IN1, IN2, IN3, IN4]\n\nsequence = [[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]\n\nwhile True:\n    for step in sequence:\n        for i in range(len(pins)):\n            pins[i].value(step[i])\n            sleep(1)\n</code></pre> <p>I set the probe to 10X sensitivity:</p> <p></p> <p>And here's what I got on the oscilloscope:</p> <p>A clear step signal, at just over 60Hz. Time is on the X-axis and voltage is on the Y-axis. Then when the oscilloscope starts receiving a signal I press Auto adjust, and the scope detects how the signal looks and adjusts the time scale so the signal is steady on the screen.</p> <p>I used the portable digital oscilloscope to troubleshoot my Output Devices board:</p> <p>I found erratic signals coming from one of the H-bridges, which caused my brushless motor to move erratically. More info is here.</p>"},{"location":"assignments/week06.html#using-a-multimeter","title":"Using a multimeter","text":"<p>In Computer-Controlled Cutting week, I measured a resistor with a multimeter:</p> <p>Here the circuit needs to be powered off. The resistor says 1002, and it indeed measures as 10kOhm.</p> <p>In Output Devices week, I measured the voltage that an OLED gets from the power supply:</p> <p>Here the circuit needs to be powered on. The OLED gets roughly 5V, as it shuould be. The OLED can operate on 3.3V-5V voltage.</p> <p>I also measured the current that the OLED draws:</p> <p>Here I need to break the circuit and put the current meter into the circuit, so that the current flows through it. Inside the current meter is a resistor with a very small, known resistance. The voltage drop over the resistor is measured and from that, the device calculates the current. On the right a bigger part of the screen is turned on, and it shows in the current measurement.</p>"},{"location":"assignments/week07.html","title":"Computer-Controlled Machining","text":""},{"location":"assignments/week07.html#assignment","title":"Assignment","text":""},{"location":"assignments/week07.html#group-assignment","title":"Group assignment","text":"<ul> <li>Do your lab's safety training</li> <li>Test runout, alignment, fixturing, speeds, feeds, materials, and toolpaths for your machine</li> </ul>"},{"location":"assignments/week07.html#individual-assignment","title":"Individual assignment","text":"<ul> <li>Make (design+mill+assemble) something big (~meter-scale)</li> <li>Extra credit: don't use fasteners or glue</li> <li>Extra credit: include curved surfaces</li> </ul> <p>See more info and recording of the lecture here.</p>"},{"location":"assignments/week07.html#design","title":"Design","text":"<p>I designed an extended table with a shelf for our coffee corner. I wondered how I could make the shelf supports look good:</p> Version 1Version 2Version 3 <p></p> <p></p> <p></p> <p>I ended up picking version 3.</p> <p>Here's an example of how convenient parametric design can be:</p> <p></p> <p>And here's the whole design process. First I create the parts and adjust their sizes, then I model the press-fit dogbone joints and finally I move the parts into one plane and nest them manually to fit onto the plywood plate that I have. I need to create the plywood plate as a part in the model, so that I can use it as the stock when setting up the machining toolpaths.</p> <p></p>"},{"location":"assignments/week07.html#computer-aided-machining","title":"Computer-Aided Machining","text":"<p>I start by creating a Setup. Under the Stock tab, I select the body that represents my plywood sheet:</p> <p>It's good practice to name the bodies in the model. It makes things easier.</p> <p>Then in the Setup tab, I set up the work coordinate system. I set the zero point to be the bottom left corner of the sheet corner, looking at it from above (see the image above). The top surface is the Z reference.</p> <p>Close-up of how I define the work origin for the Shopbot.</p> <p>Now I start creating machining operations. I had to create the chamfering tool in Fusion, it's not complicated.</p> Cutter tabCutting data tab <p>You can select the type of milling bit from a drop down list and then specify its dimensions according to the bit that you have.</p> <p>In the Cutting data tab you also input the feeds and  speeds for this bit. \u00de\u00f3rarinn recommended that for plywood I would choose a spindle speed of 14.000 rpm and a feed rate of 1000 mm/min.</p> <p>Then I chose a 2D contour milling operation and selected only the edges that I wanted chamfered. For some reason it worked better to split the operations up and select only one edge in each one. Under the Passes tab, uncheck the Stock to leave option. The first pass is the finishing pass.</p> Geometry tabHeights tab <p></p> <p>Remember to select Stock bottom as the bottom plane.</p> <p>Next, I mill the dogbone press-fit holes. I select a 6 mm flat end mill with the same feeds and speeds as the chamfering tool. I created one 2D pocket operation for each dogbone pocket.</p> <p>The simulation looks good. I had to enlarge the circles in the dogbone to make sure that the milling bit can enter them.</p> <p>The last operation is to mill all the outline, using the same 6 mm flat endmill, again rotating at 14.000 rpm and moving at 1000 mm/min through the material:</p> <p>The outline milling operation. It's a 2D contour operation, like the chamfering. I had the machine leave rectangular shaped tabs, to keep the parts from moving around while finishing the milling operation.</p>"},{"location":"assignments/week07.html#the-shopbot","title":"The ShopBot","text":""},{"location":"assignments/week07.html#specifications","title":"Specifications","text":"<p>The ShopBot in Fab Lab \u00cdsafj\u00f6r\u00f0ur. The leftover wood under the machine is free to use for everyone.</p> <p>We have a ShopBot PRSalpha 120-60 CNC. This is a big and capable 3-axis machine with a 3.28 m by 1.55 m work area and a 5 horsepower beast of a spindle. It has a cutting force of about 68 kg and it can move at up to 18 m/min across the table with the full cutting force.</p> <p>The ShopBot has strong geared stepper motors with low backlash which move the gantry using a rack-and-pinion motion system. \u00de\u00f3rarinn mentioned the other day that he isn't sure that the mechanical end stops will hold if the machine decides to move all the way to the end at full speed. The stepper motors have position sensors, so we have a closed-loop control system. The machine can correct the position of the motors in real time if they're a little bit off. The step resolution is 0.01 mm. If that's true in practice, then that's really nice.</p> <p>The ShopBot has a convenient conductive metal plate that you can place on top of your sheet material and zero the Z-axis automatically.</p> <p>The ShopBot is mostly used to make wood furniture and occasional molds for composite manufacturing, but also for milling engineering plastics and I used it successfully to mill a small and precise mold in Molding and Casting week. \u00de\u00f3rarinn is also working on milling an experimental aluminum injection mold with a local engineer who does interesting projects in the lab. I'm interesting in learning to mill aluminum with the ShopBot. You have to be really careful with your feeds and speeds. I've milled two small branding irons out of brass using a V-bit, that was fun.</p>"},{"location":"assignments/week07.html#turning-the-machine-on","title":"Turning the machine on","text":"<p>To be able to turn on the spindle, you need to reset the machine controller.</p> <p>Before you do anything in the Shopbot control software, you need to open Tools -&gt; Spindle control. Otherwise the software can't change the spindle speed as the GCode requires. Then you go into Cuts -&gt; Spindle Warmup Routine, to spin the spindle at two speeds for 10 or 15 minutes, to warm up the bearings in the spindle.</p> <p>You go into Cuts -&gt; Zero Z-axis w/ Zzero plate to zero the Z-axis with a conductive metal plate.</p> <p>Then you press K to get the KeyPad window and use the arrow keys on the keyboard to move the spindle to a convenient point before you go into Zero -&gt; Zero [2] axes (X &amp; Y) in the software.</p> <p>Turning on the shop vac just before starting the job.</p>"},{"location":"assignments/week07.html#recalibrating-the-shopbot","title":"Recalibrating the ShopBot","text":"<p>When I made a fit test with two slightly different clearances, I discovered that both of them were way off the mark. I asked my instructor \u00de\u00f3rarinn what might cause this and he suggested that the gearboxes on the stepper motors might be wearing out. This may result in the steps per inch value changing.</p> <p>So I modeled a 100 mm by 100 mm square with a circular pocket in the middle. My instructor \u00de\u00f3rarinn suggested that I also chamfer the corners, so that I could make diagonal measurements.</p> <p></p> <p>The resulting square had 100.5 mm sides. That means that I need to use this scaling factor on the steps per inch value. I can change that value in the Unit Values window in the Shopbot control software.</p> \\[ \\frac{100}{100.5} = 0.9950249 \\] <p>Corrected value: </p> \\[ 0.9950 * 97.7487 = \\underline{97.262389} \\; \\textnormal{steps/inch} \\] <p>steps/inch.</p> <p>Let's change the unit values for the X and Y axes in the ShopBot control software:</p> <p>The X and Y unit values were 97.7487 and then I changed them to 97.2624.</p> <p>Now our ShopBot is more accurate.</p>"},{"location":"assignments/week07.html#test-pieces","title":"Test pieces","text":"<p>I designed a test fit piece with different clearances in Fusion 360.</p> <p></p> <p>These fit tests gave me the confidence to finish the design of the coffee corner and mill all the parts in one go.</p> <p>Hexagon fit test pieces.</p> <p>I also did a chamfering test, here's the CAM simulation:</p> <p></p> <p>I'm glad I also did this test, because I had selected a chamfering tool that was too small.</p> <p>Both are 90\u00b0 bits, but one is bigger than the other. And that makes a difference when you carve this deep.</p>"},{"location":"assignments/week07.html#milling-the-parts-for-the-coffee-corner","title":"Milling the parts for the coffee corner","text":"<p>It was exciting to do sophisticated milling like this with confidence. I fixed the plywood sheet with screws in the corners and on the middle of the long sides. I took care to tie my hair into a bun and wear hearing protection and safety glasses. First I milled just the chamfers into the plywood sheet. Then I changed from the chamfer tool to the 6 mm flat end mill and milled the dogbone pockets. After that operation it still didn't look like anything recognizable. Finally I milled the outlines and then I recognized the parts.</p> <p>Top view after milling.</p> <p>Dislodging the sawdust with a screwdriver.</p> <p>Vaccuuming the sawdust.</p> <p>Breaking the tab.</p> <p>Breaking the tabs with a chisel.</p> <p>Sanding the edges.</p> <p>I chamfered a few corners before hammering the parts together, to make sure that they sit flush against each other.</p> <p>My instructor \u00de\u00f3rarinn suggested that I take a little off the corners to compensate for the inner corner radius in the piece that gets hammered into these holes.</p> <p>Hammering the parts together. They fit tightly together and don't require any glue.</p> <p>Our new documentation station. I really get in the zone when I sit here and write documentation. I think it's because I feel like I'm in a caf\u00e9, and that's where I get the best concentration. Look how serious I am!</p> <p>The next time I mill something out of wood using Fusion 360, I may need to use a different tab shape. Look at the burn marks after the machine stopped to mill this tab:</p> <p>There are burn marks where all the tabs were.</p> <p>While I was hard at work finishing up the documentation, my instructor \u00de\u00f3rarinn painted the table black and attached it and the shelf to the wall.</p> <p>Bas Withagen in Fab Lab Reykjav\u00edk used to say that if you have time to paint your final project, you're doing it wrong. Fortunately, I have my trusty instructor \u00de\u00f3rarinn, who painted the table black. He's there with his dog S\u00f3la, who was old and had become blind from diabetes. She laid at my desk as I worked on the Fab Academy documentation. S\u00f3la only lived for a week after I took this picture. Such a sweet dog.</p> <p>Our lovely coffee corner with a freshly painted table and \u00de\u00f3rarinn's espresso machine. \u00de\u00f3rarinn commented that now there was really no spot in the lab that wasn't cozy and enticing to sit down and work on a laptop.</p>"},{"location":"assignments/week07.html#all-the-design-files","title":"All the design files","text":"<p>Download Coffee Corner Fusion 360 model</p> <p>Download 12 mm fit test Fusion 360 model</p> <p>Download 12 mm fit test - more clearance Fusion 360 model</p> <p>Download 12 mm hexagon test Fusion 360 model</p> <p>Download 15 mm fit test Fusion 360 model</p> <p>Download 15 mm chamfer test Fusion 360 model</p> <p>Download rectangle circle test VCarve file</p> <p>Download rectangle circle test - quarter inch bit VCarve file</p> <p>Download rectangle circle test - 22mm MDF VCarve file</p>"},{"location":"assignments/week08.html","title":"Electronics Production","text":""},{"location":"assignments/week08.html#assignment","title":"Assignment","text":""},{"location":"assignments/week08.html#group-assignment","title":"Group assignment","text":"<ul> <li>Characterize the design rules for your in-house PCB production process</li> <li>Send a PCB out to a board house</li> </ul>"},{"location":"assignments/week08.html#individual-assignment","title":"Individual assignment","text":"<ul> <li>Make and test the development board that you designed to interact and communicate with an embedded microcontroller</li> <li>Extra credit: make it with another process</li> </ul> <p>See more info and recording of the lecture here.</p>"},{"location":"assignments/week08.html#vinyl-cutting-electronics","title":"Vinyl cutting electronics","text":""},{"location":"assignments/week08.html#making-a-vinyl-cutting-file-in-inkscape","title":"Making a vinyl cutting file in Inkscape","text":"<p>I had to go into Inkscape and do a bit of editing of the SVG that I exported out of KiCAD in Electronics Design week. The traces were only single lines, so I couldn't just set the line width to 0.02 mm and start cutting. I used a little trick; I converted the stroke to a path.</p> <p>These lines won't work.</p> <p>Stroke to Path.</p> <p>Now I have lots of lines. Too many, even. But I can work with these.</p> <p>Now I had a lot of intersecting shapes, which I was able to combine using Path -&gt; Union. After that, it was only a bit of cleaning up, since there was an extra rectangle left over on each pad. </p> <p>Path -&gt; Union.</p> <p>Removing duplicate lines.</p> <p>I made the lines red, set the line width to 0.02 mm and exported to PDF (File -&gt; Save As and then select PDF as the output).</p>"},{"location":"assignments/week08.html#cutting-the-circuit","title":"Cutting the circuit","text":"<p>Cutting the circuit didn't go perfectly. Some of the pads came loose when the cutter was cutting holes in them. Checking the design in Inkscape, I found that there was an extra circle on top of every hole. So each hole was cut twice. I also realized that I didn't need to solder pins onto the Xiao module, I could surface-mount it! So I deleted all the holes and cut again. This time the circuit came out perfect. I love making circuits on the vinyl cutter! It's so quick and easy.</p> <p></p> <p>I found a MicroPython blink program to run on the RP2040. All I had to do was to look at the pinout on the Xiao module to see which GPIO pin I had connected to the LED. That's pin 26. I substituted that into the program and pressed play. It works!</p> <p>Here's the blink program in MicroPython:</p> <pre><code>from machine import Pin, Timer\nled = machine.Pin(26, machine.Pin.OUT)\ntimer = Timer()\n\ndef blink(timer):\n    led.toggle()\n\ntimer.init(freq=2.5, mode=Timer.PERIODIC, callback=blink)\n</code></pre> <p>I also tried programming it in C++ in the Arduino IDE. Here is my board with the button working:</p> <p>And the Arduino code:</p> <pre><code>#define BUTTON_PIN 29\n#define LED_PIN 26\nbool status = 0;\n\nvoid setup()\n{\n  Serial.begin(9600);\n  pinMode(BUTTON_PIN, INPUT_PULLUP);\n  pinMode(LED_PIN, OUTPUT);\n}\n\nvoid loop()\n{\n  status = digitalRead(BUTTON_PIN);\n  Serial.println(status);\n  if (status == 1) {\n    digitalWrite(LED_PIN, LOW);\n  } else {\n    digitalWrite(LED_PIN, HIGH);\n  }\n  delay(100);\n}\n</code></pre>"},{"location":"assignments/week08.html#design-files","title":"Design files","text":"<p>Here is the KiCAD project:</p> <p>Download KiCAD project</p>"},{"location":"assignments/week08.html#pcb-milling","title":"PCB milling","text":"<p>I decided to make an LED debugging board. I've wanted something like this for a while. Sometimes you just want to see if something is happening on the output pin that you've defined. Or you're not sure which pin is which. I think an LED board can help when you're figuring out if the problem is in the circuit or in the code. So I designed a board with 30 LEDs, which covers the whole length of my breadboard:</p> <p>Here I'm placing a simple pattern of LEDs, each with a current limiting resistor.</p> <p>Most of the work took place in the PCB layout environment. I needed to rotate every LED individually and align it and its resistor with the others.</p> <p>I had to do a fair bit of rotating and arranging to get all the resistors and LEDs in line.</p> <p>Then I selected File -&gt; Export SVG and opened the SVG file in Inkscape. Unlike the vinyl cutting file, which needs to be a perfect SVG, what I'm using now is a PNG. So I only need to set the colors of the board and traces right, and that's it! Export to PNG with 1000 dots per inch resolution.</p> <p> The production files are simple PNG images. You can save these and load them into Fab Modules to make your own LED test board. The left one (traces) is milled with a 1/64\" bit and the right one (interior) is milled with a 1/32\" bit to cut the outline of the board.</p> <p>To mill the traces I took the milling bit out of the collet and put the 1/64 inch bit in. Initially the bit should only be poking a little bit out of the collet.</p> <p>When over the PCB and the Z-axis is in zero position, I loosened the milling bit, taking care to keep it from dropping and breaking.</p> <p>Then I lower the bit onto the PCB, thereby zeroing it. I push it gently down with one finger while I tighten the set screw, otherwise the screw can lift the bit slightly as I fasten it.</p> <p>The traces PNG is loaded in Fab Modules, RML code for Roland Modela mills is selected and PCB traces is selected. We have Fab Modules running locally on an ancient Linux machine and I don't know how to take screenshots on it. Sorry.</p> <p>Then I select the MDX-20 milling machine, click Calculate to generate the toolpath and click Send to send the RML code to the machine.</p> <p>Starting to mill the traces on the Roland MDX-20 machine.</p> <p>Vacuuming the dust away after milling.</p> <p>Fab Modules selections for milling the PCB traces.</p> <p>Generating the toolpath to mill the PCB outline. The interior PNG was loaded this time and PCB outline selected instead of PCB traces. Did you know you can rotate the view in 3D in Fab Modules? It's great!</p> <p>Milling the board outline with a 1/32 inch bit. I changed the bit with the same procedure as before.</p> <p>After another round of vacuuming, the board is ready for soldering!</p> <p>Soldering, then stopping to test the resistor sizing. First I tried a 1kOhm resistor, which made the LED too dim. Then I tried a 10Ohm resistor, which was just right. Then I soldered the rest of the resistors and LEDs onto the board. I enjoyed the process, but if I were to make many of these boards, I would start thinking about a Pick-and-Place machine. The LumenPNP seems nice.</p>"},{"location":"assignments/week08.html#led-debugging","title":"LED debugging","text":"<p>I used the LED to troubleshoot my final project. First I made a simple program that blinks all the pins. It helped me to determine which pin on the IC relates to which pin number in the Arduino IDE, using the Arduino Nano 33 IoT board definition (because that's the only Arduino core that worked with my libraries). </p> <p>Blink all the pins! I noticed gaps, where a few pins weren't broken out on the board. I could identify them by slowing the blinking down and having the SAMD21 report the pin number to the serial monitor.</p> <p>Then, when the brushless motor was moving erratically, I added the LED board to the breadboard again to the breadboard to see if I was getting PWM signals on all three motor phases:</p> <p>I got a steady ENABLE signal and two PWM signals. There should also be a PWM signal on the brown wire. I had accidentally used a pin that wasn't broken out on the board for the third PWM signal. I quickly changed the pin in the code and the motor spun smoothly. See more in Final Project: Electronics Design.</p>"},{"location":"assignments/week08.html#design-files_1","title":"Design files","text":"<p>Download LED test board KiCAD project</p>"},{"location":"assignments/week08.html#pcb-milling-test","title":"PCB milling test","text":""},{"location":"assignments/week08.html#164th-inch-bit","title":"1/64th inch bit","text":"<p>I made Neil Gershenfeld's PCB milling test using the 1/64th inch flat end mill. I used a local instance of the old Fab Modules running on a Debian Linux laptop. I used the standard speed of 4 mm/s and a cut depth of 0.1 mm. Under \"number of offsets\" I put -1, which means that I want to clear the board completely of copper around the traces.</p> <p>The toolpaths in Fab Modules. I wonder how Neil programmed this from scratch.</p> <p>I think these traces came out rather well The depth of cut seems to be good since the copper is completely removed. The edges are relatively smooth, so the milling bit must be in good condition. The very finest traces came loose from the board. That's good to know. It seems to be best not to make traces thinner than 0.3 mm.</p>"},{"location":"assignments/week08.html#001-inch-bit","title":"0.01 inch bit","text":"<p>Then I tried the super thin 0.01 inch flat end mill, and I must admit that I forgot to change the milling speed. So the first attempt was at a fast pace of 4 mm/s. The end mill broke immediately. Then I tried again at a slow speed of 0.5 mm/s and the same cut depth 0.1 mm. It also broke quite quickly. This was frustrating.</p> <p>There are more offsets, since the milling bit is thinner.</p> <p>I broke two 0.01 inch milling bits trying to mill this test file.</p>"},{"location":"assignments/week08.html#eventual-success-with-fine-traces","title":"Eventual success with fine traces","text":"<p>I waited until the final project to try the 0.01 inch end mill again, then at the very slow speed of 0.1 mm/s. It worked for an hour and then broke in the middle of the night. I documented my frustration in my final project video and in my final project presentation, Neil Gershenfeld mentioned that everything has to be perfect for this milling bit to work. You have to plane the wasteboard, clean the machine, everything has to be just right. And I think I also made the mistake of having it mill all the traces, instead of just around the ICs with the smallest pads.</p> <p>In the end I was able to mill the finest traces on my final project board with a V-bit. Then I cleared the whole board with a 1/64th inch flat end mill and milled the holes and outline with a 1/32 inch flat end mill.</p> <p>Here is the assembled robot joint running a PID control loop:</p> <p>Look at that! It works!</p>"},{"location":"assignments/week08.html#design-files_2","title":"Design files","text":"<p>Download baks KiCAD project</p>"},{"location":"assignments/week09.html","title":"Output Devices","text":""},{"location":"assignments/week09.html#assignment","title":"Assignment","text":""},{"location":"assignments/week09.html#individual-assignment","title":"Individual assignment","text":"<ul> <li>Add an output device to a microcontroller board you've designed,</li> <li>and program it to do something</li> </ul>"},{"location":"assignments/week09.html#group-assignment","title":"Group assignment","text":"<ul> <li>Measure the power consumption of an output device</li> </ul> <p>See more info and recording of the lecture here.</p>"},{"location":"assignments/week09.html#neils-board","title":"Neil's board","text":"<p>I first made Neil Gershenfeld's Hello H-Bridge D11C board without modifications. I simply downloaded the traces and interior PNG files and used them to generate G-code to mill the board. After milling, I removed the extra copper around the USB connector, to avoid a short-circuit.</p> <p>Neil's board in Fab Modules.</p> <p>I like soldering. Maybe you can tell.</p> <p>I like the fact that the SAMD11 is a capable ARM microcontroller that still comes in a package that is easy to solder. After soldering, I plugged the USB connector on the board into my computer and hooked the SWD pins up to the Atmel-ICE programmer. I followed this tutorial from Fab Lab Kannai to try to upload a bootloader to the chip. </p> <p>Trying to program the ATSAMD11C with the official ATMEL-ICE programmer.</p> <p>The microcontroller was not detected. </p> <p>The Microchip Studio software couldn't find a connected device. I tried again, and got a low voltage warning. It said that the operating voltage was 1.5 volts but needed to be 1.6 to 3.8 volts. Well, that's an improvement! Now I have a useful error message that I may be able to do something about. Later.</p> <p>At least the computer is detecting something.</p>"},{"location":"assignments/week09.html#2024-update","title":"2024 update","text":"<p>I used Yuichi's guide to using the Xiao SAMD21 as a programmer. Yuichi's documentation is usually really good, and this guide is no exception.</p> <p></p> <p>I set the Xiao SAMD21 to bootloader mode and dragged the CMSIS-DAP firmware into the folder that opened. That was enough to make the Xiao a programmer. Then I connected the pins as shown in the guide and used the Generic D11C14A board definition in the Fab SAM core for Arduino. Remember to select TWO_UART... Tools-&gt;Serial Config and choose CMSIS-DAP as the programmer. Then burn the bootloader.</p> <p>Then you can disconnect the Xiao and the SAMD11 board. When you reconnect the SAMD11 board it gets recognized and you can now program it over USB! So convenient with such a small and cheap chip!</p> <p>Only a year later, it works!</p> <p>I couldn't get the SAMD11-based programmer to work until I tried connecting the target board to a USB power brick instead of the computer. If the target board has already been programmed, then it shows up as a COM port and that can confuse the computer.</p> <p>The SAMD11 programmer from Fab Fest Bali is now working.</p> <p>I also bought thirty Raspberry Pi Pico W boards for my students to use. I tried using one of them as a programmer and it also works, when I connect the target board to a USB power brick. Now I have no shortage of programmers for the SAMD chips.</p> <p>Raspberry Pi Pico W being used as a programmer.</p> <p>Here is a summary of the Fab Academy programmers.</p>"},{"location":"assignments/week09.html#stepper-control-board","title":"Stepper control board","text":""},{"location":"assignments/week09.html#fusion-360-pcb-export-woes","title":"Fusion 360 PCB export woes","text":"<p>For my own design, I decided to go an easier route. I used the Xiao RP2040 module, which I know how to program. After the incredible fireworks show in the Monday recitation, where the Fab Lab machine builders showed their projects, I looked into the Urumbu boards and Modular Things. Urumbu is based on work at a Fab event in Kerala, where it was discovered that you can connect several stepper control boards directly to a computer and send them synced commands via USB and have them act as a single machine. Modular Things grew out of that project, and they include a convenient web editor to program the boards with a few lines of JavaScript. </p> <p>I looked at the Urumbu boards and found that they used the DRV8428 stepper controllers. We only have two of them, and they are currently unavailable at Digikey. However, the latest Modular Things boards use a Xiao RP2040 for control, which I'm comfortable with, and the stepper board uses two A4950 motor controllers, which we have at our Lab. Alright! These boards are designed in Fusion 360 and I want to make some modifications to it. I opened the stepper board in Fusion 360 but I couldn't make heads or tails of the interface of the electronics environment.</p> <p>So I started going through a friendly five video tutorial series on Fusion 360 PCB design and milling. The first video covers making a new design, getting the libraries you need and opening the PCB layout. The video was made only a year ago but the interface has already changed since then. But I was able to follow it. In the second video you make your own library component from scratch. I needed to change the default grid units from mils to millimeters first. That is a global setting, so I should now see millimeters everywhere in the electronics design environment. In the third video, you make a more complicated component from the manufacturer's 3D CAD file and technical drawing. When I made a new component, I had to set the grid units to mm again. Annoying.</p> <p>I followed step 5 on this Fab Academy site to export the circuit as a PNG. That worked well for the traces, but no matter what I tried, I couldn't export the outline of the board. It's always visible in the viewport, even when I turn off all the layers. So instead, I tried opening the 3D PCB and exporting the PCB sketch as a DXF and then turning that into a black and white SVG in Inkscape. That works, except I need to draw a frame around it, so that the milling bit has space to traverse the whole outline. But then, how do I make the frame for the traces? I tried to export them as a DXF, but that didn't work. For that, I would need to create another sketch inside the 3D PCB environment and project the traces into it, but that environment only allows you to make one sketch.</p> <p>Then I tried to make an engineering drawing. Only the board outline and the pads appeared but not the traces. And not the frame around the board, because it only exists in a sketch. Then I changed the settings for the model view from Visible Lines to Visible with Hidden Edges, and the traces appeared! But they had broken lines. So I right-clicked the Document Settings at the top of the model tree on the left and looked at the View settings. The hidden lines were drawn with HIDDEN2. I changed that to Continuous, and now I had nice and continuous traces. I exported the drawing as a PDF and opened it in Inkscape. I deleted the CAD drawing frame, which I don't need to make production files. Now I just needed to do some editing to combine the traces with the pads and make one file with only the traces and another one with only the holes and the board outline. I made all the lines red and 0.02 mm wide, just because that's what we usually do before laser cutting and vinyl cutting. I'm used to looking at things like that.</p> <p>I tried turning on Fill, but that didn't come out well. So I had to do some editing. I selected Object -&gt; Ungroup twice to separate all the lines. I thought that I was getting close to production. But a lot of the lines weren't connected. Sigh. I can't use this. </p> <p>Next I tried exporting the CAD drawing as a DXF and opened it in Inkscape, in the hope that it would be more precise. It is more precise, but the lines are still all seperate. The pads and traces aren't objects that I can combine. I tried turning Fill on, but had no better luck than with the PDF.</p> <p>To make the background, I made a rectangle with black fill and no stroke, and had it snap to the corners of the broken sketch outline. </p> <p>Nicely milled stepper control board.</p> <p>When I was looking through the Arduino code for the stepper H-bridge RP2040, I found the pin that sends a reference voltage to the Toshiba driver. It was in the stepperDriver.cpp file. Connected to the pin was a somewhat cryptic slice_num variable, but from the RP2040 datasheet I remembered that the PWM generators are called slices. From the following lines of code, it seemed that the PWM duty cycle was 15/128, or 12%:</p> <p><code>cpp   // PWM duty cycle over 128   pwm_set_chan_level(slice_num_a, channel_a, 15);   pwm_set_chan_level(slice_num_b, channel_b, 15);</code> If I assume that the maximum output voltage of the RP2040 is 3.3V, then 12% of that is 0,396V. I can try to implement this with the Arduino library function analogWrite(pin, value), where value takes a number from 0 (always off) to 255 (always on). 12% of 255 is 31.</p> <p>The DC motor hummed, but didn't move. So I tried 50/255. Then it moved a tiny bit. Next, I tried 80/255. The motor spins! And I don't seem to be overloading the USB port. But the motor is very weak. Let's try 100. Now 120. Now 150. Now 180. Now 200. Now 220. I won't dare to go above that for now.</p> <p>Two DC motors, VREF 80. Works! Let's try 120. I tried 150, 180 and finally 220.</p> <p>I also tried PWM on both motors at the same time. That worked well. Now I'm gearing up for a BLDC motor. But that requires a boost converter to get the voltage from 5 to 12 V.</p>"},{"location":"assignments/week09.html#final-project-spiral-1","title":"Final project spiral 1","text":""},{"location":"assignments/week09.html#yuichis-board","title":"Yuichi's board","text":"<p>Then I tried Yuichi Tamiya's Modular Things stepper board.</p> <p>Yuichi Tamiya's Modular Things stepper board from the 2023 instructor bootcamp in Amsterdam.</p> <p>This is the last board that Andri made in Machine week with the help of our instructors. It worked, so immediately after I got back to \u00cdsafj\u00f6r\u00f0ur I made one of my own:</p> <p>OMG, it's so smooth and quiet!</p> <p>\u00de\u00f3rarinn found me all excited when he came to work. Fig rolls and the trusty Tandy 102 by my side, and a candle lit on my desk to keep my father with me as I work. He would have loved this.</p>"},{"location":"assignments/week09.html#design-file","title":"Design file","text":"<p>Download Stepper H-bridge RP2040 Modular Thing Arduino code</p> <p>Download svavar-stepper.js </p>"},{"location":"assignments/week09.html#spiral-1-3d-design","title":"Spiral 1 3D design","text":"<p>I was so excited to see a motor moving that I immediately started to design 3D printed parts for spiral 1 of my robot arm.</p> <p>I bought two sizes of brushless motors, thinking that I would use a bigger motor in the base. I based the shape of the board on that.</p> <p>A few days after I designed the shape, I decided to change the orientation of the arm from vertical (regular robot arm) to horizontal (SCARA arm). Then there's no strain on the motors when the arm is stationary and I don't need to use the bigger and more expensive brushless motor. I also decided to keep the stepper in the base, not because I wanted to use a stepper but simply because I had a working stepper. Spiral development!</p> <p>This Fusion 360 model is named stepper_festing, which means stepper_bracket. I only meant to design a fixture for the stepper, but it quickly turned into a whole robot arm.</p> <p>Assembling spiral 1 of my robot arm.</p>"},{"location":"assignments/week09.html#robot-base","title":"Robot base","text":"<p>The 3D printed base for spiral 1 of my robot arm. The support material came easily away from the part in one piece. Neat!</p> <p>Here's the Stepper RP2040 Modular Thing that I made for the stepper in the base of the arm. Look closely and you'll see the tiny white TPU washers that I made avoid making contact between the screws and the traces.</p>"},{"location":"assignments/week09.html#spiral-1-assembly","title":"Spiral 1 assembly","text":"<p>Robot arm spiral 1.</p>"},{"location":"assignments/week09.html#design-file_1","title":"Design file","text":"<p>Download robot arm spiral 1 Fusion 360 model</p>"},{"location":"assignments/week09.html#my-pcb-design","title":"My PCB design","text":"<p>I heavily modified Yuichi's board, changing the shape and adding header pins, so that I could use all the Xiao RP2040's pins. I can now connect the brushless motor to the two H-bridges (it needs one and a half H-bridge) and I can connect the encoder to 3.3 V, ground and a digital pin on the Xiao.</p> <p>Trying the Autorouter in KiCAD. I ended up routing everything manually.</p> <p>My robot joint v1 PCB.</p> <p>I also added one header pin to the current sense resistor, hoping that I can read the current going into the motor. That would be very useful, because it's a way to prevent the H-bridges from overheating (I burned a motor driver on a commercial robot arm once and I want to make it impossible on my arm) and I can also use the measured current as a way to measure the force on the joint. Current sensing is not available on any hobby robot that I know of, so if this works, then it will be a great feature! </p> <p>I also added a 7-11V power input for the brushless motor. Yuichi's stepper board uses the 5V USB pin to power the stepper, but my brushless motor needs a higher voltage. I will just be using a lab power supply for now. I will figure out the arm's power supply later. Does it make sense to add a boost converter? I don't know, converting 230V AC into 5V and then converting 5V into 11V sounds a bit messy to me.</p>"},{"location":"assignments/week09.html#design-files","title":"Design files","text":"<p>Download Robot joint v1 KiCAD project</p>"},{"location":"assignments/week09.html#putting-dupont-connectors-on-the-motor","title":"Putting Dupont connectors on the motor","text":"<p>The power connector that came with the motor is too small for the standard 2.54 mm pin headers in the Fab Lab Inventory, so my instructor \u00de\u00f3rarinn showed me how to crimp Dupont connectors onto the wires.</p> Part 1Part 2Part 3Part 4Part 5 <p>Small connector.</p> <p>\u00de\u00f3rarinn's Dupont connector kit.</p> <p>Aligning a female Dupont connector to the wire. The first crimp connection grabs the plastic cover and the second one grabs the bare wire and secures an electrical connection.</p> <p>Crimping the connector onto the wire. More recently I've started to use narrow nose pliers instead. Then I can control exactly how the crimping goes and I don't waste as many Dupont connectors.</p> <p>Triple Dupont connector, ready for service.</p>"},{"location":"assignments/week09.html#pcb-production","title":"PCB production","text":"<p>Under <code>number of offsets</code> (off screen) I typed -1, to have the milling machine clear all the excess copper off the board. I thought this was the safest move, since I'll be putting a BLDC motor with an aluminum chassis onto the board.</p> <p>That's a nice-looking board.</p> <p>The components for arm joint v1, with a general comment on component labeling.</p>"},{"location":"assignments/week09.html#scaling-problem","title":"Scaling problem","text":"<p>The holes for the brushless motor screws were too far apart. How could that be? I exported the arm profile with the holes directly to DXF from Fusion 360, imported them into KiCAD and then exported to SVG without modifications. My instructor \u00de\u00f3rarinn suggested that my DPI settings in Inkscape and Fab Modules might be off. If you check the Fab Modules image, you'll see that the resolution was automatically set to 999.99 dots per inch, instead of 1000.</p>"},{"location":"assignments/week09.html#oh-no-torn-motor-pins","title":"Oh no, torn motor pins!","text":"<p>I tore the motor pins off the board when I was trying to insert the connector. The copper also came off the board.</p> <p>This was a design lesson: you have to put the connectors all the way at the edge of the board! I don't know what I was thinking.</p> <p>This was very frustrating. I had to stop working, cool off and come back the next day. With a level head, I thought that I might actually be able to save this board using the adhesive-backed copper sheet that I use on the vinyl cutter.</p>"},{"location":"assignments/week09.html#the-fix","title":"The fix","text":"Part 1Part 2Part 3Part 4Part 5 <p>First I cut the <code>MOTOR OUTPUT</code> and <code>CURRENT SENSE</code> letters off the board with a box cutter.</p> <p>Then I tried cutting a strip of copper sheet and I successfully glued it onto the board.</p> <p>Copper sheet added for the other three motor phases.</p> <p>Then I carefully soldered the horizontal header pins onto the copper sheet and made a solder bridge from the sheets to the traces on the board.</p> <p>Finally I added some hot glue to add a little bit of strength.</p>"},{"location":"assignments/week09.html#stepper-control-with-my-board","title":"Stepper control with my board","text":"<p>Driving a stepper from the Modular Things web interface using my arm joint control board.</p> <p>When testing my arm joint v1 with a stepper motor, I accidentally ripped the stepper motor pin header off the board and took some of the traces along with it. A current sense header pin also fell off the board. I decied to call it quits with making stuff for the day, went to the Heimabygg\u00f0 coffe house and wrote up my experiences. With fresh eyes (and a fresh espresso) at the lab the next morning, I thought of a way to fix the board. I would cut strips of adhesive-backed copper sheet and glue new traces onto the board. I soldered them to the remains of the old traces on one end and to the header pins on the other end, and after a bit of troubleshooting, the board worked! </p> <p>I've tried 247, 427, 274, 472, 742, 724 - that covers all possible \\(3! = 6\\) combinations.</p> <p>I'm getting PWM output on Xiao pins 0, 2 and 4. </p> <p>Now I know that the right pins are 7, 2 and 4. I get good PWM output for the motor from pins 2 and 4 but I get the strange sawtooth output from pin 7.</p>"},{"location":"assignments/week09.html#design-files_1","title":"Design files","text":"<p>Download Stepper H-bridge RP2040 Arduino code</p> <p>Download Svavar stepper Modular Things JavaScript code</p>"},{"location":"assignments/week09.html#led-pwm-test","title":"LED PWM test","text":"<p>Before trying to move the brushless motor, I checked whether I was getting a sinusoidal PWM on three output pins. I did this by outputting the motor control signals to the RGB LED that is built into the Xiao RP2040 board. I used Adrian's pinout image of the Xiao RP2040 many, many times because it contains the Arduino pin numbers:</p> <p>This image has been a very useful reference. To make the sinusoidal PWM motor control signals go to the RGB LED, I defined pins 17, 16 and 25 as the output pins.</p> <p>Seems to be working!</p>"},{"location":"assignments/week09.html#design-file_2","title":"Design file","text":"<p>Download sinusoidal PWM for RGB LED Arduino code</p>"},{"location":"assignments/week09.html#bldc-control-with-my-board","title":"BLDC control with my board","text":"<p>Here I'm controlling the BLDC with sinusoidal PWM signals:</p> <p>Getting some erratic behavior. This same code worked with the L298N stepper driver. After trying a few different speeds and voltages, I finally got the motor to spin around in circles in the last shot.</p>"},{"location":"assignments/week09.html#design-files_2","title":"Design files","text":"<p>Download sinusoidal L298N brushless control Arduino code</p>"},{"location":"assignments/week09.html#debugging","title":"Debugging","text":"<p>The brushless motor moved erratically no matter what I tried. I wondered if I had soldered the wrong capacitors onto the board. I tried to measure them with a component tester:</p> <p>Trying to measure a capacitor with a component tester.</p> <p>I couldn't get a reading with the component tester. Eventually I decided that I must have put the right capacitors on the board because I was so systematic and methodical in soldering the board.</p> <p>Finally, I tried lowering the power supply voltage to 5V. The motor still worked. Then I switched the motor over to Yuichi's Modular Things stepper driver and found erratic behavior there too. It seems that this Toshiba motor driver just doesn't cut it. I then connected the motor to the ancient L298N double H-bridge and it worked! OK, so the Toshiba H-bridge is out and I need to look for an alternative.</p> <p>Looking at the signals from the H-bridges. The board can control a stepper just fine. When trying to control a brushless motor, one H-bridge is a problem. It's the one that has only one pin connected. It seems that these motor drivers don't have independent half-H-bridges, which is what I need for brushless motor control. I'm going to abandon this board.</p> <p>I also noticed a lot of compliance in the structure. It seems to stem mostly from the stepper coupling that I designed. This is something I can improve in the next spiral. See the arm bending here:</p>"},{"location":"assignments/week09.html#measuring-the-power-of-an-output-device","title":"Measuring the power of an output device","text":"<p>I measured the power use of an OLED screen.</p> <p>First, I measured the voltage over the component. That means that one lead of the multimeter is on the \"hot\" side of the component and the other lead is connected to ground on the other side. The OLED must be powered on for the voltage measurement to work.</p> <p>Measuring the voltage that the OLED screen gets.</p> <p>Then I measured the current that the OLED screen uses. I needed to break the circuit and insert the multimeter into the circuit on the \"hot\" side, in order to measure the current flowing through the OLED. Inside the multimeter is a resistor with very low resistance. The multimeter measures the voltage drop over the resistor and uses that value and the resistance to calculate the current using Ohm's Law.</p> <p> On the left, the potentiometer is turned all the way down, so the bar is black. On the right the pot is turned all the way up, so the bar is white. There is a clear difference in the current reading.</p> <p>Measuring roughly the maximum current that the OLED screen uses. About 90% of the OLED screen is is illuminated here.</p> <p>To calculate the power consumption, I'll use the power formula:</p> \\[ \\mathrm{P} = \\mathrm{V}\\!\\cdot\\!\\mathrm{I}\\] <p>Potentiometer set to 0%:</p> \\[\\mathrm{P_{0\\%}}=\\mathrm{V}\\!\\cdot\\!\\mathrm{I_{0\\%}}=4.6V\\!\\cdot\\!0.004A=\\underline{0.0184W}\\] <p>Potentiometer set to 100%:</p> \\[\\mathrm{P_{100\\%}} = \\mathrm{V}\\!\\cdot\\!\\mathrm{I_{100\\%}} = 4.6V\\!\\cdot\\!0.008A = \\underline{0.0368W}\\] <p>Maximum OLED power consumption:</p> \\[\\mathrm{P_{max}} = \\mathrm{V}\\!\\cdot\\!\\mathrm{I_{max}} = 4.6V\\!\\cdot\\!0.024A = \\underline{0.1104W}\\]"},{"location":"assignments/week10.html","title":"Machine Week","text":""},{"location":"assignments/week10.html#assignment","title":"Assignment","text":""},{"location":"assignments/week10.html#group-assignment","title":"Group assignment","text":"<ul> <li>Design a machine that includes mechanism+actuation+automation+application</li> <li>Build the mechanical parts and operate it manually</li> <li>Actuate and automate your machine</li> <li>Document the group project and your individual contribution</li> </ul> <p>See more info and recording of the lecture here.</p>"},{"location":"assignments/week10.html#presentation","title":"Presentation","text":"<p>The Icelandic Machine Week team: Svavar, Andri and Hafey.</p> <p>Machine Week was fantastic. Check out our project page here:     <p> MACHINE WEEK PAGE </p></p> <p>For an intense three-day weekend, Andri S\u00e6mundsson, Hafey Viktor\u00eda Hallgr\u00edmsd\u00f3ttir and myself joined forces in Fab Lab Reykjav\u00edk to build a machine. Here's our presentation video:</p> <p>The build process and function of the TeaManator tea steeping machine.</p> <p>But it's better to watch the video with commentary from Hafey:</p> <p>Hafey presenting the TeaManator tea machine to Neil Gershenfeld and the Fab Academy class 2023. Neil liked how the machine is nicely finished and presented. Link to video.</p> <p>The clean aesthetics of the machine are thanks to Hafey, who designed and made the structure on the Shopbot and the laser cutter. She also made the logo on the vinyl cutter, which means that we used all the machines in the Fab Lab!</p>"},{"location":"assignments/week10.html#travel-arrangements","title":"Travel arrangements","text":"<p>Our instructors, \u00c1rni Bj\u00f6rnsson and \u00de\u00f3rarinn Bjartur Brei\u00f0fj\u00f6r\u00f0 Gunnarsson came to support us during this intense session of work. \u00de\u00f3rarinn and I flew in from \u00cdsafj\u00f6r\u00f0ur and \u00c1rni flew in from Akureyri. </p> <p>Landing in \u00cdsafj\u00f6r\u00f0ur is more exhilarating than many people would like.</p> <p>\u00cdsafj\u00f6r\u00f0ur is one of the most difficult airports in Iceland. When the plane comes in, it needs to take a sharp U-turn at the bottom of the fjord before landing on the tarmac. People are often quite shocked, and I heard that two of the designers of the Dutch Fokker aircraft that used to fly this route came along for the ride once and commented that the aircraft was not designed for this kind of thing. If there's even a little bit of side wind toward the mountain, the flight is cancelled. Fortunately, the weather gods smiled upon us this time. </p>"},{"location":"assignments/week10.html#fab-lab-reykjavik","title":"Fab Lab Reykjav\u00edk","text":"<p>On arriving in Fab Lab Reykjav\u00edk, I discovered that I was one of the orphaned 3D scans on display in the lobby. No long hair or beard back then.</p> <p>I made this with a Kinect 3D scanner many years ago with the help of Linda and Bas Withagen, soon after Fab Lab Reykjav\u00edk first opened. Then the Fab Lab was in Eddufell, in a small commercial center. I spent a lot of time there right after it opened. Good times.</p> <p>I wanted to take many more pictures inside Fab Lab Reykjav\u00edk, because they have designed and fabricated all sorts of clever solutions that I would like to replicate in Fab Lab \u00cdsafj\u00f6r\u00f0ur. But there was no time!</p>"},{"location":"assignments/week10.html#teamwork","title":"Teamwork","text":"<p>We were all super productive the whole time. We worked from nine in the mornings to about ten in the evenings, and we made the machine work just in time to go back home. I'm really happy with my teammates and our instructors.</p> <p>\u00c1rni, Svavar, Hafey, Andri and \u00de\u00f3rarinn.</p>"},{"location":"assignments/week10.html#the-concept","title":"The concept","text":"<p>Why is the machine called TeaManator? Because my instructor \u00de\u00f3rarinn thought we should use something distinctive as an end stop:</p> <p>He added the tongue in Blender.</p> <p>Andri made some concept art for our machine using a Generative Pre-trained Transformer:</p> <p>Andri used GPT-enabled Bing to generate the images.</p>"},{"location":"assignments/week10.html#spiral-1","title":"Spiral 1","text":"<p>My job was to make the motors work. The first spiral was to control a stepper motor using an Arduino Uno and an L298N double H-bridge motor controller. I also added a servo to the Arduino Uno. The ATMega328 chip on the Uno is a bit old and outdated, but the Arduino Uno is still the best documented and supported microcontroller board in the world. So it's a good place to get something basic working.</p> <p>Machine control spiral 1: An L298N stepper driver module on a breadboard with a SparkFun RedBoard, which is essentially the same thing as an Arduino Uno.</p>"},{"location":"assignments/week10.html#spiral-2","title":"Spiral 2","text":"<p>The second spiral was to make a custom board with a Xiao RP2040 microcontroller module, a DRV8825 StepStick motor controller, 12V input pins from a lab power supply and GPIO breakout pins for a servo and two buttons. In Machine Week I made my biggest leap forward in electronics design. I also developed my methodical method of breadboarding and testing the hardware and software, one element at a time, before transferring the design over to KiCAD.</p> <p>Machine control spiral 2 on a breadboard: A DRV8825 StepStick stepper driver module. I first connected it to the SparkFun RedBoard but when I had that working I switched to the Xiao RP2040 module.</p>"},{"location":"assignments/week10.html#pcb-milling","title":"PCB milling","text":"<p>The custom board that I made is an extension of spiral 2. The first board had mounting holes that were far too big and the board also came loose during milling. </p> <p>Bad board and good board. I input a radius for the mounting holes when I thought I was defining their diameter. So the holes are huge on the board on the left! And I didn't use enough double-sided tape to secure the PCB blank, so it shifted during the trace milling operation.</p> <p>After a redesign, the second attempt to mill the board went well. The board on the right is the final version of the TeaManator controller board. I forgot the drilling holes for the electrolytic bulk storage capacitor for the stepper driver, so I drilled those holes afterwards.</p> <p>Hand drilling the last two holes in the board.</p> <p>I only had through-hole female headers, so I bent their legs in order to be able to surface mount them.</p> <p>Bending the legs for surface mounting.</p> <p>The final TeaManator machine controller, with a Xiao RP2040. I learned a lesson in considering which side through-hole components need to be on in order to touch the copper traces.</p> <p>Close-up of the machine controller, all connected up.</p> <p>The TeaManator 2000 tea steeping machine. Clean and elegant.</p> <p>The reality behind the facade. The USB hub (with AC adapter) and the big power supply are only there to supply 5V to the Xiao and 12V to the stepper driver, because we didn't have time to learn how to make a power supply. I realized then that I need to think seriously about a neat way to power my final project.</p>"},{"location":"assignments/week10.html#design-files","title":"Design files","text":"<p>Here are the KiCAD, SVG and PNG files for the TeaManator machine control board. I'm also including all the incremental test code. Other design files are at the bottom of our group project page.</p> <p>Download TeaManator KiCAD</p> <p>Download tea_machine.ino (final code)</p> <p>Download machine_week_nema17_l298n_test.ino</p> <p>Download machine_week_nema17_l298n_servo_test.ino</p> <p>Download machine_week_nema17_and_servo.ino</p> <p>Download machine_week_xiao_servo.ino</p> <p>Download machine_week_nema17_drv8825_test.ino</p> <p>Download machine_week_nema17_drv8825_test-svavars_board.ino</p> <p>Download machine_week_nema17_and_servo-svavars_board.ino</p> <p>Download machine_week_button_test.ino</p>"},{"location":"assignments/week10.html#spiral-3","title":"Spiral 3","text":"<p>The first Stepper Modular Thing that Andri made. He had to do considerable editing to make the circuit fabricatable.</p> <p>After 3D printing all the parts for the linear motion axis, Andri worked tirelessly on the third spiral, which was to make a Modular Things stepper controller board. We were really excited about this solution, but this design really thin traces and two layers, making it difficult to make. Andri made lots of modifications to the design in Fusion 360 in order to make the traces thicker and reroute everything so that it fit on one layer. He successfully milled the board and soldered all the components to it, but it didn't work. Unfortunately, the motor drivers in the original design need a higher voltage than 5V to work. The designer, Quentin Bols\u00e9e was very responsive to our questions.</p> <p>Then our instructors \u00c1rni and \u00de\u00f3rarinn, recalled that Yuichi Tamiya at Fab Lab Kannai made a working version of the Modular Things stepper control board at the 2023 instructor bootcamp in Amsterdam.</p> <p>Andri proceeded to make the board and \u00c1rni soldered the components onto it. It worked on the first try!</p> <p>The second Stepper Modular Thing that Andri made. Wow! It's powered by the USB port!</p> <p>We didn't have time to integrate it into our machine, but I'm very glad that Andri and our instructors were able to make a working Modular Thing. Seeing the Stepper Modular Thing working and being able to make the machine control board successfully combined to give me the confidence to try to make a robot arm joint immediately when I arrived back in \u00cdsafj\u00f6r\u00f0ur. See more info in Output Devices week.</p>"},{"location":"assignments/week10.html#our-instructors","title":"Our instructors","text":"<p>We are lucky to have these instructors. Here are some images to prove it:</p> <p>Left: \u00de\u00f3rarinn explaining some electronics to Hafey. Right: Andri showing \u00c1rni the teabag holder that he made from bent acrylic.</p> <p>Attention: Coffee for Svavar! Our instructors took good care of us during this intense work session.</p> <p>My instructor \u00de\u00f3rarinn also disassembled a stepper motor and showed us how it works:</p> <p>Left: The stepper rotor, with its many iron teeth visible. Right: The step signal that turns the rotor (two of the phases are connected to the oscilloscope).</p>"},{"location":"assignments/week11.html","title":"Input Devices","text":""},{"location":"assignments/week11.html#assignment","title":"Assignment","text":""},{"location":"assignments/week11.html#individual-assignment","title":"Individual assignment","text":"<ul> <li>Measure something: add a sensor to a microcontroller board that you have designed and read it</li> </ul>"},{"location":"assignments/week11.html#group-assignment","title":"Group assignment","text":"<ul> <li>Probe an input device's analog levels and digital signals</li> </ul> <p>See more info and recording of the lecture here.</p>"},{"location":"assignments/week11.html#ir-sensor-board","title":"IR sensor board","text":"<p>I used the IR phototransistor from the fab library twice, to represent both the IR emitter and the phototransistor. For this board I'm using obsolete parts from the 2012 Fab Lab inventory that still work really well; the OP280KT IR emitter and the matched OP580 phototransistor. They are have a more square shape than their modern counterparts, but I checked the datasheets and their footprints are close enough to what I have in the KiCAD library now.</p> <p>My Xiao IR sensor schematic.</p> <p>I looked at the phototransistor board on the Xiao page of the Fab Academy web site of Adrian Torres. It has a 1kOhm resistor on the IR emitter diode and a 10kOhm resistor on the IR sensor. I did the same here.</p> <p>My Xiao PCB design for the IR emitter and sensor.</p> <p>Instead of soldering the Xiao onto the board I'm using pin sockets. The milling went well using Fab Modules and the Roland Modela MDX-20, but the edges of the traces are a little bit rough. That's a sign of wear on the 1/64 inch bit.</p> <p>Milling the traces of the IR sensor board.</p> <p>Then I milled the board outline with the 1/32 inch bit. </p> <p>Milling the outline of the IR sensor board.</p> <p>Here's how the board looks:</p> <p>The IR sensor board.</p> <p>With the Xiao SAMD21 on board.</p> <p>Here's a video of the sensor readings, it works really well:</p>"},{"location":"assignments/week11.html#measuring-the-analog-signal","title":"Measuring the analog signal","text":"<p>I connected the signal from the IR sensor to the oscilloscope and got a reading that changed with the light hitting the sensor:</p>"},{"location":"assignments/week11.html#design-files","title":"Design files","text":"<p>I used code from Adrian Torres to get readings in the serial plotter, but I changed the number of the analog read pin to A10.</p> <p>Here's my KiCAD project:</p> <p>Download Xiao IR sensor board</p> <p>And the PCB milling files for Fab Modules or Mods:</p> <p>The traces. The interior (for milling the board outline).</p> <p>And the Arduino code:</p> <p>Download IR sensor Arduino code</p>"},{"location":"assignments/week11.html#magnetic-encoder","title":"Magnetic encoder","text":"<p>The board that I made for output devices has three pins that are intended for encoder input. I connected the encoder and wrote a simple test program in the Arduino IDE. The AS5048 encoder has a three-pin PWM output and a five-pin SPI output. I used the simpler PWM output. It was easier to route the board for those connections. In this case, I use the pulseIn Arduino command to read the length of the pulses coming into the pin from the encoder. Then I print the value to the serial monitor. Here's the whole program:</p> <pre><code>const int encoder = 3; // AMS AS5048 encoder \nint pos=0; //mechanical position of shaft\n\nvoid setup() {\n  Serial.begin(9600);\n  pinMode(encoder, INPUT);\n}\n\nvoid loop() {\n  pos=pulseIn(encoder,HIGH);//read encoder pulse\n  Serial.print(pos);\n  Serial.print('\\n');\n  delay(10);\n}\n</code></pre> <p>And here's a video of it running:</p> <p>Then I connected the current sensing resistor of each H-bridge to a pin on the Xiao RP2040. Using analogRead, I was able to measure the current going through the motor! There is one value for each H-bridge, and the values are similar. The values fluctuate, so they depend on when the measurement is made.</p> <p>It seems to work!</p>"},{"location":"assignments/week11.html#measuring-the-digital-signal-from-the-encoder","title":"Measuring the digital signal from the encoder","text":"<p>I measured the SPI signals coming out of the AS5048 magnetic encoder. The first thing to measure is the clock signal. This is what synchronizes the SPI communication.</p> <p>The clock signal from the A5048 magnetic angle sensor was weak.</p> <p>I thought that maybe the magnetic encoder chip wasn't supposed to generate a clock signal. In SPI communication, there's only one main IC, and it generates the clock signal. So I connected the encoder up to a SAMD21 chip (and also connected the motor driver).</p> <p>With the microcontroller connected, the clock signal is strong. But its shape is surprising. I thought it would just be a regular square wave with no gaps.</p> <p>Next up is the chip select pin. The chip select pin is used to select between secondary SPI nodes, if more than one are connected to the same main microcontroller. This is how the chip select signal looks:</p> <p>The chip select signal in blue, overlaid onto the clock signal in yellow.</p> <p>Then there's the data, MOSI and MISO.</p> <p>The MOSI signal. I tried rotating the motor while it was on the screen. I didn't see any significant changes. But the angle still appeared in the serial monitor.</p> <p>The MISO signal. Some disturbances happened when I turned the motor, but I couldn't see how the signal was coming across the wire.</p>"},{"location":"assignments/week11.html#design-file","title":"Design file","text":"<p>Download encoder test Arduino file</p>"},{"location":"assignments/week12.html","title":"Molding and Casting","text":""},{"location":"assignments/week12.html#assignment","title":"Assignment","text":""},{"location":"assignments/week12.html#group-assignment","title":"Group assignment","text":"<ul> <li>Review the safety data sheets for each of your molding and casting materials,</li> <li>then make and compare test casts with each of them</li> <li>Extra credit: try other molding and casting processes</li> </ul>"},{"location":"assignments/week12.html#individual-assignment","title":"Individual assignment","text":"<ul> <li>Design a mold around the stock and tooling that you'll be using,</li> <li>mill it (rough cut + three-axis finish cut),</li> <li>and use it to cast parts</li> <li>Extra credit: use more than two mold parts</li> </ul> <p>See more info and recording of the lecture here.</p>"},{"location":"assignments/week12.html#the-guerilla-guide-to-cnc-and-resing-casting","title":"The Guerilla guide to CNC and resing casting","text":"<p>I came across the Guerrilla guide to CNC and resin casting by Michal Zalewski some months ago and was fascinated by the depth of technical information and practical skills displayed in the guide and in his Omnibot Mk II build. Look at that tiny DIY planetary gearbox! His adventures in CNC and robotics are inspiring. And others have used his methods successfully; just look at this hybrid walker robot (video).So I took his recommendations and tried to order the main materials that he uses for his resin casting projects: Medium density modeling board, Quantum Silicones Q262 molding silicone and Innovative Polymers IE-3075 polyurethane for casting parts with excellent material properties. The problem was that no one wanted to sell them to me:</p> <p>This seemed like a dead end.</p> <p>Then I remembered a service I had used once before to order something obscure from a US based company that didn't ship to Iceland: ShopUSA. You can have things shipped to their warehouse in Virginia, and they forward your package to any country in the world. They shipped my polyurethane resin by air, which was convenient, but the silicone that I needed to make molds went by sea, because that package was above a weight limit. I also found someone on eBay who was selling relatively small pieces of medium density modeling board for milling. This is the stuff that's in all the ads from Roland, it's dimensionally stable, easy to machine and leaves a nice surface finish, not unlike a metal mold that has been glass bead blasted:</p> <p>I like this stuff. It's like machinable wax, but with a filler, so you get a uniform, slightly textured finish. It takes well to sanding.</p>"},{"location":"assignments/week12.html#mold-pattern-1-modeling-and-toolpath-generation","title":"Mold pattern 1 modeling and toolpath generation","text":"<p>I decided to make a button for the Frankenstein MCU that my instructor \u00de\u00f3rarinn is working on with Francisco Sanchez Arroyo. You push the button and your Fab Lab goes online. You can see the Fab Labs appear on the spinning globe, with connections forming between all the labs.</p> <p>It's a simple design, mainly meant to test the 3D spiral toolpath in Fusion 360 and the surface finish that is achievable with the modeling board. First I embossed the text and tried a parallel 3D toolpath in Fusion 360:</p> <p>I couldn't get the detail I wanted with this approach.</p> <p>Next, I used a single line font for the text and used the Project command to mill it into the curved surface of the button with a 3D strategy:</p> <p>The single line font, coupled with the Project milling strategy, worked really well .</p>"},{"location":"assignments/week12.html#milling-mold-pattern-1","title":"Milling mold pattern 1","text":"<p>I used a simple fixturing method that my instructor \u00de\u00f3rarinn showed me.</p> <p>I used the zeroing plate on the Shopbot.</p> <p>The milling chips look really nice when running adaptive clearing.</p> <p>Roughing pass being completed.</p> <p>Finishing pass looking good.</p>"},{"location":"assignments/week12.html#molding-mold-pattern-1","title":"Molding mold pattern 1","text":"<p>Since my silicone hadn't arrived, I got the help of my father-in-law, who is a recently retired dentist. He uses Impregum Penta from 3M to take impressions of teeth. It comes with a handy machine which mixes the two parts in the right proportions and dispenses the silicone.</p> <p>Still knows all the moves.</p> <p>This dental silicone is really viscous, so it's hard to prevent bubbles from being trapped in it when dispensing into the mold. Also, I didn't add draft angles to the geometry, so it was hard to get the silicone out, and I damaged the mold pattern:</p> <p>I thought the mold was shallow enough to not need a draft angle, but it really does need it.</p>"},{"location":"assignments/week12.html#mold-pattern-2","title":"Mold pattern 2","text":"<p>Comparison between the profile sketches of the first and second mold pattern.</p> <p>Section analysis of first and second mold pattern.</p> <p>The second mold pattern toolpath. On the left are the feeds and speeds for the text engraving.</p> <p>My father-in-law put some Vaseline on the edge of the second mold pattern. That worked well. With the addition of the draft angles, it was much easier to get the silicone mold out of the modeling board. I used a syringe to put the silicone in this second mold pattern, so that I could get into all the little engraved letters. That strategy worked, but I still got bubbles in the silicone.</p> <p>A bit of Vaseline as mold release.</p> <p>This is the only picture I have of the syringe, because I needed both hands to apply the silicone.</p> <p>The second mold came out well, except for a few bubbles. With the help of my father-in-law, I made another mold from this pattern, but it turned out the same.</p>"},{"location":"assignments/week12.html#the-right-silicone-arrives","title":"The right silicone arrives","text":"<p>Then my silicone arrived from Hobby Silicone! I also got a vacuum pot that my friend P\u00e1ll Einarsson made. That's a great thing to have when molding and casting! But I was disappointed when I plugged it in. I got no vacuum at all. If anything, the needle on the meter went up. I tried pressing down on the lid to seal it, but no luck. Then I felt air blowing out from under the lid. Aha! </p> <p>DIY vacuum pot.</p> <p>When Sigur\u00f0ur, the electrical teacher at the school came to the lab I got him to take a look at the three-phase plug with me. He showed me how to open it and he suggested that I try swapping the brown and black wires. That worked! The vacuum pump now blows in the right direction and I can degas the silicone and polyurethane. I ordered QM-262, which is quite stiff with Shore 60A hardness, and also Soft 107, which only has a 7A Shore hardness. I tried the softer one. </p> <p>One part blue catalyst to ten parts silicone.</p> <p>Mixing the silicone and scraping the sides of the cup until the color is uniform with no streaks.</p> <p>I mixed one part catalyst (5g) with ten parts silicone (50g) as per the manufacturer's instructions, and tried to shear it (Stir only laterally, not up and down, so as not to get bubbles in the mix). When the color was even I put the mix into the vacuum pot and let it sit for five minutes. A lot of bubbles surfaced and popped. I then let air back in and put the vacuum back on twice for two minutes. </p> <p>Then I poured the light blue mixed silicone into the mold pattern (after spraying it with Ultralease from Hobby Silicone). I  poured in a thin stream into the same place the whole time, really slowly. </p> <p>Then I put it into the vacuum pot. A surprising number of bubbles came up. After a whole work day, I checked on the remains of the mixed silicone in the cup. It was still flowing freely. That was discouraging. My wife A\u00f0albj\u00f6rg worked for OK Prosthetics making prosthetic legs and silicone liners and she said that they heated up the aluminum molds to accelerate the curing process. Any remains took days to cure. They used to put the silicone mixing nozzles into an oven to be able to get the remains out and use the nozzle again quickly. She said that it depends on the chemistry and especially the catalyst, but she said that my silicone might still cure.</p> <p>Degassing the mold after pouring.</p> <p>After a week of waiting and then going to the Fab Lab Bootcamp in Neskaupsta\u00f0ur for another week, I came back and removed the mold from the master pattern.</p> <p>This silicone mold is very flexible.</p> <p>I'm very happy with the results. There are absolutely no bubbles in the mold and the text was captured perfectly. But I may need to contact the silicone manufacturer, because the datasheet says that it should cure in 24 hours.</p> <p>That's a nice-looking mold with no bubbles.</p>"},{"location":"assignments/week12.html#design-file","title":"Design file","text":"<p>Download FMCU button Fusion 360 model</p>"},{"location":"assignments/week12.html#trying-to-mix-polyurethane","title":"Trying to mix polyurethane","text":"<p>I made an attempt to mix the IE-3075 polyurethane to cast it in the silicone mold. The bottles said that I should agitate them before mixing, because they may have settled in storage. I probably shook them way too hard, because when I put the 1:1 by volume mixture into the vacuum pot, it foamed and immediately started to set. I made a rigid foam. Those can be useful as core materials in composites, but that's not what I intended to make.</p> <p></p>"},{"location":"assignments/week12.html#casting-wax-in-the-mold","title":"Casting wax in the mold","text":"<p>Just to cast something in the mold, I tried candle wax. So I took the mold home and heated up an old candle. </p> <p>Heating the candle wax over a water bath.</p> <p>When all the wax had turned liquid and transparent, I poured it carefully into the mold.</p> <p>I may have heated the wax too quickly. As it gets hotter, the wax continues to expand according to its coefficient of thermal expansion. Then I poured it into the mold and it starts to cool down and contract. The greater the difference between these two temperatures, the worse the warping and wrinkles get.</p> <p>Thermal contraction during cooling results in wrinkles on the surface.</p> <p>Then I removed the cast wax part from the silicone mold.</p> <p>A small hand immediately grabbed the cast wax part after I removed it from the mold.</p> <p>The resulting part is not nearly as smooth as the mold is. Apparently the thermal contractions were so bad that this side got wrinkled too.</p> <p>The surface is all wrinkled after thermal contraction. But the text came out well.</p> <p>My little helper played around with the mold for a second. This resulted in the mold being bent all the way backwards and developing cracks. He wasn't trying to damage it, he was just being very four years old. This is a lesson for me, the mold was too thin in the middle. I was trying to save material and I thought I could get away with it. </p> <p>\"There is a crack in everything. That's how the light gets in,\" sang Leonard Cohen.</p>"},{"location":"assignments/week12.html#trying-polyurethane-again","title":"Trying polyurethane again","text":"<p>This time I poured the isocyanate and polyol into separate plastic cups in the right proportions. I put them both into the vacuum pot and pulled a vacuum. No bubbles surfaced, so I took the silicone mold, grabbed a piece leftover acrylic to put under it, and placed it inside the vacuum pot. I then mixed the polyurethane parts together, stirring carefully with a thin acrylic stick. </p> <p>I poured the cloudy mixture into the mold in a thick stream, closed the chamber and pulled a vacuum. Lots of bubbles surfaced, but they didn't pop. Is the liquid to viscous? Is the vacuum pump not powerful enough? I let the air back in to see if the bubbles would pop. They shrank, but became bigger I pulled the vacuum again.</p> <p>The button came out of the mold without any trouble. I just had to make sure not to rip the silicone text when removing the resin part.</p> <p>The part is full of bubbles! Darn it.</p> <p>The FMCU text is very faintly visible. I would need to fill the letters with paint to make them stand out. I'm going to claim stone cold that that was the plan all along.</p> <p>My instructor \u00de\u00f3rarinn mentioned that there is a pressure pot in the Chemistry lab in the school. Maybe that will work better. Instead of drawing a vacuum, which enlarges the trapped bubbles and encourages them to rise to the surface, I will make the bubbles collapse until I can't see them anymore. When I have some spare time. This will have to do for now.</p>"},{"location":"assignments/week12.html#safety-data-sheets","title":"Safety Data Sheets","text":"<p>The silicones and the polyurethane that I ordered came with Safety Data Sheets. </p>"},{"location":"assignments/week12.html#soft-107-silicone","title":"Soft 107 Silicone","text":"<p>Soft 107 is a very soft and flexible two-component, room temperature condensation cure silicone. It has a durometer of 6. I guess they named it before they got the results back from the official durometer test. The condensation cure (or tin curing) means that this silicone probably shrinks a bit when curing. But the great thing about this material is that it's food safe (indirect contact). Because it's so soft, it's also ideal to make pads for pad printing. I've wanted to try pad printing for years, now I have what I need to do it. The silicone is mixed with a blue catalyst in a 10:1 silicone to catalyst ratio by weight. It's recommended to mix the silicone in a clean plastic container with a volume 3-4 times the volume of the silicone being mixed. Then there's space for it to expand when you put it in a vacuum pot to draw out the bubbles. If you don't have access to a vacuum chamber, they recommend a high pour: You pour into the bottom corner of the mold the whole time, keeping the mixing cup high enough above it to form a thin, steady stream of silicone. The bubbles will be pushed out before entering the thin stream and then the silcone mass slowly levels itself in the mold. This is what I did, and I also used a vacuum pot.</p> <p>The Soft 107 silicone may be harmful in contact with skin. Always use disposable gloves when handling it. Ensure good ventilation while working with it. Make sure that it doesn't leak into the environment. You must make sure that it cures before disposing of any remains. It's good to have a shower, an eyewash station and a ventilation system. It would be good for the Fab Lab to get an eyewash station. Rinse with plenty of water if you get the uncured material on your skin, in your eyes or into your mouth.</p>"},{"location":"assignments/week12.html#quantum-silicones-qm-262-silicone","title":"Quantum Silicones QM 262 Silicone","text":"<p>QM 262 is a two-component, room temperature addition cure (platinum cure) silicon material. The platinum cure means that there is essentially no shrinkage while curing. This silicone has excellent mechanical properties and is Michal Zalewski's favorite silicone for precision mold making. It has a high durometer of 60 Shore A. You mix it 10:1 silicone to blue catalyst by weight. The mixing instructions are the same as for the Soft 107 silicone material.</p> <p>The safety instructions are also the same as for the Soft 107 silicone.</p>"},{"location":"assignments/week12.html#innovative-polymers-ie-3075-polyurethane","title":"Innovative Polymers IE-3075 polyurethane","text":"<p>This very strong polyurethane is mixed 1:1 by volume from an isocyanate and a polyol:</p>"},{"location":"assignments/week12.html#raku-tool-ie-3075-isocyanate","title":"RAKU TOOL IE-3075 Isocyanate","text":"<p>Rinse with plenty of water and call a poison center if you get the uncured material on yourself. It may cause respiratory irritation and damage to organs through prolonged or repeated exposure. The material is suspected of causing cancer. Use protective glasses, glove, clothing and in case of inadequate ventilation, wear respiratory protection. Heating may cause an explosion.</p> <p>Make sure to completely cure the material before discarding the container.</p>"},{"location":"assignments/week12.html#raku-tool-ie-3075-polyol","title":"RAKU TOOL IE-3075 Polyol","text":"<p>The safety procedures are very similar to the isocyanate, except the polyol is less flammable. There is much less information in its Safety Data Sheet.</p>"},{"location":"assignments/week12.html#ultralease-ure-gp-urethane-parfilm-mold-release","title":"Ultralease URE GP Urethane Parfilm Mold Release","text":"<p>Ultralease URE GP is a solvent-less and virtually odorless mold release. It's heat stable to 315\u00b0C, so it should also be good for injection molding. It doesn't interfere with painting, coating or bonding. It should last for several molding cycles. It's recommended for use with polyurethanes, silicones and rubbers. </p> <p>Wear eye protection, long sleeves, chemical resistant gloves and an organic vapor respirator. Also ensure proper ventilation. The can may explode if heated and the contents may displace oxygen and cause rapid suffocation. Keep away from heat, sparks, flames and hot surfaces. Do not pierce or burn the pressurized container, even after use. And definitely don't spray it onto an open flame. Rinse with plenty of water if you get it on yourself. And because it's in an aerosol can, contact with the rapidly expanding gas may cause burns or frostbite, as the gas removes heat from your skin to fuel its expansion.</p>"},{"location":"assignments/week13.html","title":"Networking and Communications","text":""},{"location":"assignments/week13.html#assignment","title":"Assignment","text":""},{"location":"assignments/week13.html#individual-assignment","title":"Individual assignment","text":"<ul> <li>Design, build, and connect wired or wireless node(s)</li> <li>with network or bus addresses and a local interface</li> </ul>"},{"location":"assignments/week13.html#group-assignment","title":"Group assignment","text":"<ul> <li>Send a message between two projects</li> </ul> <p>See more info and recording of the lecture here.</p>"},{"location":"assignments/week13.html#hello-i2c","title":"Hello I2C","text":"<p>I did this week's work in Neskaupsta\u00f0ur, which is as far as you can get from \u00cdsafj\u00f6r\u00f0ur in Iceland. I had to take two flights to get there! The annual Icelandic Fab Lab Bootcamp was held in Neskaupsta\u00f0ur this year. I think everybody got lots out of it and this was the first time that we set up a repo and a web site for an Icelandic bootcamp. We're under the influence of the 2023 Instructor's Bootcamp in Amsterdam.</p> <p>This is what I packed for the trip (plus a few items of clothing and a toothbrush):</p> <p>I brought a large part of our electronics inventory, just in case.</p> <p>I decided to do as Hafey did, and make Adri\u00e1n Torres's Hello I2C boards. The project consists of a master module which sends an I2C message and two nodes that receive the message and turn on an LED.</p> <p>I read up on how I2C works. SparkFun's article on I2C is really good.</p> <p>I milled Adrian's boards and populated them with components. Hafey brought ATtiny412 ICs for me from Fab Lab Reykjav\u00edk.</p> <p>I2C node with adapter.</p> <p>For my own board I decided to use a laser diode. I had wanted to try one of those since I saw \u00c1rni Bj\u00f6rnsson's output devices video.</p> <p>My laser diode, powered directly by the lab power supply. I noticed that it has an SMD resistor soldered onto it, so I don't need to worry about limiting the current.</p> <p>My I2C laser diode PCB design.</p> <p>I tried the Gerber output for the first time.</p> <p>I tried FlatCAM, which went well, but the toolpath left thin strips of copper in between the traces. I would need to adjust the settings before milling again. It also didn't mill the text on the board, but I didn't really care about that.</p> <p>My laser diode I2C board after milling. In this milling machine, the FR1 PCB blanks are fastened to the wasteboard with double-sided tape.</p> <p>Here's my I2C laser board populated and connected to the adapter.</p> <p>Before programming the board, I had to install the megaTinyCore, which enables the Arduino IDE to program the ATtiny412.</p> <p>I went into Tools -&gt; Board -&gt; Boards Manager and searched for megatinycore and installed it.</p> <p>Then I went into Tools -&gt; Board and selected the ATtiny412:</p> <p></p> <p>Hafey pointed out to me that Adrian's Arduino code had an error. The master node was set up to send a message to one node, and then another. But the number of the node was the same in both cases: the command <code>Wire.write(1)</code> was in both places. After changing the second one to <code>Wire.write(2)</code>, the code worked. </p> <p>Hafey also showed me that instead of using the Upload arrow, now I needed to go into Sketch -&gt; Upload Using Programmer.</p> <p>First select Tools -&gt; Programmer -&gt; SerialUPDI - 230400 baud.</p> <p>Then select Sketch -&gt; Upload Using Programmer.</p> <p>Upload Using Programmer didn't work. Hafey suggested that I just try again. Then it worked.</p>"},{"location":"assignments/week13.html#debugging","title":"Debugging","text":"<p>However, the LED didn't turn on. I don't know why. I noticed that one of the legs of the female header that the laser diode was plugged into had come loose off the board. I tried pushing on it to reestablish the electrical contact, but ended up breaking the female header completely off the board. My instructor \u00de\u00f3rarinn suggested that I try connecting the laser diode to the 5V power rail on the board and GND, just to see if the board can supply it with enough power.</p> <p>USB power is OK on Adri\u00e1n's I2C Master board. I also tried this on my board and it worked too.</p> <p>Then I connected Adri\u00e1n's board to mine over I2C and plugged his board into a USB port to power it. I connected a multimeter to the broken leads for the laser diode and watched for a while. There was no voltage. Nothing was happening on the pin. This must be a software issue.</p> <p>Just a quick check whether the microcontroller is gettning 5V. Good.</p> <p>Just to see if the laser diode pin worked, I uploaded the Arduino Blink example to my board and connected the laser diode. It worked! Then I uploaded the node 1 I2C Arduino sketch onto my board, which is exactly the same code as the one that runs successfully on Adri\u00e1n's board. Nothing. OK, better check the I2C connections on the board. The message may not be getting all the way to my microcontroller.</p> <p>Aha! There's no continuity between the I2C pin header and the SCL pin on the microcontroller. My instructor \u00de\u00f3rarinn suggests only using continuity checking as a last resort, so we brought out the oscilloscope.</p> <p>We measured a short SDA signal every second at 100 kHz.</p> <p>With voltage measurements along the trace we found that it was broken near the microcontroller.</p> <p>I put some solder onto the trace to bridge the gap, connected the boards together and - nothing. Oh, I still had the Blink program on my board! I reuploaded the I2C node code and - nothing. Hm.</p> <p>Dead bugs. One thing that I ran into was that when I was measuring with the multimeter, I accidentally shorted between two tracks and the ATtiny412 became unresponsive. This happened on Adri\u00e1n's board and my own. I've become quite adept at swapping out ICs with the heat gun. Gotta be more careful with these delicate parts. Lesson learned.</p> <p>After swapping out the unresponsive ATtiny412 for a new one, my board finally worked! I soldered the female header back onto the board and here it is in all its glory:</p>"},{"location":"assignments/week13.html#success","title":"Success!","text":"<p>If you listen carefully, you can hear a giant cruise liner signaling its departure from \u00cdsafj\u00f6r\u00f0ur at the beginning of the video. We had two and three of them visit the town per day this summer, each carrying more passengers than the population of our town.</p>"},{"location":"assignments/week13.html#design-files","title":"Design files","text":"<p>Download I2C laser KiCAD project</p> <p>Download I2C master code</p> <p>Download I2C node 1 code</p> <p>Download I2C node2 code</p>"},{"location":"assignments/week13.html#fab-modules","title":"Fab Modules","text":"<p>When discussing Fab Modules/Mods/Mods Project at the Fab Lab Bootcamp in Neskaupsta\u00f0ur, few of our colleagues thought it was a little bit strange to turn vector drawings into bitmaps before running them through the CAM software. But Frosti told me that Neil had mentioned at some point that CNC machines operate on a bitmap grid in the end. That's a good point. We're using Computer Numerical Control, not Computer Vector Control. The G-codes are all encoded as Cartesian coordinates with finite precision. So if you use a high enough resolution in the PNG image, you shouldn't lose any accuracy. The workflow works well, and I like using the old Fab Modules that we have running locally on a Linux laptop.</p> <p>Late in the evening I wanted to make the UPDI adapter that I needed to connect my Hello I2C boards to the computer. Frosti took the opportunity to open up Mods Project. After tweaking a few settings and figuring out that we needed to turn on the Save module and then click Calculate again to get an RML export, the milling went great! We just needed to set the file type to RML1 in the Roland control software, instead of RML NC code.</p>"},{"location":"assignments/week13.html#microsd-breakout-board","title":"microSD breakout board","text":"<p>This video might be useful. It shows how to solder wires directly to an SD card to communicate with it. So the passive components on commercial SD breakout modules aren't strictly necessary, although I'm sure they make the communications more reliable.</p> <p>The PCB layout of my microSD card breakout board on the left and Janet Liu's schematic on the right. Her schematic shows which SD card pin matches which SPI pin on this particular SD card holder from Amphenol. You need to open the image in a new tab to see the pin names on my PCB layout.</p> <p>I didn't consider which way you put the SD card into the slot, so now that I've soldered the headers onto the board, the microSD card is stuck there for all eternity. I hope I can at least communicate with it.</p> <p>I tried going through this clear tutorial by Shawn Hymel. But since he published it, the MicroPython SD card library has disappeared from the GitHub. So I stopped there. I'd like to revisit this later.</p>"},{"location":"assignments/week13.html#design-files_1","title":"Design files","text":"<p>Download SD card breakout board KiCAD project</p>"},{"location":"assignments/week14.html","title":"Interface and Application Programming","text":""},{"location":"assignments/week14.html#assignment","title":"Assignment","text":""},{"location":"assignments/week14.html#individual-assignment","title":"Individual assignment","text":"<ul> <li>Write an application that interfaces a user with an input &amp;/or output device that you made</li> </ul>"},{"location":"assignments/week14.html#group-assignment","title":"Group assignment","text":"<ul> <li>Compare as many tool options as possible</li> </ul> <p>See more info and recording of the lecture here.</p>"},{"location":"assignments/week14.html#frankenstein-mcu","title":"Frankenstein MCU","text":"<p>Presenting my addition to the FMCU to Neil Gershenfeld and Fab Academy Class 2023. Link to the video.</p> <p>Since my instructor \u00de\u00f3rarinn is working with Fran Sanchez on a IoT button that connects Fab Labs together, I decided to clone the repo and take a look at it. The current MCU uses Zoom to connect the Fab Labs together with live video feeds. So I searched for a way to embed Zoom into your own application and found the Zoom Meeting SDK for web, and in particular this JavaScript example. </p> <p>I cloned the repo, got a secret key as a Zoom Developer and I've got the authentication server running locally on Node.js, but the readme says that I need to send a POST request to the server. </p> <p>HTTP POST request trouble on the Zoom authentication server.</p> <p>Google didn't give me any understandable instructions on how to make a POST request to a localhost Node.js server. So I turned to ChatGPT. This is the first time I ask it to help me solve a problem. And help it did!</p> <p>ChatGPT to the rescue!</p> <p>Making an HTTP POST request using Postman. At the bottom you can see the signature that the Zoom authentication server returns. Thanks ChatGPT!</p> <p>The example works on its own.</p> <p>For this example to work you need to get a special authentication repo, which runs a node js server that listens. You go to Zoom Marketplace and get developer credentials and put them into the code in this repo and run the node server. Then when you press Join Meeting on the FMCU website, the website sends a message to the authentication server and gets a passkey, and then logs you into Zoom automatically.</p> <p>Now it's in a sidebar!</p> <p>I added the Zoom Meeting SDK JavaScript code, but the button doesn't work.</p> <p>I took to Mattermost and showed the non-working \"Join Meeting\" button to \u00de\u00f3rarinn and Fran. Fran replied with this:</p> <p></p> <p>So I looked at the two CSS files in the FMCU repo and saw two instances of a hyperlink having the .repo CSS class. So I gave the Zoom code the .repo CSS class and ran the Node server:</p> <p>It works! Wow, I didn't really expect that.</p> <p>I can even move the window around.</p> <p>Now I need to connect this to a physical circuit. I'm looking into how the FMCU button uses MQTT to send a message to the Node server. I'm also looking for a way to do serial communication using Node. </p>"},{"location":"assignments/week14.html#design-files","title":"Design files","text":"<p>Here's the code with instructions on how to run it locally:</p> <p>Link to the FMCU-Zoom repo</p>"},{"location":"assignments/week14.html#visualizing-a-light-sensor","title":"Visualizing a light sensor","text":"<p>I experimented with creating a computer interface for the light sensor that I made in Input Devices week. The code that runs on the Xiao is very simple. It comes from Adri\u00e1n Torres. The code uses analogRead to read the value from the IR sensor and then writes it to the serial port:</p> <p>I used a few different Python scripts to receive the IR light values from the serial port. First I tried Neil's hello.light.45.py code but it reads single characters from the serial port and I had programmed the Xiao to send whole lines at a time. I stopped there with Neil's code.</p> <p>Then I found a nice tutorial showing how you can list the available COM devices in the terminal, pick one by typing its number, and open it using serial.tools. </p> <p>Once the serial port is open, I run an infinite while loop and read one line from the serial port at a time, decode it using UTF-8 character encoding and then turn that string into an integer. I do the reading and converting in only two lines of Python code:</p> <pre><code>packet = serialInst.readline()\ny = int(packet.decode('utf'))\n</code></pre> <p>Then, to get a very rudimentary graphical representation going, I use an if statement and display one <code>-</code> if the value is between 0 and 100, display <code>--</code> if the value is between 100 and 200 and so on, up to 1000 (<code>----------</code>).</p> <p>As simple as it gets. This barely counts as a graphical user interface.</p> <p>I also tried to make a GUI using Tkinter. I found a useful code snippet in example 1 in this tutorial, which creates a small GUI window and displays a title and a red and green rectangle with empty space between them. It's static, but by using my y variable (the number that is streaming into the serial port) instead of hardcoded numbers, I can make the bar move.</p> <p>The static GUI example.</p> <p>I could get the Tkinter interface to run separately and I could also get a stream of data from the IR sensor separately, but I had trouble combining them. Apparently, the reason is that I have two infinite while loops and the one that comes first in the code blocks the other. While the code waits for input from the serial port, nothing else can happen. And while the interface is running, nothing else can happen. I couldn't figure this out using the examples that I found online.</p> <p>The following day I gave up and asked ChatGPT to change the code to make the two loops run concurrently. That resulted in code that ran, but I needed to make some changes to it. Only the grey bar was changing size between 0 and 1000 pixels, so I put 1000-y as the width of the black bar. That worked nicely. The interface was also sluggish, but I fixed that by changing <code>root.after(100, readFromSerial)</code> to <code>root.after(10, readFromSerial)</code>. Then there is a much shorter delay for updating the interface. </p> <p>We have a GUI that runs smoothly.</p>"},{"location":"assignments/week14.html#design-files_1","title":"Design files","text":"<p>Download IR sensor Arduino code</p> <p>Download Python terminal visualization code</p> <p>Download Python GUI code</p>"},{"location":"assignments/week14.html#possible-interface-tools-for-my-robot-arm","title":"Possible interface tools for my robot arm","text":"<p>I've looked into many ways of making an interface for a robot arm. Highlights include:</p> <ul> <li>Python Tkinter: This is what I used to make the simple interface for my IR sensor. Quite simple and works well.</li> <li>PyQt5: These are Python bindings for the powerful Qt5 interface library. Many, many desktop applications are built on Qt5, including CAD software. It's possible to build a standalone application using this library.</li> <li>ROS: The standard library to control all kinds of robots. Used extensively in reasearch and industry, very full featured but difficult to get into.</li> <li>Modular Things: A really nice web interface that works with Jake Read's OSAP network layer (which runs on the microcontrollers). You plug all sorts of Modular Things into USB ports, they pop up in the web interface, it knows what they are and then you write short JavaScript codes to make them interact and form complex machines. I really like this system but I've had trouble writing HTML and JavaScript code that works in it. It seems a bit different than plain HTML/JavaScript.</li> <li>Processing: Visual programming and device control for artists. It would be possible to make an interface using Processing, but I'm not very familiar with it. One plus is that it's popular in the Fab Lab community.</li> <li>P5.js: The JavaScript port of Processing, can connect to web cams and more using standard web protocols. This is one option if I want to create a browser-based interface from scratch. And hey- since it's JavaScript, I may be able to run it inside the Modular Things web interface.</li> <li>Python script in Blender: I've seen a few examples of robot control using Python scripting in Blender. Then you can animate a 3D model of the robot and have it act out those moves in real life. Nice.</li> <li>Python script in Fusion 360: Similar deal as in Blender, except I read online that the Fusion 360 Python version is a bit limited and constricted, and it's difficult to add Python libraries to it. But it should be possible.*</li> <li>Python script in FreeCAD: Similar to the other two I guess, but FreeCAD is a bit difficult to use.</li> <li>FreeCAD robot workbench: Just throwing this in here, haven't looked at it much.</li> <li>RoboDK: Industry standard user-friendly robot control software that works with lots of robots. Not free.</li> <li>Grasshopper: It should be possible to make a 3D model control a physical robot using Grasshopper, but I'm not familiar enough with it to try. Fab Academy students have made interfaces with their circuits using Grasshopper.</li> <li>WebSerial: The web standard that makes it possible for browser-based interfaces to control machines using serial ports. Mods Community Edition uses this and I think the Modular Things web interface does too. I use it in my simple two-motor control web interface.</li> <li>PyScript: My browser-based interface uses PyScript.  I like Python. It's nice. If I can use it to program the robot in a browser and even plot its joint positions using Matplotlib and possibly use computer vision libraries and stuff like that, then that is interesting.</li> <li>WebAssembly: WebAssembly is what makes PyScript work. The Pyodide environment takes a while to load, because it uses a WebAssembly version of CPython that you need to download every time you load the website. Loading time is the disadvantage, but the advantage is that now we can port lots of performant code written in languages like C and C++ and run them at near-native speeds in the browser without installing anything! I want to look into more WebAssembly packages in the future.</li> <li>ThreeJS: The standard JavaScript library for creating 3D graphics in the browser. I could potentially use this to display a 3D rendering of my robot in a web-based control interface.</li> <li>OpenCV: The standard open-source computer vision library. I would like to add a camera to my robot in the future so that it can detect objects and pick them up.</li> <li>Svelte: I read somewhere that this is a good framework for creating responsive web sites. I don't know much about it.</li> <li>Phew! This is a web server library written specifically for the Raspberry Pi Pico by Pimoroni. I got interested in it when I saw this tutorial on how to build a captive portal using MicroPython. A captive portal works like this: The Pi Pico emits a WiFi network signal. You connect your phone to that WiFi network and try to open any web page in your browser. The browser opens the web page that the Pi Pico is serving instead. That's what a captive portal means, you can't escape it! It's often used by hotels, so that you need to input a code or contact information into the captive portal before it allows you to browse the web freely. You can make a whole robot control interface in a captive portal using web technologies.</li> <li>Simplest Pi Pico web server: I also like this web server from Doctor Monk's DIY Electronics Blog.</li> <li>Streamlit: A really simple way to make a web site out of your Python calculation scripts. I tried the example and it ran locally on my machine. But it's quite narrowly focused and limited in what it can do.</li> <li>NiceGUI: Good name. This is similar to Streamlit, a simplified way to turn your Python code into a web site. Also limited in what kind of GUI elements you can use.</li> <li>CodeMirror: I discovered this when browsing the Hack Club GitHub repo. This is what powers the Sprig web-based programming interface. I guess that this is also used in the Modular Things web-based code editor. This is one way to enable users to write code to run on my robot.</li> <li>Chilipeppr: I discovered this many years ago, when Alden Hart came to Fab Lab Reykjav\u00edk in 2015 to introduce his sophisticated CNC motion controller TinyG, which is used in Bantam Tools CNC machines and more. He also made tehe 9-axis g2core. He showed us this nifty CNC control software with a 3D preview that runs in the browser. I still haven't tried it, though.</li> <li>Johnny-Five: A JavaScript robotic control framework. I haven't looked into it that much.</li> <li>Crossbar.io: Another web networking protocol for hardware devices.</li> </ul>"},{"location":"assignments/week15.html","title":"Wild Card Week","text":""},{"location":"assignments/week15.html#assignment","title":"Assignment","text":"<p>Design and produce something with a digital fabrication process (incorporating computer-aided design and manufacturing) not covered in another assignment, documenting the requirements that your assignment meets, and including everything necessary to reproduce it.</p> <p>See more info and recording of the lecture here.</p>"},{"location":"assignments/week15.html#vacuum-forming","title":"Vacuum forming","text":""},{"location":"assignments/week15.html#design","title":"Design","text":"<p>The annual Icelandic Fab Lab Bootcamp was held in Fab Lab Neskaupsta\u00f0ur in 2023. M\u00f3ses, the Fab Lab manager, showed me how to do vacuum forming with the Mayku FormBox.</p> <p>The Mayku Formbox is a basic 200x200mm vacuum forming machine. Its heating element goes up to 340\u00b0C You need to connect a vacuum cleaner to it for it to work. It works fine, but I think I would find it annoying to have to bring the vacuum cleaner every time I used the vacuum former.</p> <p>My first attempt.</p> <p>First I brought a rectangular 3D print with #FABLABISA inscribed on it. M\u00f3ses said that the object was rather small, the edges needed to be rounded and he also showed me examples of details similar to my text not coming through in the plastic sheet. </p> <p>Vacuum forming examples. Sharp corners and small details don't work well. The text J\u00d3L (Christmas) in the upper right corner doesn't come through at all.</p> <p>He also mentioned that circular things tend to work the best. That makes sense, the stretching will be uniform and there are no corners where creases can form in the plastic sheet. I decided to go with the Fab Lab logo instead. I rounded the chocolate button shape and the logo as much as the geometry would allow, and showed M\u00f3ses a finished print. </p> <p>I used a Mayku Clear Sheet, which is made of PETG and is food safe. The official Mayku sheets are not cheap.</p> <p>Now that's a better candidate for vacuum forming.</p> <p>This should work nicely, said M\u00f3ses, but there is a question whether the pocket in the middle will be rendered in the plastic sheet. I decided to try making holes in the middle to let the air out.  printed four versions of buttons with holes in the middle, for a total of five buttons:</p> <ol> <li>No holes </li> <li>1.5 mm holes</li> <li>2 mm holes</li> <li>2 mm holes with small holes in the three smallest crevices</li> <li>2 mm holes with rectangular holes in the three smallest crevices.</li> </ol> <p>Buttons with holes added to draw vacuum through the center of the part.</p>"},{"location":"assignments/week15.html#design-files","title":"Design files","text":"<p>Here's the Fusion model of the Fab Lab chocolate button:</p> <p>Download failed #FABLABISA chocolate Fusion 360 model</p> <p>Download chocolate button Fusion 360 model</p>"},{"location":"assignments/week15.html#3d-printing","title":"3D printing","text":"<p>Completed 3D prints.</p>"},{"location":"assignments/week15.html#vacuum-forming_1","title":"Vacuum forming","text":"<p>When the prints were complete, we connected a vacuum cleaner to the FormBox and heated it up. M\u00f3ses told me that the sheet needed to be heated up until it droops 2 or 3 cm down. Then it's soft enough to form. </p> <p>Sheet is hot and drooping and ready to form.</p> <p>Then the handle locks are released and the frame with the sheet is quickly lowered onto the bed containing the 3D printed positive forms. The vacuum is held for a minute or two and the sheet is allowed to cool down a bit. Then it's ready! </p> <p>Done!</p> <p>To my surprise, all the forms came out well. Apparently the tiny crevices in the logo were enough to get the air out of the middle part. The button with no holes actually came out the best!</p> <p>Better label both the buttons and the sheet to remember which is which.</p> <p>I tried measuring the depth of the pocket in the middle of each button with a caliper and they seemed to be the same, whether there were holes in the forms or not.</p> <p>Measuring the depth in the middle.</p> <p>I like vacuum forming but its applications are limited. It would be nice to host a short class on chocolate mold making here at the Fab Lab, but I don't know what else I would use the vacuum former for. Mostly it's used to make packaging, and I don't make any packaging.</p>"},{"location":"assignments/week15.html#chocolate-casting","title":"Chocolate casting","text":"<p>I followed instructions from the Icelandic newspaper Morgunbla\u00f0i\u00f0, so they may not be useful to you.</p> <p>First melt the chocolate slowly in a water bath. Don't let any water get into the chocolate! You heat it up to 50\u00b0C.</p> <p>Melting the chocolate.</p> <p>Then you let the temperature drop to 42\u00b0C and you add a third of the same kind of chocolate (chopped) to the pot. Stir it into the melt.</p> <p>Chopping the rest of the chocolate.</p> <p>Putting the chopped chocolate into the pot.</p> <p>Then you let the temperature drop down to 32\u00b0C. Now the chocolate is tempered and you can pour it into the molds.</p> <p>Pouring into the molds.</p> <p>I also shook the molds to flatten out the bottoms of the buttons.</p> <p>And here they are, lined up with the 3D prints that created them.</p> <p>Row of chocolate Fab Lab buttons. They all came out well. I would skip the holes in the middle next time.</p> <p>Now it's time for testing. Is the chocolate tempered or not?</p> <p>I suspect that my next attempt may be more successful, since I won't have to take pictures and videos while I try to get the temperature profile right.</p>"},{"location":"assignments/week15.html#further-experimentation","title":"Further experimentation","text":"<p>It would be interesting to try printing the original Fab Lab button model with an increased distance between the 3D printed lines. I think that would make it possible to draw vacuum through the part without having to draw holes manually. And the top surface texture might be nicer, too.</p>"},{"location":"assignments/week15.html#update","title":"Update","text":"<p>The meat thermometer that I used isn't very precise. I then found this tutorial, which describes a method to temper chocolate without a thermometer, using a microwave. This was quick and easy, and the Fab Lab chocolate buttons snap apart!</p> <p>Success!</p>"},{"location":"assignments/week15.html#fpga-field-programmable-gate-array","title":"FPGA (Field-Programmable Gate Array)","text":"<p>The Runber FPGA board. I think the program is supposed to blink the eight LEDs above the FPGA chip, but the tutorial isn't entirely clear about it.</p>"},{"location":"assignments/week15.html#why","title":"Why","text":"<p>I've been curious about FPGAs for some time, for four reasons:</p> <ol> <li>I took the course Computer-Controlled Hardware in engineering school at the University of Iceland. One of the lecturers is an FPGA designer at the prosthetic company \u00d6ssur. He showed how the company's Power Knee has developed over the years from a large, complicated circuit board with lots of components to a much smaller footprint, essentially containing only a microcontroller and an FPGA. The FPGA can contain any digital circuitry, which is really interesting.</li> <li>My wife gave me the book Einstein's Shadow for Christmas a few years ago. It's an entertainingly written account of the quest to photograph a black hole. It involved extremely high-speed FPGA chips which made the Event Horizon Telescope possible.</li> <li>The astonishing optical encoder in the Dexter robot arm. Check it out.</li> <li>In the 2023 Fab Academy Student Bootcamp, Krisjanis Rijnieks mentioned that ordinary people now have the opportunity to design digital chips and have them made, using open source toolchains like Google Silicon. Google also offers the Open MPW program which is a lottery where you can submit your chip design and if you're lucky, Google will pay for the chip fabrication. I also discovered the Zero to ASIC course from Matt Venn, where he teaches people to design Application Specific Integrated Circuits from scratch and has them manufactured for them. Exciting stuff! Chips are designed using VDHL or Verilog, which are hardware description languages. You also use these languages to program FPGAs. Before committing a chip design to manufacturing, people usually test it on an FPGA.</li> </ol> <p>In Wild Card Week, I thought to myself: If I don't try an FPGA now, I probably never will. For this week, I ordered the cheapest FPGA board that I could find ($30) that still has a set of tutorials available, the Gowin RUNBER board from Seeed Studio.</p>"},{"location":"assignments/week15.html#how","title":"How","text":"<p>An FPGA is a circuit that you design with a hardware description language. The unit of computation is is one bit, which can be a 1 or a 0. The FPGA consists of lots of Look-Up Tables (LUTs), which specify what happens when ones or zeros enter them. These LUTs form logic gates which can be combined to make any circuit, even a whole ARM microcontroller! Indeed, many FPGAs are programmed to contain a microcontroller core as well as additional digital ciruits. The Gowin GW1N-4 on my board has 4608 LUTs with four inputs each.</p> <p>I managed to get a license by sending an email to Gowin customer service and then I followed the first tutorial in this PDF. The circuit blinks eight LEDs, one at a time. In Gowin FPGA Designer, I created a new project:</p> <p></p> <p>I selected FPGA Design Project:</p> <p></p> <p>And then I selected my FPGA chip:</p> <p></p> <p>I got a summary of the project settings before finishing the setup:</p> <p></p> <p>Now I had a new FPGA design project. So far so good:</p> <p></p> <p>I created a new Verilog file and pasted the code from the tutorial. Then I clicked Synthesize:</p> <p></p> <p>That seemed to work OK. Then I went into Tools -&gt; Floor Planner to see how the circuit looked inside the FPGA. I got an error. Then I looked a little further in the tutorial and found that I needed to create a constraints file, where I specify which pins I'm using and what they are. I went into File -&gt; New, selected Physical Constraints File and gave it the name constr.cst:</p> <p></p> <p>I just copied the code from the tutorial and pasted it into the constraints file. This is how it looks in the editor:</p> <p>The constraints file defines eight output pins that are supposed to turn eight LEDs on, one at a time.</p> <p>Now I could go into Tools -&gt; Floor Planner. I got a graphical representation of the chip. I would expect eight pins to be highlighted in blue, but only six pins are highlighted. But I wouldn't know how to fix the code, and the messages in the terminal seemed positive:</p> <p></p> <p>So I soldiered on. I selected the I/O Constraints at the bottom of the window and got a list of the constraints that were defined in the .cst file:</p> <p></p> <p>The third and final file I needed to create before programming the FPGA was a timing constraints file. In FPGAs, everything is counted in clock cycles, and you need to define the clock frequency. I opened the Timing Constraints Editor:</p> <p></p> <p>There I created a Timing Constraints file with a period of 83.333 nanoseconds and a frequency of 12 MHz:</p> <p></p> <p>The timing constraints file only contains a single line of code specifying the clock speed:</p> <p></p> <p>Then I selected Run Place and Route. That's the button with four colored squares that looks a bit like the Windows icon. I got a bunch of <code>Generate file completed</code> messages in the terminal, which seemed promising:</p> <p></p> <p>If you look again at the image above, you can see the mouse hovering over the Programmer icon, which is a green downward arrow. I now pressed it and hoped for the best. I have no idea what I am doing.</p> <p></p> <p>The programmer found a USB device, so I clicked Program/Configure. Here the tutorial ends, but I still needed to make some selections. I found the manual for the Programmer in the Gowin software directory and followed instructions that told me to select Embedded flash mode and select the .fs programming file in the dialog:</p> <p></p> <p>When I clicked Save I got an error:</p> <p></p> <p>This seems like a simple error, all I have to do is select the right chip. I tried selecting all the chips that have similar names to mine (GWIN-4, GWIN4B, GWIN-4D and all their versions). I had to select the chip both in the Floor Planner and in the Programmer. But nothing worked. I don't know where to go from here, so I'll stop. </p>"},{"location":"assignments/week15.html#design-files_1","title":"Design files","text":"<p>Download Gowin FPGA program files</p>"},{"location":"assignments/week16.html","title":"Applications and Implications","text":""},{"location":"assignments/week16.html#assignment","title":"Assignment","text":"<p>Propose a final project masterpiece that integrates the range of units covered, answering:</p> <ul> <li>What will it do?</li> <li>Who's done what beforehand?</li> <li>What will you design?</li> <li>What materials and components will be used?</li> <li>Where will come from?</li> <li>How much will they cost?</li> <li>What parts and systems will be made?</li> <li>What processes will be used?</li> <li>What questions need to be answered?</li> <li>How will it be evaluated?</li> </ul> <p>Your project should incorporate </p> <ul> <li>2D and 3D design,</li> <li>additive and subtractive fabrication processes,</li> <li>electronics design and production,</li> <li>embedded microcontroller interfacing and programming,</li> <li>system integration and packaging</li> </ul> <p>Where possible, you should make rather than buy the parts of your project.</p> <p>Projects can be separate or joint, but need to show individual mastery of the skills, and be independently operable.</p> <p>See more info and recording of the lecture here.</p>"},{"location":"assignments/week16.html#final-project-proposal","title":"Final project proposal","text":""},{"location":"assignments/week16.html#what-will-it-do","title":"What will it do?","text":"<p>Baksi will be a small, light and nimble SCARA-type robot arm with a structure made of PCBs (with 3D printed additions to stiffen the structure) and powered by brushless gimbal motors with angle sensors. It will be a motion platform that I will add end effectors to later. Its purpose is to teach robotics and perhaps automate some small tasks. I first called it Baks, but then I noticed that my son always asked if I was working on Baksi. The original plan was to make a traditional robot arm as shown in the sketch above, but that would involve balancing out the weight of the arm with springs. So to simplify the project I switched to a horizontal SCARA layout.</p>"},{"location":"assignments/week16.html#who-has-done-what-beforehand","title":"Who has done what beforehand?","text":"12345678910111213141516171819 <p>This robot arm sketch by Masoud Akbarzadeh inspired the shape of spiral 1 of my robot arm joint.</p> <p></p> <p>Avishek Das made a small RC servo robot arm with a really nice simulation interface. I just don't like the jerkiness and imprecision of RC servos.</p> <p></p> <p>Dan Chen made a clean-looking modular robot that can grab sushi. It's also based on RC servos.</p> <p></p> <p>A group at Fab Lab Oulu made a cardboard robot arm in machine week in 2020. It's also based on RC servos.</p> <p> </p> <p>Hiroaki Kimura made a simple RC-servo arm and controlled it with a smaller arm with potentiometers in the joints.</p> <p></p> <p>Kenny Phay Ngiap Peng made a stepper and RC-servo robot arm.</p> <p></p> <p>A group at Fab Lab IED Madrid made a stepper-based SCARA arm in Machine Week in 2019.</p> <p></p> <p>A group at Super Fab Lab Kochi made a nice stepper based SCARA arm in Machine week 2023.</p> <p></p> <p>Jules Topart made a promising robot joint actuator.</p> <p> </p> <p>Xiaomeng Liu made a very nice iPhone camera gimbal with brushless motors. These are the actuators I want to work with and this is the smoothness of motion that I want. Light and nimble, like a gimbal!</p> <p></p> <p>Christian Schmidt made a very compact GoPro camera gimbal but it was a little jittery.</p> <p> </p> <p>Adam B\u00e4ckstr\u00f6m hacked hobby servos in an amazing way and created a super-precise robot arm. His simple optical encoder design is inspiring.</p> <p></p> <p>A fellow with the username Pinaut created a surprisingly smooth-moving rc servo arm with a learning function.</p> <p></p> <p>The electronics blogger Electron Dust created this simple stepper robot arm with a learning function. I love the look of the arm, it's inspiring.</p> <p></p> <p>Youtube user \u7a1a\u6656\u541b created the most sophisticated DIY robot arm I've ever seen. It's incredible, but also impenetrable. I mean, it is open source but I wouldn't know where to begin trying to understand any of the design files.</p> <p>Image credit Datatang.</p> <p>John Lauer created a geared stepper robot arm which is really sleek. More interesting to me, he also created a geared brushless motor robot arm. John also created Chilipeppr, which I talk about in Interface and Application Programming.</p> <p></p> <p>Damian Lickindorf created Atlas, a crazy cool robot arm which also looks crazy complicated to build. Ooh look, he's using ROS and Moveit for motion planning:</p> <p></p> <p>The MeArm is probably the best open source DIY kit for beginner roboticists. I'd like my robot arm to move more smoothly and be a bit more capable than this arm.</p> <p></p> <p>The AR4 is probably the best open source DIY kit for more advanced roboticists. I think the world hasn't quite caught up to its significance. I think it's important, in the way that the RepRap is important. I'd love to build one some day. I want my robot arm to be smaller and less expensive than this arm.</p> <p></p> <p>More robot arm inspiration (I had to split this up because the image carousel couldn't handle more than 20 entries):</p> 20212223242526272829303132333435 <p>Skenkir. This was a university project with Gu\u00f0j\u00f3n Bergmann and Baldur Bj\u00f6rnsson. Our task was to lift a wine glass and give the professor a sip. And because I'm Gyro Gearloose's biggest fan, I wanted the robot to have a hand in a white glove.</p> <p></p> <p>The uArm from Ufactory. My plan was to make it fry doughnuts, but then I accidentally fried its control board.</p> <p></p> <p>The Nyrio One. We borrowed this one from Kar\u00edtas in Fab Lab Sau\u00f0\u00e1rkr\u00f3kur and I had a lot of fun with it until it got stuck trying to make a move and fried a motor control board. I replaced it and we returned it to Sau\u00f0\u00e1rkr\u00f3kur. I vowed to make my robot arm incapable of damaging itself!</p> <p></p> <p>The Dexter robot arm by Haddington Dynamics is the original reason why I wanted to make a robot arm. It was open source in the beginning, but not anymore. Their hyper-precise optical encoder design is phenomenal, there's nothing else like it in the world. They use this advanced sensor to  create precise motion from imprecise parts, which is exactly what we need for a proper robotics revolution, in my opinion. I'd love to try to make something like their optical encoder using a microcontroller instead of an FPGA. Dexter costs $15.000 now and is probably worth it, but it's still inaccessible to most people. Had I known about their Kickstarter, I would have thought seriously about the $2000 early bird kit.</p> <p></p> <p>The KUKA-style stepper robot arm from Youtube user ZeroBacklash is a really clean build. When it's ready, they will sell the design files.</p> <p></p> <p>The Mirobot is another clean build, but it's not open source. Coy Beardmore managed to make the robot solder circuit boards.</p> <p></p> <p>Skyentific. His video on brushless motors is a major reason why I chose to use brushless motors in my robot arm.</p> <p></p> <p>Ben Katz created the MIT Mini Cheetah. His bilateral teleoperation video is just an intermediate stage in the build, but it's still the best example of a haptic interface between robots that I've seen.</p> <p></p> <p>This is the first BLDC control system that I tried to build, but it was too complicated for me to replicate. Check out the project's Hackaday.io page.</p> <p></p> <p>Juan Pablo at Random Access Projects has excellent videos on sinusoidal BLDC control. This was the first BLDC control system that I managed to get working. I supported his Patreon page and got access to his Arduino code. In this video he demonstrates his own BLDC control board that uses three half-H-bridge chips instead of a ready-made brushless motor driver chip. This might be an interesting direction for spiral 3 of my robot arm.</p> <p></p> <p>SimpleFOC Community user Valentine has designed some interesting BLDC control boards. Of interest to me are the Mosquito (which contains a knockoff of the DRV8313 motor driver that I'm using) and the Lepton 1.0, 2.0  and 3.0.</p> <p>The Lepton 1.0 field-oriented control board for brushless motors.</p> <p>Shay Sackett has one of the smoothest slow control demos of a brushless motor that I've seen:</p> <p></p> <p>Mizuhai Yukkie created an interesting small BLDC driver board that works with the SimpleFOC library:</p> <p></p> <p>The blog Berryjam posted a BLDC motor being driven at super slow speeds with an L6234 driver chip (too bad they aren't available now). The blog post has good graphs of different BLDC motor control techniques.</p> <p></p> <p>Youtube user RoTechnic made a Bowden tube robot arm. The stepper motors are not on the arm but on the table, which makes the robot much, much lighter and able to lift more weight. The motor movements and forces are routed to the arm joints with strings that go throught plastic tubes, just like the brakes lines on a bicycle. It works remarkably well, I can see this being a popular design in hobby robot arms soon and quite possibly in small professional robots as well.</p> <p></p> <p>Hackaday user Xavi Cano made an educational five-bar parallel robot:</p> <p></p>"},{"location":"assignments/week16.html#what-will-you-design","title":"What will you design?","text":"<p>A robot joint controller board that I can replicate to make all the joints on the robot. I'll also design a 3D printed part that hides all the wires.</p>"},{"location":"assignments/week16.html#what-materials-and-components-will-be-used-where-will-they-come-from-how-much-will-they-cost","title":"What materials and components will be used, where will they come from, how much will they cost?","text":"Part Part no. Amount Price (USD) Total (USD) Link GM2804 Gimbal Motor w/Encoder G006983_2 3 38.99 116.97 https://shop.iflight-rc.com/ipower-gm2804-gimbal-motor-with-as5048a-encoder-pro288 Gimbal Motor Slipring - OD 6.5mm G006983_2 2 15.99 31.98 https://shop.iflight-rc.com/6-5mm-slipring-for-ipower-motor-gm2804-gimbal-motor-pro302?search=Gimbal%20Motor%20Slipring%20-%20OD%206.5mm Yoctopuce Micro-USB-Hub-V2 MHUB0002 1 32.4 32.4 https://www.yoctopuce.com/EN/products/extensions-and-networking/micro-usb-hub-v2 Pololu Adjustable 4-12V Step-Up/Step-Down Voltage Regulator S18V20ALV 1 37.95 37.95 https://www.pololu.com/product/2572 ATSAMD21E18A-AUT ATSAMD21E18A-AUTTR-ND 3 4.23 12.69 https://www.digikey.com/en/products/detail/microchip-technology/ATSAMD21E18A-AUT/4878871 DRV8313PWP 296-35540-5-ND 3 4.81 14.43 https://www.digikey.com/en/products/detail/texas-instruments/DRV8313PWP/3790947 PLA filament 10 Total 256.42"},{"location":"assignments/week16.html#what-parts-and-systems-will-be-made","title":"What parts and systems will be made?","text":"<p>I will make the control boards and 3D printed structure.</p>"},{"location":"assignments/week16.html#what-processes-will-be-used","title":"What processes will be used?","text":"<p>PCB milling, 3D printing.</p>"},{"location":"assignments/week16.html#what-questions-need-to-be-answered","title":"What questions need to be answered?","text":"<p>Can I find an Arduino core for the SAMD21 that both the OSAP and SimpleFOC libraries can compile to? Can these two libraries coexist on the same microcontroller? Can I get the closed loop control working? Can I tune the PID? Can I mill the fine traces for the SAMD21 microcontroller and the DRV8313 brushless motor driver? Can I design such a complicated board?</p>"},{"location":"assignments/week16.html#how-will-it-be-evaluated","title":"How will it be evaluated?","text":"<p>If I manage to get one robot joint working, then I consider the final project a success. I will keep working on the robot after the final presentation.</p>"},{"location":"assignments/week17.html","title":"Invention, Intellectual Property and Business Models","text":""},{"location":"assignments/week17.html#assignment","title":"Assignment","text":"<ul> <li>Develop a plan for dissemination of your final project</li> <li>Prepare drafts of your summary slide (presentation.png, 1920x1080)<ul> <li>and video clip (presentation.mp4, 1080p HTML5, &lt; ~minute, &lt; ~10 MB)</li> <li>and put them in your root directory</li> </ul> </li> </ul> <p>See more info and recording of the lecture here.</p>"},{"location":"assignments/week17.html#license","title":"License","text":"<p>At the bottom of every page on this website, I claim my copyright over the work that I\u00b4ve done in the Fab Academy. I want to choose a permissive license for the work, all I want is to be mentioned if you use part of it in your own project. I thought about one of the Creative Commons licenses, but then I found that Creative Commons don't recommend their licenses for software or hardware. Others that may apply are the MIT license for software and the CERN open hardware license. This is a jungle, and I'm a bit confused. And if I choose a licence, I'll need to include it with all my design files. I don't have time for that right now. </p> <p>Maybe the \"Fab Lab license\" that Neil Gershenfeld puts in all his software files on the Fab Academy website would be a good license for my work. But again, I am already stretched to my limits trying to finish all the assignments and the documentation; I can't also go back and modify all the design files to include a license. I can only work from nine in the morning to midnight for so long. I need to see my family at some point.</p> <p>So for now, the work is copyright, and all rights are reserved. I will revisit this in the near future (I'll review choosealicense.com and Open Hardware Licenses) and see how I can best open the work up for others to use. Feel free to contact me at \"svavar at fabisa dot is\" to get permission to use the stuff I've made.</p>"},{"location":"assignments/week17.html#funding-plan","title":"Funding plan","text":"<p>I'm not going to start a company around this little robot. But I have applied for and received two grants to develop it. </p>"},{"location":"assignments/week17.html#grant-1","title":"Grant #1","text":"<p>I applied for the first grant three months before the Fab Academy started. I had been thinking about final projects for a full year, because I was so excited about entering the Fab Academy. I really wanted to make something cool. Then when the deadline for the Icelandic Technology Development Fund rolled around, I had done quite a bit of thinking and I used that thinking to send in an application for the smallest grant of one million ISK (about $7000). And I got it! I used that grant to buy all the parts that I thought I would need for the arm, including molding and casting supplies to make precise gearboxes. The parts that I bought came in very handy, not all of them, but the rest will be useful to future Fab Academy students.</p>"},{"location":"assignments/week17.html#grant-2","title":"Grant #2","text":"<p>The second grant was from the Icelandic Student Innovation Fund. I got funds to employ a university student for the summer to develop an interface for the robot in the Robot Operating System (ROS). That student is Gu\u00f0j\u00f3n Bergmann, a friend from engineering school. Many of his buddies at TU Delft are looking into ROS, so this project will be good for him. Fortunately I've managed to build the arm just in time for his summer project to start.</p>"},{"location":"assignments/week17.html#dissemination-plan","title":"Dissemination plan","text":"<p>I've thought a lot about how to make my robot arm. But I haven't thought much about how to make sure that it reaches its intended user group. Who is its intended user? Someone like me who is interested in robotics, I guess? High school and university students, engineers, technology enthusiasts, computer science majors who want to program physical things and make them move? Who are they and where do they hang out online?</p> <p>How do I reach these people? I don't know. That's the part I'm not very good at. Do I set up a website? I guess I could let people in the Fab Lab community know about the project and see if anyone wants to buy an arm to use in their classes. But this is quite a tricky board to mill. And I could show the robot in the SimpleFOC community, except there everybody wants to build their own robot in their own style from scratch. I have a vague dream of asking Seeed Studio if they would be interested in selling populated boards in their online store as an easy way to get into robotics. I don't know.</p> <p>Maybe if the project gets featured in an article on Hackaday. Yes, that might be the right audience.</p>"},{"location":"assignments/week17.html#presentation-files","title":"Presentation files","text":"<p>I made a final project presentation slide and video under Presentation.</p>"},{"location":"assignments/week18.html","title":"Project Development","text":""},{"location":"assignments/week18.html#assignment","title":"Assignment","text":"<ul> <li>Complete your final project, tracking your progress:<ul> <li>what tasks have been completed, and what tasks remain? </li> <li>what's working? what's not?</li> <li>what questions need to be resolved?</li> <li>what will happen when?</li> <li>what have you learned?</li> </ul> </li> </ul> <p>See more info and recording of the lecture here.</p>"},{"location":"assignments/week18.html#progress-on-the-final-project","title":"Progress on the final project","text":"<p>The final project plan.</p>"},{"location":"assignments/week18.html#what-tasks-have-been-completed","title":"What tasks have been completed?","text":"<p>I managed to put together one robot joint and test it successfully. I'm really glad that I got this far.</p> <p>Because my teaching duties were over for the semester, I was finally able to document as I went along. I found that enjoyable, and the final project documentation is much better for it. I will definitely aim for real-time documentation in my projects from now on.</p> <p>I approached the project in spirals, just trying to make one robot joint work. In the first spiral I took the Stepper RP2040 Modular Thing, changed its shape and added a few things. I did a lot of testing and debugging and found that the Toshiba TB67H451FNG motor drivers are not a good fit for brushless motors. That was quite a big blow, because I had spent a lot of time designing that board. But Rico Kanthatham urged us to make the major mistakes in our final project early, and I had done that. I did spiral 1 of my final project in Output Devices week (and two more weeks after that). So I still had time to find another motor driver and start the electronics design again from scratch.</p> <p>The evolution of my PCB design skills can be seen in these four boards: </p> <p>My PCB design journey. Right-click the image and select \"Open image in new tab\" to see the boards better.</p> <ol> <li>My first board was very simple; it had just a Xiao module, an LED with a current-limiting resistor and a button. It was a good first design project and I was so happy when I got the LED blinking! </li> <li>My first major design was the machine controller for the Teamanator, the Terminator-inspired tea machine that Andri, Hafey and myself finished successfully during an intense weekend in Fab Lab Reykjav\u00edk. </li> <li>My second major design was spiral 1 of my robot joint, which embeds a Xiao module onto the board. </li> <li>In spiral 2 I wanted to go further, so I embedded the SAMD21 chip directly onto the board, which I think is much cooler. I had the confidence to do that because I had played around with the RGBB Modular Thing and managed to program it with the Atmel-ICE. I think I've come a long way, because I had not designed an electronic circuit before starting the Fab Academy.</li> </ol>"},{"location":"assignments/week18.html#what-tasks-remain","title":"What tasks remain?","text":"<p>I need to connect the second robot joint and try operating them together. The robot is also missing a Z-axis (up and down). While I've been finishing up the documentation of the weekly assignments, I've been thinking about ways to make a clean-looking Z-axis. I think I have a good solution, but it requires a hack (see \"What questions need to be resolved?\").</p> <p>I also need to make some kind of an end-effector. My instructor \u00de\u00f3rarinn helped me make an electromagnet, but in the final push, I had to do triage and decide which parts of the project needed to be abandoned and which ones I might finish. I put all my energy into getting the motor control board made and assembled with all the wires hidden.</p>"},{"location":"assignments/week18.html#what-has-worked-what-hasnt","title":"What has worked? What hasn't?","text":"<p>Everything I've tested in the final project works. I made sure of that before I assembled it. It was a bit of a risk to wait so long before actually fabricating anything. In the last Global Open Time meeting on the Saturday before I presented, I was milling the first board for my final project, and my final project still looked like this:</p> <p>Meme from \u00de\u00f3rarinn. The actual image is the first one in \u00de\u00f3rarinn's meme at the bottom of this page.</p> <p>This was my second major attempt at milling this board. The first time I used a 0.01\" milling bit, which broke after an hour of milling, in the middle of the night. You can see my reaction to that in my presentation video. Then I tried a V-bit, which is much stronger and more durable, but if you don't get the Z-height exactly right, the track that it mills will either be too thin or to thick. This may result in traces disappearing. While Global Open Time was still in session, the Modela MDX-20 finished milling with the V-bit:</p> <p>The moment I realized that I could finish my final project.</p> <p>I went to the video conferencing screen in the lab with my hands up in victory, and they guys celebrated with me.</p> <p>Look at those beautiful traces.</p> <p>As for the outcome of the final project: I love how you can see all the electronic components and yet the robot has a clean look and all the wires are hidden. All of them! That took a LOT of system integration work. The robot actually looks pretty much exactly like I envisioned it.</p> <p>However, assembling the robot was hell. Wires kept breaking and it was difficult to get them into the 3D printed part. I wouldn't want to do it like this again. This was spiral 2. In spiral 3, I want to design a multilayer PCB that contains all the wires that are currently hidden inside the 3D printed part. Then I can realize my original vision of a robot that is made of motors and PCB and nothing else! And it will still have a clean look! The prospect is exciting, but my goodness, this project is so much work. I really need a good summer holiday.</p> <p>Also, pretty much all the software interface work remains. I did receive a grant for my engineering buddy Gu\u00f0j\u00f3n Bergmann to do some work on that.</p>"},{"location":"assignments/week18.html#what-questions-need-to-be-resolved","title":"What questions need to be resolved?","text":"<p>Magnetic angle sensor placed off-axis. The PID loop still worked. If I move it a tiny bit further away from the middle, the motor goes haywire.</p> <p>Can I place the magnetic angle sensor far enough from the axis so that I can put a Z-axis leadscrew through the hole in the middle of the brushless motor? I've done a preliminary test with me holding the sensor off-axis, and it may work.</p>"},{"location":"assignments/week18.html#what-will-happen-when","title":"What will happen when?","text":"<p>Note about the final push from \u00de\u00f3rarinn. We signed it and everything. It's sitting on the espresso corner table that I made in Machining week. The espresso was quite well extracted (here's another reference image).</p> <p>Gu\u00f0j\u00f3n Bergmann, who is studying Aerospace Engineering at TU Delft, will make a mockup of the software interface, and possibly do some real-world testing this summer. His work will finish in the beginning of August. I don't know when I will have time to do more work on this project myself, but I really want to get my \"only motors and PCBs\" robot made at a PCB house. That would be so cool. But right now I'm on my last chance to write a Master's thesis in Mechanical Engineering this winter. So I'll probably focus on that in the fall of 2023.</p> <p>Gu\u00f0j\u00f3n Bergmann.</p>"},{"location":"assignments/week18.html#what-have-you-learned","title":"What have you learned?","text":"<p>Demand-side time management is a really important part of the Fab Academy, because if you just think about what you would like to accomplish and line those tasks up linearly, you will run out of time. The project must be designed with the time and energy you have in mind. Spiral development is also very useful to me. My instinct is to try to get all the way to a finished product in one giant leap, but spiral development, where you complete a rough and simple version first and then see if you have time for another complete spiral with more features, has much better results. As \u00de\u00f3rarinn said after I presented my final project, Fab Academy is really one big lesson in project management. However, I've never used Gantt charts or other detailed project management methods, because I like working in research and development, and there you never know where the road leads you or how long it's going to take.</p> <p>It's often possible to mock up a technical idea in a day or a weekend that you've been thinking about for years, and finally see if it's good or not. I've tried many things during the Fab Academy that I've been thinking about for a long time. And they're not as intimidating as they seemed. I've discovered the joy of distributed work on an open source community project (the Frankenstein MCU). Look! I figured out a way to add Zoom video conferencing to the FMCU and made nice instructions on how to run that version locally, for the other developers. This is my first time doing this sort of thing and I really like it. I've discovered a world of collaborators in the Fab Lab network.</p> <p>My instructor \u00de\u00f3rarinn has been very supportive throughout this journey and taught me many things, especially relating to electronincs. He is the resident meme master in the Fab Academy chat on Mattermost. Seriously, I think half of the memes on the meme channel came from him. He even made a meme just for me by rearranging the image series on my ideas page:</p> <p></p>"},{"location":"final-project/3d_design.html","title":"3D Design","text":""},{"location":"final-project/3d_design.html#basic-shape-study","title":"Basic shape study","text":"<p>Basic shape study. Since the arm is made of flat PCBs, I don't have many parameters to play with.</p> <p>Dimensions of the basic shape.</p> <p>I set the diameter of all the arcs to <code>d3</code>, which is the diameter of the first arc. I change that and the whole model updates.</p> <p>I eventually decided to make all the joints the same shape, because it's simpler and because when the big arcs go inward, there isn't enough room on the board for all the components. So here's the final 3D design:</p> <p>Here's baksi, the spiral 2 version.</p>"},{"location":"final-project/3d_design.html#design-files","title":"Design files","text":"<p>Download baksi spiral 2 concept Fusion 360 model</p> <p>Download 3D print with internal channels</p> <p>Download base</p>"},{"location":"final-project/build.html","title":"Build your own baksi","text":"<p>Here are instructions that you can follow to build your own baksi robot arm. This page is a work in progress.</p> Part Part no. Amount Price (USD) Total (USD) Link GM2804 Gimbal Motor w/Encoder G006983_2 3 38.99 116.97 https://shop.iflight-rc.com/ipower-gm2804-gimbal-motor-with-as5048a-encoder-pro288 Gimbal Motor Slipring - OD 6.5mm G006983_2 2 15.99 31.98 https://shop.iflight-rc.com/6-5mm-slipring-for-ipower-motor-gm2804-gimbal-motor-pro302?search=Gimbal%20Motor%20Slipring%20-%20OD%206.5mm Yoctopuce Micro-USB-Hub-V2 MHUB0002 1 32.4 32.4 https://www.yoctopuce.com/EN/products/extensions-and-networking/micro-usb-hub-v2 Pololu Adjustable 4-12V Step-Up/Step-Down Voltage Regulator S18V20ALV 1 37.95 37.95 https://www.pololu.com/product/2572 PLA filament 10 Total 256.42 <p>Here are all the electronic components you need to assemble one baksi board:</p> Id Designator Footprint Quantity Designation Supplier and ref 1 U1 TQFP-32_7x7mm_P0.8mm 1 SAMD21 ATSAMD21E18A-AUTCT-ND 2 U3 SOP65P640X120-29N 1 DRV8313PWP 296-35540-5-ND 3 SW1 Button_Omron_B3SN_6.0x6.0mm 1 Switch_Tactile_Omron B3SN-3112P 4 U4 SOT-223-3_TabPin2 1 Regulator_Linear_3.3V_1A_DiodesIncorporated AZ1117IH-3.3TRG1 5 D1 LED_RGB_CreeLED_CLV1A-FKB 1 LED_RGB_CreeLED_PLCC4 CLV1A-FKB-CK1VW1DE1BB7C3C3 6 D3 LED_1206 1 White LED 1206 QBLP650-IW 7 R18,R13,R19,R1,R7,R14,R16,R15 R_1206 8 0Ohm RC1206FR-070RL 8 R5,R2,R4,R3 R_1206 4 1kOhm RC1206FR-071KL 9 R11,R9,R8,R12,R6,R10 R_1206 6 10kOhm RC1206FR-0710KL 10 C4 C_1206 1 10nF 1206 component book 11 C10,C7,C5 C_1206 3 100nF 1206 component book 12 C6 C_1206 1 470nF 1206 component book 13 C2,C8 C_1206 2 1uF C3216X7R1H105K160AB 14 C1,C3 C_1206 2 10uF GRT31CC8YA106ME01L 15 C9 CP_Elec_D6.3mm_H6.1mm 1 100uF EEE-FN1E101UL <p>You need to make three of these boards to make a baksi robot.</p> <p>Here are all the electronic components that you need to make a sensing board for baksi:</p> Id Designator Footprint Quantity Designation Supplier and ref 1 M1 SeeedStudio_XIAO_RP2040 1 Module_XIAO-SAMD21 SKU   102010328 2 SW1 Button_Omron_B3SN_6.0x6.0mm 1 Switch_Tactile_Omron B3SN-3112P 3 D1 LED_1206 1 Red LED 1206 SML-LX1206IC-TR 4 R2 R_1206 1 10Ohm RC1206FR-0710RL 5 R1 R_1206 1 10kOhm RC1206FR-0710KL 6 R3 R_1206 1 10MOhm RC1206FR-0710ML <p>You need to make one sensing board.</p> <p>Download 3D print with internal channels</p> <p>Download base</p> <p>Download baks KiCAD project</p> <p>Download baks_joint2_traces.png</p> <p>Download baks_joint2_traces_exterior.png</p> <p>Download baks_joint2_holes_interior.png</p> <p>Download motor control code</p>"},{"location":"final-project/effector.html","title":"End effector","text":"<p>I asked my instructor \u00de\u00f3rarinn whether he could show me how to make an electromagnet, so that baks the robot arm could pick up small metal things. I expected to need to find a suitable iron core and wrap copper wire around it, and that it would be a half-day thing. I had no idea it could be a 5 minute thing!  </p> <p>\u00de\u00f3rarinn got a choke coil from the electronics inventory, tried a few different voltage and current combinations, and voil\u00e1! We can lift a small bearing ball!</p> <p>Then we tried soldering three choke coils together to see if the holding strength would increase:</p> <p>It did, you can't shake the ball off! But the current requirements might be too high for a USB port-powered robot.</p>"},{"location":"final-project/electronics.html","title":"Electronics Design","text":"<p>A completed Baksi board.</p> <p>Since both the SimpleFOC motor control library and the OSAP network layer library were able to compile onto the SAMD21 chip by pretending that it's an Arduino Nano 33 IoT, that's what I'm going with. Now I need to go into the schematic of this Arduino to see its pin definitions:</p> <p>The Arduino 33 IoT schematic. Let's see what we have here.</p> <p>The SPI communication wires from the AS5048 magnetic angle sensor are as follows:</p> <pre><code>black, pin 1, CSn\nblue, pin 2, CLK\nyellow, pin 4, MOSI\ngreen, pin 3, MISO\nred, pin 11, VDD5V\nwhite, pin 13, GND\n</code></pre> <p>SPI connections to the breadboard Modular Thing.</p> <p>Let's start with MOSI. That's pin PA16 on the Arduino Nano 33 IoT. I'll put the yellow wire there on the breadboard Modular Thing. Then MISO is pin PA19. I'll put the green wire there. Through all this tinkering I've learned that CLK is the same as SCK. That's pin PA17 and the blue wire goes there. Csn, or the chip select pin, can be assigned to any digital pin. I'll put on PA18 (the black wire). Then all that's left is +3.3 volts and ground.</p> <p>And here's the test:</p> <p>I'm getting an angle reading in the serial monitor! How cool is that?</p> <p>OK, let's connect the motor driver. For that we need PWM. According to the schematic above, the PWM pins on the Arduino Nano 33 IoT are as follows:</p> Arduino 2 3 5 6 9 10 11 12 16/A2 17/A3 19/A5 SAMD21 PB10 PB11 PA05 PA04 PA20 PA21 Not on schematic Not on schematic PA11 PA10 PB09 <p>On the the breadboard Modular Thing I only have access to PA pins. Let's try PA4, PA5 and PA10 for PWM and PA6 as the enable pin. In the Arduino code I'll set pins 6, 5 and 17 to output PWM and let pin 7 be the enable pin.</p> <p>After uploading the <code>angle_control.ino</code> sketch, the motor twitched a little bit and I got the following messages in the serial monitor:</p> <pre><code>MOT: Enable driver.\nMOT: Align sensor.\nMOT: Failed to notice movement\nMOT: Init FOC failed.\nMotor ready.\n</code></pre> <p>I must have mixed up some of the motor driver pins. Let's add my LED testing board to the circuit:</p> <p>No PWM on the brown wire.</p> <p>The enable pin turns on first (white wire) and then PWM starts on the yellow and orange wires. The brown wire (the third BLDC phase) gets no PWM signal. Aha! I still have digital pin 9 in the code, which applies to PA20! That's how I first wrote the code, but I then discovered that PA20 isn't broken out on the breadboard Thing. Alright, I'll change the third PWM pin from 9 to 17, which matches PA10, and see what happens.</p> <p>Now I'm getting PWM signals on all three phases, but the motor shakes like crazy. I wonder if I accidentally wired the phases in the wrong order. Nope, that isn't helping. I'll try removing the LED test board, since I'm done with that for now. And that was all it took! I have a smooth, responsive servomotor controlled by a bare SAMD21 chip! I won't upload a video of that, because my repository is getting quite big.</p> <p>This is it. Now I can design my board.</p>"},{"location":"final-project/electronics.html#pcb-schematic-design","title":"PCB schematic design","text":"<p>I added some electronic parts to a blank schematic. I used the RGBB Modular Thing as a reference design, to see which passive parts the microcontroller needs. I want to have an RGB status LED on the robot's 'forearm' and also a button to disengage the motors and record movements.</p> <p></p> <p>I can see that the Modular Things follow the SAMD21 datasheet and put a 10uF decoupling capacitor on VDDIN (the +3.3V input voltage) and a 1uF decoupling capacitor on VDDCORE (the 1.23V core logic voltage of the chip, provided by an internal regulator):</p> <p>I don't know what decoupling capacitors do, but it's nice to verify the design using this table in the microcontroller datasheet.</p> <p>Then I started on the motor controller. I used the SimpleFOC Mini as a reference design. One of the goals of the SimpleFOC Mini is to:</p> <p>Make it in a way to be a minimal working example for users that are interested to build their own boards based on the DRV8313 chip.</p> <p>-Antun Skuric, creator of the SimpleFOC library</p> <p>The SimpleFOC Mini is a two-layer board, but I want to make a one-layer board. Fortunately I'm not using all the pins on the motor controller, so I can simplify the design:</p> <p>The DRV8313 motor driver has a 3.3 V regulator to run a microcontroller, but it only supplies 10 mA, which is not enough for me. So I'll skip that pin.</p> <p>On second thought, after reading about the pins that I haven't been using, I'm changing my opinion. I would like to be able to </p> <p>The DRV8313 motor driver wasn't in the KiCAD library or in the fab library, but I found it on SnapEDA. But I quickly ran into a problem with it:</p> <p></p> <p>Pins 4 and 11 are superimposed. They are both VM, but on the SimpleFOC Mini schematic, they are connected differently. So I needed to right click the symbol and select Edit with Symbol Editor. Fortunately, all I had to do there was to move one of the pins:</p> <p></p> <p>I also moved the three superimposed GND pins apart, so that I could read the pin numbers.</p> <p></p> <p></p> <p>I used this layout example heavily when reviewing my design.</p>"},{"location":"final-project/electronics.html#pcb-routing","title":"PCB routing","text":"<p>I had to put eight jumper resistors in order to route this board on one layer. I also route the USB, power and SPI wires through the 3D printed layer that is sandwiched between the two PCBs in each joint. I look forward to redesigning the board for manufacturing at a board house, with 2-4 layers. That should make things considerably easier. But I am glad that I managed to design a version of the board that can be made in any Fab Lab on a single-layer PCB, because not everyone is skilled at making double-layer PCBs (myself included).</p> <p>Let's just put a wire that goes on the back side of the PCB. No one will know.</p>"},{"location":"final-project/electronics.html#pcb-design-review","title":"PCB design review","text":"<p>Now let me go over the schematic and PCB layout and see if everything checks out:</p>"},{"location":"final-project/electronics.html#microcontroller","title":"Microcontroller","text":"<ul> <li> USB (I didn't check whether the data lines are equally long. Let's hope for the best!)</li> <li> 3.3V regulator (PCB layout didn't match schematic, fixed now)</li> <li> Button</li> <li> RGB LED</li> <li> JTAG programming connector and associated passive components (Oh no: SWDCLK trace is routed under JTAG connector! Looking at the JTAG connector, this seems impossible. Time for another jumper resistor.)</li> <li> SPI connections to the magnetic angle sensor</li> <li> Decoupling capacitors for the microcontroller</li> <li> Rest of the microcontroller connections</li> </ul>"},{"location":"final-project/electronics.html#motor-driver","title":"Motor driver","text":"<ul> <li> Motor power input</li> <li> Power indicator LED</li> <li> FAULT, RESET and SLEEP on the motor driver</li> <li> Bulk capacitor and bypass capacitors for motor (One bypass cap wasn't connected to ground! Fixed now.)</li> <li> PWM signal wires between microcontroller and motor driver</li> <li> ENABLE wires and resistor</li> <li> Rest of motor driver connections (Two motor outputs routed under jumper resistor. Not good. The two VCC pins on the motor driver weren't connected together. They clearly need to be, according to the layout example. Fixed with a trace underneath the BLDC motor. Must remember to cut some vinyl to insulate the motor from this +10V power trace. The layout example has resistors going between ground pins. The SimpleFOC Mini schematic has no such resistors. It worked on the breadboard, so I'll skip the resistors. I've run out of room on the PCB! One more thing that I changed from the SimpleFOC schematic, is that I'm connecting COMPO to ground, as the motor driver datasheet shows. I also tried to connect NC to ground, but NC means Not Connected and it doesn't want to connect to anything. Both the datasheet and the SimpleFOC Mini schematic connect the +3.3V output from the motor driver to FAULT, RESET and SLEEP, to pull them up. I just don't have space for that. I'll just mill the PCB and if the 3.3V supply from the microcontroller doesn't do the trick then I'll just have to solder a wire to the board afterwards. Let's go!)</li> </ul> <p>I had to stop milling the board and start again, because I forgot one of the comments I made in the last item on the Motor driver checklist. A very important comment that I've now italicized. So I fixed the PCB layout as follows:</p> <p>I realized that after going through the checklist and making the necessary changes, I didn't need those two jumper resistors anymore. I was also able to move the VCC track out from underneath the motor.</p>"},{"location":"final-project/electronics.html#final-design","title":"Final design","text":"<p>The baksi robot joint schematic.</p> <p>The baksi robot joint PCB layout.</p>"},{"location":"final-project/electronics.html#pcb-production","title":"PCB production","text":"<p>My first attempt at milling the PCB failed, and I broke the smallest end mill (the 0.01\" one). I only have one left now. Looking back, I made the fundamental mistake of not making a small test of the most challenging aspect of the process. I'm going to try a V-bit now.</p> <p>When soldering the teeny tiny DRV8313 motor driver onto my beautiful board, I found that its legs are very thin and flexible, and so when you've fastened the driver to the big ground plane with a heat gun, you can bend the legs into place, as long as they're close to their intended copper pad.</p> <p>After soldering, I successfully put the bootloader on the SAMD21 chip and then programmed it with the SimpleFOC code. But I got no reading from the magnetic angle sensor and the serial monitor said that it detected no movement from the motor. The motor sounded weird.</p>"},{"location":"final-project/electronics.html#sensing-board","title":"Sensing board","text":"<p>I also made a sensing board for Baksi. It contains an endstop button for the Z-axis as well as a capacitive step-response proximity sensor, so that it can sense when a human gets too close, and stop moving. The big copper area on the board is the proximity sensor. The board has a Xiao SAMD21 module, which has nice analog-to-digital converters.</p> <p></p> <p></p> <p></p> <p>I had a little trouble finding the right pin names for the Seeeduino Xiao SAMD21. In the first place, when I first connected it, it was set up as a Seeeduino Femto. I couldn't find much info on that online. I tried uploading an Arduino sketch to it as a Seeduino Xiao SAMD21, but it got bricked and didn't show up on my computer anymore. Not in the Arduino IDE and not in Device Manager either. </p> <p>After a bit of Googling I found the solution to this problem. I shorted the connection between the RESET pads on one side of the Xiao's USB connector and it immediately appeared on my computer as a UF2 drive. I then tried uploading the same Arduino sketch to it as a Xiao Femto, and it worked.</p> <p>But what's the pinout of the Xiao Femto? I tried the Xiao SAMD21 pin numbers but they didn't work. I also tried my Blink all pins sketch, where I make every pin from 0 to 40 blink once and write its number to the serial monitor at the same time. </p> <p>I connected each pin to an LED on my LED debugging board to discover the pin numbers.</p> <p>But now the problem was that after uploading, the device disappeared and so I couldn't get data from it through the serial port. So I tried blinking the LED as many times as the number of the pin that I was testing, After a good wait, I counted twelve blinks on my red LED. Here's a video of my debugging method:</p> <p>I've discovered pin number 6!</p> <p>Here are all the pin numbers that I wrote down (I recorded a fourteen-minute long video and played it back to get all the pin numbers):</p> <p></p> <p>Is there a similarly simple way to find the pin numbers of my button and capacitive sensing pad?</p> <p>The sensing board is integrated into Baksi but it doesn't turn on. I seem to have misunderstood how the power works on the Xiao module. I thought that I could power it through the 5V pin, but that seems to only offer 5V out. I probably need to change the connections and power the Xiao through the USB connector. This is where Baksi's sensing board stranded.</p>"},{"location":"final-project/electronics.html#design-files","title":"Design files","text":"<p>Download baks KiCAD project</p> <p>Download baks_joint2_traces.png</p> <p>Download baks_joint2_traces_exterior.png</p> <p>Download baks_joint2_holes_interior.png</p>"},{"location":"final-project/embedded_programming.html","title":"Embedded programming","text":""},{"location":"final-project/embedded_programming.html#modular-things","title":"Modular Things","text":""},{"location":"final-project/embedded_programming.html#rgbb-thing","title":"RGBB Thing","text":"<p>To get into Modular Things, I first tried to get the rgbb board to work. I managed to put a bootloader onto the SAMD21E18A chip on the rgbb board. I downloaded edbg to C:\\code\\SAMD21, opened the Command Prompt there by typing <code>cmd</code> into the folder's address bar, and ran the following string of commands:</p> <pre><code>C:\\code\\SAMD21&gt;edbg-windows-r54 -bpv -e -t samd21 -f sam_ba_Generic_x21E_SAMD21E18A.bin\nDebugger: ATMEL Atmel-ICE CMSIS-DAP J42700061250 1.0 (SJ)\nClock frequency: 16.0 MHz\nTarget: SAM D21E18A (Rev D)\nErasing... done.\nProgramming.... done.\nVerification.... done.\n</code></pre> <p>Wow! It worked! That was exciting.</p> <p>Then I put the Fab SAM core on the SAMD21 in the Arduino IDE (first I put a different core on it and the COM port disappeared).</p> <p>I connected it to the computer, opened up the web interface and after a bit of coding the red LED turns on when I press the button!</p> <p>The RGB diode was very dim, so my instructor \u00de\u00f3rarinn took to the electronics workbench, tested it, replaced it with a new LED and discovered that the current-limiting resistors were 10kOhm instead of the recommended 1kOhm. I got to try the soldering tweezers for the first time and boy, are they handy for removing components from a board!</p> <p>\u00de\u00f3rarinn lighting up the diodes with the bench power supply.</p> <p>You just grab the part with the hot tweezers and it comes off!</p> <p>\u00de\u00f3rarinn explained diodes on the whiteboard and I discovered that I've had anodes and diodes backwards all these years! No wonder I was never particularly good at calculating electrical circuits. My wife also has this backwards. We think that the confusion comes from Chemistry class in school, because the anode on a chemical battery is not defined by which way the current is flowing, but by which type of reaction is going on there. The current goes in one direction when the battery is being charged and in the opposite direction when the battery is being discharged. But the anode and cathode don't switch places accordingly. I find this annoying.</p>"},{"location":"final-project/embedded_programming.html#design-file","title":"Design file","text":"<p>Download RGBB Modular Thing code</p>"},{"location":"final-project/embedded_programming.html#stepper-thing","title":"Stepper Thing","text":"<p>I was happy to get the rgbb board working, but then the stepper Modular Thing that I made suddenly stopped working. </p> <p></p> <p>I sent Quentin Bols\u00e9e the image above and asked him if he knew what the errors meant. But before he could reply, I remembered something that \u00c1rni Bj\u00f6rnsson had showed me. Apparently, the pin assignments have changed in the latest Modular Things code for the RP2040 board. I reverted them back to the original ones, and the stepper worked!</p> <p></p>"},{"location":"final-project/embedded_programming.html#design-files","title":"Design files","text":"<p>Download Stepper H-bridge RP2040 Modular Thing Arduino code</p> <p>Download svavar-rgbb.js</p>"},{"location":"final-project/embedded_programming.html#my-bldc-thing","title":"My BLDC Thing","text":"<p>I tried to make a BLDC Modular Thing using the instructions in the Modular Things repository. </p> <p>I added bldc to the list of constructors in ModularThingClient.ts.</p> <p>I also added this line to ModularThingClient.ts.</p> <p>I got an error that I couldn't figure out:</p> <pre><code>Parse failure: Unexpected token (3:33)\nContents of line 3: export default function bldc(name: string) {\nFailed to load url ../osapjs/osap (resolved id: ../osapjs/osap). Does the file exist?\n error   Parse failure: Unexpected token (3:33)\n  Contents of line 3: export default function bldc(name: string) {\n  File:\n    C:\\code\\modular-things-main\\C:\\code\\modular-things-main\\node_modules\\vite\\dist\\node\\chunks\\dep-5e7f419b.js:51642:15\n  Stacktrace:\nError: Parse failure: Unexpected token (3:33)\nContents of line 3: export default function bldc(name: string) {\n    at ssrTransformScript (file:///C:/code/modular-things-main/node_modules/vite/dist/node/chunks/dep-5e7f419b.js:51642:15)\n    at ssrTransform (file:///C:/code/modular-things-main/node_modules/vite/dist/node/chunks/dep-5e7f419b.js:51617:12)\n    at Object.ssrTransform (file:///C:/code/modular-things-main/node_modules/vite/dist/node/chunks/dep-5e7f419b.js:60941:20)\n    at loadAndTransform (file:///C:/code/modular-things-main/node_modules/vite/dist/node/chunks/dep-5e7f419b.js:39336:24)\n\nFailed to load url ../osapjs/osap (resolved id: ../osapjs/osap). Does the file exist? (x2)\n</code></pre> <p>I don't have more time to try to understand this system, so I'm going to leave it at that for now.</p>"},{"location":"final-project/embedded_programming.html#design-files_1","title":"Design files","text":"<p>Download failed BLDC Modular Thing code</p> <p>Here's the most promising step towards integration of SimpleFOC with OSAP (the networking layer that communicates with the Modular Things web interface). I managed to hard code a motor command in the Arduino code. It worked. This means that I don't need to run the SimpleFOC Commander communication protocol in order to make the motor work, I should be able to swap it out for OSAP and send motor commands as strings over serial:</p> <p>Download hardcoded SimpleFOC command code</p>"},{"location":"final-project/embedded_programming.html#simplefoc","title":"SimpleFOC","text":"<p>The SimpleFOC motor control library works when I use Xiao SAMD21 modules, but when I design my boards, I'd like to use the bare SAMD21E18A chip. I ran into an issue compiling the motor control code to the bare chip and asked for help on the SimpleFOC community forum:</p> <p>Error compiling to SAMD21 (bare chip) - SimpleFOC Community</p> <p>I got a very helpful answer from @AdinAck. Adin made a brushless DC motor control board with a SAMD21 chip running the SimpleFOC library. When programming the chip, he told the Arduino IDE that he was programming an Adafruit Feather board. All he had to do was to design the board so that it conformed to the Feather, and everything worked!</p> <p>So I tried to upload the motor control code to the rgbb Modular Things board by telling the Arduino IDE that I was uploading to a MattAirTech Xeno Mini. No luck. Then an Arduino MKRZERO. That didn't work either. Then an Arduino MKR1000. Nope. I was just randomly trying different boards and finally tried the Arduino Nano 33 IoT. It worked! I even got serial output from it:</p> <p>All I get is errors and zeroes, because there is no motor and no angle sensor connected to the MCU. But I'm happy, because the code compiled!</p> <p>Then I checked if I could upload the Modular Thing code to the SAMD21 chip under the pretense that it was an Arduino Nano 33 IoT. That worked too!</p> <p>I even got a 'false' response from the button (in the bottom right corner). Aw yeah!</p> <p>Next, I soldered the necessary parts onto the breadboard Thing and connected it up to the LED test board that I made in Electronics Production week. I wrote a loop that blinks every pin on the IC and sends the corresponding pin number to the serial port. With this I was able to identify which pin in the Arduino Nano 33 IoT board definition applied to which pin on the IC itself.</p>"},{"location":"final-project/embedded_programming.html#design-file_1","title":"Design file","text":"<p>Download Blink_all_pins.ino</p>"},{"location":"final-project/ideas.html","title":"Final Project","text":"<p>I have three ideas for a final project: A robot arm, a wake-up mask and a digital stirring stick that tells me when to press down with the French press to get a perfect brew. Let's go through them one by one, with illustrations made in MS Paint.</p>"},{"location":"final-project/ideas.html#idea-1-baks-the-robot-arm","title":"Idea 1: baks the robot arm","text":"<p>I want to make a robot arm. I realize that this is not a particularly original idea, but I just dig robot arms. I want to call it baks, which is the noun version of the Icelandic verb baksa, which means to 'busy oneself' or to 'be industrious', usually in the context of toddlers playing energetically outside, digging and dragging logs about and throwing rocks.</p> <p>Here's a video where I describe the final project to Neil Gershenfeld during random review.</p>"},{"location":"final-project/ideas.html#a-bit-of-history","title":"A bit of history","text":"<p>I backed the original uArm on Kickstarter and enjoyed using it until I accidentally connected the power supply directly to the Arduino instead to the uArm Shield. The plan was to have it fry doughnuts and frost them but the arm ended up getting fried instead. The software part also intimidated me.</p> <p>In one of the courses in my Mechanical Engineering degree, the task was to pick up a wine glass and give the professor a sip. The rationale behind it was to think about solutions for people with Parkinson's disease. My group put a lot of work into making a robot arm with a soft 3D printed hand that I found on Thingiverse. We converted an old theatre light (if you find one, they're a treasure trove, this one had 13 stepper motors). I designed and 3D printed all the custom components and the arm worked.</p> <p>But then I wanted an arm that can do more than one thing. When Fab Lab \u00cdsafj\u00f6r\u00f0ur needed something to impress the President of Iceland and the First Lady, Kar\u00edtas at Fab Lab Sau\u00f0\u00e1rkr\u00f3kur was kind enough to loan us a Niryo One, a 3D printed educational robot arm based on steppers and Dynamixel servos. I programmed the robot to hand the First Lady a laser cut business card, and had great fun experimenting with the robot. Then I fried one of its servo motors when a cable connector got stuck and the robot kept trying to move to its intended position. I managed to swap out the motor, but I thought that surely there's an improvement to be made here. </p> <p>Since educational robot arms seem to be mostly used to move colored cubes around, I think it's OK to scale them down and simplify them to make them less expensive and more accessible. I'd like to base my arm on brushless motors without any gearing, and use springs to balance it, just like the Anglepoise lamp. Then it's nimble and can't damage anything. It won't be able to lift much, but that's OK! I only want it to lift a paint brush or a colored cube.</p>"},{"location":"final-project/ideas.html#outline-of-the-idea","title":"Outline of the idea","text":"<p>Since I have a history of frying robot arms, I have a few personal design goals for my arm.</p> <ul> <li>Cannot hurt itself or the user</li> <li>Easily programmed by moving the arm and saving keypoints and paths</li> <li>Small</li> <li>Cheap</li> <li>Precise enough to paint candles</li> </ul> <p>The last point warrants a little explanation. Kertah\u00fasi\u00f0 in \u00cdsafj\u00f6r\u00f0ur manufacture candles in the shape of known buildings in the town and now around the country. It was started by a couple who were on parental leave but the money wasn't enough to live on. So they came to \u00de\u00f3rarinn at Fab Lab \u00cdsafj\u00f6r\u00f0ur and he helped them mold and cast the first candle houses. He was able to do this because of his experience at the Fab Academy. This was only last year, but their product offering now counts dozens of different designs. Every time they make a new design, the model is 3D printed here at Fab Lab \u00cdsafj\u00f6r\u00f0ur and S\u00e6d\u00eds and Gunnar make a silicone mold in their workshop. It's been a great collaboration. But hand painting the candles is a lot of work, so I wonder if it's possible to make a small, inexpensive and easy to use robot arm to paint the candles for them.</p>"},{"location":"final-project/ideas.html#idea-2-wake-up-mask","title":"Idea 2: Wake-up mask","text":"<p>I live in \u00cdsafj\u00f6r\u00f0ur, and that means that when writing this, I have not seen the sun for two months. Last fall I found that waking up with my younger son became significantly harder as the sun came out later in the day. Then the sun disappeared altogether. The Seasonal Affective Disorder acronym seems apt: the mood is SAD. I want to get more light in the dark winter months, especially to wake me up naturally in the morning. I absolutely love the artificial sun by DIY Perks and I want to make one, but I'm not sure where to put it. Maybe in a big floor lamp similar to the Arco, but then the liquid coolant would need to be piped all the way between the stand and the light. I'll keep that one in my little black book of ideas for now.</p> <p>Since my wife feeds the baby during the night, I take him upstairs when he wakes up early in the morning. That way we can share the sleeplessness. But this means that I can't use a sunrise alarm clock, because I don't want to wake up my wife and my older boy. </p> <p>I wonder if a wake-up mask could work. I could take a sleeping mask and add a few LEDs that shine into my eyes for about ten minutes before my alarm sounds. Use a WiFi enabled microcontroller to sync the sunrise to the alarm clock on my phone. That's probably the most difficult part, but it would make it easy to use.</p>"},{"location":"final-project/ideas.html#idea-3-ph-pal-for-the-french-press","title":"Idea 3: pH pal for the French Press","text":"<p>On my parental leave last fall, I wondered if I could use a pH meter to tell me exactly when to press down to make perfect French Press coffee every time. From experience (and reading online) I knew that with too short a brewing time the coffee becomes acidic and when you brew for too long, the coffee becomes bitter. So to get a baseline reference, every morning with my baby boy, I logged the quality of my morning cup.</p>"},{"location":"final-project/ideas.html#french-press-log-started-july-30-2022","title":"French press log started July 30 2022","text":"<ul> <li>Acidic:     </li> <li>Balanced:     </li> <li>Bitter:     </li> </ul> <p>(I made the tally marks in Inkscape, by the way.) I found that the coffee grounds get more acidic as they age. As I don't have a coffee grinder, I buy ground coffee in bags that last for three to four weeks. In this experiment I found that freshly ground coffee only seems to be delicious for as long as a loaf of bread is: one day. Two days max. Those days I got great cups of coffee. So the result was not the one I wanted: Freshly ground coffee is much more important than pressing down at the right time. I also found that pourover or Vietnamese drip is makes a much better brew out of stale coffee grounds. Quite nice, actually.</p> <p>So there goes that idea, but I did find a source of low cost, high quality pH sensors and amplifiers. Believe me, this is cheap for what you get. To measure pH with the precision that you need to tell bitter coffee (pH 5.10) from acidic coffee (pH 4.85), your sensor amplifier needs to be isolated and well designed.</p> <p>Continuing the train of thought about coffee pH I also had the brilliant idea of putting a little bit of baking soda (which is basic) into the cup to 'fix' the coffee when it turned out acidic.</p> <p>I made the worst cup of coffee in history.</p> <p>A few people have encouraged me to make a prototype of the pH pal. Maybe later!</p>"},{"location":"final-project/ideas.html#update-after-fab-academy","title":"Update after Fab Academy","text":"<p>According to this video, the chemical compounds in coffee beans that control acidity and bitterness are separate, and they get extracted at different times. So a pH sensor will probably not give enough information to nail the brew every time. It's a short and excellent explanation, so I recommend the video if you're at all interested in this stuff. Seriously, it's the best explanation I've seen by far on this subject. And it also applies to tea. If you drink coffee or tea, go and watch the video, and share it with your friends.</p> <p>For my purposes, I suspect that I would need to train an artificial nose to get a good brew every time, assuming that I always use freshly ground coffee beans.</p>"},{"location":"final-project/integration.html","title":"System integration","text":""},{"location":"final-project/integration.html#usb-hub-communication","title":"USB hub communication","text":"<p>I was unsure how to connect all the robot joints together for a while. Jake Read shows I2C communication using his OSAP library. It would make for a nicely integrated whole, but the joints that have I2C connections might react more slowly than the one in the base, which would be directly connected to the full-speed USB port. So two weeks before the final presentation I ordered a tiny USB hub from a Swiss company called Yoctopuce. When it arrived I was eager to see if it worked and whether it was able to supply enough current to two motors at the same time. So I took my bike over to Hamraborg, bought a USB-C cable, cut it in half and soldered the wires to connectors that I ordered with the USB hub. And here I am running two BLDC motors from one USB port on my laptop (note that this is a special 3A port with a battery charging logo on it):</p> <p>Now the whole thing works on a breadboard. Whew!</p>"},{"location":"final-project/integration.html#power-budget","title":"Power budget","text":"<p>A bit later I realized that I hadn't checked whether that single USB-C port on my laptop could support all the motors and things that I wanted to build into the arm. So I bought another USB-C cable, cut it in half and connected more motors. And here I have three brushless motors and one stepper motor running on one USB-C port at the same time:</p> <p>Instead of the stepper motor I'll actually be using a tiny DC motor as a Z-axis, and I also need to power an end effector.</p>"},{"location":"final-project/integration.html#assembling-a-robot-joint","title":"Assembling a robot joint","text":"<p>The night before my final project presentation, I assembled one robot joint and managed to hide all the wires. Here it is running a PID cascade control loop using the SimpleFOC library:</p> <p>Phew, it works!</p>"},{"location":"final-project/integration.html#design-file","title":"Design file","text":"<p>The motor control code is the same as in Motor Control.</p>"},{"location":"final-project/interface.html","title":"Interface","text":""},{"location":"final-project/interface.html#my-own-things","title":"My own things","text":""},{"location":"final-project/interface.html#python","title":"Python","text":"<p>I tried the PhysicalPixel example that is built into the Arduino IDE and modified it to send commands to the motor. </p> <p>In the video below I am controlling the motors with Python through two serial ports at the same time. The left motor rotates twice and the right motor rotates once.</p>"},{"location":"final-project/interface.html#design-files","title":"Design files","text":"<p>Here is the Python code that I used to control two motors at the same time:</p> <p>Download SimpleFOCprompt-2motors.py</p>"},{"location":"final-project/interface.html#browser-based-interface","title":"Browser-based interface","text":"<p>I found a fantastic example of using WebSerial in Py-Script and tried to run it locally. I got the error:</p> <pre><code>Access to Image from origin 'null' has been blocked by CORS policy\n</code></pre> <p>I found that this is because the code can only be run on a server. I tried to set up a local server using web.py but that didn't work and then I tried uploading the example to my website but the MkDocs system dindn't allow me to access the page. Then I found this tutorial on how to deploy a Py-Script app to GitHub Pages. That was easy, it's just a matter of creating a repository, uploading the files and going into settings and enabling deployment:</p> <p>The repository itself is under the Code tab. Go into the Settings tab, select Pages in the left menu and under Build and Deployment select <code>main</code>, <code>root</code> and click Save. As long as the repository has a file called index.html, the site is now live!</p> <p>Here's a link to the two motor control interface: baks</p> <p>Here I'm connecting to a COM device and sending it the command T12, which means 'Turn by 12 radians', or just about two rotations:</p> <p>It works! I couldn't be more excited! I'm getting close to having the full stack of technologies working. And the interface is live on the web!</p> <p>I made some very rough modifications to the code and managed to connect to two COM ports and control two motors:</p>"},{"location":"final-project/interface.html#design-files_1","title":"Design files","text":"<p>Here are the two files that you need to host on a  web server to make my rough baks serial communication portal work:</p> <p>Download index.html</p> <p>Download webSerialDemo.py</p> <p>In both cases, the motor control code is the same as in Motor Control.</p> <p>I've also found a way to embed the interface into this web page. You can use this to connect to any serial device and send it commands. The buttons only render as text, and there's only one input field, after \"Write to another serial port:\"</p> <p> Open a Serial Port Open another Serial Port Write to the serial port: Write to another serial port: </p>"},{"location":"final-project/interface.html#modular-things","title":"Modular Things","text":"<p>When I had the rgbb board and the stepper board working, I managed to make them interact with the following code (I named the stepper after myself):</p> <pre><code>Svavar.setCurrentScale(0.3);\nSvavar.setVelocity(200);\nSvavar.setAccel(40);\n\nvar val = 0;\n\nloop(async () =&gt; {\n  val = await led.getButtonState(0);\n  console.log(val);\n  led.setRGB(val,val,val);\n  let pos = 0;\n  if(val == true){\n  for (let i = 0; i &lt; 2; i++) {\n    pos = pos == 0 ? 5 : 0;\n    await Svavar.absolute(pos);\n  }\n  }\n}, 50);\n</code></pre> <p>The RGBB Modular Thing interacting with spiral 1 of my robot in the Modular Things web interface.</p>"},{"location":"final-project/interface.html#design-files_2","title":"Design files","text":"<p>Download the RGBB-baks Arduino code</p> <p>Download svavar-rgbb.js</p> <p>The motor control code is the same as in Motor Control.</p>"},{"location":"final-project/motor_control.html","title":"Motor Control","text":""},{"location":"final-project/motor_control.html#arduino-serial-monitor","title":"Arduino Serial Monitor","text":"<p>Here I'm sending one brushless motor commands from the Arduino serial monitor. I'm using the SimpleFOC Commander interface, which is a set of commands similar to G-code.</p>"},{"location":"final-project/motor_control.html#simplefoc-studio","title":"SimpleFOC Studio","text":"<p>I followed the setup instructions for SimpleFOC Studio. The link to the code repo is hidden in the website title.</p> <p>I got an error when trying to install the program using Anaconda. </p> <p></p> <p>I went to the SimpleFOC Discord server and saw that one other user had encountered this problem. I asked for help and someone recommended that I update Python to the latest version. I did that, but it didn't help. Then I went back into the terminal and looked at the command that I was using:</p> <pre><code>conda create -n simplefoc python=3.6.0\n</code></pre> <p>But I was running a more recent Python than 3.6.0! What if I don't say anything about the Python version? I tried:</p> <pre><code>conda create -n simplefoc\n</code></pre> <p>and it worked!</p> <p></p> <p>SimpleFOC Studio is up and running!</p> <p>I reported the successful command to the SimpleFOC Discord server.</p> <p>In SimpleFOC Studio, I tried changing the P, I and D values in the PID controller to see the difference that it made in the motion of the motor. Then I changed the values in the Arduino code that runs on my board. The PID controller still isn't particularly well-tuned, as SimpleFOC user AdinAck noticed in my final project presentation video.</p> <p>There was one glitch in the program when I first opened it; every time I gave the motor a command to move, it immediately moved back to T0. This behavior stopped when I closed the program and opened it again. I mentioned this on this SimpleFOC Community forum thread:</p> <p>There\u2019s a ghost in my GUI - SimpleFOC Community</p>"},{"location":"final-project/motor_control.html#design-file","title":"Design file","text":"<p>Here is the motor control code that runs on the SAMD21 chip and uses the SimpleFOC library. I used this code in all the other parts of the final project.</p> <p>Download motor control code</p>"},{"location":"final-project/overview.html","title":"Final project overview","text":""},{"location":"final-project/overview.html#baksi","title":"Baksi","text":"<p>My final project in the Fab Academy is Baksi the educational robot:</p> <p>The name Baksi comes from the Icelandic verb baksa - to busy oneself. In my concept sketch the name was Baks, but then my son always called it Baksi.</p> <p>Baksi is meant to be small, inexpensive, simple and safe. You can see all the electronics, and yet it has a clean look. And you can make one from scratch in a Fab Lab.</p> <p>You can check out the fun 1 minute presentation video on the Presentation page and I've documented Baksi's development on the other pages here on the left. This documentation is incomplete and unclear in some places. I'm going to leave it like that because this is what I did during the Fab Academy. New stuff is here.</p>"},{"location":"final-project/overview.html#design-spirals","title":"Design spirals","text":"<ol> <li>I went through design spiral 1 of Baksi the robot in Output Devices week. Those motor drivers didn't play well with the brushless motors.</li> <li>My final project counts as design spiral 2. It's a complete redesign using a bare SAMD21 microcontroller and a DRV8313 BLDC motor control chip for every joint. I'm very happy with it, but it's not ready for distribution.</li> <li>I've continued development on Baksi after I graduated from the Fab Academy. Design spiral 3 is in progress here. This time it will be made of motors and PCBs and nothing else! This version will be better documented, so that people can build and use a Baksi robot themselves.</li> </ol>"},{"location":"final-project/presentation.html","title":"Final Project Presentation","text":"<p>1 minute presentation video.</p> <p>Presentation slide.</p> <p>Baksi got on the 2023 list of highlighted Fab Academy projects and was included in the 2023 highlight video.</p> <p>Here I am presenting my final project to Professor Neil Gershenfeld and the instructors and students in the 2023 Fab Academy cycle. Link to the video.</p>"},{"location":"projects/baksi-software.html","title":"St\u00fad\u00ed\u00f3 Baksi software","text":"<p>The GUI for controlling Baksi the robot.</p> <p> Studio Baksi GitHub repository</p>"},{"location":"projects/baksi-software.html#development","title":"Development","text":"<p>I received a grant from the Icelandic Student Innovation Fund to hire a university student to make control software for Baksi the robot. Gu\u00f0j\u00f3n Bergmann, aerospace engineering student at TU Delft, had the job to create the BAKSI Python program during the summer of 2023. So I scrambled to finish building Baksi, graduated from the Fab Academy and immediately sent Baksi to Delft. </p>"},{"location":"projects/baksi-software.html#features","title":"Features","text":"<p>Gu\u00f0j\u00f3n got a lot further than I expected. He made a zoomable timeline where you can create, edit, copy and movement blocks and then you can save and load the whole file. He even figured out how to add PNGs of Baksi, to make it look nice. And when you play the motion in the GUI, the program sends commands to the joints in the arm via a USB serial connection. Currently, it also sends the commands when you're moving around the timeline with the mouse. When I've tuned up the PID controllers on the motors and got Baksi operational, it will be interesting to see Baksi try to follow quick scrubbing in the GUI in real time. I say scrubbing because video editors are the inspiration for this GUI, and scrubbing is the term for dragging a slider to quickly navigate through a video timeline.</p> <p>Gu\u00f0j\u00f3n made the GUI with PyQt5, which means that in theory, this set of Python scripts could be turned into a standalone program. I think fbs is probably the way to go to build a desktop app.</p> <p>Gu\u00f0j\u00f3n Bergmann.</p>"},{"location":"projects/baksi-software.html#why-not-ros","title":"Why not ROS?","text":"<p>My initial plan was that Gu\u00f0j\u00f3n would use ROS (Robot Operating System) to build the software, but a fellow student at TU Delft who works with ROS advised him against it. ROS is for much bigger and more complicated systems, and it is complicated in itself. ROS also needs a computer running Ubuntu, but Baksi only has microcontrollers and I don't want to add more cost to the robot for an unclear return. Jake Read, creative machine designer and PhD student at the Center for Bits and Atoms at MIT, also advised me not to use ROS for this project. </p>"},{"location":"projects/baksi-software.html#report","title":"Report","text":"<p>Download the St\u00fad\u00ed\u00f3 Baksi report</p>"},{"location":"projects/baksi.html","title":"Baksi the robot, version 3","text":"<p>This is where I continue development of Baksi the robot:</p> <p>Baksi on my MIT Machine Class page</p>"},{"location":"projects/bldc-modular-thing.html","title":"BLDC Modular Thing","text":""},{"location":"projects/bldc-modular-thing.html#final-version","title":"Final version","text":"<p>This work was finished during the 2024 Fab Academy Instructor Bootcamp in Le\u00f3n, Spain:</p> <p>Bootcamp page</p>"},{"location":"projects/bldc-modular-thing.html#overview","title":"Overview","text":"<p>Since I've learned to control brushless DC motors so well in my final project work, I thought I might make a BLDC motor control board that you can use in your projects. BLDCs can be really tricky to use with closed loop control. Hopefully this board will simplify your development with brushless motors, because they're great!</p> <p>Like Baksi the robot, this board uses the SimpleFOC Arduino library.</p> <ul> <li>Spiral 1: First I'm just going to make the board, and you can control it with any program that can send messages to a serial port.</li> <li>Spiral 2: Then I'd like to make the board work with Modular Things.</li> </ul>"},{"location":"projects/bldc-modular-thing.html#cad","title":"CAD","text":"<p>Ok, let's start with the shape of the board. It's square and quite small. It will be tricky to fit a Xiao module, the motor driver and associated components, and the connectors for the motor and the magnetic angle sensor on it. But it should be doable, I think.</p> <p>The Modular Thing footprint. Dimensions are in millimeters, taken from the Modular Things - Circuits repository. I'm using mirror constraints to position the holes.</p>"},{"location":"projects/bldc-modular-thing.html#inspiration","title":"Inspiration","text":"<p>I'm basing this design on the SimpleFOC Mini and the DRV8313 datasheet. I'm crossing out a few things from the SimpleFOC Mini schematic:</p> SimpleFOC Mini schematicOnly the essentials <p>The SimpleFOC Mini schematic.</p> <p>Let's get rid of all non-essential parts.</p> <p>The SimpleFOC Mini board is based on the reference design in the DRV8313 datasheet:</p> <p></p> <p>Here's an initial sketch of my board:</p> <p></p> <p>Actually, I was using the SimpleFOC Mini board in the breadboard version of my final project. The image above shows my (unfinished) first attempt at a schematic that simplifies the SimpleFOC Mini as much as possible. A few things are still missing; I need to pull up FAULT, SLEEP and RESET on the motor driver. I'm hoping that I can connect them all together to a digital pin that I'll set to HIGH. That would get rid of a few passive components on the board. I need to go over the SimpleFOC Mini schematic and add necessary components like the bulk capacitor.</p> <p>I need to reference the pin numbers on the Xiao SAMD21:</p> <p></p>"},{"location":"projects/bldc-modular-thing.html#voltage-problem","title":"Voltage problem","text":"<p>I ran into a problem with my final project because the DRV8313 motor driver only works at 8V and above. So I couldn't drive it directly from the USB port as I had planned. Fortunately, I had the foresight to order a step-up/step-down voltage regulator from Pololu, in case I needed to make some last-minute voltage changes. So I put the regulator module into the base of Baksi the robot, along with a 4 port USB hub, for communication with all the joints. </p>"},{"location":"projects/bldc-modular-thing.html#voltage-fix","title":"Voltage fix","text":"<p>When browsing the SimpleFOC Community forum I came across the Mosquito BLDC driver board, which uses the MS8313 motor driver, which seems to be a knockoff of the Texas Instruments DRV8313. The MS8313 datasheet is only in Chinese, but that isn't really a problem since all its functionality is a 1:1 copy of the DRV8313.</p> <p>I don't like using knockoff products because I know that developing something for the first time is at least ten times harder than copying it. However, the MS8313 driver operates between 1.8V and 36V, which is perfect for my application. I guess it doesn't take much to tempt me. Now I can get rid of the expensive step-up voltage regulator and run the BLDC motor directly from the 5V USB power supply. And the pinout is identical to DRV8313!</p> <p>I may also try USB-PD at some point, like this Modular Thing. I'll probably set the voltage using jumper resistors, rather than communicating with the USB-PD IC. </p> <p>Now let's try to put all this together in KiCAD.</p>"},{"location":"projects/bldc-modular-thing.html#progress","title":"Progress","text":"<p>Here's the current design. Like Baksi the robot, it doesn't have current sense. I might try to add a current sense resistor or two in the next design spiral.</p> <p></p>"},{"location":"projects/bldc-modular-thing.html#current-sensing","title":"Current sensing!","text":"<p>I looked more closely at the DRV8313 datasheet and discovered that it supports current limiting using a single low side resistor connected to all the motor phases. The motor driver uses a comparator to compare the measured voltage over the resistor to a reference voltage that needs to be supplied to the driver. It's very similar to how the Toshiba TB67H451FNG,EL H-bridge handles current limiting in Yuichi's Xiao_RP2040 Dual H-Bridge board. Nice!</p> <p>This isn't the kind of current sensing that you can use to enable torque control, but at least I can protect the USB port from damage. That's all I want for this board.</p> <p></p> <p>The Xiao SAMD21 module has one DAC output pin, which I I'd like to use as a voltage reference for the comparator inside the motor driver. The SAMD DAC Application Note supports this plan:</p> <p>A common use of DAC is to generate audio signals by connecting the DAC output to a speaker, or to generate a reference voltage; either for an external circuit or an internal peripheral such as the Analog Comparator.</p>"},{"location":"projects/bldc-modular-thing.html#mirrored-images-in-datasheet","title":"Mirrored images in datasheet","text":"<p>I've run into a problem with the schematic for BLDC control with current sensing. The PCB view in KiCAD didn't make sense to me and I didn't understand why. Then I noticed that the motor driver IC is mirrored in the current sensing schematic as compared to the recommended layout schematic. This seems a bit inconsistent.</p> <p>Since the recommended layout worked well in Baksi the robot, and the KiCAD footprint matches it, that is what I'm going to trust. Now I just need to mirror the current sensing schematic in order to be back on track.</p> <p>That's better.</p>"},{"location":"projects/bldc-modular-thing.html#trip-current","title":"Trip current","text":"<p>I will assume that the BLDC Modular Thing will be connected to a USB 3.0 or 3.1 port, which allows a 900 mA current at 5V. Let's use an upper limit of 0.8 A, to be safe.</p> <p>The motor driver has a comparator that can cut the power if the current goes over a certain threshold. Now to figure out what that threshold should be:</p> <p>If I use the 0.25 \u03a9 current resistor that we have at the lab, then I can calculate the necessary voltage on the motor driver's COMPN pin according to the DRV8313 datasheet:</p> \\[V_{COMPN} = I_{trip} \\cdot R_{sense} = 0.8\\text{A} \\cdot 0.25 \\Omega = \\underline{0.2 \\text{V}}\\] <p>The operating voltage of the SAMD21 chip in the Xiao module is supposed to be 3.3 V. I measured it to be 3.31 V. Then I can find the value that I put into the DAC with:</p> \\[\\frac{0.2 \\text{V}}{3.31 \\text{V}}\\cdot 1024 = 61.8\\] <p>I used the Xiao SAMD21 getting started guide to learn how to use the DAC. Then I modified the code to output a constant voltage level from pin A0:</p> <p><pre><code>#define DAC_PIN A0\n\nvoid setup() {\n  analogWriteResolution(10); // Set analog out resolution to max, 10-bits\n  analogReadResolution(12); // Set analog input resolution to max, 12-bits\n\n  Serial.begin(9600);\n}\n\nvoid loop() {\n  // The measured USB supply voltage is 5.188 V and the IC operating voltage is 3.310 V.\n  // 0.2V/3.31V * 1024 (or maybe 1023) = 61.8\n  // OK, so to get the right reference voltage out of the DAC, measure the 3.3V Xiao pin and put into the formula above\n  analogWrite(DAC_PIN, 62);\n\n  float voltage = analogRead(A1) * 3.3 / 4096.0;\n  Serial.println(voltage); // Print the voltage.\n  delay(100); // Delay 1ms\n}\n</code></pre> And I got rock solid 0.201 V out of pin A0:</p> <p>I can use the DAC instead of the voltage divider in the example circuit. That simplifies the PCB layout.</p>"},{"location":"projects/bldc-modular-thing.html#bom","title":"BOM","text":"<p>You need to order three things from three different places to make the BLDC Modular Thing:</p> <ul> <li>One MS8313 BLDC motor driver</li> <li>One GM2804 Gimbal Motor w/Encoder</li> <li>One Xiao SAMD21 from e.g. Seeed, Digikey or Amazon, if you don't already have one at your lab</li> </ul> <p>You also need to have a Dupont connector kit at your lab (see bottom of this page).</p> <p>Note</p> <p>The 470 nF capacitor is recommended in the DRV8313 datasheet, but it's not in the Fab Lab inventory. Fortunately, it's only there to filter out noise in the little 3.3V regulator inside the motor driver. So you can safely use the next capacitor size above it, which is 1 uF. We'll replace the 470 nF capacitor in the next update of the design files.</p> Part Count GM2804 Gimbal Motor w/Encoder 1 Xiao SAMD21 module 1 MS8313 motor driver 1 100 uF bulk capacitor with 6.3 mm diameter 1 470 nF capacitor 1 100 nF capacitor 2 10 nF capacitor 1 10 kOhm resistor 2 0.250 Ohm size 2010 resistor 1 0 Ohm jumper resistor 5 6 pin horizontal SMD pin header 1 3 pin horizontal SMD pin header 1"},{"location":"projects/bldc-modular-thing.html#design","title":"Design","text":"<p>The board uses a Xiao SAMD21 to receive angle readings from a magnetic sensor via SPI and send PWM and a few other signals to the motor driver. The schematic is based on the following example in the DRV8313 datasheet:</p> <p></p> <p>The motor driver has a comparator that measures the current going through the 0.250 Ohm resistor (R2 on the schematic below). If the current goes over a threshold, the motor driver shuts off. </p> <p>To adjust the current threshold, you need to supply a constant voltage to the COMPN pin on the motor driver. In the example above, that's done with a voltage divider (resistors R1 and R2 in the example schematic above). We're using the DAC on the SAMD21 to supply that voltage instead.</p> <p></p> <p>Note that the MS8313 motor driver that we're using is a clone of the Texas Instruments DRV8313. The MS8313 datasheet is only available in Chinese, but that driver is functionally identical to the DRV8313, so we can use the DRV8313 datasheet instead. Why are we using a clone? Because the original DRV8313 only starts operating at 8V. So to use that we need to add a step-up regulator (This one has been used successfully). The MS8313 can operate at 5V, so we can power the motor directly from USB.</p> <p>Here's the pinout of the Xiao SAMD21:</p> <p></p> <p>On the PCB below, all the motor driver connections are on the left side of the Xiao and all the SPI pins are on the right side. We're using socket connectors so that we can route the wires around the pads.</p> <p></p> <p>Here are more details about the development of this Thing.</p>"},{"location":"projects/bldc-modular-thing.html#programming","title":"Programming","text":""},{"location":"projects/bldc-modular-thing.html#arduino-code","title":"Arduino code","text":"<p>The Arduino code is mostly based on SimpleFOC examples, with DAC and a SLEEP pin added. </p> <ul> <li> <p>Get the SimpleFOC library for the Arduino IDE.</p> <p>Add the line</p> <pre><code>#define PinStatus int\n</code></pre> <p>to the top of the Arduino/libraries/SimpleFOC/src/communications/StepDirListener.h file as described in this SimpleFOC Community post.</p> </li> <li> <p>Get OSAP for the Arduino IDE.</p> </li> </ul>"},{"location":"projects/bldc-modular-thing.html#magnetic-angle-sensor","title":"Magnetic angle sensor","text":"<p>The AS5048 magnetic angle sensor has 14 bits of resolution. TThe SPI chip select pin on the AS5048 is connected to pin 7 on the Xiao, so the sensor is defined like this:</p> <pre><code>MagneticSensorSPI sensor = MagneticSensorSPI(7, 14);\n</code></pre> <p>Be careful with the SPI wires for the sensors. They should be like in the image at the top of this page. When the wires overlap, the signal sometimes gets messed up and the angle stops updating in the serial terminal. It took a little while to debug this mysterious problem. Plugging the board into a breadboard also messes with the SPI signal integrity.</p> <p>This is working code that reads the magnetic angle sensor and outputs the angle in radians to the serial monitor / serial plotter:</p> <pre><code>#include &lt;SimpleFOC.h&gt;\n\n// MagneticSensorSPI(chip_select_pin, bit_resolution)\nMagneticSensorSPI sensor = MagneticSensorSPI(7, 14);\n\nvoid setup() {\n  // monitoring port\n  Serial.begin(115200);\n\n  // initialise magnetic sensor hardware\n  sensor.init();\n\n  Serial.println(\"Sensor ready\");\n  _delay(1000);\n}\n\nvoid loop() {\n  // iterative function updating the sensor internal variables\n  // this function reads the sensor hardware and \n  // has to be called before getAngle\n  sensor.update();\n  // display the angle and the angular velocity to the terminal\n  Serial.println(sensor.getAngle());\n}\n</code></pre>"},{"location":"projects/bldc-modular-thing.html#motor-driver","title":"Motor driver","text":"<p>The motor driver is connected to the Xiao like this:</p> <pre><code>IN1 on the motor driver connects to pin 3 on the Xiao\nIN2 on the motor driver connects to pin 4 on the Xiao\nIN3 on the motor driver connects to pin 6 on the Xiao\nEN on the motor driver connects to pin 5 on the Xiao (enable)\n</code></pre> <p>So the BLDC motor is defined in the Arduino code like this:</p> <pre><code>BLDCMotor motor = BLDCMotor(7); // (This BLDC motor has seven pole pairs)\nBLDCDriver3PWM driver = BLDCDriver3PWM(3, 4, 6, 5);\n</code></pre>"},{"location":"projects/bldc-modular-thing.html#trip-current_1","title":"Trip current","text":"<p>We assume that the BLDC Modular Thing will be connected to a USB 3.0 or 3.1 port, which allows a 900 mA current at 5V. Let's use an upper limit of 0.8 A, to be safe.</p> <p>The motor driver has a comparator that can cut the power if the current goes over a certain threshold. Now to figure out what that threshold should be:</p> <p>If we use the 0.25 \u03a9 current resistor that we have at the lab, then we can calculate the necessary voltage on the motor driver's COMPN pin according to the DRV8313 datasheet:</p> \\[V_{COMPN} = I_{trip} \\cdot R_{sense} = 0.8\\text{A} \\cdot 0.25 \\Omega = \\underline{0.2 \\text{V}}\\] <p>The operating voltage of the SAMD21 chip in the Xiao module is supposed to be 3.3 V. We measured it to be 3.31 V. Then we can find a value between 0 and 1023 to put into the DAC:</p> \\[\\frac{0.2 \\text{V}}{3.31 \\text{V}}\\cdot 1024 = 61.8\\] <p>We used the Xiao SAMD21 getting started guide to learn how to use the DAC. Here's the code.</p> <pre><code>#define DAC_PIN A0\nvoid setup() {\n  analogWriteResolution(10);\n  analogWrite(DAC_PIN, 62);\n}\n</code></pre> <p>That's all you need to send a rock solid voltage of 0.2V to the COMPN pin on the motor driver.</p>"},{"location":"projects/bldc-modular-thing.html#sleep-pin","title":"SLEEP pin","text":"<p>Inside the void setup() loop, we set the SLEEP pin on the motor driver to HIGH to wake it up:</p> <pre><code>  pinMode(1, OUTPUT);\n  digitalWrite(1, HIGH);\n</code></pre> <p>The rest of the code is built from examples in the SimpleFOC library.</p> <p>Setting up the sensor</p> <p>Setting up the motor (contains info on zeroing)</p>"},{"location":"projects/bldc-modular-thing.html#javascript-code","title":"JavaScript code","text":"<p>Jake and Quentin explained the Javascript needed to make a new Modular Thing in a video call. Jake has recently updated Modular Things to make it easier to make new modules.</p>"},{"location":"projects/chat.html","title":"Chat with my docs","text":""},{"location":"projects/chat.html#result","title":"Result","text":"<p>This work was completed at the 2024 Fab Academy Instructor Bootcamp in Le\u00f3n, Spain:</p> <p>Bootcamp page</p>"},{"location":"projects/chat.html#overview","title":"Overview","text":"<p>I'm going to talk to my website (the one you're looking at) using a language model that runs on my laptop. The ultimate goal is to set up a web service that enables Fab Academy students to chat with the whole Fab Academy archive.</p> <p>What I've done so far:</p> <ul> <li> <p>I installed GPT4All on my Windows machine. It's easy, anyone can do it! You just download a regular Windows installer and open a very simple graphical user interface where you can install and interact with various language models. I recommend GPT4All for anyone who's starting out running large language models on their own hardware. The models run in CPU-only mode, which is slow, but it works on all computers! </p> <p>In GPT4All:</p> <ol> <li>I ran a tiny 3B parameter model called Mini Orca in GPT4All and it was terrible. It's a 1.84 GB download.</li> <li>Then I tried a bigger 13B parameter model called Snoozy and got more promising results, but still not dependable. Beware, it's a 6.86 GB download!</li> <li>I installed SBert (only a 43.8 MB download) to be able to use the LocalDocs feature in GPT4All. I loaded my whole documentation repository into LocalDocs in the GPT4All GUI. Easy. Then I asked Snoozy questions about things that I did in the Fab Academy. The answers weren't great. This is probably because LocalDocs is mostly a search function. You're not actually fine-tuning the model or turning your documents into a vector database or anything like that. Still, a useful result.</li> </ol> </li> <li> <p>Next, I installed Ollama in the Windows Subsystem for Linux. Ollama detected my NVidia CUDA GPU, so it runs language models much faster than GPT4All.</p> </li> <li>I ran a tiny 1B parameter model called tinyllama. It was as bad as Mini Orca.</li> <li>Now I'm trying to install PrivateGPT. I can use that to turn my docs into a vector database and that should result in higher quality responses from the language models.</li> <li>As part of the PrivateGPT effort I installed the <code>mistral</code> language model provided by Ollama on Ubuntu. Warning: The download is many gigabytes in size.</li> </ul> <p>Now let's go into the details. I asked all the language models the same set of questions, to be able to compare the results.</p>"},{"location":"projects/chat.html#attempt-1-ollama-in-linux-mint-running-in-a-virtual-machine-failed","title":"Attempt 1: Ollama in Linux Mint, running in a virtual machine (failed)","text":"<p>The first thing that I tried was to set up Ollama inside a virtual machine. Ollama only runs on Mac and Linux, and this is a great reason to start using Linux for real. The installation couldn't be simpler, I simply opened a terminal and typed</p> <pre><code>install ollama\nollama run tinyllama\n</code></pre> <p>Ollama installed fine, but Virtualbox doesn't have access to the computer's GPU. Ollama detected that and decided to run in CPU only mode. I got an error when trying to run the smallest Ollama language model; tinyllama. The message was vague, but I gathered from a bit of Googling that the hardware isn't good enough to run the model. That was disappointing.</p>"},{"location":"projects/chat.html#attempt-2-gpt4all-in-windows-chat-with-docs-not-very-good","title":"Attempt 2: GPT4All in Windows (Chat with docs not very good)","text":"Conversations Mini OrcaSnoozy test 1 (chatting with my repo)Snoozy test 2 (only the public folder) <p>I tried downloading the smallest model that it offers, Mini Orca. It's a 3 billion parameter model. It installed just fine and I was able to ask it some questions. It was a bit of a thrill to chat with something that lives on my laptop!</p> <ul> <li>Hello</li> <li>Hello! How may I assist you today?</li> <li>Please write a research and development grant application for a small educational robot arm</li> <li> <p>Sure, here's an example of a research and development grant application for a small educational robot arm:</p> <p>Title: Designing an Educational Robotic Arm for K-12 Students</p> <p>Introduction: The purpose of this project is to design and develop an educational robotic arm that will be used in the classroom to teach students about mechanical engineering, programming, and microcontroller technology. The goal is to create a hands-on learning experience that will allow students to build and program their own robotic arms. This project will provide students with valuable skills for future academic and professional success.</p> <p>Objectives: The objectives of this project are as follows: 1. Design and develop an educational robotic arm that can be used in the classroom. 2. Create a user-friendly interface that allows students to program and control the robotic arm. 3. Develop curriculum materials that align with state standards for mechanical engineering, programming, and microcontroller technology. 4. Test and refine the robotic arm based on feedback from teachers and students. 5. Provide resources and support for teachers who want to integrate this project into their classrooms.</p> <p>Methods: The methods used in this project are as follows: 1. Research and analysis of existing educational robotic arms, including their features and limitations. 2. Collaboration with teachers and education experts to develop a curriculum that aligns with state standards for mechanical engineering, programming, and microcontroller technology. 3. Development of a user-friendly interface using C++ programming language. 4. Testing and refinement of the robotic arm based on feedback from teachers and students. 5. Creation of resources and support materials for teachers who want to integrate this project into their classrooms.</p> <p>Conclusion: The design and development of an educational robotic arm will provide K-12 students with a hands-on learning experience that will help them develop valuable skills in mechanical engineering, programming, and microcontroller technology. This project has the potential to enhance student engagement and academic success, as well as prepare them for future academic and professional opportunities.</p> </li> <li> <p>Write Python code to communicate with a USB serial device</p> </li> <li> <p>Sure! Here's an example of how you can use the <code>usbserial</code> library in Python to communicate with a USB serial device:</p> <pre><code>import usb_serial\n\nser = usb_serial.Serial('/dev/ttyACM0', 9600, timeout=15) # replace 'device' and 'port' with the actual values for your device and port\n\nwhile True:\ndata = ser.readline().decode()\nprint(data)\ntime.sleep(1)\n</code></pre> <p>In this example, we are using the <code>usbserial</code> library to create a serial connection between our Python code and a USB serial device (in this case, a serial port on a Raspberry Pi). We then use a <code>while</code> loop to continuously read data from the device until it's time for us to stop. You can modify the code to send data back to the device as well using the same syntax.</p> </li> <li> <p>What is the Fab Academy?</p> </li> <li>The Fab Academy is an open educational program developed by the 3D Printing Company, 3D Systems. It provides a unique opportunity for individuals and teams to learn about 3D printing technology through hands-on experience, workshops, and online courses. The Fab Academy offers a range of courses that cover all aspects of 3D printing, from design and modeling to prototyping and manufacturing. Participants can earn certificates or degrees by completing the program's requirements.</li> <li>who is svavar konradsson?</li> <li>I'm sorry, but I couldn't find any information on a person named SVAVAR KONRADSSON. Can you please provide more context or details about who this person might be?</li> <li>who is svavar konradsson? (Now and in the prompts below I'm using LocalDocs to connect MiniOrca to my documentation repo)</li> <li>I'm sorry, but I couldn't find any information on a person named SVAVAR KONRADSSON. Can you please provide more context or details about who this person might be?</li> <li>how do you do i2c communication between at412 microcontrollers? (Note that I wrote ATtiny412 incorrectly, let's see how the model deals with that)</li> <li>To communicate with Atmel AT412 microcontrollers using I2C, you can use the following steps:<ol> <li>Connect the two Atmel AT412 microcontrollers to a single I2C bus using an I2C header on each controller.</li> <li>Power up both controllers and wait for them to initialize.</li> <li>Write a simple program that sends data from one controller to another. This can be done by writing the desired data to a serial port on one controller, then sending it as a message to the other controller using I2C.</li> <li>Read data back from the other controller using I2C. You will need to write code that receives data from the other controller and converts it into a format that can be read by your program.</li> <li>Use the received data in your program.</li> </ol> </li> <li>is the fab academy difficult?</li> <li>As an AI language model, I cannot provide subjective opinions or feedback on difficulty levels as it varies from person to person. However, the Fab Academy is designed for people with different backgrounds and skill levels, so it can be challenging if you are not familiar</li> <li>what's a good project for machine week in the fab academy?</li> <li>Hi! I'm sorry, but as an AI language model, I don't have access to information about specific projects or events that are part of the Fab Academy. However, you can check out the official website of the Fab Lab Reykjavik for more information on upcoming events and project ideas. You may also want to reach out to</li> <li>how do i use modular things?</li> <li>Hello! To use Modular Things in the Fab Academy, you can follow these steps:<ol> <li>Install the necessary software on your computer to communicate with the microcontrollers (such as the Arduino IDE).</li> <li>Write a program that sends data to the microcontroller using the serial port.</li> <li>Connect the microcontroller to the serial port and wait for it to initialize.</li> <li>Write a message to the microcontroller using Modular Things' built-in messaging system.</li> <li>Monitor the output of the microcontroller to see if the message was received correctly.</li> <li>Use the data from the microcontroller in your program.</li> <li>Repeat steps 1-6 for each message you want to send to the microcontroller.</li> </ol> </li> <li>How to make a silicone mold?</li> <li>To make a silicone mold in the Fab Academy, you can follow these steps:<ol> <li>Choose a pattern from a digital file or print it out.</li> <li>Cut out the pattern with scissors or a knife.</li> <li>Clean the edges of the pattern with rubbing alcohol and a soft cloth.</li> <li>Apply silicone to one side of the pattern, making sure not to touch any edges with your fingers.</li> <li>Place the other side of the pattern in the silicone mold, making sure it's flat against the sides.</li> <li>Press down on the pattern until it fills the mold, and then release pressure.</li> <li>remove the mold from the silicone by heating it with a hot knife or pliers.</li> <li>Clean the mold with rubbing alcohol and a soft cloth.</li> <li>Repeat steps 1-8 for each pattern you want to make a mold of.</li> </ol> </li> <li>how to make a resin casting in the fab academy?</li> <li>To make a resin casting in the Fab Academy, you can follow these steps:<ol> <li>Choose a pattern from a digital file or print it out.</li> <li>Cut out the pattern with scissors or a knife.</li> <li>Clean the edges of the pattern with rubbing alcohol and a soft cloth.</li> <li>Apply silicone to one side of the pattern, making sure not to touch any edges with your fingers.</li> <li>Place the other side of the pattern in the silicone mold, making sure it's flat against the sides.</li> <li>Press down on the pattern until it fills the mold, and then release pressure.</li> <li>Remove the mold from the silicone by heating it with a hot knife or pliers.</li> <li>Clean the mold with rubbing alcohol and a soft cloth.</li> <li>Repeat steps 1-</li> </ol> </li> <li>how do i calibrate a cnc machine?</li> <li>To calibrate a CNC machine, you can follow these steps:<ol> <li>Check the condition of the machine and make sure it's in good working order.</li> <li>Choose a suitable reference point or calibration target that is known to be accurate.</li> <li>Use the tool to create a mark on the workpiece</li> <li>Move the machine to the desired position where you want the part to be cut.</li> <li>Use the CNC system to program and execute the cutting operation.</li> <li>Record the data from the machine's sensors during the cutting process, including the feed rate, depth of cut, and tool position.</li> <li>Analyze the recorded data to identify any errors or discrepancies that may affect the accuracy of the part being cut.</li> <li>Use the CNC system to adjust the parameters of the cutting operation until the desired accuracy is achieved.9. Repeat steps 4-8 for each reference point or calibration target you want to calibrate the machine with.</li> <li>Document and store all relevant data, including the reference points and any adjustments made, for future reference.</li> </ol> </li> </ul> <p>I used the LocalDocs feature in GPT4All to ask my Fab Academy documentation website some questions. The answers were not very useful. This should perhaps not be surprising, since this feature is really mostly search. You're not fine-tuning the model or turning the documents into a vector database or anything like that. But it's quick and easy, and it's a start!</p> <ul> <li>What is the Fab Academy?</li> <li>The Fab Academy is an online program that offers a comprehensive education in digital fabrication, design and innovation. It was founded by Neil Gershenfeld of MIT's Center for Bits and Atoms (CBA) to make advanced digital fabrication tools accessible to people around the world. The program provides students with hands-on experience using cutting edge technology such as 3D printers, laser cutters, CNC machines, electronics labs, and more. Students learn about design principles, prototyping techniques, and entrepreneurship skills in order to create innovative projects that solve real world problems.</li> <li>Please write a research and development grant application for a small educational robot arm</li> <li> <p>Title of Project: Educational Robot Arm Development Grant Application</p> <p>Project Summary: The proposed project is the development of an affordable, easy-to-use educational robot arm that can be used in classrooms to teach students about robotics and automation. The goal of this project is to create a tool that will help bridge the gap between theoretical concepts and practical applications by providing hands-on experience with real-world technologies such as 3D printing, laser cutting, CNC machining, electronics labs, and more.</p> <p>Project Description: The proposed educational robot arm project is designed to provide students with a comprehensive education in digital fabrication, design, and innovation using advanced technology tools. The aim of this project is to create an affordable, easy-to-use robot arm that can be used by teachers or instructors to teach students about the principles of automation, programming, mechanics, electronics, and more.</p> <p>The proposed educational robot arm will consist of a modular design with interchangeable parts such as arms, grippers, sensors, motors, and other components that can be easily replaced or upgraded based on student needs. The robot arm will also have an intuitive user interface that allows students to program the robot using drag-and-drop software tools without requiring any prior programming experience.</p> <p>The proposed educational robot arm project is expected to benefit a wide range of students, including those interested in engineering, computer science, physics, and other STEM fields. The project will also provide teachers or instructors with an affordable tool that can be used for demonstrations, experiments, and projects related to automation, programming, mechanics, electronics, and more.</p> <p>Project Timeline: The proposed educational robot arm development grant application is expected to take approximately 12 months from start to finish. The project timeline includes the following milestones:</p> <ul> <li>Research and Development Phase (3 Months): This phase will involve conducting research on existing educational robots, identifying gaps in their capabilities, and developing a prototype design for an affordable, easy-to-use robot arm that can be used by teachers or instructors. The project team will also work to develop software tools for programming the robot using drag-and-drop interfaces.</li> <li>Prototype Development Phase (3 Months): This phase will involve building and testing a prototype of the proposed educational robot arm, refining its design based on feedback from students and teachers or instructors, and incorporating additional features such as sensors, motors, grippers, and other components that can be easily replaced or upgraded.</li> <li>Final Development Phase (3 Months): This phase will involve testing the final prototype of the proposed educational robot arm in classrooms to ensure it meets student needs and provides a valuable learning experience. The project team will also work on developing documentation, training materials, and support resources for teachers or instructors who want to use the robot arm in their classes.</li> <li>Deployment Phase (3 Months): This phase will involve distributing the final prototype of the proposed educational robot arm to schools and other organizations that are interested in using it as an educational tool. The project team will also work on developing a sustainable business model for maintaining, updating, and supporting the robot arm over time.</li> </ul> <p>Project Budget: The total budget required for this project is estimated at $100,000 USD. This includes expenses such as research and development costs, prototype development, testing, documentation, training materials, support resources, distribution, sustainability, and marketing. The proposed educational robot arm will be sold to schools or other organizations that are interested in using it for teaching purposes at a cost of $500 USD per unit.</p> <p>Conclusion: The proposed project is an innovative solution that can help bridge the gap between theoretical concepts and practical applications by providing students with hands-on experience using real-world technologies such as 3D printing, laser cutting, CNC machining, electronics labs, and more. The educational robot arm will be a valuable tool for teachers or instructors to use in their classes, helping them teach automation, programming, mechanics, electronics, and other STEM fields with ease. We believe that this project has the potential to make a significant impact on education and innovation, and we look forward to working with you to bring it to life.</p> </li> <li> <p>Write Python code to communicate with a USB serial device</p> </li> <li>Here is an example of how to use the <code>serial</code> module in Python to read data from a USB serial device:     <pre><code>import serial\n\nser = serial.Serial('COM1', baudrate=9600) # replace 'COM1' with your desired port name and baud rate\n\nwhile True:\n    try:\n        ser.readline()\n        print(f\"Received data from the USB device: {ser.readline()}\")\n    except serial.SerialException as e:\n        if str(e) == 'No such file or directory': # check for a specific error message that indicates an invalid port name\n            continue  # try again with a different port name\n</code></pre></li> <li>who is svavar konradsson?</li> <li>Svavar Konr\u00e1\u00f0sson (born May 2, 1975) is an Icelandic entrepreneur and inventor. He has founded several companies in the fields of technology, finance, and real estate development. Some of his notable ventures include Skype Technologies S.A., which he co-founded with Janus Friis in 2003; Bidco Oy, a Finnish company that specializes in online auctions for used cars; and AQS Capital Management AB, an Icelandic investment firm focused on real estate development projects. Konr\u00e1\u00f0sson is also known for his philanthropic activities, including supporting the arts, education, and environmental causes through various organizations such as Reykjavik Art Museum, The National Museum of Iceland, and Arctic Initiative.</li> <li>who is svavar konradsson? (Now and in the prompts below I'm using LocalDocs to connect Snoozy to my documentation repo)</li> <li> <p>Svavar Konr\u00e1\u00f0sson (born May 2, 1975) is an Icelandic entrepreneur and inventor. He has founded several companies in the fields of technology, finance, and real estate development. Some of his notable ventures include Skype Technologies S.A., which he co-founded with Janus Friis in 2003; Bidco Oy, a Finnish company that specializes in online auctions for used cars; and AQS Capital Management AB, an Icelandic investment firm focused on real estate development projects. Konr\u00e1\u00f0sson is also known for his philanthropic activities, including supporting the arts, education, and environmental causes through various organizations such as Reykjavik Art Museum, The National Museum of Iceland, and Arctic Initiative. Context: instructors, \u00c1rni Bj\u00f6rnsson and \u00de\u00f3rarinn Bjartur Brei\u00f0fj\u00f6r\u00f0 Gunnarsson, came to support us during this intense session of work. \u00de\u00f3rarinn and I flew in from \u00cdsafj\u00f6r\u00f0ur and \u00c1rni, respectively, while Bjarn</p> </li> <li> <p>how do you do i2c communication between at412 microcontrollers? (Note that I wrote ATtiny412 incorrectly, let's see how the model deals with that)</p> </li> <li> <p>To communicate with ATmega412 microcontrollers using the I2C protocol, follow these steps:</p> <ol> <li>Connect the two data wires (SDA and SCL) from each MCU to separate pins on your Arduino board or any other device that supports I2C communication. For example, you can connect them to A4 and A5 respectively for ATmega412 microcontrollers.</li> <li>Use the <code>Wire</code> library in combination with an appropriate <code>I2cDevice</code> object to communicate with each MCU individually. The <code>Wire</code> class provides a convenient way of working with I2C lines, while the <code>I2cDevice</code> interface allows you to read and write data from/to the microcontrollers over their respective I2C interfaces.</li> <li>When writing data to an ATmega412 MCU using I2C communication, ensure that it is configured as a slave device by setting its address register (e.g., <code>Wire.beginTransmission(address)</code>) and then sending the desired byte of data over the SDA line (<code>Wire.write(data)</code>.</li> <li>When reading from an ATmega412 MCU, use the appropriate read function to retrieve the requested data bytes from its registers (e.g., <code>I2cDevice.readFrom()</code>). Be sure to specify the correct address and register values for your specific application.</li> </ol> </li> <li> <p>is the fab academy difficult?</p> </li> <li>The difficulty level of the Fab Academy can vary depending on an individual's prior knowledge and experience in engineering, design, and fabrication. However, it is generally considered to be challenging due to its intensive nature and fast-paced curriculum that covers a wide range of topics within these fields. The program requires students to work independently as well as collaboratively on projects, which can require significant time management skills and self-motivation. Additionally, the Fab Academy's focus on hands-on learning through prototyping and fabrication may be challenging for those with limited experience in these areas.</li> <li>what's a good project for machine week in the fab academy?</li> <li>A good Machine Week project in the Fab Academy could be one that involves designing and building an automated system or tool, such as a robotic arm, CNC milling machine, 3D printer, laser cutter, or other fabrication equipment. The goal should be to create something useful for yourself or others while also learning about the principles of computer-controlled machines and their applications in various fields. Another option could be developing a project that involves integrating multiple machines together into an automated system, such as creating a conveyor belt with sensors and motors controlled by microcontrollers. This would allow you to explore the potential for collaboration between different tools and devices while also enhancing your understanding of their individual capabilities. Ultimately, the best project will depend on your interests, skills, and goals within the Fab Academy program. It's important to choose a topic that aligns with these factors in order to maximize your learning experience during Machine Week.</li> <li>how do i use modular things?</li> <li>To use Modular Things in your project, you will need to follow these steps:<ol> <li>Purchase the necessary components from a supplier that offers OSAP-compatible modules and connectors (such as Adafruit or SparkFun).</li> <li>Connect the microcontroller board with an appropriate power source and USB cable to your computer's USB port.</li> <li>Install any required software drivers for the microcontroller on your computer, such as Arduino IDE or PlatformIO.</li> <li>Use a web-based interface like Modular Things Web to create a new project and add components (such as motors, sensors, and other devices) that are compatible with OSAP protocols.</li> <li>Connect each component to the microcontroller board using appropriate connectors and wiring according to its specifications.</li> <li>Test your setup by sending commands from Modular Things Web or another program that can communicate with the serial port of the microcontroller, such as Arduino IDE's Serial Monitor.</li> </ol> </li> <li>How to make a silicone mold?</li> <li>To create a silicone mold, follow these steps:<ol> <li>Purchase the necessary materials for creating a silicone mold, such as two-part polyurethane or epoxy resin and hardener, silicone rubber (such as Soft 107), acrylic sheeting, vacuum pot, mixing container, stirring sticks, and other tools.</li> <li>Clean the area where you will be working with mold-making materials to avoid contamination of your project. Cover any nearby surfaces or objects that could come into contact with silicone rubber.</li> <li>Mix together equal parts of polyurethane resin (A) and hardener (B), following manufacturer's instructions for proper mixing ratios, as well as safety precautions to avoid skin irritation from the chemicals involved in this process.</li> <li>Pour a small amount of mixed polyurethane into an acrylic sheeting or other mold-making container with sides that are slightly higher than your desired silicone rubber thickness (e.g., 1/8\" for Soft 107). Place the mold in a vacuum pot to create a thin, steady stream of airflow and prevent bubbles from forming during curing.</li> <li>Once the polyurethane has cured into a solid mass (usually within an hour), carefully remove it from the acrylic sheeting or other container without disturbing its shape too much. This will be your mold for creating silicone rubber parts later on.</li> <li>Clean and prepare any surfaces that may come in contact with the silicone rubber, such as a vacuum pot used to create airflow during curing or stirring sticks from previous projects. These should not contain any contaminants that could affect your mold-making process.</li> <li>Measure out equal parts of Soft 107 silicone rubber and hardener, following manufacturer's instructions for proper mixing ratios to ensure a smooth consistency without air bubbles or other defects in the final product. Mix together thoroughly until fully combined.</li> <li>Pour the mixed silicone into your prepared mold (from step 4), making sure it fills all crevices and cavities evenly, but not so much that any excess spills over onto surrounding surfaces. Allow to cure for several hours or as directed by manufacturer's instructions, until a solid mass has formed within the silicone rubber mold.</li> <li>Once your silicone rubber part is fully cured and removed from its mold (usually after 24-72 hours), clean any excess material around it to avoid contamination of other projects or surfaces in the area. Store the finished product safely until ready for use, such as by attaching a motorized arm to your project using screws or other fasteners that can withstand the weight and movement of the silicone rubber part. ### Context: The second mold came out well, except for a few bubbles. With the help of my father-in-law, I made another mold from this pattern, but it turned out the same. ## The right silicone arrives above it to form a thin, steady stream of silicone. The bubbles will be pushed out before entering the thin stream and curing into your final product.</li> </ol> </li> <li>how to make a resin casting in the fab academy?</li> <li>To create a silicone rubber mold for your project, you will need to follow these steps:<ol> <li>Prepare and clean any surfaces that may come into contact with the silicone rubber, such as stirring sticks or vacuum pots used during curing. These should not contain any contaminants that could affect your mold-making process.</li> <li>Measure out equal parts of Soft 107 silicone rubber and hardener, following manufacturer's instructions for proper mixing ratios to ensure a smooth consistency without air bubbles or other defects in the final product. Mix together thoroughly until fully combined.</li> <li>Pour the mixed silicone into your prepared mold (from step 4), making sure it fills all crevices and cavities evenly, but not so much that any excess spills over onto surrounding surfaces. Allow to cure for several hours or as directed by manufacturer's instructions, until a solid mass has formed within the silicone rubber mold.</li> <li>Once your silicone rubber part is fully cured and removed from its mold (usually after 24-72 hours), clean any excess material around it to avoid contamination of other projects or surfaces in the area. Store the finished product safely until ready for use, such as by attaching a motorized arm to your project using screws or other fasteners that can withstand the weight and movement of the silicone rubber part.</li> </ol> </li> <li>how do i calibrate a cnc machine?</li> <li>To calibrate your CNC milling machine, you will need to follow these steps:<ol> <li>Prepare the workspace and set up the necessary tools for measuring and adjusting the axes of motion in your CNC milling machine. This may include a micrometer or other precision measurement tool, as well as any required hardware or software components that allow you to make fine-grained adjustments to the positioning and movement of each axis.</li> <li>Measure the current position of each axis using your chosen measurement device, taking care to ensure accurate readings are recorded for all three axes (X, Y, Z). Compare these measurements against any available specifications or tolerances provided by the manufacturer or supplier of your CNC milling machine.</li> <li>Adjust the position and movement of each axis as needed based on the measured values and any relevant specifications or tolerances. This may involve making small adjustments to screws, nuts, bolts, or other hardware components that affect the positioning and motion of your CNC milling machine's axes.</li> <li>Repeat steps 1-3 as necessary until you have achieved accurate measurements for all three axes within any specified tolerances. This may involve making multiple adjustments to different parts of the system over time, so it is important to document each step and maintain a clear record of your progress throughout the calibration process.</li> <li>Once you are satisfied with the accuracy of your CNC milling machine's positioning and movement in all three axes, test its performance by running some sample jobs or projects through the system to ensure that it is producing consistent results across different parts and materials. This may involve using specialized software tools for generating G-code instructions or other programming tasks related to controlling your CNC milling machine's movements during operation.</li> <li>Finally, store any necessary documentation or records of your calibration process in a safe location that can be easily accessed later if needed, such as by consulting with an expert technician or engineer who may need this information for troubleshooting purposes or other tasks related to maintaining and optimizing the performance of your CNC milling machine. ### Context: The guide explains how to calibrate a CNC milling machine in order to ensure accurate positioning, movement, and cutting results when working with different parts and materials on this type of equipment. This process involves making fine-grained adjustments to the axes of motion using precision measurement tools and hardware components that affect the positioning and movement of each axis (X, Y, Z). The guide also recommends testing your CNC milling machine's performance after calibration by running sample jobs or projects through it. Finally, the guide suggests storing any necessary documentation or records related to this process in a safe location for later reference if needed.</li> </ol> </li> </ul> <p>I saw in a Youtube video that deduplication of data is important (removing duplicate data) when dealing with LLMs, so this time I only pointed the Snoozy LLM to the public folder in my documentation repo. This didn't make much of a difference.</p> <ul> <li>who is svavar konradsson? (Now and in the prompts below I'm using LocalDocs to connect Snoozy to only the public folder in my documentation repo)</li> <li>Svavar Konr\u00e1\u00f0sson (born 1965) is an Icelandic musician, composer and producer. He has been active in the Icelandic music scene since the late 80s as a member of several bands including The Sugarcubes, GusGus, and Sigur R\u00f3s. Konr\u00e1\u00f0sson also collaborated with other musicians such as Bj\u00f6rk, M\u00fam, J\u00f3nsi from Sigur R\u00f3s, and many others. He has released solo albums under the name Sveinbj\u00f6rn Beinteinsson since 2013.</li> <li>how do you do i2c communication between at412 microcontrollers? (Note that I wrote ATtiny412 incorrectly, let's see how the model deals with that)</li> <li> <p>To perform I2C communication between ATmega412 microcontrollers, follow these steps:</p> <ol> <li>Connect the two microcontrollers to each other using a 6-pin header cable or any suitable wiring method. The pins on one side of the cable should match those on the other side (e.g., SDA and GND).</li> <li>Set up the I2C communication protocol between both microcontrollers by configuring their respective registers:</li> <li>Onboard ATmega412 MCU:<ul> <li>Configure GPIO pins for I2C communication using <code>GPIO_PIN</code> macros (e.g., <code>I2C_SCL = 9;</code>, <code>I2C_SDA = 8;</code>).</li> </ul> </li> <li>External ATmega412 MCU:<ul> <li>Configure GPIO pins for I2C communication using the same approach as above.</li> </ul> </li> <li>Enable the internal pull-up resistors on both microcontrollers by setting <code>I2C_PULLUP</code> to 0 (e.g., <code>I2C_PULLUP = 0;</code>). This will ensure proper data transmission between devices without requiring external pull-ups.</li> <li>Set up the I2C communication speed and other parameters as needed, such as clock speed (<code>I2C_SPEED</code>), addressing mode (e.g., <code>I2C_ADDRESS = 0x1;</code>), and more. Refer to your microcontroller's datasheet for specific details on these settings.</li> <li>Start the I2C communication by writing data or reading from devices connected via their respective SDA/SCL pins:<ul> <li>Onboard ATmega412 MCU: Send commands, read data, and handle interrupts as needed (e.g., <code>I2C_Read()</code> function).</li> </ul> </li> <li>External ATmega412 MCU: Read or write to devices connected via their respective SDA/SCL pins using the same approach as above.</li> <li>Keep in mind that I2C communication requires proper wiring, device addressing, and timing synchronization between both microcontrollers. Ensure your code handles any errors or timeouts appropriately (e.g., <code>I2C_Error()</code> function).</li> </ol> </li> <li> <p>is the fab academy difficult?</p> </li> <li>The Fab Academy is not necessarily considered \"difficult,\" but it does require dedication, focus, and hard work to complete successfully. The program provides students with access to high-quality online resources for learning various topics in digital fabrication (e.g., 3D printing, laser cutting), as well as opportunities for hands-on experience through internships or projects. To succeed in the Fab Academy, you should be prepared to invest significant time and effort into your studies, actively participate in online discussions and activities, collaborate with other students on group projects, and apply what you've learned by creating original designs and prototypes using digital fabrication tools. Overall, while completing the Fab Academy may require some level of challenge or difficulty, it is designed to be accessible for individuals who are motivated and committed to learning about cutting-edge technologies in digital fabrication.</li> <li>what's a good project for machine week in the fab academy?</li> <li>For Machine Week during Fab Academy, you can consider creating projects that demonstrate your skills with various CNC machines and tools (e.g., milling, drilling, cutting). Here are some ideas to get started:<ol> <li>Design and fabricate a custom enclosure for an Arduino or Raspberry Pi board using the laser cutter. This project can help you develop proficiency in design software like Inkscape (for vector graphics) and G-code programming, as well as hands-on experience with cutting acrylic sheets on the laser cutter.</li> <li>Create a custom 3D printed enclosure for an Arduino or Raspberry Pi board that incorporates unique features or designs. This project can help you develop proficiency in design software like Tinkercad (for basic shapes) and Fusion 360 (for more advanced models), as well as hands-on experience with 3D printing on the Ultimaker printers.</li> <li>Design a custom CNC machine tool holder or fixture that can be used to securely hold various tools, such as drills, end mills, and taps. This project can help you develop proficiency in design software like Autodesk Fusion 360 (for parametric modeling) and G-code programming for CNC machines, as well as hands-on experience with using the laser cutter to fabricate parts from acrylic sheets or other materials. Remember that these are just examples; you can always come up with your own project ideas based on your interests, skills, and goals in digital fabrication.</li> </ol> </li> </ul>"},{"location":"projects/chat.html#attempt-3-ollama-in-wsl2","title":"Attempt 3: Ollama in WSL2","text":"<p>I installed Ollama on Ubuntu under the Windows Subsystem for Linux, and downloaded the smallest language model, tinyllama. Tinyllama only has around 1 billion parameters, and it performed about as badly as the Mini Orca model.</p> <p>To install Ollama and tinyllama I used the same commands as in attempt 1, except this time I typed them into the WSL Linux terminal: <pre><code>install ollama\nollama run tinyllama\n</code></pre></p> Conversation <ul> <li>What is the Fab Academy?</li> <li>The Fab Academy is a global platform for learning and innovation, promoting the sharing of ideas and knowledge in the field of fashion. It was founded by a group of industry leaders in 2013 to address the need for an open and collaborative environment that fosters creativity, innovation, and entrepreneurship in the fashion industry. The Fab Academy offers a range of online courses, workshops, and events, as well as networking opportunities, to help individuals, startups, and brands develop their skills, learn from peers and experts, and drive innovation in the fashion industry.</li> <li>Who is Svavar Konradsson?</li> <li>Svavar Konradsson is a Swedish entrepreneur and the founder of the Fab Academy. She has over 15 years of experience in the fashion industry, having worked for brands such as H&amp;M, Zara, and Adidas. In 2013, she established the Fab Academy with a group of industry leaders to create an open and collaborative environment for creativity, innovation, and entrepreneurship in the fashiion industry. She holds a Bachelor's degree in Fashion Merchandising from Gothenburg University and has been recognized for her impact on the fashion industry through her contributions to education, research, and innovation.</li> <li>how do you do i2c communication between at412 microcontrollers? (Note that I wrote ATtiny412 incorrectly, let's see how the model deals with that)</li> <li> <p>To do I2C communication between At412 microcontrollers, you need to follow these steps:</p> <ol> <li> <p>Configure your software environment to communicate with the At412 microcontrollers using I2C (Inter-Integrated Circuit) protocol. You can use a microcontroller configuration tool like the Arduino IDE or PICkit 3 for this purpose.</p> </li> <li> <p>Connect the At412 microcontrollers to your computer/board/system by connecting the data and clock pins. Use I2C slave mode when communicating with the microcontrollers, which allows you to send commands and receive responses in parallel.</p> </li> <li> <p>Design a microcontroller program that communicates using I2C. You can use an I2C library provided by the microcontroller manufacturer or write your own program from scratch.</p> </li> <li> <p>Test your program on the At412 microcontrollers to ensure it is working properly. Connect the power supply and the microcontrollers to a computer/board/system with a USB cable, and use the I2C slave mode in the microcontroller software.</p> </li> <li> <p>Once you have verified that your microcontroller program works correctly on the At412 microcontrollers, you can start communicating with them using I2C. To do this, follow these steps:</p> <ul> <li>Open a serial terminal window for communication with the microcontrollers (e.g. Serial Monitor or Serial Debugger).</li> <li>Connect the power supply and the microcontrollers to your computer/board/system with a USB cable.</li> <li>Select I2C mode in the microcontroller software using the appropriate I2C slave mode configuration tool.</li> <li>Enter command mode by sending a \"I\" (or similar) command at the microcontroller's start address, followed by the commands you want to send.</li> <li>Receive data responses by sending an \"R\" (or similar) command and waiting for a response at the microcontroller's stop address.</li> </ul> </li> </ol> <p>That's it! Now you can start communicating with your At412 microcontrollers using I2C.</p> </li> <li> <p>is the fab academy difficult?</p> </li> <li>The Fab Academy is a global platform for learning and innovation, promoting the sharing of ideas and knowledge in the field of fashion. It was founded by industry leaders in 2013 to address the need for an open and collaborative environment that fosters creativity, innovation, and entrepreneurship in the fashion industry. The Fab Academy offers a range of online courses, worksshops, and events, as well as networking opportunities, to help individuals, startups, and brand's develop their skills, learn from peers and expertise, and drive innovation in the fashion industry. While the Fab Academy can be challenging, it is designed to equip individuals with the knowledge, skills, and networks they need to succeed in the fast-paced and competitive world of fashion.</li> <li>what's a good project for machine week in the fab academy?</li> <li> <p>Machine Week is the third in a series of innovation workshops organized by the Fab Academy. Each workshop focuses on a specific topic related to automation, robotics, and AI. Here are some potential ideas for Machine Week:</p> <ol> <li> <p>Robotics: Build a functional robot using Arduino or Raspberry Pi. This project will involve designing, building, programming, and testing the robot's movement and functionality.</p> </li> <li> <p>Machine Learning: Design and build an autonomous car using machine learning algorithms. This project will require coding, data analysis, and modeling to optimize vehicle performance for autonomous driving.</p> </li> <li> <p>Fashion Startup Competition: Participate in a fashiion startup competition to showcase your innovation skills and network with industry leaders. Competing teams will present their ideas and receive feedback on how to improve them.</p> </li> <li> <p>Digital Design and Fabrication: Design and build a functional product using digital design software, 3D printing, and laser cutters. This project will require creating CAD files, programming the 3D printer, and assembling the final product.</p> </li> <li> <p>Data Analysis and Machine Learning: Analyze a large dataset using machine learning algorithms to predict customer behavior and optimize sales strategies. This project requires coding, data analysis, and modeling to identify patterns and trends in the data.</p> </li> </ol> </li> </ul> <p>These are just a few ideas for Machine Week in the Fab Academy. The Fab Academy encourages participants to come up with their own unique projects, based on the topic of their choice.</p> <ul> <li>Please write Python code to send serial messages to an Arduino device.</li> <li> <p>I can't write actual code, but I can provide you with a general idea of how to send serial messages to an arduino     device using a python program.</p> <p>to connect to an arduino via serial port, you need to install the \"serial\" package on your system. Then, you can create an instance of the serial port class and pass it to the arduino object:</p> <pre><code>import serial\n\n# open serial port\nserial_port = serial.serial_for_url(\"COM1\", timeout=0.5)\narduino = serial.Serial(serial_port, 9600, timeout=0.2)\n</code></pre> <p>once the connection is established, you can send serial data to an arduino using the <code>send()</code> method of the arduino object:</p> <pre><code>while True:\n    # write some data to the serial port\n    arduino.write(bytes(\"hello world\\n\", \"ascii\"))\n\n    # read the serial data from arduino\n    data = arduino.readline()\n\n    if not data:\n        break\n</code></pre> <p>this program will send \"hello world\" to an arduino, and print each line of received data to the console. You can modify it to send different messages based on your needs.</p> </li> </ul>"},{"location":"projects/chat.html#attempt-4-privategpt-in-wsl-not-working-yet","title":"Attempt 4: PrivateGPT in WSL (not working yet)","text":"<p>Here's what I've done so far. I've basically mixed together this and this tutorial, but I'm going to spell out the steps I took, for future reference:</p> Setup <ul> <li>I set up WSL2 (already done).</li> <li>Then I got the WSL extension for VSCode</li> <li>I cloned the repo for PrivateGPT</li> <li>I found the link to the latest Miniconda (the minimal version of Anaconda) and used the command <code>curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh</code></li> <li>and completed these instructions</li> <li>Installed Miniconda with <code>bash Miniconda3-latest-Linux-x86_64.sh</code></li> <li>Then I closed Ubuntu and VSCode and reopened VSCode.</li> <li>Then I started a virtual environment using <code>conda create -n privategpt python=3.11</code> as shown in this tutorial</li> <li>Then <code>conda activate privategpt</code> to activate the privategpt environment</li> <li>Then I followed the installation instructions in the readme in PromptEngineer48/Ollama/2-ollama-privateGPT-chat-with-docs, starting with <code>pip install -r requirements.txt</code></li> <li>I got an error:         <pre><code>Failed to build llama-cpp-python chroma-hnswlib\nERROR: Could not build wheels for llama-cpp-python, chroma-hnswlib, which is required to install pyproject.toml-based projects\n\nRuntimeError: Unsupported compiler -- at least C++11 support is needed!\n</code></pre></li> <li>So I installed GCC with <code>sudo apt install build-essential</code> according to this tutorial</li> <li>Then I ran <code>pip install -r requirements.txt</code> again</li> <li>That went well this time, now to get the mistral model: <code>ollama pull mistral</code></li> <li>Created A directory for source documents: <code>mkdir source_documents</code></li> <li>Then cloned my fab academy site repository to ubuntu wsl2 and copied only the public folder into source_documents</li> <li> <p>Then I tried to ingest the files, but got the following error:</p> <pre><code>(base) svavark@MI0321:~/Ollama/2-ollama-privateGPT-chat-with-docs$ python ingest.py\nTraceback (most recent call last):\nFile \"/home/svavark/Ollama/2-ollama-privateGPT-chat-with-docs/ingest.py\", line 8, in &lt;module&gt;\n    from langchain.document_loaders import (\nModuleNotFoundError: No module named 'langchain'\n</code></pre> </li> <li> <p>I noticed that I was in (base) but not (privategpt), so I restarted conda: <code>conda activate privategpt</code></p> </li> <li>Then <code>python ingest.py</code> and it worked!     Lots of little caveats here and there. I closed the folder in VSCode in order to copy the public folder over to source_documents, and that closed the conda environment.</li> </ul> <p>I now got a new error with ingest.py:</p> <pre><code>LookupError: \n\nResource punkt not found.\nPlease use the NLTK Downloader to obtain the resource:\n\nimport nltk\nnltk.download('punkt')\n\nFor more information see: https://www.nltk.org/data.html\n\nAttempted to load tokenizers/punkt/PY3/english.pickle\n</code></pre> <p>I opened the nltk link in the error message. That's where I stopped for now. Remember to restart the conda virtual environment called <code>privategpt</code> when you pick this up again!</p>"},{"location":"projects/chat.html#links","title":"Links","text":"<p>Ubuntu tutorials</p> <p>My NVidia GPU was installed by default and Ollama detected it, but you may need to install the driver.</p> <p>I tried installing a few lightweight apps with GUIs in WSL. Here are some more to try.</p>"},{"location":"projects/cpp.html","title":"Learning C++ from scratch","text":""},{"location":"projects/cpp.html#why","title":"Why","text":"<p>I've wanted to learn C or C++ for some years. </p> <p>C is to modern programming languages as Latin is to modern European languages, except that C is still alive and thriving as a fast, light weight systems programming language. C was created by Dennis Ritchie at Bell Labs in the 1970, and based on the B language. His collaborator at Bell Labs, Ken Thompson, wrote the UNIX operating system in C. Because you needed to use C to maintain your operating system, the C programming language became very popular, and it still is. C++ was created by Bjarne Stroustrup in the 1980, as a way to add Object-Oriented features to the C language.</p> <p>My Master's thesis advisor said that you get much finer control over the computer using C rather than something like Python. And C++ is necessary for high-performance microcontroller code.</p> <p>Right now I want to learn C++ in order to better understand the SimpleFOC code that I use in Baksi and the BLDC Modular Thing.</p> <p>I'll keep my programs in this repo:</p> <p>  My Learning C++ GitHub repository</p>"},{"location":"projects/cpp.html#failed-attempt","title":"Failed attempt","text":"<p>I tried to follow a C++ programming book some years back, I don't remember which one it was. I installed an IDE on my Windows laptop and tried to add something or other to PATH, but I couldn't get anything to compile and I didn't know why. I'm writing my journey down this time, in case it helps someone out.</p>"},{"location":"projects/cpp.html#successful-setup","title":"Successful setup","text":"<p>If you want to try running C++ code right away, you can copy one of the examples on this page into OnlineGDB and compile and run it in your browser.</p> <p>To compile and run C++ code, I installed Linux Mint inside VirtualBox, which was easy (here's a tutorial). Then I found a short video showing how to compile a C++ program in Linux Mint using the Code::Blocks editor. It worked! </p> <p>Note</p> <p>I later found out that you can install the Code::Blocks editor on Windows and Mac. On those operating systems, you need to install GCC yourself.</p> <p>Here's what you type into the Linux terminal to get started: <pre><code>sudo apt-get update\nsudo apt-get install codeblocks\ngcc --version\n</code></pre> That's it! I only updated my system, installed Code::Blocks and checked the GCC version. Conveniently, GCC comes preinstalled on most Linux distributions. If your GCC version is 11.3.0 or later, you're good to go. Open the Code::Blocks editor, select the GCC compiler and then create a new project. You want to create a Console application. That's it, now you can write your first C++ program:</p> <p><pre><code>#include &lt;iostream&gt;\nusing namespace std;\n\nint main()\n{\n    cout &lt;&lt; \"Hello world!\\n\";\n    return 0;\n}\n</code></pre> In the top menu, select Build -&gt; Build and run. The output is</p> <pre><code>Hello world!\n</code></pre> <p>Yay!</p> <p>I also found a tutorial that shows how to compile and run a C++ program in the Linux terminal. Nice! All you have to do is navigate to the right folder using <code>cd</code> and then enter</p> <p><pre><code>g++ cplus.cpp\n./a.out\n</code></pre> Then the program runs in the Linux terminal.</p>"},{"location":"projects/cpp.html#the-c-book","title":"The C++ book","text":"<p>My father-in-law handed me a used copy of Problem Solving with C++ by Walter Savitch at the yearly bazaar in Hn\u00edfsdalur in November 2023. The book only cost ISK 100 ($1), so I bought it. I have the seventh edition. The book is friendly and accessible. It assumes that you have never programmed a computer before and you only need to understand the most basic high school algebra for the more involved exercises.</p> <p>Alternatively you can go through the tutorials at LearnCpp.com. They seem really good. </p> <p>But I'm going ahead with the book:</p>"},{"location":"projects/cpp.html#chapter-1","title":"Chapter 1","text":""},{"location":"projects/cpp.html#freefall","title":"Freefall","text":"<p>After Hello world, I made a slightly more useful program (since I'm teaching physics at M\u00cd): <pre><code>#include &lt;iostream&gt;\nusing namespace std;\n\nint main()\n{\n    double t, y;\n    cout &lt;&lt; \"Enter freefall time in seconds: \" &lt;&lt; endl;\n    cin &gt;&gt; t;\n    y = 9.81*t*t/2;\n    cout &lt;&lt; \"The vertical distance covered is \" &lt;&lt; y &lt;&lt; \" meters.\" &lt;&lt; endl;\n    return 0;\n}\n</code></pre> When I run it, it looks like this:</p> <p><pre><code>Enter freefall time in seconds: 5\nThe vertical distance covered is 122.625 meters.\n</code></pre> Nice! </p>"},{"location":"projects/cpp.html#terminal-graphics","title":"Terminal graphics","text":"<p>Then I tried my hand at making ASCII graphics: <pre><code>#include &lt;iostream&gt;\n\nusing namespace std;\n\nint main()\n{\n    cout &lt;&lt; \"**********************************\" &lt;&lt; endl;\n    cout &lt;&lt; \"  BBB       A     K  K   SSS   I  \" &lt;&lt; endl;\n    cout &lt;&lt; \"  B  B     A A    K K    S     I  \" &lt;&lt; endl;\n    cout &lt;&lt; \"  BBB     A   A   K      SSS   I  \" &lt;&lt; endl;\n    cout &lt;&lt; \"  B  B    AAAAA   K K      S   I  \" &lt;&lt; endl;\n    cout &lt;&lt; \"  BBB     A   A   K  K   SSS   I  \" &lt;&lt; endl;\n    cout &lt;&lt; \"**********************************\" &lt;&lt; endl;\n    return 0;\n}\n</code></pre> The result: <pre><code>**********************************\n  BBB       A     K  K   SSS   I  \n  B  B     A A    K K    S     I  \n  BBB     A   A   K      SSS   I  \n  B  B    AAAAA   K K      S   I  \n  BBB     A   A   K  K   SSS   I  \n**********************************\n</code></pre> This is fun!</p>"},{"location":"projects/daq.html","title":"Multichannel data acquisition device (DAQ )","text":""},{"location":"projects/daq.html#overview","title":"Overview","text":"<p>My Master's thesis project in mechanical engineering is a suspension seat for speedboats. I'm going to drop test the seat and perform sea trials with it. So I need a device that lets me make dynamic measurements to assess the seat's shock mitigating performance.</p> <p>I haven't designed the device yet, but I've gathered lots of information:</p>"},{"location":"projects/daq.html#requirements","title":"Requirements","text":"<p>The literature recommends 24 bit data AD converters, or at least not below 16 bits, to measure acceleration on suspension seats. I've looked around for a suitable high resolution, multichannel data acquisition device (DAQ) that can also handle load cells, but they seem to cost upwards of 1300 dollars, not including the sensors. The MonoDAQ is the closest I can get to an affordable solution, but it's only 16 bits and it only has 4 differential inputs. It seems that I need to make my own data acquisition system. This will not only be lower cost, but it will be a nice educational exercise as well.</p> <p>Here are my requirements:</p> <ul> <li>7 or 8 sensors</li> <li>24 bit resolution</li> <li>At least 1000 samples per second</li> <li>Must handle weak load cell signals</li> <li>As little analog design as possible</li> <li>Some way to synchronize the measurements</li> <li>Simple communications and data processing</li> </ul> <p>Fortunately, I'm a Fab Academy graduate, and so I'm no longer intimidated by assembling a device myself. I know that accurate analog design is tricky, and so I want to make the analog path as short as possible. The usual method is to pair an instrumentation amplifier (either an IC or made of discrete op-amps) with a high-resolution analog to digital converter (ADC) and send the digital values to a microcontroller for processing and storage. I've looked at many of those, but the field is vast and I'm unsure which instrumentation amplifier goes best with which analog to digital converter.</p>"},{"location":"projects/daq.html#analog-front-end","title":"Analog front end","text":""},{"location":"projects/daq.html#ad7190","title":"AD7190","text":"<p>Finally, I found the Analog Devices AD7190, which is a complete analog front end for high precision measurement applications. It's an expensive IC, but a cheap data acquisition device. I can get a ready-made board with this IC, but I like to make things from scratch in order to know how everything works.</p> <p>The AD7190 is a 4.8 kHz, 24 bit sigma-delta ADC with a programmable gain amplifier (PGA) with gain from 1/2 to 128! That's the widest data-rate and input signal range of any sigma-delta ADC. This means that I can connect any sensor to it, from accelerometers to temperature and pressure sensors, even to strain gauges! Strain gauges are the trickiest of all, because the signals you get are extremely weak and you usually need a chip that is dedicated to strain gauges. The problem with those is that these chips usually have a very slow data rate, up to hundreds of Hertz at most. That's not sufficient for my dynamic measurements. The AD7190 is perfect though, because I can use the same IC on all the sensors and sync all the measurements together with a clock signal (This application note points out problems with routing clock signals over long distances). And the chip has a few siblings, one of which (the AD7195) can provide an AC excitation signal for load cells, to boost the measurement precision.</p>"},{"location":"projects/daq.html#precision-regulator","title":"Precision regulator","text":"<p>I've been digging into the circuit note that shows a complete weigh scale design using the AD7190 chip. The circuit note says that the AD7190 analog section must be powered from 5V. That's a little bit disappointing, since I was hoping to adjust its sensitivity by using different voltage references, based on the sensors I'm using. The suggested precision 5V regulator is the ADP3303. Is that all I need? I thought I needed a precision voltage reference like the ADR431.</p>"},{"location":"projects/daq.html#sensors","title":"Sensors","text":""},{"location":"projects/daq.html#accelerometers","title":"Accelerometers","text":"<p>Accelerometers are a whole field in themselves. Choosing the right one for my tests is quite daunting. Fortunately, I know that my thesis adviser has been using the Bosch BMA280 for acceleration measurements on speedboats with good results. This IC is a digital three-axis accelerometer with 14 bit resolution and a 500 Hz data rate. OK, I can find an IC that has similar or higher specs.</p> <p>The ADXL359 from Analog Devices is a three-axis 20 bit digital accelerometer. This fits the requirement to not have to do analog design. But it's a tiny IC and I don't know how to synchronize it with the AD7910 chips.</p> <p>The ADXL316, ADXL326, ADXL356 and the new ADXL358 are analog accelerometers that have the 16-20 g range that I'm looking for. They all come in tiny packages, except fo the ADXL356. It comes in a 14-lead LCC package, which I may just be able to solder by hand. I didn't know that until I was putting this text together. The right accelerometer has jumped out at me! </p> <p>The only downside to an analog accelerometer is that I'll need to calibrate it myself. How do I do that? I don't have easy access to the University of Iceland's calibration shaker here in \u00cdsafj\u00f6r\u00f0ur. Do I measure the acceleration in free fall and at rest and calibrate the data with those two data points? Maybe that's good enough for my purposes.</p>"},{"location":"projects/daq.html#load-cells","title":"Load cells","text":"<p>Here's a page on load cell fundamentals.</p> 2000 kg5 kgStrain gauges <p>To measure the forces in the seat, I bought two 2000 kg S-type load cells. I don't know how precise they are, but this is what I could afford. They don't come with a calibration certificate. These are their specs:</p> <ul> <li>Linearity: \u00b10.02%F.S.</li> <li>Delaying: \u00b10.02%F.S.</li> <li>Repeatability: \u00b10.02%F.S.</li> <li>Sensitivity: 2.0mV/V</li> <li>Drifting: \u00b10.02%F.S</li> <li>Input impedance: 350\u00b110\u03a9</li> <li>Output impedance: 350\u00b15\u03a9</li> <li>Wire connecting method:<ul> <li>Input: Red wire(+), Black wire(-)</li> <li>Output: Green wire(+), White wire(-)</li> <li>Yellow wire(GND)</li> </ul> </li> </ul> <p>I also have two very nice 5 kg S-type load cells from Applied Measurements. The are much higher quality, they have much more documentation and a correspondingly higher price. The 5 kg load cells have a four-wire interface.  Rated Capacity (RC) kgf 0-1, 0-2, 0-5, 0-10, 0-25, 0-50 Operating Modes Tension/Compression / Tension &amp; Compression Sensitivity (RO) mV/V 2.0 nominal Zero Balance/Offset \u00b1%/Rated Output &lt;1.0 Zero Return after 30 mins \u00b1%/Applied Load &lt;0.03 Output Symmetry (tension vs. compression) \u00b1%/Rated Output &lt;0.10 Non-Linearity \u00b1%/Rated Output &lt;0.03 Hysteresis % / Rated Output &lt;0.02 Output Symmetry \u00b1%/Rated Output &lt;0.10 Repeatability \u00b1%/Rated Output &lt;0.02 Temperature Effect on Zero \u00b1%/Rated Output/\u02daC &lt;0.005 Temperature Effect on Sensitivity \u00b1%/Applied Load/\u02daC &lt;0.005 Input Resistance Ohms 375-420 nominal Output Resistance Ohms 340-360 nominal Insulation Resistance Megohms &gt;5000 @ 50Vdc Excitation Voltage Volts AC or DC 10 recommended (2-15 acceptable) Operating Temperature Range \u02daC -20 to +80 Compensated Temperature Range \u02daC 0 to +70 Storage Temperature Range \u02daC -20 to +80 Safe Overload % of Rated Capacity 150 Ultimate Overload % of Rated Capacity 200 Maximum Safe Side Load % of Rated Capacity 30 Deflection @ Rated Capacity mm (nominal) 1kg = 0.50, 2kg = 0.30, 5kg = 0.26, 10kg = 0.19, 25kg = 0.12, 50kg = 0.08 Fundamental Resonant Frequency* Hz 1kg = 200, 2kg = 300, 5kg = 600, 10kg = 950, 25kg = 1900, 50kg = 3000 IP Rating (Environmental Protection) IP51 (IP67 optional) Weight (excluding cable) grams 25 Fatigue Life Consult Sales Cable Length (as standard) metres 2 Cable Type 4-core screened, PVC sheath, \u00d83.5 Construction Material Aluminium Alloy Resolution 1 part in 250,000 (with appropriate instrumentation) </p> <p>Just for fun, I also bought a few strain gauges, in case I wanted to measure the strain in the damper body or something like that. It's also nice to have them in stock at the Fab Lab. </p> <p>Along with these sensors I bought a bunch of 24 bit HX711 AD converters which are especially designed for load cells. I thought I was all set until I discovered that the data rate of the HX711 AD converter only goes up to 80 samples per second. That's not enough. But these cheap 24 bit AD converters will still be useful to have at the Fab Lab, because they are the easiest and most common way for hobbyists to interface with load cells. </p> <p>Here's a CBA project that uses the maximum data rate of the HX711:</p> <p>And custom multi-axis load cells made by sticking strain gauges on aluminum pieces cut with a wire EDM. Very nice. It may look fast enough when he pushes on it by hand in the video, but shock events are considerably faster than the fastest movements of the human arm.</p> <p>Because I needed an alternative to the HX711, and I wanted to be able to connect all my sensors to the same type of IC, I found the AD7910 (see the Analog front end above). You can connect a load cell directly to this IC and make 4800 measurements per second at 24 bits! There is a caveat, though. When you amplify the signal, you also amplify the noise. According to this tutorial from Analog Devices, at a gain of 128 and 4.8 kHz sampling frequency you get 15.5 bits of noise-free resolution. The document assumes a load cell sensitivity of 2 mV/V, which matches my load cells. We can calculate the load cell's output at its maximum rated load like this:</p> \\[     2 \\text{mV/V} \\cdot 5 \\text{V} = 10 \\text{mV} \\] <p>The analog input range of the AD7910 with a 5V reference voltage is</p> \\[     \\pm V_{REF}/\\text{gain} = \\pm 5 \\text{V}/128 \\approx \\pm 39 \\text{mV} \\] <p>in bipolar mode. I need to check what bipolar mode means. Using that assumption, the signal from a load cell only uses</p> \\[    \\frac{10 \\text{mV}}{2\\cdot39\\text{mV}} \\approx 12.8\\% \\] <p>of the allowable range of the ADC. What does that leave me with? </p> \\[      15.5\\text{ bits}\\cdot0.128\\approx2 \\text{ bits?} \\] <p>That doesn't make sense. I'm probably calculating this totally wrong.</p> <p>Let's try again. It's probably better to use the number of possible values instead of the number of bits. Let's use the 15.5 bit noise-free range of the ADC to calculate how many bits I have to measure the 10 mV load cell signal:</p> \\[     2^{15.5}\\text{ values}\\cdot0.128\\approx 5932\\text{ values       or} \\qquad log_{2}(5932)\\approx \\text{ 12.5 bits} \\] <p>That seems closer to the mark. I can live with 12 bits. This may not be entirely correctly calculated, but it makes me feel better. Arduino forum user jim-p says something about 12 being the probable effective number of bits (ENOB) when you connect a strain gauge to an AD7195. That seems to support my simple calculations. And as they point out in the tutorial, having a much wider input range on the ADC (15.5 bits is 46,341 values) than in the signal itself (12.5 bits is 5,932 values) means that the load cell's offset error (typically 50% of the full-scale signal) and gain error (up to 20%) definitely won't overload the ADC.</p> <p>If I measure 960 samples per second instead of 4800, the useful number of bits in the ADC seems to be about 16.5 (from the graph in the tutorial). If I use 12.8% of that, I have 13.5 effective number of bits. That might be a good compromise; then the resolution is 11863 different values instead of 5932. I've just noticed that in the AD7910 datasheet, the noise performance is only given with sinc3 or sinc4 filtering enabled. There's no information about noise performance if you don't use the filters. So the filters seem important. I need to look into them.</p> <p>For a 2000 kg load cell the estimated accuracy is</p> \\[     \\frac{2000 \\text{ kg}}{5932 \\text{ values}} = 300 \\text{ g} \\] <p>and if I assume the most extreme shock event will be 16 g, then the maximum mass that I can place on top of that load cell (seat plus occupant) is</p> \\[     \\frac{2000\\text{ kg}}{16} = 125 \\text{ kg} \\] <p>For a 5 kg load cell the estimated accuracy is</p> \\[     \\frac{5 \\text{ kg}}{5932 \\text{ values}} = 0.8 \\text{ g} \\] <p>For the 5 kg load cell it makes more sense to think in terms of g's, since I will be using it as a human-scale accelerometer. If I assume that the full range of the load cell represents 16 g then the mass that I attach to the load cell must be</p> \\[     \\frac{5 \\text{ kg}}{16} = 313 \\text{ g} \\] <p>The Wikipedia page on load cells says:</p> <p>The bridge is excited with stabilized voltage (usually 10V, but can be 20V, 5V, or less for battery powered instrumentation). The difference voltage proportional to the load then appears on the signal outputs. The cell output is rated in millivolts per volt (mV/V) of the difference voltage at full rated mechanical load. So a 2.96 mV/V load cell will provide 29.6 millivolt signal at full load when excited with 10 volts. Typical sensitivity values are 1 to 3 mV/V. Typical maximum excitation voltage is around 15 volts.</p> <p>OK, maybe I can supply the load cells with 15V to get a bigger output voltage. But the AD7910 handles the excitation voltage, doesn't it? And it's a 5V device. I'll look a bit further into this.</p> <p>The Wikipedia page on load cells also says:</p> <p>The full-bridge cells come typically in four-wire configuration. The wires to the top and bottom end of the bridge are the excitation (often labelled E+ and E\u2212, or Ex+ and Ex\u2212), the wires to its sides are the signal (labelled S+ and S\u2212). Ideally, the voltage difference between S+ and S\u2212 is zero under zero load, and grows proportionally to the load cell's mechanical load.</p> <p>OK, so my 5 kg S-type load cells have four wires, so they likely have a full Wheatstone bridge. Good. But the 2000 kg S-type load cells have five wires?</p>"},{"location":"projects/daq.html#position-sensor","title":"Position sensor","text":"<p>I bought this 500 mm string potentiometer to measure the seat's position. It has a 0-5k\u03a9 resistance. In retrospect, I would probably rather have picked the 0-5V version, but I can make this work.</p> <p>String pots are expensive! I suppose that you need really precise manufacturing to make the output linear. I wonder if I could make a cheap string pot with an optical sensor instead. Saving that thought for later.</p>"},{"location":"projects/daq.html#digital-communication","title":"Digital communication","text":"<p>My plan is to make a microcontroller board with lots of breakout pins and measurement boards, which can hopefully all be the same. The AD7190 uses something similar to SPI for digital communication. I know that you can connect many devices on the same SPI bus, but you do have to take care that the signals don't overlap or bump into each other. Since I don't want to dive into SPI traffic control for now, I'm going to try to find a microcontroller that can give me enough separate SPI controllers to connect each sensor to a separate SPI bus. </p>"},{"location":"projects/daq.html#option-1-the-rp2040-microcontroller","title":"Option 1: The RP2040 microcontroller","text":"<p>I might try the RP2040. It has eight tiny programmable input-output (PIO) processors which you can program in assembly to bit-bang any communication interface you like. And of course, lots of them are freely available online, made by enthusiasts for enthusiasts. This could be the way if it turns out that the AD7190 uses a non-standard way of communicating over the bus (although I know very little about PIO programming). AD7190 datasheet says that it's SPI compatible but it uses a three-wire interface, while SPI has four wires. Some more  digging is required. Anyway, I need 32 pins for eight separate SPI buses. The Xiao RP2040 only has 11 GPIO pins and the Raspberry Pi Pico has 26 GPIO pins. That's not quite enough. Even the PGA2040 only has 30 GPIO pins. And that's all the GPIO pins that the RP2040 chip has, I'm afraid. Again, I only discovered this when writing it down. Documenting things even before I start making anything seems to be an excellent way to clarify things.</p>"},{"location":"projects/daq.html#option-2-the-samd-family-of-microcontrollers","title":"Option 2: The SAMD family of microcontrollers","text":"<p>An alternative is the SAMD21, which I've come to like using because I can solder it by hand. The SAMD21 has six SERCOM interfaces, which you can configure to be either USART, I2C or SPI. Nice! Except I need seven SPI interfaces. The SAMD51 can give me eight SPI interfaces. It comes in a 64 or 100 pin TQFP package, so I have plenty of pins. I need 32 pins for eight separate SPI buses. I hope I can mill the board for a TQFP chip and solder it. The SAMD51 also has a high-speed SD card interface, which might come in handy for logging data.</p>"},{"location":"projects/daq.html#data-processing-display-and-storage","title":"Data processing, display and storage","text":"<p>I want to learn to use direct memory access (DMA) to receive a value from each sensor, store it in a specific place in memory and when all the DMA channels have flagged the transfer as complete, the main processor takes them from memory and combines all the 24 bit numbers them into one 192 bit number. It then saves that number to the SD card and sends it to the host computer over USB. I might make that number a little bigger, so that I can include timestamps. It seems that USB can carry 512 to 1024 bytes, so that should be fine.</p> <p>On the computer I can make a simple Python program that receives the number, takes it apart into the individual sensor values and adds a plot point on all the graphs using Matplotlib. I can simply keep everything in RAM while it's recording and save the file afterwards.</p>"},{"location":"projects/daq.html#galvanic-isolation","title":"Galvanic isolation","text":"<p>Keeping noise away from it is going to be your main problem.</p> <p>-Anonymous user on the AD7195 thread on the Arduino forum.</p> <p>It might be a good idea to galvanically isolate the DAQ device from the USB port. I could use something like this or this, based on the  ADuM3160 from Analog Devices, or I could try to use the chip on my own board. Here's another one, based on the Analog Devices Adum4160/Adum3160. It even has a galvanically isolated 400 mA power output!</p> <p>To make sure that I can pipe SPI signal over 1-3 m long cables, I've been wondering if I should put a microcontroller on board with the AD converter and use it to take the SPI signals and send them over CANBUS or some other differential signaling method. This note on isolated SPI communication could be useful. It mentions the LTC6820, a chip that uses a similar method; to convert SPI into a differential signal to carry over long wires. So if plain SPI doesn't work, some sort of differential signaling is needed. How about RS-485? I noticed that it's been used a lot at the Center for Bits and Atoms.</p> <p>What? You mean you want to use the Cat-6 cable for the accelerometers? That's actually a bad idea. The ADXL345 is using either I2C or SPI communications and both of those are \"single ended\" meaning each signal is carried on one wire plus ground. That doesn't require twisted-pair cable. In fact, twisted-pair cable is bad for both of those. How far away are the acccelerometers? I2C can have problems with wires as short as 10cm and will always require hard work to get it to go more than 2m. SPI will work at high speed up to 3m and by switching to lower speeds you can get 10m with no special effort on the wiring. Just regular ribbon cable works - not twisted pair. I've got a system of 4 ADXL345's on about 8m of wire in some very harsh conditions and I have had no problems since switching the SPI clock divider to 4. They're sampling one axis each at 400Hz. One tip for the ribbon cable: put a DC wire between clock and data, such as ground. Adjacent wires will transmit high frequency interference between them. My long cables go: CS, MISO, 3.3V, MOSI, GND, CLK. I can share the design for the remote accelerometer PCBs if you want to get some made at OSHPark.</p> <p>-Arduino forum post by user MorganS.</p> <p>One tip for the ribbon cable: put a DC wire between clock and data, such as ground. Adjacent wires will transmit high frequency interference between them. My long cables go: CS, MISO, 3.3V, MOSI, GND, CLK. I can share the design for the remote accelerometer PCBs if you want to get some made at OSHPark.</p>"},{"location":"projects/daq.html#configuration","title":"Configuration","text":"<p>It would be convenient if the sensor modules would tell the main board what they are and how they need to be configured. This is inspired by the plug-and-play functionality of Modular Things. I looked around for an EEPROM memory that I could use to store the sensor's information, but it would be best if I could use a part in the Fab Lab inventory. </p> <p>The ATTINY412 is cheap at $0.50 a piece, and it has a 128B EEPROM. I can hook it up to the same SPI bus as the sensor and it stores the sensor's properties in its EEPROM. When it's connected to the main board, it sends the information and then stops communicating. Now the main processor knows the sensor's properties and sends the proper gain and sampling frequency to the ADC, and the ADC starts streaming data over SPI. It would also be nice to display the sensor type on an OLED screen.</p> <p>Another improvement could be to add a small battery to the main board, so that it can tell the time between data recording sessions. I find it annoying when I have to set the date and time every time I use a recording device. Maybe a supercapacitor would do the trick. It only needs to last for one or two weeks while updating the time every minute or so.</p>"},{"location":"projects/daq.html#schematic-design","title":"Schematic design","text":"<p>I found an Arduino forum thread where jim-p generously shared his schematic for a 24 bit measurement module using the AD7195. I'll base my own design on that, as well as the weigh scale example near the end of the AD7190 datasheet and a circuit note on the product page.</p>"},{"location":"projects/math-animations.html","title":"Math animations","text":""},{"location":"projects/math-animations.html#overview","title":"Overview","text":"<p>Animated circle generated with the manim library for Python.</p> <p>I'm trying out Grant Sanderson's (3Blue1Brown) math animation library for Python. I'm using the community-supported edition of manim, which is the most stable and best documented version. </p>"},{"location":"projects/math-animations.html#installation","title":"Installation","text":"<p>I had a lot of trouble installing manim. First I tried to install it on Linux Mint, which I have running in a virtual machine. I followed the official installation instructions, but when I tried to run a demo animation, I got an error saying that manim isn't installed. Then I tried the Windows installation instructions using Chocolatey and tried to run the demo in VSCode, but I got a similar error. I then tried installing manim in a virtual environment in Anaconda, but that didn't work either.</p> <p>Finally I came across a nice tutorial which shows how to install manim in Google Colab. It almost worked, but I got an error related to the comment in this code:</p> Faulty tutorial codeFixed code <pre><code>%%manim SquareToCircle      # Note the difference from the manual!!!\nclass SquareToCircle(Scene):\n    def construct(self):\n        circle = Circle()  \n        circle.set_fill(PINK, opacity=0.5)  \n        self.play(Create(circle)) \n</code></pre> <pre><code>%%manim CreateCircle\nclass CreateCircle(Scene):\n    def construct(self):\n        circle = Circle()  \n        circle.set_fill(ORANGE, opacity=0.5)  \n        self.play(Create(circle))  \n</code></pre> <p>So I removed the comment (and changed the class name and the fill color of the circle) and I got the animated circle above. I don't understand why the code comment caused a problem, but at least I can finally try out manim! </p>"},{"location":"projects/math-animations.html#design-file","title":"Design file","text":"<p>You can try out all the code on this page without installing anything on your machine:</p> <p>manim-basics.ipynb - Google Colab notebook</p> <p>One code snippet doesn't work. Can you make it work? Please let me know if you figure it out.</p>"},{"location":"projects/math-animations.html#learning-the-basics","title":"Learning the basics","text":"<p>Check out the official quickstart guide for explanations on how all the code on this page works.</p> <p>Here are more demo animations with code:</p> Square to circleSquare next to circleAnimateFlipShiftDifferent rotations <p><pre><code>%%manim SquareToCircle\nclass SquareToCircle(Scene):\n    def construct(self):\n        circle = Circle()\n        circle.set_fill(ORANGE, opacity=0.5)\n        self.play(Create(circle))\n\n        square = Square()\n        square.rotate(PI / 4)\n\n        self.play(Create(square))\n        self.play(Transform(square, circle))\n        self.play(FadeOut(square))\n</code></pre> </p> <p><pre><code>%%manim SquareNextToCircle\nclass SquareNextToCircle(Scene):\n    def construct(self):\n        circle = Circle()  # create a circle\n        circle.set_fill(ORANGE, opacity=0.5)  # set the color and transparency\n\n        square = Square()  # create a square\n        square.set_fill(BLUE, opacity=0.5)  # set the color and transparency\n\n        square.next_to(circle, RIGHT, buff=0.5)  # set the position\n        self.play(Create(circle), Create(square))  # show the shapes on screen\n</code></pre> Now the comments are OK! Something else must have been the problem.  </p> <p><pre><code>%%manim AnimatedSquareToCircle\nclass AnimatedSquareToCircle(Scene):\n    def construct(self):\n        circle = Circle()  # create a circle\n        square = Square()  # create a square\n\n        self.play(Create(square))  # show the square on screen\n        self.play(square.animate.rotate(PI / 4))  # rotate the square\n        self.play(\n            ReplacementTransform(square, circle)\n        )  # transform the square into a circle\n        self.play(\n            circle.animate.set_fill(ORANGE, opacity=0.5)\n        )  # color the circle on screen\n</code></pre> Same thing as Square to circle, but using the .animate method. You have more control over the individual elements when you use the .animate method.  </p> <p><pre><code>%%manim AnimatedSquareToCircleFlip\nclass AnimatedSquareToCircleFlip(Scene):\n    def construct(self):\n        circle = Circle()  # create a circle\n        square = Square()  # create a square\n\n        self.play(Create(square))  # show the square on screen\n        self.play(square.animate.flip())  # flip the square\n        self.play(\n            ReplacementTransform(square, circle)\n        )  # transform the square into a circle\n        self.play(\n            circle.animate.set_fill(ORANGE, opacity=0.5)\n        )  # color the circle on screen\n</code></pre> All I've done here is put flip() instead of rotate(PI / 4).  </p> <p><pre><code>%%manim AnimatedSquareToCircleShift\nclass AnimatedSquareToCircleShift(Scene):\n    def construct(self):\n        circle = Circle()  # create a circle\n        square = Square()  # create a square\n\n        self.play(Create(square))  # show the square on screen\n        vector_1 = Vector([1,2])\n        vector_2 = Vector([-5,-2])\n        self.play(square.animate.shift(vector_1, vector_2))  # shift the square\n        self.play(\n            ReplacementTransform(square, circle)\n        )  # transform the square into a circle\n        self.play(\n            circle.animate.set_fill(ORANGE, opacity=0.5)\n        )  # color the circle on screen\n</code></pre> This returned an error. I don't know how to use the shift command. Maybe I'll get it to work later.</p> <p><pre><code>%%manim DifferentRotations\nclass DifferentRotations(Scene):\n    def construct(self):\n        left_square = Square(color=WHITE, fill_opacity=0.7).shift(2 * LEFT)\n        right_square = Square(color=GREY, fill_opacity=0.7).shift(2 * RIGHT)\n        self.play(\n            left_square.animate.rotate(PI), Rotate(right_square, angle=PI), run_time=2\n        )\n        self.wait()\n</code></pre> </p> <p>Next I'm going to try some of the examples.</p>"},{"location":"projects/t412.html","title":"Hello ATtiny412 USB","text":"<p>I'm working on a version of Neil Gershenfeld's hello T412 boards that would be a good fit for my secondary school students. See Neil's boards here: Basic, output, input and networking. I'll use the ATtiny412 because it's so cheap that all the students can take their boards home with them. This microcontroller is also easy to solder.</p>"},{"location":"projects/t412.html#neils-board","title":"Neil's board","text":"<p>I'm basing the board on Neil Gershenfeld's t412-blink-3 pin board. Its design files are on the Fab Academy 2023 Embedded programming page.</p> <p>First I had a student in my Fab Lab class draw Neil's board in KiCAD, mill it on the Modela MDX-20 and solder the components onto it. The board has a 10 uF decoupling capacitor for the ATtiny412. She then programmed the board using Neil's Arduino sketch:</p> <p>It blinks!</p> <p>The student took the board home, but she doesn't have a USB to serial cable, so she cannot power the board when she wants to. </p>"},{"location":"projects/t412.html#design-spiral-1","title":"Design spiral 1","text":"<p>So my first design modification was to add a USB breakout board to easily power the board:</p> <p></p> <p>It didn't work. When I measured it plugged into a USB power supply, I discovered that its polarity was reversed. Strange, I thought I had checked the polarity before milling. Anyway, lets swap +5V and GND and try again:</p> <p></p> <p>Here it is running Neil's Arduino sketch on USB power:</p>"},{"location":"projects/t412.html#design-files","title":"Design files","text":"<p>My student's board:</p> <p>Download hello_t412_3_blink KiCAD project</p> <p>Download hello_t412_3_blink traces PNG file</p> <p>Download hello_t412_3_blink interior PNG file</p> <p>The USB power breakout board:</p> <p>Download usb_power_for_UPDI_MCUs KiCAD project</p> <p>Download usb_power_for_UPDI_MCUs SVG file</p> <p>Download usb_power_for_UPDI_MCUs traces PNG file</p> <p>Download usb_power_for_UPDI_MCUs interior PNG file</p> <p>Code:</p> <p>Download Neil's Arduino sketch</p>"},{"location":"projects/t412.html#design-spiral-2","title":"Design spiral 2","text":"<p>Design spiral 2 was to put the USB connector on the board with the ATtiny412:</p> <p></p> <p>When working on this board I realized that I had turned the USB connector the wrong way on the USB breakout PCB and that had caused the reversed polarity. So I turned the USB connector the right way round this time and still got the polarity wrong.</p>"},{"location":"projects/t412.html#design-spiral-3-recommended","title":"Design spiral 3 (recommended)","text":"<p>OK. Let's try again, and make the board nice and compact this time. And add a button, for good measure. That makes for more interesting programming exercises.</p> <p></p> <p>Components: ATtiny412, SMD button, 1000 Ohm resistor, LED (any color), 3 pin SMD header (use pliers to break 3 pins off), all from the Fab Lab Inventory.</p> <p>I put three layers of cloth tape on the back of the board, so that it fits snugly into the USB port. Any tape will do, just keep adding layers until the board stays connected inside the USB port.</p> <p></p> <p>To be able to use the ATtiny412 chip, you need to install the Arduino IDE (preferably version 1.8.13) and then install the MegaTinyCore.</p> <p>To connect the board to the computer, plug Neil's serial UPDI-3 pin board (pins, components, traces, traces+exterior, interior) to an FTDI cable like you see in the video at the top of this page (take care to get the wire colors right).</p> <p>I used the DigitalInputPullup example sketch to get the button working. Then I added a boolean logic variable and inverted its value when the button is pressed. This way, I can toggle the LED. </p> <p>The code didn't work the first time around because the button bounces when I press it, and that toggles the LED many times. As a quick fix, I added a 200 millisecond delay and the board now works nicely with this code:</p> <pre><code>bool i = false;\n\n\nvoid setup() {\n  //configure pin 2 as an input and enable the internal pull-up resistor\n  pinMode(2, INPUT_PULLUP);\n  pinMode(4, OUTPUT);\n}\n\n\nvoid loop() {\n  //read the pushbutton value into a variable\n  int sensorVal = digitalRead(2);\n  // Keep in mind the pull-up means the pushbutton's logic is inverted. It goes\n  // HIGH when it's open, and LOW when it's pressed. Turn on the LED when the\n  // button's pressed, and off when it's not:\n  if (sensorVal == LOW) { \n    i = !i;\n    delay(200);\n  }\n    if (i == true) { \n    digitalWrite(4, LOW);\n  } else {\n    digitalWrite(4, HIGH);\n  }\n\n}\n</code></pre> <p>This is a nice minimal board that makes for a good first project:</p>"},{"location":"projects/t412.html#design-files_1","title":"Design files","text":"<p>Download hello_LED_USB-2 KiCAD project</p> <p>Download hello_LED_USB-2 SVG file</p> <p>Download hello_LED_USB-2 traces PNG file</p> <p>Download hello_LED_USB-2 interior PNG file</p>"},{"location":"projects/t412.html#design-spiral-4-abandoned","title":"Design spiral 4 (abandoned)","text":""},{"location":"projects/t412.html#adding-inputs-and-outputs","title":"Adding inputs and outputs","text":"<p>Now I want to expand the board a little bit, so that students can connect sensors to it. </p> <p>I'll make a board that breaks out all the pins of the ATtiny412. I think I'll try to make something similar to Adrian Torres' Adrianino ecosystem, which is based on Neil Gershenfeld's classic hello boards. It might also be a good idea to make it compatible with the Keyestudio 37 in 1 Sensor Kit that we have at the lab. That makes for a quick way to try out a lot of sensors. </p> <p>Note</p> <p>If I use pin PA1 for TX instead of the default PA6 pin, then I can break out the DAC on pin 0. If I have room to route it, that is.</p> <p>Power and ground take up two pins on the microcontroller. If I put a button and an LED on the board, that uses up two pins. If I also do software USB communication and chip programming using the TX and RX pins, then I only have two IO pins left. One of those pins is the UPDI programming pin, so programming via USB had better work. Two IO pins is not a lot, but they should be enough to do a few interesting things. And the board stays tiny!</p>"},{"location":"projects/t412.html#adding-bit-banged-usb-communication","title":"Adding bit-banged USB communication","text":"<p>Using sensors with the board requires a serial connection to a PC, so that you can get the sensor values in the serial monitor.</p> <p>Warning</p> <p>If I run the ATtiny412 at 3.3V for USB communication, it might be incompatible with the Keyestudio sensor kit. Remember to check the sensor voltage before continuing with design spiral 3.</p> <p>Direct USB communication would simplify the board's pinout and enable to program the board at home, so I'm looking into V-USB. This thread has practical info on software USB communication with the ATtiny45 and I can use it with minor modifications for the ATtiny412. The thing that complicates the board design is that USB power is 5V but USB logic is 3.3V. I'm thinking that I'll put a 3.3V regulator on the board and run the ATtiny412 on 3.3V. That way I can do USB communication at the right voltage.</p> <p>Two solutions to the voltage problem are listed in the V-USB hardware considerations. Solution A is to reduce the supply voltage for the microcontroller. The ATtiny412 can run at 3.3V, so I put a 3.3V regulator on this board:</p> <p>USB board with a 3.3V regulator (highlighted) for the ATtiny412.</p> <p>The board is as compact as I could make it. I even reduced the size of the pads for the button. All I had to do was to select the button footprint and press Ctrl+E. Then I made the pads smaller and saved the footprint with Ctrl+S. That only saves the modification for this board, but doesn't change the footprint in the library. I followed this tutorial.</p> <p>Notice the yellow banner that says: \"Editing SW1 from board. Saving will update the board only.\"</p> <p>When the design was finished, I read further and saw that the microcontroller needs to run at a minimum of 12 MHz. In the ATtiny412 datasheet I discovered that the clock only goes up to 10 MHz when the supply voltage is 3.3V. OK. So I need to throw out the regulator and go with solution B in the V-USB hardware considerations.</p> <p>Useful documentation on the ATtiny412 from Fab Academy students is here and here. The FabFTDI is also interesting, because it uses the ATtiny45 with the V-USB library for software-only USB communication.</p>"},{"location":"projects/t412.html#update","title":"Update","text":"<p>I'm in a rabbit hole. As I kept reading about V-USB, the complexity of this tiny project grew. I need to set up the AVR-GCC toolchain and dependencies, modify a make file, set fuses and what not. While I do want to try that at some point, that is not the right thing for my secondary school students. So this is where spiral 3 stops, at least for now.</p> <p>Adafruit reports that the bit-banged USB stuff is becoming increasingly incompatible with modern PC-side USB controllers (well, the other way around), urging people away from the Tiny85 \"ArduinoLike \" products.      - AVR Freaks post by user westfw</p>"}]}
\ No newline at end of file
+{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"index.html","title":"Svavar's Fab Academy Journey","text":""},{"location":"index.html#hi","title":"Hi","text":"<p>My name is Svavar Konr\u00e1\u00f0sson. Welcome to my home on the web. </p> <p>This is the living and evolving documentation of my studies at the amazing Fab Academy, class 2023. I have the good fortune to work at Fab Lab \u00cdsafj\u00f6r\u00f0ur, Iceland. My instructor is \u00de\u00f3rarinn Bjartur Brei\u00f0fj\u00f6r\u00f0 Gunnarsson, director of Fab Lab \u00cdsafj\u00f6r\u00f0ur. My global evaluator is Pablo Nu\u00f1ez, a part of the dream team at Fab Lab Le\u00f3n.</p> <p>If you're technically inclined, you may find some useful stuff on this site. The documentation is lengthy and seems chaotic; but that's because we're encouraged to document everything as we go along, mistakes and all. The best resource for a Fab Academy student is the documentation from other Fab Academy students.</p>"},{"location":"index.html#final-project","title":"Final Project","text":"<p>My final project in the Fab Academy is Baksi the educational robot. </p> <p>Baksi is meant to be small, inexpensive, simple and safe. You can see all the electronics, and yet it has a clean look. You can make one yourself in a Fab Lab anywhere in the world, and the local staff will help you learn the skills that you need to pull it off. So, what are you waiting for?</p> <p>Get started building a BLDC robot from scratch</p> <p></p> <p>A big part of modern technology is in this robot in one way or another; microchips that control motors and communicate with each other, digitally fabricated parts, software to control the robot from the computer and more. I want to use this little bot to get students interested in mathematics and technology. And maybe paint candles.</p> <p>1 minute video about Baksi:</p> <p>I was invited to participate in How to Make Something that Makes (almost) Anything in the spring of 2024! I'm making Baksi more capable there:</p> <p>Baksi on my MIT Machine Class page</p>"},{"location":"index.html#fab-academy-assignments","title":"Fab Academy Assignments","text":"Principles and Practices Computer Aided Design Computer Controlled Cutting Embedded Programming 3D Scanning and Printing Electronics Design Computer-Controlled Machining Electronics Production Output Devices Machine Week Input Devices Molding and Casting Networking and Communications Interface and Application Programming Wild Card Week Applications and Implications Invention, Intellectual Property and Business Models Project Development"},{"location":"index.html#what-is-the-fab-academy","title":"What is the Fab Academy?","text":"<p>First thing: The Fab Academy is open for anyone who wants to make things. There are no prerequisites, and it's basically the same as the legendary MIT class How To Make (almost) Anything. Because of the world wide network of Fab Labs, anyone in the world can apply to the Fab Academy and drink from the firehose of cutting edge technology and whimsical stories that is Professor Neil Gershenfeld, the director of the MIT Center for Bits and Atoms. </p> <p>Presenting my final project.</p> <p>The Fab Academy is the most remarkable educational program I know of. Every year, engineers like me, artists with no technical background, PhD students, high school students and students of the school of life meet up online every Wednesday for the Fab Academy class. Everyone starts at different levels and everyone is required to go outside their comfort zone every week. I'm familiar with mechanical CAD, so in CAD week I tried artistic polygon modeling in Blender. After Neil's dizzying lecture on the week's subject, you have until next Wednesday to make something that works, and document it thoroughly.</p> <p>I spoke about my Fab Academy experience to new students at the 2024 Student Bootcamp:</p> <p> My advice to Fab Academy students (I made a robot and I almost went mad)</p> <p>My experience? It was like getting an acceptance letter into Hogwarts. A vast world opens up to you full of outstanding people who, working together, can make (almost) anything. You have the support of a group of unassuming people around the world who are actually technology wizards, but also appreciate the human element in art and design. It's the only online school where I've actually got to know the people taking part in it. </p> <p>The evolution of my electronics design skills over the course of the Fab Academy. The course puts a heavy emphasis on digital electronics, because that's what makes things come alive!</p> <p>Already I've made a contribution to a Spanish-Icelandic project and I'm only just getting started in the Fab Lab network. I've made friends, laughed and cried and yet the Fab Academy somehow only exists inside my laptop and I struggle to convey how significant this thing is to outsiders. Currently there are 2500 places like this in the world where I can now walk in and start making things (and so can you!) and share stories of struggling to make things work. And the number of Fab Labs in the world doubles every 18 months. Isn't that wild? Something's going on here.</p> <p>I had a fun meeting with Team FMCU. See my contribution here.</p> <p>The Fab Academy has existed in a side reality for a long time, but it's invisible to Muggles. They have their peculiar speech and conventions that are impenetrable to outsiders. They've been videoconferencing since ancient times. You Google the Fab Academy and find a cryptic website full of bare HTML links to technical resources without any explanations. Ah, my friend, but you lack the guidance and the context! Come on in. Check out the meme channel in the Mattermost chat.</p> <p>\u00de\u00f3rarinn, the undisputed Fab Academy meme master. See an example at the bottom of this page. Image from Adri\u00e1n Torres.</p> <p>An introduction to modern technology as we know it might realistically be taken on in a ten-year period, but we rush through it in six months. You'd better keep up, because you need to make microcontroller boards that talk to each other- wait, now you must mill a 3D shape and make a casting- hold on, now it's time for web programming, but lay that to one side because now you need to stay up all night to finish your final project and present it to a hundred faces on your laptop screen that are in all time zones and climates and circumstances in the world and you are now a part of this group, which shares a traumat- I mean a transformative experience. </p> <p>The Icelandic students in Fab Academy 2023: Yours truly, Andri S\u00e6mundsson and Hafey Viktor\u00eda Hallgr\u00edmsd\u00f3ttir.</p> <p>Two out of three Icelanders taking the Fab Academy this year got sick right after their final project presentation, because the pressure had been so high. Was it worth it? It was. I would hardly dare make electronics before but now I'm considering taking an electronic product to market. </p> <p>There is a before and after the Fab Academy. I now know how an aluminum profile feels. You know, they don't heat the material that much, they just push it with enormous force until it deforms and takes on the shape of the die. Before I was a disorganized scatterbrain. Now I'm a scatterbrain who talks about designing things in spirals and documenting everything, not because I'm being forced to do it anymore but because I enjoy the process. What is happening to me?</p>"},{"location":"index.html#becoming-an-instructor","title":"Becoming an instructor","text":"<p>The 2024 Fab Academy Instructor Bootcamp in Le\u00f3n, Spain. My contributions: BLDC Modular Thing and Chat with your repo. Image from Frosti G\u00edslason.</p> <p>I've set up Iceland's first Pre Fab course (you'll need to translate that page). I think it's essential that prospective Fab Academy students try a few things before starting the course itself, so that they know what they're getting into! Before I started the Fab Academy, \u00de\u00f3rarinn taught me to mill on the ShopBot, Hafli\u00f0i walked me through making a simple capacitive sensor and \u00c1rni helped me set up a website. It was unplanned and informal, but it helped me a lot. </p> <p>I've also been scratching my head over how Tom Dubick takes  a cohort of high school students through the Fab Academy every year. We need at least one Tom in every country. I noticed in his students' documentation that they go through a short Pre Fab course before starting the Fab Academy. So I thought it couldn't hurt to try it here, too.</p>"},{"location":"index.html#free-software","title":"Free software","text":"<p>Free and open source software is a part of the culture of Fab Labs.</p> <p>I used to be prejudiced against free and open source engineering software, but I changed my mind during the Fab Academy. Now I teach CAD using Ondsel ES, using the Part workbench (which is simpler and more powerful than Part Design) and the Laser Cut Interlocking workbench:</p> <p>The LCInterlocking workbench is great for CNC milling and laser cutting interlocking parts, but it lacks parametric input and a few other things. Since this workbench hasn't been maintained for a few years, I'm considering forking it and learning enough Python to make the necessary changes (when I have the time!). </p> <p>Part of the furniture that my students made in the fall of 2024.</p> <p>I received a group of primary school students who were interested in 3D printing, so I showed them TinkerCAD and asked if they had email addresses to sign up. Some did, some couldn't remember, so instead of TinkerCAD I opened up the Part workbench in Ondsel and showed them how to make basic shapes, resize and move them to assemble what they wanted. After a little less than two hours, they had produced this:</p> <p></p> <p>I'm also enjoying distilling CAD principles for the Pre Fab course:</p> <p>When I realized that Ondsel/FreeCAD is a capable CAD program, I no longer needed Windows. So I've been daily driving Linux Mint since March of 2024 (my settings) and \u00de\u00f3rarinn joined me this fall. Mint is the friendliest distro, without sacrificing any power or compatibility.</p>"},{"location":"index.html#my-rune","title":"My rune","text":"<p>This is the rune that I made for myself in grade school, made up of my initials SK. To start my Fab Academy journey, I made it digital, using Inkscape.</p>"},{"location":"about-me/agreement.html","title":"Fab Academy Student Agreement","text":"<p>The Fab Academy is responsible for:</p> <ul> <li>Teaching principles and practices of digital fabrication</li> <li>Arranging lectures, recitations, meetings, and events for the class</li> <li>Evaluating and providing feedback on student work</li> <li>Offering clear standards for completing assignments</li> <li>Certifying and archiving student progress</li> <li>Supervising class preparation</li> <li>Reviewing prospective students, instructors, and labs</li> <li>Providing central staff and infrastructure for students, instructors, and labs</li> <li>Fund-raising for costs not covered by student tuition</li> <li>Managing and reporting on the program's finances, results, and impacts</li> <li>Publicizing the program</li> <li>Promoting a respectful environment free of harassment and discrimination</li> <li>Encourage a diverse, accessible, and equitable community</li> </ul> <p>I am a Fab Academy student, responsible for:</p> <ul> <li>Attending class lectures and participating in reviews</li> <li>Developing and documenting projects assigned to introduce and demonstrate skills</li> <li>Allowing the Fab Academy to share my work (with attribution) in the class for purposes compatible with its mission</li> <li>Honestly reporting on my work, and appropriately attributing the work of others (both human and machine)</li> <li>Working safely</li> <li>Leaving workspaces in the same (or better) condition than I found them</li> <li>Participating in the upkeep of my lab</li> <li>Ensuring that my tuition for local and central class costs is covered</li> <li>Following locally applicable health and safety guidance</li> <li>Promoting a respectful environment free of harassment and discrimination</li> </ul> <p>Signed by committing this file in my repository,</p> <p>Svavar Konr\u00e1\u00f0sson</p>"},{"location":"about-me/bio.html","title":"Bio","text":""},{"location":"about-me/bio.html#im-svavar-konrasson","title":"I'm Svavar Konr\u00e1\u00f0sson.","text":"<p>I have a BSc in Mechanical Engineering. The only thing I have left in my Master's degree is the thesis. I'm working on it now.</p> <p>Here's a video where I tell Neil Gershenfeld a little bit about myself during random review.</p>"},{"location":"about-me/bio.html#team-spark","title":"Team Spark","text":"<p>I took part in starting Team Spark, the Icelandic Formula Student team, which designs and fabricates electric racing cars and competes against other university teams at Silverstone circuit in England every year. </p>"},{"location":"about-me/bio.html#ts11","title":"TS11","text":"<p>We got the help of Rafnar employees to make the composite shell of the TS11, our first racing car. The big protrusions on the sides are battery boxes. Because of time constraints, the steel spaceframe was simply covered with plastic sheets and then we draped fiberglass fabric over them and painted them with resin. And then Snorri offered me a job at Rafnar!</p> <p>Our first time at Silverstone Circuit. The car didn't drive, but we learned a lot!</p>"},{"location":"about-me/bio.html#ts12","title":"TS12","text":"<p>This model worked!</p> <p>Building the spaceframe of TS12, our second car (and the first one where we had some idea of what we were doing). Lots and lots of tube cutting and positioning. \u00cdvar (in the middle) designed the square tube jig that positions the main members for welding. We got help from Tekn\u00eds to fabricate it.</p> <p>I'm near the middle, in a teal shirt. We worked with three students from the Icelandic Academy of the Arts, who came up with the name Team Spark, made the logo and chose the team and car colors and designed and made this amazing composite shell which was inspired by the electric eel. This is the unveiling at their graduation exhibition. They even embroidered the logo into the headrest, can you see it?</p> <p>Team Spark at Silverstone circuit with TS12. I'm in the middle.</p> <p>I took TS12 for a spin on a go-kart track. My first time driving an electric car!</p>"},{"location":"about-me/bio.html#rafnar-boatyard","title":"Rafnar boatyard","text":""},{"location":"about-me/bio.html#drofn","title":"Dr\u00f6fn","text":"<p>My first task at Rafnar was to finish the design of this 6m pleasure boat.</p>"},{"location":"about-me/bio.html#leiftur","title":"Leiftur","text":"<p>I did the structural design and Lloyd's Register certification of an innovative RIB at Rafnar boatyard, a boat that is now manufactured in five countries around the world.</p> <p>Pilot house simulation of Leiftur, the most popular Rafnar boat. The first unit, in grey, went to the Icelandic Coast Guard. You really have to take this thing for a spin to see how unique it is.</p> <p>My desk at Rafnar boatyard. The first orange Leiftur being delivered to an Icelandic search and rescue team. Its weight distribution was spot on!</p>"},{"location":"about-me/bio.html#jokla","title":"J\u00f6kla","text":"<p>J\u00f6kla the 15m yacht. I'm casually laying my hand on the boat as though it's my baby, but I had almost no part in its design.</p> <p>One of the double-curved windows in J\u00f6kla broke during construction and the CAD model had also broken, so I got the help of our purchasing manager to measure it very precisely, model it and order a new one. It took ten weeks, cost a million ISK and arrived from Germany perfect, except it was bent the wrong way. </p> <p>I had accidentally set the document to the American orthographic projection standard instead of the European one! I then changed the setting to First angle projection and ordered another glass pane and they let me keep my job. And the yacht turned out beautiful, but this was most of my contribution to it. Drawing standards are important for getting the build right!</p>"},{"location":"about-me/bio.html#kol-carbon","title":"KOL Carbon","text":"<p>A coworker came to me with an idea for a luxury belt and I helped him take it all the way:</p> <p>I designed this compression molded carbon fiber belt buckle. It's an unnecessarily high-performance material, but I like how the fibers catch the light. This design was a good exercise in double-curved modeling.</p> <p>Yours truly modeling the belt.</p> <p>Version 2 of the compression mold, very much simplified and improved. Nice and shiny! The first mold included the hole for the belt, which made the geometry complicated and full of sharp edges which made it tricky to put the SMC material into the mold. With V2 the hole was milled afterwards.</p>"},{"location":"about-me/bio.html#skenkir","title":"Skenkir","text":"<p>This is my favorite university class project:</p> <p>Building Skenkir the robot with Gu\u00f0j\u00f3n Bergmann for a university course. The robot's only purpose in life is to lift a wine glass and give the professor a sip. Skenkir means 'someone who decants' in Icelandic.</p> <p>Because I'm Gyro Gearloose's biggest fan, the robot had to have an actuated hand.</p>"},{"location":"about-me/bio.html#fab-lab-isafjorur","title":"Fab Lab \u00cdsafj\u00f6r\u00f0ur","text":"<p>Now I work at Fab Lab \u00cdsafj\u00f6r\u00f0ur and I'm interested in ways to introduce students to computer-controlled machines.</p> <p>Myself on the left and \u00de\u00f3rarinn Bjartur Brei\u00f0fj\u00f6r\u00f0 Gunnarsson, my Fab Academy instructor and the director of Fab Lab \u00cdsafj\u00f6r\u00f0ur, on the right.</p> <p>I like to think of myself as an inventor. I realize that in many people's minds the word \"inventor\" is almost synonymous with \"crackpot\", but as a child I thought Gyro Gearloose was the coolest character and I always wanted a shed full of tools and inventions like he has. Now I work in a Fab Lab! I've even referred to myself as an inventor in public:</p> <p>Interview in Icelandic about my work and studies</p> <p>I agree with mixtela's thoughts on being an inventor. For me it's like being a writer. You don't have to be a successful published writer to call yourself a writer. You just sit down and write.</p> <p>You can decide to be an inventor. You don't need to have invented a world-changing device, all you need is to make things that you haven't seen before.</p> <p>Note</p> <p>I still need to add more details to the bio. I need to figure out the way to copy text documents from my father's antiquated Tandy 102 portable computer, on which I wrote more text about myself.</p>"},{"location":"about-me/desk.html","title":"My desk","text":"<p> My desk.</p>"},{"location":"about-me/desk.html#video","title":"Video","text":"<p>Video where I tell Neil about myself and the stuff you can see on my desk</p> <p>He was particurlarly interested in the historical Tandy computer.</p>"},{"location":"about-me/desk.html#the-candle","title":"The candle","text":"<p>During the dark winter months I light a candle on my desk every day to keep my father with me.</p>"},{"location":"about-me/desk.html#the-simplest-plywood-laptop-stand","title":"The simplest plywood laptop stand","text":"<p>My ThinkPad laptop can become totally flat! So I milled a simple stand out of two pieces of birch plywood and lasered the Fab Lab \u00cdsafj\u00f6r\u00f0ur logo onto it.</p> <p>On the right is a vertical monitor that I use for coding, reading documents and browsing the internet. Not many people use a vertical monitor, but I quite like it.</p>"},{"location":"about-me/desk.html#beam-robotics","title":"BEAM robotics","text":"<p>In the window on the left are two BEAM bots that I made from salvaged components using instructions in Mark Tilden's book Junkbots, Bugbots and Bots on Wheels. They collect sunlight and store it in capacitors. When the capacitors are full, they release the energy into the motor and the bug moves a little bit. In the summertime, my bugs go wild and sometimes fall off the windowsill. I got the little solar cells from Solarbotics.</p> <p>Around 2012 I was fascinated with a take on AI called situated robotics that started with a paper called Elephants Don't Play Chess. This was long before the large language models. The paper argues that higher level cognitive functions like logic came very late in evolution and therefore our AI efforts should focus on the basics of perception and motion that nature has mostly focused on for billions of years. A BEAM bot has a simple nervous network made of a few analog components that make up a special ring oscillator that Mark Tilden invented. This oscillation can generate crawling and walking motion. The robot is put into its environment, where it does a random walk and hopefully finds some light, and subsequent generations are improved using the roboticist as the force of evolution.</p>"},{"location":"about-me/desk.html#first-3d-prints","title":"First 3D prints","text":"<p>Also in the window is the second thing I ever 3D printed, the Stormtrooper Buddha. The first thing I 3D printed was a replacement knob for a drill press, which Bas Withagen asked me to document.</p>"},{"location":"about-me/desk.html#vinyl-cut-sensors","title":"Vinyl cut sensors","text":"<p>Lined up next to the Stormtrooper Buddha are vinyl cut touch sensors on little acrylic plates, made by my students in the Fab Lab course at \u00cdsafj\u00f6r\u00f0ur Secondary School. I had the group make these sensors the week after I did it myself in the Fab Academy. </p> <p>The step response sensor design comes from Hafli\u00f0i \u00c1sgeirsson. Hafli\u00f0i took me through making a step response touch sensor when we had the Fab Lab Iceland Bootcamp in \u00cdsafj\u00f6r\u00f0ur in 2022. That was my first time milling a circuit.</p>"},{"location":"about-me/desk.html#fab-academy-components-arrive","title":"Fab Academy components arrive","text":"<p>The image below shows my desk when all the components for the Fab Academy arrived. Yay! Outside the window you can see \u00cdsafj\u00f6r\u00f0ur harbor and the mountain Ernir. Ernir is also the name of my older son.</p> <p>My desk when the parts for the Fab Academy arrived. Can you spot the good old Tandy 102 computer?</p>"},{"location":"about-me/desk.html#tandy-102","title":"Tandy 102","text":"<p>Sometimes I use a Tandy 102 laptop from 1985 for writing, because it has the best keyboard I've ever used by far.</p> <p>The Tandy 102 was my father's first laptop. It was one of the first laptops, period.</p> <p>My dad ordered a device that plugs into the computer's RS232 port and allows me to put the files onto an SD card. They're in the ancient .DO format. First came .DO, then .DOC and finally .DOCX. When I insert the SD card into my modern laptop I run a little converter program and voil\u00e1! I can put the text on the web. </p>"},{"location":"about-me/desk.html#the-oscilloscope-watch","title":"The Oscilloscope Watch","text":"<p>The Oscilloscope Watch by Gabriel Anzziani is a marvel, ten years in the making! I backed the Kickstarter in 2013 and received the watch in August 2023! I have enormous respect for Gabriel for completing the project and sending out all the rewards despite all the hurdles along the way.</p>"},{"location":"assignments/overview.html","title":"Fab Academy Assignments","text":"Principles and Practices Computer Aided Design Computer Controlled Cutting Embedded Programming 3D Scanning and Printing Electronics Design Computer-Controlled Machining Electronics Production Output Devices Machine Week Input Devices Molding and Casting Networking and Communications Interface and Application Programming Wild Card Week Applications and Implications Invention, Intellectual Property and Business Models Project Development"},{"location":"assignments/week01.html","title":"Principles and Practices","text":""},{"location":"assignments/week01.html#assignment","title":"Assignment","text":"<ul> <li>Set up a documentation website using GitLab.</li> <li>Plan and sketch a potential final project.</li> </ul> <p>See more info and recording of the lecture here.</p>"},{"location":"assignments/week01.html#final-project-sketch","title":"Final project sketch","text":"<p>Here I am describing my final project idea to Neil Gershenfeld and the students and instructors in Fab Academy cycle 2023. Link to the video.</p> <p>This week, I set up an ideas page with the three ideas that I have for a final project in the Fab Academy. Check them out, they're quite fun! I ended up picking the friendly little educational robot arm called baks. It's powered by brushless servomotors and has a structure made entirely of PCBs! So the robot consists of motors and PCBs and nothing else! I may not be able to get all the way there during the Fab Academy, but I do want to make that happen eventually.</p> <p>I put the Student Agreement on my About page. This is a document that I sign by committing it to my repository and it states the code of conduct that I will abide by during my Fab Academy studies.</p>"},{"location":"assignments/week01.html#image-compression-for-the-web","title":"Image compression for the web","text":"<p>This is the string of ImageMagick commands that I use to compress images for this website on a Linux machine:</p> convert input_image.png -resize 1000 -quality 80 output_image.jpg <p>Note</p> <p>While I was in the Fab Academy I used Windows, and there the command is 'magick' instead of 'convert'.</p> <p>Tip</p> <p>Sometimes I want to convert a PNG with a transparent background to a compressed JPEG with a white background. To do that, I add the commands '-background white -flatten -alpha off'. Otherwise, the background becomes black by default.</p> <p>To compress all the images in a folder on a Windows machine (I rarely use this):</p> magick mogrify -resize 1000 -quality 80 -format jpg *.png <p>You can edit the text right here in the text boxes and then copy it into your terminal to compress your image. That's what I do. If you've installed ImageMagick, all you have to do is click in the address bar in the folder containing your image, type <code>cmd</code> and Enter and paste the commands from the text box into the Command Prompt. I learned how to make the text box here, it's just basic HTML.</p> <p>How to open the Command Prompt in your image folder.</p> <p>I always use -quality 80, but I vary the -resize based on how big the original image is and how much detail I need to show. The resolution is based on how big the image is displayed, which is determined by the width of the central column on my site. I think it's about 690 pixels wide.</p> <p>Note</p> <p>Hang on! I just discovered that I can copy the ImageMagick commands straight into the address bar in Windows Explorer and press Enter. Now that's convenient.</p>"},{"location":"assignments/week01.html#video-compression-for-the-web","title":"Video compression for the web","text":"<p>This is the string of FFMPEG commands that I use to compress videos for this website:</p> ffmpeg -i input_video.mov -vcodec libx264 -crf 25 -preset veryslow -movflags +faststart -vf scale=-2:360 -c:a aac -b:a 128k output_video.mp4 <p>If you've installed FFMPEG, you do the same thing as with the images above, you just type <code>cmd</code> and Enter into the address line of your image folder and copy the commands from the text box above into the Command Prompt. Now you have a much smaller video! </p> <p>I'm quite ruthless about lowering video resolution for my website. The standard resolution I use is 360 lines, this is defined by the scale command. When I just need to show that something blinks or moves, I go down to 240 lines and when I need to show text or other details I go up to 480 lines. I used to use:</p> <pre><code>ffmpeg -i input_video.mov -vcodec libx264 -crf 25 -preset medium -vf scale=-2:360 -acodec libmp3lame -q:a 4 -ar 48000 -ac 2 output_video.mp4\n</code></pre> <p>But I got no audio on iPhones.</p> <p>I found a solution to the no audio on iPhone problem on this website.</p> <p>User DLCom said:</p> <p>ffmpeg -i input -c:v libx264 -b:v 2600k -pass 2 -c:a aac -b:a 128k output.mp4   from the official ffmpeg documentation.</p> <p>So I took the \"-c:a aac -b:a 128k\" and put it instead of the \"-acodec libmp3lame -q:a 4 -ar 48000 -ac 2\" that I had been using and I got sound on the video on my iPhone.</p> <p>Then I added from the official FFmpeg documentation:  https://trac.ffmpeg.org/wiki/Encode/H.264 \"veryslow\" instead of \"medium\", to get better encoding quality I also added \"-movflags +faststart\" so that the video starts playing before it's fully loaded in the browser. The final video compression command is the one in the text box above.</p> <p>Recently I've discovered that I can't move the slider to go forwards and backwards in my latest videos. I can do it in the older ones. I need to look into that.</p>"},{"location":"assignments/week01.html#setting-up-this-website","title":"Setting up this website","text":"<p>I love Material for MkDocs. I use a lot of its features on this website. But one thing is a little annoying: I store all the images and videos and design files in the <code>docs</code> folder and when MkDocs builds the site, it copies all those files over to the <code>public</code> folder! So everything I put on this site gets doubled. I suspect that this is how all static site generators work. It would be really nice to get away with having only one copy of each media file. But even with this drawback, I will continue to use Material for MkDocs, because I'm really happy with this site.</p> <p>The rest of this page is dedicated to how I set up this website using Material for MkDocs. The website is hosted on Gitlab and deployed automatically using this file. But you can also easily deploy an MkDocs website to GitHub Pages. I did that before starting the Fab Academy, to get a little bit of a head start. You can check out the test site. I experimented with lots of different colors, but ended up finding black and white cleaner and more elegant. I also added a dark mode that you can toggle, but removed it again when it didn't work very well with the color scheme I ended up with. I really liked trying all the features in Material for MkDocs, it's a really well designed package and superbly documented.</p> <p>In a video call a few months before the Fab Academy started, \u00c1rni Bj\u00f6rnsson showed M\u00f3ses and me how to set up MkDocs and Git. I've summarized all the steps here, with a few extra resources I found along the way:</p>"},{"location":"assignments/week01.html#mkdocs-setup-from-scratch","title":"MkDocs setup from scratch","text":"<p>First, I installed the VSCode editor.</p> <p>Then, as \u00c1rni Bj\u00f6rnsson suggested, I created a folder called <code>code</code> directly in my C: drive, so that Dropbox and OneDrive don't try to sync the folder and mess up my GitHub connection.</p> <p>I followed this tutorial to set up MkDocs. There are a few steps to it:</p> <ol> <li>It starts with installing the Python extension for VSCode.</li> <li>The <code>pip</code> package manager is included with the Python extension, but for some reason you don't always get the latest version. It may be a good idea to check the version. I opened a new terminal in the top menu in VSCode (<code>Terminal -&gt; New Terminal</code>) and typed  <pre><code>pip --version\npip 22.3.1 from C:\\Users\\your_username\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\pip (python 3.10)\n</code></pre> and if it says it's out of date you can upgrade pip like this: <pre><code>pip install --upgrade pip\n</code></pre></li> <li>Now it was time to install MkDocs: <pre><code>pip install mkdocs\n</code></pre></li> <li>Then, as the tutorial suggests, I typed <code>mkdocs --version</code> to see if the installation went OK: <pre><code>mkdocs --version\nmkdocs, version 1.2.0 from /usr/local/lib/python3.8/site-packages/mkdocs (Python 3.8)\n</code></pre></li> <li>(optional) I also installed the Material theme because it seemed nice and it includes expandable code annotations: <pre><code>pip install mkdocs-material\n</code></pre></li> </ol> <p>Note</p> <p>To enable notes like this one in MkDocs, I added Admonitions to the extensions in the mkdocs.yml file: <pre><code>  markdown_extensions:\n      admonition\n</code></pre> Then, to create a note, start with <code>!!! note</code> and then indent the note text: <pre><code>  !!! note\n    Note text\n</code></pre></p>"},{"location":"assignments/week01.html#mkdocs-test-drive","title":"MkDocs test drive","text":"<p>I followed this tutorial to set up a small test website and get a live preview. </p> <ol> <li>After installing Material for MkDocs, I made a folder called Mkdocs. Then I opened a terminal and made sure that it was in the right folder: <pre><code>cd C:\\code\\Mkdocs\n</code></pre> Then I simply typed <pre><code>mkdocs new .\n</code></pre> and that was enough to create a simple site! Well, there are a few extra steps to view the site and deploy it, but this whole process is very simple.</li> <li>Then I added the following lines to mkdocs.yml: <pre><code>theme:\n  name: material\n</code></pre> This is geared towards the Material theme for MkDocs, so if you're using a different theme, the only thing you need to change is the the theme line in the mkdocs.yml file.</li> <li>Set up autocomplete. The tutorial suggests adding a line to settings.json, but it doesn't mention where that file is in VSCode. But it does provide a link to instructions. You go into <code>File -&gt; Preferences -&gt; Settings</code>, scroll all the way down to Yaml: Schemas, and click <code>Edit in settings.json</code>.  Then you add the line <code>\"https://squidfunk.github.io/mkdocs-material/schema.json\": \"mkdocs.yml\"</code>, so in the end it looks like this: <pre><code>{\n    \"workbench.colorTheme\": \"Default Dark+\",\n    \"files.autoSave\": \"afterDelay\",\n    \"yaml.schemas\": {\n\n        \"https://squidfunk.github.io/mkdocs-material/schema.json\": \"mkdocs.yml\"\n    }\n}\n</code></pre></li> <li>OK, now we're yearning for something to happen. Type the following into the terminal: <pre><code>mkdocs serve\n</code></pre> Now open your browser and write localhost:8000 in the address bar. Voil\u00e1! We have a live preview for an MkDocs website!</li> </ol> Material themeDefault theme <p></p> <p></p> <p>The source code for this site, written in Markdown, looks like this:</p> <p><pre><code># Welcome to MkDocs\n\nFor full documentation visit [mkdocs.org](https://www.mkdocs.org).\n\n## Commands\n\n* `mkdocs new [dir-name]` - Create a new project.\n* `mkdocs serve` - Start the live-reloading docs server.\n* `mkdocs build` - Build the documentation site.\n* `mkdocs -h` - Print help message and exit.\n\n## Project layout\n\n    mkdocs.yml    # The configuration file.\n    docs/\n        index.md  # The documentation homepage.\n        ...       # Other markdown pages, images and other files.\n</code></pre> As you can see, Markdown is simple and readable. Writing <code>#</code> gives you the biggest heading, <code>##</code> gives you heading 2, and so on. Put <code>*</code> in front of text to make a bullet point. To add a link, you do this: <code>[mkdocs.org](https://www.mkdocs.org)</code> and to add an image you do the same, but with an exclamation mark: <code>![Material theme](./images/material.png)</code> 5. Finally, to build a static site, write this in the terminal: <pre><code>mkdocs build\n</code></pre> I tried this and got an index page that works fine. But when I clicked the Setup page (this page) I got this:  Hm. Apparently you need to put the structure of the site into your <code>mkdocs.yml</code> file to explicitly state the site navigation. So I opened it up and added <pre><code>  nav:\n    - 'index.md'\n    - 'code.md'     # The code page is just a few code block tests in different languages.\n    - 'setup.md'\n</code></pre> No, that didn't work either. After some looking around I found a solution. I added the following line to <code>mkdocs.yml</code>: <pre><code>use_directory_urls: false\n</code></pre> It works! And the first solution is unnecessary; MkDocs will infer the site navigation based on the pages you create in the docs folder.</p> <p>Setting up MkDocs and getting the live preview working took me an hour in the morning. Writing up how I did it took me the rest of the day. Writing this documentation was a great way to learn Markdown. I like Markdown, with one exception; I don't have the ` symbol  on my keyboard. I need to use this symbol quite a lot for code snippets. I did a bit of searching and found that the shortcut <code>Alt-96</code> is bound to the ` symbol. Now I use that shortcut all the time.  And this page serves as my Markdown reference, when I start to forget how to format things.</p> <p>Note</p> <p>To enable code highlighting (coloring the code, similar to how it looks in the VSCode editor), I added the following lines to <code>mkdocs.yml</code>: <pre><code>markdown_extensions:\n- pymdownx.highlight:\n    anchor_linenums: true\n- pymdownx.inlinehilite\n- pymdownx.snippets\n- pymdownx.superfences\n- pymdownx.details\n</code></pre> I'm not sure if all these lines are necessary, but I'm just following this tutorial. The last line comes from somewhere else, I don't remember where. Anyway, now I can make a code block by enclosing the code with ``` at the top and bottom and including the name of the language at the top: <pre><code>    ```python\n    # This program prints Hello, world!\n    print('Hello, world!')\n    ```\n</code></pre> This results in: <pre><code># This program prints Hello, world!\nprint('Hello, world!')\n</code></pre> You can use this reference to write the name of the programming language correctly at the top of your code block.</p> <p>One more thing, I also added</p> <p><pre><code>markdown_extensions:\n  - attr_list\n  - md_in_html\n</code></pre> to add the ability to align images, add captions and mark large images for lazy loading, as per this tutorial.</p>"},{"location":"assignments/week01.html#customizing-the-theme","title":"Customizing the theme","text":"<p>There is a way to toggle between light and dark mode. This tutorial says that it's enough to copy the following code into <code>mkdocs.yml</code>:</p> Light/dark toggleLight/dark toggle + Color change <pre><code>theme:\n    palette: \n\n    # Palette toggle for light mode\n    - scheme: default\n      toggle:\n        icon: material/brightness-7 \n        name: Switch to dark mode\n\n    # Palette toggle for dark mode\n    - scheme: slate\n      toggle:\n        icon: material/brightness-4\n        name: Switch to light mode\n</code></pre> <pre><code>theme:\n    palette: \n\n    # Palette toggle for light mode\n    - scheme: default\n      toggle:\n        icon: material/brightness-7 \n        name: Switch to dark mode\n      primary: red\n      accent: red\n\n    # Palette toggle for dark mode\n    - scheme: slate\n      toggle:\n        icon: material/brightness-4\n        name: Switch to light mode\n    primary: red\n      accent: red\n</code></pre> Source code for the content tabs above<pre><code>    === \"Light/dark toggle\"\n        ``` yaml\n        theme:\n            palette: \n\n            # Palette toggle for light mode\n            - scheme: default\n            toggle:\n            icon: material/brightness-7 \n                name: Switch to dark mode\n\n            # Palette toggle for dark mode\n            - scheme: slate\n            toggle:\n                icon: material/brightness-4\n            name: Switch to light mode\n        ```\n    === \"Light/dark toggle + Color change\"\n        ``` yaml\n        palette: \n\n            # Palette toggle for light mode\n            - scheme: default\n            toggle:\n                icon: material/brightness-7 \n                name: Switch to dark mode\n            primary: red\n            accent: red\n\n            # Palette toggle for dark mode\n            - scheme: slate\n            toggle:\n                icon: material/brightness-4\n                name: Switch to light mode\n            primary: red\n            accent: red\n        ```\n</code></pre> <p>Note</p> <p>How to enable content tabs in <code>mkdocs.yaml</code>: <pre><code>markdown_extensions:\n- pymdownx.superfences\n- pymdownx.tabbed:\n      alternate_style: true \n</code></pre></p> <p>I also discovered that if you select a command, right click and select Change All Occurrences in VSCode, you only need to write the new color once, instead of four times. Nice! Finally, I made a logo in Inkscape. I designed this logo in grade school, it's a kind of Icelandic rune that combines my initials S and K. Then I added two lines to <code>mkdocs.yml</code> to change the logo in the top left corner and also the favicon (the icon you see in the browser tab). <pre><code>theme:\n  logo: images\\SK_logo.svg\n  favicon: images\\SK_logo.svg\n</code></pre> First I wrote the path as <code>/images/SK_logo.SVG</code> and VSCode complained about the formatting. I found that you can right click the image and select Copy Relative Path to get the right formatting. That gave me <code>docs\\images\\SK_logo.svg</code>, which didn't work, but when I changed it to <code>images\\SK_logo.svg</code> it worked. I also enabled two navigation options: <pre><code>theme:\n  features:\n    - navigation.instant    # Instant loading (page behaves like a single-page application, search persists between pages)\n    - navigation.tabs       # The pages are visible as tabs at the top instead of on the left hand side.\n</code></pre></p>"},{"location":"assignments/week01.html#page-source","title":"Page source","text":"<p>The Markdown code for the View page Source button is like this: <pre><code>[View page source](setup.txt){ .md-button }\n</code></pre> I'm going to put it on every page of my documentation. If you see an interesting element in the page, you can then easily see how to set it up. Pointing to a <code>.md</code> file doesn't work, so my workaround is to make a copy of the Markdown source file and change its extension to <code>.txt</code>.</p> <p>I made a Python script using this tutorial and put it in the MkDocs folder. The script copies all the .md files in the docs folder to another folder called textfiles and converts their extension to .txt. The View Page Source button at the bottom of each page links to its respective .txt file. The Python code has some bug, so that it only converts code.md to code.txt, but I'm happy that I was able to get that far.</p> <p>To change the theme for just the home page, I followed tmeuze's advice in this issue. To <code>mkdocs.yml</code> I added <pre><code>    custom_dir: docs/overrides\n</code></pre> and created a <code>docs/overrides</code> folder. Then I was unsure how to set up a custom theme, so I stopped there.</p> <p>To enable the Github Repository button in the top right corner, I followed this example and added the following to my <code>mkdocs.yml</code>, just below <code>site_name</code>: <pre><code>repo_name: Github Repository\nrepo_url: https://github.com/svavarkonn/MkDocs\n</code></pre></p> <p>I added <pre><code>theme:\n    features:\n        - navigation.tracking\n</code></pre> so that the URL in the address bar changes as you scroll down the page. If you copy the URL, the page will open in the section where you were when you copied it. Might be convenient if someone wants to link to something on this site.</p> <p>I also added</p> <p><pre><code>theme:\n    features:\n        - navigation.tabs\n        - navigation.tabs.sticky\n</code></pre> to make the top navigation follow you as you scroll down the page.</p> <p>By default, an \"Edit this page\" symbol is added to the right of the headline of every page.   When you click it you just get a 404 error. I followed this to remove the edit button. I just add the CSS code <pre><code>&lt;style&gt;\n  .md-content__button {\n    display: none;\n  }\n&lt;/style&gt;\n</code></pre> to the .md file of each page and voil\u00e1! The edit button disappears.</p> <p>To enable icons and emojis, I followed the Material for MkDocs documentation on icons and emojis and added the following to <code>mkdocs.yml</code>: <pre><code>markdown_extensions:\n  - attr_list\n  - pymdownx.emoji:\n      emoji_index: !!python/name:materialx.emoji.twemoji\n      emoji_generator: !!python/name:materialx.emoji.to_svg\n</code></pre> Now I can make faces :smile: (Hmm, apparently this isn't working anymore.)</p> <p>To enable keyboard keys like Ctrl+Alt+Del, I added the following to <code>mkdocs.yml</code>: <pre><code>markdown_extensions:\n  - pymdownx.keys\n</code></pre> Now I can add keyboard keys into the text by enclosing the expression with ++, and using one + between keys. The buttons above are made by typing <code>++ctrl+alt+del++</code>. Here is the key reference.</p> <p>There is no way to make image captions in Markdown. This seems like a glaring omission. I used this method of putting the caption in the next line after the image tag and enclosing the caption with **. Like this:</p> <pre><code>![Git discussion](images/hategit.PNG)\n*Some sentiments about Git*\n</code></pre> <p>The image and caption are displayed like this:  Sentiments about Git</p> <p>The caption is inline with the image, which is not great, but the workflow is simple, so I'm keeping it. If the caption doesn't work, put it inline with the image tag.</p> <p>View page source</p> <p>I've stopped using the page source button above, which links to a text file that I need to update manually. I've instead added an icon next to the page title at the top. I got the icon from Iconify. The icon links to the page source in the Github repository.</p>"},{"location":"assignments/week01.html#mathjax","title":"MathJax","text":"<p>I installed MathJax by following the steps in the Material for MkDocs documentation. Now I can display beautiful equations on my website, using LaTex syntax.</p>"},{"location":"assignments/week01.html#git-setup","title":"Git setup","text":"<p>I cloned my Fab Academy repository on Gitlab to my computer with  <pre><code>$ git clone https://gitlab.fabcloud.org/academany/fabacademy/2023/labs/isafjordur/students/svavar-konradsson.git\nCloning into 'svavar-konradsson'...\nremote: Enumerating objects: 15, done.\nremote: Counting objects: 100% (15/15), done.\nremote: Compressing objects: 100% (14/14), done.\nremote: Total 15 (delta 1), reused 0 (delta 0), pack-reused 0\nReceiving objects: 100% (15/15), 28.91 KiB | 7.23 MiB/s, done.\nResolving deltas: 100% (1/1), done.\n</code></pre> Then I edited index.html a little bit and tried pushing the change to the online repo on Gitlab: <pre><code>git push\nwarning: missing OAuth configuration for gitlab.fabcloud.org - see https://aka.ms/gcm/gitlab for more information\nremote: HTTP Basic: Access denied. The provided password or token is incorrect or your account has 2FA enabled and you must use a personal access token instead of a password. See https://gitlab.fabcloud.org/help/topics/git/troubleshooting_git#error-on-git-fetch-http-basic-access-denied\nfatal: Authentication failed for 'https://gitlab.fabcloud.org/academany/fabacademy/2023/labs/isafjordur/students/svavar-konradsson.git/'\n</code></pre> I looked up how to get an access token and my instructor \u00de\u00f3rarinn asked \u00c1rni at Fab Lab Akureyri if tokens are the thing to use. \u00c1rni recommended using an SSH key instead. I managed to generate an ssh key using this tutorial:</p> <p><pre><code>$ ssh-keygen -t ed25519 -C \"generate an ssh key for gitlab to clone my repository\"\nGenerating public/private ed25519 key pair.\nEnter file in which to save the key (/n//.ssh/id_ed25519): \nEnter passphrase (empty for no passphrase): \n</code></pre> Then I wasn't able to type anything as a passphrase. Then I found that I was able to type, but the Git Bash terminal just didn't show anything. I wrote a phrase twice and hit Enter. I got an SSH key.</p> <p>OK, I have an SSH key, but what do I do with it? And why? Why is this so complicated? I just want to upload some files to the internet.</p> <p>Then I found this tutorial on adding an SSH key to my Gitlab account and followed it blindly.</p> <p>I used <code>$ cat ~/.ssh/id_ed25519.pub | clip</code> to copy the contents of the SSH key file.</p> <p>Put it into the Gitlab account under profile -&gt; SSH keys -&gt; Add an SSH key.</p> <p>Then went into C:/code and said `git clone \"the thing I copied when I pressed clone in gitlab\"'</p> <p>Then I got the message: <pre><code>*** Please tell me who you are.\n\nRun\n\n  git config --global user.email \"you@example.com\"\n  git config --global user.name \"Your Name\"\n\nto set your account's default identity.\n</code></pre> I set the identity: <pre><code>PS C:\\code\\svavar-konradsson&gt; git config --global user.email \"my@email.com\"\nPS C:\\code\\svavar-konradsson&gt; git config --global user.name \"Svavar Konradsson\"\n</code></pre></p> <p>and then said <code>git clone</code></p> <p>That worked! I opened index.html, put my name into the title and saved. That appeared under Source control in Gitlab, I wrote a comment in a field and clicked Commit. Then a Sync button appeared and I pressed that and it pushed the site onto the online repo.</p> <p>Now I need to type my passphrase twice every time that I push files to the online repo. That's annoying, so I'm going to generate a new SSH key and skip the passphrase. I followed \u00c1rni Bj\u00f6rnsson documentation to generate an RSA key and put it into my Gitlab profile.</p> <p>Every time I made major changes in Windows Explorer; deleted lots of files and moved others, I needed to generate a new SSH key. The last one was</p> <p>ssh-keygen -t rsa -b 2048 cat ~/.ssh/id_rsa.pub | clip</p> <p>The MkDocs convention is to put the built web page into a folder called site, but Gitlab needs the web site to be in a folder called public.  Finally I found the site_dir setting, which I can change in mkdocs.yml so that I can rename the <code>site</code> folder to <code>public</code>.</p> <p>At first I manually renamed site to public and pushed the files to the Gitlab repo. I got into trouble when the dot in front of the file <code>.gitlab-ci.yml</code> was erased somehow and the site wasn't deployed. My instructor \u00de\u00f3rarinn found the problem and after that the site worked.</p>"},{"location":"assignments/week02.html","title":"Computer-Aided Design","text":""},{"location":"assignments/week02.html#assignment","title":"Assignment","text":"<ul> <li>Model (raster, vector, 2D, 3D, render, animate, simulate, ...) a possible final project,</li> <li>compress your images and videos,</li> <li>and post a description with your design files on your class page.</li> </ul> <p>See more info and recording of the lecture here.</p>"},{"location":"assignments/week02.html#raster-image-editing","title":"Raster image editing","text":"<p>My instructor \u00de\u00f3rarinn gave me a quick demo of how to isolate an object in an image and make the background transparent. That will probably come in handy in many situations. We'll use Photopea, a free online (and downloadable) photo editor that closely resembles Photoshop. You can even go through Photoshop tutorials in Photopea. </p> <p>Let's start by taking a picture of a roll of tape with flat lighting, and we'll try to avoid having shadows. I'll use the magic wand to select pixels with the a similar color as the pixel under the mouse. Then I'll invert the selection and finally I'll make a mask.</p> <p></p> <p>Next I will use the brush tool to remove the rest of the background. I can hold Alt and the right mouse button to adjust the size and softness of the brush. </p> <p></p> <p>Now I brushed away the rest of the background. But sometimes I accidentally brush away part of the object.</p> <p></p> <p>Tip from \u00de\u00f3rarinn: If you brush away too much, you can press X and switch to the other color in the mask. Then you can brush the object back into the picture.</p> <p></p> <p>Finally, it can be good to add a color fill layer. It can make it easier to see spots that you missed with the brush. You need to drag the color layer below the image layer in the menu on the right. Then the color is behind the image.</p> <p> Missed a bit!</p> <p>Raster image compression To compress the images for the web I installed ImageMagick for Windows from the website. The installation included FFmpeg. I couldn't find any info on the website on how to get started (for someone who doesn't use command line tools), but then I came across Aaron Logan's Fab Academy site from 2022. He recommended following along with this video and that did the trick for me. It was useful to see the trick of writing <code>cmd</code> in the address bar of the folder that includes the images, and then the Windows Command Prompt opens in that directory. </p> <p>Failure</p> <p>I entered <pre><code>magick convert 2023-02-02 15_22_45-Photopea _ Online Photo Editor.png -resize 40% -quality 80 output2.jpg\nconvert: unable to open image '2023-02-02': No such file or directory @ error/blob.c/OpenBlob/3569.\nconvert: no decode delegate for this image format `' @ error/constitute.c/ReadImage/741.\nconvert: unable to open image '15_22_45-Photopea': No such file or directory @ error/blob.c/OpenBlob/3569.\nconvert: unable to open image '15_22_45-Photopea': No such file or directory @ error/blob.c/OpenBlob/3569.\nconvert: no decode delegate for this image format `' @ error/constitute.c/ReadImage/741.\nconvert: unable to open image '_': No such file or directory @ error/blob.c/OpenBlob/3569.\nconvert: unable to open image '_': No such file or directory @ error/blob.c/OpenBlob/3569.\nconvert: no decode delegate for this image format `' @ error/constitute.c/ReadImage/741.\nconvert: unable to open image 'Online': No such file or directory @ error/blob.c/OpenBlob/3569.\nconvert: unable to open image 'Online': No such file or directory @ error/blob.c/OpenBlob/3569.\nconvert: no decode delegate for this image format `' @ error/constitute.c/ReadImage/741.\nconvert: unable to open image 'Photo': No such file or directory @ error/blob.c/OpenBlob/3569.\nconvert: unable to open image 'Photo': No such file or directory @ error/blob.c/OpenBlob/3569.\nconvert: no decode delegate for this image format `' @ error/constitute.c/ReadImage/741.\nconvert: unable to open image 'Editor.png': No such file or directory @ error/blob.c/OpenBlob/3569.\nconvert: unable to open image 'Editor.png': No such file or directory @ error/blob.c/OpenBlob/3569.\nconvert: no images defined `output2.jpg' @ error/convert.c/ConvertImageCommand/3342.\n</code></pre></p> <p>I guess ImageMagick didn't like the file name that the Greenshot screen grabbing tool generates. My instructor \u00de\u00f3rarinn recommended Greenshot to me, it's lightweight and because it freezes the screen, you can grab screenshots where your mouse shows up. I tried renaming one of the files to 1.png and then the ImageMagick compression command worked: <pre><code>C:\\code\\FabAcademyImagesUncompressed\\week02&gt;magick convert 1.png -resize 40% -quality 80 output1.jpg\n</code></pre> But I wanted to convert a whole folder of images with one command. This batch resize tutorial showed my how to set the width of the resized image while keeping the original aspect ratio. Now I put all the uncompressed images for the week in one folder and run <pre><code>magick mogrify -resize 560 *.png\n</code></pre> to resize all the images in the folder to be 560 pixels wide. I didn't even have to rename them this time. Then I run <pre><code>magick mogrify -format jpg *.png\n</code></pre> to convert all the images in the folder to JPEG format. Be aware that <code>mogrify</code> doesn't copy the images but changes the originals. So I just make copies of them first and put them all in one folder before running the <code>mogrify</code>. Here's the mogrify documentation.</p> <p>To resize and compress single images as I go along, I use <pre><code>magick convert image.png -resize 560 image.jpg\n</code></pre></p>"},{"location":"assignments/week02.html#design-file","title":"Design file","text":"<p>Here is the finished product:</p> <p></p>"},{"location":"assignments/week02.html#3d-modeling-in-blender","title":"3D modeling in Blender","text":"<p>Since I can generally get Fusion 360 to do what I want it to, I decided to learn a little bit about Blender. I've been missing a way to edit STL meshes and model organic stuff, so here we go.</p> <p>Right after you click Download, this Youtube tutorial series appears on the Blender website. So I got started and acquainted myself with the viewport navigation. Remember that you can press F to go to full screen on Youtube.</p> <p> Rotate by pressing and holding the XYZ axes in the image.</p> <p>You rotate by holding down the scroll button on the mouse, just like in SolidWorks. So that's convenient. There's also a set of XYZ axes in the top right corner that you can grab and rotate like the Autodesk ViewCube. You can also click top, side and front views. Nice. Clicking and holding the little hand button next to the axes moves the center of rotation. And you zoom by scrolling the wheel.</p> <p>The little camera symbol next to the axes lets you look through the camera that you've put into the scene (you can also press 0 on the number pad). Someone in the Youtube comments mentioned that F12 renders the camera view. So 0 and then F12 is a quick way to render the model. Next to the camera icon is a grid symbol, which switches between orthographic mode (good for modeling) and perspective mode (good for rendering realistic images).</p> <p>It's good to keep an eye on the status bar on the bottom, which shows you the context you're working in at the moment. Ctrl+Space is a convenient way to maximize any viewport or panel in the interface, and then you can press Ctrl+Space again to return to the default setup:</p> <p> Default interface (left) and Ctrl+Space to maximize side panel (right).</p> <p>There are several tabs at the top that represent different workspaces. In each workspace, the panels in the Blender interface have been set up for that particular task:</p> <p></p> <p>All the viewports and panels can be resized. To choose a different panel, click the symbol with the down arrow in its top left corner:</p> <p></p> <p>In the Layout workspace, pressing T will open commonly used tools like Move and Scale, and pressing ++N++ will open info about the selected object, tool-specific options and view options.</p> <p>  Left menu is toggled with T, right menu is toggled with N.</p> <p>Notice the little tabs on the right side of the right menu called Item, Tool and View. In the View tab, you can edit the position of the 3D cursor, which acts as the spawning point for new objects and you can do things like pivot objects around it.</p> <p>In the Layout workspace, the Timeline below the viewport controls the playback of the animation. You can scroll to zoom in and out and hold the scroll wheel to pan. You can define start and end points and add key frames.</p> <p>Warning</p> <p>DON'T MAKE TUTORIALS</p> <p>In our weekly local Fab Academy meeting in Iceland, I mentioned how long the documentation was taking and that I wasn't getting anywhere with Blender. My instructor \u00de\u00f3rarinn said that I shouldn't be making a tutorial on how to use Blender but rather summarize what I did, what was interesting and then link to the tutorial that I used. That's a relief. The rest of this page will be more concise and interesting.</p> <p>I ended up quitting the official Blender tutorial after the third video and starting the doughnut tutorial by Blender Guru on Youtube. I remember things much better when I have a goal in mind and just use the tools I need to achieve it. I followed videos 1 through 6.</p> <p>I haven't modeled anything organic before, so it was interesting to try make the doughnut lopsided and kind of realistic. It goes against my engineering training, where you usually want things to be symmetrical. I liked getting to know subdivision modeling, to make smooth object using relatively few polygons. And I really liked that my  3D mouse works in Blender.</p> <p>The few times when I've attempted to edit a mesh, I've moved single vertices, resulting in gnarly, pointy looking objects. So I always gave up! But now that I know about proportional editing in Blender, I can select a single vertex and the vertices close to it will follow, while those further away will be affected less. This is much quicker and more effective. I love it! And thinking about my final project, the robot arm, it would be lovely to make a keypoint editor to move it, and use proportional editing to move the keypoints around the moved point, to get a smooth rolloff. I also want to remember the Alt+S shortcut to make the faces move directly outward (normal to the faces).</p> <p> </p> <p>I still have some way to go before I'll be confident in my mesh editing skills. Here's my first attempt to make the icing on the doughnut droop:</p> <p> Side view looks good, top view reveals what's actually going on.</p> <p>After some backtracking, the icing started to look good by direct editing of the vertices. Next I tried a bit of sculpting. That means using brushes to edit the mesh. I was able to make drops in the icing by sculpting it.</p>"},{"location":"assignments/week02.html#rendering-in-blender","title":"Rendering in Blender","text":"<p>I tried adjusting the camera view and the light to get a good result. I tried bot the Eevee real-time rendering engine and the more realistic, but much slower, Cycles ray-tracing rendering engine. The rendering was quite slow until I enabled the CUDA graphics card in the laptop.</p> <p>Final result</p>"},{"location":"assignments/week02.html#design-file_1","title":"Design file","text":"<p>The doughnut Blender file is 6.8 MB, so I won't include it here. But I uploaded it to Sketchfab:</p> <p>  Doughnut made in Blender  by  svavarkonn  on Sketchfab</p>"},{"location":"assignments/week02.html#blender-simulation","title":"Blender simulation","text":"<p>I also went through a really quick tutorial on cloth simulation. Here is the result:</p> <p></p> <p>It's fascinating! There are doors opening for me left and right! Blender is a pretty incredible piece of sofware. </p>"},{"location":"assignments/week02.html#design-file_2","title":"Design file","text":"<p>The Blender file is 20.2 MB, so I won't include it here. But I uploaded it to Sketchfab:</p> <p>  Monkey + dish rag cloth simulation  by  svavarkonn  on Sketchfab</p> <p>You can make your own in ten minutes plus maybe 30 minutes of render time.</p>"},{"location":"assignments/week02.html#2d-design-in-inkscape","title":"2D design in Inkscape","text":"<p>I've started using Inkscape a bit since I started working at Fab Lab \u00cdsafj\u00f6r\u00f0ur. But I haven't used the Clone tool before. Here's a little experiment with cloning a rectangle:</p> <p></p> <p>I didn't save the Inkscape file, it wasn't very interesting.</p>"},{"location":"assignments/week02.html#antimony-modeler","title":"Antimony modeler","text":"<p>I set up a Raspberry Pi in the case that I need to use Linux during the course. I used this tutorial to enable cloud connection. That way I can connect to the Raspberry Pi from outside its network. When I connected remotely for the first time, the screen resolution was tiny because the Raspberry Pi wasn't connected to a monitor. I followed this tutorial to hardcode the screen resolution into the boot config text file. </p> <p>I tried to build Matt Keeter's Antimony modeler on the Raspberry Pi, but without luck.</p> Failure <pre><code>sudo apt install git build-essential libpng-dev python3-dev libboost-all-dev libgl1-mesa-dev lemon flex qt5-default ninja-build cmake\nReading package lists... Done\nBuilding dependency tree... Done\nReading state information... Done\nPackage qt5-default is not available, but is referred to by another package.\nThis may mean that the package is missing, has been obsoleted, or\nis only available from another source\nE: Package 'qt5-default' has no installation candidate\n</code></pre> <p>I tried to install qt5 instead of qt5-default, but it didn't work.</p> Failure <pre><code>sudo apt install git build-essential qt5\nReading package lists... Done\nBuilding dependency tree... Done\nReading state information... Done\nE: Unable to locate package qt5\n</code></pre> <p>I don't know where to go from there.</p>"},{"location":"assignments/week02.html#update-after-fab-academy","title":"Update after Fab Academy","text":"<p>I installed Linux Mint in a virtual machine using VirtualBox, which was really easy. When browsing the software manager I came across Antimony, already built and ready for download! I tried a few operations and connected them together using the node view. I always find node software like this intimidating, but it didn't take long for it to become intuitive. Here's what I made:</p> <p>Simple test where I combined features.</p> <p>You can easily do things that are hard in other CAD software. Here I made a cone, rotated it and put a twist on it.</p> <p>I'd like to 3D print these models. I tried to move the files from the virtual machine to my Windows 10 desktop but the drag and drop feature didn't work. I also tried setting up a shared folder between the two operating systems, which appeared in Windows but I couldn't see it in Linux Mint.</p> <p>I find it really cool that the world's most advanced 3D printed rocket nozzles are being designed in CAD software that's based on Matt Keeter's geometry kernel.</p>"},{"location":"assignments/week02.html#antimony-in-windows","title":"Antimony in Windows","text":"<p>I set up the Windows Subsystem for Linux. Now I have Ubuntu running inside Windows at near-native speed. I installed Antimony inside WSL and now I can open this unusual Linux-based CAD program from the Windows Start menu. From an free software perspective the WSL is kind of grotesque, but it's just so convenient. Here's how you can do it:</p> <p>You need WSL2 to run Linux apps with a graphical user interface. Here are the instructions that I followed to set up WSL2. It's super simple if you have a recent enough version of Windows, just open up Command Prompt by opening the Start menu and typing <code>cmd</code>, and then type in:</p> <pre><code>wsl.exe --install\n</code></pre> <p>After a few minutes the Windows Subsystem for Linux is installed on your machine and you can open the Ubuntu terminal.</p> <p>After a bit of searching I found this page, which told me how to install Antimony on Ubuntu 22.04 using the Debian apt package manager. Open the Start menu in Windows and type Ubuntu to get the Ubuntu terminal running. This is what you put into the Ubuntu terminal to install Antimony:</p> <pre><code>sudo apt-get -y install antimony\n</code></pre> <p>That's it! Now you can open Antimony like a Windows app and play around with it any time!</p>"},{"location":"assignments/week02.html#kokopelli-modeler","title":"Kokopelli modeler","text":"<p>I also tried to build Matt Keeter's Kokopelli from source on the Raspberry Pi, but also without luck:</p> Failure <pre><code>sudo apt-get install python python-dev python-pip gcc g++ libpng12-dev make bash cmake\nReading package lists... Done\nBuilding dependency tree... Done\nReading state information... Done\nNote, selecting 'python-is-python2' instead of 'python'\nNote, selecting 'python-dev-is-python2' instead of 'python-dev'\nPackage libpng12-dev is not available, but is referred to by another package.\nhis may mean that the package is missing, has been obsoleted, or\nis only available from another source\n\nPackage python-pip is not available, but is referred to by another package.\nThis may mean that the package is missing, has been obsoleted, or\nis only available from another source\nHowever the following packages replace it:\n  python3-pip\n\nE: Package 'python-pip' has no installation candidate\nE: Package 'libpng12-dev' has no installation candidate\n</code></pre>"},{"location":"assignments/week02.html#voxel-modeling","title":"Voxel modeling","text":"<p>I tried the MagicaVoxel program without looking at a tutorial, and made this figure:</p> <p></p> <p>I'm not sure how to make anything useful with this modeling method. Maybe I'll think of something later.</p>"},{"location":"assignments/week02.html#design-file_3","title":"Design file","text":"<p>Here's the voxel guy I made:</p> <p>Download voxel guy</p>"},{"location":"assignments/week02.html#solvespace-parametric-3d-cad","title":"Solvespace parametric 3D CAD","text":"<p>I went through a Solvespace tutorial and quite liked the experience. I like the dark 8-bit look of it. I was also surprised to find that my 3D mouse works in Solvespace. The program is lightweight and modeling seems quick, once you've memorized a few keyboard shortcuts and familiarized yourself with how the sketch constraints work. In the time that it took Fusion 360 to open, I saved the bracket and exported it as STEP, STL and a triangle mesh with a Three.js html viewer. You can open the 3D model in the browser below!</p> <p>Open bracket 3D model in browser</p> <p>Solvespace was written by Jonathan Westhues and he's made other impressive things too. This tube joint pattern generator would have been a lifesaver when we were building the steel tube spaceframe for the first and second Team Spark electric racing cars back in 2011 and 2012. Solvespace was maintained for a few years by M-Labs. M-Labs wrote the Three.js export feature, among others. Jonathan says himself that Solvespace's NURBS operations are not as good as OpenCASCADE's but they're much smaller. The constraint solver is a remarkable achievement though, and it works well. Jonathan originally made a 2D CAD program which was superseded by Solvespace, but the paper he wrote on the sketch solver is an interesting read. The Solvespace solver library is the solver behind CAD Sketcher in Blender. The Solvespace feature list mentions G-code export with cutter radius compensation and path traced with mechanism, exportable into a spreadsheet. These two are interesting. The next thing I want to try in Solvespace is to make a movable assembly.</p> <p>For me the killer feature in Solvespace is the Three.js export. The in-browser Three.js model even has the Solvespace look! The file includes the whole Three.js library, which means that the file for this simple bracket is 0.7 MB. So if you want to display more than one model they will take up a lot of space. In that case you may want to export only the js model geometries from Solvespace and then manually link them to the three.js file. The bracket model geometry is only 52 KB.</p>"},{"location":"assignments/week02.html#design-file_4","title":"Design file","text":"<p>Here's the Solvespace model for download:</p> <p>Download Solvespace bracket</p>"},{"location":"assignments/week02.html#rhino3d","title":"Rhino3D","text":"<p>Rhino can do pretty much everything. A full license costs a thousand euros and you keep that version of Rhino for life. Even better, students and educators can get a license for 200 euros. But first, I'm going to get the trial version, which lasts for 90 days (all of the Fab Academy). I've wanted to try Rhino for quite some time, but all those unfamiliar tools and menus are a bit intimidating. I know solid extrude must be there, but where?</p> <p>I didn't like the official Getting Started tutorials very much, because the first videos just show you things but not making you do anything in the software. So I went to Youtube and found a 40 minute introduction to Rhino for architecture students. I followed along for 17 minutes.</p> <p> Selecting a surface with Ctrl+Shift left mouse in the first image and dragging the black dot on the red axis. That leads to the extrusion in the second image.</p> <p>I learned to make lines, curves, surfaces, solids and how to manipulate them.Now that I've turned on the Gumball tool, I can just select a surface and extrude it by pulling on the dot on one of the Gumball tool axes. Nice!</p> <p></p> <p>In the above picture I'm rotating a surface, which changes the whole shape.</p> <p>Rhino seems to have many more tools than Fusion 360, so it's interesting for making complicated shapes. I especially like the ability to grab any point, line or surface and move and rotate them with the Gumball tool. That's a really quick way to make interesting shapes that I would find difficult to model in Fusion 360. But I still haven't learned how to model precise things in Rhino with dimensions and constraints.</p>"},{"location":"assignments/week02.html#design-file_5","title":"Design file","text":"<p>Here's the Rhino file I made (it's just nonsense like you see in the images):</p> <p>Download Rhino model</p>"},{"location":"assignments/week02.html#rhino-grasshopper","title":"Rhino + Grasshopper","text":"<p>I went through a quick tutorial and made a nice Voronoi pattern! I really like the possibilities in Grasshopper. I've wanted to try it for some time. And I like the simplicity of the Voronoi method, you just make a line midway between every point and its next neighbor, and then trim the lines. A random distribution of points results in a cellular-like pattern.</p> <p></p> <p></p>"},{"location":"assignments/week02.html#design-file_6","title":"Design file","text":"<p>Here's the Rhino file with the extruded Voronoi surface.:</p> <p>Download Rhino + Grasshopper Voronoi model</p>"},{"location":"assignments/week02.html#freecad","title":"FreeCAD","text":"<p>After watching this video, I got excited about learning FreeCAD, but I'm 20 minutes in to a tutorial and I've only learned how to enable dark mode, and I've discovered that my 3D mouse doesn't work well with the program. Or maybe I haven't found the right settings.</p> <p>Update: Now I've started modeling and I'm starting to like FreeCAD. It's incredibly capable. I only stuck with it because Neil Gershenfeld is so adamant that it's a good tool and that his Fab Academy students should try it. </p> <p>The feature tree is very similar to Inventor and SolidWorks. You can go back in time and change features that control features later in the tree. I could get used to this.</p> <p>Hold on! There's an HTML export option! And it uses native WebGL, without the Three.js library on top of it. And the bracket model is a tiny 60 KB, including the viewer! Look!</p> <p>Open FreeCAD bracket in browser</p> <p>The HTML file is human-readable, so I could easily go into it and change the background gradient colors. The bracket itself still has a yellowish color on the bottom, but this is good enough for now.</p> <p>Open FreeCAD bracket with greytone background</p>"},{"location":"assignments/week02.html#design-files","title":"Design files","text":"<p>Here's the FreeCAD bracket model:</p> <p>Download FreeCAD bracket model</p> <p>Update: I also tried setting up a parametric model based on a spreadsheet. I followed this tutorial.</p> <p></p> <p>Here's the model that includes a few configurations:</p> <p>Download configurable FreeCAD cube</p> <p>I would also like to try Python scripting in FreeCAD when I have the time.</p>"},{"location":"assignments/week02.html#on-free-and-open-source-engineering-software","title":"On free and open source engineering software","text":"<p>I must admit that I've been prejudiced against free and open source versions of the engineering software that I've been using. If it's free there must be something wrong with it. I've assumed that it must be missing lots of features and that it must have a bad user interface and be riddled with bugs. Not so! And there are features in the free software that are not found in paid software at any price. Autodesk and Dassault Syst\u00e9mes, the makers of the CAD software I use most, have thousands of employees. FreeCAD is developed by like three people and it can do finite element analysis! How is this possible? Because of the ecosystem of open-source packages that get integrated into FreeCAD, like the Open SCAD workbench, for example. And the open nature of the software ensures that those who are interested can learn everything about it, down to the lowest level, and improve it and make their own versions of it. This is similar to the original purpose of published patents, to disseminate technology for everyone.</p> <p>It's interesting to note that an old open source project that was developed in the late 1960s is still the state of the art in structural Finite Element Analysis. Nastran is a million lines of FORTRAN code written for NASA by the company that would become MSC. Nastran is the core in the most advanced FEA solvers in Autodesk Inventor and even in more exotic and cutting-edge software like ADINA, which is used for the most difficult multiphysics problems like simulating nuclear reactors before they are built. I came across ADINA in my quest to understand shock absorbers. They are surprisingly complex. ADINA makes an FEA solver that is more advanced than the Siemens NX solver, and that is saying something. NX is arguably the most advanced CAD software in the world. Its geometry kernel is also the basis of the Onshape, Shapr3D and Altair CAD software.</p>"},{"location":"assignments/week02.html#cadtron","title":"CADtron","text":"<p>I didn't try Kevin Lynagh's  CADtron because it hasn't been released yet, but it's an interesting gesture-based 2D CAD program based on the Solvespace library. Here's an example of a perpendicular constraint drawn with a stylus (from Kevin's video):</p> <p></p>"},{"location":"assignments/week02.html#fusion-360","title":"Fusion 360","text":""},{"location":"assignments/week02.html#final-project-mockup","title":"Final project mockup","text":"<p>I made a mockup of my final project in Fusion 360. I connected the parts together with joints, so that I could move the arm realistically. This arm has six axes. I imported a few electronic components from GrabCAD and put them on the arm to show how I envision the design. </p> <p>I want to make the arm out of printed circuit boards. The are fiber reinforced, so they are quite stiff. If I place some rigid foam between two circuit boards I have a very stiff and light part that also contains the microcontroller and motor driver to control the joint. I haven't seen a robot arm made of PCBs anywhere, so that's what I want to make. </p> <p>My instructor \u00de\u00f3rarinn suggested that I think about designing the arm in such a way that it could also be laser cut or 3D printed, depending on the fabrication tools that people have access to. So here are three versions, rendered in the Fusion 360 rendering environment:</p> <p>Tan colored FR1 circuit board arm Red 3D printed arm Transparent acrylic laser cut arm</p>"},{"location":"assignments/week02.html#motion-study","title":"Motion study","text":"<p>I had trouble figuring out the Fusion 360 Animation environment, so I did a motion study instead.</p> <p>Before making the motion study, I needed to create rotational joints between the parts using the Joint operation (see in the menu above).</p> <p>OK, let's go back and define all the joints first, and make the base fixed to the ground, so that it doesn't rotate with the other parts.</p> <p>It's quite simple to select the hole on each part to rotate around and that's it, really. You may need to play around with some of the settings until you get what you want. But there aren't that many settings.</p> <p>All the joints that I defined automatically appear in the motion study as a colored line. I can place keypoints on those lines at certain times to create motion in those joints. Then it's just a matter of figuring out which joint is which and its extents of motion and playing around with the interface until the movement looks good.</p> <p>Note</p> <p>To capture short animated GIFs of what I'm doing in software, I use LICEcap. It's available for Windows and MacOS. It's lightweight and produces much smaller GIFs than any other screen capture program that I've used. Because of this recommendation, I used the command line tool Gifsicle to resize the GIF after recording it with LICECap. I tried double-clicking gifsicle.exe, but nothing happened. I found this Reddit discussion, where it was explained that Gifsicle is a command-line tool, so you just enter the commands. But where? I tried the same method as with ImageMagick. I put the GIF into the folder with Gifsicle and typed <code>cmd</code> Enter, which opened the Command Prompt in that folder. Then I ended up using the command <pre><code>gifsicle motion_study5.gif --resize 660x220 --colors 256 --optimize &gt; motion_study5_resized.gif\n</code></pre> and that worked! The GIF went from 844 KB to 200 KB.</p> <p>I quite like the control interface for the motion study. Each line controls a joint. You click the line to make a keypoint and enter the position of that joint. This is more intuitive than the robot control software that I've tried. It would be nice to control the arm in this way. Someone on the internet said that Fusion 360 is not the right tool to control robot arms, and they're probably right. They recommended Blender. I've been thinking about writing a Python script for Blender that uses the animation environment to control my robot arm. Or I could try a browser-based solution. I saw something like this when searching the Fab Academy archives.</p>"},{"location":"assignments/week02.html#design-file_7","title":"Design file","text":"<p>Here's the robot arm Fusion 360 file, including the conveyor belt and motion study:</p> <p>Download robot arm mockup</p>"},{"location":"assignments/week03.html","title":"Computer-Controlled Cutting","text":""},{"location":"assignments/week03.html#assignment","title":"Assignment","text":""},{"location":"assignments/week03.html#group-assignment","title":"Group assignment","text":"<ul> <li>Characterize your laser cutter's focus, power, speed, rate, kerf, joint clearance and types </li> </ul>"},{"location":"assignments/week03.html#individual-assignment","title":"Individual assignment","text":"<ul> <li>Cut something on the vinyl cutter</li> <li>Design, laser cut, and document a parametric construction kit,</li> <li>accounting for the laser cutter kerf,</li> <li>which can be assembled in multiple ways,</li> <li>and for extra credit include elements that aren't flat </li> </ul> <p>See more info and recording of the lecture here.</p>"},{"location":"assignments/week03.html#parametric-construction-kit","title":"Parametric construction kit","text":""},{"location":"assignments/week03.html#design","title":"Design","text":"<p>I wanted to make a minimal parametric construction kit that was made up of only one piece. You can see the design taking shape in the hand-drawn sketches below  as I was thinking about the design specifications. When I had decided on the specs, the design was fully defined. The piece can have no other shape.</p> <p></p> <p>I wanted four pins and four pockets, so that defined the shape of the piece. The plan was to have the dimensions of the pins and pockets equal on all three axes, so that the pieces can be assembled every which way. This ultimately means that all the dimensions in the 2D sketch are controlled by the material thickness.</p> <p></p> <p>I made a sketch in FreeCAD and set up a spreadsheet inside the part file. In the spreadsheet I defined two main parameters that I use to control the design; the material thickness and the kerf. There I am editing the value of the kerf:</p> <p></p> <p>I made two test pieces (see the image at the top of the page) and decided to make the hole in the middle a star instead of a square. That way you can assemble the pieces at a 45\u00b0 angle, which is necessary because the angle between every pin and pocket is 45\u00b0.</p>"},{"location":"assignments/week03.html#laser-cutting-the-pieces","title":"Laser cutting the pieces","text":"<p>Then I made a series of kerf tests, which was easy because I only needed to change one parameter. I wound up making the fit tighter than I usually do (kerf = 0.24 mm) because the fit is tighter when the pieces are assembled in-plane than when they are perpendicular to each other. The 90\u00b0 perpendicular fits were always too loose and I didn't understand why. </p> <p>Kerf tests</p> <p>Then I thought about the way that the kerf tapers, so that more material is removed at the bottom of the material than at the top surface. This is because the laser has only one focus point, which is set at the top surface of the material. Below that point, the laser beam diverges, causing the sides of the pieces to not be completely perpendicular to the surface of the sheet. </p> <p>My instructor \u00de\u00f3rarinn said that there isn't really anything we can do about that, so I tried setting the focus in the middle of the material, by focusing on a 2 mm thick sheet and then cutting a 4 mm thick sheet. I was hoping that the cut would have more of an hourglass shape than a simple taper, but it didn't work out that way. Changing the focus didn't make that much of a difference, but I ended up cutting all the pieces with it set in the middle of the material.</p> <p>Here's a full plate of construction pieces, patterned by hand in Inkscape: </p> <p></p> <p>I used the Epilog Mini 24x12 laser cutter to cut my construction kit. In Inkscape, I set the line width to 0.02 mm and made the lines red (RGB 255,0,0). This is the code that the Epilog laser driver uses to determine that it should cut these lines. Then I export the drawing to PDF.</p> <p>On the computer next to the Epilog laser cutter, I open the PDF document and select File -&gt; Print.</p> 1. File -&gt; Print2. Properties <p>It doesn't really matter whether I select only Vector or Combined, because the document contains no raster (engraving) features. I set the Piece size to 600 by 300 mm. I only need to set the Vector settings in the bottom right corner because there is no rastering.</p> <p>I used vector (cutting) settings of 5% speed, 100% power and 5000 Hz laser frequency.</p> <p>The Epilog Mini 24x12 hard at work.</p>"},{"location":"assignments/week03.html#playtime","title":"Playtime","text":"<p>The construction kit was very well received by my family. After an evening of play, these are the resulting shapes. Wall-E, a drone, an axle with wheels, a cube, a coaster, a giraffe, a magic wand, an I-beam, and a tool to measure the curve of your spine. It works really well, it might be a handy tool for physiotherapists.</p> <p>I'm holding up Wall-E, which my older son Ernir (4 years old) made.</p> <p>Here's Hj\u00f6rtur's (1 year old) hand touching something that my wife A\u00f0albj\u00f6rg made.</p> <p>This could be a template to measure spine curvature.</p> <p>Ernir playing with the laser cut pieces and coloring some of them with a marker. Incidentally, I later melted down the rest of the Icelandic cat candle in this picture to make the FMCU button.</p> <p>My son was also quick to start using the laser cut pieces with his beloved garbage truck.</p> <p>My wife looking through a sheet of laser cut pieces.</p>"},{"location":"assignments/week03.html#design-files","title":"Design files","text":"<p>Download spreadsheet-driven FreeCAD design</p> <p>Download DXF file (one piece)</p> <p>Download SVG cutting file (462 pieces)</p> <p>Download PDF cutting file (462 pieces)</p>"},{"location":"assignments/week03.html#circuit-cut-with-vinyl-cutter","title":"Circuit cut with vinyl cutter","text":"<p>I wanted to cut a copper sheet and make a circuit in the vinyl cutter. This hasn't been done before at my lab. I wrote it up for my secondary school students in Icelandic and had them make vinyl cut sensors the week after I tried it myself.</p> <p>I got the design for a simple step response sensor from Hafli\u00f0i who was working at Fab Lab Reykjav\u00edk.</p> <p>My instructor \u00de\u00f3rarinn led me through the ins and outs of the vinyl cutter. He disassembled the knife to show me the tiny bearing that needs to be cleaned and lubricated when it jams:</p> <p></p> <p>Then he explained the way to adjust the knife. You start by retracting the knife fully and then cutting manually into the material. If nothing happens, you extend the knife a little bit and cut again. You want to cut fully through the material and scratch the backing, but you don't want to cut through the backing. Then you would damage the rubber that is underneath, and that's part of the machine.</p> <p></p> <p>You cut tabs like you see below and then bend the material and see if they come loose. When it looks like you're getting close, you start paying attention to the ticks on the knife. A course adjustment is two ticks, a fine adjustment is one tick. If the material comes loose when you bend it, but you're not cutting deep into the backing, you're golden:</p> <p></p> <p>\u00de\u00f3rarinn suggested a methodology of testing to get good cuts in the copper. First I would adjust the knife as discussed above. The next step would be to vary the cutting force and the speed until I get a good result. However, after he adjusted the blade and the force for the regular vinyl, I made a test and it cut quite well through the copper! So the systematic testing ended up being just three tests. </p> <p>The first test didn't work out because the copper was crumpled on top of the backing. The second test I cut with 90 grams of force and it was almost there. The third test I cut with 120 grams of force and it looked good.</p> <p>The Roland CAMM-1 Servo GX-24 vinyl cutter. I used a force setting of 120 grams to cut the copper sheet.</p> <p>We use a very simple interface for the vinyl cutter; a printer driver. We export a PDF file from Inkscape with 0.01 mm thick red lines (RGB 255,0,0) and open it in Adobe Reader. I simply go into File -&gt; Print to cut the file on the vinyl cutter. There's only one thing I need to adjust, which is the cutting area:</p> 1. File -&gt; Print2. Properties3. Ready to cut <p>In the Print dialog, I click the Properties button at the top.</p> <p>In Properties, I input the Document size which is under the Summarize Comments button. I need to enter the numbers with periods instead of commas, because this software is from the USA.</p> <p>Now I can press print and the vinyl cutter makes an electronic circuit in under a minute!</p> <p>Here's my first try at weeding copper sheet:</p> <p>It worked, but could be better.</p> <p>Neil recommended sticking everything to the final surface and then weeding. I will definitely try that next time. But this time I weeded first and then glued the copper pads to the laser cut acrylic. I forgot to add holes for pins, so I drilled them afterwards:</p> <p>When I had my students make sensors like these, I added the holes to the laser cutting file.</p> <p>The only component on the board is a 10k resistor.</p> <p>I grabbed a 10k resistor and soldered it to the pads. I'm surprised that the tiny pads survived my rough handling. Then I measured the resistance from one pin to the touch sensitive pad, to check if the solder connections were OK:</p> <p></p> <p>The soldering was fine, and the next step was to open a capacitive touch sensor example sketch in the Arduino IDE and connect my new sensor to a SparkFun RedBoard:</p> <p>Note</p> <p>I used <pre><code>ffmpeg -i input_video -vcodec libx264 -crf 25 -preset medium -vf scale=-2:1080 -acodec libmp3lame -q:a 4 -ar 48000 -ac 2 output_video.mp4\n</code></pre> to compress the video from my phone. Fab Lab Kannai put this into a tutorial. It works!</p> <p>Here's the Arduino sketch, which I modified a little bit (just commented out what I didn't need):</p> <pre><code>#include &lt;CapacitiveSensor.h&gt;\n\n/*\n * CapitiveSense Library Demo Sketch\n * Paul Badger 2008\n * Uses a high value resistor e.g. 10M between send pin and receive pin\n * Resistor effects sensitivity, experiment with values, 50K - 50M. Larger resistor values yield larger sensor values.\n * Receive pin is the sensor pin - try different amounts of foil/metal on this pin\n */\n\n\n//CapacitiveSensor   cs_4_2 = CapacitiveSensor(4,2);        // 10M resistor between pins 4 &amp; 2, pin 2 is sensor pin, add a wire and or foil if desired\nCapacitiveSensor   cs_4_6 = CapacitiveSensor(4,6);        // 10M resistor between pins 4 &amp; 6, pin 6 is sensor pin, add a wire and or foil\n//CapacitiveSensor   cs_4_8 = CapacitiveSensor(4,8);        // 10M resistor between pins 4 &amp; 8, pin 8 is sensor pin, add a wire and or foil\nint LEDpin =13;\n\nvoid setup()                    \n{\n//   cs_4_2.set_CS_AutocaL_Millis(0xFFFFFFFF);     // turn off autocalibrate on channel 1 - just as an example\n   Serial.begin(9600);\n}\n\nvoid loop()                    \n{\n    long start = millis();\n  //  long total1 =  cs_4_2.capacitiveSensor(30);\n    long total2 =  cs_4_6.capacitiveSensor(30);\n   // long total3 =  cs_4_8.capacitiveSensor(30);\n\n   // Serial.print(millis() - start);        // check on performance in milliseconds\n  //  Serial.print(\"\\t\");                    // tab character for debug windown spacing\n\n //   Serial.print(total1);                  // print sensor output 1\n    Serial.print(\"\\t\");\n    Serial.println(total2);                  // print sensor output 2\n   // Serial.print(\"\\t\");\n   // Serial.println(total3);                // print sensor output 3\n\n    delay(10);                             // arbitrary delay to limit data to serial port \n\n //   if (total3 &gt; 40) \n //   {\n  //    digitalWrite(LEDpin, HIGH); \n  //  }\n  //  else\n  //  {\n  //    digitalWrite(LEDpin, LOW); \n  //  }\n}\n</code></pre>"},{"location":"assignments/week03.html#design-files_1","title":"Design files","text":"<p>Download sensor vinyl cutting file</p> <p>Download outline laser cutting file</p>"},{"location":"assignments/week03.html#rubber-stamp","title":"Rubber stamp","text":"<p>For the rubber stamp engraving, I used this reference. I was able to cut through the rubber at 5% speed and 100% power with our 40W Epilog Mini 24x12 laser cutter:</p> <p></p> <p>The engraving test that looked cleanest to me was at 30% speed and 100% power. I then engraved the Fab Lab \u00cdsafj\u00f6r\u00f0ur logo with two such passes and cut out the outline:</p> <p></p> <p>As you can see, this makes for an awful stamp. I both forgot to mirror the logo and invert it, to make it stick out. I haven't had time to make a proper stamp yet, but the tests look promising.</p>"},{"location":"assignments/week03.html#design-files_2","title":"Design files","text":"<p>Download rubber test file</p> <p>Download failed rubber stamp logo</p> <p>Download failed rubber stamp outline</p>"},{"location":"assignments/week03.html#characterizing-our-vinyl-cutter","title":"Characterizing our vinyl cutter","text":"<p>We have a Roland CAMM-1 GS-24 vinyl cutting machine. It can cut with a force of up to 350 g. I've only gone up to 120 g with the copper sheets. The maximum cutting width is 584 mm and the maximum length is effectively unlimited (25 meters). It can cut up to 1 mm thick materials.</p> <p>The vinyl cutter has optical sensors which it uses to measure the size of the sheet. It has a fast and powerful servomotor. It cuts really quickly, so it's a good machine to use when introducing a large group to the Fab Lab.</p> <p>This vinyl cutter has an optical registration system, so you can for example print stickers, include some registration marks on the sheet, pop it into the vinyl cutter and have it cut the outlines of the stickers. I haven't tried this feature yet.</p> <p>For those who want to dive deep into how computer controlled machines work, Fransisco Sanchez made a video on making machines move with mods CE. He starts with this vinyl cutting machine, which is a standard machine in the Fab Lab Inventory. I've watched part of it, it's really interesting. If you learn to speak the machine's language then you can make all sorts of new interfaces with it that don't exist today.</p>"},{"location":"assignments/week03.html#characterizing-our-laser-cutter","title":"Characterizing our laser cutter","text":"<p>Our laser cutter is the 40W Epilog Mini 24x12. It's a CO2 laser with a 610 x 305 mm work area. It can cut up to 5 mm acrylic and MDF and engrave acrylic, MDF, glass and stone. I've also used it to mark metals using Laser Ink. I always open up this Instructable which Sun-Olkkonen wrote while she was an intern at Fab Lab \u00cdsafj\u00f6r\u00f0ur in 2018. Her guide has become quite popular. </p> <p>It's important to watch the machine while it cuts, because it's always just seconds away from starting a fire if something goes wrong. And things do go wrong somtimes. And you must never laser cut any plastic material that contains chlorine, like PVC for example. When it vaporizes such a material, chlorine gas is created, which is deadly.</p>"},{"location":"assignments/week03.html#kerf-test","title":"Kerf test","text":"<p>The missing width when I've laser cut these ten lines is exactly 2 mm. That means that the laser's kerf (or the diameter of the laser point) is</p> \\[\\frac{2mm}{10}=\\underline{0.2mm}\\] <p>So when I design a press-fit joint, I need to offset all lines outward by 0.1 mm.</p>"},{"location":"assignments/week03.html#design-file","title":"Design file","text":"<p>Download kerf test</p>"},{"location":"assignments/week03.html#raster-test","title":"Raster test","text":"<p>I used the same raster test as I did with the rubber stamp. I set the laser power to 100% and the frequency to the maximum 5000 Hz. Then I enabled Color Mapping in the Epilog Laser settings within the Print dialog in the PDF viewer.</p> <p>The Color mapping dialog. You press the triple arrow to save the setting.</p> <p>Red is 60% speed, green is 50%, blue is 40%, yellow is 30%, magenta is 20% and cyan is 10%. That goes for both rastering (top row) and cutting (bottom row).</p> <p>Here's how the 4 mm MDF reacted to these settings:</p> <p>To get a clean raster, the speed must be above 30%. To cut through the material, the speed must be 10% or slower. I usually use 5% speed to make sure that the laser cuts through.</p>"},{"location":"assignments/week03.html#design-file_1","title":"Design file","text":"<p>Download raster test file</p>"},{"location":"assignments/week04.html","title":"Embedded Programming","text":""},{"location":"assignments/week04.html#assignment","title":"Assignment","text":""},{"location":"assignments/week04.html#individual-assignment","title":"Individual assignment","text":"<ul> <li>Browse through the data sheet for your microcontroller</li> <li>Write program for a microcontroller development board<ul> <li>to interact (with local input &amp;/or output devices)</li> <li>and communicate (with remote wired or wireless devices)</li> <li>extra credit: use different languages &amp;/or development environments</li> <li>extra credit: connect external components to the board</li> </ul> </li> </ul>"},{"location":"assignments/week04.html#group-assignment","title":"Group assignment","text":"<ul> <li>Compare the performance and development workflows for other architectures</li> </ul> <p>See more info and recording of the lecture here.</p>"},{"location":"assignments/week04.html#the-rp2040-datasheet","title":"The RP2040 datasheet","text":"<p>I read the Raspberry Pi RP2040 datasheet loosely. This is one of the more interesting microcontrollers to me, because of the flexible Programmable Input/Output (PIO), two fast cores and you can program it in the Arduino IDE or in the friendly Python language. The datasheet also looks friendlier than datasheets for other microcontrollers. Still, that may only be the graphic design, because the actual content is cryptic. I understood like 0.5% of what I read. </p> <p>But I did pick up some interesting tidbits. The RP2040 has a built-in Real Time Clock. That would be useful for my wake-up mask. It has a dormant state which uses almost no power and it can be woken up by the RTC. That also sounds good for the wake-up mask. But in that case, the RTC needs to use an external clock source, which can be as slow as 1 Hz. Hold on, the RTC needs an external crystal. That's good to know. I thought you didn't need to add a crystal, but the only truly internally generated clock is the Ring Oscillator. Its speed varies with process, voltage and temperature, so it can't be used for RTC, USB communication or analog to digital conversion.</p> <p>When reading the RP2040 datasheet and testing the Xiao RP2040, I wondered: Does the tiny Xiao board have a crystal? I don't see one on the board. Is it underneath the metal cover with the RP2040? If it doesn't have an external oscillator, then the Real Time Clock doesn't work and I can't use it in my wake-up mask. I looked around and found the schematic for the Xiao RP2040 and there is a crystal and Flash memory. Good. They must be underneath the cover. </p> <p> So there is a crystal.</p> <p>But maybe the internal RTC in the RP2040 isn't good enough and I need to use something like the DS3231 chip.</p> <p>Update: My instructor \u00de\u00f3rarinn showed me a picture of what's underneath the metal cover. The picture was actually on the same page as the schematic that I had found, but I hadn't looked at the whole page. So here it is, and you can see the crystal marked with 12.000:</p> <p></p> <p>I watched a video that stated that computers are horrible at division. So I was glad to see that the Raspberry Pi Foundation decided to implement a hardware division unit in the RP2040. I wondered why there was no hardware multiplier until I got to the section about the Arm Cortex M0+ cores inside the RP2040. The Arm specification has hardware multiplication built in.</p> <p>I watched another video that shows how you can easily overclock the Raspberry Pi Pico. Overclocking has always sounded to me as if you're going to overheat the device and damage it, or make it unstable, but the datasheet says that overclocking processors in general is usually fine. In the video, a maximum speed of 250 MHz is recommended.</p> <p>I was interested in the example programs provided under the Programmer's Model headings in the datasheet but I have no idea where to put them or how to run them. There are also lots of tables with registers and commands and stuff like that but I can make neither heads nor tails of them. What are they? What would I do with them? The mysteries continue.</p> <p>The RP2040 chip has 36 General Purpose Input/Output pins. That's quite a lot. Typically, a few of those pins are connected to an external flash memory chip, as in the Raspberry Pi Pico board. The Pi Pico board has 26 user-accessible pins. Three of them can be used for reading analog signals and converting them to digital numbers. The ADCs are officially 12 bit but the effective resolution is I think something like 10 bits because of an error in the chip design. </p> <p>The RP2040 has plenty of communication interfaces (SPI, UART, I2C, USB), and if you need something else, you can make it yourself with the Programmable IO blocks. It has eight two channel PWM generators (they're called slices). So can it generate 8 PWM signals, or 16? The PIO machines can always see the states of all pins. That's interesting. I think I remember reading that the DMA channels share a similar view.</p> <p>My Master's thesis advisor said that when programming in C, you get much more access to all the computer's devices and peripherals. When the University stopped paying the license for his vibration meter, he wrote a driver for it in C. That sounds like wizardry to me, and more than a little fascinating. But the C code examples in the RP2040 datasheet don't look fun to me.</p>"},{"location":"assignments/week04.html#pio","title":"PIO","text":"<p>This is the most interesting part, the Programmable IO. There are two PIO blocks in the RP2040 and each has four state machines. That means that you have eight simple, deterministic and precisely timed cores that are specialized for input and output. Each state machine has two 32 bit shift registers. Jakob Einar, a frequent guest at Fab Lab \u00cdsafj\u00f6r\u00f0ur, made a cnc plotter using old DVD drives. He said that a shift register enables a slow Arduino Uno to control all the steppers in sync. I'm curious about how a shift register works.</p> <p>There are two PIO blocks with four state machines each. Each state machine has:</p> <ul> <li>Two 32-bit shift registers (I need to find out what they do)</li> <li>Two 32-bit scratch registers (you can think of them as variables, they're called x and y)</li> <li>4x32-bit bus FIFO in each direction or 8x32 in a single direction (data flows in and out using these and gets stored in the two variables x and y)</li> <li>Fractional clock divider (if you want the PIO to run slower than the main clock speed)</li> <li>DMA interface (to get lots of data from memory without using the processor, or put data into memory)</li> <li>IRQ flag set/clear/status (I think this is to alert the main processor that the PIO has finished an operation)</li> </ul> <p>The state machine has only nine instructions: <code>JMP</code>, <code>WAIT</code>, <code>IN</code>, <code>OUT</code>, <code>PUSH</code>, <code>PULL</code>, <code>MOV</code>, <code>IRQ</code> AND <code>SET</code>. Each instruction takes exactly one cycle. It's interesting to try programming at this level. I like the fact that the first three bits of each instruction is like this: <code>JMP</code>: 001, <code>WAIT</code>: 010 and so on. I understand that labeling system!</p> <p>Precise timing is what microcontrollers are good at! You can get PIO programs from the Raspberry Pi Pico PIO library, you can write them yourself or (and this is the most interesting case) you can generate them programmatically. I wouldn't know how to do that, though. All the supplied code examples are written in C. This may be a good introduction. I'm putting this here for myself to discover later. Here's some more stuff.</p> <p>I did find one example of using DMA in MicroPython code. The iosoft blog says that MicroPython doesn't have built-in functions to support DMA and doesn't provide a simple way to access the ADC, DMA and I/O pin registers. But there is a way to define these registers using the obscure <code>uctypes</code>. And then you need to be familiar with the RP2040 datasheet. Here someone has written some code based on the iosoft blog. This should be easy to try out, because it's Python code. Here's a resource with good pictures that goes into PIO + DMA.</p> <p>Most instructions are executed from the instruction memory, but there are a few other sources. The most versatile of these is the <code>OUT EXEC</code> instruction. You can use this to embed instructions in the data stream passing through the FIFO.</p> <p>I didn't understand the Wikipedia entry on shift registers. The Sparkfun article says that they're used to add more I/O pins to a microcontrollers. But that's not what's happening in the PIO. Apparently, you load one bit into the shift register at a time (a 1 or a 0). When a new bit enters, all the bits inside the shift register are shifted to make room for it. Then you can use the latch pin to output all the bits at the same time from the shift register. So you're turning a serial port into a parallel port. I guess this is useful for synchronized CNC movements, but how does it work inside the PIO block in the RP2040?</p> <p>The output of the PIO assembler is shown, and it consists of hexadecimal numbers. They look scary and incomprehensible. I noticed that they all have an x in them, so I asked Google why hexadecimal numbers all start with 0x. Turns out it's just to let the parser know that it's a hexadecimal base number instead of other bases.</p> <p>I've seen a lot of definitions and explanations, but what I really need is an example that I can run. I still don't understand how the data flows and how the operations are carried out. To see what's going on inside the chip, I probably need something like PicoReg. It's a debugger for the Raspberry Pi Pico. The advantage is that it's written entirely in Python I can set it up on a Raspberry Pi. I can wrap my head around that.</p> <p>I'd like to try to implement a PIO+DMA stepper controller with acceleration ramping. But I likely won't have time for that this week. V. Hunter Adams at Cornell has implemented it, but to use it you need to set up a toolchain for C. This forum post is also interesting. <code>cleverca22</code>'s comment on this post may also hold clues. Seemingly unrelated, but there may also be some clues in the servo easing algorithm. There are stepper control PIO programs here and here. But they don't implement ramping. And again, you need to use the C/C++ SDK. The RP2040 datasheet says that if you want to get started with PIO, a walkthrough of writing your first PIO program is in the Pico C/C++ SDK. It also covers using PIO with DMA. But I want to use Python. Or at least I want to be able to make a library for Python. Is it possible to do that in C/C++? Yes. But if you build an external C module for MicroPython, you have to build your own MicroPython firmware to put on the RP2040. There's another possibility, which I like better:</p> <p>An alternative approach is to use Native machine code in .mpy files which allows writing custom C code that is placed in a .mpy file, which can be imported dynamically in to a running MicroPython system without the need to recompile the main firmware.</p> <p>I flipped quickly through all the communications protocols but read PWM more carefully. If I will use brushless motors in my robot arm, I need to get to know Pulse Width Modulation. It's interesting how flexible the pin mapping on the RP2040 is, the PWM slices can use any of the GPIO pins, and so can PIO. I actually understood a part of the description of how a PWM slice works. It's a 16-bit counter that the wraps back to zero. Wrap is a command in pioasm that enables you to jump back to the beginning without using a <code>JMP</code> command, and it takes 0 cycles. I'm beginning to understand a little bit, even if I can't use these things yet. I guess I could DMA to push a sine wave from a lookup table to three PWM outputs to control a three-phase brushless motor. Then the main processors would be free to do other tasks. This arbitrary wave generator using PIO and DMA may be worth taking a look at when I have some time.</p> <p>There's a lot going on inside this $1 chip. It's like a whole city, complete with different neighborhoods connected together with highways and smaller roads to move data between places.</p> <p>All roads lead to the C/C++ SDK, it seems. Here are community libraries for the SDK. There are also lots of examples in the Raspberry Pi GitHub repo. I will have to jump in at some point.</p> <p>One question remains: What is the OSR?</p> <p>There is a bit of programmer humor in the datasheet, on page 359 it says that I2C is an ubiquitous serial bus first described in the Dead Sea Scrolls, and later used by Philips Semiconductor. On page 364 it is conjectured that the PIO can run DOOM with a high enough clock speed. On page 365 it says that a full 32-bit addition takes the PIO only around one minute at 125 MHz. What? So using the PIO for mathematical operations takes hundreds of millions of cycles?</p>"},{"location":"assignments/week04.html#dma","title":"DMA","text":"<p>Direct Memory Access is the other interesting feature in the RP2040. It's a memory controller that can copy data from one place to another very fast without the processor's intervention. Throughout the RP2040 datasheet there are mentions that this and that part of the chip has a DMA interface. It looks like it's important to learn to use DMA if you want to make things run fast. Could DMA be used to feed a PIO state machine with acceleration ramps for a stepper? I would like to learn a little bit about how DMA works and how to set it up, but it seems that it's not possible in MicroPython. The Raspberry Pi Pico C/C++ SDK instructions mention that you can use DMA by including a library called hardware_dma. Setting up a C/C++ toolchain sounds intimidating, but maybe I have to do it if I want to try using DMA. I think DMA programming is too complicated to get into for now.</p>"},{"location":"assignments/week04.html#adc","title":"ADC","text":"<p>The Analog to Digital Converter takes 96 clock cycles to make a 12-bit measurement. That's good to know. The RP2040 ADC has a few errors, most notably that the quantization error looks like a sawtooth. Also, because the wrong size of capacitor was used in one part of the ADC, there are big spikes in differential non-linearity. I won't pretend to know what that is, but it means that there will be spikes in the measured values in four places. The scaling factor for the internal temperature sensor is specified here in the datasheet. You can see it an example code in the Chip temperature section below.</p> <p>I looked at the Raspberry Pi Pico Python SDK and found it a bit thin. I also skimmed Getting started with Raspberry Pi Pico, which shows how to set up a C/C++ programming environment for the Pi Pico, and it looks extremely complicated. But that's where the juicy stuff is.</p>"},{"location":"assignments/week04.html#programming-the-xiao-rp2040","title":"Programming the Xiao RP2040","text":"<p>The Xiao RP2040 has a reset button, so it's more convenient to use in that respect than the Raspberry Pi Pico.</p>"},{"location":"assignments/week04.html#hello-rp2040","title":"Hello RP2040","text":"<p>I tried Neil Gershenfeld's Hello RP2040 Python program:</p> <p>I like having an RGB LED to play with. It could serve as a simple interface for the wake-up mask or the robot arm if I assign a different meaning to every color.</p>"},{"location":"assignments/week04.html#chip-temperature","title":"Chip temperature","text":"<p>I did this one with the Raspberry Pi Pico. Setup and programming is identical to the Xiao RP2040. I found a nice tutorial on using the temperature sensor which is built into the RP2040 chip. It's useful to make sure that the chip doesn't overheat, but it's also a good exercise in measuring an analog voltage. Since I've tried blinking the onboard LED already, I'm going to use that knowledge to modify this program to turn on the LED when the temperature crosses a threshold:</p> <pre><code>from machine import ADC, Pin\nimport time\nled = machine.Pin(\"LED\", machine.Pin.OUT)\nadc = machine.ADC(4) \nwhile True:\n    ADC_voltage = adc.read_u16() * (3.3 / (65535))\n    temperature = 27 - (ADC_voltage - 0.706)/0.001721\n    print(\"Temperature: {}\u00b0C\".format(temperature))\n\n    if temperature &gt; 26:\n        led.value(1)\n    else:\n        led.value(0)\n\n    time.sleep_ms(100)\n</code></pre> <p>I added the if statement and removed the temperature in Fahrenheit. You can see that you need to scale the analog measurement to get the temperature in degrees Celsius. I suspect that that every chip will give a slightly different value because of manufacturing variability. So it might be better to measure the temperature with a better sensor and put that value into the scaling factor. But since this sensor isn't meant to be super precise, we'll let it be.</p>"},{"location":"assignments/week04.html#interfacing-with-lcd-screen","title":"Interfacing with LCD screen","text":"<p>I connected a classic 16x2 character LCD screen to the Raspberry Pi Pico, but it didn't work. I needed to use the 4-bit mode (where you connect the LCD directly to the microcontroller) because I didn't have an LCD driver chip. Aby Michael's Fab Academy site had a useful diagram with the LCD pins. The ElectronicWings diagram was even more useful. After some Googling I found that the screen needs 5V signals. The RP2040 is a 3.3V chip, so that's why I'm getting glitchy results. Its strange that it worked with a Pico in the tutorial that I used (click the link in the video description for a connection diagram). I'd like to try the small OLED screen that is in the Fab Lab inventory next. That one is 3-5V tolerant, and much smaller and versatile than the 16x2. And it only needs four pins. Look at that nest of wires above! The OLED will be a great improvement.</p> <p>Here are the files I used, you just open each of them in Thonny and save them to your Pico. The <code>main.py</code> file runs automatically when you power the Pico on. The other two are a library for interfacing with the LCD. Beware, this didn't work for me.</p> <p>Download main.py</p> <p>Download lcd_api.py</p> <p>Download gpio_lcd.py</p>"},{"location":"assignments/week04.html#interfacing-with-oled-screen","title":"Interfacing with OLED screen","text":"<p>I used Kevin McAleer's simple code example for the SSD1306 OLED screen. It just writes Test 1 to the screen. It was exhilarating to see the tiny letters light up on the screen on the first try! I then changed the text to something more useful, a prototype display for the Frankenstein MCU, which Fran and my instructor \u00de\u00f3rarinn are working on. The plan is to make a WiFi connected button in every Fab Lab and the staff push the button every day to show that the lab is active. The connections between labs appear on a spinning globe made in Three.js, which runs in the browser.</p> <p>Download oled.py</p>"},{"location":"assignments/week04.html#stepper-control-with-rp2040","title":"Stepper control with RP2040","text":"<p>This one I also did with the Raspberry Pi Pico.</p> <pre><code>from machine import Pin\nfrom time import sleep\n\nIN1 = Pin(2,Pin.OUT)\nIN2 = Pin(3,Pin.OUT)\nIN3 = Pin(4,Pin.OUT)\nIN4 = Pin(5,Pin.OUT)\n\npins = [IN1, IN2, IN3, IN4]\n\nsequence = [[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]\n\nwhile True:\n    for step in sequence:\n        for i in range(len(pins)):\n            pins[i].value(step[i])\n            sleep(0.01)\n</code></pre> <p>Controlling the stepper is surprisingly simple. It has four phases, so you connect it to four pins on the Pico. Then you just alternate which pin is HIGH while the others are low. The stepper motor has 64 steps per rotation, but it also has a 1/64 gearing ratio, so in total it has 64 * 64 = 4096 steps per rotation. That's pretty good for a 3 dollar stepper! I bought a set of five 28-BYJ-48 steppers with ULN2003 drivers for $15. They're cheap and precise!</p> <p>But there are two drawbacks. They're quite weak. For a motor with 1:64 gearing, it's surprisingly easy to make it skip steps. Also, the gearbox introduces backlash which is much bigger than the step size. The step size is 0.09\u00b0 but the backlash seems to be a few degrees. Maybe it's possible to correct for the slop in software every time the motor changes direction. But that won't work 100% and definitely not with small motions. I wonder if these motors are a good fit for my robot arm.</p> <p>In the video above I changed the sleep value and then ran the program. First it was 0.1 s, then 0.01 s and finally 0.001 s. When I went below 0.01 s, the stepper stalled. It's fun to have status LEDs on all the phases. At slow speeds you can see how the phases are turned on and off. I want to have status LEDS on every output pin on every microcontroller board! It's a really handy debugging tool. I laser cut a press-fit acrylic arrow to see the motor's movement better.</p> <p>Since I have the 12V version of the 28BYJ-48 motors, I can run them on a 9V battery. So here's my first foray into battery-powered electronics. The Pico is still powered by a USB cable, though. I need to learn how to make a 5V regulator board, so that I can also power the Pico using the 9V battery.</p>"},{"location":"assignments/week04.html#pio-stepper-control","title":"PIO stepper control","text":"<p>I followed a tutorial and wrote a program that controls a stepper with PIO, without using the processor at all. I then modified it to include four PIO state machines that run the same program but are clocked at different frequencies:</p> <p>Here's the code:</p> <pre><code>from machine import Pin\nfrom rp2 import PIO, StateMachine, asm_pio\nfrom time import sleep\nimport sys\n\n@asm_pio(set_init=(PIO.OUT_LOW,) * 4)\ndef prog():\n        wrap_target()\n        set(pins, 8) [31] #8\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        set(pins, 4) [31] #4\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        set(pins, 2) [31] #2\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        set(pins, 1) [31] #1\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        wrap()\n\nsm0 = StateMachine(0, prog, freq=100000, set_base=Pin(2))\nsm1 = StateMachine(1, prog, freq=50000, set_base=Pin(6))\nsm2 = StateMachine(2, prog, freq=25000, set_base=Pin(10))\nsm3 = StateMachine(3, prog, freq=12500, set_base=Pin(18))\n\nsm0.active(1)\nsm1.active(1)\nsm2.active(1)\nsm3.active(1)\nsleep(5)\nsm0.active(0)\nsm1.active(0)\nsm2.active(0)\nsm3.active(0)\nsm0.exec(\"set(pins,0)\")\nsm1.exec(\"set(pins,0)\")\nsm2.exec(\"set(pins,0)\")\nsm3.exec(\"set(pins,0)\")\n</code></pre> <p><code>nop()</code> is no operation, and you can optionally add a delay after every command, like this: <code>[1]</code>. That was a delay of one clock cycle. I think 31 cycles is the maximum.</p>"},{"location":"assignments/week04.html#adding-a-reset-button","title":"Adding a Reset button","text":"<p>The Raspberry Pi Pico has no reset button, but it resets if you connect the RUN pin to ground. So I just connected a jumper to the RUN pin on the breadboard and make the other end of the jumper touch the GND pin that is one pin over to reset the Pico. That's more convenient than unplugging the USB cable and plugging it in again.</p>"},{"location":"assignments/week04.html#overclocking-the-rp2040","title":"Overclocking the RP2040","text":"<p>I tried Chris DeHut's RP2040 overclocking video. He has lots of good stuff about the Pico. Here's his program which changes the clock speed a few times and measures the time it takes to do 100.000 sets of the calculations in the Do_Stuff function:</p> <pre><code>'''\nPICO default clock speed is 125 MHz\nDemo to show time to make a bunch of basic math calculations\nat varaious clock speeds that the PICO can handle\n'''\nimport machine\nimport time\nimport machine\n\nled_onboard = machine.Pin(25, machine.Pin.OUT)\n\ndef Do_Stuff():\n    st = time.ticks_ms()\n    Y = 0\n    while Y &lt; 100000:\n        Y += 1\n        Z = 57\n        Z1 = Z + Y\n        Z2 = Z - Y\n        Z3 = Z * (Z + Y)\n        #print(Y, Z1, Z2, Z3)\n    led_onboard.value(0)\n    #print(Y)\n    et = time.ticks_ms()\n    #print(et, st, et-st)\n    return et-st\n\n\ncntr = 0\nwhile cntr &lt; 2:    #run whole test several times for observation\n    cntr += 1\n\n    machine.freq(125000000)  #set clock to 125 MHz\n    x = machine.freq()\n    t = Do_Stuff()\n    print(\"\\n@\", x, \" time to run =\", t, \"ms\")\n\n\n    machine.freq(140000000)   #set clock to 140 MHz\n    x = machine.freq()\n    t = Do_Stuff()\n    print(\"\\n@ \", x, \" time to run =\", t, \"ms\")\n\n\n    machine.freq(200000000)  #set clock to 200 MHz\n    x = machine.freq()\n    t = Do_Stuff()\n    print(\"\\n@ \", x, \" time to run =\", t, \"ms\")\n\n    machine.freq(250000000)  #set clock to 250 MHz\n    x = machine.freq()\n    t = Do_Stuff()\n    print(\"\\n@ \", x, \" time to run =\", t, \"ms\")\n\nmachine.freq(125000000)  #set clock to 125 MHz to clean things up\nprint(\"\\n All Done Folks!\")\n</code></pre> <p>The loop runs a few times so that you can take the average of the time measurements. This is one set of measurements:</p> <pre><code>@ 125000000  time to run = 1167 ms\n\n@  140000000  time to run = 1042 ms\n\n@  200000000  time to run = 729 ms\n\n@  250000000  time to run = 583 ms\n</code></pre> <p>That's a big difference by varying the clock speed, and the RP2040 datasheet says that overclocking is usually safe. I will keep this in mind when my programs are running slowly. Then I tried going a bit higher. It worked at 280 MHz, but at 290 or 300 MHz, I got no response from the microcontroller. So this is the best time:</p> <pre><code>@  280000000  time to run = 521 ms\n</code></pre> <p>I think I will not go above 250 MHz. That's a lot, twice as fast as the standard RP2040 with a 12 MHz crystal, like in the Pico and the Xiao RP2040. There are instructions online on how to go up to 420 MHz and there is at least one commercial board that runs the RP2040 at 400 MHz.</p>"},{"location":"assignments/week04.html#custom-performance-test","title":"Custom performance test","text":"<p>I modified the PIO program to control four steppers at different speeds, by modifying the clock dividers in each of the state machines. The state machines all run the same program. It works, and there should be no load on the main processor. The video looks the same as the four stepper video above.</p> <p>Now let's verify that there is no load on the main processor. I'll take Chris DeHut's 100 thousand calculation routine and put it into the PIO stepper program. Here are the results while driving four steppers at different speeds at the same time:</p> <pre><code>@ 125000000  time to run = 1167 ms\n\n@  140000000  time to run = 1042 ms\n\n@  200000000  time to run = 729 ms\n\n@  250000000  time to run = 584 ms\n</code></pre> <p>Those are the same times as the first case, which had no steppers. Wow! I then increased the number of calculation loops to 300 thousand, so that we can see what happens to the steppers as we increase the main clock frequency from 125 MHz to 140, 200 and finally 250 MHz. As you can see from the video below, the steppers speed up until the fastest stepper stalls when the clock speed goes up to 250 MHz.</p> <p>For comparison with the PIO routine, I also tried to mix the 100k calculation code with code where the processor controls four steppers at the same time, but i couldn't get those two things to happen at the same time. But I could probably run those things on core0 and core1 with good results. Let's try, using this tutorial to learn how threads work in Python:</p> <pre><code>@ 125000000  time to run = 1181 ms\n\n@  140000000  time to run = 1053 ms\n\n@  200000000  time to run = 734 ms\n\n@  250000000  time to run = 587 ms\n</code></pre> <p>It worked! My first dual-core program! The steppers just kept on running on core1 after the calculations finished on core0. And the calculation times are good! They're just a few milliseconds longer the 4 stepper PIO + 100k calculation routine.</p> <p>Here's  the code:</p> <pre><code>import machine\nimport time\nimport machine\nfrom machine import Pin\nfrom rp2 import PIO, StateMachine, asm_pio\nfrom time import sleep\nimport sys\n\nled_onboard = machine.Pin(25, machine.Pin.OUT)\n\n@asm_pio(set_init=(PIO.OUT_LOW,) * 4)\ndef prog():\n        wrap_target()\n        set(pins, 8) [31] #8\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        set(pins, 4) [31] #4\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        set(pins, 2) [31] #2\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        set(pins, 1) [31] #1\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        nop() [31]\n        wrap()\n\nsm0 = StateMachine(0, prog, freq=50000, set_base=Pin(2))\nsm1 = StateMachine(1, prog, freq=25000, set_base=Pin(6))\nsm2 = StateMachine(2, prog, freq=12500, set_base=Pin(10))\nsm3 = StateMachine(3, prog, freq=6250, set_base=Pin(18))\n\nsm0.active(1)\n\nsm1.active(1)\nsm2.active(1)\nsm3.active(1)\n\n#sleep(5)\ndef Do_Stuff():\n    st = time.ticks_ms()\n    Y = 0\n    while Y &lt; 300000:+\u00f0\u00f0\u00f0\u00f0\n        Y += 1\n        Z = 57\n        Z1 = Z + Y\n        Z2 = Z - Y\n        Z3 = Z * (Z + Y)\n        #print(Y, Z1, Z2, Z3)\n    led_onboard.value(0)\n    #print(Y)\n    et = time.ticks_ms()\n    #print(et, st, et-st)\n    return et-st\n\n\ncntr = 0\nwhile cntr &lt; 2:    #run whole test several times for observation\n    cntr += 1\n\n    machine.freq(125000000)  #set clock to 125 MHz\n    x = machine.freq()\n    t = Do_Stuff()\n    print(\"\\n@\", x, \" time to run =\", t, \"ms\")\n\n\n    machine.freq(140000000)   #set clock to 140 MHz\n    x = machine.freq()\n    t = Do_Stuff()\n    print(\"\\n@ \", x, \" time to run =\", t, \"ms\")\n\n\n    machine.freq(200000000)  #set clock to 200 MHz\n    x = machine.freq()\n    t = Do_Stuff()\n    print(\"\\n@ \", x, \" time to run =\", t, \"ms\")\n\n    machine.freq(250000000)  #set clock to 250 MHz\n    x = machine.freq()\n    t = Do_Stuff()\n    print(\"\\n@ \", x, \" time to run =\", t, \"ms\")\n\nmachine.freq(125000000)  #set clock to 125 MHz to clean things up\nprint(\"\\n All Done Folks!\")\n\nsm0.active(0)\nsm1.active(0)\nsm2.active(0)\nsm3.active(0)\nsm0.exec(\"set(pins,0)\")\nsm1.exec(\"set(pins,0)\")\nsm2.exec(\"set(pins,0)\")\nsm3.exec(\"set(pins,0)\")\n</code></pre>"},{"location":"assignments/week04.html#xiao-samd21","title":"Xiao SAMD21","text":"<p>The SAMD21 runs at 48 MHz, which is considerably slower than the RP2040. But it's easy to solder. I'll probably use it because of that. It also has a DAC output.</p> <p>For hobbyists, the SAMD21 can only be programmed in the Arduino IDE and CircuitPython. For professionals, you can use Microchip Studio or set up your own toolchain. So I set up the board in the Arduino IDE the way you would set up any new board: I added the proper link into \"Additional Boards Manager URLs\" in Preferences, and then I could find Seeed SAMD21 Boards in the Boards Manager and install them. It's as easy as that, and then selecting the right board (Seeeduino Xiao). The setup is covered in this tutorial.</p> <p>I tried connecting it to the Arduino IDE but it didn't work.</p>"},{"location":"assignments/week04.html#xiao-esp32-c3","title":"Xiao ESP32 C3","text":"<p>The ESP32 C3 runs at 160 MHz, which is fast, but it's not possible to overclock it. But the most amazing thing is that this tiny microcontroller has WiFi and Bluetooth built in!</p> <p>This is my first RISC-V chip. As Neil says, RISC-V will probably take over the world. It's an open source architecture, so unlike the ARM chips that are found in microcontrollers, billions of smartphones and all the way up to supercomputers, manufacturers don't have to pay huge licensing fees to make RISC-V chips.</p> <p>I tried connecting it to the Arduino IDE but it didn't work.</p>"},{"location":"assignments/week04.html#esp-32-cam","title":"ESP-32 CAM","text":"<p>ESP-32 CAM is a 10 dollar WiFi camera! I had to have one and try it out. It might play well with my robot arm.</p> <p>I followed this tutorial to set up the ESP32-CAM board. To install the ESP32 boards in the Arduino IDE, I followed that tutorial. Then I tested the board with this tutorial. I uncommented the AI-Thinker CAM definition in the setup and input my WiFi credentials in the sketch.   When the Arduino IDE had uploaded the code, the following message was left hanging: <pre><code>Leaving...\nHard resetting via RTS pin...\n</code></pre> But then I checked and saw that above it, the status bar said \"Done uploading\". I also found this explanation, which said that this isn't an error at all.</p> <p>First I saw nothing in the serial monitor. Then I removed an extra #define camera line. Still nothing. Then I switched to the 5G network, the same as my laptop is on. Then I saw a series of dots form .... but no IP address. But when I did in the opposite order from the tutorial (first pressed RESET, then removed the jumper) I got this message: <pre><code>ets Jul 29 2019 12:21:46\n\nrst:0x1 (POWERON_RESET),boot:0x3 (DOWNLOAD_BOOT(UART0/UART1/SDIO_REI_REO_V2))\nwaiting for download\nets Jul 29 2019 12:21:46\n</code></pre> Something's happening! I removed the jumper and pressed reset again: <pre><code>rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)\nconfigsip: 0, SPIWP:0xee\nclk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00\nmode:DIO, clock div:1\nload:0x3fff0030,len:1344\nload:0x40078000,len:13836\nload:0x40080400,len:3608\nentry 0x400805f0\n\n.\nWiFi connected\nCamera Ready! Use 'http://192.168.1.32' to connect\n</code></pre> Success! After scrolling down and pressing \"Start stream\", I could see a live stream from the camera over WiFi to my browser! At QVGA resolution (320x240), the stream is smooth. At UXGA resolution (1600x1200), the stream stutters. SVGA (800x600) is the highest resolution where lag isn't very noticeable. That's pretty good for a microcontroller! I love it. And I find that in low light, greyscale looks a lot better than a color image.</p> Note <p>This time I used <code>ffmpeg -i esp32-cam_test1.mp4 -vf scale=400:-2 -vcodec libx264 -an -crf 20 esp32-cam_test1_web.mp4</code> to compress the video and remove the audio as shown here.</p> <p>This video shows ways to control the image capture just by typing URLs into the browser. If you have a computer nearby at all times, you can also stream video from the ESP32-CAM to any browser in the world. And here's a guide to modifying the HTML code inside the Arduino code. It's not obvious how to do it, since the HTML has been converted to hex code in the Arduino sketch.</p> <p>I checked whether it's possible to overclock the ESP32, but 240 MHz seems to be the maximum clock speed.</p>"},{"location":"assignments/week04.html#fpga","title":"FPGA","text":"<p>I bought an FPGA development board from Seeed Studio. It is the Runber board, which contains a Gowin FPGA. I took the plunge because it is the cheapest FPGA board I've found that still has a set of tutorials. I looked at some of the documentation and it looks intimidating. I applied for a software license on a Friday and got it in the beginning of the next week. I haven't had the time to set it up and go through a tutorial, though.</p>"},{"location":"assignments/week05.html","title":"3D Scanning and Printing","text":""},{"location":"assignments/week05.html#assignment","title":"Assignment","text":""},{"location":"assignments/week05.html#group-assignment","title":"Group assignment","text":"<ul> <li>Test the design rules for your 3D printer(s)</li> </ul>"},{"location":"assignments/week05.html#individual-assignment","title":"Individual assignment","text":"<ul> <li>Design and 3D print an object (small, few cm<sup>3</sup>, limited by printer time)<ul> <li>that could not be made subtractively</li> </ul> </li> <li>3D scan an object (and optionally print it)</li> </ul> <p>See more info and recording of the lecture here.</p>"},{"location":"assignments/week05.html#benchmarks","title":"Benchmarks","text":"<p>I made a few test prints to characterize the Ultimaker 2+ and Ultimaker 3. </p> <p>These are our two workhorses.</p> <p>The classic 3D printing benchmark is the 3D Benchy by Creative Tools in Sweden. It came out well, with only a tiny bit of drooping in the top of the doorway.</p> <p>A nice 3D Benchy.</p> <p>I printed this tolerance test by 3D Maker Noob. The clearance test turned out well, with only the tightest clearance (0.1 mm) getting fused together. I would say that's very good.</p> <p>I've 3D printed professionally for years, but I'm still amazed how precise these computer-controlled hot glue guns can be. A hot glue gun is actually the origin of FDM 3D printing, by the way.</p> <p>And here's a test of many things, including overhangs, small text, stringing and bridging:</p> <p>Pretty good, I think.</p>"},{"location":"assignments/week05.html#3d-scanning","title":"3D scanning","text":"<p>I couldn't think of anything to 3D scan but just at the right time, an artist came into the lab with a small sculpture and asked if we could 3D scan and print it. I gave it my best shot.</p> <p>The sculpture to be scanned.</p> <p>The creature is based on a picture of the old Icelandic mythical beast Fj\u00f6rulalli, which looks mostly like a seal and lives on the beach. It's most commonly found in the West Fjords and Brei\u00f0afj\u00f6r\u00f0ur.</p> <p>It looked like a seal and acted like a seal. The Fj\u00f6rulalli is probably our least mysterious mythical creature. But I really like Angela Muenther's sculpture of it.</p> <p>I followed Christopher Barnatt's excellent tutorial in this project. We started by clearing a table and closing the blinds, because you want nice, even light for photogrammetry. We placed the little guy on some fabric with a pattern, because that helps the algorithm locate the pictures in space afterwards and stitch them together. Then we took pictures on a small point-and-shoot camera all around the sculpture in circles with increasing height. Then I loaded the images into the excellent Meshroom, which is free and open-source. I had tried Meshroom once before, but it didn't work for some reason, so I gave up. This time there was time pressure, so I became more resourceful. I found that the path to the images contained Icelandic characters. Once I had fixed that, the program started running, the computer started humming and in about an hour and a half, I had a 3D point cloud!</p> <p>Raw point cloud in Meshroom.</p> <p>Then I took the mesh into Meshmixer and deleted everything that I didn't want to include.</p> <p></p> <p>The final 3D processing step was in Blender, where I filled in the bottom of the model to make the mesh watertight and then smoothed it in a few places, using my new Blender skills from having gone through the donut tutorial last week.</p> <p>Loop select and fill in Blender.</p> <p>The smoothing tool in the sculpture environment in Blender.</p> <p>Then I 3D printed two sculptures in almost exactly the same gray color as the original sculpture. One had smoothing, the other had none. When Angela came to examine them the next day, she said she wanted something in between, so I started again and did the smoothing with more finesse this time. Then I printed some more of them, in a few different materials. One in transparent PETG and one in glow-in-the-dark PLA.</p> <p>The output of this week.</p> <p>I used this tip to get the printing temperature right for PETG, for the transparent sculpture print.</p> <p>PETG print with Lighning infill in Cura.</p> <p>Angela really liked the glow-in-the-dark version. So do I.</p> <p>Angela, far left, describing her exhibition.</p> <p>The exhibition at Galler\u00ed \u00dathverfa.</p>"},{"location":"assignments/week05.html#design-for-3d-printing","title":"Design for 3D printing","text":"<p>The next task was to design and 3D print something that you can't make subtractively (e.g. using milling). I've been interested in lattice structures for a while, so I took a stab at making one.</p> <p>The 3D sketch in Fusion 360. I sweep the circle along the line to make a cylinder. Then I repeat.</p> <p>I made a rectangular pattern of this lattice and 3D printed it.</p> <p>The red one is hard PLA and the white one is soft TPU.</p> <p>Download lattice test file</p> <p>I really liked the soft lattice, so I wanted to make a bigger version of it.</p> <p>I made a much bigger rectangular pattern in Fusion 360.</p> <p>Then I modeled a ball and used it to cut the pattern. Fortunately my laptop is quite powerful, so it went without a hitch.</p> <p>This is probably the biggest pattern I've made.</p> <p>Then I thought about how to print this thing. It needs support on the bottom side, but will regular supports generated by Cura be good enough? I decided to model the supports myself. To decide on the gap between the model and support structure, I used this reference. I decided to go for a 0.2 mm air gap, so I offset the circle by 0.4 mm.</p> <p>Support bowl for the lattice structure.</p> <p>Removing the supports went really smoothly! After cutting with scissors, I could tear the ball away from the bowl.</p> <p>\u00de\u00f3rarinn immediately suggested that I turn the ball into a lamp.</p> <p>I used this guide from Creality to adjust the Generic TPU profile in Cura for the CR-10 printer. The CR-series printers are OK for tinkerers but not for Fab Labs or other professional users. I would not let anyone use the CR-10 printers unsupervised. You have to level the bed almost every time you print, and often make adjustments after you start printing. Usually I need to start printing two or three times. It's not an enjoyable experience. </p> <p>Contrast that with the Ultimaker 2+ (I have one myself and it's my favorite 3D printer). It just prints, and you rarely have to level it. It's a real workhorse. I've printed for over 2000 hours on my machine and it's still printing like it's new. I don't like the direction Ultimaker is taking, however, with super expensive printers for professional users.</p> <p>I printed the ball using TPU (thermoplastic polyurethane) and it bounces and works great as a ball to play with! I used 1.75 mm TPU on the Creality CR-10, which has a Bowden extruder. What that means is that it pushes on the filament and it acts like a long, soft spring. So to get good results I had to print really slowly. The print took five days to complete.</p> <p>The lattice ball has become one of the favorite objects to play with in the lab. You can even bounce it off the floor without breaking it. Here are my students in the Fab Lab course at the local high school:</p>"},{"location":"assignments/week05.html#design-file","title":"Design file","text":"<p>Unfortunately the Fusion 360 file is 65 MB, so I can't include it here. But I've put the STL file on Sketchfab.</p> <p>  Lattice ball  by  svavarkonn  on Sketchfab</p>"},{"location":"assignments/week06.html","title":"Electronics Design","text":""},{"location":"assignments/week06.html#assignment","title":"Assignment","text":""},{"location":"assignments/week06.html#group-project","title":"Group project","text":"<ul> <li>Use the test equipment in your lab to observe the operation of a microcontroller circuit board</li> </ul>"},{"location":"assignments/week06.html#individual-project","title":"Individual project","text":"<ul> <li>Use an EDA tool to design a development board to interact and communicate with an embedded microcontroller</li> <li>Extra credit: try another design workflow</li> <li>Extra credit: design a case for it</li> <li>Extra credit: simulate its operation</li> </ul> <p>See more info and recording of the lecture here.</p>"},{"location":"assignments/week06.html#designing-a-simple-board-in-kicad","title":"Designing a simple board in KiCAD","text":"<p>Here's a video where I describe what I did in Electronics Design week to Neil Gershenfeld during random review.</p> <p>A few months ago I went through a short KiCAD tutorial, to get to know the program a little bit. But I got a lot more out of designing a little PCB with an LED and a button and making it on the vinyl cutter this week. Designing something without making it doesn't get me excited to do more stuff. After making the little circuit, I really want to make more. Let's get into it.</p>"},{"location":"assignments/week06.html#the-fab-library","title":"The fab library","text":"<p>I cloned the Fab Lab parts library for KiCAD from the Gitlab repository. It's maintained by Krisjanis Rijnieks in Finland. To use the library, I needed to upgrade to KiCAD 7.</p> <p></p> <p>I started by going into Preferences and Manage Symbol Libraries. There I clicked the + symbol to import a new library and navigated to the location of the fab library, which is called fab.kicad_sym. Then I went into Preferences and Manage Footprint Libraries and did the same, but that file is called fab.pretty.</p> <p>KiCAD has many parts in its libraries, but the fab library has been the most useful by far.</p>"},{"location":"assignments/week06.html#the-schematic","title":"The schematic","text":"<p>Having imported all the components in the Fab Lab Inventory, I could get started with my design. I created a new design in a new folder. In the Schematic editor I pressed A on the keyboard to add components, and added a 1206 diode, a 1206 resistor to go with it, the Xiao RP2040 module and a pushbutton. I also added a power symbol and a ground symbol. Then I used the wire tool on the right side of the interface to connect the components together in a way that made sense to me.</p> <p>My first schematic.</p>"},{"location":"assignments/week06.html#routing-the-pcb","title":"Routing the PCB","text":"<p>Next, I opened the PCB Editor. I placed the components there all at once. They were connected by thin lines called a rat's nest, but the routing of the physical traces requires a second step. I moved the parts into a pleasing arrangement and then connected them together with the wire tool in the toolbar on the right.</p> <p>After selecting Update PCB from Schematic, I got the parts all in a bundle.</p> <p>Then I realized that I probably had the wrong button, so I swapped it out. Then I arranged the parts in a pleasing way routed traces between them by pressing X on the keyboard.</p> <p>Arranged and routed.</p>"},{"location":"assignments/week06.html#3d-viewer","title":"3D Viewer","text":"<p>Then I tried the 3D Viewer (View -&gt; 3D Viewer) and got a warning that I needed to define a board outline.</p> <p>Board outline missing.</p> <p>So I added a board outline to Edge Cuts. A day or two earlier, my elder son Ernir said that he wanted to make an electric thing in the shape of a circle, and close it off on all sides except one, so that we could connect it to another circle. So I made the outline a circle. </p> <p>Circular board outline.</p> <p>I moved the components around some more until I was happy. Then I pressed Alt+3 on the keyboard to get a 3D preview. That was underwhelming, since none of the components I used have a 3D model associated with them. I wanted at least to have the Xiao module, so that I could design an enclosure around its USB connector (if I had the time). I found the model on the SeeedStudio web site. It includes a Fusion 360 design file, but I only need the STEP file. I put the STEP file into the fab.3dshapes folder in the fab library and used this tutorial to connect it to the KiCAD footprint. Now we're talking!</p> <p>I can see the 3D model being useful when designing enclosures.</p>"},{"location":"assignments/week06.html#a-few-fixes","title":"A few fixes","text":"<p>I exported the design as an SVG and opened it in Inkscape. It wasn't until I saw it there that I realized that the traces were too thin to cut on the vinyl cutter.</p> <p>I needed to go back into the PCB Editor and use a quick and dirty way to change the track width. I selected one part of each trace, then pressed U to select the whole trace and then pressed E to open the trace properties. There I could change the trace width from 0.25 mm to 1 mm. </p> <p>That's better.</p> <p>Next time I'll set the track width from the start in the proper way using Netclasses in File -&gt; Board Setup. That's much more convenient, since every new trace will have the width that I've defined.</p> <p>This is how you set the trace width properly for the whole board.</p> <p>Now I have a completed design in the PCB editor, ready to export to Inkscape:</p> <p>Xiao RP2040 LED board with a button.</p>"},{"location":"assignments/week06.html#design-files","title":"Design files","text":"<p>Here are the KiCAD files for this project, including the PDF file that is ready for cutting:</p> <p>Download KiCAD project</p>"},{"location":"assignments/week06.html#selecting-a-resistor-for-the-led","title":"Selecting a resistor for the  LED","text":"<p>Now I needed to find the right resistor to use with the blue LED. I found a very useful tutorial from Digikey, which is where I got my parts from.</p> <p>Diodes are a one-way valve for electrons. Electrons can go one way, but not the other. When diodes let current through, they have almost no resistance, and that's great. Then someone discovered that diodes can emit light. Now LEDs are everywhere and they have one caveat: You can't just connect one to a power source and have it work. Because it's such a good conductor, it will let more current through that it can handle. It will burn up, or even blow up! So we need a helper component. Every LED needs a current limiting resistor in order to survive. So, how do we select the right resistor for our blue LED?</p> <p>Let's use Ohm's Law:</p> <p> Ohm's Law pyramid. Coincidentally, VIR means 'wire' in Icelandic.</p> <p>It's fun to be able to make graphics like these in Inkscape and render them easily on a web page. Ok, I need to know the</p> <ul> <li>Source voltage: 3.3 V</li> <li>LED forward voltage: 3.2 V (max 3.5 V)</li> <li>LED's recommended operating current: 30 mA</li> </ul> <p>But there's a catch: After reading the datasheet, I know that RP2040 can only supply 16 mA from each GPIO pin. So that's the number I'll use.</p> <p>The voltage drop across the resistor needs to be</p> \\[V_{source}-V_{forward}\\] \\[3.3 V - 3.2 V = 0.1 V\\] <p>Now let's use the pyramid to get an expression for the resistor:</p> \\[R = \\frac{V}{I} = \\frac{0.1V}{0.016A} = 6.25 \u03a9\\] <p>I have the resistance! But there's one more step: I need to make sure that the resistor can take the heat. I'll use the power formula to see the power dissipated by the resistor:</p> \\[P   =   I\u22c5V\\] \\[ =   0.016 A \u22c5 0.1 V \\] \\[    =   0.0016 W \\] \\[    =   1.6 mW \\] <p>That's insignificant.</p> <p>At the Fab Lab I have 4.99\u03a9 and 10\u03a9 resistors. Let's check the current through the LED:</p> <p>4.99\u03a9:  </p> \\[I   =   \\frac{V}{R} =   \\frac{0.1V}{4.99\u03a9}  =   0.02A \\] <p>10\u03a9:    </p> \\[I   =   \\frac{V}{R} =   \\frac{0.1V}{10\u03a9}    =   0.01A\\] <p>OK, I'll use the 10\u03a9 resistor.</p>"},{"location":"assignments/week06.html#using-an-oscilloscope","title":"Using an oscilloscope","text":"<p>I programmed a Raspberry Pi Pico to output stepper motor control signals. This is the same MicroPython code as I used in Embedded Programming week. It's a very simple way of creating signals for a 28BYJ-48 stepper motor.</p> <pre><code>from machine import Pin\nfrom time import sleep\n\nIN1 = Pin(2,Pin.OUT)\nIN2 = Pin(3,Pin.OUT)\nIN3 = Pin(4,Pin.OUT)\nIN4 = Pin(5,Pin.OUT)\n\npins = [IN1, IN2, IN3, IN4]\n\nsequence = [[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]\n\nwhile True:\n    for step in sequence:\n        for i in range(len(pins)):\n            pins[i].value(step[i])\n            sleep(1)\n</code></pre> <p>I set the probe to 10X sensitivity:</p> <p></p> <p>And here's what I got on the oscilloscope:</p> <p>A clear step signal, at just over 60Hz. Time is on the X-axis and voltage is on the Y-axis. Then when the oscilloscope starts receiving a signal I press Auto adjust, and the scope detects how the signal looks and adjusts the time scale so the signal is steady on the screen.</p> <p>I used the portable digital oscilloscope to troubleshoot my Output Devices board:</p> <p>I found erratic signals coming from one of the H-bridges, which caused my brushless motor to move erratically. More info is here.</p>"},{"location":"assignments/week06.html#using-a-multimeter","title":"Using a multimeter","text":"<p>In Computer-Controlled Cutting week, I measured a resistor with a multimeter:</p> <p>Here the circuit needs to be powered off. The resistor says 1002, and it indeed measures as 10kOhm.</p> <p>In Output Devices week, I measured the voltage that an OLED gets from the power supply:</p> <p>Here the circuit needs to be powered on. The OLED gets roughly 5V, as it shuould be. The OLED can operate on 3.3V-5V voltage.</p> <p>I also measured the current that the OLED draws:</p> <p>Here I need to break the circuit and put the current meter into the circuit, so that the current flows through it. Inside the current meter is a resistor with a very small, known resistance. The voltage drop over the resistor is measured and from that, the device calculates the current. On the right a bigger part of the screen is turned on, and it shows in the current measurement.</p>"},{"location":"assignments/week07.html","title":"Computer-Controlled Machining","text":""},{"location":"assignments/week07.html#assignment","title":"Assignment","text":""},{"location":"assignments/week07.html#group-assignment","title":"Group assignment","text":"<ul> <li>Do your lab's safety training</li> <li>Test runout, alignment, fixturing, speeds, feeds, materials, and toolpaths for your machine</li> </ul>"},{"location":"assignments/week07.html#individual-assignment","title":"Individual assignment","text":"<ul> <li>Make (design+mill+assemble) something big (~meter-scale)</li> <li>Extra credit: don't use fasteners or glue</li> <li>Extra credit: include curved surfaces</li> </ul> <p>See more info and recording of the lecture here.</p>"},{"location":"assignments/week07.html#design","title":"Design","text":"<p>I designed an extended table with a shelf for our coffee corner. I wondered how I could make the shelf supports look good:</p> Version 1Version 2Version 3 <p></p> <p></p> <p></p> <p>I ended up picking version 3.</p> <p>Here's an example of how convenient parametric design can be:</p> <p></p> <p>And here's the whole design process. First I create the parts and adjust their sizes, then I model the press-fit dogbone joints and finally I move the parts into one plane and nest them manually to fit onto the plywood plate that I have. I need to create the plywood plate as a part in the model, so that I can use it as the stock when setting up the machining toolpaths.</p> <p></p>"},{"location":"assignments/week07.html#computer-aided-machining","title":"Computer-Aided Machining","text":"<p>I start by creating a Setup. Under the Stock tab, I select the body that represents my plywood sheet:</p> <p>It's good practice to name the bodies in the model. It makes things easier.</p> <p>Then in the Setup tab, I set up the work coordinate system. I set the zero point to be the bottom left corner of the sheet corner, looking at it from above (see the image above). The top surface is the Z reference.</p> <p>Close-up of how I define the work origin for the Shopbot.</p> <p>Now I start creating machining operations. I had to create the chamfering tool in Fusion, it's not complicated.</p> Cutter tabCutting data tab <p>You can select the type of milling bit from a drop down list and then specify its dimensions according to the bit that you have.</p> <p>In the Cutting data tab you also input the feeds and  speeds for this bit. \u00de\u00f3rarinn recommended that for plywood I would choose a spindle speed of 14.000 rpm and a feed rate of 1000 mm/min.</p> <p>Then I chose a 2D contour milling operation and selected only the edges that I wanted chamfered. For some reason it worked better to split the operations up and select only one edge in each one. Under the Passes tab, uncheck the Stock to leave option. The first pass is the finishing pass.</p> Geometry tabHeights tab <p></p> <p>Remember to select Stock bottom as the bottom plane.</p> <p>Next, I mill the dogbone press-fit holes. I select a 6 mm flat end mill with the same feeds and speeds as the chamfering tool. I created one 2D pocket operation for each dogbone pocket.</p> <p>The simulation looks good. I had to enlarge the circles in the dogbone to make sure that the milling bit can enter them.</p> <p>The last operation is to mill all the outline, using the same 6 mm flat endmill, again rotating at 14.000 rpm and moving at 1000 mm/min through the material:</p> <p>The outline milling operation. It's a 2D contour operation, like the chamfering. I had the machine leave rectangular shaped tabs, to keep the parts from moving around while finishing the milling operation.</p>"},{"location":"assignments/week07.html#the-shopbot","title":"The ShopBot","text":""},{"location":"assignments/week07.html#specifications","title":"Specifications","text":"<p>The ShopBot in Fab Lab \u00cdsafj\u00f6r\u00f0ur. The leftover wood under the machine is free to use for everyone.</p> <p>We have a ShopBot PRSalpha 120-60 CNC. This is a big and capable 3-axis machine with a 3.28 m by 1.55 m work area and a 5 horsepower beast of a spindle. It has a cutting force of about 68 kg and it can move at up to 18 m/min across the table with the full cutting force.</p> <p>The ShopBot has strong geared stepper motors with low backlash which move the gantry using a rack-and-pinion motion system. \u00de\u00f3rarinn mentioned the other day that he isn't sure that the mechanical end stops will hold if the machine decides to move all the way to the end at full speed. The stepper motors have position sensors, so we have a closed-loop control system. The machine can correct the position of the motors in real time if they're a little bit off. The step resolution is 0.01 mm. If that's true in practice, then that's really nice.</p> <p>The ShopBot has a convenient conductive metal plate that you can place on top of your sheet material and zero the Z-axis automatically.</p> <p>The ShopBot is mostly used to make wood furniture and occasional molds for composite manufacturing, but also for milling engineering plastics and I used it successfully to mill a small and precise mold in Molding and Casting week. \u00de\u00f3rarinn is also working on milling an experimental aluminum injection mold with a local engineer who does interesting projects in the lab. I'm interesting in learning to mill aluminum with the ShopBot. You have to be really careful with your feeds and speeds. I've milled two small branding irons out of brass using a V-bit, that was fun.</p>"},{"location":"assignments/week07.html#turning-the-machine-on","title":"Turning the machine on","text":"<p>To be able to turn on the spindle, you need to reset the machine controller.</p> <p>Before you do anything in the Shopbot control software, you need to open Tools -&gt; Spindle control. Otherwise the software can't change the spindle speed as the GCode requires. Then you go into Cuts -&gt; Spindle Warmup Routine, to spin the spindle at two speeds for 10 or 15 minutes, to warm up the bearings in the spindle.</p> <p>You go into Cuts -&gt; Zero Z-axis w/ Zzero plate to zero the Z-axis with a conductive metal plate.</p> <p>Then you press K to get the KeyPad window and use the arrow keys on the keyboard to move the spindle to a convenient point before you go into Zero -&gt; Zero [2] axes (X &amp; Y) in the software.</p> <p>Turning on the shop vac just before starting the job.</p>"},{"location":"assignments/week07.html#recalibrating-the-shopbot","title":"Recalibrating the ShopBot","text":"<p>When I made a fit test with two slightly different clearances, I discovered that both of them were way off the mark. I asked my instructor \u00de\u00f3rarinn what might cause this and he suggested that the gearboxes on the stepper motors might be wearing out. This may result in the steps per inch value changing.</p> <p>So I modeled a 100 mm by 100 mm square with a circular pocket in the middle. My instructor \u00de\u00f3rarinn suggested that I also chamfer the corners, so that I could make diagonal measurements.</p> <p></p> <p>The resulting square had 100.5 mm sides. That means that I need to use this scaling factor on the steps per inch value. I can change that value in the Unit Values window in the Shopbot control software.</p> \\[ \\frac{100}{100.5} = 0.9950249 \\] <p>Corrected value: </p> \\[ 0.9950 * 97.7487 = \\underline{97.262389} \\; \\textnormal{steps/inch} \\] <p>steps/inch.</p> <p>Let's change the unit values for the X and Y axes in the ShopBot control software:</p> <p>The X and Y unit values were 97.7487 and then I changed them to 97.2624.</p> <p>Now our ShopBot is more accurate.</p>"},{"location":"assignments/week07.html#test-pieces","title":"Test pieces","text":"<p>I designed a test fit piece with different clearances in Fusion 360.</p> <p></p> <p>These fit tests gave me the confidence to finish the design of the coffee corner and mill all the parts in one go.</p> <p>Hexagon fit test pieces.</p> <p>I also did a chamfering test, here's the CAM simulation:</p> <p></p> <p>I'm glad I also did this test, because I had selected a chamfering tool that was too small.</p> <p>Both are 90\u00b0 bits, but one is bigger than the other. And that makes a difference when you carve this deep.</p>"},{"location":"assignments/week07.html#milling-the-parts-for-the-coffee-corner","title":"Milling the parts for the coffee corner","text":"<p>It was exciting to do sophisticated milling like this with confidence. I fixed the plywood sheet with screws in the corners and on the middle of the long sides. I took care to tie my hair into a bun and wear hearing protection and safety glasses. First I milled just the chamfers into the plywood sheet. Then I changed from the chamfer tool to the 6 mm flat end mill and milled the dogbone pockets. After that operation it still didn't look like anything recognizable. Finally I milled the outlines and then I recognized the parts.</p> <p>Top view after milling.</p> <p>Dislodging the sawdust with a screwdriver.</p> <p>Vaccuuming the sawdust.</p> <p>Breaking the tab.</p> <p>Breaking the tabs with a chisel.</p> <p>Sanding the edges.</p> <p>I chamfered a few corners before hammering the parts together, to make sure that they sit flush against each other.</p> <p>My instructor \u00de\u00f3rarinn suggested that I take a little off the corners to compensate for the inner corner radius in the piece that gets hammered into these holes.</p> <p>Hammering the parts together. They fit tightly together and don't require any glue.</p> <p>Our new documentation station. I really get in the zone when I sit here and write documentation. I think it's because I feel like I'm in a caf\u00e9, and that's where I get the best concentration. Look how serious I am!</p> <p>The next time I mill something out of wood using Fusion 360, I may need to use a different tab shape. Look at the burn marks after the machine stopped to mill this tab:</p> <p>There are burn marks where all the tabs were.</p> <p>While I was hard at work finishing up the documentation, my instructor \u00de\u00f3rarinn painted the table black and attached it and the shelf to the wall.</p> <p>Bas Withagen in Fab Lab Reykjav\u00edk used to say that if you have time to paint your final project, you're doing it wrong. Fortunately, I have my trusty instructor \u00de\u00f3rarinn, who painted the table black. He's there with his dog S\u00f3la, who was old and had become blind from diabetes. She laid at my desk as I worked on the Fab Academy documentation. S\u00f3la only lived for a week after I took this picture. Such a sweet dog.</p> <p>Our lovely coffee corner with a freshly painted table and \u00de\u00f3rarinn's espresso machine. \u00de\u00f3rarinn commented that now there was really no spot in the lab that wasn't cozy and enticing to sit down and work on a laptop.</p>"},{"location":"assignments/week07.html#all-the-design-files","title":"All the design files","text":"<p>Download Coffee Corner Fusion 360 model</p> <p>Download 12 mm fit test Fusion 360 model</p> <p>Download 12 mm fit test - more clearance Fusion 360 model</p> <p>Download 12 mm hexagon test Fusion 360 model</p> <p>Download 15 mm fit test Fusion 360 model</p> <p>Download 15 mm chamfer test Fusion 360 model</p> <p>Download rectangle circle test VCarve file</p> <p>Download rectangle circle test - quarter inch bit VCarve file</p> <p>Download rectangle circle test - 22mm MDF VCarve file</p>"},{"location":"assignments/week08.html","title":"Electronics Production","text":""},{"location":"assignments/week08.html#assignment","title":"Assignment","text":""},{"location":"assignments/week08.html#group-assignment","title":"Group assignment","text":"<ul> <li>Characterize the design rules for your in-house PCB production process</li> <li>Send a PCB out to a board house</li> </ul>"},{"location":"assignments/week08.html#individual-assignment","title":"Individual assignment","text":"<ul> <li>Make and test the development board that you designed to interact and communicate with an embedded microcontroller</li> <li>Extra credit: make it with another process</li> </ul> <p>See more info and recording of the lecture here.</p>"},{"location":"assignments/week08.html#vinyl-cutting-electronics","title":"Vinyl cutting electronics","text":""},{"location":"assignments/week08.html#making-a-vinyl-cutting-file-in-inkscape","title":"Making a vinyl cutting file in Inkscape","text":"<p>I had to go into Inkscape and do a bit of editing of the SVG that I exported out of KiCAD in Electronics Design week. The traces were only single lines, so I couldn't just set the line width to 0.02 mm and start cutting. I used a little trick; I converted the stroke to a path.</p> <p>These lines won't work.</p> <p>Stroke to Path.</p> <p>Now I have lots of lines. Too many, even. But I can work with these.</p> <p>Now I had a lot of intersecting shapes, which I was able to combine using Path -&gt; Union. After that, it was only a bit of cleaning up, since there was an extra rectangle left over on each pad. </p> <p>Path -&gt; Union.</p> <p>Removing duplicate lines.</p> <p>I made the lines red, set the line width to 0.02 mm and exported to PDF (File -&gt; Save As and then select PDF as the output).</p>"},{"location":"assignments/week08.html#cutting-the-circuit","title":"Cutting the circuit","text":"<p>Cutting the circuit didn't go perfectly. Some of the pads came loose when the cutter was cutting holes in them. Checking the design in Inkscape, I found that there was an extra circle on top of every hole. So each hole was cut twice. I also realized that I didn't need to solder pins onto the Xiao module, I could surface-mount it! So I deleted all the holes and cut again. This time the circuit came out perfect. I love making circuits on the vinyl cutter! It's so quick and easy.</p> <p></p> <p>I found a MicroPython blink program to run on the RP2040. All I had to do was to look at the pinout on the Xiao module to see which GPIO pin I had connected to the LED. That's pin 26. I substituted that into the program and pressed play. It works!</p> <p>Here's the blink program in MicroPython:</p> <pre><code>from machine import Pin, Timer\nled = machine.Pin(26, machine.Pin.OUT)\ntimer = Timer()\n\ndef blink(timer):\n    led.toggle()\n\ntimer.init(freq=2.5, mode=Timer.PERIODIC, callback=blink)\n</code></pre> <p>I also tried programming it in C++ in the Arduino IDE. Here is my board with the button working:</p> <p>And the Arduino code:</p> <pre><code>#define BUTTON_PIN 29\n#define LED_PIN 26\nbool status = 0;\n\nvoid setup()\n{\n  Serial.begin(9600);\n  pinMode(BUTTON_PIN, INPUT_PULLUP);\n  pinMode(LED_PIN, OUTPUT);\n}\n\nvoid loop()\n{\n  status = digitalRead(BUTTON_PIN);\n  Serial.println(status);\n  if (status == 1) {\n    digitalWrite(LED_PIN, LOW);\n  } else {\n    digitalWrite(LED_PIN, HIGH);\n  }\n  delay(100);\n}\n</code></pre>"},{"location":"assignments/week08.html#design-files","title":"Design files","text":"<p>Here is the KiCAD project:</p> <p>Download KiCAD project</p>"},{"location":"assignments/week08.html#pcb-milling","title":"PCB milling","text":"<p>I decided to make an LED debugging board. I've wanted something like this for a while. Sometimes you just want to see if something is happening on the output pin that you've defined. Or you're not sure which pin is which. I think an LED board can help when you're figuring out if the problem is in the circuit or in the code. So I designed a board with 30 LEDs, which covers the whole length of my breadboard:</p> <p>Here I'm placing a simple pattern of LEDs, each with a current limiting resistor.</p> <p>Most of the work took place in the PCB layout environment. I needed to rotate every LED individually and align it and its resistor with the others.</p> <p>I had to do a fair bit of rotating and arranging to get all the resistors and LEDs in line.</p> <p>Then I selected File -&gt; Export SVG and opened the SVG file in Inkscape. Unlike the vinyl cutting file, which needs to be a perfect SVG, what I'm using now is a PNG. So I only need to set the colors of the board and traces right, and that's it! Export to PNG with 1000 dots per inch resolution.</p> <p> The production files are simple PNG images. You can save these and load them into Fab Modules to make your own LED test board. The left one (traces) is milled with a 1/64\" bit and the right one (interior) is milled with a 1/32\" bit to cut the outline of the board.</p> <p>To mill the traces I took the milling bit out of the collet and put the 1/64 inch bit in. Initially the bit should only be poking a little bit out of the collet.</p> <p>When over the PCB and the Z-axis is in zero position, I loosened the milling bit, taking care to keep it from dropping and breaking.</p> <p>Then I lower the bit onto the PCB, thereby zeroing it. I push it gently down with one finger while I tighten the set screw, otherwise the screw can lift the bit slightly as I fasten it.</p> <p>The traces PNG is loaded in Fab Modules, RML code for Roland Modela mills is selected and PCB traces is selected. We have Fab Modules running locally on an ancient Linux machine and I don't know how to take screenshots on it. Sorry.</p> <p>Then I select the MDX-20 milling machine, click Calculate to generate the toolpath and click Send to send the RML code to the machine.</p> <p>Starting to mill the traces on the Roland MDX-20 machine.</p> <p>Vacuuming the dust away after milling.</p> <p>Fab Modules selections for milling the PCB traces.</p> <p>Generating the toolpath to mill the PCB outline. The interior PNG was loaded this time and PCB outline selected instead of PCB traces. Did you know you can rotate the view in 3D in Fab Modules? It's great!</p> <p>Milling the board outline with a 1/32 inch bit. I changed the bit with the same procedure as before.</p> <p>After another round of vacuuming, the board is ready for soldering!</p> <p>Soldering, then stopping to test the resistor sizing. First I tried a 1kOhm resistor, which made the LED too dim. Then I tried a 10Ohm resistor, which was just right. Then I soldered the rest of the resistors and LEDs onto the board. I enjoyed the process, but if I were to make many of these boards, I would start thinking about a Pick-and-Place machine. The LumenPNP seems nice.</p>"},{"location":"assignments/week08.html#led-debugging","title":"LED debugging","text":"<p>I used the LED to troubleshoot my final project. First I made a simple program that blinks all the pins. It helped me to determine which pin on the IC relates to which pin number in the Arduino IDE, using the Arduino Nano 33 IoT board definition (because that's the only Arduino core that worked with my libraries). </p> <p>Blink all the pins! I noticed gaps, where a few pins weren't broken out on the board. I could identify them by slowing the blinking down and having the SAMD21 report the pin number to the serial monitor.</p> <p>Then, when the brushless motor was moving erratically, I added the LED board to the breadboard again to the breadboard to see if I was getting PWM signals on all three motor phases:</p> <p>I got a steady ENABLE signal and two PWM signals. There should also be a PWM signal on the brown wire. I had accidentally used a pin that wasn't broken out on the board for the third PWM signal. I quickly changed the pin in the code and the motor spun smoothly. See more in Final Project: Electronics Design.</p>"},{"location":"assignments/week08.html#design-files_1","title":"Design files","text":"<p>Download LED test board KiCAD project</p>"},{"location":"assignments/week08.html#pcb-milling-test","title":"PCB milling test","text":""},{"location":"assignments/week08.html#164th-inch-bit","title":"1/64th inch bit","text":"<p>I made Neil Gershenfeld's PCB milling test using the 1/64th inch flat end mill. I used a local instance of the old Fab Modules running on a Debian Linux laptop. I used the standard speed of 4 mm/s and a cut depth of 0.1 mm. Under \"number of offsets\" I put -1, which means that I want to clear the board completely of copper around the traces.</p> <p>The toolpaths in Fab Modules. I wonder how Neil programmed this from scratch.</p> <p>I think these traces came out rather well The depth of cut seems to be good since the copper is completely removed. The edges are relatively smooth, so the milling bit must be in good condition. The very finest traces came loose from the board. That's good to know. It seems to be best not to make traces thinner than 0.3 mm.</p>"},{"location":"assignments/week08.html#001-inch-bit","title":"0.01 inch bit","text":"<p>Then I tried the super thin 0.01 inch flat end mill, and I must admit that I forgot to change the milling speed. So the first attempt was at a fast pace of 4 mm/s. The end mill broke immediately. Then I tried again at a slow speed of 0.5 mm/s and the same cut depth 0.1 mm. It also broke quite quickly. This was frustrating.</p> <p>There are more offsets, since the milling bit is thinner.</p> <p>I broke two 0.01 inch milling bits trying to mill this test file.</p>"},{"location":"assignments/week08.html#eventual-success-with-fine-traces","title":"Eventual success with fine traces","text":"<p>I waited until the final project to try the 0.01 inch end mill again, then at the very slow speed of 0.1 mm/s. It worked for an hour and then broke in the middle of the night. I documented my frustration in my final project video and in my final project presentation, Neil Gershenfeld mentioned that everything has to be perfect for this milling bit to work. You have to plane the wasteboard, clean the machine, everything has to be just right. And I think I also made the mistake of having it mill all the traces, instead of just around the ICs with the smallest pads.</p> <p>In the end I was able to mill the finest traces on my final project board with a V-bit. Then I cleared the whole board with a 1/64th inch flat end mill and milled the holes and outline with a 1/32 inch flat end mill.</p> <p>Here is the assembled robot joint running a PID control loop:</p> <p>Look at that! It works!</p>"},{"location":"assignments/week08.html#design-files_2","title":"Design files","text":"<p>Download baks KiCAD project</p>"},{"location":"assignments/week09.html","title":"Output Devices","text":""},{"location":"assignments/week09.html#assignment","title":"Assignment","text":""},{"location":"assignments/week09.html#individual-assignment","title":"Individual assignment","text":"<ul> <li>Add an output device to a microcontroller board you've designed,</li> <li>and program it to do something</li> </ul>"},{"location":"assignments/week09.html#group-assignment","title":"Group assignment","text":"<ul> <li>Measure the power consumption of an output device</li> </ul> <p>See more info and recording of the lecture here.</p>"},{"location":"assignments/week09.html#neils-board","title":"Neil's board","text":"<p>I first made Neil Gershenfeld's Hello H-Bridge D11C board without modifications. I simply downloaded the traces and interior PNG files and used them to generate G-code to mill the board. After milling, I removed the extra copper around the USB connector, to avoid a short-circuit.</p> <p>Neil's board in Fab Modules.</p> <p>I like soldering. Maybe you can tell.</p> <p>I like the fact that the SAMD11 is a capable ARM microcontroller that still comes in a package that is easy to solder. After soldering, I plugged the USB connector on the board into my computer and hooked the SWD pins up to the Atmel-ICE programmer. I followed this tutorial from Fab Lab Kannai to try to upload a bootloader to the chip. </p> <p>Trying to program the ATSAMD11C with the official ATMEL-ICE programmer.</p> <p>The microcontroller was not detected. </p> <p>The Microchip Studio software couldn't find a connected device. I tried again, and got a low voltage warning. It said that the operating voltage was 1.5 volts but needed to be 1.6 to 3.8 volts. Well, that's an improvement! Now I have a useful error message that I may be able to do something about. Later.</p> <p>At least the computer is detecting something.</p>"},{"location":"assignments/week09.html#2024-update","title":"2024 update","text":"<p>I used Yuichi's guide to using the Xiao SAMD21 as a programmer. Yuichi's documentation is usually really good, and this guide is no exception.</p> <p></p> <p>I set the Xiao SAMD21 to bootloader mode and dragged the CMSIS-DAP firmware into the folder that opened. That was enough to make the Xiao a programmer. Then I connected the pins as shown in the guide and used the Generic D11C14A board definition in the Fab SAM core for Arduino. Remember to select TWO_UART... Tools-&gt;Serial Config and choose CMSIS-DAP as the programmer. Then burn the bootloader.</p> <p>Then you can disconnect the Xiao and the SAMD11 board. When you reconnect the SAMD11 board it gets recognized and you can now program it over USB! So convenient with such a small and cheap chip!</p> <p>Only a year later, it works!</p> <p>I couldn't get the SAMD11-based programmer to work until I tried connecting the target board to a USB power brick instead of the computer. If the target board has already been programmed, then it shows up as a COM port and that can confuse the computer.</p> <p>The SAMD11 programmer from Fab Fest Bali is now working.</p> <p>I also bought thirty Raspberry Pi Pico W boards for my students to use. I tried using one of them as a programmer and it also works, when I connect the target board to a USB power brick. Now I have no shortage of programmers for the SAMD chips.</p> <p>Raspberry Pi Pico W being used as a programmer.</p> <p>Here is a summary of the Fab Academy programmers.</p>"},{"location":"assignments/week09.html#stepper-control-board","title":"Stepper control board","text":""},{"location":"assignments/week09.html#fusion-360-pcb-export-woes","title":"Fusion 360 PCB export woes","text":"<p>For my own design, I decided to go an easier route. I used the Xiao RP2040 module, which I know how to program. After the incredible fireworks show in the Monday recitation, where the Fab Lab machine builders showed their projects, I looked into the Urumbu boards and Modular Things. Urumbu is based on work at a Fab event in Kerala, where it was discovered that you can connect several stepper control boards directly to a computer and send them synced commands via USB and have them act as a single machine. Modular Things grew out of that project, and they include a convenient web editor to program the boards with a few lines of JavaScript. </p> <p>I looked at the Urumbu boards and found that they used the DRV8428 stepper controllers. We only have two of them, and they are currently unavailable at Digikey. However, the latest Modular Things boards use a Xiao RP2040 for control, which I'm comfortable with, and the stepper board uses two A4950 motor controllers, which we have at our Lab. Alright! These boards are designed in Fusion 360 and I want to make some modifications to it. I opened the stepper board in Fusion 360 but I couldn't make heads or tails of the interface of the electronics environment.</p> <p>So I started going through a friendly five video tutorial series on Fusion 360 PCB design and milling. The first video covers making a new design, getting the libraries you need and opening the PCB layout. The video was made only a year ago but the interface has already changed since then. But I was able to follow it. In the second video you make your own library component from scratch. I needed to change the default grid units from mils to millimeters first. That is a global setting, so I should now see millimeters everywhere in the electronics design environment. In the third video, you make a more complicated component from the manufacturer's 3D CAD file and technical drawing. When I made a new component, I had to set the grid units to mm again. Annoying.</p> <p>I followed step 5 on this Fab Academy site to export the circuit as a PNG. That worked well for the traces, but no matter what I tried, I couldn't export the outline of the board. It's always visible in the viewport, even when I turn off all the layers. So instead, I tried opening the 3D PCB and exporting the PCB sketch as a DXF and then turning that into a black and white SVG in Inkscape. That works, except I need to draw a frame around it, so that the milling bit has space to traverse the whole outline. But then, how do I make the frame for the traces? I tried to export them as a DXF, but that didn't work. For that, I would need to create another sketch inside the 3D PCB environment and project the traces into it, but that environment only allows you to make one sketch.</p> <p>Then I tried to make an engineering drawing. Only the board outline and the pads appeared but not the traces. And not the frame around the board, because it only exists in a sketch. Then I changed the settings for the model view from Visible Lines to Visible with Hidden Edges, and the traces appeared! But they had broken lines. So I right-clicked the Document Settings at the top of the model tree on the left and looked at the View settings. The hidden lines were drawn with HIDDEN2. I changed that to Continuous, and now I had nice and continuous traces. I exported the drawing as a PDF and opened it in Inkscape. I deleted the CAD drawing frame, which I don't need to make production files. Now I just needed to do some editing to combine the traces with the pads and make one file with only the traces and another one with only the holes and the board outline. I made all the lines red and 0.02 mm wide, just because that's what we usually do before laser cutting and vinyl cutting. I'm used to looking at things like that.</p> <p>I tried turning on Fill, but that didn't come out well. So I had to do some editing. I selected Object -&gt; Ungroup twice to separate all the lines. I thought that I was getting close to production. But a lot of the lines weren't connected. Sigh. I can't use this. </p> <p>Next I tried exporting the CAD drawing as a DXF and opened it in Inkscape, in the hope that it would be more precise. It is more precise, but the lines are still all seperate. The pads and traces aren't objects that I can combine. I tried turning Fill on, but had no better luck than with the PDF.</p> <p>To make the background, I made a rectangle with black fill and no stroke, and had it snap to the corners of the broken sketch outline. </p> <p>Nicely milled stepper control board.</p> <p>When I was looking through the Arduino code for the stepper H-bridge RP2040, I found the pin that sends a reference voltage to the Toshiba driver. It was in the stepperDriver.cpp file. Connected to the pin was a somewhat cryptic slice_num variable, but from the RP2040 datasheet I remembered that the PWM generators are called slices. From the following lines of code, it seemed that the PWM duty cycle was 15/128, or 12%:</p> <p><code>cpp   // PWM duty cycle over 128   pwm_set_chan_level(slice_num_a, channel_a, 15);   pwm_set_chan_level(slice_num_b, channel_b, 15);</code> If I assume that the maximum output voltage of the RP2040 is 3.3V, then 12% of that is 0,396V. I can try to implement this with the Arduino library function analogWrite(pin, value), where value takes a number from 0 (always off) to 255 (always on). 12% of 255 is 31.</p> <p>The DC motor hummed, but didn't move. So I tried 50/255. Then it moved a tiny bit. Next, I tried 80/255. The motor spins! And I don't seem to be overloading the USB port. But the motor is very weak. Let's try 100. Now 120. Now 150. Now 180. Now 200. Now 220. I won't dare to go above that for now.</p> <p>Two DC motors, VREF 80. Works! Let's try 120. I tried 150, 180 and finally 220.</p> <p>I also tried PWM on both motors at the same time. That worked well. Now I'm gearing up for a BLDC motor. But that requires a boost converter to get the voltage from 5 to 12 V.</p>"},{"location":"assignments/week09.html#final-project-spiral-1","title":"Final project spiral 1","text":""},{"location":"assignments/week09.html#yuichis-board","title":"Yuichi's board","text":"<p>Then I tried Yuichi Tamiya's Modular Things stepper board.</p> <p>Yuichi Tamiya's Modular Things stepper board from the 2023 instructor bootcamp in Amsterdam.</p> <p>This is the last board that Andri made in Machine week with the help of our instructors. It worked, so immediately after I got back to \u00cdsafj\u00f6r\u00f0ur I made one of my own:</p> <p>OMG, it's so smooth and quiet!</p> <p>\u00de\u00f3rarinn found me all excited when he came to work. Fig rolls and the trusty Tandy 102 by my side, and a candle lit on my desk to keep my father with me as I work. He would have loved this.</p>"},{"location":"assignments/week09.html#design-file","title":"Design file","text":"<p>Download Stepper H-bridge RP2040 Modular Thing Arduino code</p> <p>Download svavar-stepper.js </p>"},{"location":"assignments/week09.html#spiral-1-3d-design","title":"Spiral 1 3D design","text":"<p>I was so excited to see a motor moving that I immediately started to design 3D printed parts for spiral 1 of my robot arm.</p> <p>I bought two sizes of brushless motors, thinking that I would use a bigger motor in the base. I based the shape of the board on that.</p> <p>A few days after I designed the shape, I decided to change the orientation of the arm from vertical (regular robot arm) to horizontal (SCARA arm). Then there's no strain on the motors when the arm is stationary and I don't need to use the bigger and more expensive brushless motor. I also decided to keep the stepper in the base, not because I wanted to use a stepper but simply because I had a working stepper. Spiral development!</p> <p>This Fusion 360 model is named stepper_festing, which means stepper_bracket. I only meant to design a fixture for the stepper, but it quickly turned into a whole robot arm.</p> <p>Assembling spiral 1 of my robot arm.</p>"},{"location":"assignments/week09.html#robot-base","title":"Robot base","text":"<p>The 3D printed base for spiral 1 of my robot arm. The support material came easily away from the part in one piece. Neat!</p> <p>Here's the Stepper RP2040 Modular Thing that I made for the stepper in the base of the arm. Look closely and you'll see the tiny white TPU washers that I made avoid making contact between the screws and the traces.</p>"},{"location":"assignments/week09.html#spiral-1-assembly","title":"Spiral 1 assembly","text":"<p>Robot arm spiral 1.</p>"},{"location":"assignments/week09.html#design-file_1","title":"Design file","text":"<p>Download robot arm spiral 1 Fusion 360 model</p>"},{"location":"assignments/week09.html#my-pcb-design","title":"My PCB design","text":"<p>I heavily modified Yuichi's board, changing the shape and adding header pins, so that I could use all the Xiao RP2040's pins. I can now connect the brushless motor to the two H-bridges (it needs one and a half H-bridge) and I can connect the encoder to 3.3 V, ground and a digital pin on the Xiao.</p> <p>Trying the Autorouter in KiCAD. I ended up routing everything manually.</p> <p>My robot joint v1 PCB.</p> <p>I also added one header pin to the current sense resistor, hoping that I can read the current going into the motor. That would be very useful, because it's a way to prevent the H-bridges from overheating (I burned a motor driver on a commercial robot arm once and I want to make it impossible on my arm) and I can also use the measured current as a way to measure the force on the joint. Current sensing is not available on any hobby robot that I know of, so if this works, then it will be a great feature! </p> <p>I also added a 7-11V power input for the brushless motor. Yuichi's stepper board uses the 5V USB pin to power the stepper, but my brushless motor needs a higher voltage. I will just be using a lab power supply for now. I will figure out the arm's power supply later. Does it make sense to add a boost converter? I don't know, converting 230V AC into 5V and then converting 5V into 11V sounds a bit messy to me.</p>"},{"location":"assignments/week09.html#design-files","title":"Design files","text":"<p>Download Robot joint v1 KiCAD project</p>"},{"location":"assignments/week09.html#putting-dupont-connectors-on-the-motor","title":"Putting Dupont connectors on the motor","text":"<p>The power connector that came with the motor is too small for the standard 2.54 mm pin headers in the Fab Lab Inventory, so my instructor \u00de\u00f3rarinn showed me how to crimp Dupont connectors onto the wires.</p> Part 1Part 2Part 3Part 4Part 5 <p>Small connector.</p> <p>\u00de\u00f3rarinn's Dupont connector kit.</p> <p>Aligning a female Dupont connector to the wire. The first crimp connection grabs the plastic cover and the second one grabs the bare wire and secures an electrical connection.</p> <p>Crimping the connector onto the wire. More recently I've started to use narrow nose pliers instead. Then I can control exactly how the crimping goes and I don't waste as many Dupont connectors.</p> <p>Triple Dupont connector, ready for service.</p>"},{"location":"assignments/week09.html#pcb-production","title":"PCB production","text":"<p>Under <code>number of offsets</code> (off screen) I typed -1, to have the milling machine clear all the excess copper off the board. I thought this was the safest move, since I'll be putting a BLDC motor with an aluminum chassis onto the board.</p> <p>That's a nice-looking board.</p> <p>The components for arm joint v1, with a general comment on component labeling.</p>"},{"location":"assignments/week09.html#scaling-problem","title":"Scaling problem","text":"<p>The holes for the brushless motor screws were too far apart. How could that be? I exported the arm profile with the holes directly to DXF from Fusion 360, imported them into KiCAD and then exported to SVG without modifications. My instructor \u00de\u00f3rarinn suggested that my DPI settings in Inkscape and Fab Modules might be off. If you check the Fab Modules image, you'll see that the resolution was automatically set to 999.99 dots per inch, instead of 1000.</p>"},{"location":"assignments/week09.html#oh-no-torn-motor-pins","title":"Oh no, torn motor pins!","text":"<p>I tore the motor pins off the board when I was trying to insert the connector. The copper also came off the board.</p> <p>This was a design lesson: you have to put the connectors all the way at the edge of the board! I don't know what I was thinking.</p> <p>This was very frustrating. I had to stop working, cool off and come back the next day. With a level head, I thought that I might actually be able to save this board using the adhesive-backed copper sheet that I use on the vinyl cutter.</p>"},{"location":"assignments/week09.html#the-fix","title":"The fix","text":"Part 1Part 2Part 3Part 4Part 5 <p>First I cut the <code>MOTOR OUTPUT</code> and <code>CURRENT SENSE</code> letters off the board with a box cutter.</p> <p>Then I tried cutting a strip of copper sheet and I successfully glued it onto the board.</p> <p>Copper sheet added for the other three motor phases.</p> <p>Then I carefully soldered the horizontal header pins onto the copper sheet and made a solder bridge from the sheets to the traces on the board.</p> <p>Finally I added some hot glue to add a little bit of strength.</p>"},{"location":"assignments/week09.html#stepper-control-with-my-board","title":"Stepper control with my board","text":"<p>Driving a stepper from the Modular Things web interface using my arm joint control board.</p> <p>When testing my arm joint v1 with a stepper motor, I accidentally ripped the stepper motor pin header off the board and took some of the traces along with it. A current sense header pin also fell off the board. I decied to call it quits with making stuff for the day, went to the Heimabygg\u00f0 coffe house and wrote up my experiences. With fresh eyes (and a fresh espresso) at the lab the next morning, I thought of a way to fix the board. I would cut strips of adhesive-backed copper sheet and glue new traces onto the board. I soldered them to the remains of the old traces on one end and to the header pins on the other end, and after a bit of troubleshooting, the board worked! </p> <p>I've tried 247, 427, 274, 472, 742, 724 - that covers all possible \\(3! = 6\\) combinations.</p> <p>I'm getting PWM output on Xiao pins 0, 2 and 4. </p> <p>Now I know that the right pins are 7, 2 and 4. I get good PWM output for the motor from pins 2 and 4 but I get the strange sawtooth output from pin 7.</p>"},{"location":"assignments/week09.html#design-files_1","title":"Design files","text":"<p>Download Stepper H-bridge RP2040 Arduino code</p> <p>Download Svavar stepper Modular Things JavaScript code</p>"},{"location":"assignments/week09.html#led-pwm-test","title":"LED PWM test","text":"<p>Before trying to move the brushless motor, I checked whether I was getting a sinusoidal PWM on three output pins. I did this by outputting the motor control signals to the RGB LED that is built into the Xiao RP2040 board. I used Adrian's pinout image of the Xiao RP2040 many, many times because it contains the Arduino pin numbers:</p> <p>This image has been a very useful reference. To make the sinusoidal PWM motor control signals go to the RGB LED, I defined pins 17, 16 and 25 as the output pins.</p> <p>Seems to be working!</p>"},{"location":"assignments/week09.html#design-file_2","title":"Design file","text":"<p>Download sinusoidal PWM for RGB LED Arduino code</p>"},{"location":"assignments/week09.html#bldc-control-with-my-board","title":"BLDC control with my board","text":"<p>Here I'm controlling the BLDC with sinusoidal PWM signals:</p> <p>Getting some erratic behavior. This same code worked with the L298N stepper driver. After trying a few different speeds and voltages, I finally got the motor to spin around in circles in the last shot.</p>"},{"location":"assignments/week09.html#design-files_2","title":"Design files","text":"<p>Download sinusoidal L298N brushless control Arduino code</p>"},{"location":"assignments/week09.html#debugging","title":"Debugging","text":"<p>The brushless motor moved erratically no matter what I tried. I wondered if I had soldered the wrong capacitors onto the board. I tried to measure them with a component tester:</p> <p>Trying to measure a capacitor with a component tester.</p> <p>I couldn't get a reading with the component tester. Eventually I decided that I must have put the right capacitors on the board because I was so systematic and methodical in soldering the board.</p> <p>Finally, I tried lowering the power supply voltage to 5V. The motor still worked. Then I switched the motor over to Yuichi's Modular Things stepper driver and found erratic behavior there too. It seems that this Toshiba motor driver just doesn't cut it. I then connected the motor to the ancient L298N double H-bridge and it worked! OK, so the Toshiba H-bridge is out and I need to look for an alternative.</p> <p>Looking at the signals from the H-bridges. The board can control a stepper just fine. When trying to control a brushless motor, one H-bridge is a problem. It's the one that has only one pin connected. It seems that these motor drivers don't have independent half-H-bridges, which is what I need for brushless motor control. I'm going to abandon this board.</p> <p>I also noticed a lot of compliance in the structure. It seems to stem mostly from the stepper coupling that I designed. This is something I can improve in the next spiral. See the arm bending here:</p>"},{"location":"assignments/week09.html#measuring-the-power-of-an-output-device","title":"Measuring the power of an output device","text":"<p>I measured the power use of an OLED screen.</p> <p>First, I measured the voltage over the component. That means that one lead of the multimeter is on the \"hot\" side of the component and the other lead is connected to ground on the other side. The OLED must be powered on for the voltage measurement to work.</p> <p>Measuring the voltage that the OLED screen gets.</p> <p>Then I measured the current that the OLED screen uses. I needed to break the circuit and insert the multimeter into the circuit on the \"hot\" side, in order to measure the current flowing through the OLED. Inside the multimeter is a resistor with very low resistance. The multimeter measures the voltage drop over the resistor and uses that value and the resistance to calculate the current using Ohm's Law.</p> <p> On the left, the potentiometer is turned all the way down, so the bar is black. On the right the pot is turned all the way up, so the bar is white. There is a clear difference in the current reading.</p> <p>Measuring roughly the maximum current that the OLED screen uses. About 90% of the OLED screen is is illuminated here.</p> <p>To calculate the power consumption, I'll use the power formula:</p> \\[ \\mathrm{P} = \\mathrm{V}\\!\\cdot\\!\\mathrm{I}\\] <p>Potentiometer set to 0%:</p> \\[\\mathrm{P_{0\\%}}=\\mathrm{V}\\!\\cdot\\!\\mathrm{I_{0\\%}}=4.6V\\!\\cdot\\!0.004A=\\underline{0.0184W}\\] <p>Potentiometer set to 100%:</p> \\[\\mathrm{P_{100\\%}} = \\mathrm{V}\\!\\cdot\\!\\mathrm{I_{100\\%}} = 4.6V\\!\\cdot\\!0.008A = \\underline{0.0368W}\\] <p>Maximum OLED power consumption:</p> \\[\\mathrm{P_{max}} = \\mathrm{V}\\!\\cdot\\!\\mathrm{I_{max}} = 4.6V\\!\\cdot\\!0.024A = \\underline{0.1104W}\\]"},{"location":"assignments/week10.html","title":"Machine Week","text":""},{"location":"assignments/week10.html#assignment","title":"Assignment","text":""},{"location":"assignments/week10.html#group-assignment","title":"Group assignment","text":"<ul> <li>Design a machine that includes mechanism+actuation+automation+application</li> <li>Build the mechanical parts and operate it manually</li> <li>Actuate and automate your machine</li> <li>Document the group project and your individual contribution</li> </ul> <p>See more info and recording of the lecture here.</p>"},{"location":"assignments/week10.html#presentation","title":"Presentation","text":"<p>The Icelandic Machine Week team: Svavar, Andri and Hafey.</p> <p>Machine Week was fantastic. Check out our project page here:     <p> MACHINE WEEK PAGE </p></p> <p>For an intense three-day weekend, Andri S\u00e6mundsson, Hafey Viktor\u00eda Hallgr\u00edmsd\u00f3ttir and myself joined forces in Fab Lab Reykjav\u00edk to build a machine. Here's our presentation video:</p> <p>The build process and function of the TeaManator tea steeping machine.</p> <p>But it's better to watch the video with commentary from Hafey:</p> <p>Hafey presenting the TeaManator tea machine to Neil Gershenfeld and the Fab Academy class 2023. Neil liked how the machine is nicely finished and presented. Link to video.</p> <p>The clean aesthetics of the machine are thanks to Hafey, who designed and made the structure on the Shopbot and the laser cutter. She also made the logo on the vinyl cutter, which means that we used all the machines in the Fab Lab!</p>"},{"location":"assignments/week10.html#travel-arrangements","title":"Travel arrangements","text":"<p>Our instructors, \u00c1rni Bj\u00f6rnsson and \u00de\u00f3rarinn Bjartur Brei\u00f0fj\u00f6r\u00f0 Gunnarsson came to support us during this intense session of work. \u00de\u00f3rarinn and I flew in from \u00cdsafj\u00f6r\u00f0ur and \u00c1rni flew in from Akureyri. </p> <p>Landing in \u00cdsafj\u00f6r\u00f0ur is more exhilarating than many people would like.</p> <p>\u00cdsafj\u00f6r\u00f0ur is one of the most difficult airports in Iceland. When the plane comes in, it needs to take a sharp U-turn at the bottom of the fjord before landing on the tarmac. People are often quite shocked, and I heard that two of the designers of the Dutch Fokker aircraft that used to fly this route came along for the ride once and commented that the aircraft was not designed for this kind of thing. If there's even a little bit of side wind toward the mountain, the flight is cancelled. Fortunately, the weather gods smiled upon us this time. </p>"},{"location":"assignments/week10.html#fab-lab-reykjavik","title":"Fab Lab Reykjav\u00edk","text":"<p>On arriving in Fab Lab Reykjav\u00edk, I discovered that I was one of the orphaned 3D scans on display in the lobby. No long hair or beard back then.</p> <p>I made this with a Kinect 3D scanner many years ago with the help of Linda and Bas Withagen, soon after Fab Lab Reykjav\u00edk first opened. Then the Fab Lab was in Eddufell, in a small commercial center. I spent a lot of time there right after it opened. Good times.</p> <p>I wanted to take many more pictures inside Fab Lab Reykjav\u00edk, because they have designed and fabricated all sorts of clever solutions that I would like to replicate in Fab Lab \u00cdsafj\u00f6r\u00f0ur. But there was no time!</p>"},{"location":"assignments/week10.html#teamwork","title":"Teamwork","text":"<p>We were all super productive the whole time. We worked from nine in the mornings to about ten in the evenings, and we made the machine work just in time to go back home. I'm really happy with my teammates and our instructors.</p> <p>\u00c1rni, Svavar, Hafey, Andri and \u00de\u00f3rarinn.</p>"},{"location":"assignments/week10.html#the-concept","title":"The concept","text":"<p>Why is the machine called TeaManator? Because my instructor \u00de\u00f3rarinn thought we should use something distinctive as an end stop:</p> <p>He added the tongue in Blender.</p> <p>Andri made some concept art for our machine using a Generative Pre-trained Transformer:</p> <p>Andri used GPT-enabled Bing to generate the images.</p>"},{"location":"assignments/week10.html#spiral-1","title":"Spiral 1","text":"<p>My job was to make the motors work. The first spiral was to control a stepper motor using an Arduino Uno and an L298N double H-bridge motor controller. I also added a servo to the Arduino Uno. The ATMega328 chip on the Uno is a bit old and outdated, but the Arduino Uno is still the best documented and supported microcontroller board in the world. So it's a good place to get something basic working.</p> <p>Machine control spiral 1: An L298N stepper driver module on a breadboard with a SparkFun RedBoard, which is essentially the same thing as an Arduino Uno.</p>"},{"location":"assignments/week10.html#spiral-2","title":"Spiral 2","text":"<p>The second spiral was to make a custom board with a Xiao RP2040 microcontroller module, a DRV8825 StepStick motor controller, 12V input pins from a lab power supply and GPIO breakout pins for a servo and two buttons. In Machine Week I made my biggest leap forward in electronics design. I also developed my methodical method of breadboarding and testing the hardware and software, one element at a time, before transferring the design over to KiCAD.</p> <p>Machine control spiral 2 on a breadboard: A DRV8825 StepStick stepper driver module. I first connected it to the SparkFun RedBoard but when I had that working I switched to the Xiao RP2040 module.</p>"},{"location":"assignments/week10.html#pcb-milling","title":"PCB milling","text":"<p>The custom board that I made is an extension of spiral 2. The first board had mounting holes that were far too big and the board also came loose during milling. </p> <p>Bad board and good board. I input a radius for the mounting holes when I thought I was defining their diameter. So the holes are huge on the board on the left! And I didn't use enough double-sided tape to secure the PCB blank, so it shifted during the trace milling operation.</p> <p>After a redesign, the second attempt to mill the board went well. The board on the right is the final version of the TeaManator controller board. I forgot the drilling holes for the electrolytic bulk storage capacitor for the stepper driver, so I drilled those holes afterwards.</p> <p>Hand drilling the last two holes in the board.</p> <p>I only had through-hole female headers, so I bent their legs in order to be able to surface mount them.</p> <p>Bending the legs for surface mounting.</p> <p>The final TeaManator machine controller, with a Xiao RP2040. I learned a lesson in considering which side through-hole components need to be on in order to touch the copper traces.</p> <p>Close-up of the machine controller, all connected up.</p> <p>The TeaManator 2000 tea steeping machine. Clean and elegant.</p> <p>The reality behind the facade. The USB hub (with AC adapter) and the big power supply are only there to supply 5V to the Xiao and 12V to the stepper driver, because we didn't have time to learn how to make a power supply. I realized then that I need to think seriously about a neat way to power my final project.</p>"},{"location":"assignments/week10.html#design-files","title":"Design files","text":"<p>Here are the KiCAD, SVG and PNG files for the TeaManator machine control board. I'm also including all the incremental test code. Other design files are at the bottom of our group project page.</p> <p>Download TeaManator KiCAD</p> <p>Download tea_machine.ino (final code)</p> <p>Download machine_week_nema17_l298n_test.ino</p> <p>Download machine_week_nema17_l298n_servo_test.ino</p> <p>Download machine_week_nema17_and_servo.ino</p> <p>Download machine_week_xiao_servo.ino</p> <p>Download machine_week_nema17_drv8825_test.ino</p> <p>Download machine_week_nema17_drv8825_test-svavars_board.ino</p> <p>Download machine_week_nema17_and_servo-svavars_board.ino</p> <p>Download machine_week_button_test.ino</p>"},{"location":"assignments/week10.html#spiral-3","title":"Spiral 3","text":"<p>The first Stepper Modular Thing that Andri made. He had to do considerable editing to make the circuit fabricatable.</p> <p>After 3D printing all the parts for the linear motion axis, Andri worked tirelessly on the third spiral, which was to make a Modular Things stepper controller board. We were really excited about this solution, but this design really thin traces and two layers, making it difficult to make. Andri made lots of modifications to the design in Fusion 360 in order to make the traces thicker and reroute everything so that it fit on one layer. He successfully milled the board and soldered all the components to it, but it didn't work. Unfortunately, the motor drivers in the original design need a higher voltage than 5V to work. The designer, Quentin Bols\u00e9e was very responsive to our questions.</p> <p>Then our instructors \u00c1rni and \u00de\u00f3rarinn, recalled that Yuichi Tamiya at Fab Lab Kannai made a working version of the Modular Things stepper control board at the 2023 instructor bootcamp in Amsterdam.</p> <p>Andri proceeded to make the board and \u00c1rni soldered the components onto it. It worked on the first try!</p> <p>The second Stepper Modular Thing that Andri made. Wow! It's powered by the USB port!</p> <p>We didn't have time to integrate it into our machine, but I'm very glad that Andri and our instructors were able to make a working Modular Thing. Seeing the Stepper Modular Thing working and being able to make the machine control board successfully combined to give me the confidence to try to make a robot arm joint immediately when I arrived back in \u00cdsafj\u00f6r\u00f0ur. See more info in Output Devices week.</p>"},{"location":"assignments/week10.html#our-instructors","title":"Our instructors","text":"<p>We are lucky to have these instructors. Here are some images to prove it:</p> <p>Left: \u00de\u00f3rarinn explaining some electronics to Hafey. Right: Andri showing \u00c1rni the teabag holder that he made from bent acrylic.</p> <p>Attention: Coffee for Svavar! Our instructors took good care of us during this intense work session.</p> <p>My instructor \u00de\u00f3rarinn also disassembled a stepper motor and showed us how it works:</p> <p>Left: The stepper rotor, with its many iron teeth visible. Right: The step signal that turns the rotor (two of the phases are connected to the oscilloscope).</p>"},{"location":"assignments/week11.html","title":"Input Devices","text":""},{"location":"assignments/week11.html#assignment","title":"Assignment","text":""},{"location":"assignments/week11.html#individual-assignment","title":"Individual assignment","text":"<ul> <li>Measure something: add a sensor to a microcontroller board that you have designed and read it</li> </ul>"},{"location":"assignments/week11.html#group-assignment","title":"Group assignment","text":"<ul> <li>Probe an input device's analog levels and digital signals</li> </ul> <p>See more info and recording of the lecture here.</p>"},{"location":"assignments/week11.html#ir-sensor-board","title":"IR sensor board","text":"<p>I used the IR phototransistor from the fab library twice, to represent both the IR emitter and the phototransistor. For this board I'm using obsolete parts from the 2012 Fab Lab inventory that still work really well; the OP280KT IR emitter and the matched OP580 phototransistor. They are have a more square shape than their modern counterparts, but I checked the datasheets and their footprints are close enough to what I have in the KiCAD library now.</p> <p>My Xiao IR sensor schematic.</p> <p>I looked at the phototransistor board on the Xiao page of the Fab Academy web site of Adrian Torres. It has a 1kOhm resistor on the IR emitter diode and a 10kOhm resistor on the IR sensor. I did the same here.</p> <p>My Xiao PCB design for the IR emitter and sensor.</p> <p>Instead of soldering the Xiao onto the board I'm using pin sockets. The milling went well using Fab Modules and the Roland Modela MDX-20, but the edges of the traces are a little bit rough. That's a sign of wear on the 1/64 inch bit.</p> <p>Milling the traces of the IR sensor board.</p> <p>Then I milled the board outline with the 1/32 inch bit. </p> <p>Milling the outline of the IR sensor board.</p> <p>Here's how the board looks:</p> <p>The IR sensor board.</p> <p>With the Xiao SAMD21 on board.</p> <p>Here's a video of the sensor readings, it works really well:</p>"},{"location":"assignments/week11.html#measuring-the-analog-signal","title":"Measuring the analog signal","text":"<p>I connected the signal from the IR sensor to the oscilloscope and got a reading that changed with the light hitting the sensor:</p>"},{"location":"assignments/week11.html#design-files","title":"Design files","text":"<p>I used code from Adrian Torres to get readings in the serial plotter, but I changed the number of the analog read pin to A10.</p> <p>Here's my KiCAD project:</p> <p>Download Xiao IR sensor board</p> <p>And the PCB milling files for Fab Modules or Mods:</p> <p>The traces. The interior (for milling the board outline).</p> <p>And the Arduino code:</p> <p>Download IR sensor Arduino code</p>"},{"location":"assignments/week11.html#magnetic-encoder","title":"Magnetic encoder","text":"<p>The board that I made for output devices has three pins that are intended for encoder input. I connected the encoder and wrote a simple test program in the Arduino IDE. The AS5048 encoder has a three-pin PWM output and a five-pin SPI output. I used the simpler PWM output. It was easier to route the board for those connections. In this case, I use the pulseIn Arduino command to read the length of the pulses coming into the pin from the encoder. Then I print the value to the serial monitor. Here's the whole program:</p> <pre><code>const int encoder = 3; // AMS AS5048 encoder \nint pos=0; //mechanical position of shaft\n\nvoid setup() {\n  Serial.begin(9600);\n  pinMode(encoder, INPUT);\n}\n\nvoid loop() {\n  pos=pulseIn(encoder,HIGH);//read encoder pulse\n  Serial.print(pos);\n  Serial.print('\\n');\n  delay(10);\n}\n</code></pre> <p>And here's a video of it running:</p> <p>Then I connected the current sensing resistor of each H-bridge to a pin on the Xiao RP2040. Using analogRead, I was able to measure the current going through the motor! There is one value for each H-bridge, and the values are similar. The values fluctuate, so they depend on when the measurement is made.</p> <p>It seems to work!</p>"},{"location":"assignments/week11.html#measuring-the-digital-signal-from-the-encoder","title":"Measuring the digital signal from the encoder","text":"<p>I measured the SPI signals coming out of the AS5048 magnetic encoder. The first thing to measure is the clock signal. This is what synchronizes the SPI communication.</p> <p>The clock signal from the A5048 magnetic angle sensor was weak.</p> <p>I thought that maybe the magnetic encoder chip wasn't supposed to generate a clock signal. In SPI communication, there's only one main IC, and it generates the clock signal. So I connected the encoder up to a SAMD21 chip (and also connected the motor driver).</p> <p>With the microcontroller connected, the clock signal is strong. But its shape is surprising. I thought it would just be a regular square wave with no gaps.</p> <p>Next up is the chip select pin. The chip select pin is used to select between secondary SPI nodes, if more than one are connected to the same main microcontroller. This is how the chip select signal looks:</p> <p>The chip select signal in blue, overlaid onto the clock signal in yellow.</p> <p>Then there's the data, MOSI and MISO.</p> <p>The MOSI signal. I tried rotating the motor while it was on the screen. I didn't see any significant changes. But the angle still appeared in the serial monitor.</p> <p>The MISO signal. Some disturbances happened when I turned the motor, but I couldn't see how the signal was coming across the wire.</p>"},{"location":"assignments/week11.html#design-file","title":"Design file","text":"<p>Download encoder test Arduino file</p>"},{"location":"assignments/week12.html","title":"Molding and Casting","text":""},{"location":"assignments/week12.html#assignment","title":"Assignment","text":""},{"location":"assignments/week12.html#group-assignment","title":"Group assignment","text":"<ul> <li>Review the safety data sheets for each of your molding and casting materials,</li> <li>then make and compare test casts with each of them</li> <li>Extra credit: try other molding and casting processes</li> </ul>"},{"location":"assignments/week12.html#individual-assignment","title":"Individual assignment","text":"<ul> <li>Design a mold around the stock and tooling that you'll be using,</li> <li>mill it (rough cut + three-axis finish cut),</li> <li>and use it to cast parts</li> <li>Extra credit: use more than two mold parts</li> </ul> <p>See more info and recording of the lecture here.</p>"},{"location":"assignments/week12.html#the-guerilla-guide-to-cnc-and-resing-casting","title":"The Guerilla guide to CNC and resing casting","text":"<p>I came across the Guerrilla guide to CNC and resin casting by Michal Zalewski some months ago and was fascinated by the depth of technical information and practical skills displayed in the guide and in his Omnibot Mk II build. Look at that tiny DIY planetary gearbox! His adventures in CNC and robotics are inspiring. And others have used his methods successfully; just look at this hybrid walker robot (video).So I took his recommendations and tried to order the main materials that he uses for his resin casting projects: Medium density modeling board, Quantum Silicones Q262 molding silicone and Innovative Polymers IE-3075 polyurethane for casting parts with excellent material properties. The problem was that no one wanted to sell them to me:</p> <p>This seemed like a dead end.</p> <p>Then I remembered a service I had used once before to order something obscure from a US based company that didn't ship to Iceland: ShopUSA. You can have things shipped to their warehouse in Virginia, and they forward your package to any country in the world. They shipped my polyurethane resin by air, which was convenient, but the silicone that I needed to make molds went by sea, because that package was above a weight limit. I also found someone on eBay who was selling relatively small pieces of medium density modeling board for milling. This is the stuff that's in all the ads from Roland, it's dimensionally stable, easy to machine and leaves a nice surface finish, not unlike a metal mold that has been glass bead blasted:</p> <p>I like this stuff. It's like machinable wax, but with a filler, so you get a uniform, slightly textured finish. It takes well to sanding.</p>"},{"location":"assignments/week12.html#mold-pattern-1-modeling-and-toolpath-generation","title":"Mold pattern 1 modeling and toolpath generation","text":"<p>I decided to make a button for the Frankenstein MCU that my instructor \u00de\u00f3rarinn is working on with Francisco Sanchez Arroyo. You push the button and your Fab Lab goes online. You can see the Fab Labs appear on the spinning globe, with connections forming between all the labs.</p> <p>It's a simple design, mainly meant to test the 3D spiral toolpath in Fusion 360 and the surface finish that is achievable with the modeling board. First I embossed the text and tried a parallel 3D toolpath in Fusion 360:</p> <p>I couldn't get the detail I wanted with this approach.</p> <p>Next, I used a single line font for the text and used the Project command to mill it into the curved surface of the button with a 3D strategy:</p> <p>The single line font, coupled with the Project milling strategy, worked really well .</p>"},{"location":"assignments/week12.html#milling-mold-pattern-1","title":"Milling mold pattern 1","text":"<p>I used a simple fixturing method that my instructor \u00de\u00f3rarinn showed me.</p> <p>I used the zeroing plate on the Shopbot.</p> <p>The milling chips look really nice when running adaptive clearing.</p> <p>Roughing pass being completed.</p> <p>Finishing pass looking good.</p>"},{"location":"assignments/week12.html#molding-mold-pattern-1","title":"Molding mold pattern 1","text":"<p>Since my silicone hadn't arrived, I got the help of my father-in-law, who is a recently retired dentist. He uses Impregum Penta from 3M to take impressions of teeth. It comes with a handy machine which mixes the two parts in the right proportions and dispenses the silicone.</p> <p>Still knows all the moves.</p> <p>This dental silicone is really viscous, so it's hard to prevent bubbles from being trapped in it when dispensing into the mold. Also, I didn't add draft angles to the geometry, so it was hard to get the silicone out, and I damaged the mold pattern:</p> <p>I thought the mold was shallow enough to not need a draft angle, but it really does need it.</p>"},{"location":"assignments/week12.html#mold-pattern-2","title":"Mold pattern 2","text":"<p>Comparison between the profile sketches of the first and second mold pattern.</p> <p>Section analysis of first and second mold pattern.</p> <p>The second mold pattern toolpath. On the left are the feeds and speeds for the text engraving.</p> <p>My father-in-law put some Vaseline on the edge of the second mold pattern. That worked well. With the addition of the draft angles, it was much easier to get the silicone mold out of the modeling board. I used a syringe to put the silicone in this second mold pattern, so that I could get into all the little engraved letters. That strategy worked, but I still got bubbles in the silicone.</p> <p>A bit of Vaseline as mold release.</p> <p>This is the only picture I have of the syringe, because I needed both hands to apply the silicone.</p> <p>The second mold came out well, except for a few bubbles. With the help of my father-in-law, I made another mold from this pattern, but it turned out the same.</p>"},{"location":"assignments/week12.html#the-right-silicone-arrives","title":"The right silicone arrives","text":"<p>Then my silicone arrived from Hobby Silicone! I also got a vacuum pot that my friend P\u00e1ll Einarsson made. That's a great thing to have when molding and casting! But I was disappointed when I plugged it in. I got no vacuum at all. If anything, the needle on the meter went up. I tried pressing down on the lid to seal it, but no luck. Then I felt air blowing out from under the lid. Aha! </p> <p>DIY vacuum pot.</p> <p>When Sigur\u00f0ur, the electrical teacher at the school came to the lab I got him to take a look at the three-phase plug with me. He showed me how to open it and he suggested that I try swapping the brown and black wires. That worked! The vacuum pump now blows in the right direction and I can degas the silicone and polyurethane. I ordered QM-262, which is quite stiff with Shore 60A hardness, and also Soft 107, which only has a 7A Shore hardness. I tried the softer one. </p> <p>One part blue catalyst to ten parts silicone.</p> <p>Mixing the silicone and scraping the sides of the cup until the color is uniform with no streaks.</p> <p>I mixed one part catalyst (5g) with ten parts silicone (50g) as per the manufacturer's instructions, and tried to shear it (Stir only laterally, not up and down, so as not to get bubbles in the mix). When the color was even I put the mix into the vacuum pot and let it sit for five minutes. A lot of bubbles surfaced and popped. I then let air back in and put the vacuum back on twice for two minutes. </p> <p>Then I poured the light blue mixed silicone into the mold pattern (after spraying it with Ultralease from Hobby Silicone). I  poured in a thin stream into the same place the whole time, really slowly. </p> <p>Then I put it into the vacuum pot. A surprising number of bubbles came up. After a whole work day, I checked on the remains of the mixed silicone in the cup. It was still flowing freely. That was discouraging. My wife A\u00f0albj\u00f6rg worked for OK Prosthetics making prosthetic legs and silicone liners and she said that they heated up the aluminum molds to accelerate the curing process. Any remains took days to cure. They used to put the silicone mixing nozzles into an oven to be able to get the remains out and use the nozzle again quickly. She said that it depends on the chemistry and especially the catalyst, but she said that my silicone might still cure.</p> <p>Degassing the mold after pouring.</p> <p>After a week of waiting and then going to the Fab Lab Bootcamp in Neskaupsta\u00f0ur for another week, I came back and removed the mold from the master pattern.</p> <p>This silicone mold is very flexible.</p> <p>I'm very happy with the results. There are absolutely no bubbles in the mold and the text was captured perfectly. But I may need to contact the silicone manufacturer, because the datasheet says that it should cure in 24 hours.</p> <p>That's a nice-looking mold with no bubbles.</p>"},{"location":"assignments/week12.html#design-file","title":"Design file","text":"<p>Download FMCU button Fusion 360 model</p>"},{"location":"assignments/week12.html#trying-to-mix-polyurethane","title":"Trying to mix polyurethane","text":"<p>I made an attempt to mix the IE-3075 polyurethane to cast it in the silicone mold. The bottles said that I should agitate them before mixing, because they may have settled in storage. I probably shook them way too hard, because when I put the 1:1 by volume mixture into the vacuum pot, it foamed and immediately started to set. I made a rigid foam. Those can be useful as core materials in composites, but that's not what I intended to make.</p> <p></p>"},{"location":"assignments/week12.html#casting-wax-in-the-mold","title":"Casting wax in the mold","text":"<p>Just to cast something in the mold, I tried candle wax. So I took the mold home and heated up an old candle. </p> <p>Heating the candle wax over a water bath.</p> <p>When all the wax had turned liquid and transparent, I poured it carefully into the mold.</p> <p>I may have heated the wax too quickly. As it gets hotter, the wax continues to expand according to its coefficient of thermal expansion. Then I poured it into the mold and it starts to cool down and contract. The greater the difference between these two temperatures, the worse the warping and wrinkles get.</p> <p>Thermal contraction during cooling results in wrinkles on the surface.</p> <p>Then I removed the cast wax part from the silicone mold.</p> <p>A small hand immediately grabbed the cast wax part after I removed it from the mold.</p> <p>The resulting part is not nearly as smooth as the mold is. Apparently the thermal contractions were so bad that this side got wrinkled too.</p> <p>The surface is all wrinkled after thermal contraction. But the text came out well.</p> <p>My little helper played around with the mold for a second. This resulted in the mold being bent all the way backwards and developing cracks. He wasn't trying to damage it, he was just being very four years old. This is a lesson for me, the mold was too thin in the middle. I was trying to save material and I thought I could get away with it. </p> <p>\"There is a crack in everything. That's how the light gets in,\" sang Leonard Cohen.</p>"},{"location":"assignments/week12.html#trying-polyurethane-again","title":"Trying polyurethane again","text":"<p>This time I poured the isocyanate and polyol into separate plastic cups in the right proportions. I put them both into the vacuum pot and pulled a vacuum. No bubbles surfaced, so I took the silicone mold, grabbed a piece leftover acrylic to put under it, and placed it inside the vacuum pot. I then mixed the polyurethane parts together, stirring carefully with a thin acrylic stick. </p> <p>I poured the cloudy mixture into the mold in a thick stream, closed the chamber and pulled a vacuum. Lots of bubbles surfaced, but they didn't pop. Is the liquid to viscous? Is the vacuum pump not powerful enough? I let the air back in to see if the bubbles would pop. They shrank, but became bigger I pulled the vacuum again.</p> <p>The button came out of the mold without any trouble. I just had to make sure not to rip the silicone text when removing the resin part.</p> <p>The part is full of bubbles! Darn it.</p> <p>The FMCU text is very faintly visible. I would need to fill the letters with paint to make them stand out. I'm going to claim stone cold that that was the plan all along.</p> <p>My instructor \u00de\u00f3rarinn mentioned that there is a pressure pot in the Chemistry lab in the school. Maybe that will work better. Instead of drawing a vacuum, which enlarges the trapped bubbles and encourages them to rise to the surface, I will make the bubbles collapse until I can't see them anymore. When I have some spare time. This will have to do for now.</p>"},{"location":"assignments/week12.html#safety-data-sheets","title":"Safety Data Sheets","text":"<p>The silicones and the polyurethane that I ordered came with Safety Data Sheets. </p>"},{"location":"assignments/week12.html#soft-107-silicone","title":"Soft 107 Silicone","text":"<p>Soft 107 is a very soft and flexible two-component, room temperature condensation cure silicone. It has a durometer of 6. I guess they named it before they got the results back from the official durometer test. The condensation cure (or tin curing) means that this silicone probably shrinks a bit when curing. But the great thing about this material is that it's food safe (indirect contact). Because it's so soft, it's also ideal to make pads for pad printing. I've wanted to try pad printing for years, now I have what I need to do it. The silicone is mixed with a blue catalyst in a 10:1 silicone to catalyst ratio by weight. It's recommended to mix the silicone in a clean plastic container with a volume 3-4 times the volume of the silicone being mixed. Then there's space for it to expand when you put it in a vacuum pot to draw out the bubbles. If you don't have access to a vacuum chamber, they recommend a high pour: You pour into the bottom corner of the mold the whole time, keeping the mixing cup high enough above it to form a thin, steady stream of silicone. The bubbles will be pushed out before entering the thin stream and then the silcone mass slowly levels itself in the mold. This is what I did, and I also used a vacuum pot.</p> <p>The Soft 107 silicone may be harmful in contact with skin. Always use disposable gloves when handling it. Ensure good ventilation while working with it. Make sure that it doesn't leak into the environment. You must make sure that it cures before disposing of any remains. It's good to have a shower, an eyewash station and a ventilation system. It would be good for the Fab Lab to get an eyewash station. Rinse with plenty of water if you get the uncured material on your skin, in your eyes or into your mouth.</p>"},{"location":"assignments/week12.html#quantum-silicones-qm-262-silicone","title":"Quantum Silicones QM 262 Silicone","text":"<p>QM 262 is a two-component, room temperature addition cure (platinum cure) silicon material. The platinum cure means that there is essentially no shrinkage while curing. This silicone has excellent mechanical properties and is Michal Zalewski's favorite silicone for precision mold making. It has a high durometer of 60 Shore A. You mix it 10:1 silicone to blue catalyst by weight. The mixing instructions are the same as for the Soft 107 silicone material.</p> <p>The safety instructions are also the same as for the Soft 107 silicone.</p>"},{"location":"assignments/week12.html#innovative-polymers-ie-3075-polyurethane","title":"Innovative Polymers IE-3075 polyurethane","text":"<p>This very strong polyurethane is mixed 1:1 by volume from an isocyanate and a polyol:</p>"},{"location":"assignments/week12.html#raku-tool-ie-3075-isocyanate","title":"RAKU TOOL IE-3075 Isocyanate","text":"<p>Rinse with plenty of water and call a poison center if you get the uncured material on yourself. It may cause respiratory irritation and damage to organs through prolonged or repeated exposure. The material is suspected of causing cancer. Use protective glasses, glove, clothing and in case of inadequate ventilation, wear respiratory protection. Heating may cause an explosion.</p> <p>Make sure to completely cure the material before discarding the container.</p>"},{"location":"assignments/week12.html#raku-tool-ie-3075-polyol","title":"RAKU TOOL IE-3075 Polyol","text":"<p>The safety procedures are very similar to the isocyanate, except the polyol is less flammable. There is much less information in its Safety Data Sheet.</p>"},{"location":"assignments/week12.html#ultralease-ure-gp-urethane-parfilm-mold-release","title":"Ultralease URE GP Urethane Parfilm Mold Release","text":"<p>Ultralease URE GP is a solvent-less and virtually odorless mold release. It's heat stable to 315\u00b0C, so it should also be good for injection molding. It doesn't interfere with painting, coating or bonding. It should last for several molding cycles. It's recommended for use with polyurethanes, silicones and rubbers. </p> <p>Wear eye protection, long sleeves, chemical resistant gloves and an organic vapor respirator. Also ensure proper ventilation. The can may explode if heated and the contents may displace oxygen and cause rapid suffocation. Keep away from heat, sparks, flames and hot surfaces. Do not pierce or burn the pressurized container, even after use. And definitely don't spray it onto an open flame. Rinse with plenty of water if you get it on yourself. And because it's in an aerosol can, contact with the rapidly expanding gas may cause burns or frostbite, as the gas removes heat from your skin to fuel its expansion.</p>"},{"location":"assignments/week13.html","title":"Networking and Communications","text":""},{"location":"assignments/week13.html#assignment","title":"Assignment","text":""},{"location":"assignments/week13.html#individual-assignment","title":"Individual assignment","text":"<ul> <li>Design, build, and connect wired or wireless node(s)</li> <li>with network or bus addresses and a local interface</li> </ul>"},{"location":"assignments/week13.html#group-assignment","title":"Group assignment","text":"<ul> <li>Send a message between two projects</li> </ul> <p>See more info and recording of the lecture here.</p>"},{"location":"assignments/week13.html#hello-i2c","title":"Hello I2C","text":"<p>I did this week's work in Neskaupsta\u00f0ur, which is as far as you can get from \u00cdsafj\u00f6r\u00f0ur in Iceland. I had to take two flights to get there! The annual Icelandic Fab Lab Bootcamp was held in Neskaupsta\u00f0ur this year. I think everybody got lots out of it and this was the first time that we set up a repo and a web site for an Icelandic bootcamp. We're under the influence of the 2023 Instructor's Bootcamp in Amsterdam.</p> <p>This is what I packed for the trip (plus a few items of clothing and a toothbrush):</p> <p>I brought a large part of our electronics inventory, just in case.</p> <p>I decided to do as Hafey did, and make Adri\u00e1n Torres's Hello I2C boards. The project consists of a master module which sends an I2C message and two nodes that receive the message and turn on an LED.</p> <p>I read up on how I2C works. SparkFun's article on I2C is really good.</p> <p>I milled Adrian's boards and populated them with components. Hafey brought ATtiny412 ICs for me from Fab Lab Reykjav\u00edk.</p> <p>I2C node with adapter.</p> <p>For my own board I decided to use a laser diode. I had wanted to try one of those since I saw \u00c1rni Bj\u00f6rnsson's output devices video.</p> <p>My laser diode, powered directly by the lab power supply. I noticed that it has an SMD resistor soldered onto it, so I don't need to worry about limiting the current.</p> <p>My I2C laser diode PCB design.</p> <p>I tried the Gerber output for the first time.</p> <p>I tried FlatCAM, which went well, but the toolpath left thin strips of copper in between the traces. I would need to adjust the settings before milling again. It also didn't mill the text on the board, but I didn't really care about that.</p> <p>My laser diode I2C board after milling. In this milling machine, the FR1 PCB blanks are fastened to the wasteboard with double-sided tape.</p> <p>Here's my I2C laser board populated and connected to the adapter.</p> <p>Before programming the board, I had to install the megaTinyCore, which enables the Arduino IDE to program the ATtiny412.</p> <p>I went into Tools -&gt; Board -&gt; Boards Manager and searched for megatinycore and installed it.</p> <p>Then I went into Tools -&gt; Board and selected the ATtiny412:</p> <p></p> <p>Hafey pointed out to me that Adrian's Arduino code had an error. The master node was set up to send a message to one node, and then another. But the number of the node was the same in both cases: the command <code>Wire.write(1)</code> was in both places. After changing the second one to <code>Wire.write(2)</code>, the code worked. </p> <p>Hafey also showed me that instead of using the Upload arrow, now I needed to go into Sketch -&gt; Upload Using Programmer.</p> <p>First select Tools -&gt; Programmer -&gt; SerialUPDI - 230400 baud.</p> <p>Then select Sketch -&gt; Upload Using Programmer.</p> <p>Upload Using Programmer didn't work. Hafey suggested that I just try again. Then it worked.</p>"},{"location":"assignments/week13.html#debugging","title":"Debugging","text":"<p>However, the LED didn't turn on. I don't know why. I noticed that one of the legs of the female header that the laser diode was plugged into had come loose off the board. I tried pushing on it to reestablish the electrical contact, but ended up breaking the female header completely off the board. My instructor \u00de\u00f3rarinn suggested that I try connecting the laser diode to the 5V power rail on the board and GND, just to see if the board can supply it with enough power.</p> <p>USB power is OK on Adri\u00e1n's I2C Master board. I also tried this on my board and it worked too.</p> <p>Then I connected Adri\u00e1n's board to mine over I2C and plugged his board into a USB port to power it. I connected a multimeter to the broken leads for the laser diode and watched for a while. There was no voltage. Nothing was happening on the pin. This must be a software issue.</p> <p>Just a quick check whether the microcontroller is gettning 5V. Good.</p> <p>Just to see if the laser diode pin worked, I uploaded the Arduino Blink example to my board and connected the laser diode. It worked! Then I uploaded the node 1 I2C Arduino sketch onto my board, which is exactly the same code as the one that runs successfully on Adri\u00e1n's board. Nothing. OK, better check the I2C connections on the board. The message may not be getting all the way to my microcontroller.</p> <p>Aha! There's no continuity between the I2C pin header and the SCL pin on the microcontroller. My instructor \u00de\u00f3rarinn suggests only using continuity checking as a last resort, so we brought out the oscilloscope.</p> <p>We measured a short SDA signal every second at 100 kHz.</p> <p>With voltage measurements along the trace we found that it was broken near the microcontroller.</p> <p>I put some solder onto the trace to bridge the gap, connected the boards together and - nothing. Oh, I still had the Blink program on my board! I reuploaded the I2C node code and - nothing. Hm.</p> <p>Dead bugs. One thing that I ran into was that when I was measuring with the multimeter, I accidentally shorted between two tracks and the ATtiny412 became unresponsive. This happened on Adri\u00e1n's board and my own. I've become quite adept at swapping out ICs with the heat gun. Gotta be more careful with these delicate parts. Lesson learned.</p> <p>After swapping out the unresponsive ATtiny412 for a new one, my board finally worked! I soldered the female header back onto the board and here it is in all its glory:</p>"},{"location":"assignments/week13.html#success","title":"Success!","text":"<p>If you listen carefully, you can hear a giant cruise liner signaling its departure from \u00cdsafj\u00f6r\u00f0ur at the beginning of the video. We had two and three of them visit the town per day this summer, each carrying more passengers than the population of our town.</p>"},{"location":"assignments/week13.html#design-files","title":"Design files","text":"<p>Download I2C laser KiCAD project</p> <p>Download I2C master code</p> <p>Download I2C node 1 code</p> <p>Download I2C node2 code</p>"},{"location":"assignments/week13.html#fab-modules","title":"Fab Modules","text":"<p>When discussing Fab Modules/Mods/Mods Project at the Fab Lab Bootcamp in Neskaupsta\u00f0ur, few of our colleagues thought it was a little bit strange to turn vector drawings into bitmaps before running them through the CAM software. But Frosti told me that Neil had mentioned at some point that CNC machines operate on a bitmap grid in the end. That's a good point. We're using Computer Numerical Control, not Computer Vector Control. The G-codes are all encoded as Cartesian coordinates with finite precision. So if you use a high enough resolution in the PNG image, you shouldn't lose any accuracy. The workflow works well, and I like using the old Fab Modules that we have running locally on a Linux laptop.</p> <p>Late in the evening I wanted to make the UPDI adapter that I needed to connect my Hello I2C boards to the computer. Frosti took the opportunity to open up Mods Project. After tweaking a few settings and figuring out that we needed to turn on the Save module and then click Calculate again to get an RML export, the milling went great! We just needed to set the file type to RML1 in the Roland control software, instead of RML NC code.</p>"},{"location":"assignments/week13.html#microsd-breakout-board","title":"microSD breakout board","text":"<p>This video might be useful. It shows how to solder wires directly to an SD card to communicate with it. So the passive components on commercial SD breakout modules aren't strictly necessary, although I'm sure they make the communications more reliable.</p> <p>The PCB layout of my microSD card breakout board on the left and Janet Liu's schematic on the right. Her schematic shows which SD card pin matches which SPI pin on this particular SD card holder from Amphenol. You need to open the image in a new tab to see the pin names on my PCB layout.</p> <p>I didn't consider which way you put the SD card into the slot, so now that I've soldered the headers onto the board, the microSD card is stuck there for all eternity. I hope I can at least communicate with it.</p> <p>I tried going through this clear tutorial by Shawn Hymel. But since he published it, the MicroPython SD card library has disappeared from the GitHub. So I stopped there. I'd like to revisit this later.</p>"},{"location":"assignments/week13.html#design-files_1","title":"Design files","text":"<p>Download SD card breakout board KiCAD project</p>"},{"location":"assignments/week14.html","title":"Interface and Application Programming","text":""},{"location":"assignments/week14.html#assignment","title":"Assignment","text":""},{"location":"assignments/week14.html#individual-assignment","title":"Individual assignment","text":"<ul> <li>Write an application that interfaces a user with an input &amp;/or output device that you made</li> </ul>"},{"location":"assignments/week14.html#group-assignment","title":"Group assignment","text":"<ul> <li>Compare as many tool options as possible</li> </ul> <p>See more info and recording of the lecture here.</p>"},{"location":"assignments/week14.html#frankenstein-mcu","title":"Frankenstein MCU","text":"<p>Presenting my addition to the FMCU to Neil Gershenfeld and Fab Academy Class 2023. Link to the video.</p> <p>Since my instructor \u00de\u00f3rarinn is working with Fran Sanchez on a IoT button that connects Fab Labs together, I decided to clone the repo and take a look at it. The current MCU uses Zoom to connect the Fab Labs together with live video feeds. So I searched for a way to embed Zoom into your own application and found the Zoom Meeting SDK for web, and in particular this JavaScript example. </p> <p>I cloned the repo, got a secret key as a Zoom Developer and I've got the authentication server running locally on Node.js, but the readme says that I need to send a POST request to the server. </p> <p>HTTP POST request trouble on the Zoom authentication server.</p> <p>Google didn't give me any understandable instructions on how to make a POST request to a localhost Node.js server. So I turned to ChatGPT. This is the first time I ask it to help me solve a problem. And help it did!</p> <p>ChatGPT to the rescue!</p> <p>Making an HTTP POST request using Postman. At the bottom you can see the signature that the Zoom authentication server returns. Thanks ChatGPT!</p> <p>The example works on its own.</p> <p>For this example to work you need to get a special authentication repo, which runs a node js server that listens. You go to Zoom Marketplace and get developer credentials and put them into the code in this repo and run the node server. Then when you press Join Meeting on the FMCU website, the website sends a message to the authentication server and gets a passkey, and then logs you into Zoom automatically.</p> <p>Now it's in a sidebar!</p> <p>I added the Zoom Meeting SDK JavaScript code, but the button doesn't work.</p> <p>I took to Mattermost and showed the non-working \"Join Meeting\" button to \u00de\u00f3rarinn and Fran. Fran replied with this:</p> <p></p> <p>So I looked at the two CSS files in the FMCU repo and saw two instances of a hyperlink having the .repo CSS class. So I gave the Zoom code the .repo CSS class and ran the Node server:</p> <p>It works! Wow, I didn't really expect that.</p> <p>I can even move the window around.</p> <p>Now I need to connect this to a physical circuit. I'm looking into how the FMCU button uses MQTT to send a message to the Node server. I'm also looking for a way to do serial communication using Node. </p>"},{"location":"assignments/week14.html#design-files","title":"Design files","text":"<p>Here's the code with instructions on how to run it locally:</p> <p>Link to the FMCU-Zoom repo</p>"},{"location":"assignments/week14.html#visualizing-a-light-sensor","title":"Visualizing a light sensor","text":"<p>I experimented with creating a computer interface for the light sensor that I made in Input Devices week. The code that runs on the Xiao is very simple. It comes from Adri\u00e1n Torres. The code uses analogRead to read the value from the IR sensor and then writes it to the serial port:</p> <p>I used a few different Python scripts to receive the IR light values from the serial port. First I tried Neil's hello.light.45.py code but it reads single characters from the serial port and I had programmed the Xiao to send whole lines at a time. I stopped there with Neil's code.</p> <p>Then I found a nice tutorial showing how you can list the available COM devices in the terminal, pick one by typing its number, and open it using serial.tools. </p> <p>Once the serial port is open, I run an infinite while loop and read one line from the serial port at a time, decode it using UTF-8 character encoding and then turn that string into an integer. I do the reading and converting in only two lines of Python code:</p> <pre><code>packet = serialInst.readline()\ny = int(packet.decode('utf'))\n</code></pre> <p>Then, to get a very rudimentary graphical representation going, I use an if statement and display one <code>-</code> if the value is between 0 and 100, display <code>--</code> if the value is between 100 and 200 and so on, up to 1000 (<code>----------</code>).</p> <p>As simple as it gets. This barely counts as a graphical user interface.</p> <p>I also tried to make a GUI using Tkinter. I found a useful code snippet in example 1 in this tutorial, which creates a small GUI window and displays a title and a red and green rectangle with empty space between them. It's static, but by using my y variable (the number that is streaming into the serial port) instead of hardcoded numbers, I can make the bar move.</p> <p>The static GUI example.</p> <p>I could get the Tkinter interface to run separately and I could also get a stream of data from the IR sensor separately, but I had trouble combining them. Apparently, the reason is that I have two infinite while loops and the one that comes first in the code blocks the other. While the code waits for input from the serial port, nothing else can happen. And while the interface is running, nothing else can happen. I couldn't figure this out using the examples that I found online.</p> <p>The following day I gave up and asked ChatGPT to change the code to make the two loops run concurrently. That resulted in code that ran, but I needed to make some changes to it. Only the grey bar was changing size between 0 and 1000 pixels, so I put 1000-y as the width of the black bar. That worked nicely. The interface was also sluggish, but I fixed that by changing <code>root.after(100, readFromSerial)</code> to <code>root.after(10, readFromSerial)</code>. Then there is a much shorter delay for updating the interface. </p> <p>We have a GUI that runs smoothly.</p>"},{"location":"assignments/week14.html#design-files_1","title":"Design files","text":"<p>Download IR sensor Arduino code</p> <p>Download Python terminal visualization code</p> <p>Download Python GUI code</p>"},{"location":"assignments/week14.html#possible-interface-tools-for-my-robot-arm","title":"Possible interface tools for my robot arm","text":"<p>I've looked into many ways of making an interface for a robot arm. Highlights include:</p> <ul> <li>Python Tkinter: This is what I used to make the simple interface for my IR sensor. Quite simple and works well.</li> <li>PyQt5: These are Python bindings for the powerful Qt5 interface library. Many, many desktop applications are built on Qt5, including CAD software. It's possible to build a standalone application using this library.</li> <li>ROS: The standard library to control all kinds of robots. Used extensively in reasearch and industry, very full featured but difficult to get into.</li> <li>Modular Things: A really nice web interface that works with Jake Read's OSAP network layer (which runs on the microcontrollers). You plug all sorts of Modular Things into USB ports, they pop up in the web interface, it knows what they are and then you write short JavaScript codes to make them interact and form complex machines. I really like this system but I've had trouble writing HTML and JavaScript code that works in it. It seems a bit different than plain HTML/JavaScript.</li> <li>Processing: Visual programming and device control for artists. It would be possible to make an interface using Processing, but I'm not very familiar with it. One plus is that it's popular in the Fab Lab community.</li> <li>P5.js: The JavaScript port of Processing, can connect to web cams and more using standard web protocols. This is one option if I want to create a browser-based interface from scratch. And hey- since it's JavaScript, I may be able to run it inside the Modular Things web interface.</li> <li>Python script in Blender: I've seen a few examples of robot control using Python scripting in Blender. Then you can animate a 3D model of the robot and have it act out those moves in real life. Nice.</li> <li>Python script in Fusion 360: Similar deal as in Blender, except I read online that the Fusion 360 Python version is a bit limited and constricted, and it's difficult to add Python libraries to it. But it should be possible.*</li> <li>Python script in FreeCAD: Similar to the other two I guess, but FreeCAD is a bit difficult to use.</li> <li>FreeCAD robot workbench: Just throwing this in here, haven't looked at it much.</li> <li>RoboDK: Industry standard user-friendly robot control software that works with lots of robots. Not free.</li> <li>Grasshopper: It should be possible to make a 3D model control a physical robot using Grasshopper, but I'm not familiar enough with it to try. Fab Academy students have made interfaces with their circuits using Grasshopper.</li> <li>WebSerial: The web standard that makes it possible for browser-based interfaces to control machines using serial ports. Mods Community Edition uses this and I think the Modular Things web interface does too. I use it in my simple two-motor control web interface.</li> <li>PyScript: My browser-based interface uses PyScript.  I like Python. It's nice. If I can use it to program the robot in a browser and even plot its joint positions using Matplotlib and possibly use computer vision libraries and stuff like that, then that is interesting.</li> <li>WebAssembly: WebAssembly is what makes PyScript work. The Pyodide environment takes a while to load, because it uses a WebAssembly version of CPython that you need to download every time you load the website. Loading time is the disadvantage, but the advantage is that now we can port lots of performant code written in languages like C and C++ and run them at near-native speeds in the browser without installing anything! I want to look into more WebAssembly packages in the future.</li> <li>ThreeJS: The standard JavaScript library for creating 3D graphics in the browser. I could potentially use this to display a 3D rendering of my robot in a web-based control interface.</li> <li>OpenCV: The standard open-source computer vision library. I would like to add a camera to my robot in the future so that it can detect objects and pick them up.</li> <li>Svelte: I read somewhere that this is a good framework for creating responsive web sites. I don't know much about it.</li> <li>Phew! This is a web server library written specifically for the Raspberry Pi Pico by Pimoroni. I got interested in it when I saw this tutorial on how to build a captive portal using MicroPython. A captive portal works like this: The Pi Pico emits a WiFi network signal. You connect your phone to that WiFi network and try to open any web page in your browser. The browser opens the web page that the Pi Pico is serving instead. That's what a captive portal means, you can't escape it! It's often used by hotels, so that you need to input a code or contact information into the captive portal before it allows you to browse the web freely. You can make a whole robot control interface in a captive portal using web technologies.</li> <li>Simplest Pi Pico web server: I also like this web server from Doctor Monk's DIY Electronics Blog.</li> <li>Streamlit: A really simple way to make a web site out of your Python calculation scripts. I tried the example and it ran locally on my machine. But it's quite narrowly focused and limited in what it can do.</li> <li>NiceGUI: Good name. This is similar to Streamlit, a simplified way to turn your Python code into a web site. Also limited in what kind of GUI elements you can use.</li> <li>CodeMirror: I discovered this when browsing the Hack Club GitHub repo. This is what powers the Sprig web-based programming interface. I guess that this is also used in the Modular Things web-based code editor. This is one way to enable users to write code to run on my robot.</li> <li>Chilipeppr: I discovered this many years ago, when Alden Hart came to Fab Lab Reykjav\u00edk in 2015 to introduce his sophisticated CNC motion controller TinyG, which is used in Bantam Tools CNC machines and more. He also made tehe 9-axis g2core. He showed us this nifty CNC control software with a 3D preview that runs in the browser. I still haven't tried it, though.</li> <li>Johnny-Five: A JavaScript robotic control framework. I haven't looked into it that much.</li> <li>Crossbar.io: Another web networking protocol for hardware devices.</li> </ul>"},{"location":"assignments/week15.html","title":"Wild Card Week","text":""},{"location":"assignments/week15.html#assignment","title":"Assignment","text":"<p>Design and produce something with a digital fabrication process (incorporating computer-aided design and manufacturing) not covered in another assignment, documenting the requirements that your assignment meets, and including everything necessary to reproduce it.</p> <p>See more info and recording of the lecture here.</p>"},{"location":"assignments/week15.html#vacuum-forming","title":"Vacuum forming","text":""},{"location":"assignments/week15.html#design","title":"Design","text":"<p>The annual Icelandic Fab Lab Bootcamp was held in Fab Lab Neskaupsta\u00f0ur in 2023. M\u00f3ses, the Fab Lab manager, showed me how to do vacuum forming with the Mayku FormBox.</p> <p>The Mayku Formbox is a basic 200x200mm vacuum forming machine. Its heating element goes up to 340\u00b0C You need to connect a vacuum cleaner to it for it to work. It works fine, but I think I would find it annoying to have to bring the vacuum cleaner every time I used the vacuum former.</p> <p>My first attempt.</p> <p>First I brought a rectangular 3D print with #FABLABISA inscribed on it. M\u00f3ses said that the object was rather small, the edges needed to be rounded and he also showed me examples of details similar to my text not coming through in the plastic sheet. </p> <p>Vacuum forming examples. Sharp corners and small details don't work well. The text J\u00d3L (Christmas) in the upper right corner doesn't come through at all.</p> <p>He also mentioned that circular things tend to work the best. That makes sense, the stretching will be uniform and there are no corners where creases can form in the plastic sheet. I decided to go with the Fab Lab logo instead. I rounded the chocolate button shape and the logo as much as the geometry would allow, and showed M\u00f3ses a finished print. </p> <p>I used a Mayku Clear Sheet, which is made of PETG and is food safe. The official Mayku sheets are not cheap.</p> <p>Now that's a better candidate for vacuum forming.</p> <p>This should work nicely, said M\u00f3ses, but there is a question whether the pocket in the middle will be rendered in the plastic sheet. I decided to try making holes in the middle to let the air out.  printed four versions of buttons with holes in the middle, for a total of five buttons:</p> <ol> <li>No holes </li> <li>1.5 mm holes</li> <li>2 mm holes</li> <li>2 mm holes with small holes in the three smallest crevices</li> <li>2 mm holes with rectangular holes in the three smallest crevices.</li> </ol> <p>Buttons with holes added to draw vacuum through the center of the part.</p>"},{"location":"assignments/week15.html#design-files","title":"Design files","text":"<p>Here's the Fusion model of the Fab Lab chocolate button:</p> <p>Download failed #FABLABISA chocolate Fusion 360 model</p> <p>Download chocolate button Fusion 360 model</p>"},{"location":"assignments/week15.html#3d-printing","title":"3D printing","text":"<p>Completed 3D prints.</p>"},{"location":"assignments/week15.html#vacuum-forming_1","title":"Vacuum forming","text":"<p>When the prints were complete, we connected a vacuum cleaner to the FormBox and heated it up. M\u00f3ses told me that the sheet needed to be heated up until it droops 2 or 3 cm down. Then it's soft enough to form. </p> <p>Sheet is hot and drooping and ready to form.</p> <p>Then the handle locks are released and the frame with the sheet is quickly lowered onto the bed containing the 3D printed positive forms. The vacuum is held for a minute or two and the sheet is allowed to cool down a bit. Then it's ready! </p> <p>Done!</p> <p>To my surprise, all the forms came out well. Apparently the tiny crevices in the logo were enough to get the air out of the middle part. The button with no holes actually came out the best!</p> <p>Better label both the buttons and the sheet to remember which is which.</p> <p>I tried measuring the depth of the pocket in the middle of each button with a caliper and they seemed to be the same, whether there were holes in the forms or not.</p> <p>Measuring the depth in the middle.</p> <p>I like vacuum forming but its applications are limited. It would be nice to host a short class on chocolate mold making here at the Fab Lab, but I don't know what else I would use the vacuum former for. Mostly it's used to make packaging, and I don't make any packaging.</p>"},{"location":"assignments/week15.html#chocolate-casting","title":"Chocolate casting","text":"<p>I followed instructions from the Icelandic newspaper Morgunbla\u00f0i\u00f0, so they may not be useful to you.</p> <p>First melt the chocolate slowly in a water bath. Don't let any water get into the chocolate! You heat it up to 50\u00b0C.</p> <p>Melting the chocolate.</p> <p>Then you let the temperature drop to 42\u00b0C and you add a third of the same kind of chocolate (chopped) to the pot. Stir it into the melt.</p> <p>Chopping the rest of the chocolate.</p> <p>Putting the chopped chocolate into the pot.</p> <p>Then you let the temperature drop down to 32\u00b0C. Now the chocolate is tempered and you can pour it into the molds.</p> <p>Pouring into the molds.</p> <p>I also shook the molds to flatten out the bottoms of the buttons.</p> <p>And here they are, lined up with the 3D prints that created them.</p> <p>Row of chocolate Fab Lab buttons. They all came out well. I would skip the holes in the middle next time.</p> <p>Now it's time for testing. Is the chocolate tempered or not?</p> <p>I suspect that my next attempt may be more successful, since I won't have to take pictures and videos while I try to get the temperature profile right.</p>"},{"location":"assignments/week15.html#further-experimentation","title":"Further experimentation","text":"<p>It would be interesting to try printing the original Fab Lab button model with an increased distance between the 3D printed lines. I think that would make it possible to draw vacuum through the part without having to draw holes manually. And the top surface texture might be nicer, too.</p>"},{"location":"assignments/week15.html#update","title":"Update","text":"<p>The meat thermometer that I used isn't very precise. I then found this tutorial, which describes a method to temper chocolate without a thermometer, using a microwave. This was quick and easy, and the Fab Lab chocolate buttons snap apart!</p> <p>Success!</p>"},{"location":"assignments/week15.html#fpga-field-programmable-gate-array","title":"FPGA (Field-Programmable Gate Array)","text":"<p>The Runber FPGA board. I think the program is supposed to blink the eight LEDs above the FPGA chip, but the tutorial isn't entirely clear about it.</p>"},{"location":"assignments/week15.html#why","title":"Why","text":"<p>I've been curious about FPGAs for some time, for four reasons:</p> <ol> <li>I took the course Computer-Controlled Hardware in engineering school at the University of Iceland. One of the lecturers is an FPGA designer at the prosthetic company \u00d6ssur. He showed how the company's Power Knee has developed over the years from a large, complicated circuit board with lots of components to a much smaller footprint, essentially containing only a microcontroller and an FPGA. The FPGA can contain any digital circuitry, which is really interesting.</li> <li>My wife gave me the book Einstein's Shadow for Christmas a few years ago. It's an entertainingly written account of the quest to photograph a black hole. It involved extremely high-speed FPGA chips which made the Event Horizon Telescope possible.</li> <li>The astonishing optical encoder in the Dexter robot arm. Check it out.</li> <li>In the 2023 Fab Academy Student Bootcamp, Krisjanis Rijnieks mentioned that ordinary people now have the opportunity to design digital chips and have them made, using open source toolchains like Google Silicon. Google also offers the Open MPW program which is a lottery where you can submit your chip design and if you're lucky, Google will pay for the chip fabrication. I also discovered the Zero to ASIC course from Matt Venn, where he teaches people to design Application Specific Integrated Circuits from scratch and has them manufactured for them. Exciting stuff! Chips are designed using VDHL or Verilog, which are hardware description languages. You also use these languages to program FPGAs. Before committing a chip design to manufacturing, people usually test it on an FPGA.</li> </ol> <p>In Wild Card Week, I thought to myself: If I don't try an FPGA now, I probably never will. For this week, I ordered the cheapest FPGA board that I could find ($30) that still has a set of tutorials available, the Gowin RUNBER board from Seeed Studio.</p>"},{"location":"assignments/week15.html#how","title":"How","text":"<p>An FPGA is a circuit that you design with a hardware description language. The unit of computation is is one bit, which can be a 1 or a 0. The FPGA consists of lots of Look-Up Tables (LUTs), which specify what happens when ones or zeros enter them. These LUTs form logic gates which can be combined to make any circuit, even a whole ARM microcontroller! Indeed, many FPGAs are programmed to contain a microcontroller core as well as additional digital ciruits. The Gowin GW1N-4 on my board has 4608 LUTs with four inputs each.</p> <p>I managed to get a license by sending an email to Gowin customer service and then I followed the first tutorial in this PDF. The circuit blinks eight LEDs, one at a time. In Gowin FPGA Designer, I created a new project:</p> <p></p> <p>I selected FPGA Design Project:</p> <p></p> <p>And then I selected my FPGA chip:</p> <p></p> <p>I got a summary of the project settings before finishing the setup:</p> <p></p> <p>Now I had a new FPGA design project. So far so good:</p> <p></p> <p>I created a new Verilog file and pasted the code from the tutorial. Then I clicked Synthesize:</p> <p></p> <p>That seemed to work OK. Then I went into Tools -&gt; Floor Planner to see how the circuit looked inside the FPGA. I got an error. Then I looked a little further in the tutorial and found that I needed to create a constraints file, where I specify which pins I'm using and what they are. I went into File -&gt; New, selected Physical Constraints File and gave it the name constr.cst:</p> <p></p> <p>I just copied the code from the tutorial and pasted it into the constraints file. This is how it looks in the editor:</p> <p>The constraints file defines eight output pins that are supposed to turn eight LEDs on, one at a time.</p> <p>Now I could go into Tools -&gt; Floor Planner. I got a graphical representation of the chip. I would expect eight pins to be highlighted in blue, but only six pins are highlighted. But I wouldn't know how to fix the code, and the messages in the terminal seemed positive:</p> <p></p> <p>So I soldiered on. I selected the I/O Constraints at the bottom of the window and got a list of the constraints that were defined in the .cst file:</p> <p></p> <p>The third and final file I needed to create before programming the FPGA was a timing constraints file. In FPGAs, everything is counted in clock cycles, and you need to define the clock frequency. I opened the Timing Constraints Editor:</p> <p></p> <p>There I created a Timing Constraints file with a period of 83.333 nanoseconds and a frequency of 12 MHz:</p> <p></p> <p>The timing constraints file only contains a single line of code specifying the clock speed:</p> <p></p> <p>Then I selected Run Place and Route. That's the button with four colored squares that looks a bit like the Windows icon. I got a bunch of <code>Generate file completed</code> messages in the terminal, which seemed promising:</p> <p></p> <p>If you look again at the image above, you can see the mouse hovering over the Programmer icon, which is a green downward arrow. I now pressed it and hoped for the best. I have no idea what I am doing.</p> <p></p> <p>The programmer found a USB device, so I clicked Program/Configure. Here the tutorial ends, but I still needed to make some selections. I found the manual for the Programmer in the Gowin software directory and followed instructions that told me to select Embedded flash mode and select the .fs programming file in the dialog:</p> <p></p> <p>When I clicked Save I got an error:</p> <p></p> <p>This seems like a simple error, all I have to do is select the right chip. I tried selecting all the chips that have similar names to mine (GWIN-4, GWIN4B, GWIN-4D and all their versions). I had to select the chip both in the Floor Planner and in the Programmer. But nothing worked. I don't know where to go from here, so I'll stop. </p>"},{"location":"assignments/week15.html#design-files_1","title":"Design files","text":"<p>Download Gowin FPGA program files</p>"},{"location":"assignments/week16.html","title":"Applications and Implications","text":""},{"location":"assignments/week16.html#assignment","title":"Assignment","text":"<p>Propose a final project masterpiece that integrates the range of units covered, answering:</p> <ul> <li>What will it do?</li> <li>Who's done what beforehand?</li> <li>What will you design?</li> <li>What materials and components will be used?</li> <li>Where will come from?</li> <li>How much will they cost?</li> <li>What parts and systems will be made?</li> <li>What processes will be used?</li> <li>What questions need to be answered?</li> <li>How will it be evaluated?</li> </ul> <p>Your project should incorporate </p> <ul> <li>2D and 3D design,</li> <li>additive and subtractive fabrication processes,</li> <li>electronics design and production,</li> <li>embedded microcontroller interfacing and programming,</li> <li>system integration and packaging</li> </ul> <p>Where possible, you should make rather than buy the parts of your project.</p> <p>Projects can be separate or joint, but need to show individual mastery of the skills, and be independently operable.</p> <p>See more info and recording of the lecture here.</p>"},{"location":"assignments/week16.html#final-project-proposal","title":"Final project proposal","text":""},{"location":"assignments/week16.html#what-will-it-do","title":"What will it do?","text":"<p>Baksi will be a small, light and nimble SCARA-type robot arm with a structure made of PCBs (with 3D printed additions to stiffen the structure) and powered by brushless gimbal motors with angle sensors. It will be a motion platform that I will add end effectors to later. Its purpose is to teach robotics and perhaps automate some small tasks. I first called it Baks, but then I noticed that my son always asked if I was working on Baksi. The original plan was to make a traditional robot arm as shown in the sketch above, but that would involve balancing out the weight of the arm with springs. So to simplify the project I switched to a horizontal SCARA layout.</p>"},{"location":"assignments/week16.html#who-has-done-what-beforehand","title":"Who has done what beforehand?","text":"12345678910111213141516171819 <p>This robot arm sketch by Masoud Akbarzadeh inspired the shape of spiral 1 of my robot arm joint.</p> <p></p> <p>Avishek Das made a small RC servo robot arm with a really nice simulation interface. I just don't like the jerkiness and imprecision of RC servos.</p> <p></p> <p>Dan Chen made a clean-looking modular robot that can grab sushi. It's also based on RC servos.</p> <p></p> <p>A group at Fab Lab Oulu made a cardboard robot arm in machine week in 2020. It's also based on RC servos.</p> <p> </p> <p>Hiroaki Kimura made a simple RC-servo arm and controlled it with a smaller arm with potentiometers in the joints.</p> <p></p> <p>Kenny Phay Ngiap Peng made a stepper and RC-servo robot arm.</p> <p></p> <p>A group at Fab Lab IED Madrid made a stepper-based SCARA arm in Machine Week in 2019.</p> <p></p> <p>A group at Super Fab Lab Kochi made a nice stepper based SCARA arm in Machine week 2023.</p> <p></p> <p>Jules Topart made a promising robot joint actuator.</p> <p> </p> <p>Xiaomeng Liu made a very nice iPhone camera gimbal with brushless motors. These are the actuators I want to work with and this is the smoothness of motion that I want. Light and nimble, like a gimbal!</p> <p></p> <p>Christian Schmidt made a very compact GoPro camera gimbal but it was a little jittery.</p> <p> </p> <p>Adam B\u00e4ckstr\u00f6m hacked hobby servos in an amazing way and created a super-precise robot arm. His simple optical encoder design is inspiring.</p> <p></p> <p>A fellow with the username Pinaut created a surprisingly smooth-moving rc servo arm with a learning function.</p> <p></p> <p>The electronics blogger Electron Dust created this simple stepper robot arm with a learning function. I love the look of the arm, it's inspiring.</p> <p></p> <p>Youtube user \u7a1a\u6656\u541b created the most sophisticated DIY robot arm I've ever seen. It's incredible, but also impenetrable. I mean, it is open source but I wouldn't know where to begin trying to understand any of the design files.</p> <p>Image credit Datatang.</p> <p>John Lauer created a geared stepper robot arm which is really sleek. More interesting to me, he also created a geared brushless motor robot arm. John also created Chilipeppr, which I talk about in Interface and Application Programming.</p> <p></p> <p>Damian Lickindorf created Atlas, a crazy cool robot arm which also looks crazy complicated to build. Ooh look, he's using ROS and Moveit for motion planning:</p> <p></p> <p>The MeArm is probably the best open source DIY kit for beginner roboticists. I'd like my robot arm to move more smoothly and be a bit more capable than this arm.</p> <p></p> <p>The AR4 is probably the best open source DIY kit for more advanced roboticists. I think the world hasn't quite caught up to its significance. I think it's important, in the way that the RepRap is important. I'd love to build one some day. I want my robot arm to be smaller and less expensive than this arm.</p> <p></p> <p>More robot arm inspiration (I had to split this up because the image carousel couldn't handle more than 20 entries):</p> 20212223242526272829303132333435 <p>Skenkir. This was a university project with Gu\u00f0j\u00f3n Bergmann and Baldur Bj\u00f6rnsson. Our task was to lift a wine glass and give the professor a sip. And because I'm Gyro Gearloose's biggest fan, I wanted the robot to have a hand in a white glove.</p> <p></p> <p>The uArm from Ufactory. My plan was to make it fry doughnuts, but then I accidentally fried its control board.</p> <p></p> <p>The Nyrio One. We borrowed this one from Kar\u00edtas in Fab Lab Sau\u00f0\u00e1rkr\u00f3kur and I had a lot of fun with it until it got stuck trying to make a move and fried a motor control board. I replaced it and we returned it to Sau\u00f0\u00e1rkr\u00f3kur. I vowed to make my robot arm incapable of damaging itself!</p> <p></p> <p>The Dexter robot arm by Haddington Dynamics is the original reason why I wanted to make a robot arm. It was open source in the beginning, but not anymore. Their hyper-precise optical encoder design is phenomenal, there's nothing else like it in the world. They use this advanced sensor to  create precise motion from imprecise parts, which is exactly what we need for a proper robotics revolution, in my opinion. I'd love to try to make something like their optical encoder using a microcontroller instead of an FPGA. Dexter costs $15.000 now and is probably worth it, but it's still inaccessible to most people. Had I known about their Kickstarter, I would have thought seriously about the $2000 early bird kit.</p> <p></p> <p>The KUKA-style stepper robot arm from Youtube user ZeroBacklash is a really clean build. When it's ready, they will sell the design files.</p> <p></p> <p>The Mirobot is another clean build, but it's not open source. Coy Beardmore managed to make the robot solder circuit boards.</p> <p></p> <p>Skyentific. His video on brushless motors is a major reason why I chose to use brushless motors in my robot arm.</p> <p></p> <p>Ben Katz created the MIT Mini Cheetah. His bilateral teleoperation video is just an intermediate stage in the build, but it's still the best example of a haptic interface between robots that I've seen.</p> <p></p> <p>This is the first BLDC control system that I tried to build, but it was too complicated for me to replicate. Check out the project's Hackaday.io page.</p> <p></p> <p>Juan Pablo at Random Access Projects has excellent videos on sinusoidal BLDC control. This was the first BLDC control system that I managed to get working. I supported his Patreon page and got access to his Arduino code. In this video he demonstrates his own BLDC control board that uses three half-H-bridge chips instead of a ready-made brushless motor driver chip. This might be an interesting direction for spiral 3 of my robot arm.</p> <p></p> <p>SimpleFOC Community user Valentine has designed some interesting BLDC control boards. Of interest to me are the Mosquito (which contains a knockoff of the DRV8313 motor driver that I'm using) and the Lepton 1.0, 2.0  and 3.0.</p> <p>The Lepton 1.0 field-oriented control board for brushless motors.</p> <p>Shay Sackett has one of the smoothest slow control demos of a brushless motor that I've seen:</p> <p></p> <p>Mizuhai Yukkie created an interesting small BLDC driver board that works with the SimpleFOC library:</p> <p></p> <p>The blog Berryjam posted a BLDC motor being driven at super slow speeds with an L6234 driver chip (too bad they aren't available now). The blog post has good graphs of different BLDC motor control techniques.</p> <p></p> <p>Youtube user RoTechnic made a Bowden tube robot arm. The stepper motors are not on the arm but on the table, which makes the robot much, much lighter and able to lift more weight. The motor movements and forces are routed to the arm joints with strings that go throught plastic tubes, just like the brakes lines on a bicycle. It works remarkably well, I can see this being a popular design in hobby robot arms soon and quite possibly in small professional robots as well.</p> <p></p> <p>Hackaday user Xavi Cano made an educational five-bar parallel robot:</p> <p></p>"},{"location":"assignments/week16.html#what-will-you-design","title":"What will you design?","text":"<p>A robot joint controller board that I can replicate to make all the joints on the robot. I'll also design a 3D printed part that hides all the wires.</p>"},{"location":"assignments/week16.html#what-materials-and-components-will-be-used-where-will-they-come-from-how-much-will-they-cost","title":"What materials and components will be used, where will they come from, how much will they cost?","text":"Part Part no. Amount Price (USD) Total (USD) Link GM2804 Gimbal Motor w/Encoder G006983_2 3 38.99 116.97 https://shop.iflight-rc.com/ipower-gm2804-gimbal-motor-with-as5048a-encoder-pro288 Gimbal Motor Slipring - OD 6.5mm G006983_2 2 15.99 31.98 https://shop.iflight-rc.com/6-5mm-slipring-for-ipower-motor-gm2804-gimbal-motor-pro302?search=Gimbal%20Motor%20Slipring%20-%20OD%206.5mm Yoctopuce Micro-USB-Hub-V2 MHUB0002 1 32.4 32.4 https://www.yoctopuce.com/EN/products/extensions-and-networking/micro-usb-hub-v2 Pololu Adjustable 4-12V Step-Up/Step-Down Voltage Regulator S18V20ALV 1 37.95 37.95 https://www.pololu.com/product/2572 ATSAMD21E18A-AUT ATSAMD21E18A-AUTTR-ND 3 4.23 12.69 https://www.digikey.com/en/products/detail/microchip-technology/ATSAMD21E18A-AUT/4878871 DRV8313PWP 296-35540-5-ND 3 4.81 14.43 https://www.digikey.com/en/products/detail/texas-instruments/DRV8313PWP/3790947 PLA filament 10 Total 256.42"},{"location":"assignments/week16.html#what-parts-and-systems-will-be-made","title":"What parts and systems will be made?","text":"<p>I will make the control boards and 3D printed structure.</p>"},{"location":"assignments/week16.html#what-processes-will-be-used","title":"What processes will be used?","text":"<p>PCB milling, 3D printing.</p>"},{"location":"assignments/week16.html#what-questions-need-to-be-answered","title":"What questions need to be answered?","text":"<p>Can I find an Arduino core for the SAMD21 that both the OSAP and SimpleFOC libraries can compile to? Can these two libraries coexist on the same microcontroller? Can I get the closed loop control working? Can I tune the PID? Can I mill the fine traces for the SAMD21 microcontroller and the DRV8313 brushless motor driver? Can I design such a complicated board?</p>"},{"location":"assignments/week16.html#how-will-it-be-evaluated","title":"How will it be evaluated?","text":"<p>If I manage to get one robot joint working, then I consider the final project a success. I will keep working on the robot after the final presentation.</p>"},{"location":"assignments/week17.html","title":"Invention, Intellectual Property and Business Models","text":""},{"location":"assignments/week17.html#assignment","title":"Assignment","text":"<ul> <li>Develop a plan for dissemination of your final project</li> <li>Prepare drafts of your summary slide (presentation.png, 1920x1080)<ul> <li>and video clip (presentation.mp4, 1080p HTML5, &lt; ~minute, &lt; ~10 MB)</li> <li>and put them in your root directory</li> </ul> </li> </ul> <p>See more info and recording of the lecture here.</p>"},{"location":"assignments/week17.html#license","title":"License","text":"<p>At the bottom of every page on this website, I claim my copyright over the work that I\u00b4ve done in the Fab Academy. I want to choose a permissive license for the work, all I want is to be mentioned if you use part of it in your own project. I thought about one of the Creative Commons licenses, but then I found that Creative Commons don't recommend their licenses for software or hardware. Others that may apply are the MIT license for software and the CERN open hardware license. This is a jungle, and I'm a bit confused. And if I choose a licence, I'll need to include it with all my design files. I don't have time for that right now. </p> <p>Maybe the \"Fab Lab license\" that Neil Gershenfeld puts in all his software files on the Fab Academy website would be a good license for my work. But again, I am already stretched to my limits trying to finish all the assignments and the documentation; I can't also go back and modify all the design files to include a license. I can only work from nine in the morning to midnight for so long. I need to see my family at some point.</p> <p>So for now, the work is copyright, and all rights are reserved. I will revisit this in the near future (I'll review choosealicense.com and Open Hardware Licenses) and see how I can best open the work up for others to use. Feel free to contact me at \"svavar at fabisa dot is\" to get permission to use the stuff I've made.</p>"},{"location":"assignments/week17.html#funding-plan","title":"Funding plan","text":"<p>I'm not going to start a company around this little robot. But I have applied for and received two grants to develop it. </p>"},{"location":"assignments/week17.html#grant-1","title":"Grant #1","text":"<p>I applied for the first grant three months before the Fab Academy started. I had been thinking about final projects for a full year, because I was so excited about entering the Fab Academy. I really wanted to make something cool. Then when the deadline for the Icelandic Technology Development Fund rolled around, I had done quite a bit of thinking and I used that thinking to send in an application for the smallest grant of one million ISK (about $7000). And I got it! I used that grant to buy all the parts that I thought I would need for the arm, including molding and casting supplies to make precise gearboxes. The parts that I bought came in very handy, not all of them, but the rest will be useful to future Fab Academy students.</p>"},{"location":"assignments/week17.html#grant-2","title":"Grant #2","text":"<p>The second grant was from the Icelandic Student Innovation Fund. I got funds to employ a university student for the summer to develop an interface for the robot in the Robot Operating System (ROS). That student is Gu\u00f0j\u00f3n Bergmann, a friend from engineering school. Many of his buddies at TU Delft are looking into ROS, so this project will be good for him. Fortunately I've managed to build the arm just in time for his summer project to start.</p>"},{"location":"assignments/week17.html#dissemination-plan","title":"Dissemination plan","text":"<p>I've thought a lot about how to make my robot arm. But I haven't thought much about how to make sure that it reaches its intended user group. Who is its intended user? Someone like me who is interested in robotics, I guess? High school and university students, engineers, technology enthusiasts, computer science majors who want to program physical things and make them move? Who are they and where do they hang out online?</p> <p>How do I reach these people? I don't know. That's the part I'm not very good at. Do I set up a website? I guess I could let people in the Fab Lab community know about the project and see if anyone wants to buy an arm to use in their classes. But this is quite a tricky board to mill. And I could show the robot in the SimpleFOC community, except there everybody wants to build their own robot in their own style from scratch. I have a vague dream of asking Seeed Studio if they would be interested in selling populated boards in their online store as an easy way to get into robotics. I don't know.</p> <p>Maybe if the project gets featured in an article on Hackaday. Yes, that might be the right audience.</p>"},{"location":"assignments/week17.html#presentation-files","title":"Presentation files","text":"<p>I made a final project presentation slide and video under Presentation.</p>"},{"location":"assignments/week18.html","title":"Project Development","text":""},{"location":"assignments/week18.html#assignment","title":"Assignment","text":"<ul> <li>Complete your final project, tracking your progress:<ul> <li>what tasks have been completed, and what tasks remain? </li> <li>what's working? what's not?</li> <li>what questions need to be resolved?</li> <li>what will happen when?</li> <li>what have you learned?</li> </ul> </li> </ul> <p>See more info and recording of the lecture here.</p>"},{"location":"assignments/week18.html#progress-on-the-final-project","title":"Progress on the final project","text":"<p>The final project plan.</p>"},{"location":"assignments/week18.html#what-tasks-have-been-completed","title":"What tasks have been completed?","text":"<p>I managed to put together one robot joint and test it successfully. I'm really glad that I got this far.</p> <p>Because my teaching duties were over for the semester, I was finally able to document as I went along. I found that enjoyable, and the final project documentation is much better for it. I will definitely aim for real-time documentation in my projects from now on.</p> <p>I approached the project in spirals, just trying to make one robot joint work. In the first spiral I took the Stepper RP2040 Modular Thing, changed its shape and added a few things. I did a lot of testing and debugging and found that the Toshiba TB67H451FNG motor drivers are not a good fit for brushless motors. That was quite a big blow, because I had spent a lot of time designing that board. But Rico Kanthatham urged us to make the major mistakes in our final project early, and I had done that. I did spiral 1 of my final project in Output Devices week (and two more weeks after that). So I still had time to find another motor driver and start the electronics design again from scratch.</p> <p>The evolution of my PCB design skills can be seen in these four boards: </p> <p>My PCB design journey. Right-click the image and select \"Open image in new tab\" to see the boards better.</p> <ol> <li>My first board was very simple; it had just a Xiao module, an LED with a current-limiting resistor and a button. It was a good first design project and I was so happy when I got the LED blinking! </li> <li>My first major design was the machine controller for the Teamanator, the Terminator-inspired tea machine that Andri, Hafey and myself finished successfully during an intense weekend in Fab Lab Reykjav\u00edk. </li> <li>My second major design was spiral 1 of my robot joint, which embeds a Xiao module onto the board. </li> <li>In spiral 2 I wanted to go further, so I embedded the SAMD21 chip directly onto the board, which I think is much cooler. I had the confidence to do that because I had played around with the RGBB Modular Thing and managed to program it with the Atmel-ICE. I think I've come a long way, because I had not designed an electronic circuit before starting the Fab Academy.</li> </ol>"},{"location":"assignments/week18.html#what-tasks-remain","title":"What tasks remain?","text":"<p>I need to connect the second robot joint and try operating them together. The robot is also missing a Z-axis (up and down). While I've been finishing up the documentation of the weekly assignments, I've been thinking about ways to make a clean-looking Z-axis. I think I have a good solution, but it requires a hack (see \"What questions need to be resolved?\").</p> <p>I also need to make some kind of an end-effector. My instructor \u00de\u00f3rarinn helped me make an electromagnet, but in the final push, I had to do triage and decide which parts of the project needed to be abandoned and which ones I might finish. I put all my energy into getting the motor control board made and assembled with all the wires hidden.</p>"},{"location":"assignments/week18.html#what-has-worked-what-hasnt","title":"What has worked? What hasn't?","text":"<p>Everything I've tested in the final project works. I made sure of that before I assembled it. It was a bit of a risk to wait so long before actually fabricating anything. In the last Global Open Time meeting on the Saturday before I presented, I was milling the first board for my final project, and my final project still looked like this:</p> <p>Meme from \u00de\u00f3rarinn. The actual image is the first one in \u00de\u00f3rarinn's meme at the bottom of this page.</p> <p>This was my second major attempt at milling this board. The first time I used a 0.01\" milling bit, which broke after an hour of milling, in the middle of the night. You can see my reaction to that in my presentation video. Then I tried a V-bit, which is much stronger and more durable, but if you don't get the Z-height exactly right, the track that it mills will either be too thin or to thick. This may result in traces disappearing. While Global Open Time was still in session, the Modela MDX-20 finished milling with the V-bit:</p> <p>The moment I realized that I could finish my final project.</p> <p>I went to the video conferencing screen in the lab with my hands up in victory, and they guys celebrated with me.</p> <p>Look at those beautiful traces.</p> <p>As for the outcome of the final project: I love how you can see all the electronic components and yet the robot has a clean look and all the wires are hidden. All of them! That took a LOT of system integration work. The robot actually looks pretty much exactly like I envisioned it.</p> <p>However, assembling the robot was hell. Wires kept breaking and it was difficult to get them into the 3D printed part. I wouldn't want to do it like this again. This was spiral 2. In spiral 3, I want to design a multilayer PCB that contains all the wires that are currently hidden inside the 3D printed part. Then I can realize my original vision of a robot that is made of motors and PCB and nothing else! And it will still have a clean look! The prospect is exciting, but my goodness, this project is so much work. I really need a good summer holiday.</p> <p>Also, pretty much all the software interface work remains. I did receive a grant for my engineering buddy Gu\u00f0j\u00f3n Bergmann to do some work on that.</p>"},{"location":"assignments/week18.html#what-questions-need-to-be-resolved","title":"What questions need to be resolved?","text":"<p>Magnetic angle sensor placed off-axis. The PID loop still worked. If I move it a tiny bit further away from the middle, the motor goes haywire.</p> <p>Can I place the magnetic angle sensor far enough from the axis so that I can put a Z-axis leadscrew through the hole in the middle of the brushless motor? I've done a preliminary test with me holding the sensor off-axis, and it may work.</p>"},{"location":"assignments/week18.html#what-will-happen-when","title":"What will happen when?","text":"<p>Note about the final push from \u00de\u00f3rarinn. We signed it and everything. It's sitting on the espresso corner table that I made in Machining week. The espresso was quite well extracted (here's another reference image).</p> <p>Gu\u00f0j\u00f3n Bergmann, who is studying Aerospace Engineering at TU Delft, will make a mockup of the software interface, and possibly do some real-world testing this summer. His work will finish in the beginning of August. I don't know when I will have time to do more work on this project myself, but I really want to get my \"only motors and PCBs\" robot made at a PCB house. That would be so cool. But right now I'm on my last chance to write a Master's thesis in Mechanical Engineering this winter. So I'll probably focus on that in the fall of 2023.</p> <p>Gu\u00f0j\u00f3n Bergmann.</p>"},{"location":"assignments/week18.html#what-have-you-learned","title":"What have you learned?","text":"<p>Demand-side time management is a really important part of the Fab Academy, because if you just think about what you would like to accomplish and line those tasks up linearly, you will run out of time. The project must be designed with the time and energy you have in mind. Spiral development is also very useful to me. My instinct is to try to get all the way to a finished product in one giant leap, but spiral development, where you complete a rough and simple version first and then see if you have time for another complete spiral with more features, has much better results. As \u00de\u00f3rarinn said after I presented my final project, Fab Academy is really one big lesson in project management. However, I've never used Gantt charts or other detailed project management methods, because I like working in research and development, and there you never know where the road leads you or how long it's going to take.</p> <p>It's often possible to mock up a technical idea in a day or a weekend that you've been thinking about for years, and finally see if it's good or not. I've tried many things during the Fab Academy that I've been thinking about for a long time. And they're not as intimidating as they seemed. I've discovered the joy of distributed work on an open source community project (the Frankenstein MCU). Look! I figured out a way to add Zoom video conferencing to the FMCU and made nice instructions on how to run that version locally, for the other developers. This is my first time doing this sort of thing and I really like it. I've discovered a world of collaborators in the Fab Lab network.</p> <p>My instructor \u00de\u00f3rarinn has been very supportive throughout this journey and taught me many things, especially relating to electronincs. He is the resident meme master in the Fab Academy chat on Mattermost. Seriously, I think half of the memes on the meme channel came from him. He even made a meme just for me by rearranging the image series on my ideas page:</p> <p></p>"},{"location":"final-project/3d_design.html","title":"3D Design","text":""},{"location":"final-project/3d_design.html#basic-shape-study","title":"Basic shape study","text":"<p>Basic shape study. Since the arm is made of flat PCBs, I don't have many parameters to play with.</p> <p>Dimensions of the basic shape.</p> <p>I set the diameter of all the arcs to <code>d3</code>, which is the diameter of the first arc. I change that and the whole model updates.</p> <p>I eventually decided to make all the joints the same shape, because it's simpler and because when the big arcs go inward, there isn't enough room on the board for all the components. So here's the final 3D design:</p> <p>Here's baksi, the spiral 2 version.</p>"},{"location":"final-project/3d_design.html#design-files","title":"Design files","text":"<p>Download baksi spiral 2 concept Fusion 360 model</p> <p>Download 3D print with internal channels</p> <p>Download base</p>"},{"location":"final-project/build.html","title":"Build your own baksi","text":"<p>Here are instructions that you can follow to build your own baksi robot arm. This page is a work in progress.</p> Part Part no. Amount Price (USD) Total (USD) Link GM2804 Gimbal Motor w/Encoder G006983_2 3 38.99 116.97 https://shop.iflight-rc.com/ipower-gm2804-gimbal-motor-with-as5048a-encoder-pro288 Gimbal Motor Slipring - OD 6.5mm G006983_2 2 15.99 31.98 https://shop.iflight-rc.com/6-5mm-slipring-for-ipower-motor-gm2804-gimbal-motor-pro302?search=Gimbal%20Motor%20Slipring%20-%20OD%206.5mm Yoctopuce Micro-USB-Hub-V2 MHUB0002 1 32.4 32.4 https://www.yoctopuce.com/EN/products/extensions-and-networking/micro-usb-hub-v2 Pololu Adjustable 4-12V Step-Up/Step-Down Voltage Regulator S18V20ALV 1 37.95 37.95 https://www.pololu.com/product/2572 PLA filament 10 Total 256.42 <p>Here are all the electronic components you need to assemble one baksi board:</p> Id Designator Footprint Quantity Designation Supplier and ref 1 U1 TQFP-32_7x7mm_P0.8mm 1 SAMD21 ATSAMD21E18A-AUTCT-ND 2 U3 SOP65P640X120-29N 1 DRV8313PWP 296-35540-5-ND 3 SW1 Button_Omron_B3SN_6.0x6.0mm 1 Switch_Tactile_Omron B3SN-3112P 4 U4 SOT-223-3_TabPin2 1 Regulator_Linear_3.3V_1A_DiodesIncorporated AZ1117IH-3.3TRG1 5 D1 LED_RGB_CreeLED_CLV1A-FKB 1 LED_RGB_CreeLED_PLCC4 CLV1A-FKB-CK1VW1DE1BB7C3C3 6 D3 LED_1206 1 White LED 1206 QBLP650-IW 7 R18,R13,R19,R1,R7,R14,R16,R15 R_1206 8 0Ohm RC1206FR-070RL 8 R5,R2,R4,R3 R_1206 4 1kOhm RC1206FR-071KL 9 R11,R9,R8,R12,R6,R10 R_1206 6 10kOhm RC1206FR-0710KL 10 C4 C_1206 1 10nF 1206 component book 11 C10,C7,C5 C_1206 3 100nF 1206 component book 12 C6 C_1206 1 470nF 1206 component book 13 C2,C8 C_1206 2 1uF C3216X7R1H105K160AB 14 C1,C3 C_1206 2 10uF GRT31CC8YA106ME01L 15 C9 CP_Elec_D6.3mm_H6.1mm 1 100uF EEE-FN1E101UL <p>You need to make three of these boards to make a baksi robot.</p> <p>Here are all the electronic components that you need to make a sensing board for baksi:</p> Id Designator Footprint Quantity Designation Supplier and ref 1 M1 SeeedStudio_XIAO_RP2040 1 Module_XIAO-SAMD21 SKU   102010328 2 SW1 Button_Omron_B3SN_6.0x6.0mm 1 Switch_Tactile_Omron B3SN-3112P 3 D1 LED_1206 1 Red LED 1206 SML-LX1206IC-TR 4 R2 R_1206 1 10Ohm RC1206FR-0710RL 5 R1 R_1206 1 10kOhm RC1206FR-0710KL 6 R3 R_1206 1 10MOhm RC1206FR-0710ML <p>You need to make one sensing board.</p> <p>Download 3D print with internal channels</p> <p>Download base</p> <p>Download baks KiCAD project</p> <p>Download baks_joint2_traces.png</p> <p>Download baks_joint2_traces_exterior.png</p> <p>Download baks_joint2_holes_interior.png</p> <p>Download motor control code</p>"},{"location":"final-project/effector.html","title":"End effector","text":"<p>I asked my instructor \u00de\u00f3rarinn whether he could show me how to make an electromagnet, so that baks the robot arm could pick up small metal things. I expected to need to find a suitable iron core and wrap copper wire around it, and that it would be a half-day thing. I had no idea it could be a 5 minute thing!  </p> <p>\u00de\u00f3rarinn got a choke coil from the electronics inventory, tried a few different voltage and current combinations, and voil\u00e1! We can lift a small bearing ball!</p> <p>Then we tried soldering three choke coils together to see if the holding strength would increase:</p> <p>It did, you can't shake the ball off! But the current requirements might be too high for a USB port-powered robot.</p>"},{"location":"final-project/electronics.html","title":"Electronics Design","text":"<p>A completed Baksi board.</p> <p>Since both the SimpleFOC motor control library and the OSAP network layer library were able to compile onto the SAMD21 chip by pretending that it's an Arduino Nano 33 IoT, that's what I'm going with. Now I need to go into the schematic of this Arduino to see its pin definitions:</p> <p>The Arduino 33 IoT schematic. Let's see what we have here.</p> <p>The SPI communication wires from the AS5048 magnetic angle sensor are as follows:</p> <pre><code>black, pin 1, CSn\nblue, pin 2, CLK\nyellow, pin 4, MOSI\ngreen, pin 3, MISO\nred, pin 11, VDD5V\nwhite, pin 13, GND\n</code></pre> <p>SPI connections to the breadboard Modular Thing.</p> <p>Let's start with MOSI. That's pin PA16 on the Arduino Nano 33 IoT. I'll put the yellow wire there on the breadboard Modular Thing. Then MISO is pin PA19. I'll put the green wire there. Through all this tinkering I've learned that CLK is the same as SCK. That's pin PA17 and the blue wire goes there. Csn, or the chip select pin, can be assigned to any digital pin. I'll put on PA18 (the black wire). Then all that's left is +3.3 volts and ground.</p> <p>And here's the test:</p> <p>I'm getting an angle reading in the serial monitor! How cool is that?</p> <p>OK, let's connect the motor driver. For that we need PWM. According to the schematic above, the PWM pins on the Arduino Nano 33 IoT are as follows:</p> Arduino 2 3 5 6 9 10 11 12 16/A2 17/A3 19/A5 SAMD21 PB10 PB11 PA05 PA04 PA20 PA21 Not on schematic Not on schematic PA11 PA10 PB09 <p>On the the breadboard Modular Thing I only have access to PA pins. Let's try PA4, PA5 and PA10 for PWM and PA6 as the enable pin. In the Arduino code I'll set pins 6, 5 and 17 to output PWM and let pin 7 be the enable pin.</p> <p>After uploading the <code>angle_control.ino</code> sketch, the motor twitched a little bit and I got the following messages in the serial monitor:</p> <pre><code>MOT: Enable driver.\nMOT: Align sensor.\nMOT: Failed to notice movement\nMOT: Init FOC failed.\nMotor ready.\n</code></pre> <p>I must have mixed up some of the motor driver pins. Let's add my LED testing board to the circuit:</p> <p>No PWM on the brown wire.</p> <p>The enable pin turns on first (white wire) and then PWM starts on the yellow and orange wires. The brown wire (the third BLDC phase) gets no PWM signal. Aha! I still have digital pin 9 in the code, which applies to PA20! That's how I first wrote the code, but I then discovered that PA20 isn't broken out on the breadboard Thing. Alright, I'll change the third PWM pin from 9 to 17, which matches PA10, and see what happens.</p> <p>Now I'm getting PWM signals on all three phases, but the motor shakes like crazy. I wonder if I accidentally wired the phases in the wrong order. Nope, that isn't helping. I'll try removing the LED test board, since I'm done with that for now. And that was all it took! I have a smooth, responsive servomotor controlled by a bare SAMD21 chip! I won't upload a video of that, because my repository is getting quite big.</p> <p>This is it. Now I can design my board.</p>"},{"location":"final-project/electronics.html#pcb-schematic-design","title":"PCB schematic design","text":"<p>I added some electronic parts to a blank schematic. I used the RGBB Modular Thing as a reference design, to see which passive parts the microcontroller needs. I want to have an RGB status LED on the robot's 'forearm' and also a button to disengage the motors and record movements.</p> <p></p> <p>I can see that the Modular Things follow the SAMD21 datasheet and put a 10uF decoupling capacitor on VDDIN (the +3.3V input voltage) and a 1uF decoupling capacitor on VDDCORE (the 1.23V core logic voltage of the chip, provided by an internal regulator):</p> <p>I don't know what decoupling capacitors do, but it's nice to verify the design using this table in the microcontroller datasheet.</p> <p>Then I started on the motor controller. I used the SimpleFOC Mini as a reference design. One of the goals of the SimpleFOC Mini is to:</p> <p>Make it in a way to be a minimal working example for users that are interested to build their own boards based on the DRV8313 chip.</p> <p>-Antun Skuric, creator of the SimpleFOC library</p> <p>The SimpleFOC Mini is a two-layer board, but I want to make a one-layer board. Fortunately I'm not using all the pins on the motor controller, so I can simplify the design:</p> <p>The DRV8313 motor driver has a 3.3 V regulator to run a microcontroller, but it only supplies 10 mA, which is not enough for me. So I'll skip that pin.</p> <p>On second thought, after reading about the pins that I haven't been using, I'm changing my opinion. I would like to be able to </p> <p>The DRV8313 motor driver wasn't in the KiCAD library or in the fab library, but I found it on SnapEDA. But I quickly ran into a problem with it:</p> <p></p> <p>Pins 4 and 11 are superimposed. They are both VM, but on the SimpleFOC Mini schematic, they are connected differently. So I needed to right click the symbol and select Edit with Symbol Editor. Fortunately, all I had to do there was to move one of the pins:</p> <p></p> <p>I also moved the three superimposed GND pins apart, so that I could read the pin numbers.</p> <p></p> <p></p> <p>I used this layout example heavily when reviewing my design.</p>"},{"location":"final-project/electronics.html#pcb-routing","title":"PCB routing","text":"<p>I had to put eight jumper resistors in order to route this board on one layer. I also route the USB, power and SPI wires through the 3D printed layer that is sandwiched between the two PCBs in each joint. I look forward to redesigning the board for manufacturing at a board house, with 2-4 layers. That should make things considerably easier. But I am glad that I managed to design a version of the board that can be made in any Fab Lab on a single-layer PCB, because not everyone is skilled at making double-layer PCBs (myself included).</p> <p>Let's just put a wire that goes on the back side of the PCB. No one will know.</p>"},{"location":"final-project/electronics.html#pcb-design-review","title":"PCB design review","text":"<p>Now let me go over the schematic and PCB layout and see if everything checks out:</p>"},{"location":"final-project/electronics.html#microcontroller","title":"Microcontroller","text":"<ul> <li> USB (I didn't check whether the data lines are equally long. Let's hope for the best!)</li> <li> 3.3V regulator (PCB layout didn't match schematic, fixed now)</li> <li> Button</li> <li> RGB LED</li> <li> JTAG programming connector and associated passive components (Oh no: SWDCLK trace is routed under JTAG connector! Looking at the JTAG connector, this seems impossible. Time for another jumper resistor.)</li> <li> SPI connections to the magnetic angle sensor</li> <li> Decoupling capacitors for the microcontroller</li> <li> Rest of the microcontroller connections</li> </ul>"},{"location":"final-project/electronics.html#motor-driver","title":"Motor driver","text":"<ul> <li> Motor power input</li> <li> Power indicator LED</li> <li> FAULT, RESET and SLEEP on the motor driver</li> <li> Bulk capacitor and bypass capacitors for motor (One bypass cap wasn't connected to ground! Fixed now.)</li> <li> PWM signal wires between microcontroller and motor driver</li> <li> ENABLE wires and resistor</li> <li> Rest of motor driver connections (Two motor outputs routed under jumper resistor. Not good. The two VCC pins on the motor driver weren't connected together. They clearly need to be, according to the layout example. Fixed with a trace underneath the BLDC motor. Must remember to cut some vinyl to insulate the motor from this +10V power trace. The layout example has resistors going between ground pins. The SimpleFOC Mini schematic has no such resistors. It worked on the breadboard, so I'll skip the resistors. I've run out of room on the PCB! One more thing that I changed from the SimpleFOC schematic, is that I'm connecting COMPO to ground, as the motor driver datasheet shows. I also tried to connect NC to ground, but NC means Not Connected and it doesn't want to connect to anything. Both the datasheet and the SimpleFOC Mini schematic connect the +3.3V output from the motor driver to FAULT, RESET and SLEEP, to pull them up. I just don't have space for that. I'll just mill the PCB and if the 3.3V supply from the microcontroller doesn't do the trick then I'll just have to solder a wire to the board afterwards. Let's go!)</li> </ul> <p>I had to stop milling the board and start again, because I forgot one of the comments I made in the last item on the Motor driver checklist. A very important comment that I've now italicized. So I fixed the PCB layout as follows:</p> <p>I realized that after going through the checklist and making the necessary changes, I didn't need those two jumper resistors anymore. I was also able to move the VCC track out from underneath the motor.</p>"},{"location":"final-project/electronics.html#final-design","title":"Final design","text":"<p>The baksi robot joint schematic.</p> <p>The baksi robot joint PCB layout.</p>"},{"location":"final-project/electronics.html#pcb-production","title":"PCB production","text":"<p>My first attempt at milling the PCB failed, and I broke the smallest end mill (the 0.01\" one). I only have one left now. Looking back, I made the fundamental mistake of not making a small test of the most challenging aspect of the process. I'm going to try a V-bit now.</p> <p>When soldering the teeny tiny DRV8313 motor driver onto my beautiful board, I found that its legs are very thin and flexible, and so when you've fastened the driver to the big ground plane with a heat gun, you can bend the legs into place, as long as they're close to their intended copper pad.</p> <p>After soldering, I successfully put the bootloader on the SAMD21 chip and then programmed it with the SimpleFOC code. But I got no reading from the magnetic angle sensor and the serial monitor said that it detected no movement from the motor. The motor sounded weird.</p>"},{"location":"final-project/electronics.html#sensing-board","title":"Sensing board","text":"<p>I also made a sensing board for Baksi. It contains an endstop button for the Z-axis as well as a capacitive step-response proximity sensor, so that it can sense when a human gets too close, and stop moving. The big copper area on the board is the proximity sensor. The board has a Xiao SAMD21 module, which has nice analog-to-digital converters.</p> <p></p> <p></p> <p></p> <p>I had a little trouble finding the right pin names for the Seeeduino Xiao SAMD21. In the first place, when I first connected it, it was set up as a Seeeduino Femto. I couldn't find much info on that online. I tried uploading an Arduino sketch to it as a Seeduino Xiao SAMD21, but it got bricked and didn't show up on my computer anymore. Not in the Arduino IDE and not in Device Manager either. </p> <p>After a bit of Googling I found the solution to this problem. I shorted the connection between the RESET pads on one side of the Xiao's USB connector and it immediately appeared on my computer as a UF2 drive. I then tried uploading the same Arduino sketch to it as a Xiao Femto, and it worked.</p> <p>But what's the pinout of the Xiao Femto? I tried the Xiao SAMD21 pin numbers but they didn't work. I also tried my Blink all pins sketch, where I make every pin from 0 to 40 blink once and write its number to the serial monitor at the same time. </p> <p>I connected each pin to an LED on my LED debugging board to discover the pin numbers.</p> <p>But now the problem was that after uploading, the device disappeared and so I couldn't get data from it through the serial port. So I tried blinking the LED as many times as the number of the pin that I was testing, After a good wait, I counted twelve blinks on my red LED. Here's a video of my debugging method:</p> <p>I've discovered pin number 6!</p> <p>Here are all the pin numbers that I wrote down (I recorded a fourteen-minute long video and played it back to get all the pin numbers):</p> <p></p> <p>Is there a similarly simple way to find the pin numbers of my button and capacitive sensing pad?</p> <p>The sensing board is integrated into Baksi but it doesn't turn on. I seem to have misunderstood how the power works on the Xiao module. I thought that I could power it through the 5V pin, but that seems to only offer 5V out. I probably need to change the connections and power the Xiao through the USB connector. This is where Baksi's sensing board stranded.</p>"},{"location":"final-project/electronics.html#design-files","title":"Design files","text":"<p>Download baks KiCAD project</p> <p>Download baks_joint2_traces.png</p> <p>Download baks_joint2_traces_exterior.png</p> <p>Download baks_joint2_holes_interior.png</p>"},{"location":"final-project/embedded_programming.html","title":"Embedded programming","text":""},{"location":"final-project/embedded_programming.html#modular-things","title":"Modular Things","text":""},{"location":"final-project/embedded_programming.html#rgbb-thing","title":"RGBB Thing","text":"<p>To get into Modular Things, I first tried to get the rgbb board to work. I managed to put a bootloader onto the SAMD21E18A chip on the rgbb board. I downloaded edbg to C:\\code\\SAMD21, opened the Command Prompt there by typing <code>cmd</code> into the folder's address bar, and ran the following string of commands:</p> <pre><code>C:\\code\\SAMD21&gt;edbg-windows-r54 -bpv -e -t samd21 -f sam_ba_Generic_x21E_SAMD21E18A.bin\nDebugger: ATMEL Atmel-ICE CMSIS-DAP J42700061250 1.0 (SJ)\nClock frequency: 16.0 MHz\nTarget: SAM D21E18A (Rev D)\nErasing... done.\nProgramming.... done.\nVerification.... done.\n</code></pre> <p>Wow! It worked! That was exciting.</p> <p>Then I put the Fab SAM core on the SAMD21 in the Arduino IDE (first I put a different core on it and the COM port disappeared).</p> <p>I connected it to the computer, opened up the web interface and after a bit of coding the red LED turns on when I press the button!</p> <p>The RGB diode was very dim, so my instructor \u00de\u00f3rarinn took to the electronics workbench, tested it, replaced it with a new LED and discovered that the current-limiting resistors were 10kOhm instead of the recommended 1kOhm. I got to try the soldering tweezers for the first time and boy, are they handy for removing components from a board!</p> <p>\u00de\u00f3rarinn lighting up the diodes with the bench power supply.</p> <p>You just grab the part with the hot tweezers and it comes off!</p> <p>\u00de\u00f3rarinn explained diodes on the whiteboard and I discovered that I've had anodes and diodes backwards all these years! No wonder I was never particularly good at calculating electrical circuits. My wife also has this backwards. We think that the confusion comes from Chemistry class in school, because the anode on a chemical battery is not defined by which way the current is flowing, but by which type of reaction is going on there. The current goes in one direction when the battery is being charged and in the opposite direction when the battery is being discharged. But the anode and cathode don't switch places accordingly. I find this annoying.</p>"},{"location":"final-project/embedded_programming.html#design-file","title":"Design file","text":"<p>Download RGBB Modular Thing code</p>"},{"location":"final-project/embedded_programming.html#stepper-thing","title":"Stepper Thing","text":"<p>I was happy to get the rgbb board working, but then the stepper Modular Thing that I made suddenly stopped working. </p> <p></p> <p>I sent Quentin Bols\u00e9e the image above and asked him if he knew what the errors meant. But before he could reply, I remembered something that \u00c1rni Bj\u00f6rnsson had showed me. Apparently, the pin assignments have changed in the latest Modular Things code for the RP2040 board. I reverted them back to the original ones, and the stepper worked!</p> <p></p>"},{"location":"final-project/embedded_programming.html#design-files","title":"Design files","text":"<p>Download Stepper H-bridge RP2040 Modular Thing Arduino code</p> <p>Download svavar-rgbb.js</p>"},{"location":"final-project/embedded_programming.html#my-bldc-thing","title":"My BLDC Thing","text":"<p>I tried to make a BLDC Modular Thing using the instructions in the Modular Things repository. </p> <p>I added bldc to the list of constructors in ModularThingClient.ts.</p> <p>I also added this line to ModularThingClient.ts.</p> <p>I got an error that I couldn't figure out:</p> <pre><code>Parse failure: Unexpected token (3:33)\nContents of line 3: export default function bldc(name: string) {\nFailed to load url ../osapjs/osap (resolved id: ../osapjs/osap). Does the file exist?\n error   Parse failure: Unexpected token (3:33)\n  Contents of line 3: export default function bldc(name: string) {\n  File:\n    C:\\code\\modular-things-main\\C:\\code\\modular-things-main\\node_modules\\vite\\dist\\node\\chunks\\dep-5e7f419b.js:51642:15\n  Stacktrace:\nError: Parse failure: Unexpected token (3:33)\nContents of line 3: export default function bldc(name: string) {\n    at ssrTransformScript (file:///C:/code/modular-things-main/node_modules/vite/dist/node/chunks/dep-5e7f419b.js:51642:15)\n    at ssrTransform (file:///C:/code/modular-things-main/node_modules/vite/dist/node/chunks/dep-5e7f419b.js:51617:12)\n    at Object.ssrTransform (file:///C:/code/modular-things-main/node_modules/vite/dist/node/chunks/dep-5e7f419b.js:60941:20)\n    at loadAndTransform (file:///C:/code/modular-things-main/node_modules/vite/dist/node/chunks/dep-5e7f419b.js:39336:24)\n\nFailed to load url ../osapjs/osap (resolved id: ../osapjs/osap). Does the file exist? (x2)\n</code></pre> <p>I don't have more time to try to understand this system, so I'm going to leave it at that for now.</p>"},{"location":"final-project/embedded_programming.html#design-files_1","title":"Design files","text":"<p>Download failed BLDC Modular Thing code</p> <p>Here's the most promising step towards integration of SimpleFOC with OSAP (the networking layer that communicates with the Modular Things web interface). I managed to hard code a motor command in the Arduino code. It worked. This means that I don't need to run the SimpleFOC Commander communication protocol in order to make the motor work, I should be able to swap it out for OSAP and send motor commands as strings over serial:</p> <p>Download hardcoded SimpleFOC command code</p>"},{"location":"final-project/embedded_programming.html#simplefoc","title":"SimpleFOC","text":"<p>The SimpleFOC motor control library works when I use Xiao SAMD21 modules, but when I design my boards, I'd like to use the bare SAMD21E18A chip. I ran into an issue compiling the motor control code to the bare chip and asked for help on the SimpleFOC community forum:</p> <p>Error compiling to SAMD21 (bare chip) - SimpleFOC Community</p> <p>I got a very helpful answer from @AdinAck. Adin made a brushless DC motor control board with a SAMD21 chip running the SimpleFOC library. When programming the chip, he told the Arduino IDE that he was programming an Adafruit Feather board. All he had to do was to design the board so that it conformed to the Feather, and everything worked!</p> <p>So I tried to upload the motor control code to the rgbb Modular Things board by telling the Arduino IDE that I was uploading to a MattAirTech Xeno Mini. No luck. Then an Arduino MKRZERO. That didn't work either. Then an Arduino MKR1000. Nope. I was just randomly trying different boards and finally tried the Arduino Nano 33 IoT. It worked! I even got serial output from it:</p> <p>All I get is errors and zeroes, because there is no motor and no angle sensor connected to the MCU. But I'm happy, because the code compiled!</p> <p>Then I checked if I could upload the Modular Thing code to the SAMD21 chip under the pretense that it was an Arduino Nano 33 IoT. That worked too!</p> <p>I even got a 'false' response from the button (in the bottom right corner). Aw yeah!</p> <p>Next, I soldered the necessary parts onto the breadboard Thing and connected it up to the LED test board that I made in Electronics Production week. I wrote a loop that blinks every pin on the IC and sends the corresponding pin number to the serial port. With this I was able to identify which pin in the Arduino Nano 33 IoT board definition applied to which pin on the IC itself.</p>"},{"location":"final-project/embedded_programming.html#design-file_1","title":"Design file","text":"<p>Download Blink_all_pins.ino</p>"},{"location":"final-project/ideas.html","title":"Final Project","text":"<p>I have three ideas for a final project: A robot arm, a wake-up mask and a digital stirring stick that tells me when to press down with the French press to get a perfect brew. Let's go through them one by one, with illustrations made in MS Paint.</p>"},{"location":"final-project/ideas.html#idea-1-baks-the-robot-arm","title":"Idea 1: baks the robot arm","text":"<p>I want to make a robot arm. I realize that this is not a particularly original idea, but I just dig robot arms. I want to call it baks, which is the noun version of the Icelandic verb baksa, which means to 'busy oneself' or to 'be industrious', usually in the context of toddlers playing energetically outside, digging and dragging logs about and throwing rocks.</p> <p>Here's a video where I describe the final project to Neil Gershenfeld during random review.</p>"},{"location":"final-project/ideas.html#a-bit-of-history","title":"A bit of history","text":"<p>I backed the original uArm on Kickstarter and enjoyed using it until I accidentally connected the power supply directly to the Arduino instead to the uArm Shield. The plan was to have it fry doughnuts and frost them but the arm ended up getting fried instead. The software part also intimidated me.</p> <p>In one of the courses in my Mechanical Engineering degree, the task was to pick up a wine glass and give the professor a sip. The rationale behind it was to think about solutions for people with Parkinson's disease. My group put a lot of work into making a robot arm with a soft 3D printed hand that I found on Thingiverse. We converted an old theatre light (if you find one, they're a treasure trove, this one had 13 stepper motors). I designed and 3D printed all the custom components and the arm worked.</p> <p>But then I wanted an arm that can do more than one thing. When Fab Lab \u00cdsafj\u00f6r\u00f0ur needed something to impress the President of Iceland and the First Lady, Kar\u00edtas at Fab Lab Sau\u00f0\u00e1rkr\u00f3kur was kind enough to loan us a Niryo One, a 3D printed educational robot arm based on steppers and Dynamixel servos. I programmed the robot to hand the First Lady a laser cut business card, and had great fun experimenting with the robot. Then I fried one of its servo motors when a cable connector got stuck and the robot kept trying to move to its intended position. I managed to swap out the motor, but I thought that surely there's an improvement to be made here. </p> <p>Since educational robot arms seem to be mostly used to move colored cubes around, I think it's OK to scale them down and simplify them to make them less expensive and more accessible. I'd like to base my arm on brushless motors without any gearing, and use springs to balance it, just like the Anglepoise lamp. Then it's nimble and can't damage anything. It won't be able to lift much, but that's OK! I only want it to lift a paint brush or a colored cube.</p>"},{"location":"final-project/ideas.html#outline-of-the-idea","title":"Outline of the idea","text":"<p>Since I have a history of frying robot arms, I have a few personal design goals for my arm.</p> <ul> <li>Cannot hurt itself or the user</li> <li>Easily programmed by moving the arm and saving keypoints and paths</li> <li>Small</li> <li>Cheap</li> <li>Precise enough to paint candles</li> </ul> <p>The last point warrants a little explanation. Kertah\u00fasi\u00f0 in \u00cdsafj\u00f6r\u00f0ur manufacture candles in the shape of known buildings in the town and now around the country. It was started by a couple who were on parental leave but the money wasn't enough to live on. So they came to \u00de\u00f3rarinn at Fab Lab \u00cdsafj\u00f6r\u00f0ur and he helped them mold and cast the first candle houses. He was able to do this because of his experience at the Fab Academy. This was only last year, but their product offering now counts dozens of different designs. Every time they make a new design, the model is 3D printed here at Fab Lab \u00cdsafj\u00f6r\u00f0ur and S\u00e6d\u00eds and Gunnar make a silicone mold in their workshop. It's been a great collaboration. But hand painting the candles is a lot of work, so I wonder if it's possible to make a small, inexpensive and easy to use robot arm to paint the candles for them.</p>"},{"location":"final-project/ideas.html#idea-2-wake-up-mask","title":"Idea 2: Wake-up mask","text":"<p>I live in \u00cdsafj\u00f6r\u00f0ur, and that means that when writing this, I have not seen the sun for two months. Last fall I found that waking up with my younger son became significantly harder as the sun came out later in the day. Then the sun disappeared altogether. The Seasonal Affective Disorder acronym seems apt: the mood is SAD. I want to get more light in the dark winter months, especially to wake me up naturally in the morning. I absolutely love the artificial sun by DIY Perks and I want to make one, but I'm not sure where to put it. Maybe in a big floor lamp similar to the Arco, but then the liquid coolant would need to be piped all the way between the stand and the light. I'll keep that one in my little black book of ideas for now.</p> <p>Since my wife feeds the baby during the night, I take him upstairs when he wakes up early in the morning. That way we can share the sleeplessness. But this means that I can't use a sunrise alarm clock, because I don't want to wake up my wife and my older boy. </p> <p>I wonder if a wake-up mask could work. I could take a sleeping mask and add a few LEDs that shine into my eyes for about ten minutes before my alarm sounds. Use a WiFi enabled microcontroller to sync the sunrise to the alarm clock on my phone. That's probably the most difficult part, but it would make it easy to use.</p>"},{"location":"final-project/ideas.html#idea-3-ph-pal-for-the-french-press","title":"Idea 3: pH pal for the French Press","text":"<p>On my parental leave last fall, I wondered if I could use a pH meter to tell me exactly when to press down to make perfect French Press coffee every time. From experience (and reading online) I knew that with too short a brewing time the coffee becomes acidic and when you brew for too long, the coffee becomes bitter. So to get a baseline reference, every morning with my baby boy, I logged the quality of my morning cup.</p>"},{"location":"final-project/ideas.html#french-press-log-started-july-30-2022","title":"French press log started July 30 2022","text":"<ul> <li>Acidic:     </li> <li>Balanced:     </li> <li>Bitter:     </li> </ul> <p>(I made the tally marks in Inkscape, by the way.) I found that the coffee grounds get more acidic as they age. As I don't have a coffee grinder, I buy ground coffee in bags that last for three to four weeks. In this experiment I found that freshly ground coffee only seems to be delicious for as long as a loaf of bread is: one day. Two days max. Those days I got great cups of coffee. So the result was not the one I wanted: Freshly ground coffee is much more important than pressing down at the right time. I also found that pourover or Vietnamese drip is makes a much better brew out of stale coffee grounds. Quite nice, actually.</p> <p>So there goes that idea, but I did find a source of low cost, high quality pH sensors and amplifiers. Believe me, this is cheap for what you get. To measure pH with the precision that you need to tell bitter coffee (pH 5.10) from acidic coffee (pH 4.85), your sensor amplifier needs to be isolated and well designed.</p> <p>Continuing the train of thought about coffee pH I also had the brilliant idea of putting a little bit of baking soda (which is basic) into the cup to 'fix' the coffee when it turned out acidic.</p> <p>I made the worst cup of coffee in history.</p> <p>A few people have encouraged me to make a prototype of the pH pal. Maybe later!</p>"},{"location":"final-project/ideas.html#update-after-fab-academy","title":"Update after Fab Academy","text":"<p>According to this video, the chemical compounds in coffee beans that control acidity and bitterness are separate, and they get extracted at different times. So a pH sensor will probably not give enough information to nail the brew every time. It's a short and excellent explanation, so I recommend the video if you're at all interested in this stuff. Seriously, it's the best explanation I've seen by far on this subject. And it also applies to tea. If you drink coffee or tea, go and watch the video, and share it with your friends.</p> <p>For my purposes, I suspect that I would need to train an artificial nose to get a good brew every time, assuming that I always use freshly ground coffee beans.</p>"},{"location":"final-project/integration.html","title":"System integration","text":""},{"location":"final-project/integration.html#usb-hub-communication","title":"USB hub communication","text":"<p>I was unsure how to connect all the robot joints together for a while. Jake Read shows I2C communication using his OSAP library. It would make for a nicely integrated whole, but the joints that have I2C connections might react more slowly than the one in the base, which would be directly connected to the full-speed USB port. So two weeks before the final presentation I ordered a tiny USB hub from a Swiss company called Yoctopuce. When it arrived I was eager to see if it worked and whether it was able to supply enough current to two motors at the same time. So I took my bike over to Hamraborg, bought a USB-C cable, cut it in half and soldered the wires to connectors that I ordered with the USB hub. And here I am running two BLDC motors from one USB port on my laptop (note that this is a special 3A port with a battery charging logo on it):</p> <p>Now the whole thing works on a breadboard. Whew!</p>"},{"location":"final-project/integration.html#power-budget","title":"Power budget","text":"<p>A bit later I realized that I hadn't checked whether that single USB-C port on my laptop could support all the motors and things that I wanted to build into the arm. So I bought another USB-C cable, cut it in half and connected more motors. And here I have three brushless motors and one stepper motor running on one USB-C port at the same time:</p> <p>Instead of the stepper motor I'll actually be using a tiny DC motor as a Z-axis, and I also need to power an end effector.</p>"},{"location":"final-project/integration.html#assembling-a-robot-joint","title":"Assembling a robot joint","text":"<p>The night before my final project presentation, I assembled one robot joint and managed to hide all the wires. Here it is running a PID cascade control loop using the SimpleFOC library:</p> <p>Phew, it works!</p>"},{"location":"final-project/integration.html#design-file","title":"Design file","text":"<p>The motor control code is the same as in Motor Control.</p>"},{"location":"final-project/interface.html","title":"Interface","text":""},{"location":"final-project/interface.html#my-own-things","title":"My own things","text":""},{"location":"final-project/interface.html#python","title":"Python","text":"<p>I tried the PhysicalPixel example that is built into the Arduino IDE and modified it to send commands to the motor. </p> <p>In the video below I am controlling the motors with Python through two serial ports at the same time. The left motor rotates twice and the right motor rotates once.</p>"},{"location":"final-project/interface.html#design-files","title":"Design files","text":"<p>Here is the Python code that I used to control two motors at the same time:</p> <p>Download SimpleFOCprompt-2motors.py</p>"},{"location":"final-project/interface.html#browser-based-interface","title":"Browser-based interface","text":"<p>I found a fantastic example of using WebSerial in Py-Script and tried to run it locally. I got the error:</p> <pre><code>Access to Image from origin 'null' has been blocked by CORS policy\n</code></pre> <p>I found that this is because the code can only be run on a server. I tried to set up a local server using web.py but that didn't work and then I tried uploading the example to my website but the MkDocs system dindn't allow me to access the page. Then I found this tutorial on how to deploy a Py-Script app to GitHub Pages. That was easy, it's just a matter of creating a repository, uploading the files and going into settings and enabling deployment:</p> <p>The repository itself is under the Code tab. Go into the Settings tab, select Pages in the left menu and under Build and Deployment select <code>main</code>, <code>root</code> and click Save. As long as the repository has a file called index.html, the site is now live!</p> <p>Here's a link to the two motor control interface: baks</p> <p>Here I'm connecting to a COM device and sending it the command T12, which means 'Turn by 12 radians', or just about two rotations:</p> <p>It works! I couldn't be more excited! I'm getting close to having the full stack of technologies working. And the interface is live on the web!</p> <p>I made some very rough modifications to the code and managed to connect to two COM ports and control two motors:</p>"},{"location":"final-project/interface.html#design-files_1","title":"Design files","text":"<p>Here are the two files that you need to host on a  web server to make my rough baks serial communication portal work:</p> <p>Download index.html</p> <p>Download webSerialDemo.py</p> <p>In both cases, the motor control code is the same as in Motor Control.</p> <p>I've also found a way to embed the interface into this web page. You can use this to connect to any serial device and send it commands. The buttons only render as text, and there's only one input field, after \"Write to another serial port:\"</p> <p> Open a Serial Port Open another Serial Port Write to the serial port: Write to another serial port: </p>"},{"location":"final-project/interface.html#modular-things","title":"Modular Things","text":"<p>When I had the rgbb board and the stepper board working, I managed to make them interact with the following code (I named the stepper after myself):</p> <pre><code>Svavar.setCurrentScale(0.3);\nSvavar.setVelocity(200);\nSvavar.setAccel(40);\n\nvar val = 0;\n\nloop(async () =&gt; {\n  val = await led.getButtonState(0);\n  console.log(val);\n  led.setRGB(val,val,val);\n  let pos = 0;\n  if(val == true){\n  for (let i = 0; i &lt; 2; i++) {\n    pos = pos == 0 ? 5 : 0;\n    await Svavar.absolute(pos);\n  }\n  }\n}, 50);\n</code></pre> <p>The RGBB Modular Thing interacting with spiral 1 of my robot in the Modular Things web interface.</p>"},{"location":"final-project/interface.html#design-files_2","title":"Design files","text":"<p>Download the RGBB-baks Arduino code</p> <p>Download svavar-rgbb.js</p> <p>The motor control code is the same as in Motor Control.</p>"},{"location":"final-project/motor_control.html","title":"Motor Control","text":""},{"location":"final-project/motor_control.html#arduino-serial-monitor","title":"Arduino Serial Monitor","text":"<p>Here I'm sending one brushless motor commands from the Arduino serial monitor. I'm using the SimpleFOC Commander interface, which is a set of commands similar to G-code.</p>"},{"location":"final-project/motor_control.html#simplefoc-studio","title":"SimpleFOC Studio","text":"<p>I followed the setup instructions for SimpleFOC Studio. The link to the code repo is hidden in the website title.</p> <p>I got an error when trying to install the program using Anaconda. </p> <p></p> <p>I went to the SimpleFOC Discord server and saw that one other user had encountered this problem. I asked for help and someone recommended that I update Python to the latest version. I did that, but it didn't help. Then I went back into the terminal and looked at the command that I was using:</p> <pre><code>conda create -n simplefoc python=3.6.0\n</code></pre> <p>But I was running a more recent Python than 3.6.0! What if I don't say anything about the Python version? I tried:</p> <pre><code>conda create -n simplefoc\n</code></pre> <p>and it worked!</p> <p></p> <p>SimpleFOC Studio is up and running!</p> <p>I reported the successful command to the SimpleFOC Discord server.</p> <p>In SimpleFOC Studio, I tried changing the P, I and D values in the PID controller to see the difference that it made in the motion of the motor. Then I changed the values in the Arduino code that runs on my board. The PID controller still isn't particularly well-tuned, as SimpleFOC user AdinAck noticed in my final project presentation video.</p> <p>There was one glitch in the program when I first opened it; every time I gave the motor a command to move, it immediately moved back to T0. This behavior stopped when I closed the program and opened it again. I mentioned this on this SimpleFOC Community forum thread:</p> <p>There\u2019s a ghost in my GUI - SimpleFOC Community</p>"},{"location":"final-project/motor_control.html#design-file","title":"Design file","text":"<p>Here is the motor control code that runs on the SAMD21 chip and uses the SimpleFOC library. I used this code in all the other parts of the final project.</p> <p>Download motor control code</p>"},{"location":"final-project/overview.html","title":"Final project overview","text":""},{"location":"final-project/overview.html#baksi","title":"Baksi","text":"<p>My final project in the Fab Academy is Baksi the educational robot:</p> <p>The name Baksi comes from the Icelandic verb baksa - to busy oneself. In my concept sketch the name was Baks, but then my son always called it Baksi.</p> <p>Baksi is meant to be small, inexpensive, simple and safe. You can see all the electronics, and yet it has a clean look. And you can make one from scratch in a Fab Lab.</p> <p>You can check out the fun 1 minute presentation video on the Presentation page and I've documented Baksi's development on the other pages here on the left. This documentation is incomplete and unclear in some places. I'm going to leave it like that because this is what I did during the Fab Academy. New stuff is here.</p>"},{"location":"final-project/overview.html#design-spirals","title":"Design spirals","text":"<ol> <li>I went through design spiral 1 of Baksi the robot in Output Devices week. Those motor drivers didn't play well with the brushless motors.</li> <li>My final project counts as design spiral 2. It's a complete redesign using a bare SAMD21 microcontroller and a DRV8313 BLDC motor control chip for every joint. I'm very happy with it, but it's not ready for distribution.</li> <li>I've continued development on Baksi after I graduated from the Fab Academy. Design spiral 3 is in progress here. This time it will be made of motors and PCBs and nothing else! This version will be better documented, so that people can build and use a Baksi robot themselves.</li> </ol>"},{"location":"final-project/presentation.html","title":"Final Project Presentation","text":"<p>1 minute presentation video.</p> <p>Presentation slide.</p> <p>Baksi got on the 2023 list of highlighted Fab Academy projects and was included in the 2023 highlight video.</p> <p>Here I am presenting my final project to Professor Neil Gershenfeld and the instructors and students in the 2023 Fab Academy cycle. Link to the video.</p>"},{"location":"projects/baksi-software.html","title":"St\u00fad\u00ed\u00f3 Baksi software","text":"<p>The GUI for controlling Baksi the robot.</p> <p> Studio Baksi GitHub repository</p>"},{"location":"projects/baksi-software.html#development","title":"Development","text":"<p>I received a grant from the Icelandic Student Innovation Fund to hire a university student to make control software for Baksi the robot. Gu\u00f0j\u00f3n Bergmann, aerospace engineering student at TU Delft, had the job to create the BAKSI Python program during the summer of 2023. So I scrambled to finish building Baksi, graduated from the Fab Academy and immediately sent Baksi to Delft. </p>"},{"location":"projects/baksi-software.html#features","title":"Features","text":"<p>Gu\u00f0j\u00f3n got a lot further than I expected. He made a zoomable timeline where you can create, edit, copy and movement blocks and then you can save and load the whole file. He even figured out how to add PNGs of Baksi, to make it look nice. And when you play the motion in the GUI, the program sends commands to the joints in the arm via a USB serial connection. Currently, it also sends the commands when you're moving around the timeline with the mouse. When I've tuned up the PID controllers on the motors and got Baksi operational, it will be interesting to see Baksi try to follow quick scrubbing in the GUI in real time. I say scrubbing because video editors are the inspiration for this GUI, and scrubbing is the term for dragging a slider to quickly navigate through a video timeline.</p> <p>Gu\u00f0j\u00f3n made the GUI with PyQt5, which means that in theory, this set of Python scripts could be turned into a standalone program. I think fbs is probably the way to go to build a desktop app.</p> <p>Gu\u00f0j\u00f3n Bergmann.</p>"},{"location":"projects/baksi-software.html#why-not-ros","title":"Why not ROS?","text":"<p>My initial plan was that Gu\u00f0j\u00f3n would use ROS (Robot Operating System) to build the software, but a fellow student at TU Delft who works with ROS advised him against it. ROS is for much bigger and more complicated systems, and it is complicated in itself. ROS also needs a computer running Ubuntu, but Baksi only has microcontrollers and I don't want to add more cost to the robot for an unclear return. Jake Read, creative machine designer and PhD student at the Center for Bits and Atoms at MIT, also advised me not to use ROS for this project. </p>"},{"location":"projects/baksi-software.html#report","title":"Report","text":"<p>Download the St\u00fad\u00ed\u00f3 Baksi report</p>"},{"location":"projects/baksi.html","title":"Baksi the robot, version 3","text":"<p>This is where I continue development of Baksi the robot:</p> <p>Baksi on my MIT Machine Class page</p>"},{"location":"projects/bldc-modular-thing.html","title":"BLDC Modular Thing","text":""},{"location":"projects/bldc-modular-thing.html#final-version","title":"Final version","text":"<p>This work was finished during the 2024 Fab Academy Instructor Bootcamp in Le\u00f3n, Spain:</p> <p>Bootcamp page</p>"},{"location":"projects/bldc-modular-thing.html#overview","title":"Overview","text":"<p>Since I've learned to control brushless DC motors so well in my final project work, I thought I might make a BLDC motor control board that you can use in your projects. BLDCs can be really tricky to use with closed loop control. Hopefully this board will simplify your development with brushless motors, because they're great!</p> <p>Like Baksi the robot, this board uses the SimpleFOC Arduino library.</p> <ul> <li>Spiral 1: First I'm just going to make the board, and you can control it with any program that can send messages to a serial port.</li> <li>Spiral 2: Then I'd like to make the board work with Modular Things.</li> </ul>"},{"location":"projects/bldc-modular-thing.html#cad","title":"CAD","text":"<p>Ok, let's start with the shape of the board. It's square and quite small. It will be tricky to fit a Xiao module, the motor driver and associated components, and the connectors for the motor and the magnetic angle sensor on it. But it should be doable, I think.</p> <p>The Modular Thing footprint. Dimensions are in millimeters, taken from the Modular Things - Circuits repository. I'm using mirror constraints to position the holes.</p>"},{"location":"projects/bldc-modular-thing.html#inspiration","title":"Inspiration","text":"<p>I'm basing this design on the SimpleFOC Mini and the DRV8313 datasheet. I'm crossing out a few things from the SimpleFOC Mini schematic:</p> SimpleFOC Mini schematicOnly the essentials <p>The SimpleFOC Mini schematic.</p> <p>Let's get rid of all non-essential parts.</p> <p>The SimpleFOC Mini board is based on the reference design in the DRV8313 datasheet:</p> <p></p> <p>Here's an initial sketch of my board:</p> <p></p> <p>Actually, I was using the SimpleFOC Mini board in the breadboard version of my final project. The image above shows my (unfinished) first attempt at a schematic that simplifies the SimpleFOC Mini as much as possible. A few things are still missing; I need to pull up FAULT, SLEEP and RESET on the motor driver. I'm hoping that I can connect them all together to a digital pin that I'll set to HIGH. That would get rid of a few passive components on the board. I need to go over the SimpleFOC Mini schematic and add necessary components like the bulk capacitor.</p> <p>I need to reference the pin numbers on the Xiao SAMD21:</p> <p></p>"},{"location":"projects/bldc-modular-thing.html#voltage-problem","title":"Voltage problem","text":"<p>I ran into a problem with my final project because the DRV8313 motor driver only works at 8V and above. So I couldn't drive it directly from the USB port as I had planned. Fortunately, I had the foresight to order a step-up/step-down voltage regulator from Pololu, in case I needed to make some last-minute voltage changes. So I put the regulator module into the base of Baksi the robot, along with a 4 port USB hub, for communication with all the joints. </p>"},{"location":"projects/bldc-modular-thing.html#voltage-fix","title":"Voltage fix","text":"<p>When browsing the SimpleFOC Community forum I came across the Mosquito BLDC driver board, which uses the MS8313 motor driver, which seems to be a knockoff of the Texas Instruments DRV8313. The MS8313 datasheet is only in Chinese, but that isn't really a problem since all its functionality is a 1:1 copy of the DRV8313.</p> <p>I don't like using knockoff products because I know that developing something for the first time is at least ten times harder than copying it. However, the MS8313 driver operates between 1.8V and 36V, which is perfect for my application. I guess it doesn't take much to tempt me. Now I can get rid of the expensive step-up voltage regulator and run the BLDC motor directly from the 5V USB power supply. And the pinout is identical to DRV8313!</p> <p>I may also try USB-PD at some point, like this Modular Thing. I'll probably set the voltage using jumper resistors, rather than communicating with the USB-PD IC. </p> <p>Now let's try to put all this together in KiCAD.</p>"},{"location":"projects/bldc-modular-thing.html#progress","title":"Progress","text":"<p>Here's the current design. Like Baksi the robot, it doesn't have current sense. I might try to add a current sense resistor or two in the next design spiral.</p> <p></p>"},{"location":"projects/bldc-modular-thing.html#current-sensing","title":"Current sensing!","text":"<p>I looked more closely at the DRV8313 datasheet and discovered that it supports current limiting using a single low side resistor connected to all the motor phases. The motor driver uses a comparator to compare the measured voltage over the resistor to a reference voltage that needs to be supplied to the driver. It's very similar to how the Toshiba TB67H451FNG,EL H-bridge handles current limiting in Yuichi's Xiao_RP2040 Dual H-Bridge board. Nice!</p> <p>This isn't the kind of current sensing that you can use to enable torque control, but at least I can protect the USB port from damage. That's all I want for this board.</p> <p></p> <p>The Xiao SAMD21 module has one DAC output pin, which I I'd like to use as a voltage reference for the comparator inside the motor driver. The SAMD DAC Application Note supports this plan:</p> <p>A common use of DAC is to generate audio signals by connecting the DAC output to a speaker, or to generate a reference voltage; either for an external circuit or an internal peripheral such as the Analog Comparator.</p>"},{"location":"projects/bldc-modular-thing.html#mirrored-images-in-datasheet","title":"Mirrored images in datasheet","text":"<p>I've run into a problem with the schematic for BLDC control with current sensing. The PCB view in KiCAD didn't make sense to me and I didn't understand why. Then I noticed that the motor driver IC is mirrored in the current sensing schematic as compared to the recommended layout schematic. This seems a bit inconsistent.</p> <p>Since the recommended layout worked well in Baksi the robot, and the KiCAD footprint matches it, that is what I'm going to trust. Now I just need to mirror the current sensing schematic in order to be back on track.</p> <p>That's better.</p>"},{"location":"projects/bldc-modular-thing.html#trip-current","title":"Trip current","text":"<p>I will assume that the BLDC Modular Thing will be connected to a USB 3.0 or 3.1 port, which allows a 900 mA current at 5V. Let's use an upper limit of 0.8 A, to be safe.</p> <p>The motor driver has a comparator that can cut the power if the current goes over a certain threshold. Now to figure out what that threshold should be:</p> <p>If I use the 0.25 \u03a9 current resistor that we have at the lab, then I can calculate the necessary voltage on the motor driver's COMPN pin according to the DRV8313 datasheet:</p> \\[V_{COMPN} = I_{trip} \\cdot R_{sense} = 0.8\\text{A} \\cdot 0.25 \\Omega = \\underline{0.2 \\text{V}}\\] <p>The operating voltage of the SAMD21 chip in the Xiao module is supposed to be 3.3 V. I measured it to be 3.31 V. Then I can find the value that I put into the DAC with:</p> \\[\\frac{0.2 \\text{V}}{3.31 \\text{V}}\\cdot 1024 = 61.8\\] <p>I used the Xiao SAMD21 getting started guide to learn how to use the DAC. Then I modified the code to output a constant voltage level from pin A0:</p> <p><pre><code>#define DAC_PIN A0\n\nvoid setup() {\n  analogWriteResolution(10); // Set analog out resolution to max, 10-bits\n  analogReadResolution(12); // Set analog input resolution to max, 12-bits\n\n  Serial.begin(9600);\n}\n\nvoid loop() {\n  // The measured USB supply voltage is 5.188 V and the IC operating voltage is 3.310 V.\n  // 0.2V/3.31V * 1024 (or maybe 1023) = 61.8\n  // OK, so to get the right reference voltage out of the DAC, measure the 3.3V Xiao pin and put into the formula above\n  analogWrite(DAC_PIN, 62);\n\n  float voltage = analogRead(A1) * 3.3 / 4096.0;\n  Serial.println(voltage); // Print the voltage.\n  delay(100); // Delay 1ms\n}\n</code></pre> And I got rock solid 0.201 V out of pin A0:</p> <p>I can use the DAC instead of the voltage divider in the example circuit. That simplifies the PCB layout.</p>"},{"location":"projects/bldc-modular-thing.html#bom","title":"BOM","text":"<p>You need to order three things from three different places to make the BLDC Modular Thing:</p> <ul> <li>One MS8313 BLDC motor driver</li> <li>One GM2804 Gimbal Motor w/Encoder</li> <li>One Xiao SAMD21 from e.g. Seeed, Digikey or Amazon, if you don't already have one at your lab</li> </ul> <p>You also need to have a Dupont connector kit at your lab (see bottom of this page).</p> <p>Note</p> <p>The 470 nF capacitor is recommended in the DRV8313 datasheet, but it's not in the Fab Lab inventory. Fortunately, it's only there to filter out noise in the little 3.3V regulator inside the motor driver. So you can safely use the next capacitor size above it, which is 1 uF. We'll replace the 470 nF capacitor in the next update of the design files.</p> Part Count GM2804 Gimbal Motor w/Encoder 1 Xiao SAMD21 module 1 MS8313 motor driver 1 100 uF bulk capacitor with 6.3 mm diameter 1 470 nF capacitor 1 100 nF capacitor 2 10 nF capacitor 1 10 kOhm resistor 2 0.250 Ohm size 2010 resistor 1 0 Ohm jumper resistor 5 6 pin horizontal SMD pin header 1 3 pin horizontal SMD pin header 1"},{"location":"projects/bldc-modular-thing.html#design","title":"Design","text":"<p>The board uses a Xiao SAMD21 to receive angle readings from a magnetic sensor via SPI and send PWM and a few other signals to the motor driver. The schematic is based on the following example in the DRV8313 datasheet:</p> <p></p> <p>The motor driver has a comparator that measures the current going through the 0.250 Ohm resistor (R2 on the schematic below). If the current goes over a threshold, the motor driver shuts off. </p> <p>To adjust the current threshold, you need to supply a constant voltage to the COMPN pin on the motor driver. In the example above, that's done with a voltage divider (resistors R1 and R2 in the example schematic above). We're using the DAC on the SAMD21 to supply that voltage instead.</p> <p></p> <p>Note that the MS8313 motor driver that we're using is a clone of the Texas Instruments DRV8313. The MS8313 datasheet is only available in Chinese, but that driver is functionally identical to the DRV8313, so we can use the DRV8313 datasheet instead. Why are we using a clone? Because the original DRV8313 only starts operating at 8V. So to use that we need to add a step-up regulator (This one has been used successfully). The MS8313 can operate at 5V, so we can power the motor directly from USB.</p> <p>Here's the pinout of the Xiao SAMD21:</p> <p></p> <p>On the PCB below, all the motor driver connections are on the left side of the Xiao and all the SPI pins are on the right side. We're using socket connectors so that we can route the wires around the pads.</p> <p></p> <p>Here are more details about the development of this Thing.</p>"},{"location":"projects/bldc-modular-thing.html#programming","title":"Programming","text":""},{"location":"projects/bldc-modular-thing.html#arduino-code","title":"Arduino code","text":"<p>The Arduino code is mostly based on SimpleFOC examples, with DAC and a SLEEP pin added. </p> <ul> <li> <p>Get the SimpleFOC library for the Arduino IDE.</p> <p>Add the line</p> <pre><code>#define PinStatus int\n</code></pre> <p>to the top of the Arduino/libraries/SimpleFOC/src/communications/StepDirListener.h file as described in this SimpleFOC Community post.</p> </li> <li> <p>Get OSAP for the Arduino IDE.</p> </li> </ul>"},{"location":"projects/bldc-modular-thing.html#magnetic-angle-sensor","title":"Magnetic angle sensor","text":"<p>The AS5048 magnetic angle sensor has 14 bits of resolution. TThe SPI chip select pin on the AS5048 is connected to pin 7 on the Xiao, so the sensor is defined like this:</p> <pre><code>MagneticSensorSPI sensor = MagneticSensorSPI(7, 14);\n</code></pre> <p>Be careful with the SPI wires for the sensors. They should be like in the image at the top of this page. When the wires overlap, the signal sometimes gets messed up and the angle stops updating in the serial terminal. It took a little while to debug this mysterious problem. Plugging the board into a breadboard also messes with the SPI signal integrity.</p> <p>This is working code that reads the magnetic angle sensor and outputs the angle in radians to the serial monitor / serial plotter:</p> <pre><code>#include &lt;SimpleFOC.h&gt;\n\n// MagneticSensorSPI(chip_select_pin, bit_resolution)\nMagneticSensorSPI sensor = MagneticSensorSPI(7, 14);\n\nvoid setup() {\n  // monitoring port\n  Serial.begin(115200);\n\n  // initialise magnetic sensor hardware\n  sensor.init();\n\n  Serial.println(\"Sensor ready\");\n  _delay(1000);\n}\n\nvoid loop() {\n  // iterative function updating the sensor internal variables\n  // this function reads the sensor hardware and \n  // has to be called before getAngle\n  sensor.update();\n  // display the angle and the angular velocity to the terminal\n  Serial.println(sensor.getAngle());\n}\n</code></pre>"},{"location":"projects/bldc-modular-thing.html#motor-driver","title":"Motor driver","text":"<p>The motor driver is connected to the Xiao like this:</p> <pre><code>IN1 on the motor driver connects to pin 3 on the Xiao\nIN2 on the motor driver connects to pin 4 on the Xiao\nIN3 on the motor driver connects to pin 6 on the Xiao\nEN on the motor driver connects to pin 5 on the Xiao (enable)\n</code></pre> <p>So the BLDC motor is defined in the Arduino code like this:</p> <pre><code>BLDCMotor motor = BLDCMotor(7); // (This BLDC motor has seven pole pairs)\nBLDCDriver3PWM driver = BLDCDriver3PWM(3, 4, 6, 5);\n</code></pre>"},{"location":"projects/bldc-modular-thing.html#trip-current_1","title":"Trip current","text":"<p>We assume that the BLDC Modular Thing will be connected to a USB 3.0 or 3.1 port, which allows a 900 mA current at 5V. Let's use an upper limit of 0.8 A, to be safe.</p> <p>The motor driver has a comparator that can cut the power if the current goes over a certain threshold. Now to figure out what that threshold should be:</p> <p>If we use the 0.25 \u03a9 current resistor that we have at the lab, then we can calculate the necessary voltage on the motor driver's COMPN pin according to the DRV8313 datasheet:</p> \\[V_{COMPN} = I_{trip} \\cdot R_{sense} = 0.8\\text{A} \\cdot 0.25 \\Omega = \\underline{0.2 \\text{V}}\\] <p>The operating voltage of the SAMD21 chip in the Xiao module is supposed to be 3.3 V. We measured it to be 3.31 V. Then we can find a value between 0 and 1023 to put into the DAC:</p> \\[\\frac{0.2 \\text{V}}{3.31 \\text{V}}\\cdot 1024 = 61.8\\] <p>We used the Xiao SAMD21 getting started guide to learn how to use the DAC. Here's the code.</p> <pre><code>#define DAC_PIN A0\nvoid setup() {\n  analogWriteResolution(10);\n  analogWrite(DAC_PIN, 62);\n}\n</code></pre> <p>That's all you need to send a rock solid voltage of 0.2V to the COMPN pin on the motor driver.</p>"},{"location":"projects/bldc-modular-thing.html#sleep-pin","title":"SLEEP pin","text":"<p>Inside the void setup() loop, we set the SLEEP pin on the motor driver to HIGH to wake it up:</p> <pre><code>  pinMode(1, OUTPUT);\n  digitalWrite(1, HIGH);\n</code></pre> <p>The rest of the code is built from examples in the SimpleFOC library.</p> <p>Setting up the sensor</p> <p>Setting up the motor (contains info on zeroing)</p>"},{"location":"projects/bldc-modular-thing.html#javascript-code","title":"JavaScript code","text":"<p>Jake and Quentin explained the Javascript needed to make a new Modular Thing in a video call. Jake has recently updated Modular Things to make it easier to make new modules.</p>"},{"location":"projects/chat.html","title":"Chat with my docs","text":""},{"location":"projects/chat.html#result","title":"Result","text":"<p>This work was completed at the 2024 Fab Academy Instructor Bootcamp in Le\u00f3n, Spain:</p> <p>Bootcamp page</p>"},{"location":"projects/chat.html#overview","title":"Overview","text":"<p>I'm going to talk to my website (the one you're looking at) using a language model that runs on my laptop. The ultimate goal is to set up a web service that enables Fab Academy students to chat with the whole Fab Academy archive.</p> <p>What I've done so far:</p> <ul> <li> <p>I installed GPT4All on my Windows machine. It's easy, anyone can do it! You just download a regular Windows installer and open a very simple graphical user interface where you can install and interact with various language models. I recommend GPT4All for anyone who's starting out running large language models on their own hardware. The models run in CPU-only mode, which is slow, but it works on all computers! </p> <p>In GPT4All:</p> <ol> <li>I ran a tiny 3B parameter model called Mini Orca in GPT4All and it was terrible. It's a 1.84 GB download.</li> <li>Then I tried a bigger 13B parameter model called Snoozy and got more promising results, but still not dependable. Beware, it's a 6.86 GB download!</li> <li>I installed SBert (only a 43.8 MB download) to be able to use the LocalDocs feature in GPT4All. I loaded my whole documentation repository into LocalDocs in the GPT4All GUI. Easy. Then I asked Snoozy questions about things that I did in the Fab Academy. The answers weren't great. This is probably because LocalDocs is mostly a search function. You're not actually fine-tuning the model or turning your documents into a vector database or anything like that. Still, a useful result.</li> </ol> </li> <li> <p>Next, I installed Ollama in the Windows Subsystem for Linux. Ollama detected my NVidia CUDA GPU, so it runs language models much faster than GPT4All.</p> </li> <li>I ran a tiny 1B parameter model called tinyllama. It was as bad as Mini Orca.</li> <li>Now I'm trying to install PrivateGPT. I can use that to turn my docs into a vector database and that should result in higher quality responses from the language models.</li> <li>As part of the PrivateGPT effort I installed the <code>mistral</code> language model provided by Ollama on Ubuntu. Warning: The download is many gigabytes in size.</li> </ul> <p>Now let's go into the details. I asked all the language models the same set of questions, to be able to compare the results.</p>"},{"location":"projects/chat.html#attempt-1-ollama-in-linux-mint-running-in-a-virtual-machine-failed","title":"Attempt 1: Ollama in Linux Mint, running in a virtual machine (failed)","text":"<p>The first thing that I tried was to set up Ollama inside a virtual machine. Ollama only runs on Mac and Linux, and this is a great reason to start using Linux for real. The installation couldn't be simpler, I simply opened a terminal and typed</p> <pre><code>install ollama\nollama run tinyllama\n</code></pre> <p>Ollama installed fine, but Virtualbox doesn't have access to the computer's GPU. Ollama detected that and decided to run in CPU only mode. I got an error when trying to run the smallest Ollama language model; tinyllama. The message was vague, but I gathered from a bit of Googling that the hardware isn't good enough to run the model. That was disappointing.</p>"},{"location":"projects/chat.html#attempt-2-gpt4all-in-windows-chat-with-docs-not-very-good","title":"Attempt 2: GPT4All in Windows (Chat with docs not very good)","text":"Conversations Mini OrcaSnoozy test 1 (chatting with my repo)Snoozy test 2 (only the public folder) <p>I tried downloading the smallest model that it offers, Mini Orca. It's a 3 billion parameter model. It installed just fine and I was able to ask it some questions. It was a bit of a thrill to chat with something that lives on my laptop!</p> <ul> <li>Hello</li> <li>Hello! How may I assist you today?</li> <li>Please write a research and development grant application for a small educational robot arm</li> <li> <p>Sure, here's an example of a research and development grant application for a small educational robot arm:</p> <p>Title: Designing an Educational Robotic Arm for K-12 Students</p> <p>Introduction: The purpose of this project is to design and develop an educational robotic arm that will be used in the classroom to teach students about mechanical engineering, programming, and microcontroller technology. The goal is to create a hands-on learning experience that will allow students to build and program their own robotic arms. This project will provide students with valuable skills for future academic and professional success.</p> <p>Objectives: The objectives of this project are as follows: 1. Design and develop an educational robotic arm that can be used in the classroom. 2. Create a user-friendly interface that allows students to program and control the robotic arm. 3. Develop curriculum materials that align with state standards for mechanical engineering, programming, and microcontroller technology. 4. Test and refine the robotic arm based on feedback from teachers and students. 5. Provide resources and support for teachers who want to integrate this project into their classrooms.</p> <p>Methods: The methods used in this project are as follows: 1. Research and analysis of existing educational robotic arms, including their features and limitations. 2. Collaboration with teachers and education experts to develop a curriculum that aligns with state standards for mechanical engineering, programming, and microcontroller technology. 3. Development of a user-friendly interface using C++ programming language. 4. Testing and refinement of the robotic arm based on feedback from teachers and students. 5. Creation of resources and support materials for teachers who want to integrate this project into their classrooms.</p> <p>Conclusion: The design and development of an educational robotic arm will provide K-12 students with a hands-on learning experience that will help them develop valuable skills in mechanical engineering, programming, and microcontroller technology. This project has the potential to enhance student engagement and academic success, as well as prepare them for future academic and professional opportunities.</p> </li> <li> <p>Write Python code to communicate with a USB serial device</p> </li> <li> <p>Sure! Here's an example of how you can use the <code>usbserial</code> library in Python to communicate with a USB serial device:</p> <pre><code>import usb_serial\n\nser = usb_serial.Serial('/dev/ttyACM0', 9600, timeout=15) # replace 'device' and 'port' with the actual values for your device and port\n\nwhile True:\ndata = ser.readline().decode()\nprint(data)\ntime.sleep(1)\n</code></pre> <p>In this example, we are using the <code>usbserial</code> library to create a serial connection between our Python code and a USB serial device (in this case, a serial port on a Raspberry Pi). We then use a <code>while</code> loop to continuously read data from the device until it's time for us to stop. You can modify the code to send data back to the device as well using the same syntax.</p> </li> <li> <p>What is the Fab Academy?</p> </li> <li>The Fab Academy is an open educational program developed by the 3D Printing Company, 3D Systems. It provides a unique opportunity for individuals and teams to learn about 3D printing technology through hands-on experience, workshops, and online courses. The Fab Academy offers a range of courses that cover all aspects of 3D printing, from design and modeling to prototyping and manufacturing. Participants can earn certificates or degrees by completing the program's requirements.</li> <li>who is svavar konradsson?</li> <li>I'm sorry, but I couldn't find any information on a person named SVAVAR KONRADSSON. Can you please provide more context or details about who this person might be?</li> <li>who is svavar konradsson? (Now and in the prompts below I'm using LocalDocs to connect MiniOrca to my documentation repo)</li> <li>I'm sorry, but I couldn't find any information on a person named SVAVAR KONRADSSON. Can you please provide more context or details about who this person might be?</li> <li>how do you do i2c communication between at412 microcontrollers? (Note that I wrote ATtiny412 incorrectly, let's see how the model deals with that)</li> <li>To communicate with Atmel AT412 microcontrollers using I2C, you can use the following steps:<ol> <li>Connect the two Atmel AT412 microcontrollers to a single I2C bus using an I2C header on each controller.</li> <li>Power up both controllers and wait for them to initialize.</li> <li>Write a simple program that sends data from one controller to another. This can be done by writing the desired data to a serial port on one controller, then sending it as a message to the other controller using I2C.</li> <li>Read data back from the other controller using I2C. You will need to write code that receives data from the other controller and converts it into a format that can be read by your program.</li> <li>Use the received data in your program.</li> </ol> </li> <li>is the fab academy difficult?</li> <li>As an AI language model, I cannot provide subjective opinions or feedback on difficulty levels as it varies from person to person. However, the Fab Academy is designed for people with different backgrounds and skill levels, so it can be challenging if you are not familiar</li> <li>what's a good project for machine week in the fab academy?</li> <li>Hi! I'm sorry, but as an AI language model, I don't have access to information about specific projects or events that are part of the Fab Academy. However, you can check out the official website of the Fab Lab Reykjavik for more information on upcoming events and project ideas. You may also want to reach out to</li> <li>how do i use modular things?</li> <li>Hello! To use Modular Things in the Fab Academy, you can follow these steps:<ol> <li>Install the necessary software on your computer to communicate with the microcontrollers (such as the Arduino IDE).</li> <li>Write a program that sends data to the microcontroller using the serial port.</li> <li>Connect the microcontroller to the serial port and wait for it to initialize.</li> <li>Write a message to the microcontroller using Modular Things' built-in messaging system.</li> <li>Monitor the output of the microcontroller to see if the message was received correctly.</li> <li>Use the data from the microcontroller in your program.</li> <li>Repeat steps 1-6 for each message you want to send to the microcontroller.</li> </ol> </li> <li>How to make a silicone mold?</li> <li>To make a silicone mold in the Fab Academy, you can follow these steps:<ol> <li>Choose a pattern from a digital file or print it out.</li> <li>Cut out the pattern with scissors or a knife.</li> <li>Clean the edges of the pattern with rubbing alcohol and a soft cloth.</li> <li>Apply silicone to one side of the pattern, making sure not to touch any edges with your fingers.</li> <li>Place the other side of the pattern in the silicone mold, making sure it's flat against the sides.</li> <li>Press down on the pattern until it fills the mold, and then release pressure.</li> <li>remove the mold from the silicone by heating it with a hot knife or pliers.</li> <li>Clean the mold with rubbing alcohol and a soft cloth.</li> <li>Repeat steps 1-8 for each pattern you want to make a mold of.</li> </ol> </li> <li>how to make a resin casting in the fab academy?</li> <li>To make a resin casting in the Fab Academy, you can follow these steps:<ol> <li>Choose a pattern from a digital file or print it out.</li> <li>Cut out the pattern with scissors or a knife.</li> <li>Clean the edges of the pattern with rubbing alcohol and a soft cloth.</li> <li>Apply silicone to one side of the pattern, making sure not to touch any edges with your fingers.</li> <li>Place the other side of the pattern in the silicone mold, making sure it's flat against the sides.</li> <li>Press down on the pattern until it fills the mold, and then release pressure.</li> <li>Remove the mold from the silicone by heating it with a hot knife or pliers.</li> <li>Clean the mold with rubbing alcohol and a soft cloth.</li> <li>Repeat steps 1-</li> </ol> </li> <li>how do i calibrate a cnc machine?</li> <li>To calibrate a CNC machine, you can follow these steps:<ol> <li>Check the condition of the machine and make sure it's in good working order.</li> <li>Choose a suitable reference point or calibration target that is known to be accurate.</li> <li>Use the tool to create a mark on the workpiece</li> <li>Move the machine to the desired position where you want the part to be cut.</li> <li>Use the CNC system to program and execute the cutting operation.</li> <li>Record the data from the machine's sensors during the cutting process, including the feed rate, depth of cut, and tool position.</li> <li>Analyze the recorded data to identify any errors or discrepancies that may affect the accuracy of the part being cut.</li> <li>Use the CNC system to adjust the parameters of the cutting operation until the desired accuracy is achieved.9. Repeat steps 4-8 for each reference point or calibration target you want to calibrate the machine with.</li> <li>Document and store all relevant data, including the reference points and any adjustments made, for future reference.</li> </ol> </li> </ul> <p>I used the LocalDocs feature in GPT4All to ask my Fab Academy documentation website some questions. The answers were not very useful. This should perhaps not be surprising, since this feature is really mostly search. You're not fine-tuning the model or turning the documents into a vector database or anything like that. But it's quick and easy, and it's a start!</p> <ul> <li>What is the Fab Academy?</li> <li>The Fab Academy is an online program that offers a comprehensive education in digital fabrication, design and innovation. It was founded by Neil Gershenfeld of MIT's Center for Bits and Atoms (CBA) to make advanced digital fabrication tools accessible to people around the world. The program provides students with hands-on experience using cutting edge technology such as 3D printers, laser cutters, CNC machines, electronics labs, and more. Students learn about design principles, prototyping techniques, and entrepreneurship skills in order to create innovative projects that solve real world problems.</li> <li>Please write a research and development grant application for a small educational robot arm</li> <li> <p>Title of Project: Educational Robot Arm Development Grant Application</p> <p>Project Summary: The proposed project is the development of an affordable, easy-to-use educational robot arm that can be used in classrooms to teach students about robotics and automation. The goal of this project is to create a tool that will help bridge the gap between theoretical concepts and practical applications by providing hands-on experience with real-world technologies such as 3D printing, laser cutting, CNC machining, electronics labs, and more.</p> <p>Project Description: The proposed educational robot arm project is designed to provide students with a comprehensive education in digital fabrication, design, and innovation using advanced technology tools. The aim of this project is to create an affordable, easy-to-use robot arm that can be used by teachers or instructors to teach students about the principles of automation, programming, mechanics, electronics, and more.</p> <p>The proposed educational robot arm will consist of a modular design with interchangeable parts such as arms, grippers, sensors, motors, and other components that can be easily replaced or upgraded based on student needs. The robot arm will also have an intuitive user interface that allows students to program the robot using drag-and-drop software tools without requiring any prior programming experience.</p> <p>The proposed educational robot arm project is expected to benefit a wide range of students, including those interested in engineering, computer science, physics, and other STEM fields. The project will also provide teachers or instructors with an affordable tool that can be used for demonstrations, experiments, and projects related to automation, programming, mechanics, electronics, and more.</p> <p>Project Timeline: The proposed educational robot arm development grant application is expected to take approximately 12 months from start to finish. The project timeline includes the following milestones:</p> <ul> <li>Research and Development Phase (3 Months): This phase will involve conducting research on existing educational robots, identifying gaps in their capabilities, and developing a prototype design for an affordable, easy-to-use robot arm that can be used by teachers or instructors. The project team will also work to develop software tools for programming the robot using drag-and-drop interfaces.</li> <li>Prototype Development Phase (3 Months): This phase will involve building and testing a prototype of the proposed educational robot arm, refining its design based on feedback from students and teachers or instructors, and incorporating additional features such as sensors, motors, grippers, and other components that can be easily replaced or upgraded.</li> <li>Final Development Phase (3 Months): This phase will involve testing the final prototype of the proposed educational robot arm in classrooms to ensure it meets student needs and provides a valuable learning experience. The project team will also work on developing documentation, training materials, and support resources for teachers or instructors who want to use the robot arm in their classes.</li> <li>Deployment Phase (3 Months): This phase will involve distributing the final prototype of the proposed educational robot arm to schools and other organizations that are interested in using it as an educational tool. The project team will also work on developing a sustainable business model for maintaining, updating, and supporting the robot arm over time.</li> </ul> <p>Project Budget: The total budget required for this project is estimated at $100,000 USD. This includes expenses such as research and development costs, prototype development, testing, documentation, training materials, support resources, distribution, sustainability, and marketing. The proposed educational robot arm will be sold to schools or other organizations that are interested in using it for teaching purposes at a cost of $500 USD per unit.</p> <p>Conclusion: The proposed project is an innovative solution that can help bridge the gap between theoretical concepts and practical applications by providing students with hands-on experience using real-world technologies such as 3D printing, laser cutting, CNC machining, electronics labs, and more. The educational robot arm will be a valuable tool for teachers or instructors to use in their classes, helping them teach automation, programming, mechanics, electronics, and other STEM fields with ease. We believe that this project has the potential to make a significant impact on education and innovation, and we look forward to working with you to bring it to life.</p> </li> <li> <p>Write Python code to communicate with a USB serial device</p> </li> <li>Here is an example of how to use the <code>serial</code> module in Python to read data from a USB serial device:     <pre><code>import serial\n\nser = serial.Serial('COM1', baudrate=9600) # replace 'COM1' with your desired port name and baud rate\n\nwhile True:\n    try:\n        ser.readline()\n        print(f\"Received data from the USB device: {ser.readline()}\")\n    except serial.SerialException as e:\n        if str(e) == 'No such file or directory': # check for a specific error message that indicates an invalid port name\n            continue  # try again with a different port name\n</code></pre></li> <li>who is svavar konradsson?</li> <li>Svavar Konr\u00e1\u00f0sson (born May 2, 1975) is an Icelandic entrepreneur and inventor. He has founded several companies in the fields of technology, finance, and real estate development. Some of his notable ventures include Skype Technologies S.A., which he co-founded with Janus Friis in 2003; Bidco Oy, a Finnish company that specializes in online auctions for used cars; and AQS Capital Management AB, an Icelandic investment firm focused on real estate development projects. Konr\u00e1\u00f0sson is also known for his philanthropic activities, including supporting the arts, education, and environmental causes through various organizations such as Reykjavik Art Museum, The National Museum of Iceland, and Arctic Initiative.</li> <li>who is svavar konradsson? (Now and in the prompts below I'm using LocalDocs to connect Snoozy to my documentation repo)</li> <li> <p>Svavar Konr\u00e1\u00f0sson (born May 2, 1975) is an Icelandic entrepreneur and inventor. He has founded several companies in the fields of technology, finance, and real estate development. Some of his notable ventures include Skype Technologies S.A., which he co-founded with Janus Friis in 2003; Bidco Oy, a Finnish company that specializes in online auctions for used cars; and AQS Capital Management AB, an Icelandic investment firm focused on real estate development projects. Konr\u00e1\u00f0sson is also known for his philanthropic activities, including supporting the arts, education, and environmental causes through various organizations such as Reykjavik Art Museum, The National Museum of Iceland, and Arctic Initiative. Context: instructors, \u00c1rni Bj\u00f6rnsson and \u00de\u00f3rarinn Bjartur Brei\u00f0fj\u00f6r\u00f0 Gunnarsson, came to support us during this intense session of work. \u00de\u00f3rarinn and I flew in from \u00cdsafj\u00f6r\u00f0ur and \u00c1rni, respectively, while Bjarn</p> </li> <li> <p>how do you do i2c communication between at412 microcontrollers? (Note that I wrote ATtiny412 incorrectly, let's see how the model deals with that)</p> </li> <li> <p>To communicate with ATmega412 microcontrollers using the I2C protocol, follow these steps:</p> <ol> <li>Connect the two data wires (SDA and SCL) from each MCU to separate pins on your Arduino board or any other device that supports I2C communication. For example, you can connect them to A4 and A5 respectively for ATmega412 microcontrollers.</li> <li>Use the <code>Wire</code> library in combination with an appropriate <code>I2cDevice</code> object to communicate with each MCU individually. The <code>Wire</code> class provides a convenient way of working with I2C lines, while the <code>I2cDevice</code> interface allows you to read and write data from/to the microcontrollers over their respective I2C interfaces.</li> <li>When writing data to an ATmega412 MCU using I2C communication, ensure that it is configured as a slave device by setting its address register (e.g., <code>Wire.beginTransmission(address)</code>) and then sending the desired byte of data over the SDA line (<code>Wire.write(data)</code>.</li> <li>When reading from an ATmega412 MCU, use the appropriate read function to retrieve the requested data bytes from its registers (e.g., <code>I2cDevice.readFrom()</code>). Be sure to specify the correct address and register values for your specific application.</li> </ol> </li> <li> <p>is the fab academy difficult?</p> </li> <li>The difficulty level of the Fab Academy can vary depending on an individual's prior knowledge and experience in engineering, design, and fabrication. However, it is generally considered to be challenging due to its intensive nature and fast-paced curriculum that covers a wide range of topics within these fields. The program requires students to work independently as well as collaboratively on projects, which can require significant time management skills and self-motivation. Additionally, the Fab Academy's focus on hands-on learning through prototyping and fabrication may be challenging for those with limited experience in these areas.</li> <li>what's a good project for machine week in the fab academy?</li> <li>A good Machine Week project in the Fab Academy could be one that involves designing and building an automated system or tool, such as a robotic arm, CNC milling machine, 3D printer, laser cutter, or other fabrication equipment. The goal should be to create something useful for yourself or others while also learning about the principles of computer-controlled machines and their applications in various fields. Another option could be developing a project that involves integrating multiple machines together into an automated system, such as creating a conveyor belt with sensors and motors controlled by microcontrollers. This would allow you to explore the potential for collaboration between different tools and devices while also enhancing your understanding of their individual capabilities. Ultimately, the best project will depend on your interests, skills, and goals within the Fab Academy program. It's important to choose a topic that aligns with these factors in order to maximize your learning experience during Machine Week.</li> <li>how do i use modular things?</li> <li>To use Modular Things in your project, you will need to follow these steps:<ol> <li>Purchase the necessary components from a supplier that offers OSAP-compatible modules and connectors (such as Adafruit or SparkFun).</li> <li>Connect the microcontroller board with an appropriate power source and USB cable to your computer's USB port.</li> <li>Install any required software drivers for the microcontroller on your computer, such as Arduino IDE or PlatformIO.</li> <li>Use a web-based interface like Modular Things Web to create a new project and add components (such as motors, sensors, and other devices) that are compatible with OSAP protocols.</li> <li>Connect each component to the microcontroller board using appropriate connectors and wiring according to its specifications.</li> <li>Test your setup by sending commands from Modular Things Web or another program that can communicate with the serial port of the microcontroller, such as Arduino IDE's Serial Monitor.</li> </ol> </li> <li>How to make a silicone mold?</li> <li>To create a silicone mold, follow these steps:<ol> <li>Purchase the necessary materials for creating a silicone mold, such as two-part polyurethane or epoxy resin and hardener, silicone rubber (such as Soft 107), acrylic sheeting, vacuum pot, mixing container, stirring sticks, and other tools.</li> <li>Clean the area where you will be working with mold-making materials to avoid contamination of your project. Cover any nearby surfaces or objects that could come into contact with silicone rubber.</li> <li>Mix together equal parts of polyurethane resin (A) and hardener (B), following manufacturer's instructions for proper mixing ratios, as well as safety precautions to avoid skin irritation from the chemicals involved in this process.</li> <li>Pour a small amount of mixed polyurethane into an acrylic sheeting or other mold-making container with sides that are slightly higher than your desired silicone rubber thickness (e.g., 1/8\" for Soft 107). Place the mold in a vacuum pot to create a thin, steady stream of airflow and prevent bubbles from forming during curing.</li> <li>Once the polyurethane has cured into a solid mass (usually within an hour), carefully remove it from the acrylic sheeting or other container without disturbing its shape too much. This will be your mold for creating silicone rubber parts later on.</li> <li>Clean and prepare any surfaces that may come in contact with the silicone rubber, such as a vacuum pot used to create airflow during curing or stirring sticks from previous projects. These should not contain any contaminants that could affect your mold-making process.</li> <li>Measure out equal parts of Soft 107 silicone rubber and hardener, following manufacturer's instructions for proper mixing ratios to ensure a smooth consistency without air bubbles or other defects in the final product. Mix together thoroughly until fully combined.</li> <li>Pour the mixed silicone into your prepared mold (from step 4), making sure it fills all crevices and cavities evenly, but not so much that any excess spills over onto surrounding surfaces. Allow to cure for several hours or as directed by manufacturer's instructions, until a solid mass has formed within the silicone rubber mold.</li> <li>Once your silicone rubber part is fully cured and removed from its mold (usually after 24-72 hours), clean any excess material around it to avoid contamination of other projects or surfaces in the area. Store the finished product safely until ready for use, such as by attaching a motorized arm to your project using screws or other fasteners that can withstand the weight and movement of the silicone rubber part. ### Context: The second mold came out well, except for a few bubbles. With the help of my father-in-law, I made another mold from this pattern, but it turned out the same. ## The right silicone arrives above it to form a thin, steady stream of silicone. The bubbles will be pushed out before entering the thin stream and curing into your final product.</li> </ol> </li> <li>how to make a resin casting in the fab academy?</li> <li>To create a silicone rubber mold for your project, you will need to follow these steps:<ol> <li>Prepare and clean any surfaces that may come into contact with the silicone rubber, such as stirring sticks or vacuum pots used during curing. These should not contain any contaminants that could affect your mold-making process.</li> <li>Measure out equal parts of Soft 107 silicone rubber and hardener, following manufacturer's instructions for proper mixing ratios to ensure a smooth consistency without air bubbles or other defects in the final product. Mix together thoroughly until fully combined.</li> <li>Pour the mixed silicone into your prepared mold (from step 4), making sure it fills all crevices and cavities evenly, but not so much that any excess spills over onto surrounding surfaces. Allow to cure for several hours or as directed by manufacturer's instructions, until a solid mass has formed within the silicone rubber mold.</li> <li>Once your silicone rubber part is fully cured and removed from its mold (usually after 24-72 hours), clean any excess material around it to avoid contamination of other projects or surfaces in the area. Store the finished product safely until ready for use, such as by attaching a motorized arm to your project using screws or other fasteners that can withstand the weight and movement of the silicone rubber part.</li> </ol> </li> <li>how do i calibrate a cnc machine?</li> <li>To calibrate your CNC milling machine, you will need to follow these steps:<ol> <li>Prepare the workspace and set up the necessary tools for measuring and adjusting the axes of motion in your CNC milling machine. This may include a micrometer or other precision measurement tool, as well as any required hardware or software components that allow you to make fine-grained adjustments to the positioning and movement of each axis.</li> <li>Measure the current position of each axis using your chosen measurement device, taking care to ensure accurate readings are recorded for all three axes (X, Y, Z). Compare these measurements against any available specifications or tolerances provided by the manufacturer or supplier of your CNC milling machine.</li> <li>Adjust the position and movement of each axis as needed based on the measured values and any relevant specifications or tolerances. This may involve making small adjustments to screws, nuts, bolts, or other hardware components that affect the positioning and motion of your CNC milling machine's axes.</li> <li>Repeat steps 1-3 as necessary until you have achieved accurate measurements for all three axes within any specified tolerances. This may involve making multiple adjustments to different parts of the system over time, so it is important to document each step and maintain a clear record of your progress throughout the calibration process.</li> <li>Once you are satisfied with the accuracy of your CNC milling machine's positioning and movement in all three axes, test its performance by running some sample jobs or projects through the system to ensure that it is producing consistent results across different parts and materials. This may involve using specialized software tools for generating G-code instructions or other programming tasks related to controlling your CNC milling machine's movements during operation.</li> <li>Finally, store any necessary documentation or records of your calibration process in a safe location that can be easily accessed later if needed, such as by consulting with an expert technician or engineer who may need this information for troubleshooting purposes or other tasks related to maintaining and optimizing the performance of your CNC milling machine. ### Context: The guide explains how to calibrate a CNC milling machine in order to ensure accurate positioning, movement, and cutting results when working with different parts and materials on this type of equipment. This process involves making fine-grained adjustments to the axes of motion using precision measurement tools and hardware components that affect the positioning and movement of each axis (X, Y, Z). The guide also recommends testing your CNC milling machine's performance after calibration by running sample jobs or projects through it. Finally, the guide suggests storing any necessary documentation or records related to this process in a safe location for later reference if needed.</li> </ol> </li> </ul> <p>I saw in a Youtube video that deduplication of data is important (removing duplicate data) when dealing with LLMs, so this time I only pointed the Snoozy LLM to the public folder in my documentation repo. This didn't make much of a difference.</p> <ul> <li>who is svavar konradsson? (Now and in the prompts below I'm using LocalDocs to connect Snoozy to only the public folder in my documentation repo)</li> <li>Svavar Konr\u00e1\u00f0sson (born 1965) is an Icelandic musician, composer and producer. He has been active in the Icelandic music scene since the late 80s as a member of several bands including The Sugarcubes, GusGus, and Sigur R\u00f3s. Konr\u00e1\u00f0sson also collaborated with other musicians such as Bj\u00f6rk, M\u00fam, J\u00f3nsi from Sigur R\u00f3s, and many others. He has released solo albums under the name Sveinbj\u00f6rn Beinteinsson since 2013.</li> <li>how do you do i2c communication between at412 microcontrollers? (Note that I wrote ATtiny412 incorrectly, let's see how the model deals with that)</li> <li> <p>To perform I2C communication between ATmega412 microcontrollers, follow these steps:</p> <ol> <li>Connect the two microcontrollers to each other using a 6-pin header cable or any suitable wiring method. The pins on one side of the cable should match those on the other side (e.g., SDA and GND).</li> <li>Set up the I2C communication protocol between both microcontrollers by configuring their respective registers:</li> <li>Onboard ATmega412 MCU:<ul> <li>Configure GPIO pins for I2C communication using <code>GPIO_PIN</code> macros (e.g., <code>I2C_SCL = 9;</code>, <code>I2C_SDA = 8;</code>).</li> </ul> </li> <li>External ATmega412 MCU:<ul> <li>Configure GPIO pins for I2C communication using the same approach as above.</li> </ul> </li> <li>Enable the internal pull-up resistors on both microcontrollers by setting <code>I2C_PULLUP</code> to 0 (e.g., <code>I2C_PULLUP = 0;</code>). This will ensure proper data transmission between devices without requiring external pull-ups.</li> <li>Set up the I2C communication speed and other parameters as needed, such as clock speed (<code>I2C_SPEED</code>), addressing mode (e.g., <code>I2C_ADDRESS = 0x1;</code>), and more. Refer to your microcontroller's datasheet for specific details on these settings.</li> <li>Start the I2C communication by writing data or reading from devices connected via their respective SDA/SCL pins:<ul> <li>Onboard ATmega412 MCU: Send commands, read data, and handle interrupts as needed (e.g., <code>I2C_Read()</code> function).</li> </ul> </li> <li>External ATmega412 MCU: Read or write to devices connected via their respective SDA/SCL pins using the same approach as above.</li> <li>Keep in mind that I2C communication requires proper wiring, device addressing, and timing synchronization between both microcontrollers. Ensure your code handles any errors or timeouts appropriately (e.g., <code>I2C_Error()</code> function).</li> </ol> </li> <li> <p>is the fab academy difficult?</p> </li> <li>The Fab Academy is not necessarily considered \"difficult,\" but it does require dedication, focus, and hard work to complete successfully. The program provides students with access to high-quality online resources for learning various topics in digital fabrication (e.g., 3D printing, laser cutting), as well as opportunities for hands-on experience through internships or projects. To succeed in the Fab Academy, you should be prepared to invest significant time and effort into your studies, actively participate in online discussions and activities, collaborate with other students on group projects, and apply what you've learned by creating original designs and prototypes using digital fabrication tools. Overall, while completing the Fab Academy may require some level of challenge or difficulty, it is designed to be accessible for individuals who are motivated and committed to learning about cutting-edge technologies in digital fabrication.</li> <li>what's a good project for machine week in the fab academy?</li> <li>For Machine Week during Fab Academy, you can consider creating projects that demonstrate your skills with various CNC machines and tools (e.g., milling, drilling, cutting). Here are some ideas to get started:<ol> <li>Design and fabricate a custom enclosure for an Arduino or Raspberry Pi board using the laser cutter. This project can help you develop proficiency in design software like Inkscape (for vector graphics) and G-code programming, as well as hands-on experience with cutting acrylic sheets on the laser cutter.</li> <li>Create a custom 3D printed enclosure for an Arduino or Raspberry Pi board that incorporates unique features or designs. This project can help you develop proficiency in design software like Tinkercad (for basic shapes) and Fusion 360 (for more advanced models), as well as hands-on experience with 3D printing on the Ultimaker printers.</li> <li>Design a custom CNC machine tool holder or fixture that can be used to securely hold various tools, such as drills, end mills, and taps. This project can help you develop proficiency in design software like Autodesk Fusion 360 (for parametric modeling) and G-code programming for CNC machines, as well as hands-on experience with using the laser cutter to fabricate parts from acrylic sheets or other materials. Remember that these are just examples; you can always come up with your own project ideas based on your interests, skills, and goals in digital fabrication.</li> </ol> </li> </ul>"},{"location":"projects/chat.html#attempt-3-ollama-in-wsl2","title":"Attempt 3: Ollama in WSL2","text":"<p>I installed Ollama on Ubuntu under the Windows Subsystem for Linux, and downloaded the smallest language model, tinyllama. Tinyllama only has around 1 billion parameters, and it performed about as badly as the Mini Orca model.</p> <p>To install Ollama and tinyllama I used the same commands as in attempt 1, except this time I typed them into the WSL Linux terminal: <pre><code>install ollama\nollama run tinyllama\n</code></pre></p> Conversation <ul> <li>What is the Fab Academy?</li> <li>The Fab Academy is a global platform for learning and innovation, promoting the sharing of ideas and knowledge in the field of fashion. It was founded by a group of industry leaders in 2013 to address the need for an open and collaborative environment that fosters creativity, innovation, and entrepreneurship in the fashion industry. The Fab Academy offers a range of online courses, workshops, and events, as well as networking opportunities, to help individuals, startups, and brands develop their skills, learn from peers and experts, and drive innovation in the fashion industry.</li> <li>Who is Svavar Konradsson?</li> <li>Svavar Konradsson is a Swedish entrepreneur and the founder of the Fab Academy. She has over 15 years of experience in the fashion industry, having worked for brands such as H&amp;M, Zara, and Adidas. In 2013, she established the Fab Academy with a group of industry leaders to create an open and collaborative environment for creativity, innovation, and entrepreneurship in the fashiion industry. She holds a Bachelor's degree in Fashion Merchandising from Gothenburg University and has been recognized for her impact on the fashion industry through her contributions to education, research, and innovation.</li> <li>how do you do i2c communication between at412 microcontrollers? (Note that I wrote ATtiny412 incorrectly, let's see how the model deals with that)</li> <li> <p>To do I2C communication between At412 microcontrollers, you need to follow these steps:</p> <ol> <li> <p>Configure your software environment to communicate with the At412 microcontrollers using I2C (Inter-Integrated Circuit) protocol. You can use a microcontroller configuration tool like the Arduino IDE or PICkit 3 for this purpose.</p> </li> <li> <p>Connect the At412 microcontrollers to your computer/board/system by connecting the data and clock pins. Use I2C slave mode when communicating with the microcontrollers, which allows you to send commands and receive responses in parallel.</p> </li> <li> <p>Design a microcontroller program that communicates using I2C. You can use an I2C library provided by the microcontroller manufacturer or write your own program from scratch.</p> </li> <li> <p>Test your program on the At412 microcontrollers to ensure it is working properly. Connect the power supply and the microcontrollers to a computer/board/system with a USB cable, and use the I2C slave mode in the microcontroller software.</p> </li> <li> <p>Once you have verified that your microcontroller program works correctly on the At412 microcontrollers, you can start communicating with them using I2C. To do this, follow these steps:</p> <ul> <li>Open a serial terminal window for communication with the microcontrollers (e.g. Serial Monitor or Serial Debugger).</li> <li>Connect the power supply and the microcontrollers to your computer/board/system with a USB cable.</li> <li>Select I2C mode in the microcontroller software using the appropriate I2C slave mode configuration tool.</li> <li>Enter command mode by sending a \"I\" (or similar) command at the microcontroller's start address, followed by the commands you want to send.</li> <li>Receive data responses by sending an \"R\" (or similar) command and waiting for a response at the microcontroller's stop address.</li> </ul> </li> </ol> <p>That's it! Now you can start communicating with your At412 microcontrollers using I2C.</p> </li> <li> <p>is the fab academy difficult?</p> </li> <li>The Fab Academy is a global platform for learning and innovation, promoting the sharing of ideas and knowledge in the field of fashion. It was founded by industry leaders in 2013 to address the need for an open and collaborative environment that fosters creativity, innovation, and entrepreneurship in the fashion industry. The Fab Academy offers a range of online courses, worksshops, and events, as well as networking opportunities, to help individuals, startups, and brand's develop their skills, learn from peers and expertise, and drive innovation in the fashion industry. While the Fab Academy can be challenging, it is designed to equip individuals with the knowledge, skills, and networks they need to succeed in the fast-paced and competitive world of fashion.</li> <li>what's a good project for machine week in the fab academy?</li> <li> <p>Machine Week is the third in a series of innovation workshops organized by the Fab Academy. Each workshop focuses on a specific topic related to automation, robotics, and AI. Here are some potential ideas for Machine Week:</p> <ol> <li> <p>Robotics: Build a functional robot using Arduino or Raspberry Pi. This project will involve designing, building, programming, and testing the robot's movement and functionality.</p> </li> <li> <p>Machine Learning: Design and build an autonomous car using machine learning algorithms. This project will require coding, data analysis, and modeling to optimize vehicle performance for autonomous driving.</p> </li> <li> <p>Fashion Startup Competition: Participate in a fashiion startup competition to showcase your innovation skills and network with industry leaders. Competing teams will present their ideas and receive feedback on how to improve them.</p> </li> <li> <p>Digital Design and Fabrication: Design and build a functional product using digital design software, 3D printing, and laser cutters. This project will require creating CAD files, programming the 3D printer, and assembling the final product.</p> </li> <li> <p>Data Analysis and Machine Learning: Analyze a large dataset using machine learning algorithms to predict customer behavior and optimize sales strategies. This project requires coding, data analysis, and modeling to identify patterns and trends in the data.</p> </li> </ol> </li> </ul> <p>These are just a few ideas for Machine Week in the Fab Academy. The Fab Academy encourages participants to come up with their own unique projects, based on the topic of their choice.</p> <ul> <li>Please write Python code to send serial messages to an Arduino device.</li> <li> <p>I can't write actual code, but I can provide you with a general idea of how to send serial messages to an arduino     device using a python program.</p> <p>to connect to an arduino via serial port, you need to install the \"serial\" package on your system. Then, you can create an instance of the serial port class and pass it to the arduino object:</p> <pre><code>import serial\n\n# open serial port\nserial_port = serial.serial_for_url(\"COM1\", timeout=0.5)\narduino = serial.Serial(serial_port, 9600, timeout=0.2)\n</code></pre> <p>once the connection is established, you can send serial data to an arduino using the <code>send()</code> method of the arduino object:</p> <pre><code>while True:\n    # write some data to the serial port\n    arduino.write(bytes(\"hello world\\n\", \"ascii\"))\n\n    # read the serial data from arduino\n    data = arduino.readline()\n\n    if not data:\n        break\n</code></pre> <p>this program will send \"hello world\" to an arduino, and print each line of received data to the console. You can modify it to send different messages based on your needs.</p> </li> </ul>"},{"location":"projects/chat.html#attempt-4-privategpt-in-wsl-not-working-yet","title":"Attempt 4: PrivateGPT in WSL (not working yet)","text":"<p>Here's what I've done so far. I've basically mixed together this and this tutorial, but I'm going to spell out the steps I took, for future reference:</p> Setup <ul> <li>I set up WSL2 (already done).</li> <li>Then I got the WSL extension for VSCode</li> <li>I cloned the repo for PrivateGPT</li> <li>I found the link to the latest Miniconda (the minimal version of Anaconda) and used the command <code>curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh</code></li> <li>and completed these instructions</li> <li>Installed Miniconda with <code>bash Miniconda3-latest-Linux-x86_64.sh</code></li> <li>Then I closed Ubuntu and VSCode and reopened VSCode.</li> <li>Then I started a virtual environment using <code>conda create -n privategpt python=3.11</code> as shown in this tutorial</li> <li>Then <code>conda activate privategpt</code> to activate the privategpt environment</li> <li>Then I followed the installation instructions in the readme in PromptEngineer48/Ollama/2-ollama-privateGPT-chat-with-docs, starting with <code>pip install -r requirements.txt</code></li> <li>I got an error:         <pre><code>Failed to build llama-cpp-python chroma-hnswlib\nERROR: Could not build wheels for llama-cpp-python, chroma-hnswlib, which is required to install pyproject.toml-based projects\n\nRuntimeError: Unsupported compiler -- at least C++11 support is needed!\n</code></pre></li> <li>So I installed GCC with <code>sudo apt install build-essential</code> according to this tutorial</li> <li>Then I ran <code>pip install -r requirements.txt</code> again</li> <li>That went well this time, now to get the mistral model: <code>ollama pull mistral</code></li> <li>Created A directory for source documents: <code>mkdir source_documents</code></li> <li>Then cloned my fab academy site repository to ubuntu wsl2 and copied only the public folder into source_documents</li> <li> <p>Then I tried to ingest the files, but got the following error:</p> <pre><code>(base) svavark@MI0321:~/Ollama/2-ollama-privateGPT-chat-with-docs$ python ingest.py\nTraceback (most recent call last):\nFile \"/home/svavark/Ollama/2-ollama-privateGPT-chat-with-docs/ingest.py\", line 8, in &lt;module&gt;\n    from langchain.document_loaders import (\nModuleNotFoundError: No module named 'langchain'\n</code></pre> </li> <li> <p>I noticed that I was in (base) but not (privategpt), so I restarted conda: <code>conda activate privategpt</code></p> </li> <li>Then <code>python ingest.py</code> and it worked!     Lots of little caveats here and there. I closed the folder in VSCode in order to copy the public folder over to source_documents, and that closed the conda environment.</li> </ul> <p>I now got a new error with ingest.py:</p> <pre><code>LookupError: \n\nResource punkt not found.\nPlease use the NLTK Downloader to obtain the resource:\n\nimport nltk\nnltk.download('punkt')\n\nFor more information see: https://www.nltk.org/data.html\n\nAttempted to load tokenizers/punkt/PY3/english.pickle\n</code></pre> <p>I opened the nltk link in the error message. That's where I stopped for now. Remember to restart the conda virtual environment called <code>privategpt</code> when you pick this up again!</p>"},{"location":"projects/chat.html#links","title":"Links","text":"<p>Ubuntu tutorials</p> <p>My NVidia GPU was installed by default and Ollama detected it, but you may need to install the driver.</p> <p>I tried installing a few lightweight apps with GUIs in WSL. Here are some more to try.</p>"},{"location":"projects/cpp.html","title":"Learning C++ from scratch","text":""},{"location":"projects/cpp.html#why","title":"Why","text":"<p>I've wanted to learn C or C++ for some years. </p> <p>C is to modern programming languages as Latin is to modern European languages, except that C is still alive and thriving as a fast, light weight systems programming language. C was created by Dennis Ritchie at Bell Labs in the 1970, and based on the B language. His collaborator at Bell Labs, Ken Thompson, wrote the UNIX operating system in C. Because you needed to use C to maintain your operating system, the C programming language became very popular, and it still is. C++ was created by Bjarne Stroustrup in the 1980, as a way to add Object-Oriented features to the C language.</p> <p>My Master's thesis advisor said that you get much finer control over the computer using C rather than something like Python. And C++ is necessary for high-performance microcontroller code.</p> <p>Right now I want to learn C++ in order to better understand the SimpleFOC code that I use in Baksi and the BLDC Modular Thing.</p> <p>I'll keep my programs in this repo:</p> <p>  My Learning C++ GitHub repository</p>"},{"location":"projects/cpp.html#failed-attempt","title":"Failed attempt","text":"<p>I tried to follow a C++ programming book some years back, I don't remember which one it was. I installed an IDE on my Windows laptop and tried to add something or other to PATH, but I couldn't get anything to compile and I didn't know why. I'm writing my journey down this time, in case it helps someone out.</p>"},{"location":"projects/cpp.html#successful-setup","title":"Successful setup","text":"<p>If you want to try running C++ code right away, you can copy one of the examples on this page into OnlineGDB and compile and run it in your browser.</p> <p>To compile and run C++ code, I installed Linux Mint inside VirtualBox, which was easy (here's a tutorial). Then I found a short video showing how to compile a C++ program in Linux Mint using the Code::Blocks editor. It worked! </p> <p>Note</p> <p>I later found out that you can install the Code::Blocks editor on Windows and Mac. On those operating systems, you need to install GCC yourself.</p> <p>Here's what you type into the Linux terminal to get started: <pre><code>sudo apt-get update\nsudo apt-get install codeblocks\ngcc --version\n</code></pre> That's it! I only updated my system, installed Code::Blocks and checked the GCC version. Conveniently, GCC comes preinstalled on most Linux distributions. If your GCC version is 11.3.0 or later, you're good to go. Open the Code::Blocks editor, select the GCC compiler and then create a new project. You want to create a Console application. That's it, now you can write your first C++ program:</p> <p><pre><code>#include &lt;iostream&gt;\nusing namespace std;\n\nint main()\n{\n    cout &lt;&lt; \"Hello world!\\n\";\n    return 0;\n}\n</code></pre> In the top menu, select Build -&gt; Build and run. The output is</p> <pre><code>Hello world!\n</code></pre> <p>Yay!</p> <p>I also found a tutorial that shows how to compile and run a C++ program in the Linux terminal. Nice! All you have to do is navigate to the right folder using <code>cd</code> and then enter</p> <p><pre><code>g++ cplus.cpp\n./a.out\n</code></pre> Then the program runs in the Linux terminal.</p>"},{"location":"projects/cpp.html#the-c-book","title":"The C++ book","text":"<p>My father-in-law handed me a used copy of Problem Solving with C++ by Walter Savitch at the yearly bazaar in Hn\u00edfsdalur in November 2023. The book only cost ISK 100 ($1), so I bought it. I have the seventh edition. The book is friendly and accessible. It assumes that you have never programmed a computer before and you only need to understand the most basic high school algebra for the more involved exercises.</p> <p>Alternatively you can go through the tutorials at LearnCpp.com. They seem really good. </p> <p>But I'm going ahead with the book:</p>"},{"location":"projects/cpp.html#chapter-1","title":"Chapter 1","text":""},{"location":"projects/cpp.html#freefall","title":"Freefall","text":"<p>After Hello world, I made a slightly more useful program (since I'm teaching physics at M\u00cd): <pre><code>#include &lt;iostream&gt;\nusing namespace std;\n\nint main()\n{\n    double t, y;\n    cout &lt;&lt; \"Enter freefall time in seconds: \" &lt;&lt; endl;\n    cin &gt;&gt; t;\n    y = 9.81*t*t/2;\n    cout &lt;&lt; \"The vertical distance covered is \" &lt;&lt; y &lt;&lt; \" meters.\" &lt;&lt; endl;\n    return 0;\n}\n</code></pre> When I run it, it looks like this:</p> <p><pre><code>Enter freefall time in seconds: 5\nThe vertical distance covered is 122.625 meters.\n</code></pre> Nice! </p>"},{"location":"projects/cpp.html#terminal-graphics","title":"Terminal graphics","text":"<p>Then I tried my hand at making ASCII graphics: <pre><code>#include &lt;iostream&gt;\n\nusing namespace std;\n\nint main()\n{\n    cout &lt;&lt; \"**********************************\" &lt;&lt; endl;\n    cout &lt;&lt; \"  BBB       A     K  K   SSS   I  \" &lt;&lt; endl;\n    cout &lt;&lt; \"  B  B     A A    K K    S     I  \" &lt;&lt; endl;\n    cout &lt;&lt; \"  BBB     A   A   K      SSS   I  \" &lt;&lt; endl;\n    cout &lt;&lt; \"  B  B    AAAAA   K K      S   I  \" &lt;&lt; endl;\n    cout &lt;&lt; \"  BBB     A   A   K  K   SSS   I  \" &lt;&lt; endl;\n    cout &lt;&lt; \"**********************************\" &lt;&lt; endl;\n    return 0;\n}\n</code></pre> The result: <pre><code>**********************************\n  BBB       A     K  K   SSS   I  \n  B  B     A A    K K    S     I  \n  BBB     A   A   K      SSS   I  \n  B  B    AAAAA   K K      S   I  \n  BBB     A   A   K  K   SSS   I  \n**********************************\n</code></pre> This is fun!</p>"},{"location":"projects/daq.html","title":"Multichannel data acquisition device (DAQ )","text":""},{"location":"projects/daq.html#overview","title":"Overview","text":"<p>My Master's thesis project in mechanical engineering is a suspension seat for speedboats. I'm going to drop test the seat and perform sea trials with it. So I need a device that lets me make dynamic measurements to assess the seat's shock mitigating performance.</p> <p>I haven't designed the device yet, but I've gathered lots of information:</p>"},{"location":"projects/daq.html#requirements","title":"Requirements","text":"<p>The literature recommends 24 bit data AD converters, or at least not below 16 bits, to measure acceleration on suspension seats. I've looked around for a suitable high resolution, multichannel data acquisition device (DAQ) that can also handle load cells, but they seem to cost upwards of 1300 dollars, not including the sensors. The MonoDAQ is the closest I can get to an affordable solution, but it's only 16 bits and it only has 4 differential inputs. It seems that I need to make my own data acquisition system. This will not only be lower cost, but it will be a nice educational exercise as well.</p> <p>Here are my requirements:</p> <ul> <li>7 or 8 sensors</li> <li>24 bit resolution</li> <li>At least 1000 samples per second</li> <li>Must handle weak load cell signals</li> <li>As little analog design as possible</li> <li>Some way to synchronize the measurements</li> <li>Simple communications and data processing</li> </ul> <p>Fortunately, I'm a Fab Academy graduate, and so I'm no longer intimidated by assembling a device myself. I know that accurate analog design is tricky, and so I want to make the analog path as short as possible. The usual method is to pair an instrumentation amplifier (either an IC or made of discrete op-amps) with a high-resolution analog to digital converter (ADC) and send the digital values to a microcontroller for processing and storage. I've looked at many of those, but the field is vast and I'm unsure which instrumentation amplifier goes best with which analog to digital converter.</p>"},{"location":"projects/daq.html#analog-front-end","title":"Analog front end","text":""},{"location":"projects/daq.html#ad7190","title":"AD7190","text":"<p>Finally, I found the Analog Devices AD7190, which is a complete analog front end for high precision measurement applications. It's an expensive IC, but a cheap data acquisition device. I can get a ready-made board with this IC, but I like to make things from scratch in order to know how everything works.</p> <p>The AD7190 is a 4.8 kHz, 24 bit sigma-delta ADC with a programmable gain amplifier (PGA) with gain from 1/2 to 128! That's the widest data-rate and input signal range of any sigma-delta ADC. This means that I can connect any sensor to it, from accelerometers to temperature and pressure sensors, even to strain gauges! Strain gauges are the trickiest of all, because the signals you get are extremely weak and you usually need a chip that is dedicated to strain gauges. The problem with those is that these chips usually have a very slow data rate, up to hundreds of Hertz at most. That's not sufficient for my dynamic measurements. The AD7190 is perfect though, because I can use the same IC on all the sensors and sync all the measurements together with a clock signal (This application note points out problems with routing clock signals over long distances). And the chip has a few siblings, one of which (the AD7195) can provide an AC excitation signal for load cells, to boost the measurement precision.</p>"},{"location":"projects/daq.html#precision-regulator","title":"Precision regulator","text":"<p>I've been digging into the circuit note that shows a complete weigh scale design using the AD7190 chip. The circuit note says that the AD7190 analog section must be powered from 5V. That's a little bit disappointing, since I was hoping to adjust its sensitivity by using different voltage references, based on the sensors I'm using. The suggested precision 5V regulator is the ADP3303. Is that all I need? I thought I needed a precision voltage reference like the ADR431.</p>"},{"location":"projects/daq.html#sensors","title":"Sensors","text":""},{"location":"projects/daq.html#accelerometers","title":"Accelerometers","text":"<p>Accelerometers are a whole field in themselves. Choosing the right one for my tests is quite daunting. Fortunately, I know that my thesis adviser has been using the Bosch BMA280 for acceleration measurements on speedboats with good results. This IC is a digital three-axis accelerometer with 14 bit resolution and a 500 Hz data rate. OK, I can find an IC that has similar or higher specs.</p> <p>The ADXL359 from Analog Devices is a three-axis 20 bit digital accelerometer. This fits the requirement to not have to do analog design. But it's a tiny IC and I don't know how to synchronize it with the AD7910 chips.</p> <p>The ADXL316, ADXL326, ADXL356 and the new ADXL358 are analog accelerometers that have the 16-20 g range that I'm looking for. They all come in tiny packages, except fo the ADXL356. It comes in a 14-lead LCC package, which I may just be able to solder by hand. I didn't know that until I was putting this text together. The right accelerometer has jumped out at me! </p> <p>The only downside to an analog accelerometer is that I'll need to calibrate it myself. How do I do that? I don't have easy access to the University of Iceland's calibration shaker here in \u00cdsafj\u00f6r\u00f0ur. Do I measure the acceleration in free fall and at rest and calibrate the data with those two data points? Maybe that's good enough for my purposes.</p>"},{"location":"projects/daq.html#load-cells","title":"Load cells","text":"<p>Here's a page on load cell fundamentals.</p> 2000 kg5 kgStrain gauges <p>To measure the forces in the seat, I bought two 2000 kg S-type load cells. I don't know how precise they are, but this is what I could afford. They don't come with a calibration certificate. These are their specs:</p> <ul> <li>Linearity: \u00b10.02%F.S.</li> <li>Delaying: \u00b10.02%F.S.</li> <li>Repeatability: \u00b10.02%F.S.</li> <li>Sensitivity: 2.0mV/V</li> <li>Drifting: \u00b10.02%F.S</li> <li>Input impedance: 350\u00b110\u03a9</li> <li>Output impedance: 350\u00b15\u03a9</li> <li>Wire connecting method:<ul> <li>Input: Red wire(+), Black wire(-)</li> <li>Output: Green wire(+), White wire(-)</li> <li>Yellow wire(GND)</li> </ul> </li> </ul> <p>I also have two very nice 5 kg S-type load cells from Applied Measurements. The are much higher quality, they have much more documentation and a correspondingly higher price. The 5 kg load cells have a four-wire interface.  Rated Capacity (RC) kgf 0-1, 0-2, 0-5, 0-10, 0-25, 0-50 Operating Modes Tension/Compression / Tension &amp; Compression Sensitivity (RO) mV/V 2.0 nominal Zero Balance/Offset \u00b1%/Rated Output &lt;1.0 Zero Return after 30 mins \u00b1%/Applied Load &lt;0.03 Output Symmetry (tension vs. compression) \u00b1%/Rated Output &lt;0.10 Non-Linearity \u00b1%/Rated Output &lt;0.03 Hysteresis % / Rated Output &lt;0.02 Output Symmetry \u00b1%/Rated Output &lt;0.10 Repeatability \u00b1%/Rated Output &lt;0.02 Temperature Effect on Zero \u00b1%/Rated Output/\u02daC &lt;0.005 Temperature Effect on Sensitivity \u00b1%/Applied Load/\u02daC &lt;0.005 Input Resistance Ohms 375-420 nominal Output Resistance Ohms 340-360 nominal Insulation Resistance Megohms &gt;5000 @ 50Vdc Excitation Voltage Volts AC or DC 10 recommended (2-15 acceptable) Operating Temperature Range \u02daC -20 to +80 Compensated Temperature Range \u02daC 0 to +70 Storage Temperature Range \u02daC -20 to +80 Safe Overload % of Rated Capacity 150 Ultimate Overload % of Rated Capacity 200 Maximum Safe Side Load % of Rated Capacity 30 Deflection @ Rated Capacity mm (nominal) 1kg = 0.50, 2kg = 0.30, 5kg = 0.26, 10kg = 0.19, 25kg = 0.12, 50kg = 0.08 Fundamental Resonant Frequency* Hz 1kg = 200, 2kg = 300, 5kg = 600, 10kg = 950, 25kg = 1900, 50kg = 3000 IP Rating (Environmental Protection) IP51 (IP67 optional) Weight (excluding cable) grams 25 Fatigue Life Consult Sales Cable Length (as standard) metres 2 Cable Type 4-core screened, PVC sheath, \u00d83.5 Construction Material Aluminium Alloy Resolution 1 part in 250,000 (with appropriate instrumentation) </p> <p>Just for fun, I also bought a few strain gauges, in case I wanted to measure the strain in the damper body or something like that. It's also nice to have them in stock at the Fab Lab. </p> <p>Along with these sensors I bought a bunch of 24 bit HX711 AD converters which are especially designed for load cells. I thought I was all set until I discovered that the data rate of the HX711 AD converter only goes up to 80 samples per second. That's not enough. But these cheap 24 bit AD converters will still be useful to have at the Fab Lab, because they are the easiest and most common way for hobbyists to interface with load cells. </p> <p>Here's a CBA project that uses the maximum data rate of the HX711:</p> <p>And custom multi-axis load cells made by sticking strain gauges on aluminum pieces cut with a wire EDM. Very nice. It may look fast enough when he pushes on it by hand in the video, but shock events are considerably faster than the fastest movements of the human arm.</p> <p>Because I needed an alternative to the HX711, and I wanted to be able to connect all my sensors to the same type of IC, I found the AD7910 (see the Analog front end above). You can connect a load cell directly to this IC and make 4800 measurements per second at 24 bits! There is a caveat, though. When you amplify the signal, you also amplify the noise. According to this tutorial from Analog Devices, at a gain of 128 and 4.8 kHz sampling frequency you get 15.5 bits of noise-free resolution. The document assumes a load cell sensitivity of 2 mV/V, which matches my load cells. We can calculate the load cell's output at its maximum rated load like this:</p> \\[     2 \\text{mV/V} \\cdot 5 \\text{V} = 10 \\text{mV} \\] <p>The analog input range of the AD7910 with a 5V reference voltage is</p> \\[     \\pm V_{REF}/\\text{gain} = \\pm 5 \\text{V}/128 \\approx \\pm 39 \\text{mV} \\] <p>in bipolar mode. I need to check what bipolar mode means. Using that assumption, the signal from a load cell only uses</p> \\[    \\frac{10 \\text{mV}}{2\\cdot39\\text{mV}} \\approx 12.8\\% \\] <p>of the allowable range of the ADC. What does that leave me with? </p> \\[      15.5\\text{ bits}\\cdot0.128\\approx2 \\text{ bits?} \\] <p>That doesn't make sense. I'm probably calculating this totally wrong.</p> <p>Let's try again. It's probably better to use the number of possible values instead of the number of bits. Let's use the 15.5 bit noise-free range of the ADC to calculate how many bits I have to measure the 10 mV load cell signal:</p> \\[     2^{15.5}\\text{ values}\\cdot0.128\\approx 5932\\text{ values       or} \\qquad log_{2}(5932)\\approx \\text{ 12.5 bits} \\] <p>That seems closer to the mark. I can live with 12 bits. This may not be entirely correctly calculated, but it makes me feel better. Arduino forum user jim-p says something about 12 being the probable effective number of bits (ENOB) when you connect a strain gauge to an AD7195. That seems to support my simple calculations. And as they point out in the tutorial, having a much wider input range on the ADC (15.5 bits is 46,341 values) than in the signal itself (12.5 bits is 5,932 values) means that the load cell's offset error (typically 50% of the full-scale signal) and gain error (up to 20%) definitely won't overload the ADC.</p> <p>If I measure 960 samples per second instead of 4800, the useful number of bits in the ADC seems to be about 16.5 (from the graph in the tutorial). If I use 12.8% of that, I have 13.5 effective number of bits. That might be a good compromise; then the resolution is 11863 different values instead of 5932. I've just noticed that in the AD7910 datasheet, the noise performance is only given with sinc3 or sinc4 filtering enabled. There's no information about noise performance if you don't use the filters. So the filters seem important. I need to look into them.</p> <p>For a 2000 kg load cell the estimated accuracy is</p> \\[     \\frac{2000 \\text{ kg}}{5932 \\text{ values}} = 300 \\text{ g} \\] <p>and if I assume the most extreme shock event will be 16 g, then the maximum mass that I can place on top of that load cell (seat plus occupant) is</p> \\[     \\frac{2000\\text{ kg}}{16} = 125 \\text{ kg} \\] <p>For a 5 kg load cell the estimated accuracy is</p> \\[     \\frac{5 \\text{ kg}}{5932 \\text{ values}} = 0.8 \\text{ g} \\] <p>For the 5 kg load cell it makes more sense to think in terms of g's, since I will be using it as a human-scale accelerometer. If I assume that the full range of the load cell represents 16 g then the mass that I attach to the load cell must be</p> \\[     \\frac{5 \\text{ kg}}{16} = 313 \\text{ g} \\] <p>The Wikipedia page on load cells says:</p> <p>The bridge is excited with stabilized voltage (usually 10V, but can be 20V, 5V, or less for battery powered instrumentation). The difference voltage proportional to the load then appears on the signal outputs. The cell output is rated in millivolts per volt (mV/V) of the difference voltage at full rated mechanical load. So a 2.96 mV/V load cell will provide 29.6 millivolt signal at full load when excited with 10 volts. Typical sensitivity values are 1 to 3 mV/V. Typical maximum excitation voltage is around 15 volts.</p> <p>OK, maybe I can supply the load cells with 15V to get a bigger output voltage. But the AD7910 handles the excitation voltage, doesn't it? And it's a 5V device. I'll look a bit further into this.</p> <p>The Wikipedia page on load cells also says:</p> <p>The full-bridge cells come typically in four-wire configuration. The wires to the top and bottom end of the bridge are the excitation (often labelled E+ and E\u2212, or Ex+ and Ex\u2212), the wires to its sides are the signal (labelled S+ and S\u2212). Ideally, the voltage difference between S+ and S\u2212 is zero under zero load, and grows proportionally to the load cell's mechanical load.</p> <p>OK, so my 5 kg S-type load cells have four wires, so they likely have a full Wheatstone bridge. Good. But the 2000 kg S-type load cells have five wires?</p>"},{"location":"projects/daq.html#position-sensor","title":"Position sensor","text":"<p>I bought this 500 mm string potentiometer to measure the seat's position. It has a 0-5k\u03a9 resistance. In retrospect, I would probably rather have picked the 0-5V version, but I can make this work.</p> <p>String pots are expensive! I suppose that you need really precise manufacturing to make the output linear. I wonder if I could make a cheap string pot with an optical sensor instead. Saving that thought for later.</p>"},{"location":"projects/daq.html#digital-communication","title":"Digital communication","text":"<p>My plan is to make a microcontroller board with lots of breakout pins and measurement boards, which can hopefully all be the same. The AD7190 uses something similar to SPI for digital communication. I know that you can connect many devices on the same SPI bus, but you do have to take care that the signals don't overlap or bump into each other. Since I don't want to dive into SPI traffic control for now, I'm going to try to find a microcontroller that can give me enough separate SPI controllers to connect each sensor to a separate SPI bus. </p>"},{"location":"projects/daq.html#option-1-the-rp2040-microcontroller","title":"Option 1: The RP2040 microcontroller","text":"<p>I might try the RP2040. It has eight tiny programmable input-output (PIO) processors which you can program in assembly to bit-bang any communication interface you like. And of course, lots of them are freely available online, made by enthusiasts for enthusiasts. This could be the way if it turns out that the AD7190 uses a non-standard way of communicating over the bus (although I know very little about PIO programming). AD7190 datasheet says that it's SPI compatible but it uses a three-wire interface, while SPI has four wires. Some more  digging is required. Anyway, I need 32 pins for eight separate SPI buses. The Xiao RP2040 only has 11 GPIO pins and the Raspberry Pi Pico has 26 GPIO pins. That's not quite enough. Even the PGA2040 only has 30 GPIO pins. And that's all the GPIO pins that the RP2040 chip has, I'm afraid. Again, I only discovered this when writing it down. Documenting things even before I start making anything seems to be an excellent way to clarify things.</p>"},{"location":"projects/daq.html#option-2-the-samd-family-of-microcontrollers","title":"Option 2: The SAMD family of microcontrollers","text":"<p>An alternative is the SAMD21, which I've come to like using because I can solder it by hand. The SAMD21 has six SERCOM interfaces, which you can configure to be either USART, I2C or SPI. Nice! Except I need seven SPI interfaces. The SAMD51 can give me eight SPI interfaces. It comes in a 64 or 100 pin TQFP package, so I have plenty of pins. I need 32 pins for eight separate SPI buses. I hope I can mill the board for a TQFP chip and solder it. The SAMD51 also has a high-speed SD card interface, which might come in handy for logging data.</p>"},{"location":"projects/daq.html#data-processing-display-and-storage","title":"Data processing, display and storage","text":"<p>I want to learn to use direct memory access (DMA) to receive a value from each sensor, store it in a specific place in memory and when all the DMA channels have flagged the transfer as complete, the main processor takes them from memory and combines all the 24 bit numbers them into one 192 bit number. It then saves that number to the SD card and sends it to the host computer over USB. I might make that number a little bigger, so that I can include timestamps. It seems that USB can carry 512 to 1024 bytes, so that should be fine.</p> <p>On the computer I can make a simple Python program that receives the number, takes it apart into the individual sensor values and adds a plot point on all the graphs using Matplotlib. I can simply keep everything in RAM while it's recording and save the file afterwards.</p>"},{"location":"projects/daq.html#galvanic-isolation","title":"Galvanic isolation","text":"<p>Keeping noise away from it is going to be your main problem.</p> <p>-Anonymous user on the AD7195 thread on the Arduino forum.</p> <p>It might be a good idea to galvanically isolate the DAQ device from the USB port. I could use something like this or this, based on the  ADuM3160 from Analog Devices, or I could try to use the chip on my own board. Here's another one, based on the Analog Devices Adum4160/Adum3160. It even has a galvanically isolated 400 mA power output!</p> <p>To make sure that I can pipe SPI signal over 1-3 m long cables, I've been wondering if I should put a microcontroller on board with the AD converter and use it to take the SPI signals and send them over CANBUS or some other differential signaling method. This note on isolated SPI communication could be useful. It mentions the LTC6820, a chip that uses a similar method; to convert SPI into a differential signal to carry over long wires. So if plain SPI doesn't work, some sort of differential signaling is needed. How about RS-485? I noticed that it's been used a lot at the Center for Bits and Atoms.</p> <p>What? You mean you want to use the Cat-6 cable for the accelerometers? That's actually a bad idea. The ADXL345 is using either I2C or SPI communications and both of those are \"single ended\" meaning each signal is carried on one wire plus ground. That doesn't require twisted-pair cable. In fact, twisted-pair cable is bad for both of those. How far away are the acccelerometers? I2C can have problems with wires as short as 10cm and will always require hard work to get it to go more than 2m. SPI will work at high speed up to 3m and by switching to lower speeds you can get 10m with no special effort on the wiring. Just regular ribbon cable works - not twisted pair. I've got a system of 4 ADXL345's on about 8m of wire in some very harsh conditions and I have had no problems since switching the SPI clock divider to 4. They're sampling one axis each at 400Hz. One tip for the ribbon cable: put a DC wire between clock and data, such as ground. Adjacent wires will transmit high frequency interference between them. My long cables go: CS, MISO, 3.3V, MOSI, GND, CLK. I can share the design for the remote accelerometer PCBs if you want to get some made at OSHPark.</p> <p>-Arduino forum post by user MorganS.</p> <p>One tip for the ribbon cable: put a DC wire between clock and data, such as ground. Adjacent wires will transmit high frequency interference between them. My long cables go: CS, MISO, 3.3V, MOSI, GND, CLK. I can share the design for the remote accelerometer PCBs if you want to get some made at OSHPark.</p>"},{"location":"projects/daq.html#configuration","title":"Configuration","text":"<p>It would be convenient if the sensor modules would tell the main board what they are and how they need to be configured. This is inspired by the plug-and-play functionality of Modular Things. I looked around for an EEPROM memory that I could use to store the sensor's information, but it would be best if I could use a part in the Fab Lab inventory. </p> <p>The ATTINY412 is cheap at $0.50 a piece, and it has a 128B EEPROM. I can hook it up to the same SPI bus as the sensor and it stores the sensor's properties in its EEPROM. When it's connected to the main board, it sends the information and then stops communicating. Now the main processor knows the sensor's properties and sends the proper gain and sampling frequency to the ADC, and the ADC starts streaming data over SPI. It would also be nice to display the sensor type on an OLED screen.</p> <p>Another improvement could be to add a small battery to the main board, so that it can tell the time between data recording sessions. I find it annoying when I have to set the date and time every time I use a recording device. Maybe a supercapacitor would do the trick. It only needs to last for one or two weeks while updating the time every minute or so.</p>"},{"location":"projects/daq.html#schematic-design","title":"Schematic design","text":"<p>I found an Arduino forum thread where jim-p generously shared his schematic for a 24 bit measurement module using the AD7195. I'll base my own design on that, as well as the weigh scale example near the end of the AD7190 datasheet and a circuit note on the product page.</p>"},{"location":"projects/math-animations.html","title":"Math animations","text":""},{"location":"projects/math-animations.html#overview","title":"Overview","text":"<p>Animated circle generated with the manim library for Python.</p> <p>I'm trying out Grant Sanderson's (3Blue1Brown) math animation library for Python. I'm using the community-supported edition of manim, which is the most stable and best documented version. </p>"},{"location":"projects/math-animations.html#installation","title":"Installation","text":"<p>I had a lot of trouble installing manim. First I tried to install it on Linux Mint, which I have running in a virtual machine. I followed the official installation instructions, but when I tried to run a demo animation, I got an error saying that manim isn't installed. Then I tried the Windows installation instructions using Chocolatey and tried to run the demo in VSCode, but I got a similar error. I then tried installing manim in a virtual environment in Anaconda, but that didn't work either.</p> <p>Finally I came across a nice tutorial which shows how to install manim in Google Colab. It almost worked, but I got an error related to the comment in this code:</p> Faulty tutorial codeFixed code <pre><code>%%manim SquareToCircle      # Note the difference from the manual!!!\nclass SquareToCircle(Scene):\n    def construct(self):\n        circle = Circle()  \n        circle.set_fill(PINK, opacity=0.5)  \n        self.play(Create(circle)) \n</code></pre> <pre><code>%%manim CreateCircle\nclass CreateCircle(Scene):\n    def construct(self):\n        circle = Circle()  \n        circle.set_fill(ORANGE, opacity=0.5)  \n        self.play(Create(circle))  \n</code></pre> <p>So I removed the comment (and changed the class name and the fill color of the circle) and I got the animated circle above. I don't understand why the code comment caused a problem, but at least I can finally try out manim! </p>"},{"location":"projects/math-animations.html#design-file","title":"Design file","text":"<p>You can try out all the code on this page without installing anything on your machine:</p> <p>manim-basics.ipynb - Google Colab notebook</p> <p>One code snippet doesn't work. Can you make it work? Please let me know if you figure it out.</p>"},{"location":"projects/math-animations.html#learning-the-basics","title":"Learning the basics","text":"<p>Check out the official quickstart guide for explanations on how all the code on this page works.</p> <p>Here are more demo animations with code:</p> Square to circleSquare next to circleAnimateFlipShiftDifferent rotations <p><pre><code>%%manim SquareToCircle\nclass SquareToCircle(Scene):\n    def construct(self):\n        circle = Circle()\n        circle.set_fill(ORANGE, opacity=0.5)\n        self.play(Create(circle))\n\n        square = Square()\n        square.rotate(PI / 4)\n\n        self.play(Create(square))\n        self.play(Transform(square, circle))\n        self.play(FadeOut(square))\n</code></pre> </p> <p><pre><code>%%manim SquareNextToCircle\nclass SquareNextToCircle(Scene):\n    def construct(self):\n        circle = Circle()  # create a circle\n        circle.set_fill(ORANGE, opacity=0.5)  # set the color and transparency\n\n        square = Square()  # create a square\n        square.set_fill(BLUE, opacity=0.5)  # set the color and transparency\n\n        square.next_to(circle, RIGHT, buff=0.5)  # set the position\n        self.play(Create(circle), Create(square))  # show the shapes on screen\n</code></pre> Now the comments are OK! Something else must have been the problem.  </p> <p><pre><code>%%manim AnimatedSquareToCircle\nclass AnimatedSquareToCircle(Scene):\n    def construct(self):\n        circle = Circle()  # create a circle\n        square = Square()  # create a square\n\n        self.play(Create(square))  # show the square on screen\n        self.play(square.animate.rotate(PI / 4))  # rotate the square\n        self.play(\n            ReplacementTransform(square, circle)\n        )  # transform the square into a circle\n        self.play(\n            circle.animate.set_fill(ORANGE, opacity=0.5)\n        )  # color the circle on screen\n</code></pre> Same thing as Square to circle, but using the .animate method. You have more control over the individual elements when you use the .animate method.  </p> <p><pre><code>%%manim AnimatedSquareToCircleFlip\nclass AnimatedSquareToCircleFlip(Scene):\n    def construct(self):\n        circle = Circle()  # create a circle\n        square = Square()  # create a square\n\n        self.play(Create(square))  # show the square on screen\n        self.play(square.animate.flip())  # flip the square\n        self.play(\n            ReplacementTransform(square, circle)\n        )  # transform the square into a circle\n        self.play(\n            circle.animate.set_fill(ORANGE, opacity=0.5)\n        )  # color the circle on screen\n</code></pre> All I've done here is put flip() instead of rotate(PI / 4).  </p> <p><pre><code>%%manim AnimatedSquareToCircleShift\nclass AnimatedSquareToCircleShift(Scene):\n    def construct(self):\n        circle = Circle()  # create a circle\n        square = Square()  # create a square\n\n        self.play(Create(square))  # show the square on screen\n        vector_1 = Vector([1,2])\n        vector_2 = Vector([-5,-2])\n        self.play(square.animate.shift(vector_1, vector_2))  # shift the square\n        self.play(\n            ReplacementTransform(square, circle)\n        )  # transform the square into a circle\n        self.play(\n            circle.animate.set_fill(ORANGE, opacity=0.5)\n        )  # color the circle on screen\n</code></pre> This returned an error. I don't know how to use the shift command. Maybe I'll get it to work later.</p> <p><pre><code>%%manim DifferentRotations\nclass DifferentRotations(Scene):\n    def construct(self):\n        left_square = Square(color=WHITE, fill_opacity=0.7).shift(2 * LEFT)\n        right_square = Square(color=GREY, fill_opacity=0.7).shift(2 * RIGHT)\n        self.play(\n            left_square.animate.rotate(PI), Rotate(right_square, angle=PI), run_time=2\n        )\n        self.wait()\n</code></pre> </p> <p>Next I'm going to try some of the examples.</p>"},{"location":"projects/t412.html","title":"Hello ATtiny412 USB","text":"<p>I'm working on a version of Neil Gershenfeld's hello T412 boards that would be a good fit for my secondary school students. See Neil's boards here: Basic, output, input and networking. I'll use the ATtiny412 because it's so cheap that all the students can take their boards home with them. This microcontroller is also easy to solder.</p>"},{"location":"projects/t412.html#neils-board","title":"Neil's board","text":"<p>I'm basing the board on Neil Gershenfeld's t412-blink-3 pin board. Its design files are on the Fab Academy 2023 Embedded programming page.</p> <p>First I had a student in my Fab Lab class draw Neil's board in KiCAD, mill it on the Modela MDX-20 and solder the components onto it. The board has a 10 uF decoupling capacitor for the ATtiny412. She then programmed the board using Neil's Arduino sketch:</p> <p>It blinks!</p> <p>The student took the board home, but she doesn't have a USB to serial cable, so she cannot power the board when she wants to. </p>"},{"location":"projects/t412.html#design-spiral-1","title":"Design spiral 1","text":"<p>So my first design modification was to add a USB breakout board to easily power the board:</p> <p></p> <p>It didn't work. When I measured it plugged into a USB power supply, I discovered that its polarity was reversed. Strange, I thought I had checked the polarity before milling. Anyway, lets swap +5V and GND and try again:</p> <p></p> <p>Here it is running Neil's Arduino sketch on USB power:</p>"},{"location":"projects/t412.html#design-files","title":"Design files","text":"<p>My student's board:</p> <p>Download hello_t412_3_blink KiCAD project</p> <p>Download hello_t412_3_blink traces PNG file</p> <p>Download hello_t412_3_blink interior PNG file</p> <p>The USB power breakout board:</p> <p>Download usb_power_for_UPDI_MCUs KiCAD project</p> <p>Download usb_power_for_UPDI_MCUs SVG file</p> <p>Download usb_power_for_UPDI_MCUs traces PNG file</p> <p>Download usb_power_for_UPDI_MCUs interior PNG file</p> <p>Code:</p> <p>Download Neil's Arduino sketch</p>"},{"location":"projects/t412.html#design-spiral-2","title":"Design spiral 2","text":"<p>Design spiral 2 was to put the USB connector on the board with the ATtiny412:</p> <p></p> <p>When working on this board I realized that I had turned the USB connector the wrong way on the USB breakout PCB and that had caused the reversed polarity. So I turned the USB connector the right way round this time and still got the polarity wrong.</p>"},{"location":"projects/t412.html#design-spiral-3-recommended","title":"Design spiral 3 (recommended)","text":"<p>OK. Let's try again, and make the board nice and compact this time. And add a button, for good measure. That makes for more interesting programming exercises.</p> <p></p> <p>Components: ATtiny412, SMD button, 1000 Ohm resistor, LED (any color), 3 pin SMD header (use pliers to break 3 pins off), all from the Fab Lab Inventory.</p> <p>I put three layers of cloth tape on the back of the board, so that it fits snugly into the USB port. Any tape will do, just keep adding layers until the board stays connected inside the USB port.</p> <p></p> <p>To be able to use the ATtiny412 chip, you need to install the Arduino IDE (preferably version 1.8.13) and then install the MegaTinyCore.</p> <p>To connect the board to the computer, plug Neil's serial UPDI-3 pin board (pins, components, traces, traces+exterior, interior) to an FTDI cable like you see in the video at the top of this page (take care to get the wire colors right).</p> <p>I used the DigitalInputPullup example sketch to get the button working. Then I added a boolean logic variable and inverted its value when the button is pressed. This way, I can toggle the LED. </p> <p>The code didn't work the first time around because the button bounces when I press it, and that toggles the LED many times. As a quick fix, I added a 200 millisecond delay and the board now works nicely with this code:</p> <pre><code>bool i = false;\n\n\nvoid setup() {\n  //configure pin 2 as an input and enable the internal pull-up resistor\n  pinMode(2, INPUT_PULLUP);\n  pinMode(4, OUTPUT);\n}\n\n\nvoid loop() {\n  //read the pushbutton value into a variable\n  int sensorVal = digitalRead(2);\n  // Keep in mind the pull-up means the pushbutton's logic is inverted. It goes\n  // HIGH when it's open, and LOW when it's pressed. Turn on the LED when the\n  // button's pressed, and off when it's not:\n  if (sensorVal == LOW) { \n    i = !i;\n    delay(200);\n  }\n    if (i == true) { \n    digitalWrite(4, LOW);\n  } else {\n    digitalWrite(4, HIGH);\n  }\n\n}\n</code></pre> <p>This is a nice minimal board that makes for a good first project:</p>"},{"location":"projects/t412.html#design-files_1","title":"Design files","text":"<p>Download hello_LED_USB-2 KiCAD project</p> <p>Download hello_LED_USB-2 SVG file</p> <p>Download hello_LED_USB-2 traces PNG file</p> <p>Download hello_LED_USB-2 interior PNG file</p>"},{"location":"projects/t412.html#design-spiral-4-abandoned","title":"Design spiral 4 (abandoned)","text":""},{"location":"projects/t412.html#adding-inputs-and-outputs","title":"Adding inputs and outputs","text":"<p>Now I want to expand the board a little bit, so that students can connect sensors to it. </p> <p>I'll make a board that breaks out all the pins of the ATtiny412. I think I'll try to make something similar to Adrian Torres' Adrianino ecosystem, which is based on Neil Gershenfeld's classic hello boards. It might also be a good idea to make it compatible with the Keyestudio 37 in 1 Sensor Kit that we have at the lab. That makes for a quick way to try out a lot of sensors. </p> <p>Note</p> <p>If I use pin PA1 for TX instead of the default PA6 pin, then I can break out the DAC on pin 0. If I have room to route it, that is.</p> <p>Power and ground take up two pins on the microcontroller. If I put a button and an LED on the board, that uses up two pins. If I also do software USB communication and chip programming using the TX and RX pins, then I only have two IO pins left. One of those pins is the UPDI programming pin, so programming via USB had better work. Two IO pins is not a lot, but they should be enough to do a few interesting things. And the board stays tiny!</p>"},{"location":"projects/t412.html#adding-bit-banged-usb-communication","title":"Adding bit-banged USB communication","text":"<p>Using sensors with the board requires a serial connection to a PC, so that you can get the sensor values in the serial monitor.</p> <p>Warning</p> <p>If I run the ATtiny412 at 3.3V for USB communication, it might be incompatible with the Keyestudio sensor kit. Remember to check the sensor voltage before continuing with design spiral 3.</p> <p>Direct USB communication would simplify the board's pinout and enable to program the board at home, so I'm looking into V-USB. This thread has practical info on software USB communication with the ATtiny45 and I can use it with minor modifications for the ATtiny412. The thing that complicates the board design is that USB power is 5V but USB logic is 3.3V. I'm thinking that I'll put a 3.3V regulator on the board and run the ATtiny412 on 3.3V. That way I can do USB communication at the right voltage.</p> <p>Two solutions to the voltage problem are listed in the V-USB hardware considerations. Solution A is to reduce the supply voltage for the microcontroller. The ATtiny412 can run at 3.3V, so I put a 3.3V regulator on this board:</p> <p>USB board with a 3.3V regulator (highlighted) for the ATtiny412.</p> <p>The board is as compact as I could make it. I even reduced the size of the pads for the button. All I had to do was to select the button footprint and press Ctrl+E. Then I made the pads smaller and saved the footprint with Ctrl+S. That only saves the modification for this board, but doesn't change the footprint in the library. I followed this tutorial.</p> <p>Notice the yellow banner that says: \"Editing SW1 from board. Saving will update the board only.\"</p> <p>When the design was finished, I read further and saw that the microcontroller needs to run at a minimum of 12 MHz. In the ATtiny412 datasheet I discovered that the clock only goes up to 10 MHz when the supply voltage is 3.3V. OK. So I need to throw out the regulator and go with solution B in the V-USB hardware considerations.</p> <p>Useful documentation on the ATtiny412 from Fab Academy students is here and here. The FabFTDI is also interesting, because it uses the ATtiny45 with the V-USB library for software-only USB communication.</p>"},{"location":"projects/t412.html#update","title":"Update","text":"<p>I'm in a rabbit hole. As I kept reading about V-USB, the complexity of this tiny project grew. I need to set up the AVR-GCC toolchain and dependencies, modify a make file, set fuses and what not. While I do want to try that at some point, that is not the right thing for my secondary school students. So this is where spiral 3 stops, at least for now.</p> <p>Adafruit reports that the bit-banged USB stuff is becoming increasingly incompatible with modern PC-side USB controllers (well, the other way around), urging people away from the Tiny85 \"ArduinoLike \" products.      - AVR Freaks post by user westfw</p>"}]}
\ No newline at end of file
diff --git a/public/sitemap.xml.gz b/public/sitemap.xml.gz
index b09850d9ddb7eae4904e9ef58f521139584891ed..b74079a1618f025bb40ef63687128523ba9d6306 100644
Binary files a/public/sitemap.xml.gz and b/public/sitemap.xml.gz differ