Firmware Factory: Bit Fields vs Shift and Mask

Working with embedded systems usually involves writing code which will interface with hardware. This often means working on the register level. It doesn’t matter if we’re talking about a UART, an analog to digital converter, an LCD controller, or some other gizmo. Sooner or later, you’re going to have to break out the datasheets and figure out how to talk to an external device. To succeed at this you must become a master of bit manipulation.

Hardware designers don’t like wasting space, so modes, settings and other small pieces of information are often stored as packed bits. Our processors usually access things a byte (or a word) at a time, so what is the best way to handle this? Like so many other topics in software engineering, there are multiple ways to skin this cat. In C (and its derivatives) there are two major options: shift and mask, and bit fields.

Continue reading “Firmware Factory: Bit Fields vs Shift and Mask”

Hacklet 72 – Burning Man Projects

Burning Man is almost here! In just a few days, artists, hackers, makers, and engineers will converge on the Black Rock Desert in northern Nevada. They’ll endure the heat, the dust, and possibly a few bugs to create one of the largest outdoor art festivals in the world. Every year, the playa is covered with art cars, giant rolling barges, and fire-breathing animals covered in RGB LEDs. With so many projects to work on, it’s no surprise that quite a few Hackaday.io members (and Hackaday staffers) are burners. This week’s Hacklet is about some of the best Burning Man projects on Hackaday.io!

thedeepWe start with [David Nghiem] and “The Deep” – DC’s Sonic Jellyfish Art Cart. There’s just something calming about a watching a luminescent jellyfish floating serenely through the dark ocean. [David] and his team are recreating that effect in the desert with The Deep. They’re hanging a giant jellyfish in front of a golf cart. The medusa will be festooned with yards of silk and other types of fabric to create a flowing effect. Lighting will come from 8 RGB LED strips, controlled by 15 Teensy LCs. The Teensys will keep the lights flashing to the beat of the music. Burners can dance inside the sculpture, because this jellyfish thankfully has no sting.

anglerfishBicycles are the preferred mode of personal transportation at Burning Man. As you might imagine, it can be pretty hard to find your bike among all the other parked cycles. [Bob Baddeley] has made this a bit easier with Anglerfish for Bikes. Real anglerfish have an illicium, which is a stalk with a lighted tip that hangs just in front of their mouth. The bioluminescent light lures prey to the fish. [Bob] is using an RGB LED illuminated ball to lure him to his bike. This anglerfish started life as a blinky globe from Amazon. [Bob] removed the original electronics and replaced them with a Bluetooth radio on his own custom PCB. A simple press of a button gets the ball shimmering and blinking, leading [Bob] to his ride.

danceNext up is [Jeremy] with Interactive Disco Dance Floor. Inspired by Saturday Night Fever and the music video for Billy Jean, [Jeremy] is creating a dance floor that responds to those dancing on it. The floor is lit by 80 meters of 5050 RGB LEDs, controlled by ATmega168s. The ATmega168’s are connected to a capacitive sensor made up of a chicken wire grid. The system is sensitive enough to pick up feet even when wearing thick motorcycle boots. All the processors connect to a central computer via an RS-485 network. This allows the computer to take over and drive pre-programmed patterns to the floor. The PC side code is written in JavaScript, so it’s easy to modify.

jacketFinally, we have Hackaday.io’s own [Jasmine] with Glow Jacket. Walking around at night in Black Rock City can be dangerous. People running from party to party, high cyclists flying across the playa, you never know who might run into you! Having something to make sure you’re visible is a great start of a project. Keeping warm through the cold nights in the desert would be an added bonus. [Jasmine] sewed 32 feet of electroluminescent (EL) wire onto the back of a black parka. The wire ran to two AA battery-powered inverters hidden in the jacket. The hardest part turned out to be sewing all that EL wire to a jacket. Once all the stitching was done though, her husband [Ben] glows like a beacon in the night.

burning-thumb

Burners unite! [Jasmine] has set the Hacker Burners project page as a meeting place for all burners and fans of Burning Man. If you’re interested, join up! If you’d like to see more Burning Man projects, I’ve got you covered with our new Burning Man project list. If I missed your project, don’t hesitate to drop me a message on Hackaday.io. That’s it for this week’s Hacklet. As always, see you next week. Same hack time, same hack channel, bringing you the best of Hackaday.io!

Hollywood Finally Gets Hacking Right with Mr. Robot

Author’s note: I’m keeping spoilers out of this article, but they will surely show up in the comments.

A few weeks ago I started hearing about a new show on the USA network, Mr. Robot. The synopsis for the show was “Mr. Robot is a psychological thriller that follows a young programmer who works as a cyber-security engineer by day and a vigilante hacker by night.” Yeah, that sounds like another Hollywood crapfest. Cue crazy GUIs and virtual reality flybys representing hacking scenes. After watching the pilot though, I realized I couldn’t have been more wrong. I was hooked for the entire 10 week first season.

elliot-hacksLet’s start with the hacking, which is the whole reason this article is here on Hackaday. Show creator [Sam Esmail] isn’t a hacker himself, but he is tech savvy enough to see how poorly hacking has been portrayed on TV and in the movies. He knew he could do it better. The solution was good consultants, in the form of [Michael Bazzell] and others. The team helped shape the show into a rather realistic portrayal of hacking techniques. Elliot Alderson (Rami Malek), the main character, is the “vigilante” hacker described in the synopsis. Within the first 10 minutes of the pilot, he is turning a child pornographer in to the police. How does he catch the creeper? Tor exit node exploits, of course.

The onion routing protocol is not as anonymous as you think it is. Whoever’s in control of the exit nodes is also in control of the traffic, which makes me the one in control.

