Write Your Own X86 Bootloader

What if you want to make a very lean machine and do without any operating system? Or maybe you want to try to write your own OS, even just for the challenge or fun? Maybe you were reading up on a cool OS architecture and thought to yourself, “I can write that!”. Well, before diving into your code, you’d first have to write something called a bootloader.

A bootloader is code that runs early on in a PC’s, Mac’s, Raspberry Pi’s or microcontroller’s boot sequence, before anything like an operating system is up. Often its job is to set up minimal hardware, such as RAM, and then load the OS or your embedded code.

[Alex Parker] has written a three-part series of clear blog posts that make writing the bootloader part easy, at least for x86 machines. And the nice thing is that you don’t need an x86 to get started. He does it on a Mac using the QEMU processor emulator, though he also talks about doing it under Windows and Linux.

In the first part of the series, the bootloader leaves you in the x86’s real mode, with 16-bit instructions and access to one megabyte of memory — think pre-80286 days, or 1982 for those of us who were computing back then. To prove it works, he uses BIOS calls to display “Hello world!”. This also shows that through the BIOS, you have a set of peripherals you can work with.

In the second part, he shows how to set up 32-bit protected mode and a Global Descriptor Table, making access to a large amount of memory easier.

In the first two parts, the code is written in assembly, so in the third part he finishes the series by showing how to load C++ code into memory and execute it. That C++ code would of course be your application, which we’ll leave to your imagination.

It’s reasonably rare to write bootloader code for a desktop computer — much less so for microcontrollers. For instance, [Dmitry Grinberg] wrote his own bootloader so that he could have encrypted ROM images for his AVR on USB. And we’ve talked about [Lady Ada]’s guide to burning Arduino bootloaders. But if you want to get down to the bare metal on your x86, the bootloader is the place to start. And it’s not so bad.

Super squirter automatic water gun

Motion Activated Super-Squirter Stands Guard

Thieves beware. If you prowl around [Matthew Gaber]’s place, you get soaked by his motion activated super-squirter. Even if he’s not at home, he can aim and fire it remotely using an iPhone app. And for the record, a camera saves photos of your wetted-self to an SD card.

ESPino, ArduCAM UNO and voltage converter boards
ESPino, ArduCAM UNO and voltage converter boards

The whole security system is handled by three subsystems for target acquisition, photo documentation, and communications. The first subsystem is centered around an ESPino which utilizes a PIR sensor to detect motion. It then turns on a windscreen washer pump and uses pan and tilt servos to squirt water in a pattern toward the victim.

The target acquisition hardware also sends a message to the second subsystem, an ArduCAM ESP8266 UNO board. It takes a burst of photos using an ArduCAM Mini Camera mounted beside the squirter outlet. The UNO can also serve up a webpage with a collection of the photos.

The final subsystem is an iPhone app which talks to both the ESPino and the UNO board. It can remotely control the squirter and provide a video feed of what the camera sees.

One detail of the build we really enjoyed is the vacuum relief valve he fabricated himself. It prevents siphoning through the pump when it’s not on. Don’t miss a demo of the squirter in action after the break.

Continue reading “Motion Activated Super-Squirter Stands Guard”

Paperback: ePaper desktop monitor playing Doom

Hackaday Prize Entry: PaperBack Desktop EPaper Monitor

When we announced the Hackaday Prize with its Best Product category, [PK] polled his wife and co-workers about the idea of making a desktop monitor using 6″ 800×600 ePaper, which he has since built and calls the PaperBack. One such requirement for a monitor is to be able to connect to it using one of the usual desktop methods: VGA, DVI or HDMI. Given his previous experience making his own VGA card for the 2015 prize, he went with that. HDMI is in the works.

But it ended up being more than a desktop monitor. He first made a power and breakout board that a VGA input board would eventually connect to. To test it, he included a socket for plugging in an ESP32. With only one bodge he had the Hackaday logo displayed on the ePaper. He also now had the option of using it as a wireless internet connected display.

Moving on to VGA support, [PK] made a VGA input board using the MST9883 chip, which does the A/D conversion of the VGA RGB graphics signal and also recovers a pixel sampling clock from the HSYNC. His new VGA ePaper monitor has to identify itself to the VGA source, telling it dimensions, resolution and so on. This is called the EDID and was handled by the addition of an Atmel ATmega328 to the board. To finish it off, an LCMXO1200C FPGA does the high-speed conversions with the help of a 4 MBit SRAM framebuffer.

His very first test involved simply displaying the Hackaday logo using the ESP32, but now with the VGA input board he has it displaying Doom. Since it’s using ePaper it has only a 1-second refresh rate but it’s hard to come up with a more awesome way to proved that it works. He can also unplug it at any time and walk away with the latest screenshot intact. See it for yourself in the video below.

Continue reading “Hackaday Prize Entry: PaperBack Desktop EPaper Monitor”

Our Reactions To The Treatment Of Robots

Most of us have seen employees of Boston Dynamics kicking their robots, and many of us instinctively react with horror. More recently I’ve watched my own robots being petted, applauded for their achievements, and yes, even kicked.

