UART Can’t? Arduino CANSerial Can!

[Jacob Geigle] had a problem. A GPS unit and a Bluetooth-to-serial were tying up all the hardware UARTs on an AVR Arduino project. “Software serial”, I hear you say. But what if I told you [Jacob] already had the board in question sending out data over CAN bus?

[Jacob]’s sweet hack creates an arbitrary number of CAN “devices” inside the Arduino code, and can treat each one of them as its own serial data channel. The “N” in CAN stands for network, after all. The trick is to create a device ID for each desired CANSerial interface, which is done in his library using the usual Arduino setup step. A buffer takes care of storing all the different channels until they can be pushed out over the hardware CAN peripheral. On the big-computer side of things, some software listens for the different “device” enumeration IDs and assigns each a virtual serial port.

While this was a hack born of necessity, we can see it as a clever opportunity to segregate information coming from the microcontroller into different streams. Maybe a debug channel, a command channel, and a data channel? They’re virtual devices, so go nuts!

While we usually see CANbus in its native habitat – inside your car – it’s also cool to think of the uses we could put it to. For instance, controlling a 3D printer. Need a CAN refresher? We’ve got just the ticket.

[Bus photo: Malta Bus; The terminus, Valletta by John Haslam. Can photo: Paint Cans by Daniel R. Blume. Horrible visual pun: I’m afraid that’s on us. You try finding images for CANbus code!]

Photovoltaic Cells In LTSpice

We like to build things using real parts. But we do think the more you can model using tools like LTSpice, the less time you can spend going down dead ends. If you need to model a common component like a resistor or even an active device, most simulators have great models and you can tweak them to have realistic parasitic effects. But what if the component you want isn’t in the library or doesn’t have the fidelity you want? [FesZ] wanted to model photovoltaic cells and had to build his own model. The resulting two videos are well worth watching.

Building your own models in Spice isn’t necessarily very difficult. However, knowing exactly what to add to model different real-world effects can be challenging. The videos do a good job of showing how to mutate a simple diode into one that produces current when exposed to light.

Continue reading “Photovoltaic Cells In LTSpice”

Fighting All That Can Go Wrong With Resin

[Jan Mrázek] is on a quest to make your resin 3D prints more accurate, more functional, and less failure prone. Let’s start off with his recent post on combating resin shrinkage.

When you want a part to have a 35 mm inner diameter, you probably have pretty good reasons, and when you draw a circle in your CAD software, you want a circle to come out in the real world. Resin shrinkage can put a kink in both of these plans. [Jan] identifies three culprits: resin squeezing, resin shrinkage, and exposure bleeding. And these three factors can add up in unexpected ways, so that you’ll get a small reference cube when you print it on its own, but large reference cubes when printed as a group. [Jan]’s article comes with a test piece that’ll help you diagnose what’s going on. Continue reading “Fighting All That Can Go Wrong With Resin”

Think You Know How Mario Kart Works?

In what looks like the kickoff of a fun video series, [MrL314] takes us on a quick but deep tour of how the AI in Mario Kart works. (Video, embedded below.) Don’t play much Mario Kart anymore? Well, have a look anyway because some of the very simple tricks that make Bowser pass Princess Peach without running into her might be useful in any manner of pre-programmed navigation scenarios.

Quick spoilers. The CPU players move through different zones, each with a desired speed and a vector direction field that changes the direction they should point in. Only when they run off course do they actually compute headings to their target. Setting this desired direction and speed beforehand greatly reduces the on-the-fly computation needed.

Then you throw other players into the mix, and a very simple distance-dependant turning algorithm makes for clean overtaking. This effect is hand-tweaked for the particular racecourse, though, because you don’t want Luigi driving off the thin stretches on Rainbow Road. For more technical details, you can check out [MrL314]’s notes.

If anything, this video gives us a further appreciation of the clever little hacks that create apparently complex interactions from tremendously simple rules. Remember Mario Kart when you’re programming in that next multi-gigabyte neural network model, OK?

