Give Your RPi a Cool FPGA Hat

Need additional, custom IO for your Raspberry Pi? Adding an FPGA is a logical way to expand your IO, and allow for high speed digital interfaces. [Eric Brombaugh]’s Icehat adds a Lattice iCE5LP4K-SG48 FPGA in a package that fits neatly on top of the Raspberry Pi Zero. It also provides a few LEDs and Digilent compatible PMOD connectors for adding peripherals. The FPGA costs about six bucks, so this is one cheap FPGA board.

The FPGA has one time programmable memory, but can also be programmed over SPI. This allows the host Pi to flash the FGPA with the latest bitstream at boot. Sadly, this particular device is not supported by the open source Icestorm toolchain. Instead, you’ll need Lattice’s iCEcube2 design software. Fortunately, this chip is supported by the free license.

Icehat is an open source hardware design, but also includes a software application for flashing a bitstream to the FPGA from the Pi and an example application to get you started. All the relevant sources can be found on Github, and the PCB is available on OSHPark.

While this isn’t the first pairing of a Raspberry Pi and FPGA we’ve seen, it is quite possibly the smallest, and can be built by hand at a low cost.

What We Learned from the 2016 Queercon Badge

DEF CON has become known for the creative electronic badges, and now we get to see a variety of them dangling from lanyards every year. This year, the Queercon badge stood out as the one that got the most people asking “where did you get that?!” Once again, [Evan Mackay], [George Louthan], [Jonathan Nelson], and [Jason Painter] delivered an awesome badge for this con-within-a-con for LGBT hackers and their friends.

The badge is a squid shape, with a nifty clear solder mask, printed on black FR4, and routed with natural curved traces. The squid eyes consist of sixty cyan LEDs, with RGB LEDs on the tentacles. The eyes make expressions, and the tentacles light up with a selectable pattern. Hitting the “ink” button shoots your pattern out to all nearby devices using the 2.4 GHz radio on board, and a set of small connectors can be used to “mate” with other badges to learn patterns. Yes, the Queercon badge always has suggestive undertones.

After playing with it for the whole con, we think this badge has some good lessons for electronic badge designers:

Variable Brightness

The 2016 Queercon Badge with two hats
The Queercon Badge with Two Hats

This badge used a phototransistor as a light sensor to measure ambient light and set the brightness accordingly. With over 60 LEDs, this helped the two AA batteries last for nearly the entire conference.

Power Switches

This badge has a power switch. That switch turns the badge off. This probably sounds very obvious, but it’s also unfortunately uncommon on electronic badges. The switch means people turn the badge off at night, and don’t have to yank batteries when firmware glitches.


The badge had two expansion ports on the squid’s head for adding hats. These were given power, and the connector spec was published before the event. Our favourite? A unicorn horn with a rainbow LED inside.

Social Badges are Fun

This has been the fourth Queercon badge in a row that communicated with other badges to unlock things. This is actually a neat way to get people to interact, and leads to a whole host of suggestive puns. Badginal intercourse, anyone?

We’ve heard that next year’s badge is already in the works, and we look forward to seeing what these folks come up with next. For now, you can grab all the hardware design files and get inspired for your own electronic badge build.

Distributed, Open Source Chat with Vector and Matrix

When it comes to chat, you have many choices. Facebook Messenger, Google Talk, Whatsapp, Kik, and Slack are all viable options. However, all of these choices are proprietary, and require you to use servers that you can’t run yourself. They’re highly centralized, closed source tools.

In the open source world, IRC has been the go to solution for chat for many years, and for good reason. Anyone can run a server, there’s many clients, and it’s built on open standards. But IRC comes from a pre-mobile world, and relies on clients to maintain persistent connections to the server. It’s not the best experience on a phone. and aim to be a modern solution to chat. Matrix is a standard for passing messages around, and Vector is a chat solution built on top, with support for iOS, Android, and your browser.

What makes this solution different is the concept of Homeservers. A Homeserver manages messages for users, recording them when they are received and providing them to users when they connect. Homeservers also “federate” to communicate amongst each other. This means anyone can run a Homeserver and connect it to the greater network of Matrix, providing a distributed approach to building a chat network.

Under the hood, Matrix is just HTTP. You send messages into the network with POST requests, and receive new messages by polling with GET requests. This means no persistent connections are required, which is perfect for mobile and low power devices.

On the topic of devices, Matrix is designed for general purpose messaging, not just chat. It should be pretty simple to connect hardware up to Matrix, which would provide a simple way to get data in and out of connected devices. Since it’s all HTTP, a device based on the ESP8266 could hop into your chat room with relative ease.

Matrix and Vector are very much in beta, but are definitely usable and worth a try. To get started, you can create an account on and start chatting. We’re awaiting some of the features in the works, including end-to-end encryption, and hope to see some future hacks talking to the Matrix infrastructure.

