A Tutorial on Using Linux for Real-Time Tasks

[Andreas] has created this tutorial on real-time (RT) tasks in Linux. At first blush that sounds like a rather dry topic, but [Andreas] makes things interesting by giving us some real-world demos using a Raspberry Pi and a stepper motor. Driving a stepper motor requires relatively accurate timing. Attempting to use a desktop operating system for a task like this is generally ill-advised. Accurate timing is best left to a separate microcontroller. This is why we often see the Raspi paired with an Arduino here on Hackaday. The rationale behind this is not often explained.

[Andreas] connects a common low-cost 28BYJ-48 geared stepper motor with a ULN2003 driver board to a Raspberry Pi’s GPIO pins. These motors originally saw use moving the louvers of air conditioners. In general, they get the job done, but aren’t exactly high quality. [Andreas] uses a simple program to pulse the pins in the correct order to spin the motor. Using an oscilloscope, a split screen display, and a camera on the stepper motor, [Andreas] walks us through several common timing hazards, and how to avoid them.

The most telling hazard is shown last. While running his stepper program, [Andreas] runs a second program which allocates lots of memory. Eventually, Linux swaps out the stepper program’s memory, causing the stepper motor to stop spinning for a couple of seconds. All is not lost though, as the swapping can be prevented with an mlockall() call.

The take away from this is that Linux is not a hard real-time operating system. With a few tricks and extensions, it can do some soft real-time tasks. The best solution is to either use an operating system designed for real-time operation, or offload real-time operations to a separate controller.

Continue reading “A Tutorial on Using Linux for Real-Time Tasks”

The Stepper Driver Driver

KONICA MINOLTA DIGITAL CAMERA

The Stepstick and Pololu motor drivers are the heart of just about every Reprap electronics board, but they can go bad. The usual way of testing these things is to rig up a microcontroller on a breadboard, grab some cables, and wire something up. [Ken]’s Easy Stepper Motor Controller is a much simpler solution to the problem of testing these drivers and could, with a bit of practice, be constructed on a single-sided homebrew PCB.

The Easy Stepper Motor Controller is a very simple board with connections to a motor, a power supply, and headers for a single Pololu or Stepstick motor driver. Two buttons and a pot control the rotation of the motor with the help of an ATtiny10, and jumpers for up to 16x microstepping are right there on the board.

There’s a video after the break showing what this stepper motor driver driver can do. It’s not much, but if you’re just testing a driver, it’s all you need.
Continue reading “The Stepper Driver Driver”

The Most Beautiful Floppy Disk Jukebox Ever

Playing music on floppy drives is something that has been done to death. [kiu]’s RumbleRail is something else entirely. Yes, it’s still a collection of floppy drives playing MIDI files, but the engineering and build quality that went into this build puts it in a class by itself.

Instead of the usual assemblage of wires, power cords, and circuits that accompany most musical floppy drive builds, [kiu]’s is an exercise in precision and modularity. Each of the eight floppy drives are connected to its own driver with an ATMega16 microcontroller on board. The microcontrollers in these driver boards receive orders from the command board over an I2C bus. Since everything on the RumbleRail is modular, and the fact [kiu] is using DIP switches to set the I2C address of each board, this build could theoretically be expanded to 127 voices, or 127 individual floppy drives each playing their part of a MIDI file.

The RumbleRail can also operate in a standalone mode without the need for a separate computer feeding it data. MIDI files can be loaded off an SD card by the main controller board, and decode them for the floppy drivers.

If you’d like to build your own RumbleRail, all the board files, schematics, and firmware are up on [kiu]’s git. There are, of course, a few videos below of the floppy jukebox in action.

Continue reading “The Most Beautiful Floppy Disk Jukebox Ever”

Electronic Phenakistoscope!

phenakistoscope

Looking for a clever way to build a Phenakistoscope? Maybe you’re more familiar with its other names; Fantoscope, Phantasmascope, or perhaps its close cousin the Zoetrope?

If you’re still scratching your head, that’s okay — they have really weird names. What we’re referring to here is a type of optical illusion that mimics movement by showing a series of still images at an offset interval — this can be achieved by looking through slots, strobing a light (like in this case) or even by the use of mirrors.

