FPGA Testbenches Made Easier

You finally finish writing the Verilog for that amazing new DSP function that will revolutionize human society and make you rich. Does it work? Your first instinct, of course, is to blow it into your FPGA of choice and see if it works. If it does, that was a great idea. If it doesn’t, it was a terrible idea because — typically — it is hard to look inside the FPGA. That’s why you’ll typical simulate your logic on a desktop computer before you commit it to the FPGA. But that means you have to delay gratification long enough to write a testbench — a piece of hardware description language (HDL) code that exercises the function you wrote. In this post I’ll show you a small piece of software that can read your Verilog module and automatically create most of a testbench for you. The code originally came from GitHub, but I wanted to make some changes to it, so I forked it and I’ll tell you about the changes I made. This isn’t specific to a particular FPGA. Any Verilog project can use the tool to generate a simple starter testbench.

Writing a testbench isn’t that hard. You usually use the same language you wrote the original code in but since it won’t reside in silicon, you can do things in the simulator that you can’t get away with in code that you’ll synthesize. However, it is a bit painful to have to always write more or less the same code, especially if you have a lot of modules you want to test. But it is a good idea to test small modules before linking them together and then test them linked together, too. With this little Python script, it is very easy to generate a simple testbench and then further elaborate it. It isn’t life-changing, but it does save some time. If you want to try this out, you’ll need something to run the Python script on, of course. You also need a Verilog simulator or you can use EDA Playground to try all this out in your browser.

Continue reading “FPGA Testbenches Made Easier”

Turning A Rotary Tool Into A CNC

Now that 3D printers are everywhere, electronics are cheap, and open source software is extremely capable, just about anyone can build a CNC machine. That’s exactly what [Nikodem] did by turning a Dremel tool into an extremely capable CNC machine that’s able to cut MDF and acrylic and can engrave aluminum.

The electronics for the build are just an Arduino Uno, a motor driver sheld running GRBL, a relay for the Dremel, a few motor drivers, and a big ‘ol 30 A power supply. The build uses NEMA 17 motors, two on the Y-axis and one each on the X and Z. The CNC has a fantastically strong frame despite the 3D printed parts. It is constructed out of aluminum extrusion, with the carriages riding on some nice straight rods.

As for how well this CNC machine works, it’s pretty good. With the Gcode to cut an 80mm diameter circle out of MDF, this machine managed to cut a circle that was 80.02 mm in diameter. That’s pretty good, and getting into the territory that the error is probably in the cheap set of calipers, not the finished part itself. It’s an awesome build, and [Nikodem] has everything documented in his four-part video series. You can check the end of that out below.

Continue reading “Turning A Rotary Tool Into A CNC”

Supercon: Designing Your Own Diffractive Optics

Kelly Peng is an electrical and optical engineer, and founder of Kura AR. She’s built a fusion reactor, a Raman spectrometer, a DIY structured light camera, a linear particle accelerator, and emotional classifiers for likes and dislikes. In short, we have someone who can do anything, and she came in to talk about one of the dark arts (pun obviously intended): optics.

The entire idea of Kura AR is to build an immersive augmented reality experience, and when it comes to AR glasses, there are two ways of doing it. You could go the Google Glass route and use a small OLED and lenses, but these displays aren’t very bright. Alternatively, you could use a diffractive waveguide, like the Hololens. This is a lot more difficult to manufacture, but the payoff will be a much larger field of view and a much more immersive experience.

Continue reading “Supercon: Designing Your Own Diffractive Optics”

Delta Bot Plucks Out Tunes On A Mandolin

Is there no occupation safe from the scourge of robotic replacement? First it was the automobile assemblers, then fast food workers, and now it’s the — mandolin players?