Why do people react the way they do when mechanical creations are treated as if they were people, pets, or worse? There are some very interesting things to learn about ourselves when considering the treatment of robots as subhuman. But it’s equally interesting to consider the ramifications of treating them as human.

The Boston Dynamics Syndrome

Shown here are two snapshots of Boston Dynamics robots taken from their videos about Spot and Atlas. Why do scenes like this create the empathic reactions they do? Two possible reasons come to mind. One is that the we anthropomorphize the human-shaped one, meaning we think of it as human. That’s easy to do since not only is it human-shaped but the video shows it carrying a box using human-like movements. The second snapshot perhaps evokes the strongest reactions in anyone who owns a dog, though its similarity to any four-legged animal will usually do.

Is it wrong for Boston Dynamics, or anyone else, to treat robots in this way? Being an electronic and mechanical wizard, you might have an emotional reaction and then catch yourself with the reminder that these machines aren’t conscious and don’t feel emotional pain. But it may be wrong for one very good reason.

Continue reading “Our Reactions To The Treatment Of Robots”

SpiderMAV drone perching from the ceiling

SpiderMAV Drone Shoots Webs To Perch And Stabilize

Introducing your friendly neighborhood SpiderMAV, a micro aerial vehicle that shoots webbing to enable it to hang from ceilings and stabilize itself horizontally using low power. It’s inspired by the Darwin’s bark spider that spins a circular web with anchor lines up to 25 meters (82 feet) long.

SpiderMAV perching and stabilizing modules

For the DJI Matrice 100 drone to hang from a ceiling, a compressed gas cylinder fires a magnet with a trailing polystyrene line up to a steel beam. The line can then be reeled in to the desired length. For horizontal stabilization, line-trailing magnets are fired horizontally instead and then reeled in to tension the lines.

To test the effectiveness of the system, a cross wind was produced using a fan. With the DJI’s attitude-hold mode, maximum X, Y and Z deviations were 136, 386 and 106 mm respectively. With the stabilization, however, the deviations were reduced to 47, 80 and 74 mm. The power requirements were also reduced to essentially nil. Watch it in action in the videos below.

SpiderMAV is the brainchild of Imperial College London’s Aerial Robotics Laboratory, led by [Mirko Kovac], and is still experimental. For example, a magnet release mechanism has yet to be built in. Perhaps a sharp tug by the reeling mechanism, or a sudden thrust by the drone would release the magnets. Or the permanent magnets could be replaced with electromagnets, provided the required current doesn’t offset the efficiency gains. What solutions can you come up with? Let us know in the comments.

Continue reading “SpiderMAV Drone Shoots Webs To Perch And Stabilize”

Ben Franklin’s Weak Motor And Other Forgotten Locomotion

Most of the electric motors we see these days are of the electromagnetic variety, and for good reason: they’re powerful. But there’s a type of motor that was invented before the electromagnetic one, and of which there are many variations. Those are motors that run on high voltage, and the attraction and repulsion of charge, commonly known as electrostatic motors.

Ben Franklin — whose electric experiments are most frequently associated with flying a kite in a thunderstorm — built and tested one such high-voltage motor. It wasn’t very powerful, but was good enough for him to envision using it as a rotisserie hack. Food is a powerful motivator.

What follows is a walk through the development of various types of these motors, from the earliest ion propelled ones to the induction motors which most have never heard of before, even an HV hacker such as yours truly.

Continue reading “Ben Franklin’s Weak Motor And Other Forgotten Locomotion”

Test your speed

Modern Strongman Games Test Your Speed Instead

Step right up! What would a Makerfaire be without some carnival games? And being a Makerfaire, they could of course be modernized versions. In [avishorp]’s case, he made a series of games that test your speed and look very much like the old strongman game, aka high striker or strength tester.

In the strongman game, you smash a lever with all your might using a hammer. A puck on the other end of the lever then shoots up a tower, hopefully high enough to hit a bell, winning you a prize. In [avishorp]’s games the puck, tower and bell are all replaced with an LED strip. In the swipe game, the faster you swipe your hand sideways over two optical proximity sensors, the higher the LEDs light up. In the drum game, the speed with which you drum on a rubber disk with embedded accelerometer, the higher the LEDs light up. The chase and response games both involve buttons that you have to rapidly hit, to similar effect.

For the brains, each game is controlled by an Adafruit Trinket board. [Avishorp] chose to use the PlatformIO IDE instead of the Arduino IDE to write them, preferring its modern editor, but he didn’t like that it doesn’t print and that it doesn’t tell you the final file size. The latter issue caused him to overwrite the bootloader, something that he understandably considered a major inconvenience.

Check out his page for more details, Fritzing diagrams, links to code, and all game videos. Meanwhile we’ve included clips of the drum and swipe games below.

And if it’s more carnival games you’re looking for, how about this adult-sized Sit ‘n Spin made using a rear differential and axle assembly out of an old car or truck. Or maybe you prefer something less likely to make you woozy, in which case you can try fishing with the Bass Master 3000.

Continue reading “Modern Strongman Games Test Your Speed Instead”