Continue reading “Think You Know How Mario Kart Works?”

Dithering Makes Everything Cooler: Now Even Animated

[dukope] was writing a game, Return of the Obra Dinn, with a fantastic visual style. One of the choices was to make everything in glorious one-bit color, otherwise known as black and white, and then dither it back to monochrome. You know, like they used to do on the Mac Plus.

If dithering is your aesthetic, then it makes a ton of sense to take it seriously. And it’s absolutely beautiful – check out the video below.

But what’s even more amazing is [dukope]’s attention to detail on the dithering. For instance, this post on the TIG forums details the problems and solutions when you have a dithered image that needs to also be animated. You want the dots to stay relatively constant on the object as the virtual camera pans across the scene, and that’s going to necessitate a custom algorithm. And if you think that’s cool, have a look at how the book at the center of the game is animated.

What can we say. We loved dithering before, but this post has made our love even deeper.

Continue reading “Dithering Makes Everything Cooler: Now Even Animated”

Moteus Open Source BLDC Controller Gets Major Upgrade

[Josh Pieper] of mjbots Robotic Systems just released a major revision to his moteus open sourced brushless DC (BLDC) electric motor controller. The update adds a flexible I/O subsystem which significantly expands the kinds of feedback encoders and peripherals the controller can accept. In the video below the break, [Josh] walks through eleven different example configurations. If you prefer, these examples are also presented in article form on his blog.

The moteus controller originally came about when [Josh] was developing the quad A0, an open source dynamic quadruped robot, along the lines of the MIT Mini Cheetah or Boston Dynamics robotic dogs, and wasn’t satisfied that existing controllers could do the trick. It’s a compact 50 mm square board based on an STM32G4, has an integrated magnetic encoder, and accepts external sensor connections. Interfacing with the board is via CAN-FD using a register-based scheme. A Python GUI tool provides name-based register access via a logical tree structure as well as real-time telemetry plotting capabilities for diagnostic and configuration tasks.

If you are using BLDC motors in your projects, definitely check this out. Even if you’re not using a moteus controller, [Josh]’s demonstrations of the various encoder feedback technologies is very interesting and educational. The entire project is open source, and both the hardware and software design files can be found on the project’s GitHub repository. For some users, this may be a major factor, considering that the latest ODrive BLDC controller offering has become closed source.

We wrote about the mjbots quad A0 in 2019, and you can follow the moteus project over on Hackaday.io. We also found this interesting video by [Skyentific] comparing three popular open source BLCD controllers including the moteus (second video below the break). There’s also the SimpleFOC project we covered last year if you want to dig in and learn more about field-oriented control of BLDC motors. Thanks to [Androiddrew] for the tip.

Continue reading “Moteus Open Source BLDC Controller Gets Major Upgrade”

A 3D Printer Big Enough To Print A Kayak

When one of your design goals for a 3D printer is “fits through standard doors,” you know you’re going to be able to print some pretty big stuff. And given that the TAUT ONE printer by [Nathan Brüchner] could easily be mistaken for a phone booth, we’d say it’ll be turning out some interesting prints.

The genesis for this beast of a printer came from the Before Times, with the idea of printing a kayak. [Nathan] leveraged his lowdown time to make it happen, going through three prototypes. Each featured a print bed of 1,000 mm x 550 mm with 1,100 mm of Z-height, and the overall footprint fits a standard Euro-pallet. It uses a CoreXY design to move the dual-filament hot end, which has ducting for taking cooling air from outside the cabinet. And the machine has all the bells and whistles — WiFi, an internal camera, filament sensors, and a range of environmental controls.

In a nod to making it easier to build, [Nathan] kept all the custom parts either laser cut or 3D-printed — no mill or lathe required. He also points out that he used only quality components, which shows in the price — about 3,000€. That seems like a lot to be able to print kayaks that you can buy for fraction of that amount, but we certainly appreciate the potential of this printer, and the effort that went into making it work.