This particular Phenakistoscope is a very simple but clever design that makes use of a recycled stepper motor from a printer, a CD as the animation disk, a strip of LED lighting, a few potentiometers and an Arduino to control the strobe. It works by synchronizing the strobe frequency with the motor rotation, resulting in the image in motion effect.

Stick around after the break for a full gallery of the build and a demonstration video.

Continue reading “Electronic Phenakistoscope!”

Four Cable Drawing Machine Pulls Our Strings

sandplotter

[David] has created a four cable drawing machine for the Telus Spark Science Centre in Canada. Hackaday has featured [David’s] unconventional drawing contraptions before, specifically his center pivot pen plotter. The drawing machine is a new take on a drawbot, and could be considered to be close cousins with [Dan’s] SkyCam. The premise is simple: A stepper motor with a reel of string is placed at each corner of a square. The strings for all four motors come together at a center weight. When all four strings are taut, the weight is lifted off the drawing surface. When a bit of slack is added into the strings, gravity pulls the weight down to touch the sand.

It’s at this point that a simple premise becomes a complex implementation. Moving the weight in one direction is a matter of reeling out string on one motor, and reeling in string on the other. But what about the two “un driven” strings? They have to be slack enough to allow movement in the driven direction, but not so slack that the weight can dig in and tumble on the sand, causing a tangle. To handle some of these questions, [David] called on [Kevin] to write some software. [Kevin] created a custom kinematics module for LinuxCNC to control the drawing machine. The drawing machine runs on Gerber Code, similar to a CNC. Simply feed the machine Cartesian coordinates, and [Kevin’s] module converts to steps.

Continue reading “Four Cable Drawing Machine Pulls Our Strings”

Raspi AC and Blinds Controller

raspiBlindsACController

[Chris’s] bedroom has a unique setup with an air conditioning unit perched on the wall next to the top of the blinds that cover his window. Normally, to open the blinds he had to tug on a cord and operating the AC meant fiddling with a remote control. Not anymore. Now [Chris] has an all-in-one Raspberry Pi-based solution to drive both.

The build uses a stepper motor salvaged from a printer to directly drive the blinds, with a familiar-looking Easy Driver connecting it to the Pi. The motor spins the blinds’ mechanism either open or closed, though at a modest pace that’s slow enough to provide the needed torque. [Chris] added an IR diode plugged into the Pi that imitates the air conditioning unit’s remote control, and simply pointed it directly at the unit’s receiver. An inexpensive WiFi dongle gets the Pi onto the network, allowing [Chris] to interact via a custom web interface. The interface itself not only provides a couple of clickable buttons, but a cleverly-designed status image indicating the position of the blinds.

Make sure you see the video below for a demonstration and for more details on the build. This is one of the better examples of home automation devices we’ve seen recently, especially considering it actually fits the “autonomous” implications discussed in our Ask Hackaday post from a few months back—although a relatively simple automation, [Chris’s] interface does allow for operating both the blinds and the AC on a preselected schedule.

Continue reading “Raspi AC and Blinds Controller”

Raspi Mini Laser Engraver

If you’ve got a lot of spare parts lying around, you may be able to cobble together your own laser engraver without too much trouble. We’ve already seen small engraver builds that use an Arduino, but [Jeremy] tipped us off to [Xiang Zhai’s] version, which provides an in-depth guide to building one with a Raspberry Pi.

[Xiang] began by opening up two spare DVD writeable drives, salvaging not only their laser diodes but the stepper motors and their accompanying hardware, as well as a handful of small magnets near each diode. To assemble the laser, he sourced an inexpensive laser diode module from eBay and used a vise to push the diode into the head of the housing. With the laser snugly in place and the appropriate connecting wires soldered on, [Xiang] whipped up a laser driver circuit, which the Raspi will later control. [Xiang] worked out the stepper motors’ configuration by following [Groover’s] engraver build-(we featured it a few years back)-attaching the plate that holds the material to be engraved onto one axis and the laser assembly to the other.

Check out [Xiang’s] project blog for details explaining the h-bridge circuits as well as the Python code for the Raspi. As always, if you’re attempting any build involving a laser, please use all necessary precautions! And if you need more information on using DVD burners for their diodes, check out this hack from earlier in the summer