• Solenoids, please

    Dima Matasov05/09/2024 at 03:34 0 comments

    The last couple of days I spent in a war with solenoids and I must say, I was completely losing to them :)

    I tried several designs: with one and two coils, with different magnets, and with springs/rubber bands. Eventually, I think I've found a working solution, but I was on the verge of giving up to the damned physics and throwing in the towel haha. Along the way, I remembered how to solder steel using aspirin: it smells quite strongly...

    So, conclusions:

    • Magnetic conductivity is a serious matter. Not all iron pieces are magnetized equally: stainless steel magnetizes poorly, steel for nails and bolts is passable, but special ferrite rods for solenoids are the best. Moreover, they are much lighter than iron pieces and turn out to be more efficient.
    • Neodymium magnets are just magic! This tiny thing is very strong for its volume.
    • Simply wrapping a coil around a rod is not enough, you need to close the magnetic circuit (or understand at which point you intend to attract/repel something.
    • Rubber bands and springs are not friends of miniature constructions - they are often very stiff. I can't imagine how various wristwatches are made so precise. Also, finding the right spring in the states is harder and more expensive than ordering a microchip lol.

    I also experimented with the number of turns of the solenoid and came across an amusing paradox:

    1. The magnetic field strength of a solenoid B = u(N/L)I where u is the relative magnetic permeability, N is the number of turns, L is the length of the solenoid, I is the current.
    2. I = V/R according to Ohm's law, and R is directly proportional to the length of the wire, that is, the number of turns. I ~ V/N

    we get that B ~ u(N/L)(V/N) = u(V/L) basically, no matter how much you wind - it’s all the same hahaha whether 1 turn or 1000. When I came with this question to GPT and asked it to draw a graph of the optimal number of turns for my parameters, it reasoned in the same way and drew me a constant :D

    Fortunately, good old googling threw me this wonderful post on Reddit: https://www.reddit.com/r/ElectricalEngineering/comments/5rc0y4/calculating_the_ideal_number_of_turns_to_maximize/

    In short, we forget about 2 important assumptions:

    1. Actually, we forgot about the internal resistance of the power source in this equation: B ~= N/(Rinternal + kN). okay, we already get a curve asymptotically converging to a constant - at least intuitively understandable
    2. And while we're winding, we're increasing the diameter of the circles. that is, the resistance per circle grows faster than the strength of the magnet and the curve actually has an extremum.

    Another funny conclusion from the first equation - winding the coil lengthwise seems useless! (doubling the number of turns wound one on top of the other, we double the length of the solenoid, the twos cancel out, hehe) the most effective strategy - winding a single wire thickness spiral! but the problem with that is that such a spiral will have a very very low resistance and a hellishly huge current will flow through it (if found) and burn it :) so the length of the coil actually regulates its energy consumption. All other things being equal, a long coil with higher resistance and a smaller current is more efficient than a single-wire spiral.

    Here's a solenoid force calculator I made :)

    I put together a working prototype of one voxel. At 24V power, it manages with quite short current pulses, but if you jerk it back and forth, it heats up significantly. Perhaps it's worth considering temperature control.

    Also, I learned about PCB solenoids / PCB motors while figuring all this out. Perhaps this is a decent way to further miniaturize the entire construction https://www.youtube.com/@CarlBugeja

    And one more: I recently stumbled upon a project very similar to mine on hackaday: https://hackaday.io/project/191181-electromechanical-refreshable-braille-module

    Amazing tiny stuff here, kudos!

  • One step back

    Dima Matasov05/09/2024 at 03:03 0 comments

    So, a bit of background:

    When I was a kid, one of my favorite games was a very geeky DOS game - Snake Battle (Змеиный Бой) by Gamos (You can play it here through DosBox right in the browser!). The essence of the game was that you had to program a snake and send it into the arena to compete with other snakes in biting off each other's tails :) 

    Over time, it had a couple of reincarnations like this one, and it was clearly inspired by one of the oldest games for programmers — CRobots.

    But Snake Battle was actually brilliant compared to them because of its visual language used for writing the "brains" of the snakes: you were limited to just 9 slots of 7x7 cells, in which you "drew" game situations that the snake tried to apply on the field sequentially. This provided quite strict game frameworks, which fueled the excitement, and even as a child, you understood that the best champion snake also had only 9 "brains" in its head, and if you tried hard, you could approach or outsmart it. In purely programming games with full Turing-complete languages, the best snakes/agents are monstrous neural networks that sweaty nerdy researchers write over long months — the motivation to compete with them is significantly more phantom.

    It should look something like this:

    • A physical board of 21x21 (in the original game it was 25x25, but we programmers love everything to divide by 8, and 25 divides by 8 very wastefully)
    • Each cell of the board is a small bistable plunger on a solenoid that can rise up and lower down: usually, the field is lowered, but the snake's body protrudes above it
    • On the cap of each such plunger, there are 9 RGB LEDs to draw snakes and other objects
    • Optionally, a phone app that pairs with the field via BLE and can launch games on the field. Or acts as a joystick, if you decided to run a regular snake game and eat apples
    • All this is quite small, say no more than 15x15 cm, and runs on a battery.

    But then I realized that there you could launch quite a large class of retro toys like puzzles, city builders, platformers, and other minesweepers. Especially if you make each plunger also a button (that is, you can press it with your finger or—possibly—by touching it in the lowered position—raise it.

    For now, the question of what exactly would be interesting to launch there is open, we'll come back to it later.