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”

3D Printering: Blender Tips For Printable Objects

3D models drawn in Blender work great in a computer animated virtual world but don’t always when brought into a slicer for 3D printing. Slicers require something which makes sense in the real world. And the real world is far less forgiving, as I’ve found out with my own projects which use 3D printed parts.

Our [Brian Benchoff] already talked about making parts in Blender with his two-part series (here and here) so consider this the next step. These are the techniques I’ve come up with for preparing parts for 3D printing before handing them off to a slicer program. Note that the same may apply to other mesh-type modeling programs too, but as Blender is the only one I’ve used, please share your experiences with other programs in the comments below.

I’ll be using the latest version of Blender at this time, version 2.79b. My printer is the Crealty CR-10 and my slicer is Cura 3.1.0. Some of these steps may vary depending on your slicer or if you’re using a printing service. For example, Shapeways has instructions for people creating STLs from Blender for uploading to them.

Continue reading “3D Printering: Blender Tips For Printable Objects”

Friday Hack Chat: All About Crypto

What is crypto? Crypto means ‘hidden’, and it’s meant ‘hidden’ since before the Greek alphabet was written, but don’t let that stop you from arguing. For this week’s Hack Chat, we’re going to be talking all about cryptography, a medium of exchange for secrets. If you need confidentiality, integrity, or authenticity, you need cryptography.

Our guest for this week’s Hack Chat will be none other than Nick Sayer. Nick is a frequent attendee of the Hackaday meetups and he’s been building gadgets and gizmos and selling them on Tindie for years now. He’s given talks on design for manufacturing. This year, he designed and developed the Orthrus, an appliance that creates a cryptographically secured USB volume from two microSD cards. Basically, it’s like the Captain Planet team, only instead of rings, you need all the SD cards, and instead of Captain Planet, you summon your data.

For this week’s Hack Chat, we’re going to sit down with and talk about all things cryptography, including understanding what you need, what you don’t, and picking the correct tools. Items of interest will include:

  • When cryptography is needed
  • Cryptography tools
  • The best practices for cryptography

You are, of course, encouraged to add your own questions to the discussion. You can do that by leaving a comment on the Cryptography Hack Chat and we’ll put that in the queue for the Hack Chat discussion.

join-hack-chat

Our Hack Chats are live community events on the Hackaday.io Hack Chat group messaging. This week we’ll be sitting down on Friday, November 16th, at noon, Pacific time. If time zones got you down, we have a handy time zone converter.

Click that speech bubble to the right, and you’ll be taken directly to the Hack Chat group on Hackaday.io.

You don’t have to wait until Friday; join whenever you want and you can see what the community is talking about.

Hack My House: Opening Raspberry Pi to the Internet, but Not the Whole World

If you’ve followed along with our series so far, you know we’ve set up a network of Raspberry Pis that PXE boot off a central server, and then used Zoneminder to run a network of IP cameras. Now that some useful services are running in our smart house, how do we access those services when away from home, and how do we keep the rest of the world from spying on our cameras?

Before we get to VPNs and port forwarding, there is a more fundamental issue: Do you trust your devices? What exactly is the firmware on those cheap cameras really doing? You could use Wireshark and a smart switch with port mirroring to audit the camera’s traffic. How much traffic would you need to inspect to feel confident the camera never sends your data off somewhere else?

Thankfully, there’s a better way. One of the major features of surveillance software like Zoneminder is that it aggregates the feeds from the cameras. This process also has the effect of proxying the video feeds: We don’t connect directly to the cameras in order to view them, we connect to the surveillance software. If you don’t completely trust those cameras, then don’t give them internet access. You can make the cameras a physically separate network, only connected to the surveillance machine, or just set their IP addresses manually, and don’t fill in the default route or DNS. Whichever way you set it up, the goal is the same: let your surveillance software talk to the cameras, but don’t let the cameras talk to the outside world.