This is an accurate description of some of the exploits which have been demonstrated on the tor network. There aren’t any VR hacking scenes to be found either. In fact, several characters watch and make fun of the “flu shot” scene in Hackers. In this show, the command line isn’t hidden, it’s celebrated. We see every command the characters type, from netstat to CAN bus dumps. In one scene, Elliot even fires up a windows virtual machine so he can run DeepSound on his Kali Linux box.

The hacking isn’t all software either. Everyone’s favorite Linux single board computer is featured prominently in the first season. We can’t knock a show where a character looks at another and says “Ok, we all know what a Raspberry Pi is, what’s your point?”

Continue reading “Hollywood Finally Gets Hacking Right with Mr. Robot”

Hacklet 71 – Waterborne projects

Water: Life on earth wouldn’t exist without it. 71 percent of the Earth is covered by water. That only leaves 29 percent for us humans to live – and not all of that land is inhabitable. Water is so important that most human settlements start near water of some sort. Water to drink, or water to move goods. With all this water in oceans, lakes, and rivers, it is no surprise that hackers, makers, and engineers alike build some incredible projects that work on and under the water.

Continue reading “Hacklet 71 – Waterborne projects”

You Can Have my TIPs When You Pry them from my Cold, Dead Hands

We’ve seen a growing number of posts and recommendations around the net regarding components, specifically transistors. “Don’t use old parts” they cry,  “Go with newer components.”  You can often find these recommendations on Arduino forums. This all came to a head with a page called “Do Not TIP,” which was linked in the Arduino subreddit.  This page belongs to [Tom Jennings], creator of Fidonet, and one of the early authors of what would become Phoenix BIOS. [Tom] and a few others have been calling for everyone to send their old parts to the landfill – not use them, nor gift them to new experimenters. Get them out of the food chain. No offense to [Tom], but we have to disagree. These parts are still perfectly usable for experienced designers, and have a lot to offer new hardware hackers.

TIP is the part number prefix for a series of power transistors created by Texas Instruments.  In fact, “TIP” stands for Texas Instruments Power. The series was originally released in 1969. Yes, that’s right, 1969. Why are we still using parts designed when man first walked on the moon? The same reason people are still using the 555 timer: they’re simple, they’re easily available, they’re robust, and most of all, they get the job done. The TIP series has been used in thousands of classes, tutorials both online and off, and millions of projects over the years. Much of that documentation is already out there on the internet. The TIP series is also out in the distribution channel – they’ve been used for 40 years. Any retail shop that stocks a few electronics parts will have at least one of the TIP series.

The TIP series aren’t always the best transistors for the job. However, for most hobbyist-designed circuits, we don’t need the best performance, nor the best price – we’re going to use the parts we have on hand. There is always room to improve once you get the basic circuit working.

Continue reading “You Can Have my TIPs When You Pry them from my Cold, Dead Hands”

Hacklet 70 – Calculator Projects

Hackers, makers, and engineers have long had a love affair with number crunching. Specifically with the machines that make crunching numbers easier. Today it may be computers, smart watches, and smartphones, but that wasn’t always the case. In the 50’s and 60’s, Slide rules were the rage. Engineers would carry them around in leather belt pouches. By the early 70’s though, the pocket calculator revolution had begun. Calculators have been close at hand for hackers and engineers ever since. This week’s Hacklet celebrates some of the best calculator projects on Hackaday.io!

calc1We start with [Joey Shepard] and RPN Scientific Calculator. No equals sign needed here; [Joey] designed this calculator to work with Reverse Polish notation, just like many of HP’s early machines. Stacks are pretty important for RPN calculators, and this one has plenty of space with dual 200 layer stacks. The two main processors are MSP430s from Texas Instruments. The user interface are a 4 line x 20 character LCD and 42 hand wired buttons. The two processors are pretty ingenious. They communicate over a UART. One processor handles the keyboard and display, while the other concentrates on crunching the numbers and storing data in an SRAM. The case for this calculator is made from soldered up copper clad board. It’s mechanically strong especially since [Joey] added a bead of solder along each joint. If you want to learn more about this technique check out this guide on FR4 enclosures.

[Joey] definitely improved his solder skills with this project. Every wire and connection, including the full SRAM address and data bus were wired by hand on proto boards. We especially like the sweet looking laser cut keyboard on this project!
Continue reading “Hacklet 70 – Calculator Projects”

Oracle CSO to Customers: Leave the Vulnerabilities to Us

[Mary Ann Davidson], chief security officer of Oracle, is having a bad Tuesday. The internet has been alight these past few hours over a blog post published and quickly taken down from oracle’s servers. (archive) We’re not 100% sure the whole thing isn’t a hack of some sort. Based on [Mary’s] previous writing though, it seems to be legit.

The TL;DR version of Mary’s post is that she’s sick and tired of customers reverse engineering Oracle’s code in an attempt to find security vulnerabilities. Doing so is a clear violation of Oracle’s license agreement. Beyond the message, the tone of the blog says a lot. This is the same sort of policy we’re seeing on the hardware side from companies like John Deere and Sony. Folks like [Cory Doctorow] and the EFF are doing all they can to fight it. We have to say that we do agree with [Mary] on one point: Operators should make sure their systems are locked down with the latest software versions, updates, and patches before doing anything else.

[Mary] states that “Bug bounties are the new boy band”, that they simply don’t make sense from a business standpoint. Only 3% of Oracles vulnerabilities came from security researchers. The rest come from internal company testing. The fact that Oracle doesn’t have a bug bounty program might have something to do with that. [Mary] need not worry. Bug Bounty or not, she’s placed her company squarely in the cross-hairs of plenty of hackers out there – white hat and black alike.