Seven Segment Display

temps2

I’ve finally finished this project and it’s working exactly as intended. My only regret is that the two LED displays are slightly crooked. I had taken for granted that they would somehow align themselves on the circuitboard but I only realized that wasn’t the case after I had soldered the 14 pins.

temps1

It’s extremely visible and readable from across the living room.

In any case, another one in the books. It’s in Fahrenheit for now because the numbers were bigger. A single byte would cover up to 256 if I only wanted to display three-digit integers, but I wanted four digits of precision, so I went on a quest to learn how to send two bytes at a time, which turned out to be less than trivial. Send-a-byte/read-a-byte is pretty simple but sending an array of bytes required I reacquaint myself with C arrays and memcpy(). I had gotten too comfortable with Python’s list slices and completely forgotten the syntax for pointers.

Python and Arduino code for this project is here


Thursday, March 14, 2024


Electronics

These digits should be in order

I’m working on a CPU/GPU readout for my PC. So far it’s been a week of on-and-off soldering and handwiring and tinkering with this Arduino Nano clone, seven segment displays, and shift registers, for something one could probably find on Aliexpress for less than $10.

board

I mean, that’s not the point though. Neither is the coding part or the learning how electronics work, really. On paper this is pretty much a waste of time and money. I enjoy it though. It’s a great intersection between my love of technology and my love of craft. A successful solder joint gives me the same feeling as a good plane shaving. In this case though, it’s an additive process as opposed to subtractive. Instead of carving material off, you’re adding metal and silicon to your project, and you can feel the board getting physically heavier as you go along.

The handwiring bit is a carryover from my time spent building keyboards from scratch. For some reason I’ve come to enjoy working with magnet wire, thanks to my custom tool, which is actually just an Xacto knife with half the blade snapped off. I use it to carefully scrape off the enamel insulation. I find this better than working with plastic/rubber insulated wire, which tends to melt, shrink, crumble, etc. Also, the negligible thickness of the insulation means the wires take up way less space, so I can cross wires over a lot more before having to resort to creative wire routing.

wires

Mostly, the shiny red wire is pretty and reminds me of a nervous system.

The hardware is all set up and appears to be working OK (with no magical smoke), but the digits are not showing up in order.


Monday, February 19, 2024


Raytracing

I was lamenting on Discord about having never found an on-ramp for linear algebra despite learning it several times over, and someone recommended The Ray Tracer Challenge by Jamis Buck.

It starts all the way from the bottom, from tuples to points and vectors and matrices, but doesn’t really get bogged down in the math a whole lot, which was what the entirety of linear algebra was like for me through high school and college. I even somehow slogged my way through a computer graphics class in college that probably followed the same curriculum in this book. By the time we got to any actual graphics work in that class, I was already mentally checked out having had to hand-compute matrix products and determinants. Not to mention, the class was held in C for a program that was taught primarily in Java.

However, Buck moves with a quick “let’s just go through this once and move on” pace and doesn’t take his time getting to why all these concepts are useful. This time around, I’ll be writing in Python. In addition, rather than implementing all the transformations by the book, I’m just going to take advantage of the power of NumPy, another thing I hadn’t really gotten too deeply into for lack of practical applications.

I swear, once I make it all the way through this book, I’ll come back and do a few more of these by hand, but for now this stuff is actually pretty exciting and I have made my first computer-generated image file since college:

projectile

def projectiles():
    height = 400
    width = 400 
    canvas = np.zeros((height, width, 3))
    
    for magnitude in range(4,100):
        start = np.array((0,1,0))
        velocity = np.array((1,1.8,0)) 
        velocity = (velocity / np.linalg.norm(velocity)) * magnitude* .2
        p_pos = start
        p_vel = velocity
        env_grav = np.array((0,-0.1,0))
        env_wind = np.array((-0.04, 0, 0))

        while p_pos[0] >= 0:
            #tick
            p_pos = p_pos + p_vel
            p_vel = p_vel + env_grav + env_wind

            #print(p_pos)
            ppm.write_pixel(canvas, int(p_pos[0]), height - int(p_pos[1]), ppm.RED)

    ppm.write_ppm(canvas, "projectile.ppm")

Anyway, that was just for outputting 2D files. I’m still working my way through 4x4 matrices before I get to the fun 3D stuff.

Also I did write the file output myself. The book works in PPM files, which are just plain text files, and quite handy for debugging.


Sunday, January 14, 2024


Learning 2

Learn

Hello, I have come to collect my six figures, please.


Tuesday, January 09, 2024


Learning

So I decided it’s finally time to learn what machine learning is all about. If my eGPU isn’t going to be any good for games, I might as well put it to use for something, and here we are.

I came across Google’s intro to ML stuff and got started on that. Turns out, according to Google all you need are:

  • A solid knowledge of Python
  • Basic programming skils

I’m not sure how you’d have the former without the latter, but I guess I consider myself close enough to both. I always imagined the requirements being more along the lines of:

  • Access to a bunch of noisy hot things in a data center
  • Strong programming skills
  • A solid grasp of linear algebra, maybe some sort of degree.

I have none of these, but at this point I’ve decided I usually have the most fun diving into something without any actual research, and hope to find out along the way.

It’s already paying off because I’ve finally installed and used Conda for the first time. At first I installed Anaconda, and learned that Anaconda is a whole suite of stuff I probably won’t be using any time soon, so I removed it and installed Miniconda instead. So far, as a single user with a very small development footprint, it hasn’t proven to be any different from my usual Python usage, except it’s conda install instead of pip install.


Monday, January 08, 2024