Edit: As has been pointed out in the comments, leaving off a default route is significantly less effective than separate networks. A truly malicious peice of hardware could easily probe for the gateway.

This idea applies to more than cameras. Any device that doesn’t need internet access to function, can be isolated in this way. While this could be considered paranoia, I consider it simple good practice. Join me after the break to discuss port forwarding vs. VPNs.

Continue reading “Hack My House: Opening Raspberry Pi to the Internet, but Not the Whole World”

Mechanisms: Lead Screws and Ball Screws

Translating rotary motion to linear motion is a basic part of mechatronic design. Take a look at the nearest 3D-printer or CNC router — at least the Cartesian variety — and you’ll see some mechanism that converts the rotation of the the motor shafts into the smooth linear motion needed for each axis.

Hobby-grade machines are as likely as not to use pulleys and timing belts to achieve this translation, and that generally meets the needs of the machine. But in some machines, the stretchiness of a belt won’t cut it, and the designer may turn to some variety of screw drive to do the job.

Continue reading “Mechanisms: Lead Screws and Ball Screws”

Fail of the Week: Leaf Blowers Can’t Fly

Leaf blowers, the main instrument of the suburban Saturday symphony, are one of the most useful nuisances. It doesn’t take much work with a rake to convince even the most noise-averse homeowner to head to the Big Box Store to pick one up to speed lawn chores. Once you do buy one, and feel the thrust produced by these handheld banshees, you might wonder, If I let go of this thing, would it fly? 

[Peter Sripol] had that very thought and set about building a couple of leaf blower powered planes to answer the question. It’s probably not a spoiler alert to report that the answer is no, but the video below is a fun watch anyway. The surprising thing is just how close both planes came to succeeding. The first plane was a stripped-down Ryobi two-stroke leaf blower suspended from a giant wing and tail section that very nearly got off the ground. Version 1.1 gained a retractable electric boost propeller – strictly for take-offs – and lost a lot of excess weight. That plane practically leaped into the air, but alas, servo problems prevented [Peter] from shutting down the electric and flying on Ryobi alone. Even a servo fix couldn’t save the next flight, which cratered right after takeoff. A version 2.0, this time using a brutally modified electric leaf blower, was slightly more airworthy but augured in several times before becoming unflyable.

What can we learn from all this? Not much other than it would take a lot of effort to make a leaf blower fly. We appreciate all of [Peter]’s hard work here, but we think he’s better off concentrating on his beautiful homebrew ultralight instead.

Continue reading “Fail of the Week: Leaf Blowers Can’t Fly”

New Part Day: A $6 Linux Computer You Might Be Able To Write Code For

The latest news from the world of cheap electronics is a single board computer running Linux. It costs six dollars, and you can buy it right now. You might even be able to compile code for it, too.

The C-Sky Linux development board is listed on Taobao as an ‘OrangePi NanoPi Raspberry Pi Linux Development Board” and despite some flagrant misappropriation of trademarks, this is indeed a computer running Linux, available for seven American dollars.

This board is based on a NationalChip GX6605S SoC, a unique chip with an ISA that isn’t ARM, x86, RISC-V, MIPS, or anything else that would be considered normal. The chip itself was designed for set-top boxes, but there are a surprising number of build tools that include buildroot, GCC and support for qemu. The company behind this chip is maintaining a kernel, and support for this chip has been added to the mainline kernel. Yes, unlike many other single board computers out there, you might actually be able to compile something for this chip.

The features for this board include 64 MB of DDR2 RAM, HDMI out (with a 1280 x 720 framebuffer, upscaled to 1080p, most likely), and a CPU running at just about 600 MHz. There are a few buttons connected to the GPIO pins, two USB host ports, a USB-TTL port for a serial console, and a few more pins for additional GPIOs. There does not appear to be any networking, and we have no idea what the onboard storage is.

If you want a challenge to get something compiled, this is the chip for you.