Category: Uncategorized

  • React State | Front-end Web Development

    A new concept I’m starting to learn in my Coursera course on React Basics (view post series here) is React “States.” States in React is an interesting way of storing the “state” or current information about a variable or function.

    As a new topic, I’m still learning how React works. For an actual professional, please refer to a better explanation.

    The first example of utilizing state is the “React.useState” hook. To use useState, you assign it to two array values that usually consist of one variable storing the value and another variable to set the value of the state. For example:

    import { useState } from 'react';
    
    function exampleApp() {
        const [user, setUser] = useState("ezra");
        
    }

    First, we import the state hook. Then, in the function, we assign two variables to the useState hook. Inside of the state, it has “Ezra,” which, in this case, sets the default value. If we wanted to add a function to update the state to a value, we could do so as follows:

        
        function updateUser(e) {
            setUser(e.target.value);
        }
    

    Coursera outlines that you generally want to utilize separate functions to handle events. In this case, we have a function that, when called in combination with an input field, will grab the input’s value (e.target.value). We use the setUser that we already declared earlier.

    The complete component example they taught me was:

    import { useState } from 'react';
    
    function ExampleApp() {
        const [user, setUser] = useState("ezra");
    
        function updateUser(e) {
            setUser(e.target.value);
        }
        return (
            <div>
                <h1>{user}</h1>
                <input onInput={updateUser}></input>
            </div>
        )
    }
    export default ExampleApp;

    This creates a page with an H1 element and an Input field. By default, H1 says “Ezra,” but when you type into the input field, it actively changes to what you type.

    example code demonstrated for useState

    It is an excellent and useful concept that will probably be used frequently in future React programming. Coursera also outlined a general guideline for creating components, specifically when and when not to use states.

    As the name implies, you have Stateless and Stateful components, one without any state declarations and others with state declarations. It goes to the basics of how you want things formatted and makes it much easier to later grab the state of an object by passing it down from a parent to a child component rather than having to reinstate that state in each element.

    example of stateful and stateless components in react
    credit: Coursera.org

    States in react go a lot deeper and a lot more complex, but I’m excited to learn more about it.

  • Designing LED Mounts

    Designing LED Mounts

    One of the more recent tasks of my custom drone show drones is the LED light mounts. Getting started, I had only one real option material-wise, based on looking at Stan Humphries’s video covering his complete build, which is 3D printing the attachment.

    The concept: An easily detachable clip-on assembly to the legs of the drone. Has mounting for up to LED modules shining in all directions. A diffuser is mounted on the bottom to enclose the whole assembly. With some inspiration from Stan Humphries’s design, I was able to get started designing in Fusion.

    The first task was getting the CAD files for the frame assembly. This was more diffuse than expected; a quick search on GrabCad yielded nothing useful. But with some Googling, I found that HolyBro (the frame manufacturer) had uploaded the full CAD reference files onto Wikifactory. With that, I could roughly assemble the frame parts in Fusion 360.

    Timelapse Fusion Assembly

    The first concept was testing the fit of a clip and how much pressure could be held before it could come off. And rather basic screw mounting for the Adafruit LEDs:

    After printing this initial prototype, I realized two important things:

    • The clip style of starting from the middle and moving outward on either side makes it challenging to mount from the bottom quickly
    • The LED mounting was not bidirectional. There would be no proper light distribution.

    The second design fixed both of those issues. Stan fixed the first problem by doing an opposing hook style on both ends. Mounting could be done by rotating it when aligned to the middle of the frame.

    Another feature in the new version is adding a second component: Light Base. The light base has 4 LEDs mounted in all directions at angles to disperse the light as much as possible.

    Light mount in fusion 360

    Both components can be mounted together with standard M3 screws threading directly into the plastic. (Adding heat inserts only adds to the complexity, significantly scaling the number of drones)

    My next version will include more quality-of-life updates, textured hooks to snap attachments more easily off, a mount for the future diffuser, and more holes in hook attachment for routing LED wiring.

  • Meta Front-End Developer Course | 2 Months in

    Meta Front-End Developer Course | 2 Months in

    I’m about two months into my Front End Web Development course, and it’s about time I update.

    As of this writing, I’ve completed four out of nine of the certificate program’s courses. Since my last post, I’ve finished “Programming with Javascript,” “Version Control,” and “HTML and CSS in Depth.” I’m currently in the middle of “React Basics.”

    Programming with Javascript

    So far, this is one of my favorite courses in the program. This is mainly because it’s the only language I never really understood the basics of. It covers the basics from logging into the console to editing and integrating with HTML, how to use event handlers, and editing basic HTML with the console in inspect element.

    One of the more significant concepts introduced was OOP or Object-Oriented Programming. OOP is a recommended programming model for developing applications, where some parts of a website are thought of as modules that can be removed, duplicated, and quickly edited for reusability.

    For example, instead of writing new code every time you want to show the latest blog post, you can create a reusable template that knows how to do this. Then, whenever you need it, you can use that template to automatically grab and display the newest blog post on any page without having to write the code again. A big part of that is being demonstrated in my current course I’m taking on React Basics.

    There’s a much better explanation of how it works and more in-depth here.

    Version Control

    Version control covers the basics of GitHub. As with Javascript, this course was also informative. I’ve used GitHub occasionally for small projects and downloaded many open-source apps, but I never really understood how to use it and how it works. This course covered creating repositories, forking, branching, and basic terminal commands.

    One of the neat things I learned about GitHub that I previously did not know about is the branching system for repositories. In a barebones repository, you have the Main branch, which has the (usually) fully fleshed-out main releases for a project. For example, I’m developing docs for the Drone Project (https://ezraharris.com/category/tech/drone/ series I’m doing on building drones for a drone show). With that, I chose a free template for creating docs called “Read-the-Docs.” Read the Docs has a template with GitHub, which makes it super easy to create a copy from the template page and host it for free using their deployment system. The branching is part of the automatic deployment system; I have two branches in GitHub: a Testing branch and a Main branch. I can make changes to the testing branch that may break the formatting, but that’s not on the main page and won’t affect the primary traffic of users. I can preview edits before pushing the testing branch into the main branch.

    GitHub has much better documentation on using branching and managing pull requests here.

    HTML and CSS in Depth

    This also introduced many new concepts I had no idea were natively possible, like animations, using keyframes for more than just linear animations, and creating super smooth effects with only a couple of lines of code.

    At the end of this course, I had to create a basic homepage using the concepts covered in the course. I was given a choice of four clients. I ended up choosing Lucky Shrub. I was provided a basic description with info about the client, logos, and a couple of preparation videos outlining the site’s basic framework I would create.

    Screenshot of Luckshrub's client option given by coursera

    What made this assignment different from the other courses was the peer-reviewed grading. This is where I had some issues with Coursera. The downside is that they only support uploading HTML and CSS files, for the final project, making it challenging to review my peers’ websites because the links between files and folder structures were strange or because they used images outside of what Coursera provided. In the end, it made for a more complicated grading system than what it needed to be.

    I ended up uploading the whole site to a GitHub repository and hosted it on Pages.dev. Cloudflare provides free basic web hosting and testing applications. (You can view my finished site for the project here)

    I think it’d be a much easier process if Coursera worked with Pages.dev and/or Github to host the sites for previews instead of the mangled way of downloading and hosting it locally they have now.

    Preview of my homepage assignment for Coursera

    Overall, I enjoyed all of the courses, but Javascript and React are quickly becoming the most interesting.

  • The Fusion 360 Experience: Turning Ideas into Reality with Printrbot 3D Printer

    The Fusion 360 Experience: Turning Ideas into Reality with Printrbot 3D Printer

    I recently wanted to learn more about Fusion 360 3D designing. To further my 3D modeling experience, I started another project, this time to redesign one of my existing 3D printers from scratch.

    It started with looking at the Prusa Mini+ and how the X gantry worked. The Prusa Mini is an FDM 3D printer by Prusa, a German company. It has a similar style to how my Printrbot Simple Metal is oriented. One significant difference is that the X gantry moves along the rods instead of the rods moving along a centered Z gantry. For example:

    printrbot simple metal and Prusa mini+ comparison (x axis)

    As shown in the figure, the Prusa Mini+ is designed so that only what is needed is moving, the Fans (part cooling, hotend cooling), Extruder, Hotend, and Z sensor. One plus of having the Prusa Mini Design is that there’s very minimal weight and thus less mass movement. I only have to carry the needed weight instead of a significantly heavier X arm on the Printrbot. This isn’t necessarily a downside. 90% of the Printrbot is machined, so it’s highly durable and can “fall off a table and go right back to printing” – Brook Drumm (CEO of Printrbot).

    Another great thing about the Prusa Mini+ is that Prusa manufactures everything in-house and 3D prints most of the parts for their printers. I have found that to be useful as they also release all of their step files which I can use to modify the designs to my liking. Same with the Printrbot, even with it being shut down a couple of years ago. At BrookDrumm.com, there are uploaded .F3D files for every model he’s produced and even some that haven’t been manufactured,

    Prusa factory tour showing off Prusa’s print farm.

    I started by studying both printer designs in Fusion, how they worked, what made them different, and how I could combine both to create the best of both worlds. Next, I began designing my first iteration of my “Printrbot with the Prusa Mini style”PrintrMini.” The first one was very rough. A ton of wasted printed space, an inefficient motor mount with weight not being distributed properly, and a couple of more minor issues: At this point, I’m hoping for one of my last iterations of the design.

    Designing the actual arm that slides. This is version 1 to see what works best @printrbot Its a bit plain but might work pic.twitter.com/Q6k2aI79Xr— Ezra Harris (@Ezradharris) April 7, 2023

    V1 of my design

    After some feedback on a Discord server, I redesigned both the toolhead and the X-Z gantry mount. This time to be as compact as possible with as even weight distribution as I could manage and utilize many of the original parts. This was V2:

    (Above: I figured out how to render in Fusion, so I tried my hand at it. V2 of my design)

    I also bought an E3D V6 Hotend since the original hotend (Ubis 13s) was rather old and had some flaws compared to the newer V6; since the V6 hotend and the Ubis hotend have very similar designs, the original extruder could mount it, which a massive bonus with not having to order another extruder assembly.

    I decided to go for a very similar style in V2 to the original X/Z gantry attachment. I utilized the same motor mount and lead screw to make it more compact and utilize as many original parts as possible.

    At the moment, I’m working on V3; version 3 would be a machined X/Z gantry with an almost identical design to the original Printrbot billet but without the bearings for the X gantry:

    V3 of my printrbot design

    (Above: V3 of my X/Z gantry mount)

    I didn’t change the toolhead mount in V3, as I’m still finishing up some smaller details on the mount. But since it’s 3D printed, I can always print a new design if my current model has flaws. The new X/Z mount would utilize press-fit bearings and press-fit 8mm rods. Using a machined mount would provide several benefits, one being that it’s aluminum and would be super strong compared to my plastic 3D prints; another is that it would still utilize the aesthetics from the original Printrbot with it being machined metal; it is called Printrbot Simple Metal after all.

    I’m still getting a quote from my brother (CovenantMFG) for that at this time, so v3 may or may not happen. If not, ill probably figure out a way to 3D print it, most likely in Carbon Fiber infused filament for strength and temperature resilience.

    So far, this experience of learning fusion and changing my design over and over for more compact and practical parts has been delightful.

    A big plus in this process has Fusion’s student plan. The student plan allows me access to almost every feature for free as long as I’m a student. Previously I had been using the Personal license, which included limited features, such as only up to 10 design files at a time and only being able to import .step files for converting 3D models.