LEGO Submarine 4.0

By Rosemary Hattersley. Posted

This LEGO builder extraordinaire is a “middle-aged guy from Finland” who dreams up, and then painstakingly creates, working models that address complex physics and mathematical challenges. His latest build, LEGO Submarine 4.0, runs off a LEGO EV3 motor and Raspberry Pi Zero 2 W. Like all his builds, the submarine project is thoroughly documented on his YouTube channel, Brick Experiment Channel, where his methodical approach to construction and problem-solving have earned him more than 2.7 million subscribers.

This is the fourth LEGO submarine design he has completed. The first three variously used propellers to add or reduce buoyancy (“gravity and buoyancy stay always the same while the propellers exert force”); a balloon, and an air compressor to adjust the amount of water displaced, thereby controlling whether the submarine sinks or rises; and a piston ballast to suck in more water to add weight and increase the sub’s gravity.

He settled on the last method for Submarine 4.0, despite the difficulty of gauging the neutral buoyancy point. However, it had proved a more stable setup and would not compress under pressure when submerged. Most importantly, “you can measure the piston position with a LEGO EV3 motor that contains a tachometer. That will help the control loop.” This loop is also the reason for using Raspberry Pi: as we reported last issue, he had recently made an impressive inverted pendulum that uses a PID (proportional integral derivative) control loop running on Raspberry Pi Zero 2 W to accurately measure and compensate for constantly changing speed, location, and pressure levels.

He planned a similar setup here, to monitor and control the submarine’s depth. He soon found the wireless LAN connectivity invaluable when tweaking the PID parameters and updating any Python code without having to physically connect to the Pi Zero 2 W via USB (which would have involved carefully extracting everything from the precision environment he’d created). He now says wireless LAN is “an absolute necessity” which “made the development process a lot faster.”

Underwater flying machine

A fair amount of time and effort went into creating the submarine’s beautiful transparent acrylic case with tightly fitting and invisible end caps. The basic acrylic cylinders were precision-cut and end pieces with rubber seals attached to form a waterproof unit. LEGO gears were fitted to control the syringe that would adjust the buoyancy.

An absolute pressure sensor (which measures pressure relative to a vacuum, and is unaffected by the ambient pressure) is used to track the submarine’s depth. It connects to Raspberry Pi Zero 2 W via I2C. A SparkFun TFMini-S Micro laser sensor provides a second means of measuring the submarine’s depth, but its accuracy is affected by the murky environments in which he was using it.

A more successful purchase was the radio board he harvested from a cheap Chinese toy submarine, having chosen it for its 27MHz radio frequency (needed to penetrate water) and its aesthetically pleasing controller. Raspberry Pi provides enough juice to power the board, so he decided to discard its LiPo battery in favour of a LEGO waterproof rechargeable battery pack.

Diving for pearls

In Submarines 2.0 and 3.0, he used lead pellets to provide extra weight, but they were quite sizable and took up valuable space inside the submarine’s frame. For this version, he splashed out on expensive 2.5 mm tungsten pellets weighing 18 g/cm3. Weighed on a kitchen scale, the submarine was 826 g, with a displacement of 1614 g. He added 580 g of tungsten pellets to make the submarine dive gently, making adjustments using the syringe.

To prevent entanglements while on manoeuvres, he attached a magnet on the inside top of the submarine frame so he could ‘fish’ the craft out of danger, if needs be. With lots of weeds and obstructions on the river bed, he was keen to avoid collisions, especially as it cost more than 600 EUR.

Thankfully, Submarine 4.0 has performed well in a range of environments from swimming pools and water tanks to a nearby river. “It drives well under water. The automatic depth control really makes controlling it easy, as you can focus on pressing only forward/backward and left/right buttons and forget the dive/surface buttons. I’d say the controls are as good as in Submarine 2.0, which has been the best so far,” he reports.

Nonetheless, as a perfectionist, he notes several areas for improvement.

From The MagPi store

Subscribe

Subscribe to the newsletter

Get every issue delivered directly to your inbox and keep up to date with the latest news, offers, events, and more.