Monday, December 30, 2013


Typical example

Assisting on a side project, I've put together a program named MILSGen that may help designing and building large, geographically accurate LEGO dioramas. It takes an image representing an elevation map, and splits it down to an array of corresponding MILS modules 32x32 studs in size. In case you haven't heard of it yet, MILS is a concept of creating large landscapes using pre-built modules that can be easily transported and quickly connected using regular Technic pins. (Find more about MILS system on the webpages of Antonio Bellón, who developed and wrote a detailed article about it.)

Side code matches all neighboursIt is a simple text application that lets the user choose an input image, where each pixel corresponds to a single stud at the output. Then, it solves the given terrain segment using several common LEGO plates, trying to keep it as "hollow" as possible to reduce the overall weight and part count. Finally, the standard underlying MILS structure is added, and each module exported into LDraw format one can view in LDView, edit via MLCad, etc.

There are some additional features: it automatically crops the input image to the maximum size that can be created with 32x32 tiles, covers the outside structural edges with closed bricks, lets the user choose the physical height of the highest point of the input image, and even to omit the entire substructure altogether if the overlying terrain is all one needs.

Each model is hollow In addition, to simplify the finaly assembly, one can enable the edge identifiers that put a set of 1x1 bricks at each inner edge, which matches its exact unique pair on its neighbour. The modules are named according to their coordinates in the entire system, borrowing the chess system: letters and numbers indicating columns and rows, respectively. E.g. top left corner is A1, third row in fourth column is D3, etc.

What MILSGen doesn't do are reinforcements. Since I wanted to finish it before the year 2400, structural analysis was out of the question; it is down to the builder of MILS modules to judge where are the reinforcements necessary, and in what amount. Also, it doesn't process input colors but just the pixel brightness: the entire output landscape is green. Acquiring an additional image with colour map and approximating it to a palette of common LEGO colours might be implemented in some of the future versions.

Installation is really simple ― just download the ZIP, unpack everything to a new folder, copy your input image there as well, and run the executable. It's not particularly pretty but it serves its purpose. Make sure to check out the PDF with detailed instructions, prerequisites for the input files and some other remarks included in the ZIP file, or separately available here as well.


Sunday, August 11, 2013

NXT Auto-Engraver Prototype

Typically, the main raison d'être of my LEGO projects is fun, but this one was actually ignited by a specific task that occured, initially unrelated to LEGO: the aim was to engrave a given digital bitmap on a flat surface of a few plastic objects. Sounds like a job for NXT & Technic duet, doesn't it?

Lego-NXT-Engraver-Open Some time ago I've attempted to build an entire NXT CNC for plastic with an electric drill and everything, and it turned out just a tad over-ambitious. This time the basic concept would remain the same ― that is, a vertical rotating drill bit which moves in 3D above the engraved surface. However, this time the mechanical requirements were significantly lower, and the machine doable using fairly regular techniques and parts. The intention was actually to build a prototype as a proof of concept (which explains its ugliness, kludges and devilish colour-clashing), and make a final, finely designed and engineered engraver afterwards, if it turns out to be used regularly.

The drill bit is a standard diamond-coated one used for engraving, and as such the only part which is not LEGO. It is driven by a PF XL and M motors running through and adder to reach sufficient rotation speed without sacrificing the torque, and this structure can be moved vertically with four gear racks and 12T gears, rotated by the first NXT motor. This whole mechanism is suspended on a frame which slides on four rails built using tiles and Technic bricks, and is moved by a pair of large linear actuators running in parallel. The actuators were an obvious choice thanks to their high precision, whereas the vertical movement of the drill is not as critical, since it pushes into the surface to be engraved with the entire weight of the structure anyway.

The Y dimension is regulated by moving the object itself, again on a rail built with tiles and Technic bricks, and moved by a linear actuator ― but this time one was sufficient. The entire extents of the actuators can be used, resulting in an engraving area of slightly over 5x5 studs (40x40 mm), which is more than enough for the objects in question. They are held in place using cradles built from Technic bricks, and secured in place with stop pins. A couple of them simultaneously easily keep the object in place while the drill does its job.

Lego-NXT-Engraver-Structure To speed up and simplify the tedious task of rotating the actuators by hand while moving the drill to a desired starting point, I've added two PF L motors, each of which can be engaged to the actuators' driveshafts when needed using the standard gearbox driving rings, operated manually. In addition, the entire drilling structure can be lifted sideways to allow access to the cradle and the object, and also to change the drill bit if necessary.

The NXT script is very simple ― it reads the movement instructions from an onboard text file. This file is beforehand generated by a short Python program I've made for the purpose, which opens a desired image file, simply rounds it to white and black pixels, and then generates and uploads the file on the Smart brick. It uses a simple scanning algorithm (left-to-right in each line, and each line top-to-bottom) to provide as consistent and precise movements as possible, reduce gear whiplash effects, axle tensions, etc.

All in all, the machine works pretty well. While obviously not engraved on professional equipment, the result was fairly satisfactory and its resolution was even better than I had skeptically expected. For a moderately complex logo about 20x8 mm in size it took about ten minutes, and with some movement optimizations I haven't taken the trouble for in this prototype phase, I'm sure this could be reduced down to about six or seven. Of course, some kind of external power supply is mandatory for mass engraving (which is underway at the time of writing).


Lego-NXT-Engraver-Drill Lego-NXT-Engraver-Sample Lego-NXT-Engraver-Superpos


Tuesday, May 21, 2013

Having fun at the nearby lake


I'm well aware that working, remotely controlled Technic boats based on compact LEGO hulls have already been confirmed as a working concept, but I just couldn't help giving it a little try myself, in the catamaran layout. Nothing extremely developed or fancy ― the intention was to just have some fun testing it at the nearby lake.

It turns out that this design works rather well, and the boat was both swift when running under full throttle, and maneuvrable. Instead of having a drive & rudder motor configuration, it actually uses two parallel propellers, each connected to its independently controlled Power Functions L motor*. Turning is, just like a tank, done by turning the propellers at different speeds, or in the extreme case, turning them in the opposite directions (i.e. a differential drive). They are controlled by an IR V2 receiver and powered by a standard battery pack.

The boat was pretty stable and did not rock too dangerously even when maneuvering rapidly. Design allows the battery pack to be mounted at several points longitudinally (along a Technic liftarm), so that the overall balance of the boat could be finely adjusted in the center. It turns out I was lucky, and the initial configuration from the workbench was already working well.

What wasn't working so well were the propellers which had the tendency to collect every bit of weed floating around the lake and get stuck, and the IR controls which struggled with the intense sunlight, reducing the control range to just barely a meter or two. Of course, in theory an NXT smart brick could be used instead, which offers the extended range of Bluetooth communication, but I simply didn't want to risk ruining it in the water if anything went wrong. Fortunately, it didn't anyway, and the boat actually easily handled some extra weight of a GoPro camera.

In any case, it is not too difficult to build (just make sure it's sturdy and simple), and the hulls can be found on BrickLink for reasonable prices, so give it a try if you feel like a LEGO Captain!


Lego_Catamaran_Boat_Legoism1 Lego_Catamaran_Boat_Legoism2 Lego_Catamaran_Boat_Legoism3 Lego_Catamaran_Boat_Legoism4 Lego_Catamaran_Boat_Legoism6


* Thanks to Sariel for the transmission idea