Nanocounter: Frequency Counter with an Android UI

Have you ever started a project, run into an issue, started a new project to solve the issue, and completely forgot about the original project? [Andy] went down a rabbit hole of needing a tool to calibrate an MCU oscillator, but not having an accurate way to measure frequency. Most people would just buy a frequency counter and be done with it, but [Andy] decided to build his own.

The Nanocounter is an accurate, open source frequency counter that uses an Android phone as its display. It’s based on a high accuracy temperature compensated crystal oscillator (TCXO) fed into a phase locked loop (PLL) to create a high frequency, accurate reference clock.

This reference clock, along with the signal to be measured, are sent into a Xilinx FPGA which uses a method called equal precision measurement to determine the frequency. A STM32F072 microcontroller uses a SPI interface to get this data out of the FPGA, and controls the whole system. Finally, a cheap HC-06 Bluetooth module facilitates communication with an Android device.

The project achieves the goal of frequency counting, though [Andy] doesn’t remember what project sparked the idea to build it. (Classic yak shaving!) But the result is a great read of a detailed writeup, and you can watch a video of the Nanocounter in action after the break. That’s a win in our book.

Continue reading “Nanocounter: Frequency Counter with an Android UI”

Turn Your RPi 3 Into a BLE Beacon

With the launch of the Raspberry Pi 3, Bluetooth Low Energy (BLE) is now at our disposal. With BLE, there are a few technologies for implementing one-way beacons that broadcast data. Apple has been pushing iBeacon since 2013, and Google just launched their Eddystone solution last year.

If you’re looking to target Google’s Eddystone on your RPi 3, [Yamir] has you covered. He’s put together a guide on setting up an Eddystone-URL beacon within Raspbian. This type of beacon just broadcasts a URL. Users within range will get a notification that the URL is available, and can navigate through to it. Eddystone-URL works on both iOS and Android.

The process for setting this up is pretty simple. The hciconfig and hcitool commands do all the work. [Yamir] was even nice enough to make a calculator tool that generates the hcitool command for your own URL. While is hack is a simple one, it’s a nice five-minute project. It’s also handy for broadcasting the URL of your Raspberry Pi if it’s running a web server as part of a more intricate hack.

Converting an Electric Scooter to Lithium Batteries and Disabling the Safeties

There’s a bunch of different electric scooters available nowadays, including those hoverboards that keep catching fire. [TK] had an older Razor E300 that uses lead acid batteries. After getting tired of the low speeds and 12 hour charge times, [TK] decided it was time to swap for lithium batteries.

The new batteries were sourced from a Ryobi drill. Each provides 18 V, giving 36 V in series. The original batteries only ran at 24 V, which caused some issues with the motor controller. It refused to start up with the higher voltage. The solution: disable the safety shutdown relay on the motor controller by bridging it with a wire.

With the voltage issue sorted out, it was time for the current limit to be modified. This motor controller uses a TI TL494 to generate the PWM waveforms that drive a MOSFET to provide variable power to the motor. Cutting the trace to the TL494’s current sense pin removed the current limit all together.

We’re not saying it’s advisable to disable all current and voltage limits on your scooter, but it seems to be working out for [TK]. The $200 scooter now does 28 km/h, up from 22 km/h and charges much faster. With gearing mods, he’s hoping to eke out some more performance.

After the break, the full conversion video.

Continue reading “Converting an Electric Scooter to Lithium Batteries and Disabling the Safeties”

Icestudio: An Open Source Graphical FPGA Tool

If you’ve ever worked with FPGAs, you’ve dealt with the massive IDEs provided by the vendors. Xilinx’s ISE takes about 6 gigabytes, and Altera’s Quartus clocks in at over 10 gigs. That’s a lot of downloading proprietary software just to make an LED blink.

[Jesús Arroyo]’s Icestudio is a new, graphical tool that lets you generate Verilog code from block diagrams and run it on the Lattice Semi iCEstick development board. A drag and drop interface lets you connect IOs, logic gates, dividers, and other elements. Once your block diagram is ready, a single button press downloads the code to the iCEstick.

Under the hood, Icestudio uses IceStorm, which we’ve discussed on HaD in the past, including this great talk by [Clifford], Icestorm’s lead. For the GUI, Icestudio uses nw.js, which spits out JSON based on the block diagram. This JSON is converted into a Verilog file and a PCF file. The Verilog is used to create the logic on the FPGA, and the PCF is used to define the pin configuration for the device. Clicking on selected modules reveals the generated Verilog if you want to know what’s actually going on.

It’s experimental, but this looks like a neat way to get started on FPGAs without learning a new language or downloading many gigs of toolchains. We’re hoping Icestudio continues to grow into a useful tool for education and FPGA development. A demo follows after the break.

[Thanks to Nils for the tip!]

Continue reading “Icestudio: An Open Source Graphical FPGA Tool”