Probably not, unless [Clayton Darwin]’s mandolin playing pluck-bot has anything to say about it. The pick-wielding delta-ish robot can be seen in action in the video below, plucking out the iconic opening measures of that 70s prom-theme favorite, “Colour My World.” The robot consists of two stepper motors connected to a hinged wooden arm by two pushrods. We had to slow the video down to catch the motion, but it looks like [Clayton] has worked out the kinematics so that the pick can be positioned in front of any of the mandolin’s eight strings. A quick move of the lower stepper then flicks the pick across a string and plucks it. [Clayton] goes into some detail about how he built the motion-control part in an earlier video; he also proves that steppers are better musicians than we’ll ever be with a little “Axel F” break.

It’s only a beginning, of course, but the complexity of the kinematics just goes to show how simple playing an instrument isn’t. Unless, of course, you unleash an endless waterfall of marbles on the problem.

Continue reading “Delta Bot Plucks Out Tunes On A Mandolin”

Smooth Moves From Cheap Motors

Building an electric motor isn’t hard or technically challenging, but these motors have very little in the way of control. A stepper motor is usually employed in applications that need precision, but adding this feature to a motor adds complexity and therefore cost. There is a small $3 stepper motor available, but the downside to this motor is that it’s not exactly the Cadillac of motors, nor was it intended to be. With some coaxing, though, [T-Kuhn] was able to get a lot out of this small, cheap motor.

To test out the motors, [T-Kuhn] built a small robotic arm. He began by programming his own pulse generating algorithm that mimics a sine wave in order to smooth out the movement of the motor. An Arduino isn’t fast enough to do these computations, though, so he upgraded to using the ESP32. He also was able to implement the inverse kinematics on his own. The result of all this work for a specific platform and motor type is a robotic arm that has a very low cost but delivers performance of much more expensive hardware.

The robot arm was built by [T-Kuhn] too, and all of the details on that build, as well as all the schematics and code, are available on the project site if you need a low-cost robot arm or a good stepper motor controller for a low cost. There are many other ways of getting the most out of other types of low-cost motors as well.

Continue reading “Smooth Moves From Cheap Motors”

How’s A Gyro Work?

It wasn’t long ago that a gyro — or gyroscope — was an exotic piece of electronics gear. Most of us only saw them as children’s toys that would balance on your finger. That’s changed, though, thanks to microelectronics. Now your game controller, your phone, and your drone all probably use little ICs that are actually three-axis gyroscopes. Ever wonder how they work and what they do? [RCModelReviews] has a video that covers three kinds of gyros: old mechanical gyros, modern MEMS gyros, and even an exotic laser-based gyro. (YouTube, embedded below.)

Gyroscopes allow you to detect orientation by detecting linear forces on a rotating element. They are used in everything from spacecraft to submarines. The device has many origins dating back to antiquity. But the modern gyro showed up around 1800 or so. The children’s toy appeared in 1917 and is still made today.

Continue reading “How’s A Gyro Work?”

Magnets And Printed Parts Make Quick-Disconnect Terminals

The Apple MagSafe power connector is long gone from their product line, but that doesn’t mean that magnetic connectors aren’t without their charms. It just takes the right application, and finding one might be easier with these homebrew magnetic connectors.

We’ll admit that the application that [Wesley Lee] found for his magnetic connectors is perhaps a little odd. He’s building something called Linobyte, a hybrid art and electronics project that pays homage to computing history with very high-style, interactive core memory modules. The connectors are for the sense wire that is weaved through the eight toroids on each module, to program it with a single byte. Each connector has a 3D-printed boot that holds a small, gold-plated neodymium magnet with the sense wire soldered to it. A socket holds another magnet to the underside of a PCB. The magnet in the boot sticks to the PCB and makes contact with pads, completing the circuit. We know what you’re thinking: heating a magnet past the Curie point is a great way to ruin it. [Wesley] admits that happens, but it just makes the connection a little weaker, which works for his application. The short video below shows how he puts them together.

We can think of a couple of ways these connectors would be useful, and we really like the look of the whole project. It’ll be interesting to see where it goes, but in the meantime, brushing up on how magnets work could be fun. Continue reading “Magnets And Printed Parts Make Quick-Disconnect Terminals”